diff --git a/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart b/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart index f2084d4a..94b20c86 100755 --- a/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart +++ b/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart @@ -105,7 +105,7 @@ class _CardDetailPageState extends State with RouteAware { state.endDate.value = data['endDate']; state.starTime.value = data['starTime']; state.endTime.value = data['endTime']; - state.weekDay.value = data['weekDay']; + state.weekDay.value = data['validityValue']; }); } } @@ -131,7 +131,7 @@ class _CardDetailPageState extends State with RouteAware { state.endDate.value = data['endDate']; state.starTime.value = data['starTime']; state.endTime.value = data['endTime']; - state.weekDay.value = data['weekDay']; + state.weekDay.value = data['validityValue']; }); } })))), diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart index df21ce95..2c0268fd 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart'; import 'package:star_lock/blue/io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -45,9 +46,15 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) { _replyAddFaceBegin(reply); } + + // 添加掌静脉开始(此处用作修改掌静脉) + if ((reply is SenderAddPalmWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) { + _replyAddPalmBegin(reply); + } }); } + /// 收到蓝牙的信息解析 // 修改卡片,接收消息 Future _replyAddICCardBegin(Reply reply) async { final int status = reply.data[2]; @@ -249,6 +256,58 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ } } + // 修改掌静脉,接收消息 + Future _replyAddPalmBegin(Reply reply) async { + final int status = reply.data[2]; + + switch (status) { + case 0x00: + //成功 + state.sureBtnState.value = 0; + cancelBlueConnetctToastTimer(); + dismissEasyLoading(); + editPalmData(); + break; + case 0x06: + //无权限 + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + final List token = reply.data.sublist(5, 9); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.palmVeinId!.toString(), + userID:await Storage.getUid(), + palmNo:int.parse(state.fingerprintItemData.value.palmVeinNumber!), + useCountLimit:0xffff, + operate: 1, // 0:注册 1:修改 2:删除 3:删除全部 + isAdmin:state.fingerprintItemData.value.palmVeinRight!, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:0, // 周循环 + startDate: state.beginTimeTimestamp.value~/1000, + endDate: state.endTimeTimestamp.value~/1000, + startTime:'0', + endTime:'0', + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: token, + isBeforeAddUser: false + ); + break; + default: + //失败 + break; + } + } + + /// 调用协议 // 修改指纹调用协议 Future senderAddFingerprint() async { if(state.sureBtnState.value == 1){ @@ -471,6 +530,62 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ }); } + // 修改掌静脉调用协议 + Future senderAddPalm() async { + if (state.sureBtnState.value == 1) { + return; + } + state.sureBtnState.value = 1; + + showEasyLoading(); + showBlueConnetctToastTimer(action: () { + dismissEasyLoading(); + state.sureBtnState.value = 0; + }); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.palmVeinId!.toString(), + userID:await Storage.getUid(), + palmNo:int.parse(state.fingerprintItemData.value.palmVeinNumber!), + useCountLimit:0xffff, + operate: 1, // 0:注册 1:修改 2:删除 3:删除全部 + isAdmin:state.fingerprintItemData.value.palmVeinRight!, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:0, // 周循环 + startDate: state.beginTimeTimestamp.value~/1000, + endDate: state.endTimeTimestamp.value~/1000, + startTime:'0', + endTime:'0', + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: getTokenList, + isBeforeAddUser: false + ); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + state.sureBtnState.value = 0; + if (state.ifCurrentScreen.value == true) { + showBlueConnetctToast(); + } + } + }); + } + + /// 调用接口 // 修改指纹调用接口 Future editFingerprintsData() async{ final LoginEntity entity = await ApiRepository.to.editFingerprintsData( @@ -579,6 +694,33 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ } } + // 修改掌静脉调用接口 + Future editPalmData() async { + final LoginEntity entity = await ApiRepository.to.editPalmData( + lockId: state.fingerprintItemData.value.lockId!, + palmVeinId: state.fingerprintItemData.value.palmVeinId!, + startDate: state.beginTimeTimestamp.value, + endDate: state.endTimeTimestamp.value, + startTime: 0, + endTime: 0, + palmVeinType: 2, + weekDay: [], + palmVeinName: state.fingerprintItemData.value.palmVeinName!, + addType: 1, + isCoerced: state.fingerprintItemData.value.isCoerced!, + palmVeinRight: state.fingerprintItemData.value.palmVeinRight!, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('修改成功', something: () { + Get.back(result: { + 'beginTimeTimestamp':state.beginTimeTimestamp.value.toString(), + 'endTimeTimestamp':state.endTimeTimestamp.value.toString(), + }); + eventBus.fire(OtherTypeRefreshListEvent()); + }); + } + } + @override void onReady() { super.onReady(); diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart index f60848ac..8c399193 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart @@ -77,6 +77,10 @@ class _OtherTypeKeyChangeDatePageState extends State // 人脸 logic.senderAddFace(); break; + case 4: + // 掌静脉 + logic.senderAddPalm(); + break; default: break; } diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart index 333647e4..acab76b3 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart @@ -39,7 +39,7 @@ class OtherTypeKeyChangeDateState{// 0普通状态(可用) 1连接中(不可用) RxInt beginTimeTimestamp = 0.obs;// 开始时间 RxInt endTimeTimestamp = 0.obs;// 结束时间 - RxInt pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸 + RxInt pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸 4掌静脉 RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 RxInt sureBtnState = 0.obs; } \ No newline at end of file diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart index 4b338982..9914d592 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart'; import 'package:star_lock/blue/io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -47,9 +48,15 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{ if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) { _replyAddFaceBegin(reply); } + + // 添加掌静脉开始(此处用作修改掌静脉) + if ((reply is SenderAddPalmWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) { + _replyAddPalmBegin(reply); + } }); } + /// 接收协议数据 // 修改卡片,接收协议数据 Future _replyAddICCardBegin(Reply reply) async { final int status = reply.data[2]; @@ -250,7 +257,57 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{ } } + // 修改掌静脉,接收协议数据 + Future _replyAddPalmBegin(Reply reply) async { + final int status = reply.data[2]; + switch(status){ + case 0x00: + //成功 + cancelBlueConnetctToastTimer(); + dismissEasyLoading(); + editPalmData(); + break; + case 0x06: + //无权限 + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + final List token = reply.data.sublist(5, 9); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.palmVeinId!.toString(), + userID:await Storage.getUid(), + palmNo:int.parse(state.fingerprintItemData.value.palmVeinNumber!), + useCountLimit:0xffff, + operate: 1, // 0:注册 1:修改 2:删除 3:删除全部 + isAdmin:state.fingerprintItemData.value.palmVeinRight!, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:1, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 + startDate: state.starDateTimestamp.value~/1000, + endDate: state.endDateTimestamp.value~/1000, + startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()), + endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: token, + isBeforeAddUser: false + ); + break; + default: + //失败 + break; + } + } + + /// 发送协议数据 // 修改卡片,发送协议 Future senderAddICCard() async { if(state.sureBtnState.value == 1){ @@ -473,7 +530,62 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{ }); } + // 修改掌静脉,发送协议 + Future senderAddPalm() async { + if (state.sureBtnState.value == 1) { + return; + } + state.sureBtnState.value = 1; + showEasyLoading(); + showBlueConnetctToastTimer(action: () { + dismissEasyLoading(); + state.sureBtnState.value = 0; + }); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.palmVeinId!.toString(), + userID:await Storage.getUid(), + palmNo:int.parse(state.fingerprintItemData.value.palmVeinNumber!), + useCountLimit:0xffff, + operate: 1, // 0:注册 1:修改 2:删除 3:删除全部 + isAdmin:state.fingerprintItemData.value.palmVeinRight!, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:1, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 + startDate: state.starDateTimestamp.value~/1000, + endDate: state.endDateTimestamp.value~/1000, + startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()), + endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: getTokenList, + isBeforeAddUser: false + ); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + state.sureBtnState.value = 0; + if (state.ifCurrentScreen.value == true) { + showBlueConnetctToast(); + } + } + }); + } + + /// 修改数据 // 修改指纹,调用接口 Future editFingerprintsData() async{ final LoginEntity entity = await ApiRepository.to.editFingerprintsData( @@ -594,6 +706,36 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{ } } + // 修改掌静脉,调用接口 + Future editPalmData() async { + final LoginEntity entity = await ApiRepository.to.editPalmData( + lockId: state.fingerprintItemData.value.lockId!, + palmVeinId: state.fingerprintItemData.value.palmVeinId!, + startDate: state.starDateTimestamp.value, + endDate: state.endDateTimestamp.value, + startTime: state.starTimeTimestamp.value, + endTime: state.endTimeTimestamp.value, + palmVeinType: 4, + weekDay: state.weekDay.value, + palmVeinName: state.fingerprintItemData.value.palmVeinName!, + addType: 1, + isCoerced: state.fingerprintItemData.value.isCoerced!, + palmVeinRight: state.fingerprintItemData.value.palmVeinRight!, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('修改成功', something: () { + eventBus.fire(OtherTypeRefreshListEvent()); + Get.back(result: { + 'starDate':state.starDateTimestamp.value.toString(), + 'endDate':state.endDateTimestamp.value.toString(), + 'starTime':state.starTimeTimestamp.value.toString(), + 'endTime':state.endTimeTimestamp.value.toString(), + 'validityValue':state.weekDay.value, + }); + }); + } + } + @override void onReady() { super.onReady(); diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart index e7927024..d6e609f2 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart @@ -90,6 +90,10 @@ class _OtherTypeKeyChangeValidityDatePageState extends State { SizedBox( height: 120.h, ), - Obx(() => state.isClickAddPalm.value == false - ? GestureDetector( - onTap: () { - state.isClickAddPalm.value = true; - }, - child: Container( - width: 1.sw, - padding: EdgeInsets.all(10.w), - margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h), - decoration: BoxDecoration( - color: AppColors.mainColor, - borderRadius: BorderRadius.circular(10.w), - ), - child: Center(child: Text('准备好了,开始添加', style: TextStyle(color: Colors.white, fontSize: 24.sp)))), - ) - : Container( + Obx(() => + // state.isClickAddPalm.value == false + // ? GestureDetector( + // onTap: () { + // logic.senderAddPalm(); + // }, + // child: Container( + // width: 1.sw, + // padding: EdgeInsets.all(10.w), + // margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h), + // decoration: BoxDecoration( + // color: AppColors.mainColor, + // borderRadius: BorderRadius.circular(10.w), + // ), + // child: Center(child: Text('准备好了,开始添加', style: TextStyle(color: Colors.white, fontSize: 24.sp)))), + // ) + // : + Container( width: 1.sw, padding: EdgeInsets.all(10.w), margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h), diff --git a/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart b/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart index 20fa6ab0..8bf669e0 100755 --- a/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart +++ b/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart @@ -179,16 +179,16 @@ class PalmDetailLogic extends BaseGetXController { } } - // 删除遥控 + // 删除 Future deletPalmData() async { - // final LoginEntity entity = await ApiRepository.to.deletRemoteControlData( - // remoteId: state.fingerprintItemData.value.remoteId ?? 0, - // ); - // if (entity.errorCode!.codeIsSuccessful) { - // showToast('删除成功'.tr, something: () { - // Get.back(result: 'addScuess'); - // }); - // } + final LoginEntity entity = await ApiRepository.to.deletPalmData( + palmVeinId: state.fingerprintItemData.value.palmVeinId ?? 0, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('删除成功'.tr, something: () { + Get.back(result: 'addScuess'); + }); + } } String getKeyTypeShowDateTime() { diff --git a/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart b/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart index 0fb0994f..2d35f80c 100755 --- a/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart +++ b/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart @@ -70,7 +70,7 @@ class _PalmDetailPageState extends State with RouteAware { final data = await Get.toNamed( Routers.otherTypeKeyChangeDatePage, arguments: { - 'pushType': 0, + 'pushType': 4, 'fingerprintItemData': state.fingerprintItemData.value, }); @@ -86,7 +86,7 @@ class _PalmDetailPageState extends State with RouteAware { final data = await Get.toNamed( Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, + 'pushType': 4, 'fingerprintItemData': state.fingerprintItemData.value, }); @@ -96,7 +96,7 @@ class _PalmDetailPageState extends State with RouteAware { state.endDate.value = data['endDate']; state.starTime.value = data['starTime']; state.endTime.value = data['endTime']; - state.weekDay.value = data['weekDay']; + state.weekDay.value = data['validityValue']; }); } } @@ -112,7 +112,7 @@ class _PalmDetailPageState extends State with RouteAware { final data = await Get.toNamed( Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, + 'pushType': 4, 'fingerprintItemData': state.fingerprintItemData.value, }); @@ -122,7 +122,7 @@ class _PalmDetailPageState extends State with RouteAware { state.endDate.value = data['endDate']; state.starTime.value = data['starTime']; state.endTime.value = data['endTime']; - state.weekDay.value = data['weekDay']; + state.weekDay.value = data['validityValue']; }); } })))), @@ -137,7 +137,7 @@ class _PalmDetailPageState extends State with RouteAware { final data = await Get.toNamed( Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, + 'pushType': 4, 'fingerprintItemData': state.fingerprintItemData.value, }); diff --git a/lib/main/lockDetail/palm/palmList/palmList_logic.dart b/lib/main/lockDetail/palm/palmList/palmList_logic.dart index 8f803430..cad800a0 100755 --- a/lib/main/lockDetail/palm/palmList/palmList_logic.dart +++ b/lib/main/lockDetail/palm/palmList/palmList_logic.dart @@ -39,7 +39,11 @@ class PalmListLogic extends BaseGetXController { case 0x00: //成功 cancelBlueConnetctToastTimer(); - deletICPalmData(); + if(state.isDeletAll == true){ + resetPalmData(); + }else{ + deletPalmData(); + } break; case 0x06: //无权限 @@ -156,30 +160,28 @@ class PalmListLogic extends BaseGetXController { return entity; } - // 删除所有IC卡 - Future deletICPalmData() async { - String palmId = ''; - String type = '1'; - if (state.isDeletAll == false) { - palmId = state.deletKeyID; - type = '0'; + // 删除所有掌静脉 + Future resetPalmData() async { + final LoginEntity entity = await ApiRepository.to.resetPalmData( + lockId: state.lockId.value + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('重置成功'.tr, something: () { + getPalmListData(isRefresh: true); + }); + } + } + + // 删除所有掌静脉 + Future deletPalmData() async { + final LoginEntity entity = await ApiRepository.to.deletPalmData( + palmVeinId: int.parse(state.deletKeyID), + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('删除成功'.tr, something: () { + getPalmListData(isRefresh: true); + }); } - // final LoginEntity entity = await ApiRepository.to.deletIcPalmData( - // cardId: palmId, - // lockId: state.lockId.value.toString(), - // type: type, - // deleteType: '1'); - // if (entity.errorCode!.codeIsSuccessful) { - // if (state.isDeletAll == false) { - // showToast('删除成功'.tr, something: () { - // getICCardListData(isRefresh: true); - // }); - // } else { - // showToast('重置成功'.tr, something: () { - // getICCardListData(isRefresh: true); - // }); - // } - // } } // 监听修改完详情之后刷新列表 diff --git a/lib/main/lockDetail/remoteControl/remoteControlDetail/remoteControlDetail_page.dart b/lib/main/lockDetail/remoteControl/remoteControlDetail/remoteControlDetail_page.dart index ee0b3ec5..73ddc75c 100755 --- a/lib/main/lockDetail/remoteControl/remoteControlDetail/remoteControlDetail_page.dart +++ b/lib/main/lockDetail/remoteControl/remoteControlDetail/remoteControlDetail_page.dart @@ -101,7 +101,7 @@ class _RemoteControlDetailPageState extends State with state.endDate.value = data['endDate']; state.starTime.value = data['starTime']; state.endTime.value = data['endTime']; - state.weekDay.value = data['weekDay']; + state.weekDay.value = data['validityValue']; }); } } @@ -117,7 +117,7 @@ class _RemoteControlDetailPageState extends State with var data = await Get.toNamed( Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, + 'pushType': 2, 'fingerprintItemData': state.fingerprintItemData.value, }); @@ -127,7 +127,7 @@ class _RemoteControlDetailPageState extends State with state.endDate.value = data['endDate']; state.starTime.value = data['starTime']; state.endTime.value = data['endTime']; - state.weekDay.value = data['weekDay']; + state.weekDay.value = data['validityValue']; }); } })))), @@ -142,7 +142,7 @@ class _RemoteControlDetailPageState extends State with var data = await Get.toNamed( Routers.otherTypeKeyChangeValidityDatePage, arguments: { - 'pushType': 0, + 'pushType': 2, 'fingerprintItemData': state.fingerprintItemData.value, }); diff --git a/lib/network/api.dart b/lib/network/api.dart index b9ebc13d..3f36dc8a 100755 --- a/lib/network/api.dart +++ b/lib/network/api.dart @@ -139,6 +139,8 @@ abstract class Api { final String addPalmURL = '/palmVein/add'; // 添加掌静脉 final String updatePalmUserNoURL = '/palmVein/updatePalmVeinUserNo'; // 更新掌静脉用户序号 final String editPalmURL = '/palmVein/update'; // 编辑掌静脉 + final String deletePalmURL = '/palmVein/delete'; // 删除掌静脉 + final String clearPalmURL = '/palmVein/clear'; // 清空掌静脉 final String checkPalmNameURL = '/palmVein/checkPalmVeinName'; // 校验掌静脉名字是否存在 final String transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表 diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 47ba46cf..3d909bc4 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -1665,6 +1665,22 @@ class ApiProvider extends BaseProvider { 'palmVeinRight': palmVeinRight })); + // 删除掌静脉 + Future deletPalmData(int palmVeinId) => + post( + deletePalmURL.toUrl, + jsonEncode({ + 'palmVeinId': palmVeinId, + })); + + // 重置掌静脉 + Future resetPalmData(int lockId) => + post( + clearPalmURL.toUrl, + jsonEncode({ + 'lockId': lockId, + })); + // 校验掌静脉名字是否重复 Future checkPalmNameDuplicatedData( String lockId, String palmVeinName) => diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index d3cc951f..d48ab024 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -1811,7 +1811,7 @@ class ApiRepository { return LoginEntity.fromJson(res.body); } - // 编辑遥控 + // 编辑掌静脉 Future editPalmData({ required int lockId, required int palmVeinId, @@ -1842,6 +1842,18 @@ class ApiRepository { return LoginEntity.fromJson(res.body); } + // 删除掌静脉 + Future deletPalmData({required int palmVeinId}) async { + final res = await apiProvider.deletPalmData(palmVeinId); + return LoginEntity.fromJson(res.body); + } + + // 重置掌静脉 + Future resetPalmData({required int lockId}) async { + final res = await apiProvider.resetPalmData(lockId); + return LoginEntity.fromJson(res.body); + } + // 校验掌静脉名字是否重复 Future checkPalmNameDuplicatedData( {required String lockId, required String palmVeinName}) async {