From d4e64da5aad11b1f1973b42ba5dcb6ba693b0f29 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, 21 Sep 2023 14:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=80=83=E5=8B=A4=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=91=98=E5=B7=A5=E6=B7=BB=E5=8A=A0=E6=8C=87=E7=BA=B9?= =?UTF-8?q?=E3=80=81=E5=8D=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 12 +- star_lock/images/lan/lan_keys.json | 12 +- star_lock/images/lan/lan_zh.json | 12 +- .../checkingInAddStaff_logic.dart | 57 ++++-- .../checkingInAddStaff_page.dart | 169 +++++++++++++++-- .../checkingInAddStaff_state.dart | 1 + .../checkingInStaffList_page.dart | 4 +- .../addFingerprint/addFingerprint_logic.dart | 5 + .../addFingerprint/addFingerprint_state.dart | 2 + .../addFingerprintTip_state.dart | 2 + .../addICCard/addICCard_logic.dart | 7 +- .../addICCard/addICCard_state.dart | 2 + .../otherTypeAddKey_logic.dart | 4 +- .../otherTypeAddKey/otherTypeAddKey_page.dart | 7 +- .../otherTypeAddKey_state.dart | 9 +- .../otherTypeKeyDetail_page.dart | 178 +++++++++--------- .../otherTypeKeyList_page.dart | 3 +- .../otherTypeKeyManage_page.dart | 11 +- .../otherTypeKeyManage_tabbar.dart | 6 +- star_lock/lib/tools/eventBusEventManage.dart | 6 + star_lock/lib/translations/lanKeyEntity.dart | 45 ++++- 21 files changed, 410 insertions(+), 144 deletions(-) diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index 4ca15633..ca230699 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -405,5 +405,15 @@ "pleaseEnterWifiPwd":"Please Enter WiFi Password", "edit":"Edit", "stressFingerprint":"Stress Fingerprint", - "effectiveDay":"Effective Day" + "effectiveDay":"Effective Day", + + "whetherTheEmployeeHasPassword":"If The Employee Has A Password", + "whetherTheEmployeeHasCard":"If The Employee Has A Card", + "whetherTheEmployeeHasFingerprint":"If The Employee Has A Fingerprint", + "seletPassword":"Selet Password", + "seletCard":"Selet Card", + "seletFingerprint":"Selet Fingerprint", + "getKey":"Get Key", + "getCard":"Get Card", + "getFingerprint":"Get Fingerprint" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index e48b4baa..2e1e6224 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -405,5 +405,15 @@ "pleaseEnterWifiPwd":"pleaseEnterWifiPwd", "edit":"edit", "stressFingerprint":"stressFingerprint", - "effectiveDay":"effectiveDay" + "effectiveDay":"effectiveDay", + + "whetherTheEmployeeHasPassword":"whetherTheEmployeeHasPassword", + "whetherTheEmployeeHasCard":"whetherTheEmployeeHasCard", + "whetherTheEmployeeHasFingerprint":"whetherTheEmployeeHasFingerprint", + "seletPassword":"seletPassword", + "seletCard":"seletCard", + "seletFingerprint":"seletFingerprint", + "getKey":"getKey", + "getCard":"getCard", + "getFingerprint":"getFingerprint" } \ No newline at end of file diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 0a09c1c9..06b3ace3 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -408,5 +408,15 @@ "pleaseEnterWifiPwd":"请输入WiFi密码", "edit":"编辑", "stressFingerprint":"胁迫指纹", - "effectiveDay":"有效日" + "effectiveDay":"有效日", + + "whetherTheEmployeeHasPassword":"员工是否有密码", + "whetherTheEmployeeHasCard":"员工是否有卡", + "whetherTheEmployeeHasFingerprint":"员工是否有指纹", + "seletPassword":"选择密码", + "seletCard":"选择卡", + "seletFingerprint":"选择指纹", + "getKey":"获取钥匙", + "getCard":"获取卡", + "getFingerprint":"获取指纹" } \ No newline at end of file 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 74dd5dde..6a9355ab 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,4 +1,6 @@ +import 'dart:async'; + import 'package:get/get.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/toast.dart'; @@ -11,6 +13,16 @@ typedef KeyClickCallback = void Function(List selet class CheckingInAddStaffLogic extends BaseGetXController{ CheckingInAddStaffState state = CheckingInAddStaffState(); + // 下级界面修改成功后传递数据 + StreamSubscription? _getNumberEvent; + void _initLoadDataAction() { + // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus + _getNumberEvent = + eventBus.on().listen((event) { + state.getDataPassword.value = event.number; + }); + } + // 添加员工 void addStaffLoadData() async{ var attendanceWay = ""; @@ -51,11 +63,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{ break; } - if(state.staffNameController.text.isEmpty){ - Toast.show(msg: "请输入姓名"); - return; - } - var entity = await ApiRepository.to.addStaffData( attendanceType: state.seletPrintingMethodType.value, attendanceWay: attendanceWay, @@ -72,11 +79,11 @@ class CheckingInAddStaffLogic extends BaseGetXController{ } } - // 考勤设置添加员工-选择钥匙 + // 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,attendanceWay分别为用户名、密码、卡号、指纹号 void addStaffSeletKey(KeyClickCallback kyClickCallback) async{ var entity = await ApiRepository.to.addStaffSeletKeyData( companyId: state.companyId.value, - type:"1", + type:state.seletPrintingMethodType.value, ); if(entity.errorCode!.codeIsSuccessful){ state.keyEntity.value = entity.data!; @@ -124,11 +131,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{ break; } - if(state.staffNameController.text.isEmpty){ - Toast.show(msg: "请输入姓名"); - return; - } - var entity = await ApiRepository.to.editStaffData( attendanceType: state.seletPrintingMethodType.value, attendanceWay: attendanceWay, @@ -146,12 +148,38 @@ class CheckingInAddStaffLogic extends BaseGetXController{ } } + //获取密码请求 + void getKeyboardPwdRequest() async { + if(state.staffNameController.text.isEmpty){ + Toast.show(msg: "请输入姓名"); + return; + } + var entity = await ApiRepository.to.getPasswordKey( + "0", + '0', + state.staffNameController.text, + 2.toString(), + '0', + state.getKeyInfosData.value.lockId.toString(), + '0', + "0", + '0'); + if (entity.errorCode!.codeIsSuccessful) { + print('获取密码成功'); + if (entity.data != null) { + state.getDataPassword.value = entity.data!.keyboardPwd!; + } + } else { + Toast.show(msg: '${entity.errorMsg}'); + } + } + @override void onReady() { // TODO: implement onReady super.onReady(); print("onReady()"); - + _initLoadDataAction(); } @override @@ -159,13 +187,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{ // TODO: implement onInit super.onInit(); print("onInit()"); - } @override void onClose() { // TODO: implement onClose + super.onClose(); + _getNumberEvent!.cancel(); } } \ No newline at end of file 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 0ee9a749..aa261d99 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 @@ -8,6 +8,7 @@ import '../../../../../tools/commonItem.dart'; import '../../../../../tools/showBottomSheetTool.dart'; import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/titleAppBar.dart'; +import '../../../../../tools/toast.dart'; import '../../../../../translations/trans_lib.dart'; import 'checkingInAddStaff_logic.dart'; @@ -49,12 +50,10 @@ class _CheckingInAddStaffPageState extends State { var list = ["APP", "密码", "卡", "指纹"]; _showSeletClockInType(list, "1"); })), - SizedBox( - height: 10.h, - ), - CommonItem( - leftTitel: - TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr, + SizedBox(height: 10.h,), + //员工是否有App、卡、钥匙、指纹必须显示 + Obx(() => CommonItem( + leftTitel:addStaffGetIfHaveKey(), rightTitle: "", isHaveLine: true, isHaveRightWidget: true, @@ -72,9 +71,10 @@ class _CheckingInAddStaffPageState extends State { }); }), ], - )), + ))), + // 当选择App时显示 其他隐藏 Obx(() => Visibility( - visible: state.appUnHaveAccount.value, + visible: (state.appUnHaveAccount.value && state.seletPrintingMethodType.value == "1") ? true : false, child: Column( children: [ CommonItem( @@ -108,10 +108,77 @@ class _CheckingInAddStaffPageState extends State { ], ), )), + // 当选择密码、卡、指纹时显示 + Obx(() => Visibility( + visible: (state.seletPrintingMethodType.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))), + SizedBox(width: 30.w,), + SizedBox( + width: 130.w, + height: 40.h, + child: ElevatedButton( + style: ElevatedButton.styleFrom(backgroundColor: AppColors.mainColor,), + child: Text(addStaffSeletKeyType(), style: TextStyle(color: Colors.white, fontSize: 22.sp)), + onPressed: () async { + switch(int.parse(state.seletPrintingMethodType.value)){ + case 2: + // 获取密码 + logic.getKeyboardPwdRequest(); + break; + case 3: + // 卡 + if(state.staffNameController.text.isEmpty){ + Toast.show(msg: "请输入姓名"); + return; + } + + var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: { + "lockId": state.getKeyInfosData.value.lockId, + "keyType": 0, + "fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + "fromTypeTwoStaffName" :state.staffNameController.text + }); + if(data != null) { + + } + break; + case 4: + // 指纹 + if(state.staffNameController.text.isEmpty){ + Toast.show(msg: "请输入姓名"); + return; + } + + var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: { + "lockId": state.getKeyInfosData.value.lockId, + "keyType": 1, + "fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + "fromTypeTwoStaffName" :state.staffNameController.text + }); + if(data != null) { + + } + break; + break; + } + + } + ), + ), + ], + )), + )), + // 当选择钥匙类型为有时 必显示 Obx(() => Visibility( visible: !state.appUnHaveAccount.value, child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.selectKey!.tr, + leftTitel: addStaffGetKeyType(), rightTitle: state.seletKey.value, isHaveLine: false, isHaveDirection: true, @@ -126,15 +193,18 @@ class _CheckingInAddStaffPageState extends State { }), )), - SizedBox( - height: 50.w, - ), + SizedBox(height: 50.w), 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){ + Toast.show(msg: "请输入姓名"); + return; + } + if(state.isAdd.value == "2"){ logic.editStaffLoadData(); }else{ @@ -191,13 +261,16 @@ class _CheckingInAddStaffPageState extends State { data: list, //选择事件的回调 clickCallBack: (int index, var str) { - print("object:$index str:$str"); - if(type == "1"){ - state.seletPrintingMethodType.value = (index+1).toString(); - state.seletPrintingMethodStr.value = str.toString(); - }else{ - state.seletKey.value = str.toString(); - } + setState(() { + if(type == "1"){ + state.seletPrintingMethodType.value = (index+1).toString(); + state.seletPrintingMethodStr.value = str.toString(); + state.getDataPassword.value = ""; + }else{ + state.seletKey.value = str.toString(); + } + print("object:$index str:$str type:$type state.seletPrintingMethodType.value:${state.seletPrintingMethodType.value}"); + }); }); } @@ -224,4 +297,62 @@ class _CheckingInAddStaffPageState extends State { ), ); } + + String addStaffGetIfHaveKey(){ + String title = ""; + switch(int.parse(state.seletPrintingMethodType.value)){ + case 1: + title = TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr; + break; + case 2: + title = TranslationLoader.lanKeys!.whetherTheEmployeeHasPassword!.tr; + break; + case 3: + title = TranslationLoader.lanKeys!.whetherTheEmployeeHasCard!.tr; + break; + case 4: + title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr; + break; + } + return title; + } + + String addStaffGetKeyType(){ + String title = ""; + switch(int.parse(state.seletPrintingMethodType.value)){ + case 1: + title = TranslationLoader.lanKeys!.accountNumber!.tr; + break; + case 2: + title = TranslationLoader.lanKeys!.password!.tr; + break; + case 3: + title = TranslationLoader.lanKeys!.card!.tr; + break; + case 4: + title = TranslationLoader.lanKeys!.fingerprint!.tr; + break; + } + return title; + } + + String addStaffSeletKeyType(){ + String title = ""; + switch(int.parse(state.seletPrintingMethodType.value)){ + case 1: + title = TranslationLoader.lanKeys!.getKey!.tr; + break; + case 2: + title = TranslationLoader.lanKeys!.getPassword!.tr; + break; + case 3: + title = TranslationLoader.lanKeys!.getCard!.tr; + break; + case 4: + title = TranslationLoader.lanKeys!.getFingerprint!.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 9d54e524..171c1ba5 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 @@ -25,6 +25,7 @@ class CheckingInAddStaffState{ final seletKey = "".obs; final isAdd = "1".obs; // 1添加 2编辑 + final getDataPassword = "".obs; CheckingInAddStaffState() { Map map = Get.arguments; 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 83642832..f4822c95 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 @@ -86,8 +86,8 @@ class _CheckingInStaffListPageState extends State { child: Row( children: [ SizedBox(width: 30.w,), - CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w), - // Image.asset('images/controls_user.png', width: 40.w, height: 40.w), + // CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w), + Image.asset('images/controls_user.png', width: 40.w, height: 40.w), SizedBox(width: 30.w,), Text(staffListItem.staffName!, style: TextStyle(fontSize: 24.sp)), ], diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart index 1757ee52..388915f5 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart @@ -14,6 +14,7 @@ import '../../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../../blue/sender_manage.dart'; import '../../../../../network/api_repository.dart'; import '../../../../../tools/baseGetXController.dart'; +import '../../../../../tools/eventBusEventManage.dart'; import '../../../../../tools/storage.dart'; import '../../../../../tools/toast.dart'; import 'addFingerprint_state.dart'; @@ -231,6 +232,10 @@ class AddFingerprintLogic extends BaseGetXController { ); if(entity.errorCode!.codeIsSuccessful){ Toast.show(msg: "添加成功"); + if(state.fromType.value == 2){ + // 回调指纹号 + eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent("")); + } Get.close(3); } } diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart index 19896e12..a0eeebb9 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart @@ -13,6 +13,7 @@ class AddFingerprintState{ final isCoerced = "".obs; final startDate = "".obs; final weekDay = [].obs; + final fromType = 0.obs; AddFingerprintState() { Map map = Get.arguments; @@ -26,5 +27,6 @@ class AddFingerprintState{ startDate.value = map["startDate"]; lockId.value = map["lockId"]; weekDay.value = map["weekDay"]; + fromType.value = map["fromType"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart index 325fba5d..95c43c07 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart @@ -11,6 +11,7 @@ class AddFingerprintTipState{ final isCoerced = "".obs; final startDate = "".obs; final weekDay = [].obs; + final fromType = 0.obs; AddFingerprintTipState() { Map map = Get.arguments; @@ -24,5 +25,6 @@ class AddFingerprintTipState{ startDate.value = map["startDate"]; lockId.value = map["lockId"]; weekDay.value = map["weekDay"]; + fromType.value = map["fromType"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart index df44fec8..7abfbc71 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart @@ -14,6 +14,7 @@ import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; import '../../../../network/api_repository.dart'; +import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/storage.dart'; import '../../../../tools/toast.dart'; import 'addICCard_state.dart'; @@ -186,7 +187,11 @@ class AddICCardLogic extends BaseGetXController{ ); if(entity.errorCode!.codeIsSuccessful){ Toast.show(msg: "添加成功"); - Get.close(3); + if(state.fromType.value == 2){ + // 回调卡号 + eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent("")); + } + Get.close(2); } } diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart index fa8543db..5a2395de 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart @@ -13,6 +13,7 @@ class AddICCardState{ final isCoerced = "".obs; final startDate = "".obs; final weekDay = [].obs; + final fromType = 0.obs; AddICCardState() { Map map = Get.arguments; @@ -26,5 +27,6 @@ class AddICCardState{ startDate.value = map["startDate"]; lockId.value = map["lockId"]; weekDay.value = map["weekDay"]; + fromType.value = map["fromType"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart index f246899d..1f46a29d 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart @@ -73,7 +73,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController { } - switch (state.fromType.value) { + switch (state.lockType.value) { case 0: // 卡 Get.toNamed(Routers.addICCardPage, arguments: { @@ -86,6 +86,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController { "isCoerced": state.isStressFingerprint.value ? "1" : "2", "startDate": startDate, "weekDay": state.weekdaysList.value, + "fromType": state.fromType.value, }); // var entity = await ApiRepository.to.addICCardData( @@ -117,6 +118,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController { "isCoerced": state.isStressFingerprint.value ? "1" : "2", "startDate": startDate, "weekDay": state.weekdaysList.value, + "fromType": state.fromType.value, }); // var entity = await ApiRepository.to.addFingerprintsData( diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart index 9e8a525e..aa6a42c7 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart @@ -18,8 +18,10 @@ class OtherTypeAddKeyPage extends StatefulWidget { final String seletType; final int lockType; // 0卡 1指纹 2钥匙 final int lockId; + final int fromType;// // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + final String fromTypeTwoStaffName;// 从添加员工进入 传入员工名字 const OtherTypeAddKeyPage( - {Key? key, required this.seletType, required this.lockType, required this.lockId}) : super(key: key); + {Key? key, required this.seletType, required this.lockType, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName}) : super(key: key); @override State createState() => _OtherTypeAddKeyPageState(); @@ -32,8 +34,9 @@ class _OtherTypeAddKeyPageState extends State { @override Widget build(BuildContext context) { state.seletType.value = widget.seletType; - state.fromType.value = widget.lockType; + state.lockType.value = widget.lockType; state.lockId.value = widget.lockId; + state.nameController.text = widget.fromTypeTwoStaffName; return indexChangeWidget(); } diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart index 35d707df..ca314d0b 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart @@ -6,7 +6,8 @@ import 'package:get/get.dart'; class OtherTypeAddKeyState{ final lockId = 0.obs; final seletType = "0".obs;// 0永久 1显示 2循环 - final fromType = 0.obs;// 0卡 1指纹 2钥匙 + final lockType = 0.obs;// 0卡 1指纹 2钥匙 + final fromType = 0.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入 final isStressFingerprint = false.obs; var beginTime = "".obs;// 开始时间 @@ -20,8 +21,8 @@ class OtherTypeAddKeyState{ final TextEditingController nameController = TextEditingController(); OtherTypeAddKeyState() { - Map map = Get.arguments; - lockId.value = map["lockId"]; - fromType.value = map["fromType"]; + // Map map = Get.arguments; + // lockId.value = map["lockId"]; + // fromType.value = map["fromType"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart index 26be1af0..38b89b6b 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart @@ -251,95 +251,95 @@ class _OtherTypeKeyDetailPageState extends State { ); } - Widget addControlsBtn(int type) { - List widgetList = []; - List> routerList = []; - //卡详情 - if (type == 0) { - routerList.add({ - 'btnTitle': '设置密码', - 'routerName': Routers.passwordKeyDetailPage, - 'type': 9 - }); - routerList.add({ - 'btnTitle': '设置指纹', - 'routerName': Routers.otherTypeKeyManagePage, - 'type': 1 - }); - routerList.add({ - 'btnTitle': '设置遥控', - 'routerName': Routers.otherTypeKeyManagePage, - 'type': 2 - }); - } else if (type == 1) { - //指纹详情 - routerList.add({ - 'btnTitle': '设置密码', - 'routerName': Routers.passwordKeyDetailPage, - 'type': 9 - }); - routerList.add({ - 'btnTitle': '设置卡', - 'routerName': Routers.otherTypeKeyManagePage, - 'type': 0 - }); - routerList.add({ - 'btnTitle': '设置遥控', - 'routerName': Routers.otherTypeKeyManagePage, - 'type': 2 - }); - } else if (type == 2) { - //遥控详情 - routerList.add({ - 'btnTitle': '设置密码', - 'routerName': Routers.passwordKeyDetailPage, - 'type': 9 - }); - routerList.add({ - 'btnTitle': '设置卡', - 'routerName': Routers.otherTypeKeyManagePage, - 'type': 0 - }); - routerList.add({ - 'btnTitle': '设置指纹', - 'routerName': Routers.otherTypeKeyManagePage, - 'type': 1 - }); - } - - for (int i = 0; i < routerList.length; i++) { - widgetList.add(SizedBox( - width: ScreenUtil().screenWidth - 40.w, - height: 60.h, - child: OutlinedButton( - style: OutlinedButton.styleFrom( - // backgroundColor: Colors.white, - side: BorderSide(width: 1, color: AppColors.mainColor)), - onPressed: () { - if (routerList[i]['type'] == 9) { - Navigator.pushNamed(context, Routers.passwordKeyManagePage); - } else { - Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, - arguments: routerList[i]['type']); - } - }, - child: Text( - routerList[i]['btnTitle'], - style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), - )), - )); - - widgetList.add( - SizedBox( - height: 10.h, - ), - ); - } - - return Column( - children: widgetList, - ); - } + // Widget addControlsBtn(int type) { + // List widgetList = []; + // List> routerList = []; + // //卡详情 + // if (type == 0) { + // routerList.add({ + // 'btnTitle': '设置密码', + // 'routerName': Routers.passwordKeyDetailPage, + // 'type': 9 + // }); + // routerList.add({ + // 'btnTitle': '设置指纹', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 1 + // }); + // routerList.add({ + // 'btnTitle': '设置遥控', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 2 + // }); + // } else if (type == 1) { + // //指纹详情 + // routerList.add({ + // 'btnTitle': '设置密码', + // 'routerName': Routers.passwordKeyDetailPage, + // 'type': 9 + // }); + // routerList.add({ + // 'btnTitle': '设置卡', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 0 + // }); + // routerList.add({ + // 'btnTitle': '设置遥控', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 2 + // }); + // } else if (type == 2) { + // //遥控详情 + // routerList.add({ + // 'btnTitle': '设置密码', + // 'routerName': Routers.passwordKeyDetailPage, + // 'type': 9 + // }); + // routerList.add({ + // 'btnTitle': '设置卡', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 0 + // }); + // routerList.add({ + // 'btnTitle': '设置指纹', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 1 + // }); + // } + // + // for (int i = 0; i < routerList.length; i++) { + // widgetList.add(SizedBox( + // width: ScreenUtil().screenWidth - 40.w, + // height: 60.h, + // child: OutlinedButton( + // style: OutlinedButton.styleFrom( + // // backgroundColor: Colors.white, + // side: BorderSide(width: 1, color: AppColors.mainColor)), + // onPressed: () { + // if (routerList[i]['type'] == 9) { + // Navigator.pushNamed(context, Routers.passwordKeyManagePage); + // } else { + // Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, + // arguments: routerList[i]['type']); + // } + // }, + // child: Text( + // routerList[i]['btnTitle'], + // style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), + // )), + // )); + // + // widgetList.add( + // SizedBox( + // height: 10.h, + // ), + // ); + // } + // + // return Column( + // children: widgetList, + // ); + // } String getAppBarTitle(int type) { String title = ""; diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart index ba9ba0d1..db150da1 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart @@ -70,7 +70,8 @@ class _OtherTypeKeyListPageState extends State { onClick: () async { var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: { "lockId": state.lockId.value, - "fromType": state.fromType.value + "keyType": state.fromType.value, + "fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入 }); if(data != null) { switch (state.fromType.value) { diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_page.dart index 5b44f0a5..e2819ad9 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_page.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_page.dart @@ -22,18 +22,23 @@ class _OtherTypeKeyManagePageState extends State { // 0卡 1指纹 2钥匙 Map map = Get.arguments; var lockId = map["lockId"]; - var lockType = map["fromType"]; + var lockKeyType = map["keyType"]; + var fromType = map["fromType"]; // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + var fromTypeTwoStaffName = ""; + if(fromType == 2){ + fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字 + } return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: - "${TranslationLoader.lanKeys!.addTip!.tr}${getAppBarTitle(lockType)}", + "${TranslationLoader.lanKeys!.addTip!.tr}${getAppBarTitle(lockKeyType)}", haveBack: true, backgroundColor: AppColors.mainColor), body: Column( children: [ - OtherTypeKeyManageTabbar(initialIndex: index, lockType: lockType, lockId: lockId), + OtherTypeKeyManageTabbar(initialIndex: index, lockType: lockKeyType, lockId: lockId, fromType: fromType, fromTypeTwoStaffName:fromTypeTwoStaffName), ], ), ); diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_tabbar.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_tabbar.dart index 34e8f88d..5f479f0a 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyManage/otherTypeKeyManage_tabbar.dart @@ -11,8 +11,10 @@ class OtherTypeKeyManageTabbar extends StatefulWidget { var initialIndex = 1; var lockType = 0; var lockId = 0; + var fromType = 0; // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + var fromTypeTwoStaffName = "";// 从添加员工进入 传入员工名字 OtherTypeKeyManageTabbar( - {Key? key, required this.initialIndex, required this.lockType, required this.lockId}) + {Key? key, required this.initialIndex, required this.lockType, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName}) : super(key: key); @override @@ -91,6 +93,8 @@ class _OtherTypeKeyManageTabbarState extends State seletType: item.seletType, lockType: widget.lockType, lockId: widget.lockId, + fromType: widget.fromType, + fromTypeTwoStaffName:widget.fromTypeTwoStaffName )) .toList(), ), diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index 6cffeaba..9bde6fa4 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -24,3 +24,9 @@ class PassCurrentLockInformationEvent{ class OtherTypeRefreshListEvent{ OtherTypeRefreshListEvent(); } + +/// 考情添加员工卡、指纹之后回调卡、指纹number +class ChickInAddStaffCardAndFingerprintBlockNumberEvent{ + String number; + ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number); +} diff --git a/star_lock/lib/translations/lanKeyEntity.dart b/star_lock/lib/translations/lanKeyEntity.dart index 3206c9a8..577ee896 100644 --- a/star_lock/lib/translations/lanKeyEntity.dart +++ b/star_lock/lib/translations/lanKeyEntity.dart @@ -387,10 +387,19 @@ class LanKeyEntity { this.wifiPwd, this.pleaseEnterWifiPwd, this.wifiDistributionNetwork, - this.attendanceRecord, - this.edit, - this.stressFingerprint, - this.effectiveDay + this.attendanceRecord, + this.edit, + this.stressFingerprint, + this.effectiveDay, + this.whetherTheEmployeeHasPassword, + this.whetherTheEmployeeHasCard, + this.whetherTheEmployeeHasFingerprint, + this.seletPassword, + this.seletCard, + this.seletFingerprint, + this.getKey, + this.getCard, + this.getFingerprint, }); LanKeyEntity.fromJson(dynamic json) { @@ -815,6 +824,15 @@ class LanKeyEntity { edit = json['edit']; stressFingerprint = json['stressFingerprint']; effectiveDay = json['effectiveDay']; + whetherTheEmployeeHasPassword = json['whetherTheEmployeeHasPassword']; + whetherTheEmployeeHasCard = json['whetherTheEmployeeHasCard']; + whetherTheEmployeeHasFingerprint = json['whetherTheEmployeeHasFingerprint']; + seletPassword = json['seletPassword']; + seletCard = json['seletCard']; + seletFingerprint = json['seletFingerprint']; + getKey = json['getKey']; + getCard = json['getCard']; + getFingerprint = json['getFingerprint']; } String? starLock; String? clickUnlockAndHoldDownClose; @@ -1225,6 +1243,16 @@ class LanKeyEntity { String? edit; String? stressFingerprint; String? effectiveDay; + String? whetherTheEmployeeHasPassword; + String? whetherTheEmployeeHasCard; + String? whetherTheEmployeeHasFingerprint; + String? seletPassword; + String? seletCard; + String? seletFingerprint; + String? getKey; + String? getCard; + String? getFingerprint; + Map toJson() { final map = {}; map['starLock'] = starLock; @@ -1645,6 +1673,15 @@ class LanKeyEntity { map['edit'] = edit; map['stressFingerprint'] = stressFingerprint; map['effectiveDay'] = effectiveDay; + map['whetherTheEmployeeHasPassword'] = whetherTheEmployeeHasPassword; + map['whetherTheEmployeeHasCard'] = whetherTheEmployeeHasCard; + map['whetherTheEmployeeHasFingerprint'] = whetherTheEmployeeHasFingerprint; + map['seletPassword'] = seletPassword; + map['seletCard'] = seletCard; + map['seletFingerprint'] = seletFingerprint; + map['getKey'] = getKey; + map['getCard'] = getCard; + map['getFingerprint'] = getFingerprint; return map; } }