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 4be60c8c..e361ca3a 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 @@ -81,7 +81,8 @@ class _ElectronicKeyDetailPageState extends State { isHaveDirection: true, action: () { Navigator.pushNamed( - context, Routers.electronicKeyDetailChangeDate); + context, Routers.electronicKeyDetailChangeDate, + arguments: {"itemData": itemData}); }), Container(height: 10.h), CommonItem( @@ -252,7 +253,7 @@ class _ElectronicKeyDetailPageState extends State { Future modifyKeyNameRequest() async { KeyOperationRecordEntity entity = await ApiRepository.to .modifyKeyNameForAdmin( - itemData.keyId.toString(), _changeNameController.text, '0'); + itemData.keyId.toString(), _changeNameController.text, ''); if (entity.errorCode!.codeIsSuccessful) { print("修改要是名称成功啦啦啦啦啦"); Toast.show(msg: "修改成功"); @@ -265,7 +266,7 @@ class _ElectronicKeyDetailPageState extends State { //删除电子钥匙名称请求 Future deleteKeyRequest() async { ElectronicKeyListEntity entity = - await ApiRepository.to.deleteElectronicKey('0'); + await ApiRepository.to.deleteElectronicKey(itemData.keyId.toString()); if (entity.errorCode!.codeIsSuccessful) { print("删除电子钥匙成功"); Toast.show(msg: "删除成功"); 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 40615e15..b29d7afa 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 @@ -1,11 +1,16 @@ import 'package:flutter/material.dart'; -import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart'; +import 'package:flutter_pickers/pickers.dart'; +import 'package:flutter_pickers/time_picker/model/date_mode.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart'; +import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/toast.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/commonItem.dart'; -import '../../../../../tools/showSeletDateTime.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; @@ -19,8 +24,23 @@ class ElectronicKeyDetailChangeDate extends StatefulWidget { class _ElectronicKeyDetailChangeDateState extends State { + ElectronicKeyListItem itemData = ElectronicKeyListItem(); + + String _selectEffectiveDate = ''; //生效时间 + String _selectFailureDate = ''; //失效时间 + late DateTime _effectiveDateTime; + late DateTime _failureDateTime; + late String endDay = ''; + late String startDay = ''; + late List weekDays = []; + @override Widget build(BuildContext context) { + dynamic obj = ModalRoute.of(context)?.settings.arguments; + if (obj != null && (obj["itemData"] != null)) { + itemData = obj["itemData"]; + } + return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( @@ -34,7 +54,9 @@ class _ElectronicKeyDetailChangeDateState TranslationLoader.lanKeys!.sure!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), ), - onPressed: () {}, + onPressed: () { + updateKeyDateRequest(); + }, ), ], ), @@ -47,50 +69,58 @@ class _ElectronicKeyDetailChangeDateState children: [ CommonItem( leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, - rightTitle: "2020.06.20 11:49", - isHaveDirection: true, + rightTitle: _selectEffectiveDate, isHaveLine: true, + isHaveDirection: true, action: () { - ShowSeletDateTime().showDatePicker( - context, - '2100-01-01 00:00', - '1900-01-01 00:00', - getNowDate(), - 'yyyy-MMMM-dd HH:mm', - (dateTime, List index) {}); + Pickers.showDatePicker(context, mode: DateMode.YMDHM, + onConfirm: (p) { + setState(() { + _selectEffectiveDate = + '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; + _effectiveDateTime = DateTime.parse(_selectEffectiveDate); + }); + }); }), CommonItem( leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, - rightTitle: "2020.06.20 11:49", + rightTitle: _selectFailureDate, isHaveDirection: true, action: () { - ShowSeletDateTime().showDatePicker(context, '00:00', '00:00', - getNowDate(), 'HH:mm', (dateTime, List index) {}); + Pickers.showDatePicker(context, mode: DateMode.YMDHM, + onConfirm: (p) { + setState(() { + _selectFailureDate = + '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; + _failureDateTime = DateTime.parse(_selectFailureDate); + }); + }); }), ], ); } - String getNowDate() { - // 获取当前时间对象 - DateTime today = DateTime.now(); - String dateSlug = - "${today.hour.toString().padLeft(2, '0')}:${today.minute.toString().padLeft(2, '0')}"; + //修改钥匙名称请求 + Future updateKeyDateRequest() async { + KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate( + itemData.keyId.toString(), + itemData.lockId.toString(), + _failureDateTime.millisecondsSinceEpoch.toString(), + endDay, + '', + _effectiveDateTime.millisecondsSinceEpoch.toString(), + startDay, + weekDays); + if (entity.errorCode!.codeIsSuccessful) { + print("修改要是名称成功啦啦啦啦啦"); + Toast.show(msg: "修改成功"); + setState(() { + Navigator.pop(context); + }); + } + } - // //获取当前时间的年 - // int year = now.year; - // //获取当前时间的月 - // int month = now.month; - // //获取当前时间的日 - // int day = now.day; - // //获取当前时间的时 - // int hour = now.hour; - // //获取当前时间的分 - // int minute = now.minute; - // //获取当前时间的秒 - // int millisecond = now.millisecond; - - // print("组合 $year-$month-$day $hour:$minute:$millisecond"); - return dateSlug; + String intToStr(int v) { + return (v < 10) ? "0$v" : "$v"; } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart index 56af0a4c..eff9bdad 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; @@ -104,4 +106,35 @@ class _BasicInformationPageState extends State { ], )); } + + void getLockInfo() async { + var entity = await ApiRepository.to.getLockInfo( + lastUpdateDate: DateTime.now().millisecondsSinceEpoch.toString(), + pageNo: '1', + ); + if (entity.errorCode!.codeIsSuccessful) { + // if (page == 0) { + // refreshController.refreshCompleted(); + // } else { + // if (entity.data!.keyInfos!.isEmpty) { + // refreshController.loadNoData(); + // } else { + // refreshController.loadComplete(); + // } + // } + // page++; + + if (entity.data!.keyInfos!.isEmpty) { + state.dataLength.value = 0; + } else if (entity.data!.keyInfos!.length == 1) { + state.dataLength.value = 1; + } else { + state.dataLength.value = 2; + } + state.lockMainEntity.value = entity; + } else { + // refreshController.loadFailed(); + } + // refreshController.refreshCompleted(); + } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index e6c4e9a4..4c8effca 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -33,149 +34,166 @@ class _PasswordKeyDetailPageState extends State { } return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.passwordDetail!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor, - actionsList: [ - IconButton( - icon: Image.asset( - 'images/icon_bar_share.png', - height: 30.h, - width: 30.w, + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.passwordDetail!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + actionsList: [ + IconButton( + icon: Image.asset( + 'images/icon_bar_share.png', + height: 30.h, + width: 30.w, + ), + onPressed: () {}, ), - onPressed: () {}, + ], + // actionsList: [ + // TextButton( + // child: Text( + // "分享", + // style: TextStyle(color: Colors.white, fontSize: 24.sp), + // ), + // onPressed: () {}, + // ), + // ], + ), + body: SingleChildScrollView( + child: Column( + children: [ + CommonItem( + leftTitel: TranslationLoader.lanKeys!.password!.tr, + rightTitle: itemData.keyboardPwd, + isHaveDirection: true, + isHaveLine: true, + action: () { + showCupertinoAlertDialog(context); + }), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.name!.tr, + rightTitle: itemData.keyboardPwdName, + isHaveDirection: true, + isHaveLine: true, + action: () { + showCupertinoAlertDialog(context); + }), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, + rightTitle: "永久", + isHaveDirection: true, + action: () { + Navigator.pushNamed( + context, Routers.electronicKeyDetailChangeDate); + }), + Container(height: 10.h), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.sender!.tr, + rightTitle: itemData.senderUsername, + isHaveLine: true, + action: () {}), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.senderTime!.tr, + rightTitle: getSenderDate(itemData), + action: () {}), + Container(height: 10.h), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, + rightTitle: "", + isHaveDirection: true, + action: () { + Navigator.pushNamed(context, Routers.keyOperationRecordPage, + arguments: { + 'lockId': itemData.lockId.toString(), + 'keyId': itemData.keyboardPwdId.toString() + }); + }), + Container(height: 40.h), + 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: () { + Navigator.pushNamed( + context, Routers.otherTypeKeyManagePage, + arguments: 0); + }, + child: Text( + '设置卡', + style: TextStyle( + color: AppColors.mainColor, fontSize: 24.sp), + )), + ), + SizedBox( + height: 10.h, + ), + 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: () { + Navigator.pushNamed( + context, Routers.otherTypeKeyManagePage, + arguments: 1); + }, + child: Text( + '设置指纹', + style: TextStyle( + color: AppColors.mainColor, fontSize: 24.sp), + )), + ), + SizedBox( + height: 10.h, + ), + 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: () { + Navigator.pushNamed( + context, Routers.otherTypeKeyManagePage, + arguments: 2); + }, + child: Text( + '设置遥控', + style: TextStyle( + color: AppColors.mainColor, fontSize: 24.sp), + )), + ), + SizedBox( + height: 30.h, + ), + SubmitBtn( + btnName: TranslationLoader.lanKeys!.delete!.tr, + isDelete: true, + borderRadius: 20.w, + margin: EdgeInsets.only( + left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + onClick: () { + deletePwdRequest(); + }), + ], ), - ], - // actionsList: [ - // TextButton( - // child: Text( - // "分享", - // style: TextStyle(color: Colors.white, fontSize: 24.sp), - // ), - // onPressed: () {}, - // ), - // ], - ), - body: Column( - children: [ - CommonItem( - leftTitel: TranslationLoader.lanKeys!.password!.tr, - rightTitle: itemData.keyboardPwd, - isHaveDirection: true, - isHaveLine: true, - action: () { - showCupertinoAlertDialog(context); - }), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.name!.tr, - rightTitle: itemData.keyboardPwdName, - isHaveDirection: true, - isHaveLine: true, - action: () { - showCupertinoAlertDialog(context); - }), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, - rightTitle: "永久", - isHaveDirection: true, - action: () { - Navigator.pushNamed( - context, Routers.electronicKeyDetailChangeDate); - }), - Container(height: 10.h), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.sender!.tr, - rightTitle: itemData.senderUsername, - action: () {}), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.senderTime!.tr, - rightTitle: itemData.sendDate.toString(), - action: () {}), - Container(height: 10.h), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, - rightTitle: "", - isHaveDirection: true, - action: () { - Navigator.pushNamed(context, Routers.keyOperationRecordPage, - arguments: { - 'lockId': itemData.lockId.toString(), - 'keyId': itemData.keyboardPwdId.toString() - }); - }), - Container(height: 40.h), - 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: () { - Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, - arguments: 0); - }, - child: Text( - '设置卡', - style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), - )), - ), - SizedBox( - height: 10.h, - ), - 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: () { - Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, - arguments: 1); - }, - child: Text( - '设置指纹', - style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), - )), - ), - SizedBox( - height: 10.h, - ), - 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: () { - Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, - arguments: 2); - }, - child: Text( - '设置遥控', - style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), - )), - ), - SizedBox( - height: 30.h, - ), - SubmitBtn( - btnName: TranslationLoader.lanKeys!.delete!.tr, - isDelete: true, - borderRadius: 20.w, - margin: EdgeInsets.only( - left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), - padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () { - deletePwdRequest(); - }), - ], - ), - ); + )); + } + + //发送时间 + String getSenderDate(PasswordKeyListItem indexEntity) { + String senderDate = ''; + DateTime dateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); + senderDate = dateStr.toLocal().toString().substring(0, 16); + return senderDate; } Widget commonItem(String leftTitle, String rightTitle, @@ -241,10 +259,10 @@ class _PasswordKeyDetailPageState extends State { ); } - //删除密码请求 + //删除密码请求 deleteType:1-蓝牙 2-网关 Future deletePwdRequest() async { - PasswordKeyEntity entity = - await ApiRepository.to.deleteKeyboardPwd('0', '1', '1'); + PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd( + itemData.lockId.toString(), itemData.keyboardPwdId.toString(), '1'); if (entity.errorCode!.codeIsSuccessful) { print("删除密码成功"); Toast.show(msg: "删除成功"); 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 b227de6d..cb51559b 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 @@ -400,7 +400,7 @@ class _PasswordKeyPerpetualPageState extends State { //清空码 getKeyType = '4'; } - if (widget.type == '0') { + if (widget.type != '0' || widget.type != '2' || widget.type == '5') { getFailureDateTime = DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString(); getEffectiveDateTime = DateTime.parse(_selectEffectiveDate) diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index dbeeb595..450deeec 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -23,10 +23,11 @@ abstract class Api { final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称 final String modifyKeyNameForAdminURL = '/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字 + final String updateKeyDateURL = '/key/updateKeyDate'; //编辑电子钥匙的有效期、有效时间、有效日 final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表 final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置 - final String deleteElectronicKeyURL = '/keyboardPwd/reset'; //删除电子钥匙 - final String deleteKeyboardPwdURL = '/keyboardPwd/reset'; //删除密码 + final String deleteElectronicKeyURL = '/key/delete'; //删除电子钥匙 + final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码 final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息 final String deletLockURL = '/lock/delete'; // 删除锁 diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index cef6de78..4af64b07 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -194,6 +194,28 @@ class ApiProvider extends BaseProvider { 'operatorUid': operatorUid, })); + Future updateKeyDate( + String keyId, + String lockId, + String endDate, + String endDay, + String operatorUid, + String startDate, + String startDay, + List weekDays) => + post( + updateKeyDateURL.toUrl, + jsonEncode({ + 'keyId': keyId, + 'lockId': lockId, + 'endDate': endDate, + 'endDay': endDay, + 'operatorUid': operatorUid, + 'startDate': startDate, + 'startDay': startDay, + 'weekDays': weekDays, + })); + Future resetElectronicKey(String lockId, String operatorUid) => post(resetElectronicKeyURL.toUrl, jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); @@ -332,11 +354,11 @@ class ApiProvider extends BaseProvider { post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId})); Future deleteKeyboardPwd( - String keyId, String keyboardPwdId, String deleteType) => + String lockId, String keyboardPwdId, String deleteType) => post( deleteKeyboardPwdURL.toUrl, jsonEncode({ - 'keyId': keyId, + 'lockId': lockId, 'keyboardPwdId': keyboardPwdId, 'deleteType': deleteType })); diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 518d1cfd..b90d03c7 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -192,9 +192,17 @@ class ApiRepository { required Map position, required Map bluetooth, required String deviceNo, - required String lockUserNo}) async { - final res = await apiProvider.bindingBlueAdmin(bindingDate, hotelMode, - lockAlias, lockData, nbInitSuccess, position, bluetooth, deviceNo, lockUserNo); + required String lockUserNo}) async { + final res = await apiProvider.bindingBlueAdmin( + bindingDate, + hotelMode, + lockAlias, + lockData, + nbInitSuccess, + position, + bluetooth, + deviceNo, + lockUserNo); return SaveLockEntity.fromJson(res.body); } @@ -229,7 +237,22 @@ class ApiRepository { return KeyOperationRecordEntity.fromJson(res.body); } - //编辑电子钥匙名字 + //编辑电子钥匙有效期 + Future updateKeyDate( + String keyId, + String lockId, + String endDate, + String endDay, + String operatorUid, + String startDate, + String startDay, + List weekDays) async { + final res = await apiProvider.updateKeyDate(keyId, lockId, endDate, endDay, + operatorUid, startDate, startDay, weekDays); + return KeyOperationRecordEntity.fromJson(res.body); + } + + //密码列表 Future passwordKeyList( String keyStatus, String lockId, @@ -314,9 +337,9 @@ class ApiRepository { //删除密码 Future deleteKeyboardPwd( - String keyId, String keyboardPwdId, String deleteType) async { + String lockId, String keyboardPwdId, String deleteType) async { final res = - await apiProvider.deleteKeyboardPwd(keyId, keyboardPwdId, deleteType); + await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType); return PasswordKeyEntity.fromJson(res.body); }