From a628860c9c3123d1d2f401d78a840e237dd657cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Thu, 29 Feb 2024 17:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=80=83=E5=8B=A4=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E3=80=81=E4=BF=AE=E5=A4=8D=E6=8E=88=E6=9D=83=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ios/Runner.xcodeproj/project.pbxproj | 2 +- .../authorizedAdmin_logic.dart | 22 ++ .../authorizedAdmin/authorizedAdmin_page.dart | 157 +++++++++++--- .../authorizedAdmin_state.dart | 3 + .../authorizedAdminList_page.dart | 1 - .../volumeAuthorizationLock_page.dart | 26 ++- .../addCardTypeManage_tabbar.dart | 25 +-- .../card/addCardType/addCardType_page.dart | 3 +- .../card/addICCard/addICCard_logic.dart | 16 +- .../card/cardList/cardList_page.dart | 78 +++---- .../otherTypeKeyChangeDate_logic.dart | 23 ++ .../otherTypeKeyChangeDate_page.dart | 14 +- .../checkingInDetail_state.dart | 4 +- .../checkingInList/checkingInList_page.dart | 19 +- .../checkingInSetWorkTime_page.dart | 5 +- .../checkingInSetWorkdaySet_page.dart | 77 ++++--- .../checkingInAddStaff_logic.dart | 127 +++-------- .../checkingInAddStaff_page.dart | 200 +++++++++++------- .../checkingInAddStaff_state.dart | 14 +- .../checkingInStaffList_entity.dart | 4 + .../checkingInStaffList_logic.dart | 11 + .../checkingInStaffList_page.dart | 143 +++++++++++-- .../checkingInStaffDetail_page.dart | 11 +- .../electronicKeyDetail_logic.dart | 2 + .../electronicKeyDetail_page.dart | 24 +-- .../electronicKeyDetail_state.dart | 12 ++ .../electronicKeyDetailChangeDate_logic.dart | 28 ++- .../electronicKeyDetailChangeDate_page.dart | 54 ++--- .../electronicKeyDetailChangeDate_state.dart | 25 ++- .../sendElectronicKey_logic.dart | 23 +- .../sendElectronicKey_state.dart | 3 +- .../face/addFace/addFace_logic.dart | 3 +- .../addFaceTypeManage_page.dart | 10 +- .../addFaceTypeManage_tabbar.dart | 34 +-- .../face/addFaceType/addFaceType_page.dart | 16 +- .../face/addFaceType/addFaceType_state.dart | 13 +- .../addFingerprint/addFingerprint_logic.dart | 2 +- .../addFingerprintTypeManage_tabbar.dart | 25 +-- .../addFingerprintType_page.dart | 3 +- .../fingerprintList/fingerprintList_page.dart | 88 ++++---- .../basicInformation_page.dart | 2 +- .../editLockName/editLockName_page.dart | 4 +- .../passwordKey_perpetual_logic.dart | 4 - .../passwordKey_perpetual_page.dart | 3 +- star_lock/lib/network/api.dart | 1 + star_lock/lib/network/api_provider.dart | 16 +- star_lock/lib/network/api_repository.dart | 21 +- star_lock/lib/tools/commonItem.dart | 4 +- star_lock/lib/tools/dateTool.dart | 2 +- 49 files changed, 867 insertions(+), 540 deletions(-) diff --git a/star_lock/ios/Runner.xcodeproj/project.pbxproj b/star_lock/ios/Runner.xcodeproj/project.pbxproj index 948be51b..21e7f887 100644 --- a/star_lock/ios/Runner.xcodeproj/project.pbxproj +++ b/star_lock/ios/Runner.xcodeproj/project.pbxproj @@ -459,7 +459,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index a5039a66..fb14201a 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -292,6 +292,28 @@ class AuthorizedAdminLogic extends BaseGetXController { } } + //标记房间为已入住 isOn:已入住: 1 空闲:2 + Future 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) { showCupertinoDialog( diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart index 15a1ecc4..1cb64622 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -12,6 +12,7 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/NativeInteractionTool.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../translations/trans_lib.dart'; @@ -285,9 +286,15 @@ class _AuthorizedAdminPageState extends State { height: 10.h, ), OutLineBtn( - btnName: '邮件通知', + btnName: state.emailOrPhoneController.text.contains("@")?'邮件通知':"短信通知", 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( @@ -295,7 +302,10 @@ class _AuthorizedAdminPageState extends State { ), OutLineBtn( btnName: '微信通知', - onClick: () {}, + onClick: () { + // _openModalBottomSheet(); + NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr); + }, ), SizedBox( height: 10.h, @@ -303,36 +313,13 @@ class _AuthorizedAdminPageState extends State { OutLineBtn( btnName: '标记为:已入住', onClick: () { - updateRoomCheckIn(); + logic.updateRoomCheckIn(); }, ), ], ); } - //标记房间为已入住 isOn:已入住: 1 空闲:2 - Future 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) { return SizedBox( @@ -400,6 +387,10 @@ class _AuthorizedAdminPageState extends State { .phoneNumbers![0] .replaceAll(RegExp(r"\s+\b|\b\s"), ""); } + + if (currentContact.fullName!.isNotEmpty) { + state.keyNameController.text = currentContact.fullName!; + } }); }, ), @@ -428,4 +419,116 @@ class _AuthorizedAdminPageState extends State { String intToStr(int 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(Colors.white)), + child: Text( + '取消', + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ); + }); + } + + List initBottomSheetList() { + List 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: + } + } + } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart index a699d8d1..c599d4ac 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart @@ -29,6 +29,9 @@ class AuthorizedAdminState { var weekdaysList = [].obs; var isCreateUser = false.obs; //用户未注册时传1 已注册传0 + final widgetType = 0.obs; + String pwdShareStr = '您好,您的授权管理员生成成功'; + var addUserId = ''.obs; AuthorizedAdminState() { Map map = Get.arguments; diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index cc769f96..c925c2a8 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -11,7 +11,6 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/EasyRefreshTool.dart'; -import '../../../../tools/left_slide_actions.dart'; import '../../../../tools/showIosTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart index b1e52e40..5a8191c0 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; // import 'package:flutter_pickers/pickers.dart'; @@ -258,17 +259,31 @@ class _VolumeAuthorizationLockPageState controller: editController, //输入框一行 maxLines: 1, - // controller: _controller, + inputFormatters: [ + FilteringTextInputFormatter.deny('\n'), + LengthLimitingTextInputFormatter(30), + ], autofocus: false, textAlign: TextAlign.end, decoration: InputDecoration( //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), + // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), hintText: tfStr, hintStyle: TextStyle(fontSize: 22.sp), - //不需要输入框下划线 - border: InputBorder.none, + focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), + 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( @@ -295,6 +310,9 @@ class _VolumeAuthorizationLockPageState .phoneNumbers![0] .replaceAll(RegExp(r"\s+\b|\b\s"), ""); } + if (currentContact.fullName!.isNotEmpty) { + _keyNameController.text = currentContact.fullName!; + } }); }, ), diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart index 245048e3..db9c485d 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart @@ -29,11 +29,15 @@ class _AddCardManageTabbarState extends State with SingleTickerProviderStateMixin { late TabController _tabController; - final List _itemTabs = [ + final List _itemTabs = [ + 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 _fromCheckInTypeItemTabs = [ ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), - ItemView( - title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"), ]; @override @@ -43,7 +47,7 @@ class _AddCardManageTabbarState extends State _tabController = TabController( vsync: this, - length: _itemTabs.length, + length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length, initialIndex: widget.initialIndex); _tabController.addListener(() { if (_tabController.animation!.value == _tabController.index) { @@ -69,7 +73,7 @@ class _AddCardManageTabbarState extends State onTap: (index) { 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, indicatorColor: Colors.red, unselectedLabelColor: Colors.black, @@ -101,13 +105,10 @@ class _AddCardManageTabbarState extends State return Expanded( child: TabBarView( controller: _tabController, - children: _itemTabs - .map((ItemView item) => AddCardPage( - selectType: item.selectType, - lockId: widget.lockId, - fromType: widget.fromType, - fromTypeTwoStaffName: widget.fromTypeTwoStaffName)) - .toList(), + children: + widget.fromType == 1 + ? _itemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList() + : _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList(), ), ); } diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart index 536e0872..5d17f5fb 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart @@ -40,7 +40,8 @@ class _AddCardPageState extends State { Widget build(BuildContext context) { state.selectType.value = widget.selectType; state.lockId.value = widget.lockId; - // state.nameController.text = widget.fromTypeTwoStaffName; + state.nameController.text = widget.fromTypeTwoStaffName; + state.fromType.value = widget.fromType; WidgetsBinding.instance.addPostFrameCallback((_) { // Your code here diff --git a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart index 9af2719e..8b40091b 100644 --- a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart +++ b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart @@ -308,14 +308,6 @@ class AddICCardLogic extends BaseGetXController{ weekDay: state.weekDay.value, ); 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()); } } @@ -335,6 +327,14 @@ class AddICCardLogic extends BaseGetXController{ // eventBus.fire(OtherTypeRefreshListEvent()); // } // 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); } } diff --git a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart index cd23ae40..ea796c9a 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart @@ -118,49 +118,51 @@ class _CardListPageState extends State with RouteAware { Widget _buildMainUI() { return Obx(() => state.fingerprintItemListData.value.isNotEmpty - ? ListView.separated( + ? SlidableAutoCloseBehavior( + child: ListView.separated( itemCount: state.fingerprintItemListData.value.length, itemBuilder: (c, index) { - FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index]; - return Slidable( - key:ValueKey(fingerprintItemData.fingerprintId), - endActionPane: ActionPane( - extentRatio: 0.2, - motion: const ScrollMotion(), - children: [ - SlidableAction( - onPressed: (BuildContext context){ - showIosTipViewDialog(context); - }, - backgroundColor: Colors.red, - foregroundColor: Colors.white, - label: '删除', - ), - ], - ), - child: _keyItem( - 'images/icon_card.png', - fingerprintItemData.cardName!, - (fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", - fingerprintItemData.validTimeStr!, - () async { - var data = await Get.toNamed( - Routers.cardDetailPage, arguments: { - "fingerprintItemData": fingerprintItemData, - }); - if (data != null) { - logic.getICCardListData(); - } - }), - ); + FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index]; + return Slidable( + key:ValueKey(fingerprintItemData.fingerprintId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context){ + showIosTipViewDialog(context); + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + label: '删除', + ), + ], + ), + child: _keyItem( + 'images/icon_card.png', + fingerprintItemData.cardName!, + (fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", + fingerprintItemData.validTimeStr!, + () async { + var data = await Get.toNamed( + Routers.cardDetailPage, arguments: { + "fingerprintItemData": fingerprintItemData, + }); + if (data != null) { + logic.getICCardListData(); + } + }), + ); }, separatorBuilder: (BuildContext context, int index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); + return const Divider( + height: 1, + 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) { diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart index d9c679ea..a759dad3 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart @@ -10,6 +10,17 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ // 修改指纹信息 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( fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(), lockId: state.fingerprintItemData.value.lockId.toString(), @@ -32,6 +43,18 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ // 编辑iC卡 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( cardId: state.fingerprintItemData.value.cardId.toString(), lockId: state.fingerprintItemData.value.lockId.toString(), diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart index 536fd0a7..bbbce875 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart @@ -76,11 +76,8 @@ class _OtherTypeKeyChangeDatePageState Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) { setState(() { - state.beginTimeTimestamp.value = DateTime.parse( - '${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')}') - .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')}"; + 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.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch; }); }); })), @@ -92,11 +89,8 @@ class _OtherTypeKeyChangeDatePageState Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) { setState(() { - state.endTimeTimestamp.value = DateTime.parse( - '${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')}') - .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')}"; + 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.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch; }); }); })), diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart index fce26a80..43e692fb 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart @@ -5,7 +5,7 @@ import 'checkingInDetail_entity.dart'; class CheckingInDetailState{ - final getKeyInfosData = LockListInfoItemEntity().obs; + // final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final staffId = 0.obs; @@ -17,7 +17,7 @@ class CheckingInDetailState{ final monthListData = [].obs; CheckingInDetailState() { Map map = Get.arguments; - getKeyInfosData.value = map["getKeyInfosData"]; + // getKeyInfosData.value = map["getKeyInfosData"]; companyId.value = map["companyId"]; staffId.value = map["staffId"]; } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart index 13abfa3a..bff6e77c 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart @@ -36,7 +36,7 @@ class _CheckingInListPageState extends State { haveBack: true, backgroundColor: AppColors.mainColor, actionsList: [ - (state.getKeyInfosData.value.isLockOwner == 1 && state.getKeyInfosData.value.keyRight == 1) ? + (state.getKeyInfosData.value.keyRight == 1) ? GestureDetector( onTap: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); @@ -67,7 +67,7 @@ class _CheckingInListPageState extends State { Widget topInfo() { return Container( width: 1.sw, - height: 280.h, + // height: 280.h, color: Colors.white, child: Column( children: [ @@ -81,8 +81,7 @@ class _CheckingInListPageState extends State { borderRadius: BorderRadius.circular(60.w), ), child: Image.asset(getTopImg(), width: 120.w, height: 120.w) - ) - ), + )), SizedBox(height: 10.h), Obx(() => Text(getTopTitle(), style: TextStyle(color: Colors.black, fontSize: 24.sp))), SizedBox(height: 30.h), @@ -168,7 +167,7 @@ class _CheckingInListPageState extends State { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if(isDemoMode == false){ await showDialog( - context: context, + context: Get.context!, builder: (context) { return ShowCalendar( datePickerMode: DatePickerMode.day, @@ -262,7 +261,7 @@ class _CheckingInListPageState extends State { AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index]; return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName,() { Get.toNamed(Routers.checkingInDetailPage, arguments: { - "getKeyInfosData": state.getKeyInfosData.value, + // "getKeyInfosData": state.getKeyInfosData.value, "companyId": state.companyId.value, "staffId": attendanceRecordList.staffId, }); @@ -297,18 +296,18 @@ class _CheckingInListPageState extends State { return GestureDetector( onTap: action, child: Container( - height: 80.h, - // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + // height: 80.h, + padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10.w), ), child: Row( children: [ - SizedBox(width: 30.w,), + SizedBox(width: 20.w,), Text("${index+1}", style: TextStyle(fontSize: 20.sp),), 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( // width: 60.h, // height: 60.h, diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart index 0d17ca33..ac33cf71 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart @@ -96,9 +96,8 @@ class _CheckingInSetWorkTimePageState extends State { return; } - if (int.parse(state.beginTimeTimestamp.value) > - int.parse(state.endTimeTimestamp.value)) { - logic.showToast("结束时间不能大于开始时间"); + if (int.parse(state.beginTimeTimestamp.value) > int.parse(state.endTimeTimestamp.value)) { + logic.showToast("结束时间必须要比开始时间晚,请重新选择"); return; } if (state.pushType.value == "2") { diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart index 749ce6d6..7f14950c 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart @@ -129,18 +129,16 @@ class _CheckingInSetWorkdaySetState extends State { allHeight: 60.h, isHaveLine: true, isHaveRightWidget: true, - rightWidget: GestureDetector( - onTap: () { - setState(() { - state.isSingledayWeekend.value = 1; - state.weekDays.value = [1, 2 , 3, 4, 5, 6]; - }); - }, - child: Row( - children: [ - Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), - ], - ), + action: (){ + setState(() { + state.isSingledayWeekend.value = 0; + state.weekDays.value = [1, 2 , 3, 4, 5, 6]; + }); + }, + rightWidget: Row( + children: [ + Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), + ], ) )), Obx(() => CommonItem( @@ -149,18 +147,16 @@ class _CheckingInSetWorkdaySetState extends State { allHeight: 60.h, isHaveLine: false, isHaveRightWidget: true, - rightWidget: GestureDetector( - onTap: () { - setState(() { - state.isSingledayWeekend.value = 2; - state.weekDays.value = [1, 2 , 3, 4, 5]; - }); - }, - child: Row( - children: [ - Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), - ], - ), + action: (){ + setState(() { + state.isSingledayWeekend.value = 1; + state.weekDays.value = [6, 7]; + }); + }, + rightWidget: Row( + children: [ + 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 { allHeight: 60.h, isHaveLine: true, isHaveRightWidget: true, - rightWidget: GestureDetector( - onTap: () { - setState(() { - state.isSingledayWeekend.value = 2; - if(state.weekDays.value.contains(index)){ - state.weekDays.value.remove(index); - }else{ - state.weekDays.value.add(index); - } - state.weekDays.value.sort(); - }); - }, - child: Obx(() => Row( - children: [ - Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), - ], - ))) + action: (){ + setState(() { + state.isSingledayWeekend.value = 2; + if(state.weekDays.value.contains(index)){ + state.weekDays.value.remove(index); + }else{ + state.weekDays.value.add(index); + } + state.weekDays.value.sort(); + }); + }, + rightWidget: Obx(() => Row( + children: [ + Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,), + ], + )) ); } ), diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart index d4a2b86e..7b4aad05 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../network/api_repository.dart'; @@ -15,55 +16,23 @@ class CheckingInAddStaffLogic extends BaseGetXController{ StreamSubscription? _getNumberEvent; void _initLoadDataAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _getNumberEvent = - eventBus.on().listen((event) { - state.getDataPassword.value = event.number; + _getNumberEvent = eventBus.on().listen((event) { + state.attendanceWayNumber.value = event.number; + isCanClickAction(); + // print("event.number = ${event.number} state.getDataPassword.value = ${state.attendanceWayNumber.value}"); }); } // 添加员工 void addStaffLoadData() async{ - var attendanceWay = ""; var usernameType = "1"; - switch(int.parse(state.selectPrintingMethodType.value)){ - case 1: - // 打卡方式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; + if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){ + usernameType = "2"; } var entity = await ApiRepository.to.addStaffData( attendanceType: state.selectPrintingMethodType.value, - attendanceWay: attendanceWay, + attendanceWay: state.attendanceWayNumber.value, companyId: state.companyId.value, have: state.appUnHaveAccount.value ? "2" : "1", staffName: state.staffNameController.text, @@ -91,47 +60,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{ // 编辑员工 void editStaffLoadData() async{ - var attendanceWay = ""; var usernameType = "1"; - switch(int.parse(state.selectPrintingMethodType.value)){ - case 1: - // 打卡方式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; + if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){ + usernameType = "2"; } var entity = await ApiRepository.to.editStaffData( attendanceType: state.selectPrintingMethodType.value, - attendanceWay: attendanceWay, + attendanceWay: state.attendanceWayNumber.value, staffId: state.staffListItemData.value.staffId.toString(), have: state.appUnHaveAccount.value ? "2" : "1", staffName: state.staffNameController.text, @@ -152,29 +88,12 @@ class CheckingInAddStaffLogic extends BaseGetXController{ showToast("请输入姓名"); 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( endDate: "0", - isExclusive: '0', keyboardPwdName: state.staffNameController.text, keyboardPwdType: 2.toString(), - keyboardPwdVersion: '0', lockId: state.getKeyInfosData.value.lockId.toString(), - operatorUid: '0', startDate: '0', - timezoneRawOffSet: '0', startHours: 0, endHours: 0, isCoerced: 1); @@ -182,13 +101,35 @@ class CheckingInAddStaffLogic extends BaseGetXController{ if (entity.errorCode!.codeIsSuccessful) { print('获取密码成功'); if (entity.data != null) { - state.getDataPassword.value = entity.data!.keyboardPwd!; + state.attendanceWayNumber.value = entity.data!.keyboardPwd!; + isCanClickAction(); } } else { 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 void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart index 2ea59332..beee1ea4 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart @@ -29,19 +29,21 @@ class _CheckingInAddStaffPageState extends State { backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: - "${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.staff!.tr}", + "${state.isAdd.value == "1" ? TranslationLoader.lanKeys!.add!.tr : "编辑"}${TranslationLoader.lanKeys!.staff!.tr}", haveBack: true, backgroundColor: AppColors.mainColor), body: Column( children: [ + // 姓名 CommonItem( leftTitel: TranslationLoader.lanKeys!.name!.tr, rightTitle: "", isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget( - TranslationLoader.lanKeys!.pleaseEnter!.tr, + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.name!.tr}", state.staffNameController)), + // 选择打卡方式 Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr, rightTitle: state.selectPrintingMethodStr.value, @@ -49,11 +51,12 @@ class _CheckingInAddStaffPageState extends State { isHaveDirection: true, action: () { var list = ["APP", "密码", "卡", "指纹"]; - _showSelectClockInType(list, "1"); + if(state.getKeyInfosData.value.lockName!.contains("T9A")){ + list.add("人脸"); + } + _showSelectClockInType(list, list, "1", "选择钥匙"); })), - SizedBox( - height: 10.h, - ), + SizedBox(height: 10.h), //员工是否有App、卡、钥匙、指纹必须显示 Obx(() => CommonItem( leftTitel: addStaffGetIfHaveKey(), @@ -62,29 +65,28 @@ class _CheckingInAddStaffPageState extends State { isHaveRightWidget: true, rightWidget: Row( children: [ - whetherTheEmployeeHasAKeyWidget( - "无", state.appUnHaveAccount.value, () { + whetherTheEmployeeHasAKeyWidget("无", state.appUnHaveAccount.value, () { setState(() { state.appUnHaveAccount.value = true; + state.attendanceWayNumber.value = ""; + logic.isCanClickAction(); }); }), SizedBox( width: 30.w, ), - whetherTheEmployeeHasAKeyWidget( - "有", !state.appUnHaveAccount.value, () { + whetherTheEmployeeHasAKeyWidget("有", !state.appUnHaveAccount.value, () { setState(() { state.appUnHaveAccount.value = false; + state.attendanceWayNumber.value = ""; + logic.isCanClickAction(); }); }), ], ))), - // 当选择App时显示 其他隐藏 + // 当选择App时且没有钥匙的时候 显示输入账号输入框和选择国家 其他隐藏 Obx(() => Visibility( - visible: (state.appUnHaveAccount.value && - state.selectPrintingMethodType.value == "1") - ? true - : false, + visible: (state.appUnHaveAccount.value && state.selectPrintingMethodType.value == "1") ? true : false, child: Column( children: [ CommonItem( @@ -93,7 +95,7 @@ class _CheckingInAddStaffPageState extends State { isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget( - TranslationLoader.lanKeys!.pleaseEnter!.tr, + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}员工${TranslationLoader.lanKeys!.accountNumber!.tr}", state.staffAccountController)), CommonItem( leftTitel: @@ -125,16 +127,14 @@ class _CheckingInAddStaffPageState extends State { )), // 当选择密码、卡、指纹时显示 Obx(() => Visibility( - visible: (state.selectPrintingMethodType.value != "1" && state.appUnHaveAccount.value) - ? true - : false, + visible: (state.selectPrintingMethodType.value != "1" && state.appUnHaveAccount.value) ? true : false, child: CommonItem( leftTitel: addStaffGetKeyType(), isHaveLine: false, isHaveRightWidget: true, rightWidget: Row( 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: 150.w, @@ -155,8 +155,7 @@ class _CheckingInAddStaffPageState extends State { break; case 3: // 卡 - if (state - .staffNameController.text.isEmpty) { + if (state.staffNameController.text.isEmpty) { logic.showToast("请输入姓名"); return; } @@ -164,15 +163,13 @@ class _CheckingInAddStaffPageState extends State { var data = await Get.toNamed( Routers.addCardTypeManagePage, arguments: { - "lockId": state - .getKeyInfosData.value.lockId, - "keyType": 0, - "fromType": - 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入 - "fromTypeTwoStaffName": - state.staffNameController.text + "lockId": state.getKeyInfosData.value.lockId, + "fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + "fromTypeTwoStaffName": state.staffNameController.text }); - if (data != null) {} + if (data != null) { + + } break; case 4: // 指纹 @@ -184,17 +181,22 @@ class _CheckingInAddStaffPageState extends State { var data = await Get.toNamed( Routers.addFingerprintTypeManagePage, arguments: { - "lockId": state - .getKeyInfosData.value.lockId, - "keyType": 1, - "fromType": - 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入 - "fromTypeTwoStaffName": - state.staffNameController.text + "lockId": state.getKeyInfosData.value.lockId, + "fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + "fromTypeTwoStaffName": state.staffNameController.text }); - if (data != null) {} - break; + if (data != null) { + + } 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 { visible: !state.appUnHaveAccount.value, child: CommonItem( leftTitel: addStaffGetKeyType(), - rightTitle: state.selectKey.value, + rightTitle: state.attendanceWayNumber.value, isHaveLine: false, isHaveDirection: true, action: () { logic.addStaffSelectKey((v) { - var list = []; + var showList = []; + List numberList = []; 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), - SubmitBtn( + Obx(() => SubmitBtn( btnName: TranslationLoader.lanKeys!.sure!.tr, borderRadius: 20.w, margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () { - if (state.staffNameController.text.isEmpty) { - logic.showToast("请输入姓名"); - return; - } - + isDisabled: state.isCanClick.value, + onClick: state.isCanClick.value ? (){ if (state.isAdd.value == "2") { logic.editStaffLoadData(); } else { logic.addStaffLoadData(); } - }), + }: null)) ], ), ); @@ -255,12 +255,15 @@ class _CheckingInAddStaffPageState extends State { maxLines: 1, inputFormatters: [ FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter(30), + // LengthLimitingTextInputFormatter(30), ], style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: tf, autofocus: false, textAlign: TextAlign.end, + onChanged: (v) { + logic.changeInput(tf); + }, decoration: InputDecoration( //输入里面输入文字内边距设置 // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), @@ -280,58 +283,63 @@ class _CheckingInAddStaffPageState extends State { } // type 1 打卡方式 2选择钥匙 - void _showSelectClockInType(List list, String type) { + void _showSelectClockInType(List showList, List numberList, String showBottomSheetToolType, String title) { ShowBottomSheetTool().showSingleRowPicker( //上下文 context, //默认的索引 normalIndex: 0, - title: "选择钥匙", + title: title, cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, sureTitle: TranslationLoader.lanKeys!.sure!.tr, //要显示的列表 //可自定义数据适配器 //adapter: PickerAdapter(), - data: list, + data: showList, //选择事件的回调 clickCallBack: (int index, var str) { setState(() { - if (type == "1") { + if (showBottomSheetToolType == "1") { state.selectPrintingMethodType.value = (index + 1).toString(); state.selectPrintingMethodStr.value = str.toString(); - state.getDataPassword.value = ""; + state.attendanceWayNumber.value = ""; } else { - state.selectKey.value = str.toString(); + state.attendanceWayNumber.value = numberList[index].toString(); } - print( - "object:$index str:$str type:$type state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}"); + logic.isCanClickAction(); + print("object:$index str:$str type:$showBottomSheetToolType state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}"); }); }); } - Widget whetherTheEmployeeHasAKeyWidget( - String title, bool appUnHaveAccount, Function() action) { + Widget whetherTheEmployeeHasAKeyWidget(String title, bool appUnHaveAccount, Function() action) { return GestureDetector( onTap: action, - child: Row( - children: [ - Image.asset( - appUnHaveAccount - ? 'images/icon_round_select.png' - : 'images/icon_round_unSelect.png', - width: 26.w, - height: 26.w, - ), - SizedBox( - width: 5.w, - ), - Text( - title, - style: TextStyle( - fontSize: 22.sp, + child: Container( + // width: 80.w, + height: 65.w, + padding: EdgeInsets.only(left:10.w, right: 10.w), + // color: Colors.red, + child: Row( + children: [ + Image.asset( + appUnHaveAccount + ? 'images/icon_round_select.png' + : 'images/icon_round_unSelect.png', + width: 26.w, + height: 26.w, ), - ), - ], + SizedBox( + width: 5.w, + ), + Text( + title, + style: TextStyle( + fontSize: 22.sp, + ), + ), + ], + ), ), ); } @@ -351,6 +359,9 @@ class _CheckingInAddStaffPageState extends State { case 4: title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr; break; + case 4: + title = "员工是否有人脸"; + break; } return title; } @@ -370,6 +381,9 @@ class _CheckingInAddStaffPageState extends State { case 4: title = TranslationLoader.lanKeys!.fingerprint!.tr; break; + case 5: + title = TranslationLoader.lanKeys!.humanFace!.tr; + break; } return title; } @@ -389,7 +403,33 @@ class _CheckingInAddStaffPageState extends State { case 4: title = TranslationLoader.lanKeys!.getFingerprint!.tr; break; + case 5: + title = "获取人脸"; + break; } 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; + } + } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart index 5d601a38..4b40f29d 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart @@ -14,7 +14,7 @@ class CheckingInAddStaffState{ final TextEditingController staffNameController = TextEditingController(); final TextEditingController staffAccountController = TextEditingController(); - final selectPrintingMethodType = "1".obs;// 选择打卡类型 + final selectPrintingMethodType = "1".obs;// 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸 final selectPrintingMethodStr = "APP".obs;// 选择打卡类型字符串 final countryName = "中国".obs; @@ -22,10 +22,15 @@ class CheckingInAddStaffState{ final appUnHaveAccount = true.obs;// 默认没有账号 final keyEntity = [].obs;// 选择钥匙数据 - final selectKey = "".obs; 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() { Map map = Get.arguments; @@ -38,6 +43,7 @@ class CheckingInAddStaffState{ staffNameController.text = staffListItemData.value.staffName!; selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString(); + attendanceWayNumber.value = staffListItemData.value.attendanceWay!; switch(staffListItemData.value.attendanceType){ case 1: selectPrintingMethodStr.value = "APP"; @@ -55,7 +61,7 @@ class CheckingInAddStaffState{ if(staffListItemData.value.attendanceWay!.isNotEmpty){ appUnHaveAccount.value = false; - selectKey.value = staffListItemData.value.attendanceWay!; + attendanceWayNumber.value = staffListItemData.value.attendanceWay!; }else{ appUnHaveAccount.value = true; } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart index d34af350..394e3866 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart @@ -37,6 +37,7 @@ class CheckingInAddStaffListItemEntity { int? staffId; int? attendanceType; int? countryCode; + int? cardStatus; String? attendanceWay; CheckingInAddStaffListItemEntity( @@ -45,6 +46,7 @@ class CheckingInAddStaffListItemEntity { this.staffId, this.attendanceType, this.countryCode, + this.cardStatus, this.attendanceWay}); CheckingInAddStaffListItemEntity.fromJson(Map json) { @@ -53,6 +55,7 @@ class CheckingInAddStaffListItemEntity { staffId = json['staffId']; attendanceType = json['attendanceType']; countryCode = json['countryCode']; + cardStatus = json['cardStatus']; attendanceWay = json['attendanceWay']; } @@ -63,6 +66,7 @@ class CheckingInAddStaffListItemEntity { data['staffId'] = staffId; data['attendanceType'] = attendanceType; data['countryCode'] = countryCode; + data['cardStatus'] = cardStatus; data['attendanceWay'] = attendanceWay; return data; } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_logic.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_logic.dart index eb193fbc..5f1ab458 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_logic.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_logic.dart @@ -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; void _initLoadDataAction() { _teamEvent = eventBus.on().listen((event) { diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart index be4fc957..98208fbc 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart @@ -1,11 +1,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:get/get.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/customNetworkImage.dart'; import '../../../../../tools/noData.dart'; +import '../../../../../tools/showIosTipView.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; import 'checkingInStaffList_entity.dart'; @@ -55,22 +57,49 @@ class _CheckingInStaffListPageState extends State { ), body: Container( color: Colors.white, - child: Obx(() => state.staffListData.value.isNotEmpty ? ListView.separated( - itemCount: state.staffListData.value.length, - itemBuilder: (c, index) { - CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index]; - return _checkingInStaffManageItem(staffListItem, () { - Get.toNamed(Routers.checkingInStaffDetailPage, arguments: { - "staffListItem": staffListItem, - "getKeyInfosData": state.getKeyInfosData.value, - "companyId": state.companyId.value, - }); - }); - }, - separatorBuilder: (context, index) { - return const Divider( - height: 1, indent: 20, color: AppColors.greyLineColor); - }, + child: Obx(() => state.staffListData.value.isNotEmpty ? + SlidableAutoCloseBehavior( + child: ListView.separated( + itemCount: state.staffListData.value.length, + itemBuilder: (c, index) { + CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index]; + return Slidable( + key:ValueKey(staffListItem.staffId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context){ + 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()), )); } @@ -79,20 +108,90 @@ class _CheckingInStaffListPageState extends State { return GestureDetector( onTap: action, child: Container( - height: 60.h, + // height: 60.h, width: 1.sw, 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( children: [ - SizedBox(width: 30.w,), + SizedBox(width: 20.w,), // CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w), - Image.asset('images/controls_user.png', width: 40.w, height: 40.w), - SizedBox(width: 30.w,), - Text(staffListItem.staffName!, style: TextStyle(fontSize: 24.sp)), + Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w), + SizedBox(width: 20.w,), + 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(); + }, + ); + }, + ); + } + } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart index 9d7afd94..6ac277d9 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart @@ -26,7 +26,7 @@ class _CheckingInStaffDetailPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.staff!.tr, + barTitle: "员工信息", haveBack: true, backgroundColor: AppColors.mainColor, actionsList: [ @@ -62,7 +62,14 @@ class _CheckingInStaffDetailPageState extends State { CommonItem( leftTitel: TranslationLoader.lanKeys!.attendanceRecord!.tr, rightTitle: "", - isHaveDirection: true), + isHaveDirection: true, + action: (){ + Get.toNamed(Routers.checkingInDetailPage, arguments: { + // "getKeyInfosData": state.getKeyInfosData.value, + "companyId": state.companyId.value, + "staffId": state.staffListItemData.value.staffId, + }); + }), ], ), ); diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index 264675c3..11348c9f 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -25,6 +25,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController { Get.back(); showToast("修改成功", something: (){ eventBus.fire(ElectronicKeyListRefreshUI()); + eventBus.fire(AuthorizedAdminPageRefreshUI()); }); } } @@ -37,6 +38,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController { print("删除电子钥匙成功"); showToast("删除成功", something: (){ eventBus.fire(ElectronicKeyListRefreshUI()); + eventBus.fire(AuthorizedAdminPageRefreshUI()); Get.back(); }); } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index c563146d..94705580 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -10,6 +10,7 @@ import 'package:star_lock/tools/jh_pop_menus.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/commonItem.dart'; +import '../../../../../tools/dateTool.dart'; import '../../../../../tools/showIosTipView.dart'; import '../../../../../tools/showTFView.dart'; import '../../../../../tools/submitBtn.dart'; @@ -69,7 +70,7 @@ class _ElectronicKeyDetailPageState extends State { Obx(() => getPeriodValidityWidget()), Container(height: 10.h), CommonItem( - leftTitel: TranslationLoader.lanKeys!.receiver!.tr, + leftTitel: "接受账号", rightTitle: state.itemData.value.username, action: () {}), const SizedBox(height: 1), @@ -133,7 +134,6 @@ class _ElectronicKeyDetailPageState extends State { } else if (dateType == XSConstantMacro.keyTypeLoop) { return getLoopTypeDateWidget(); } - return Container(); } @@ -151,21 +151,19 @@ class _ElectronicKeyDetailPageState extends State { //限时钥匙 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( leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, allHeight: 90.h, - rightTitle: useDateStr, + rightTitle: '${state.beginTime.value}\n${state.endTime.value}', isHaveDirection: true, - action: () { - Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate, - arguments: {"itemData": state.itemData.value}); + action: () async { + var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, 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()); + } }); } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart index 83085ae1..b9bc7860 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart @@ -2,15 +2,27 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; +import '../../../../../tools/dateTool.dart'; + class ElectronicKeyDetailState { final itemData = ElectronicKeyListItem().obs; final keyName = "".obs; final TextEditingController changeNameController = TextEditingController(); + var beginTime = "".obs;// 开始时间 + var endTime = "".obs;// 结束时间 + var beginTimeTimestamp = 0.obs;// 开始时间时间戳 + var endTimeTimestamp = 0.obs;// 结束时间时间戳 + ElectronicKeyDetailState() { Map map = Get.arguments; itemData.value = map["itemData"]; changeNameController.text = 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!; } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart index 4a901cd5..602cd14f 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart @@ -18,8 +18,8 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController { keyboardPwdId: state.pwdId.value.toString(), keyboardPwdName: state.inputNameController.text, newKeyboardPwd: state.inputPwdController.text, - startDate: state.startDate.value, - endDate: state.endDate.value, + startDate: state.beginTimeTimestamp.value, + endDate: state.endTimeTimestamp.value, changeType: state.changeType.value, hoursStart: state.hoursStart.value, hoursEnd: state.hoursEnd.value, @@ -27,26 +27,42 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { showToast("修改成功", something: (){ eventBus.fire(ElectronicKeyListRefreshUI()); + eventBus.fire(AuthorizedAdminPageRefreshUI()); Get.back(); }); } } - //修改钥匙名称请求 + //修改钥匙请求 Future 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( state.itemData.value.keyId.toString(), state.itemData.value.lockId.toString(), - state.failureDateTime.millisecondsSinceEpoch.toString(), + state.endTimeTimestamp.value.toString(), state.endDay.value, '', - state.effectiveDateTime.millisecondsSinceEpoch.toString(), + state.beginTimeTimestamp.value.toString(), state.startDay.value, state.weekDays.value); if (entity.errorCode!.codeIsSuccessful) { showToast("修改成功", something: (){ eventBus.fire(ElectronicKeyListRefreshUI()); - Get.back(); + eventBus.fire(AuthorizedAdminPageRefreshUI()); + Get.back(result: { + "beginTimeTimestamp":state.beginTimeTimestamp.value, + "endTimeTimestamp":state.endTimeTimestamp.value, + }); }); } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart index d9ad5cf7..8c1701b4 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart @@ -56,50 +56,42 @@ class _ElectronicKeyDetailChangeDateState } Widget buildMainUI() { - String getStartDate = ""; - String getEndDate = ""; - if (state.itemData.value.startDate != null) { - DateTime startDateStr = - DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!); - getStartDate = startDateStr.toLocal().toString().substring(0, 16); - } - - if (state.itemData.value.endDate != null) { - DateTime endDateStr = - DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!); - getEndDate = endDateStr.toLocal().toString().substring(0, 16); - } + // String getStartDate = ""; + // String getEndDate = ""; + // if (state.itemData.value.startDate != null) { + // DateTime startDateStr = + // DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!); + // getStartDate = startDateStr.toLocal().toString().substring(0, 16); + // } + // + // if (state.itemData.value.endDate != null) { + // DateTime endDateStr = + // DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!); + // getEndDate = endDateStr.toLocal().toString().substring(0, 16); + // } return Column( children: [ Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, - rightTitle: state.selectEffectiveDate.value.isNotEmpty - ? state.selectEffectiveDate.value - : getStartDate, + rightTitle: state.beginTime.value, isHaveLine: true, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.YMDHM, - onConfirm: (p) { - state.selectEffectiveDate.value = - '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; - state.effectiveDateTime = - DateTime.parse(state.selectEffectiveDate.value); + Pickers.showDatePicker(context, mode: DateMode.YMDHM, 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.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch; + print("state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"); }); })), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, - rightTitle: state.selectFailureDate.value.isNotEmpty - ? state.selectFailureDate.value - : getEndDate, + rightTitle: state.endTime.value, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.YMDHM, - onConfirm: (p) { - state.selectFailureDate.value = - '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; - state.failureDateTime = - DateTime.parse(state.selectFailureDate.value); + Pickers.showDatePicker(context, mode: DateMode.YMDHM, 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.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch; + print("state.endTimeTimestamp.value:${state.endTimeTimestamp.value}"); }); })), ], diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart index cac37195..186c7636 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; +import '../../../../../tools/dateTool.dart'; + class ElectronicKeyDetailChangeDateState { final itemData = ElectronicKeyListItem().obs; final TextEditingController inputPwdController = TextEditingController(); @@ -11,15 +13,22 @@ class ElectronicKeyDetailChangeDateState { final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警) final hoursStart = 0.obs; final hoursEnd = 0.obs; - final startDate = 0.obs; - final endDate = 0.obs; final pwdId = ''.obs; final lockId = 0.obs; final fromType = ''.obs; - final selectEffectiveDate = ''.obs; //生效时间 - final selectFailureDate = ''.obs; //失效时间 - DateTime effectiveDateTime = DateTime.now(); - DateTime failureDateTime = DateTime.now(); + + // final startDate = 0.obs; + // final endDate = 0.obs; + // 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 startDay = ''.obs; final weekDays = [].obs; @@ -29,6 +38,10 @@ class ElectronicKeyDetailChangeDateState { // itemData.value = map["itemData"]; if ((map["itemData"] != null)) { 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)) { pwdId.value = map["pwdId"]; diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart index 96a859c5..4f8ca43d 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart @@ -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 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") { - print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}"); - if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) { - showToast("失效时间需大于生效时间"); - return; - } - - if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) { - showToast("生效时间需大于当前时间"); - return; - } + if (state.type.value == "0" || state.type.value == "3") { + print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}"); + if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) { + showToast("失效时间需大于生效时间"); + return; } + if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) { + showToast("生效时间需大于当前时间"); + return; + } + } + String lockID = state.keyInfo.value.lockId.toString(); int typeValue = int.parse(state.type.value); switch (typeValue) { diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart index ca3f0db0..1eb85be8 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart @@ -5,8 +5,7 @@ import 'package:get/get.dart'; import '../../../../lockMian/entity/lockListInfo_entity.dart'; class SendElectronicKeyState { - TextEditingController emailOrPhoneController = - TextEditingController(); //邮箱/手机号输入框 + TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框 TextEditingController keyNameController = TextEditingController(); //钥匙名输入框 final FlutterContactPicker contactPicker = FlutterContactPicker(); diff --git a/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart b/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart index 3e66daa9..92ecfc40 100644 --- a/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart +++ b/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart @@ -263,8 +263,7 @@ class AddFaceLogic extends BaseGetXController { showToast("添加成功"); if (state.fromType.value == 2) { // 回调人脸号 - eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent( - faceId.toString())); + eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.faceNumber.value)); } else if (state.fromType.value == 1) { eventBus.fire(OtherTypeRefreshListEvent()); } diff --git a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart index 91ea41a4..8ed2b3f2 100644 --- a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart +++ b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart @@ -19,7 +19,13 @@ class _AddFaceTypeManagePageState extends State { @override 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( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( @@ -29,7 +35,7 @@ class _AddFaceTypeManagePageState extends State { backgroundColor: AppColors.mainColor), body: Column( children: [ - AddFaceTypeManageTabbar(initialIndex: index), + AddFaceTypeManageTabbar(lockId: lockId, fromType: fromType, fromTypeTwoStaffName: fromTypeTwoStaffName, initialIndex: index), ], ), ); diff --git a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_tabbar.dart b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_tabbar.dart index 0704f149..34b0ae91 100644 --- a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_tabbar.dart @@ -9,24 +9,27 @@ import '../addFaceType_page.dart'; class AddFaceTypeManageTabbar extends StatefulWidget { var initialIndex = 1; - - AddFaceTypeManageTabbar({Key? key, required this.initialIndex}) - : super(key: key); + var lockId = 0; + var fromType = 1; // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + var fromTypeTwoStaffName = "";// 从添加员工进入 传入员工名字 + AddFaceTypeManageTabbar({Key? key, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName, required this.initialIndex}) : super(key: key); @override - State createState() => - _AddFaceTypeManageTabbarState(); + State createState() => _AddFaceTypeManageTabbarState(); } -class _AddFaceTypeManageTabbarState extends State - with SingleTickerProviderStateMixin { +class _AddFaceTypeManageTabbarState extends State with SingleTickerProviderStateMixin { late TabController _tabController; final List _itemTabs = [ ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), - ItemView( - title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"), + ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"), + ]; + + final List _fromCheckInTypeItemTabs = [ + ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), + ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), ]; @override @@ -60,7 +63,7 @@ class _AddFaceTypeManageTabbarState extends State TabBar _tabBar() { return TabBar( 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, indicatorColor: Colors.red, unselectedLabelColor: Colors.black, @@ -92,11 +95,12 @@ class _AddFaceTypeManageTabbarState extends State return Expanded( child: TabBarView( controller: _tabController, - children: _itemTabs - .map((ItemView item) => AddFaceTypePage( - selectType: item.selectType, - )) - .toList(), + children: + widget.fromType == 1 + ? _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(), + + // _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(), ), ); } diff --git a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart index 70126a10..eaad2544 100644 --- a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart +++ b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart @@ -13,9 +13,18 @@ import '../../../../translations/trans_lib.dart'; import 'addFaceType_logic.dart'; 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 State createState() => _AddFaceTypePageState(); @@ -28,6 +37,9 @@ class _AddFaceTypePageState extends State { @override Widget build(BuildContext context) { state.seletType.value = widget.selectType; + state.lockId.value = widget.lockId; + state.nameController.text = widget.fromTypeTwoStaffName; + state.fromType.value = widget.fromType; return indexChangeWidget(); } diff --git a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_state.dart b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_state.dart index b2b59331..8af55b3b 100644 --- a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_state.dart +++ b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_state.dart @@ -5,6 +5,7 @@ class AddFaceTypeState { final lockId = 0.obs; final seletType = "0".obs; // 0永久 1显示 2循环 final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字 final isStressFingerprint = false.obs; var beginTime = "".obs; // 开始时间 @@ -18,8 +19,14 @@ class AddFaceTypeState { final TextEditingController nameController = TextEditingController(); AddFaceTypeState() { - Map map = Get.arguments; - lockId.value = map["lockId"]; - fromType.value = map["fromType"]; + // Map map = Get.arguments; + // lockId.value = map["lockId"]; + // fromType.value = map["fromType"]; + // if(fromType.value == 2){ + // fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字 + // // nameController.text = fromTypeTwoStaffName.value; + // } + + // print("lockId:${lockId.value} fromType:${fromType.value}"); } } diff --git a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart index 842d98e4..866de542 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart @@ -368,7 +368,7 @@ class AddFingerprintLogic extends BaseGetXController { showToast("添加成功"); if(state.fromType.value == 2){ // 回调指纹号 - eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(fingerprintId)); + eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.fingerprintNumber.value)); }else if(state.fromType.value == 1){ eventBus.fire(OtherTypeRefreshListEvent()); } diff --git a/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintManage/addFingerprintTypeManage_tabbar.dart b/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintManage/addFingerprintTypeManage_tabbar.dart index baef6122..6393abf6 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintManage/addFingerprintTypeManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintManage/addFingerprintTypeManage_tabbar.dart @@ -30,6 +30,11 @@ class _AddFingerprintTypeManageTabbarState extends State _fromCheckInTypeItemTabs = [ + ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), + ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), + ]; + @override void initState() { // TODO: implement initState @@ -63,7 +68,7 @@ class _AddFingerprintTypeManageTabbarState extends State _tab(item)).toList(), + tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(), isScrollable: true, indicatorColor: Colors.red, unselectedLabelColor: Colors.black, @@ -85,8 +90,7 @@ class _AddFingerprintTypeManageTabbarState extends State AddFingerprintTypePage( - selectType: item.selectType, - lockId: widget.lockId, - fromType: widget.fromType, - fromTypeTwoStaffName:widget.fromTypeTwoStaffName - )) - .toList(), - ), + children: + widget.fromType == 1 + ? _itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList() + :_itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(), + ), ); } + } class ItemView { diff --git a/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart b/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart index 46322103..c9417af3 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart @@ -40,7 +40,8 @@ class _AddFingerprintTypePageState extends State { Widget build(BuildContext context) { state.selectType.value = widget.selectType; state.lockId.value = widget.lockId; - // state.nameController.text = widget.fromTypeTwoStaffName; + state.nameController.text = widget.fromTypeTwoStaffName; + state.fromType.value = widget.fromType; WidgetsBinding.instance.addPostFrameCallback((_) { // Your code here diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart index 01893bad..7fdc8446 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart @@ -117,54 +117,56 @@ class _FingerprintListPageState extends State with RouteAwa Widget _buildMainUI() { return Obx(() => state.fingerprintItemListData.value.isNotEmpty - ? ListView.separated( + ? SlidableAutoCloseBehavior( + child: ListView.separated( itemCount: state.fingerprintItemListData.value.length, itemBuilder: (c, index) { - FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index]; - // 指纹 - return Slidable( - key:ValueKey(fingerprintItemData.fingerprintId), - endActionPane: ActionPane( - extentRatio: 0.2, - motion: const ScrollMotion(), - children: [ - SlidableAction( - onPressed: (BuildContext context){ - showIosTipViewDialog(context); - }, - backgroundColor: Colors.red, - foregroundColor: Colors.white, - label: '删除', - ), - ], - ), - child: _keyItem( - 'images/icon_fingerprint.png', - fingerprintItemData.fingerprintName!, - (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", - fingerprintItemData.validTimeStr!, - // fingerprintItemData.fingerprintType! == 1 - // ? "永久" - // : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}", - () async { - var data = await Get.toNamed( - Routers.fingerprintDetailPage, - arguments: { - "fingerprintItemData": fingerprintItemData, - }); - if (data != null) { - logic.getFingerprintsListData(); - } - }), - ); + FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index]; + // 指纹 + return Slidable( + key:ValueKey(fingerprintItemData.fingerprintId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context){ + showIosTipViewDialog(context); + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + label: '删除', + ), + ], + ), + child: _keyItem( + 'images/icon_fingerprint.png', + fingerprintItemData.fingerprintName!, + (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", + fingerprintItemData.validTimeStr!, + // fingerprintItemData.fingerprintType! == 1 + // ? "永久" + // : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}", + () async { + var data = await Get.toNamed( + Routers.fingerprintDetailPage, + arguments: { + "fingerprintItemData": fingerprintItemData, + }); + if (data != null) { + logic.getFingerprintsListData(); + } + }), + ); }, separatorBuilder: (BuildContext context, int index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); + return const Divider( + height: 1, + 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) { diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart index 411a0f81..2f753b94 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart @@ -68,7 +68,7 @@ class _BasicInformationPageState extends State { leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, rightTitle: logic.getUseKeyTypeStr( state.lockBasicInfo.value.startDate, - state.lockBasicInfo.value.startDate, + state.lockBasicInfo.value.endDate, state.lockBasicInfo.value.keyType), allHeight: 70.h, isHaveLine: false), diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart index 9795027b..36666840 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart @@ -31,7 +31,7 @@ class _EditLockNamePageState extends State { actionsList: [ TextButton( child: Text( - TranslationLoader.lanKeys!.sure!.tr, + TranslationLoader.lanKeys!.save!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () { @@ -45,7 +45,7 @@ class _EditLockNamePageState extends State { child: LoginInput( controller: state.changeLockNameController, leftWidget: const SizedBox(), - hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, + hintText: "请输入名称", inputFormatters: [ LengthLimitingTextInputFormatter(50), ]), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index 6e208b46..9dc89753 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -98,14 +98,10 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { } var entity = await ApiRepository.to.getPasswordKey( endDate: getFailureDateTime, - isExclusive: '0', keyboardPwdName: state.nameController.text, keyboardPwdType: getKeyType, - keyboardPwdVersion: '0', lockId: lockId, - operatorUid: '0', startDate: getEffectiveDateTime, - timezoneRawOffSet: '0', startHours: state.loopStartHours.value, endHours: state.loopEndHours.value, isCoerced: 1); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index e3b914ae..2d476fc5 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -644,8 +644,7 @@ class _PasswordKeyPerpetualPageState extends State wit return widgetList; } - GestureDetector buildCenter3( - String imageName, String titleStr, int itemIndex) { + GestureDetector buildCenter3(String imageName, String titleStr, int itemIndex) { return GestureDetector( child: Container( width: 120.w, diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 21a4ab39..2afe6bdb 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -85,6 +85,7 @@ abstract class Api { final String getStaffListURL = '/staff/list'; // 获取员工列表 final String addStaffURL = '/staff/add'; // 添加员工 final String editStaffURL = '/staff/update'; // 编辑员工 + final String deleteStaffURL = '/staff/delete'; // 删除员工 final String addStaffSelectKeyURL = '/staff/attendanceList'; // 考勤设置添加员工-选择钥匙 final String addHolidaysURL = '/vacation/add'; // 添加假期 final String holidaysListURL = '/vacation/list'; // 假期列表 diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 38b45b4a..d82f63db 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -392,14 +392,10 @@ class ApiProvider extends BaseProvider { Future getKeyboardPwd( String endDate, - String isExclusive, String keyboardPwdName, String keyboardPwdType, - String keyboardPwdVersion, String lockId, - String operatorUid, String startDate, - String timezoneRawOffSet, int startHours, int endHours, int isCoerced) => @@ -407,14 +403,10 @@ class ApiProvider extends BaseProvider { passwordKeyGetURL.toUrl, jsonEncode({ 'endDate': endDate, - 'isExclusive': isExclusive, 'keyboardPwdName': keyboardPwdName, 'keyboardPwdType': keyboardPwdType, - 'keyboardPwdVersion': keyboardPwdVersion, 'lockId': lockId, - 'operatorUid': operatorUid, 'startDate': startDate, - 'timezoneRawOffSet': timezoneRawOffSet, 'hoursStart': startHours, 'hoursEnd': endHours, 'isCoerced': isCoerced, @@ -776,6 +768,14 @@ class ApiProvider extends BaseProvider { 'lockId': lockId, })); + // 删除 + Future deletStaffData(int lockId, int staffId) => post( + deleteStaffURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'staffId': staffId, + })); + // 添加员工 Future addStaffData( String attendanceType, diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index c160c5b3..4be41a1e 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -398,27 +398,19 @@ class ApiRepository { //获取密码 Future getPasswordKey( {required String endDate, - required String isExclusive, required String keyboardPwdName, required String keyboardPwdType, - required String keyboardPwdVersion, required String lockId, - required String operatorUid, required String startDate, - required String timezoneRawOffSet, required int startHours, required int endHours, required int isCoerced}) async { final res = await apiProvider.getKeyboardPwd( endDate, - isExclusive, keyboardPwdName, keyboardPwdType, - keyboardPwdVersion, lockId, - operatorUid, startDate, - timezoneRawOffSet, startHours, endHours, isCoerced); @@ -1016,6 +1008,15 @@ class ApiRepository { return CheckingInAddStaffListEntity.fromJson(res.body); } + // 删除员工 + Future deletStaffData({ + required int lockId, + required int staffId, + }) async { + final res = await apiProvider.deletStaffData(lockId, staffId); + return LoginEntity.fromJson(res.body); + } + // 添加员工 Future addStaffData({ required String attendanceType, @@ -1092,7 +1093,7 @@ class ApiRepository { } // 修改考勤设置信息 - Future editCheckInSetInfoData({ + Future editCheckInSetInfoData({ required String attendanceType, required String companyId, required String type, @@ -1103,7 +1104,7 @@ class ApiRepository { }) async { final res = await apiProvider.editCheckInSetInfoData(attendanceType, companyId, type, companyName, workEndTime, workStartTime, workDay); - return CheckingInSetEntity.fromJson(res.body); + return LoginEntity.fromJson(res.body); } // 获取指纹列表 diff --git a/star_lock/lib/tools/commonItem.dart b/star_lock/lib/tools/commonItem.dart index 5765d1de..6c672787 100644 --- a/star_lock/lib/tools/commonItem.dart +++ b/star_lock/lib/tools/commonItem.dart @@ -60,8 +60,8 @@ class CommonItem extends StatelessWidget { isHaveRightWidget! ? rightWidget! : SizedBox( - width: 250.w, - child: Text( + width: rightTitle!.isNotEmpty ? 250.w : 0.1.w, + child: Text( rightTitle ?? "", textAlign: TextAlign.right, overflow: TextOverflow.ellipsis, diff --git a/star_lock/lib/tools/dateTool.dart b/star_lock/lib/tools/dateTool.dart index b0f48d00..aca77373 100644 --- a/star_lock/lib/tools/dateTool.dart +++ b/star_lock/lib/tools/dateTool.dart @@ -35,7 +35,7 @@ class DateTool { int time = int.parse(timeDate); 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; }