修复考勤模块、修复授权管理员部分bug

This commit is contained in:
魏少阳 2024-02-29 17:31:30 +08:00
parent 0f58f3c757
commit a628860c9c
49 changed files with 867 additions and 540 deletions

View File

@ -459,7 +459,7 @@
97C146E61CF9000F007C117D /* Project object */ = { 97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1430; LastUpgradeCheck = 1300;
ORGANIZATIONNAME = ""; ORGANIZATIONNAME = "";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {

View File

@ -292,6 +292,28 @@ class AuthorizedAdminLogic extends BaseGetXController {
} }
} }
// isOn:: 1 2
Future<void> updateRoomCheckIn() async {
// var entity = await ApiRepository.to
// .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
// if (entity.errorCode!.codeIsSuccessful) {
// print("标记为已入住成功啦啦啦啦啦");
// Toast.show(msg: "标记成功");
// setState(() {});
// } else {
// Toast.show(msg: '操作失败');
// }
var entity = await ApiRepository.to.setRoomStatusData(
lockId: state.keyInfo.value.lockId!,
roomStatus: 1,
);
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
showToast("标记成功");
}
}
// //
void _showDialog(String errMsg) { void _showDialog(String errMsg) {
showCupertinoDialog( showCupertinoDialog(

View File

@ -12,6 +12,7 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/NativeInteractionTool.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
@ -285,9 +286,15 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
height: 10.h, height: 10.h,
), ),
OutLineBtn( OutLineBtn(
btnName: '邮件通知', btnName: state.emailOrPhoneController.text.contains("@")?'邮件通知':"短信通知",
onClick: () { onClick: () {
Navigator.pushNamed(context, Routers.sendEmailNotificationPage); if(state.emailOrPhoneController.text.contains("@")){
Get.toNamed(Routers.sendEmailNotificationPage);
}else{
// _openModalBottomSheet();
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
}, },
), ),
SizedBox( SizedBox(
@ -295,7 +302,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
), ),
OutLineBtn( OutLineBtn(
btnName: '微信通知', btnName: '微信通知',
onClick: () {}, onClick: () {
// _openModalBottomSheet();
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
},
), ),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
@ -303,36 +313,13 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
OutLineBtn( OutLineBtn(
btnName: '标记为:已入住', btnName: '标记为:已入住',
onClick: () { onClick: () {
updateRoomCheckIn(); logic.updateRoomCheckIn();
}, },
), ),
], ],
); );
} }
// isOn:: 1 2
Future<void> updateRoomCheckIn() async {
// var entity = await ApiRepository.to
// .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
// if (entity.errorCode!.codeIsSuccessful) {
// print("标记为已入住成功啦啦啦啦啦");
// Toast.show(msg: "标记成功");
// setState(() {});
// } else {
// Toast.show(msg: '操作失败');
// }
var entity = await ApiRepository.to.setRoomStatusData(
lockId: state.keyInfo.value.lockId!,
roomStatus: 1,
);
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
logic.showToast("标记成功");
setState(() {});
}
}
// //
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) { Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
return SizedBox( return SizedBox(
@ -400,6 +387,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
.phoneNumbers![0] .phoneNumbers![0]
.replaceAll(RegExp(r"\s+\b|\b\s"), ""); .replaceAll(RegExp(r"\s+\b|\b\s"), "");
} }
if (currentContact.fullName!.isNotEmpty) {
state.keyNameController.text = currentContact.fullName!;
}
}); });
}, },
), ),
@ -428,4 +419,116 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
String intToStr(int v) { String intToStr(int v) {
return (v < 10) ? "0$v" : "$v"; return (v < 10) ? "0$v" : "$v";
} }
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
constraints: BoxConstraints(maxHeight: 270.h),
builder: (BuildContext context) {
return Column(
children: [
SizedBox(
width: ScreenUtil().screenWidth,
height: 180.h,
child: ListView(
scrollDirection: Axis.horizontal, //
children: initBottomSheetList()),
),
Container(
height: 8.h,
color: AppColors.greyBackgroundColor,
),
TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消',
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
onPressed: () {
Navigator.pop(context);
},
)
],
);
});
}
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
return widgetList;
}
GestureDetector buildCenter3(String imageName, String titleStr, int itemIndex) {
return GestureDetector(
child: Container(
width: 120.w,
// height: 64.h,
margin:
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
imageName,
width: 50.w,
height: 50.h,
),
SizedBox(
height: 16.w,
),
Text(
titleStr,
style: TextStyle(
fontSize: ScreenUtil().setSp(20), color: Colors.black),
),
],
),
),
onTap: () => _jumpSmartDeviceRoute(itemIndex),
);
}
//\n生效时间${itemData.startDate}\n类型\n锁名${itemData.keyboardPwdName}
_jumpSmartDeviceRoute(int itemIndex) {
Get.back();
switch (itemIndex) {
case 0:
//
{
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
break;
case 1:
//
{
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
break;
case 2:
//
{
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
}
break;
case 3:
//
{
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
break;
default:
}
}
} }

View File

@ -29,6 +29,9 @@ class AuthorizedAdminState {
var weekdaysList = [].obs; var weekdaysList = [].obs;
var isCreateUser = false.obs; //1 0 var isCreateUser = false.obs; //1 0
final widgetType = 0.obs;
String pwdShareStr = '您好,您的授权管理员生成成功';
var addUserId = ''.obs; var addUserId = ''.obs;
AuthorizedAdminState() { AuthorizedAdminState() {
Map map = Get.arguments; Map map = Get.arguments;

View File

@ -11,7 +11,6 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showIosTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
// import 'package:flutter_pickers/pickers.dart'; // import 'package:flutter_pickers/pickers.dart';
@ -258,17 +259,31 @@ class _VolumeAuthorizationLockPageState
controller: editController, controller: editController,
// //
maxLines: 1, maxLines: 1,
// controller: _controller, inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
],
autofocus: false, autofocus: false,
textAlign: TextAlign.end, textAlign: TextAlign.end,
decoration: InputDecoration( decoration: InputDecoration(
// //
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr, hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp), hintStyle: TextStyle(fontSize: 22.sp),
//线 focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: InputBorder.none, disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
), ),
// decoration: InputDecoration(
// //
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// hintText: tfStr,
// hintStyle: TextStyle(fontSize: 22.sp),
// //线
// border: InputBorder.none,
// ),
), ),
), ),
SizedBox( SizedBox(
@ -295,6 +310,9 @@ class _VolumeAuthorizationLockPageState
.phoneNumbers![0] .phoneNumbers![0]
.replaceAll(RegExp(r"\s+\b|\b\s"), ""); .replaceAll(RegExp(r"\s+\b|\b\s"), "");
} }
if (currentContact.fullName!.isNotEmpty) {
_keyNameController.text = currentContact.fullName!;
}
}); });
}, },
), ),

View File

@ -29,11 +29,15 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
late TabController _tabController; late TabController _tabController;
final List<ItemView> _itemTabs = <ItemView>[ final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
]; ];
@override @override
@ -43,7 +47,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
_tabController = TabController( _tabController = TabController(
vsync: this, vsync: this,
length: _itemTabs.length, length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
initialIndex: widget.initialIndex); initialIndex: widget.initialIndex);
_tabController.addListener(() { _tabController.addListener(() {
if (_tabController.animation!.value == _tabController.index) { if (_tabController.animation!.value == _tabController.index) {
@ -69,7 +73,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
onTap: (index) { onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true, isScrollable: true,
indicatorColor: Colors.red, indicatorColor: Colors.red,
unselectedLabelColor: Colors.black, unselectedLabelColor: Colors.black,
@ -101,13 +105,10 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
return Expanded( return Expanded(
child: TabBarView( child: TabBarView(
controller: _tabController, controller: _tabController,
children: _itemTabs children:
.map((ItemView item) => AddCardPage( widget.fromType == 1
selectType: item.selectType, ? _itemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList()
lockId: widget.lockId, : _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList(),
fromType: widget.fromType,
fromTypeTwoStaffName: widget.fromTypeTwoStaffName))
.toList(),
), ),
); );
} }

View File

@ -40,7 +40,8 @@ class _AddCardPageState extends State<AddCardPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
state.selectType.value = widget.selectType; state.selectType.value = widget.selectType;
state.lockId.value = widget.lockId; state.lockId.value = widget.lockId;
// state.nameController.text = widget.fromTypeTwoStaffName; state.nameController.text = widget.fromTypeTwoStaffName;
state.fromType.value = widget.fromType;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
// Your code here // Your code here

View File

@ -308,14 +308,6 @@ class AddICCardLogic extends BaseGetXController{
weekDay: state.weekDay.value, weekDay: state.weekDay.value,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("添加成功");
if(state.fromType.value == 2){
//
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(entity.data!.cardId.toString()));
}else if(state.fromType.value == 1){
eventBus.fire(OtherTypeRefreshListEvent());
}
Get.close(2);
updateIdCardUserNoLoadData(entity.data!.cardId.toString()); updateIdCardUserNoLoadData(entity.data!.cardId.toString());
} }
} }
@ -335,6 +327,14 @@ class AddICCardLogic extends BaseGetXController{
// eventBus.fire(OtherTypeRefreshListEvent()); // eventBus.fire(OtherTypeRefreshListEvent());
// } // }
// Get.close(2); // Get.close(2);
showToast("添加成功");
if(state.fromType.value == 2){
//
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.cardNumber.value));
}else if(state.fromType.value == 1){
eventBus.fire(OtherTypeRefreshListEvent());
}
Get.close(2);
} }
} }

View File

@ -118,49 +118,51 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
Widget _buildMainUI() { Widget _buildMainUI() {
return Obx(() => state.fingerprintItemListData.value.isNotEmpty return Obx(() => state.fingerprintItemListData.value.isNotEmpty
? ListView.separated( ? SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.fingerprintItemListData.value.length, itemCount: state.fingerprintItemListData.value.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index]; FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
return Slidable( return Slidable(
key:ValueKey(fingerprintItemData.fingerprintId), key:ValueKey(fingerprintItemData.fingerprintId),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
SlidableAction( SlidableAction(
onPressed: (BuildContext context){ onPressed: (BuildContext context){
showIosTipViewDialog(context); showIosTipViewDialog(context);
}, },
backgroundColor: Colors.red, backgroundColor: Colors.red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
label: '删除', label: '删除',
), ),
], ],
), ),
child: _keyItem( child: _keyItem(
'images/icon_card.png', 'images/icon_card.png',
fingerprintItemData.cardName!, fingerprintItemData.cardName!,
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", (fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
fingerprintItemData.validTimeStr!, fingerprintItemData.validTimeStr!,
() async { () async {
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.cardDetailPage, arguments: { Routers.cardDetailPage, arguments: {
"fingerprintItemData": fingerprintItemData, "fingerprintItemData": fingerprintItemData,
}); });
if (data != null) { if (data != null) {
logic.getICCardListData(); logic.getICCardListData();
} }
}), }),
); );
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (BuildContext context, int index) {
return const Divider( return const Divider(
height: 1, height: 1,
color: AppColors.greyLineColor, color: AppColors.greyLineColor,
); );
}, },
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)); ),
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
} }
void showIosTipViewDialog(BuildContext context) { void showIosTipViewDialog(BuildContext context) {

View File

@ -10,6 +10,17 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
// //
void editFingerprintsData() async{ void editFingerprintsData() async{
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
showToast("生效时间需大于当前时间");
return;
}
var entity = await ApiRepository.to.editFingerprintsData( var entity = await ApiRepository.to.editFingerprintsData(
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(), fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
lockId: state.fingerprintItemData.value.lockId.toString(), lockId: state.fingerprintItemData.value.lockId.toString(),
@ -32,6 +43,18 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
// iC卡 // iC卡
void editICCardData() async{ void editICCardData() async{
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
showToast("生效时间需大于当前时间");
return;
}
var entity = await ApiRepository.to.editICCardData( var entity = await ApiRepository.to.editICCardData(
cardId: state.fingerprintItemData.value.cardId.toString(), cardId: state.fingerprintItemData.value.cardId.toString(),
lockId: state.fingerprintItemData.value.lockId.toString(), lockId: state.fingerprintItemData.value.lockId.toString(),

View File

@ -76,11 +76,8 @@ class _OtherTypeKeyChangeDatePageState
Pickers.showDatePicker(context, mode: DateMode.YMDHM, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
setState(() { setState(() {
state.beginTimeTimestamp.value = DateTime.parse( state.beginTime.value = "${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}') state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
.millisecondsSinceEpoch;
state.beginTime.value =
"${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
}); });
}); });
})), })),
@ -92,11 +89,8 @@ class _OtherTypeKeyChangeDatePageState
Pickers.showDatePicker(context, mode: DateMode.YMDHM, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
setState(() { setState(() {
state.endTimeTimestamp.value = DateTime.parse( state.endTime.value = "${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}') state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
.millisecondsSinceEpoch;
state.endTime.value =
"${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
}); });
}); });
})), })),

View File

@ -5,7 +5,7 @@ import 'checkingInDetail_entity.dart';
class CheckingInDetailState{ class CheckingInDetailState{
final getKeyInfosData = LockListInfoItemEntity().obs; // final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
final staffId = 0.obs; final staffId = 0.obs;
@ -17,7 +17,7 @@ class CheckingInDetailState{
final monthListData = <MonthList>[].obs; final monthListData = <MonthList>[].obs;
CheckingInDetailState() { CheckingInDetailState() {
Map map = Get.arguments; Map map = Get.arguments;
getKeyInfosData.value = map["getKeyInfosData"]; // getKeyInfosData.value = map["getKeyInfosData"];
companyId.value = map["companyId"]; companyId.value = map["companyId"];
staffId.value = map["staffId"]; staffId.value = map["staffId"];
} }

View File

@ -36,7 +36,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: [
(state.getKeyInfosData.value.isLockOwner == 1 && state.getKeyInfosData.value.keyRight == 1) ? (state.getKeyInfosData.value.keyRight == 1) ?
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
@ -67,7 +67,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
Widget topInfo() { Widget topInfo() {
return Container( return Container(
width: 1.sw, width: 1.sw,
height: 280.h, // height: 280.h,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
children: [ children: [
@ -81,8 +81,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
borderRadius: BorderRadius.circular(60.w), borderRadius: BorderRadius.circular(60.w),
), ),
child: Image.asset(getTopImg(), width: 120.w, height: 120.w) child: Image.asset(getTopImg(), width: 120.w, height: 120.w)
) )),
),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Obx(() => Text(getTopTitle(), style: TextStyle(color: Colors.black, fontSize: 24.sp))), Obx(() => Text(getTopTitle(), style: TextStyle(color: Colors.black, fontSize: 24.sp))),
SizedBox(height: 30.h), SizedBox(height: 30.h),
@ -168,7 +167,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if(isDemoMode == false){ if(isDemoMode == false){
await showDialog( await showDialog(
context: context, context: Get.context!,
builder: (context) { builder: (context) {
return ShowCalendar( return ShowCalendar(
datePickerMode: DatePickerMode.day, datePickerMode: DatePickerMode.day,
@ -262,7 +261,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index]; AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index];
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName,() { return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName,() {
Get.toNamed(Routers.checkingInDetailPage, arguments: { Get.toNamed(Routers.checkingInDetailPage, arguments: {
"getKeyInfosData": state.getKeyInfosData.value, // "getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value, "companyId": state.companyId.value,
"staffId": attendanceRecordList.staffId, "staffId": attendanceRecordList.staffId,
}); });
@ -297,18 +296,18 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
height: 80.h, // height: 80.h,
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
), ),
child: Row( child: Row(
children: [ children: [
SizedBox(width: 30.w,), SizedBox(width: 20.w,),
Text("${index+1}", style: TextStyle(fontSize: 20.sp),), Text("${index+1}", style: TextStyle(fontSize: 20.sp),),
SizedBox(width: 20.w,), SizedBox(width: 20.w,),
Image.asset('images/controls_user.png', width: 40.w, height: 40.w,), Image.asset('images/controls_user.png', width: 60.w, height: 60.w,),
// Container( // Container(
// width: 60.h, // width: 60.h,
// height: 60.h, // height: 60.h,

View File

@ -96,9 +96,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
return; return;
} }
if (int.parse(state.beginTimeTimestamp.value) > if (int.parse(state.beginTimeTimestamp.value) > int.parse(state.endTimeTimestamp.value)) {
int.parse(state.endTimeTimestamp.value)) { logic.showToast("结束时间必须要比开始时间晚,请重新选择");
logic.showToast("结束时间不能大于开始时间");
return; return;
} }
if (state.pushType.value == "2") { if (state.pushType.value == "2") {

View File

@ -129,18 +129,16 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
allHeight: 60.h, allHeight: 60.h,
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: GestureDetector( action: (){
onTap: () { setState(() {
setState(() { state.isSingledayWeekend.value = 0;
state.isSingledayWeekend.value = 1; state.weekDays.value = [1, 2 , 3, 4, 5, 6];
state.weekDays.value = [1, 2 , 3, 4, 5, 6]; });
}); },
}, rightWidget: Row(
child: Row( children: [
children: [ Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), ],
],
),
) )
)), )),
Obx(() => CommonItem( Obx(() => CommonItem(
@ -149,18 +147,16 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
allHeight: 60.h, allHeight: 60.h,
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: GestureDetector( action: (){
onTap: () { setState(() {
setState(() { state.isSingledayWeekend.value = 1;
state.isSingledayWeekend.value = 2; state.weekDays.value = [6, 7];
state.weekDays.value = [1, 2 , 3, 4, 5]; });
}); },
}, rightWidget: Row(
child: Row( children: [
children: [ Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), ],
],
),
) )
)), )),
], ],
@ -210,23 +206,22 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
allHeight: 60.h, allHeight: 60.h,
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: GestureDetector( action: (){
onTap: () { setState(() {
setState(() { state.isSingledayWeekend.value = 2;
state.isSingledayWeekend.value = 2; if(state.weekDays.value.contains(index)){
if(state.weekDays.value.contains(index)){ state.weekDays.value.remove(index);
state.weekDays.value.remove(index); }else{
}else{ state.weekDays.value.add(index);
state.weekDays.value.add(index); }
} state.weekDays.value.sort();
state.weekDays.value.sort(); });
}); },
}, rightWidget: Obx(() => Row(
child: Obx(() => Row( children: [
children: [ Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), ],
], ))
)))
); );
} }
), ),

View File

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../network/api_repository.dart'; import '../../../../../network/api_repository.dart';
@ -15,55 +16,23 @@ class CheckingInAddStaffLogic extends BaseGetXController{
StreamSubscription? _getNumberEvent; StreamSubscription? _getNumberEvent;
void _initLoadDataAction() { void _initLoadDataAction() {
// eventBus // eventBus
_getNumberEvent = _getNumberEvent = eventBus.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>().listen((event) {
eventBus.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>().listen((event) { state.attendanceWayNumber.value = event.number;
state.getDataPassword.value = event.number; isCanClickAction();
// print("event.number = ${event.number} state.getDataPassword.value = ${state.attendanceWayNumber.value}");
}); });
} }
// //
void addStaffLoadData() async{ void addStaffLoadData() async{
var attendanceWay = "";
var usernameType = "1"; var usernameType = "1";
switch(int.parse(state.selectPrintingMethodType.value)){ if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){
case 1: usernameType = "2";
// APP
if(state.appUnHaveAccount.value){
//
attendanceWay = state.staffAccountController.text;
if(attendanceWay.contains("@")){
usernameType = "2";
}
if(attendanceWay.isEmpty){
showToast("请输入员工账号");
return;
}
}else {
attendanceWay = state.selectKey.value;
if(attendanceWay.isEmpty){
showToast("请选择员工钥匙");
return;
}
}
break;
case 2:
break;
case 3:
break;
case 4:
break;
} }
var entity = await ApiRepository.to.addStaffData( var entity = await ApiRepository.to.addStaffData(
attendanceType: state.selectPrintingMethodType.value, attendanceType: state.selectPrintingMethodType.value,
attendanceWay: attendanceWay, attendanceWay: state.attendanceWayNumber.value,
companyId: state.companyId.value, companyId: state.companyId.value,
have: state.appUnHaveAccount.value ? "2" : "1", have: state.appUnHaveAccount.value ? "2" : "1",
staffName: state.staffNameController.text, staffName: state.staffNameController.text,
@ -91,47 +60,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{
// //
void editStaffLoadData() async{ void editStaffLoadData() async{
var attendanceWay = "";
var usernameType = "1"; var usernameType = "1";
switch(int.parse(state.selectPrintingMethodType.value)){ if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){
case 1: usernameType = "2";
// APP
if(state.appUnHaveAccount.value){
//
attendanceWay = state.staffAccountController.text;
if(attendanceWay.contains("@")){
usernameType = "2";
}
if(attendanceWay.isEmpty){
showToast("请输入员工账号");
return;
}
}else {
attendanceWay = state.selectKey.value;
if(attendanceWay.isEmpty){
showToast("请选择员工钥匙");
return;
}
}
break;
case 2:
break;
case 3:
break;
case 4:
break;
} }
var entity = await ApiRepository.to.editStaffData( var entity = await ApiRepository.to.editStaffData(
attendanceType: state.selectPrintingMethodType.value, attendanceType: state.selectPrintingMethodType.value,
attendanceWay: attendanceWay, attendanceWay: state.attendanceWayNumber.value,
staffId: state.staffListItemData.value.staffId.toString(), staffId: state.staffListItemData.value.staffId.toString(),
have: state.appUnHaveAccount.value ? "2" : "1", have: state.appUnHaveAccount.value ? "2" : "1",
staffName: state.staffNameController.text, staffName: state.staffNameController.text,
@ -152,29 +88,12 @@ class CheckingInAddStaffLogic extends BaseGetXController{
showToast("请输入姓名"); showToast("请输入姓名");
return; return;
} }
// var entity = await ApiRepository.to.getPasswordKey(
// "0",
// '0',
// state.staffNameController.text,
// 2.toString(),
// '0',
// state.getKeyInfosData.value.lockId.toString(),
// '0',
// "0",
// '0',
// 0,
// 0,
// 1);
var entity = await ApiRepository.to.getPasswordKey( var entity = await ApiRepository.to.getPasswordKey(
endDate: "0", endDate: "0",
isExclusive: '0',
keyboardPwdName: state.staffNameController.text, keyboardPwdName: state.staffNameController.text,
keyboardPwdType: 2.toString(), keyboardPwdType: 2.toString(),
keyboardPwdVersion: '0',
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.getKeyInfosData.value.lockId.toString(),
operatorUid: '0',
startDate: '0', startDate: '0',
timezoneRawOffSet: '0',
startHours: 0, startHours: 0,
endHours: 0, endHours: 0,
isCoerced: 1); isCoerced: 1);
@ -182,13 +101,35 @@ class CheckingInAddStaffLogic extends BaseGetXController{
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
print('获取密码成功'); print('获取密码成功');
if (entity.data != null) { if (entity.data != null) {
state.getDataPassword.value = entity.data!.keyboardPwd!; state.attendanceWayNumber.value = entity.data!.keyboardPwd!;
isCanClickAction();
} }
} else { } else {
showToast('${entity.errorMsg}'); showToast('${entity.errorMsg}');
} }
} }
void changeInput(TextEditingController controller) {
if (controller == state.staffNameController) {
state.staffName.value = controller.text;
}
if (controller == state.staffAccountController) {
state.staffAccount.value = controller.text;
}
isCanClickAction();
}
//
void isCanClickAction() {
if(state.selectPrintingMethodType.value == "1" && state.appUnHaveAccount.value){
//
state.isCanClick.value = state.staffNameIsNotEmpty && state.staffAccountIsNotEmpty;
}else{
state.isCanClick.value = state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty;
}
print("state.isCanClick.value = ${state.isCanClick.value}");
}
@override @override
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady

View File

@ -29,19 +29,21 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: barTitle:
"${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.staff!.tr}", "${state.isAdd.value == "1" ? TranslationLoader.lanKeys!.add!.tr : "编辑"}${TranslationLoader.lanKeys!.staff!.tr}",
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: [
//
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr, leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: getTFWidget( rightWidget: getTFWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.name!.tr}",
state.staffNameController)), state.staffNameController)),
//
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr, leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr,
rightTitle: state.selectPrintingMethodStr.value, rightTitle: state.selectPrintingMethodStr.value,
@ -49,11 +51,12 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
var list = ["APP", "密码", "", "指纹"]; var list = ["APP", "密码", "", "指纹"];
_showSelectClockInType(list, "1"); if(state.getKeyInfosData.value.lockName!.contains("T9A")){
list.add("人脸");
}
_showSelectClockInType(list, list, "1", "选择钥匙");
})), })),
SizedBox( SizedBox(height: 10.h),
height: 10.h,
),
//App //App
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: addStaffGetIfHaveKey(), leftTitel: addStaffGetIfHaveKey(),
@ -62,29 +65,28 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: Row( rightWidget: Row(
children: [ children: [
whetherTheEmployeeHasAKeyWidget( whetherTheEmployeeHasAKeyWidget("", state.appUnHaveAccount.value, () {
"", state.appUnHaveAccount.value, () {
setState(() { setState(() {
state.appUnHaveAccount.value = true; state.appUnHaveAccount.value = true;
state.attendanceWayNumber.value = "";
logic.isCanClickAction();
}); });
}), }),
SizedBox( SizedBox(
width: 30.w, width: 30.w,
), ),
whetherTheEmployeeHasAKeyWidget( whetherTheEmployeeHasAKeyWidget("", !state.appUnHaveAccount.value, () {
"", !state.appUnHaveAccount.value, () {
setState(() { setState(() {
state.appUnHaveAccount.value = false; state.appUnHaveAccount.value = false;
state.attendanceWayNumber.value = "";
logic.isCanClickAction();
}); });
}), }),
], ],
))), ))),
// App时显示 // App时且没有钥匙的时候
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.appUnHaveAccount.value && visible: (state.appUnHaveAccount.value && state.selectPrintingMethodType.value == "1") ? true : false,
state.selectPrintingMethodType.value == "1")
? true
: false,
child: Column( child: Column(
children: [ children: [
CommonItem( CommonItem(
@ -93,7 +95,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: getTFWidget( rightWidget: getTFWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, "${TranslationLoader.lanKeys!.pleaseEnter!.tr}员工${TranslationLoader.lanKeys!.accountNumber!.tr}",
state.staffAccountController)), state.staffAccountController)),
CommonItem( CommonItem(
leftTitel: leftTitel:
@ -125,16 +127,14 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
)), )),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.selectPrintingMethodType.value != "1" && state.appUnHaveAccount.value) visible: (state.selectPrintingMethodType.value != "1" && state.appUnHaveAccount.value) ? true : false,
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: addStaffGetKeyType(), leftTitel: addStaffGetKeyType(),
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: Row( rightWidget: Row(
children: [ children: [
Obx(() => Text(state.getDataPassword.value, style: TextStyle(fontSize: 24.sp))), Obx(() => Text(state.attendanceWayNumber.value, style: TextStyle(fontSize: 24.sp))),
SizedBox(width: 30.w), SizedBox(width: 30.w),
SizedBox( SizedBox(
width: 150.w, width: 150.w,
@ -155,8 +155,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
break; break;
case 3: case 3:
// //
if (state if (state.staffNameController.text.isEmpty) {
.staffNameController.text.isEmpty) {
logic.showToast("请输入姓名"); logic.showToast("请输入姓名");
return; return;
} }
@ -164,15 +163,13 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.addCardTypeManagePage, Routers.addCardTypeManagePage,
arguments: { arguments: {
"lockId": state "lockId": state.getKeyInfosData.value.lockId,
.getKeyInfosData.value.lockId, "fromType": 2, // 1 2
"keyType": 0, "fromTypeTwoStaffName": state.staffNameController.text
"fromType":
2, // 1 2
"fromTypeTwoStaffName":
state.staffNameController.text
}); });
if (data != null) {} if (data != null) {
}
break; break;
case 4: case 4:
// //
@ -184,17 +181,22 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.addFingerprintTypeManagePage, Routers.addFingerprintTypeManagePage,
arguments: { arguments: {
"lockId": state "lockId": state.getKeyInfosData.value.lockId,
.getKeyInfosData.value.lockId, "fromType": 2, // 1 2
"keyType": 1, "fromTypeTwoStaffName": state.staffNameController.text
"fromType":
2, // 1 2
"fromTypeTwoStaffName":
state.staffNameController.text
}); });
if (data != null) {} if (data != null) {
break;
}
break; break;
case 5:
Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
"lockId": state.getKeyInfosData.value.lockId,
"fromType": 2, // 1 2
"fromTypeTwoStaffName": state.staffNameController.text
});
break;
} }
}), }),
), ),
@ -206,37 +208,35 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
visible: !state.appUnHaveAccount.value, visible: !state.appUnHaveAccount.value,
child: CommonItem( child: CommonItem(
leftTitel: addStaffGetKeyType(), leftTitel: addStaffGetKeyType(),
rightTitle: state.selectKey.value, rightTitle: state.attendanceWayNumber.value,
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
logic.addStaffSelectKey((v) { logic.addStaffSelectKey((v) {
var list = []; var showList = [];
List numberList = [];
for (var element in v) { for (var element in v) {
list.add(element.attendanceWay); showList.add("${element.staffName}-${element.attendanceWay}");
numberList.add(element.attendanceWay);
} }
_showSelectClockInType(list, "2"); _showSelectClockInType(showList, numberList, "2", addStaffSelectKeySelectClockInType());
}); });
}), }),
)), )),
SizedBox(height: 50.w), SizedBox(height: 50.w),
SubmitBtn( Obx(() => SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr, btnName: TranslationLoader.lanKeys!.sure!.tr,
borderRadius: 20.w, borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w), margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () { isDisabled: state.isCanClick.value,
if (state.staffNameController.text.isEmpty) { onClick: state.isCanClick.value ? (){
logic.showToast("请输入姓名");
return;
}
if (state.isAdd.value == "2") { if (state.isAdd.value == "2") {
logic.editStaffLoadData(); logic.editStaffLoadData();
} else { } else {
logic.addStaffLoadData(); logic.addStaffLoadData();
} }
}), }: null))
], ],
), ),
); );
@ -255,12 +255,15 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
maxLines: 1, maxLines: 1,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30), // LengthLimitingTextInputFormatter(30),
], ],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: tf, controller: tf,
autofocus: false, autofocus: false,
textAlign: TextAlign.end, textAlign: TextAlign.end,
onChanged: (v) {
logic.changeInput(tf);
},
decoration: InputDecoration( decoration: InputDecoration(
// //
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
@ -280,58 +283,63 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
} }
// type 1 2 // type 1 2
void _showSelectClockInType(List list, String type) { void _showSelectClockInType(List showList, List numberList, String showBottomSheetToolType, String title) {
ShowBottomSheetTool().showSingleRowPicker( ShowBottomSheetTool().showSingleRowPicker(
// //
context, context,
// //
normalIndex: 0, normalIndex: 0,
title: "选择钥匙", title: title,
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
sureTitle: TranslationLoader.lanKeys!.sure!.tr, sureTitle: TranslationLoader.lanKeys!.sure!.tr,
// //
// //
//adapter: PickerAdapter(), //adapter: PickerAdapter(),
data: list, data: showList,
// //
clickCallBack: (int index, var str) { clickCallBack: (int index, var str) {
setState(() { setState(() {
if (type == "1") { if (showBottomSheetToolType == "1") {
state.selectPrintingMethodType.value = (index + 1).toString(); state.selectPrintingMethodType.value = (index + 1).toString();
state.selectPrintingMethodStr.value = str.toString(); state.selectPrintingMethodStr.value = str.toString();
state.getDataPassword.value = ""; state.attendanceWayNumber.value = "";
} else { } else {
state.selectKey.value = str.toString(); state.attendanceWayNumber.value = numberList[index].toString();
} }
print( logic.isCanClickAction();
"object:$index str:$str type:$type state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}"); print("object:$index str:$str type:$showBottomSheetToolType state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}");
}); });
}); });
} }
Widget whetherTheEmployeeHasAKeyWidget( Widget whetherTheEmployeeHasAKeyWidget(String title, bool appUnHaveAccount, Function() action) {
String title, bool appUnHaveAccount, Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Row( child: Container(
children: [ // width: 80.w,
Image.asset( height: 65.w,
appUnHaveAccount padding: EdgeInsets.only(left:10.w, right: 10.w),
? 'images/icon_round_select.png' // color: Colors.red,
: 'images/icon_round_unSelect.png', child: Row(
width: 26.w, children: [
height: 26.w, Image.asset(
), appUnHaveAccount
SizedBox( ? 'images/icon_round_select.png'
width: 5.w, : 'images/icon_round_unSelect.png',
), width: 26.w,
Text( height: 26.w,
title,
style: TextStyle(
fontSize: 22.sp,
), ),
), SizedBox(
], width: 5.w,
),
Text(
title,
style: TextStyle(
fontSize: 22.sp,
),
),
],
),
), ),
); );
} }
@ -351,6 +359,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
case 4: case 4:
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr; title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr;
break; break;
case 4:
title = "员工是否有人脸";
break;
} }
return title; return title;
} }
@ -370,6 +381,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
case 4: case 4:
title = TranslationLoader.lanKeys!.fingerprint!.tr; title = TranslationLoader.lanKeys!.fingerprint!.tr;
break; break;
case 5:
title = TranslationLoader.lanKeys!.humanFace!.tr;
break;
} }
return title; return title;
} }
@ -389,7 +403,33 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
case 4: case 4:
title = TranslationLoader.lanKeys!.getFingerprint!.tr; title = TranslationLoader.lanKeys!.getFingerprint!.tr;
break; break;
case 5:
title = "获取人脸";
break;
} }
return title; return title;
} }
String addStaffSelectKeySelectClockInType() {
String title = "";
switch (int.parse(state.selectPrintingMethodType.value)) {
case 1:
title = "选择钥匙".tr;
break;
case 2:
title = "选择密码".tr;
break;
case 3:
title = "选择卡".tr;
break;
case 4:
title = "选择指纹".tr;
break;
case 5:
title = "选择人脸".tr;
break;
}
return title;
}
} }

View File

@ -14,7 +14,7 @@ class CheckingInAddStaffState{
final TextEditingController staffNameController = TextEditingController(); final TextEditingController staffNameController = TextEditingController();
final TextEditingController staffAccountController = TextEditingController(); final TextEditingController staffAccountController = TextEditingController();
final selectPrintingMethodType = "1".obs;// final selectPrintingMethodType = "1".obs;// 1APP 2 3 4 5
final selectPrintingMethodStr = "APP".obs;// final selectPrintingMethodStr = "APP".obs;//
final countryName = "中国".obs; final countryName = "中国".obs;
@ -22,10 +22,15 @@ class CheckingInAddStaffState{
final appUnHaveAccount = true.obs;// final appUnHaveAccount = true.obs;//
final keyEntity = <CheckingInAddStaffKeyEntity>[].obs;// final keyEntity = <CheckingInAddStaffKeyEntity>[].obs;//
final selectKey = "".obs;
final isAdd = "1".obs; // 1 2 final isAdd = "1".obs; // 1 2
final getDataPassword = "".obs; final attendanceWayNumber = "".obs;
final isCanClick = false.obs;
var staffName = ''.obs;
var staffAccount = ''.obs;
bool get staffNameIsNotEmpty => staffName.value.isNotEmpty;
bool get staffAccountIsNotEmpty => staffAccount.value.isNotEmpty;
bool get attendanceWayNumberIsNotEmpty => attendanceWayNumber.value.isNotEmpty;
CheckingInAddStaffState() { CheckingInAddStaffState() {
Map map = Get.arguments; Map map = Get.arguments;
@ -38,6 +43,7 @@ class CheckingInAddStaffState{
staffNameController.text = staffListItemData.value.staffName!; staffNameController.text = staffListItemData.value.staffName!;
selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString(); selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString();
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
switch(staffListItemData.value.attendanceType){ switch(staffListItemData.value.attendanceType){
case 1: case 1:
selectPrintingMethodStr.value = "APP"; selectPrintingMethodStr.value = "APP";
@ -55,7 +61,7 @@ class CheckingInAddStaffState{
if(staffListItemData.value.attendanceWay!.isNotEmpty){ if(staffListItemData.value.attendanceWay!.isNotEmpty){
appUnHaveAccount.value = false; appUnHaveAccount.value = false;
selectKey.value = staffListItemData.value.attendanceWay!; attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
}else{ }else{
appUnHaveAccount.value = true; appUnHaveAccount.value = true;
} }

View File

@ -37,6 +37,7 @@ class CheckingInAddStaffListItemEntity {
int? staffId; int? staffId;
int? attendanceType; int? attendanceType;
int? countryCode; int? countryCode;
int? cardStatus;
String? attendanceWay; String? attendanceWay;
CheckingInAddStaffListItemEntity( CheckingInAddStaffListItemEntity(
@ -45,6 +46,7 @@ class CheckingInAddStaffListItemEntity {
this.staffId, this.staffId,
this.attendanceType, this.attendanceType,
this.countryCode, this.countryCode,
this.cardStatus,
this.attendanceWay}); this.attendanceWay});
CheckingInAddStaffListItemEntity.fromJson(Map<String, dynamic> json) { CheckingInAddStaffListItemEntity.fromJson(Map<String, dynamic> json) {
@ -53,6 +55,7 @@ class CheckingInAddStaffListItemEntity {
staffId = json['staffId']; staffId = json['staffId'];
attendanceType = json['attendanceType']; attendanceType = json['attendanceType'];
countryCode = json['countryCode']; countryCode = json['countryCode'];
cardStatus = json['cardStatus'];
attendanceWay = json['attendanceWay']; attendanceWay = json['attendanceWay'];
} }
@ -63,6 +66,7 @@ class CheckingInAddStaffListItemEntity {
data['staffId'] = staffId; data['staffId'] = staffId;
data['attendanceType'] = attendanceType; data['attendanceType'] = attendanceType;
data['countryCode'] = countryCode; data['countryCode'] = countryCode;
data['cardStatus'] = cardStatus;
data['attendanceWay'] = attendanceWay; data['attendanceWay'] = attendanceWay;
return data; return data;
} }

View File

@ -20,6 +20,17 @@ class CheckingInStaffManageLogic extends BaseGetXController{
} }
} }
//
void deletStaff(int staffId) async{
var entity = await ApiRepository.to.deletStaffData(
lockId: state.getKeyInfosData.value.lockId!,
staffId:staffId,
);
if(entity.errorCode!.codeIsSuccessful){
getStaffList();
}
}
late StreamSubscription _teamEvent; late StreamSubscription _teamEvent;
void _initLoadDataAction() { void _initLoadDataAction() {
_teamEvent = eventBus.on<RefreshCheckInStaffListDataEvent>().listen((event) { _teamEvent = eventBus.on<RefreshCheckInStaffListDataEvent>().listen((event) {

View File

@ -1,11 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/customNetworkImage.dart'; import '../../../../../tools/customNetworkImage.dart';
import '../../../../../tools/noData.dart'; import '../../../../../tools/noData.dart';
import '../../../../../tools/showIosTipView.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import 'checkingInStaffList_entity.dart'; import 'checkingInStaffList_entity.dart';
@ -55,22 +57,49 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
), ),
body: Container( body: Container(
color: Colors.white, color: Colors.white,
child: Obx(() => state.staffListData.value.isNotEmpty ? ListView.separated( child: Obx(() => state.staffListData.value.isNotEmpty ?
itemCount: state.staffListData.value.length, SlidableAutoCloseBehavior(
itemBuilder: (c, index) { child: ListView.separated(
CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index]; itemCount: state.staffListData.value.length,
return _checkingInStaffManageItem(staffListItem, () { itemBuilder: (c, index) {
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: { CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
"staffListItem": staffListItem, return Slidable(
"getKeyInfosData": state.getKeyInfosData.value, key:ValueKey(staffListItem.staffId),
"companyId": state.companyId.value, endActionPane: ActionPane(
}); extentRatio: 0.2,
}); motion: const ScrollMotion(),
}, children: [
separatorBuilder: (context, index) { SlidableAction(
return const Divider( onPressed: (BuildContext context){
height: 1, indent: 20, color: AppColors.greyLineColor); showIosTipViewDialog(staffListItem.staffId!, context);
}, },
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _checkingInStaffManageItem(staffListItem, () {
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
"staffListItem": staffListItem,
"getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value,
});
}),
);
// return _checkingInStaffManageItem(staffListItem, () {
// Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
// "staffListItem": staffListItem,
// "getKeyInfosData": state.getKeyInfosData.value,
// "companyId": state.companyId.value,
// });
// });
},
separatorBuilder: (context, index) {
return Divider(height: 1.h, indent: 20.w, color: AppColors.greyLineColor);
},
),
) : NoData()), ) : NoData()),
)); ));
} }
@ -79,20 +108,90 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
height: 60.h, // height: 60.h,
width: 1.sw, width: 1.sw,
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.h, bottom: 10.h), margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
child: Row( child: Row(
children: [ children: [
SizedBox(width: 30.w,), SizedBox(width: 20.w,),
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w), // CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
Image.asset('images/controls_user.png', width: 40.w, height: 40.w), Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w),
SizedBox(width: 30.w,), SizedBox(width: 20.w,),
Text(staffListItem.staffName!, style: TextStyle(fontSize: 24.sp)), Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 1.sw - 20.w - 60.w - 20.w - 30.w,
child: Text(staffListItem.staffName!,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 24.sp)
)
),
Visibility(visible: staffListItem.cardStatus == 0, child: SizedBox(height: 5.h,)),
Visibility(
visible: staffListItem.cardStatus == 0,
child: Container(
padding: EdgeInsets.only(right: 5.w, left: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor,
),
child: Text("打卡方式无效", style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
),
),
],
),
], ],
), ),
), ),
); );
} }
// 1APP 2 3 4
String getTypeIcon(int type) {
String title = 'images/controls_user.png';
switch (type) {
case 1:
//
title = 'images/controls_user.png';
break;
case 2:
//
title = 'images/icon_password.png';
break;
case 3:
// ic卡
title = 'images/icon_card.png';
break;
case 4:
//
title = 'images/icon_fingerprint.png';
break;
default:
break;
}
return title;
}
void showIosTipViewDialog(int staffId, BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowIosTipView(
title: "提示",
tipTitle: "确定要删除吗?",
sureClick: () async {
Get.back();
logic.deletStaff(staffId);
},
cancelClick: () {
Get.back();
},
);
},
);
}
} }

View File

@ -26,7 +26,7 @@ class _CheckingInStaffDetailPageState extends State<CheckingInStaffDetailPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.staff!.tr, barTitle: "员工信息",
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: [
@ -62,7 +62,14 @@ class _CheckingInStaffDetailPageState extends State<CheckingInStaffDetailPage> {
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.attendanceRecord!.tr, leftTitel: TranslationLoader.lanKeys!.attendanceRecord!.tr,
rightTitle: "", rightTitle: "",
isHaveDirection: true), isHaveDirection: true,
action: (){
Get.toNamed(Routers.checkingInDetailPage, arguments: {
// "getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value,
"staffId": state.staffListItemData.value.staffId,
});
}),
], ],
), ),
); );

View File

@ -25,6 +25,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
Get.back(); Get.back();
showToast("修改成功", something: (){ showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
}); });
} }
} }
@ -37,6 +38,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
print("删除电子钥匙成功"); print("删除电子钥匙成功");
showToast("删除成功", something: (){ showToast("删除成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back(); Get.back();
}); });
} }

View File

@ -10,6 +10,7 @@ import 'package:star_lock/tools/jh_pop_menus.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart'; import '../../../../../tools/commonItem.dart';
import '../../../../../tools/dateTool.dart';
import '../../../../../tools/showIosTipView.dart'; import '../../../../../tools/showIosTipView.dart';
import '../../../../../tools/showTFView.dart'; import '../../../../../tools/showTFView.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
@ -69,7 +70,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
Obx(() => getPeriodValidityWidget()), Obx(() => getPeriodValidityWidget()),
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr, leftTitel: "接受账号",
rightTitle: state.itemData.value.username, rightTitle: state.itemData.value.username,
action: () {}), action: () {}),
const SizedBox(height: 1), const SizedBox(height: 1),
@ -133,7 +134,6 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
} else if (dateType == XSConstantMacro.keyTypeLoop) { } else if (dateType == XSConstantMacro.keyTypeLoop) {
return getLoopTypeDateWidget(); return getLoopTypeDateWidget();
} }
return Container(); return Container();
} }
@ -151,21 +151,19 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
// //
Widget getTimeLimitTypeDateWidget() { Widget getTimeLimitTypeDateWidget() {
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
String useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
return CommonItem( return CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 90.h, allHeight: 90.h,
rightTitle: useDateStr, rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
isHaveDirection: true, isHaveDirection: true,
action: () { action: () async {
Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate, var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {"itemData": state.itemData.value});
arguments: {"itemData": state.itemData.value}); if(data != null) {
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
state.endTimeTimestamp.value = data["endTimeTimestamp"];
state.beginTime.value = DateTool().dateToYMDHNString(state.beginTimeTimestamp.value.toString());
state.endTime.value = DateTool().dateToYMDHNString(state.endTimeTimestamp.value.toString());
}
}); });
} }

View File

@ -2,15 +2,27 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import '../../../../../tools/dateTool.dart';
class ElectronicKeyDetailState { class ElectronicKeyDetailState {
final itemData = ElectronicKeyListItem().obs; final itemData = ElectronicKeyListItem().obs;
final keyName = "".obs; final keyName = "".obs;
final TextEditingController changeNameController = TextEditingController(); final TextEditingController changeNameController = TextEditingController();
var beginTime = "".obs;//
var endTime = "".obs;//
var beginTimeTimestamp = 0.obs;//
var endTimeTimestamp = 0.obs;//
ElectronicKeyDetailState() { ElectronicKeyDetailState() {
Map map = Get.arguments; Map map = Get.arguments;
itemData.value = map["itemData"]; itemData.value = map["itemData"];
changeNameController.text = itemData.value.keyName!; changeNameController.text = itemData.value.keyName!;
keyName.value = itemData.value.keyName!; keyName.value = itemData.value.keyName!;
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
beginTimeTimestamp.value = itemData.value.startDate!;
endTimeTimestamp.value = itemData.value.endDate!;
} }
} }

View File

@ -18,8 +18,8 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
keyboardPwdId: state.pwdId.value.toString(), keyboardPwdId: state.pwdId.value.toString(),
keyboardPwdName: state.inputNameController.text, keyboardPwdName: state.inputNameController.text,
newKeyboardPwd: state.inputPwdController.text, newKeyboardPwd: state.inputPwdController.text,
startDate: state.startDate.value, startDate: state.beginTimeTimestamp.value,
endDate: state.endDate.value, endDate: state.endTimeTimestamp.value,
changeType: state.changeType.value, changeType: state.changeType.value,
hoursStart: state.hoursStart.value, hoursStart: state.hoursStart.value,
hoursEnd: state.hoursEnd.value, hoursEnd: state.hoursEnd.value,
@ -27,26 +27,42 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: (){ showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back(); Get.back();
}); });
} }
} }
// //
Future<void> updateKeyDateRequest() async { Future<void> updateKeyDateRequest() async {
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
showToast("生效时间需大于当前时间");
return;
}
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate( KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
state.itemData.value.keyId.toString(), state.itemData.value.keyId.toString(),
state.itemData.value.lockId.toString(), state.itemData.value.lockId.toString(),
state.failureDateTime.millisecondsSinceEpoch.toString(), state.endTimeTimestamp.value.toString(),
state.endDay.value, state.endDay.value,
'', '',
state.effectiveDateTime.millisecondsSinceEpoch.toString(), state.beginTimeTimestamp.value.toString(),
state.startDay.value, state.startDay.value,
state.weekDays.value); state.weekDays.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: (){ showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(ElectronicKeyListRefreshUI());
Get.back(); eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back(result: {
"beginTimeTimestamp":state.beginTimeTimestamp.value,
"endTimeTimestamp":state.endTimeTimestamp.value,
});
}); });
} }
} }

View File

@ -56,50 +56,42 @@ class _ElectronicKeyDetailChangeDateState
} }
Widget buildMainUI() { Widget buildMainUI() {
String getStartDate = ""; // String getStartDate = "";
String getEndDate = ""; // String getEndDate = "";
if (state.itemData.value.startDate != null) { // if (state.itemData.value.startDate != null) {
DateTime startDateStr = // DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!); // DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
getStartDate = startDateStr.toLocal().toString().substring(0, 16); // getStartDate = startDateStr.toLocal().toString().substring(0, 16);
} // }
//
if (state.itemData.value.endDate != null) { // if (state.itemData.value.endDate != null) {
DateTime endDateStr = // DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!); // DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
getEndDate = endDateStr.toLocal().toString().substring(0, 16); // getEndDate = endDateStr.toLocal().toString().substring(0, 16);
} // }
return Column( return Column(
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.selectEffectiveDate.value.isNotEmpty rightTitle: state.beginTime.value,
? state.selectEffectiveDate.value
: getStartDate,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
onConfirm: (p) { state.beginTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.selectEffectiveDate.value = state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; print("state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}");
state.effectiveDateTime =
DateTime.parse(state.selectEffectiveDate.value);
}); });
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.selectFailureDate.value.isNotEmpty rightTitle: state.endTime.value,
? state.selectFailureDate.value
: getEndDate,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
onConfirm: (p) { state.endTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.selectFailureDate.value = state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; print("state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
state.failureDateTime =
DateTime.parse(state.selectFailureDate.value);
}); });
})), })),
], ],

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import '../../../../../tools/dateTool.dart';
class ElectronicKeyDetailChangeDateState { class ElectronicKeyDetailChangeDateState {
final itemData = ElectronicKeyListItem().obs; final itemData = ElectronicKeyListItem().obs;
final TextEditingController inputPwdController = TextEditingController(); final TextEditingController inputPwdController = TextEditingController();
@ -11,15 +13,22 @@ class ElectronicKeyDetailChangeDateState {
final isCoerced = '1'.obs; //:1;:2 final isCoerced = '1'.obs; //:1;:2
final hoursStart = 0.obs; final hoursStart = 0.obs;
final hoursEnd = 0.obs; final hoursEnd = 0.obs;
final startDate = 0.obs;
final endDate = 0.obs;
final pwdId = ''.obs; final pwdId = ''.obs;
final lockId = 0.obs; final lockId = 0.obs;
final fromType = ''.obs; final fromType = ''.obs;
final selectEffectiveDate = ''.obs; //
final selectFailureDate = ''.obs; // // final startDate = 0.obs;
DateTime effectiveDateTime = DateTime.now(); // final endDate = 0.obs;
DateTime failureDateTime = DateTime.now(); // final selectEffectiveDate = ''.obs; //
// final selectFailureDate = ''.obs; //
// DateTime effectiveDateTime = DateTime.now();
// DateTime failureDateTime = DateTime.now();
var beginTime = "".obs;//
var endTime = "".obs;//
var beginTimeTimestamp = 0.obs;//
var endTimeTimestamp = 0.obs;//
final endDay = ''.obs; final endDay = ''.obs;
final startDay = ''.obs; final startDay = ''.obs;
final weekDays = [].obs; final weekDays = [].obs;
@ -29,6 +38,10 @@ class ElectronicKeyDetailChangeDateState {
// itemData.value = map["itemData"]; // itemData.value = map["itemData"];
if ((map["itemData"] != null)) { if ((map["itemData"] != null)) {
itemData.value = map["itemData"]; itemData.value = map["itemData"];
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
beginTimeTimestamp.value = itemData.value.startDate!;
endTimeTimestamp.value = itemData.value.endDate!;
} }
if ((map["pwdId"] != null)) { if ((map["pwdId"] != null)) {
pwdId.value = map["pwdId"]; pwdId.value = map["pwdId"];

View File

@ -25,21 +25,20 @@ class SendElectronicKeyLogic extends BaseGetXController {
DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute); DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute);
DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute); DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute);
// //
if (state.type.value == "0" || state.type.value == "3") { if (state.type.value == "0" || state.type.value == "3") {
print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}"); print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) { if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
showToast("失效时间需大于生效时间"); showToast("失效时间需大于生效时间");
return; return;
}
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
showToast("生效时间需大于当前时间");
return;
}
} }
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
showToast("生效时间需大于当前时间");
return;
}
}
String lockID = state.keyInfo.value.lockId.toString(); String lockID = state.keyInfo.value.lockId.toString();
int typeValue = int.parse(state.type.value); int typeValue = int.parse(state.type.value);
switch (typeValue) { switch (typeValue) {

View File

@ -5,8 +5,7 @@ import 'package:get/get.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart'; import '../../../../lockMian/entity/lockListInfo_entity.dart';
class SendElectronicKeyState { class SendElectronicKeyState {
TextEditingController emailOrPhoneController = TextEditingController emailOrPhoneController = TextEditingController(); ///
TextEditingController(); ///
TextEditingController keyNameController = TextEditingController(); // TextEditingController keyNameController = TextEditingController(); //
final FlutterContactPicker contactPicker = FlutterContactPicker(); final FlutterContactPicker contactPicker = FlutterContactPicker();

View File

@ -263,8 +263,7 @@ class AddFaceLogic extends BaseGetXController {
showToast("添加成功"); showToast("添加成功");
if (state.fromType.value == 2) { if (state.fromType.value == 2) {
// //
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent( eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.faceNumber.value));
faceId.toString()));
} else if (state.fromType.value == 1) { } else if (state.fromType.value == 1) {
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
} }

View File

@ -19,7 +19,13 @@ class _AddFaceTypeManagePageState extends State<AddFaceTypeManagePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Map map = Get.arguments;
var lockId = map["lockId"];
var fromType = map["fromType"]; // 1 2
var fromTypeTwoStaffName = "";
if(fromType == 2){
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; //
}
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
@ -29,7 +35,7 @@ class _AddFaceTypeManagePageState extends State<AddFaceTypeManagePage> {
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: [
AddFaceTypeManageTabbar(initialIndex: index), AddFaceTypeManageTabbar(lockId: lockId, fromType: fromType, fromTypeTwoStaffName: fromTypeTwoStaffName, initialIndex: index),
], ],
), ),
); );

View File

@ -9,24 +9,27 @@ import '../addFaceType_page.dart';
class AddFaceTypeManageTabbar extends StatefulWidget { class AddFaceTypeManageTabbar extends StatefulWidget {
var initialIndex = 1; var initialIndex = 1;
var lockId = 0;
AddFaceTypeManageTabbar({Key? key, required this.initialIndex}) var fromType = 1; // 1 2
: super(key: key); var fromTypeTwoStaffName = "";//
AddFaceTypeManageTabbar({Key? key, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName, required this.initialIndex}) : super(key: key);
@override @override
State<AddFaceTypeManageTabbar> createState() => State<AddFaceTypeManageTabbar> createState() => _AddFaceTypeManageTabbarState();
_AddFaceTypeManageTabbarState();
} }
class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar> class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
late TabController _tabController; late TabController _tabController;
final List<ItemView> _itemTabs = <ItemView>[ final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView( ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"), ];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
]; ];
@override @override
@ -60,7 +63,7 @@ class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar>
TabBar _tabBar() { TabBar _tabBar() {
return TabBar( return TabBar(
controller: _tabController, controller: _tabController,
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true, isScrollable: true,
indicatorColor: Colors.red, indicatorColor: Colors.red,
unselectedLabelColor: Colors.black, unselectedLabelColor: Colors.black,
@ -92,11 +95,12 @@ class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar>
return Expanded( return Expanded(
child: TabBarView( child: TabBarView(
controller: _tabController, controller: _tabController,
children: _itemTabs children:
.map((ItemView item) => AddFaceTypePage( widget.fromType == 1
selectType: item.selectType, ? _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList()
)) :_itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
.toList(),
// _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
), ),
); );
} }

View File

@ -13,9 +13,18 @@ import '../../../../translations/trans_lib.dart';
import 'addFaceType_logic.dart'; import 'addFaceType_logic.dart';
class AddFaceTypePage extends StatefulWidget { class AddFaceTypePage extends StatefulWidget {
final String selectType; final String selectType; //
final int lockId;
final int fromType; // // 1 2
final String fromTypeTwoStaffName; //
const AddFaceTypePage({Key? key, required this.selectType}) : super(key: key); const AddFaceTypePage(
{Key? key,
required this.selectType,
required this.lockId,
required this.fromType,
required this.fromTypeTwoStaffName})
: super(key: key);
@override @override
State<AddFaceTypePage> createState() => _AddFaceTypePageState(); State<AddFaceTypePage> createState() => _AddFaceTypePageState();
@ -28,6 +37,9 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
state.seletType.value = widget.selectType; state.seletType.value = widget.selectType;
state.lockId.value = widget.lockId;
state.nameController.text = widget.fromTypeTwoStaffName;
state.fromType.value = widget.fromType;
return indexChangeWidget(); return indexChangeWidget();
} }

View File

@ -5,6 +5,7 @@ class AddFaceTypeState {
final lockId = 0.obs; final lockId = 0.obs;
final seletType = "0".obs; // 0 1 2 final seletType = "0".obs; // 0 1 2
final fromType = 1.obs; // // 1 2 final fromType = 1.obs; // // 1 2
var fromTypeTwoStaffName = "".obs; //
final isStressFingerprint = false.obs; final isStressFingerprint = false.obs;
var beginTime = "".obs; // var beginTime = "".obs; //
@ -18,8 +19,14 @@ class AddFaceTypeState {
final TextEditingController nameController = TextEditingController(); final TextEditingController nameController = TextEditingController();
AddFaceTypeState() { AddFaceTypeState() {
Map map = Get.arguments; // Map map = Get.arguments;
lockId.value = map["lockId"]; // lockId.value = map["lockId"];
fromType.value = map["fromType"]; // fromType.value = map["fromType"];
// if(fromType.value == 2){
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; //
// // nameController.text = fromTypeTwoStaffName.value;
// }
// print("lockId:${lockId.value} fromType:${fromType.value}");
} }
} }

View File

@ -368,7 +368,7 @@ class AddFingerprintLogic extends BaseGetXController {
showToast("添加成功"); showToast("添加成功");
if(state.fromType.value == 2){ if(state.fromType.value == 2){
// //
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(fingerprintId)); eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.fingerprintNumber.value));
}else if(state.fromType.value == 1){ }else if(state.fromType.value == 1){
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
} }

View File

@ -30,6 +30,11 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"), ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
]; ];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
@ -63,7 +68,7 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
onTap: (index){ onTap: (index){
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true, isScrollable: true,
indicatorColor: Colors.red, indicatorColor: Colors.red,
unselectedLabelColor: Colors.black, unselectedLabelColor: Colors.black,
@ -85,8 +90,7 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
} }
Tab _tab(ItemView item) { Tab _tab(ItemView item) {
return Tab( return Tab(child: SizedBox(
child: SizedBox(
width: 1.sw / 5, width: 1.sw / 5,
child: Text(item.title, textAlign: TextAlign.center))); child: Text(item.title, textAlign: TextAlign.center)));
} }
@ -95,17 +99,14 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
return Expanded( return Expanded(
child: TabBarView( child: TabBarView(
controller: _tabController, controller: _tabController,
children: _itemTabs children:
.map((ItemView item) => AddFingerprintTypePage( widget.fromType == 1
selectType: item.selectType, ? _itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList()
lockId: widget.lockId, :_itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
fromType: widget.fromType, ),
fromTypeTwoStaffName:widget.fromTypeTwoStaffName
))
.toList(),
),
); );
} }
} }
class ItemView { class ItemView {

View File

@ -40,7 +40,8 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
state.selectType.value = widget.selectType; state.selectType.value = widget.selectType;
state.lockId.value = widget.lockId; state.lockId.value = widget.lockId;
// state.nameController.text = widget.fromTypeTwoStaffName; state.nameController.text = widget.fromTypeTwoStaffName;
state.fromType.value = widget.fromType;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
// Your code here // Your code here

View File

@ -117,54 +117,56 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
Widget _buildMainUI() { Widget _buildMainUI() {
return Obx(() => state.fingerprintItemListData.value.isNotEmpty return Obx(() => state.fingerprintItemListData.value.isNotEmpty
? ListView.separated( ? SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.fingerprintItemListData.value.length, itemCount: state.fingerprintItemListData.value.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index]; FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
// //
return Slidable( return Slidable(
key:ValueKey(fingerprintItemData.fingerprintId), key:ValueKey(fingerprintItemData.fingerprintId),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
SlidableAction( SlidableAction(
onPressed: (BuildContext context){ onPressed: (BuildContext context){
showIosTipViewDialog(context); showIosTipViewDialog(context);
}, },
backgroundColor: Colors.red, backgroundColor: Colors.red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
label: '删除', label: '删除',
), ),
], ],
), ),
child: _keyItem( child: _keyItem(
'images/icon_fingerprint.png', 'images/icon_fingerprint.png',
fingerprintItemData.fingerprintName!, fingerprintItemData.fingerprintName!,
(fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
fingerprintItemData.validTimeStr!, fingerprintItemData.validTimeStr!,
// fingerprintItemData.fingerprintType! == 1 // fingerprintItemData.fingerprintType! == 1
// ? "永久" // ? "永久"
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}", // : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
() async { () async {
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.fingerprintDetailPage, Routers.fingerprintDetailPage,
arguments: { arguments: {
"fingerprintItemData": fingerprintItemData, "fingerprintItemData": fingerprintItemData,
}); });
if (data != null) { if (data != null) {
logic.getFingerprintsListData(); logic.getFingerprintsListData();
} }
}), }),
); );
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (BuildContext context, int index) {
return const Divider( return const Divider(
height: 1, height: 1,
color: AppColors.greyLineColor, color: AppColors.greyLineColor,
); );
}, },
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)); ),
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
} }
void showIosTipViewDialog(BuildContext context) { void showIosTipViewDialog(BuildContext context) {

View File

@ -68,7 +68,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle: logic.getUseKeyTypeStr( rightTitle: logic.getUseKeyTypeStr(
state.lockBasicInfo.value.startDate, state.lockBasicInfo.value.startDate,
state.lockBasicInfo.value.startDate, state.lockBasicInfo.value.endDate,
state.lockBasicInfo.value.keyType), state.lockBasicInfo.value.keyType),
allHeight: 70.h, allHeight: 70.h,
isHaveLine: false), isHaveLine: false),

View File

@ -31,7 +31,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
actionsList: [ actionsList: [
TextButton( TextButton(
child: Text( child: Text(
TranslationLoader.lanKeys!.sure!.tr, TranslationLoader.lanKeys!.save!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () { onPressed: () {
@ -45,7 +45,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
child: LoginInput( child: LoginInput(
controller: state.changeLockNameController, controller: state.changeLockNameController,
leftWidget: const SizedBox(), leftWidget: const SizedBox(),
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, hintText: "请输入名称",
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter(50), LengthLimitingTextInputFormatter(50),
]), ]),

View File

@ -98,14 +98,10 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
} }
var entity = await ApiRepository.to.getPasswordKey( var entity = await ApiRepository.to.getPasswordKey(
endDate: getFailureDateTime, endDate: getFailureDateTime,
isExclusive: '0',
keyboardPwdName: state.nameController.text, keyboardPwdName: state.nameController.text,
keyboardPwdType: getKeyType, keyboardPwdType: getKeyType,
keyboardPwdVersion: '0',
lockId: lockId, lockId: lockId,
operatorUid: '0',
startDate: getEffectiveDateTime, startDate: getEffectiveDateTime,
timezoneRawOffSet: '0',
startHours: state.loopStartHours.value, startHours: state.loopStartHours.value,
endHours: state.loopEndHours.value, endHours: state.loopEndHours.value,
isCoerced: 1); isCoerced: 1);

View File

@ -644,8 +644,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
return widgetList; return widgetList;
} }
GestureDetector buildCenter3( GestureDetector buildCenter3(String imageName, String titleStr, int itemIndex) {
String imageName, String titleStr, int itemIndex) {
return GestureDetector( return GestureDetector(
child: Container( child: Container(
width: 120.w, width: 120.w,

View File

@ -85,6 +85,7 @@ abstract class Api {
final String getStaffListURL = '/staff/list'; // final String getStaffListURL = '/staff/list'; //
final String addStaffURL = '/staff/add'; // final String addStaffURL = '/staff/add'; //
final String editStaffURL = '/staff/update'; // final String editStaffURL = '/staff/update'; //
final String deleteStaffURL = '/staff/delete'; //
final String addStaffSelectKeyURL = '/staff/attendanceList'; // - final String addStaffSelectKeyURL = '/staff/attendanceList'; // -
final String addHolidaysURL = '/vacation/add'; // final String addHolidaysURL = '/vacation/add'; //
final String holidaysListURL = '/vacation/list'; // final String holidaysListURL = '/vacation/list'; //

View File

@ -392,14 +392,10 @@ class ApiProvider extends BaseProvider {
Future<Response> getKeyboardPwd( Future<Response> getKeyboardPwd(
String endDate, String endDate,
String isExclusive,
String keyboardPwdName, String keyboardPwdName,
String keyboardPwdType, String keyboardPwdType,
String keyboardPwdVersion,
String lockId, String lockId,
String operatorUid,
String startDate, String startDate,
String timezoneRawOffSet,
int startHours, int startHours,
int endHours, int endHours,
int isCoerced) => int isCoerced) =>
@ -407,14 +403,10 @@ class ApiProvider extends BaseProvider {
passwordKeyGetURL.toUrl, passwordKeyGetURL.toUrl,
jsonEncode({ jsonEncode({
'endDate': endDate, 'endDate': endDate,
'isExclusive': isExclusive,
'keyboardPwdName': keyboardPwdName, 'keyboardPwdName': keyboardPwdName,
'keyboardPwdType': keyboardPwdType, 'keyboardPwdType': keyboardPwdType,
'keyboardPwdVersion': keyboardPwdVersion,
'lockId': lockId, 'lockId': lockId,
'operatorUid': operatorUid,
'startDate': startDate, 'startDate': startDate,
'timezoneRawOffSet': timezoneRawOffSet,
'hoursStart': startHours, 'hoursStart': startHours,
'hoursEnd': endHours, 'hoursEnd': endHours,
'isCoerced': isCoerced, 'isCoerced': isCoerced,
@ -776,6 +768,14 @@ class ApiProvider extends BaseProvider {
'lockId': lockId, 'lockId': lockId,
})); }));
//
Future<Response> deletStaffData(int lockId, int staffId) => post(
deleteStaffURL.toUrl,
jsonEncode({
'lockId': lockId,
'staffId': staffId,
}));
// //
Future<Response> addStaffData( Future<Response> addStaffData(
String attendanceType, String attendanceType,

View File

@ -398,27 +398,19 @@ class ApiRepository {
// //
Future<PasswordKeyEntity> getPasswordKey( Future<PasswordKeyEntity> getPasswordKey(
{required String endDate, {required String endDate,
required String isExclusive,
required String keyboardPwdName, required String keyboardPwdName,
required String keyboardPwdType, required String keyboardPwdType,
required String keyboardPwdVersion,
required String lockId, required String lockId,
required String operatorUid,
required String startDate, required String startDate,
required String timezoneRawOffSet,
required int startHours, required int startHours,
required int endHours, required int endHours,
required int isCoerced}) async { required int isCoerced}) async {
final res = await apiProvider.getKeyboardPwd( final res = await apiProvider.getKeyboardPwd(
endDate, endDate,
isExclusive,
keyboardPwdName, keyboardPwdName,
keyboardPwdType, keyboardPwdType,
keyboardPwdVersion,
lockId, lockId,
operatorUid,
startDate, startDate,
timezoneRawOffSet,
startHours, startHours,
endHours, endHours,
isCoerced); isCoerced);
@ -1016,6 +1008,15 @@ class ApiRepository {
return CheckingInAddStaffListEntity.fromJson(res.body); return CheckingInAddStaffListEntity.fromJson(res.body);
} }
//
Future<LoginEntity> deletStaffData({
required int lockId,
required int staffId,
}) async {
final res = await apiProvider.deletStaffData(lockId, staffId);
return LoginEntity.fromJson(res.body);
}
// //
Future<LoginEntity> addStaffData({ Future<LoginEntity> addStaffData({
required String attendanceType, required String attendanceType,
@ -1092,7 +1093,7 @@ class ApiRepository {
} }
// //
Future<CheckingInSetEntity> editCheckInSetInfoData({ Future<LoginEntity> editCheckInSetInfoData({
required String attendanceType, required String attendanceType,
required String companyId, required String companyId,
required String type, required String type,
@ -1103,7 +1104,7 @@ class ApiRepository {
}) async { }) async {
final res = await apiProvider.editCheckInSetInfoData(attendanceType, final res = await apiProvider.editCheckInSetInfoData(attendanceType,
companyId, type, companyName, workEndTime, workStartTime, workDay); companyId, type, companyName, workEndTime, workStartTime, workDay);
return CheckingInSetEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
// //

View File

@ -60,8 +60,8 @@ class CommonItem extends StatelessWidget {
isHaveRightWidget! isHaveRightWidget!
? rightWidget! ? rightWidget!
: SizedBox( : SizedBox(
width: 250.w, width: rightTitle!.isNotEmpty ? 250.w : 0.1.w,
child: Text( child: Text(
rightTitle ?? "", rightTitle ?? "",
textAlign: TextAlign.right, textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

View File

@ -35,7 +35,7 @@ class DateTool {
int time = int.parse(timeDate); int time = int.parse(timeDate);
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time); DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
String appointmentDate = formatDate(nowDate, [yyyy,'.',mm,'.',dd,' ',HH,':',nn]); String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd,' ',HH,':',nn]);
return appointmentDate; return appointmentDate;
} }