fix:修复卡/指纹/密码/授权管理员列表修改名字后不更新的问题

This commit is contained in:
anfe 2024-06-03 14:49:29 +08:00
parent 0d51c46393
commit ae0fcafb9e
16 changed files with 356 additions and 141 deletions

View File

@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -59,6 +60,20 @@ class AuthorizedAdminListLogic extends BaseGetXController {
}); });
} }
//
Future<void> refreshIndividualKeys(
{required int lockId, required int keyId}) async {
final ElectronicKeyEntity entity =
await ApiRepository.to.electronicKey(lockId: lockId, keyId: keyId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.itemDataList
.indexWhere((ElectronicKeyListItem item) => item.keyId == keyId);
state.itemDataList.removeAt(index);
state.itemDataList.insert(index, entity.data!);
}
}
@override @override
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady

View File

@ -150,8 +150,11 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
'itemData': indexEntity, 'itemData': indexEntity,
}).then((Object? val) { }).then((Object? val) {
if (val != null) { if (val != null) {
logic.mockNetworkDataRequest(); logic
setState(() {}); .refreshIndividualKeys(
lockId: indexEntity.lockId!,
keyId: indexEntity.keyId!)
.then((dynamic value) => setState(() {}));
} }
}); });
}), }),

View File

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
@ -27,8 +28,8 @@ class ElectronicKeyDetailPage extends StatefulWidget {
} }
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> { class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
final logic = Get.put(ElectronicKeyDetailLogic()); final ElectronicKeyDetailLogic logic = Get.put(ElectronicKeyDetailLogic());
final state = Get.find<ElectronicKeyDetailLogic>().state; final ElectronicKeyDetailState state = Get.find<ElectronicKeyDetailLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,7 +40,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
barTitle: '钥匙详情'.tr, barTitle: '钥匙详情'.tr,
haveBack: true, haveBack: true,
actionsList: (state.keyType.value != 3) actionsList: (state.keyType.value != 3)
? [ ? <Widget>[
IconButton( IconButton(
icon: Image.asset( icon: Image.asset(
'images/icon_bar_more.png', 'images/icon_bar_more.png',
@ -54,7 +55,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
: null, : null,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: ListView( body: ListView(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '姓名'.tr, leftTitel: '姓名'.tr,
rightTitle: state.keyName.value, rightTitle: state.keyName.value,
@ -62,7 +63,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () { action: () {
showCupertinoAlertDialog( showCupertinoAlertDialog(
tipsTitle: "修改姓名".tr, alertEnum: ShowAlertEnum.name); tipsTitle: '修改姓名'.tr, alertEnum: ShowAlertEnum.name);
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.isRealNameAuth.value, visible: state.isRealNameAuth.value,
@ -73,7 +74,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () { action: () {
showCupertinoAlertDialog( showCupertinoAlertDialog(
tipsTitle: "修改真实姓名".tr, tipsTitle: '修改真实姓名'.tr,
alertEnum: ShowAlertEnum.realName); alertEnum: ShowAlertEnum.realName);
}))), }))),
Obx(() => Visibility( Obx(() => Visibility(
@ -85,7 +86,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () { action: () {
showCupertinoAlertDialog( showCupertinoAlertDialog(
tipsTitle: "修改身份证号".tr, tipsTitle: '修改身份证号'.tr,
alertEnum: ShowAlertEnum.idCardNumber); alertEnum: ShowAlertEnum.idCardNumber);
}))), }))),
Obx(() => CommonItem( Obx(() => CommonItem(
@ -96,16 +97,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveDirection: state.itemData.value.keyStatus! == isHaveDirection: state.itemData.value.keyStatus! ==
XSConstantMacro.keyStatusExpired XSConstantMacro.keyStatusExpired
? false ? false
: state.keyType.value == 3 : state.keyType.value != 3,
? false
: true,
isHaveLine: true, isHaveLine: true,
action: state.itemData.value.keyStatus! == action: state.itemData.value.keyStatus! ==
XSConstantMacro.keyStatusExpired XSConstantMacro.keyStatusExpired
? null ? null
: () async { : () async {
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
logic.showToast("冻结状态下不允许修改钥匙权限".tr); logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
return; return;
} }
@ -113,14 +112,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
// / // /
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyDetailChangeDate, Routers.electronicKeyDetailChangeDate,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["beginTimeTimestamp"].toString(); state.starDate.value = data['beginTimeTimestamp'].toString();
state.endDate.value = data["endTimeTimestamp"].toString(); state.endDate.value = data['endTimeTimestamp'].toString();
state.keyType.value = 2; state.keyType.value = 2;
}); });
} }
@ -128,23 +127,23 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
// //
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyPeriodValidityPage, Routers.electronicKeyPeriodValidityPage,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["starDate"]; state.starDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.starTime.value = data["starTime"]; state.starTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
} }
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false, visible: state.keyType.value == 4 ,
child: Obx(() => CommonItem( child: Obx(() => CommonItem(
leftTitel: '有效日'.tr, leftTitel: '有效日'.tr,
rightTitle: logic.weekDayStr.join(','), rightTitle: logic.weekDayStr.join(','),
@ -152,63 +151,63 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () async { action: () async {
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
logic.showToast("冻结状态下不允许修改钥匙权限".tr); logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
return; return;
} }
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyPeriodValidityPage, Routers.electronicKeyPeriodValidityPage,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["starDate"]; state.starDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.starTime.value = data["starTime"]; state.starTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
})))), })))),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false, visible: state.keyType.value == 4 ? true : false,
child: Obx(() => CommonItem( child: Obx(() => CommonItem(
leftTitel: "有效时间".tr, leftTitel: '有效时间'.tr,
rightTitle: rightTitle:
"${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", '${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
logic.showToast("冻结状态下不允许修改钥匙权限".tr); logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
return; return;
} }
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyPeriodValidityPage, Routers.electronicKeyPeriodValidityPage,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["starDate"]; state.starDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.starTime.value = data["starTime"]; state.starTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
})))), })))),
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: "接收者".tr, leftTitel: '接收者'.tr,
rightTitle: state.itemData.value.username ?? ""), rightTitle: state.itemData.value.username ?? ''),
const SizedBox(height: 1), const SizedBox(height: 1),
CommonItem( CommonItem(
leftTitel: "发送人".tr, leftTitel: '发送人'.tr,
rightTitle: state.itemData.value.senderUsername ?? ""), rightTitle: state.itemData.value.senderUsername ?? ''),
const SizedBox(height: 1), const SizedBox(height: 1),
CommonItem( CommonItem(
leftTitel: '发送时间'.tr, leftTitel: '发送时间'.tr,
@ -218,8 +217,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
Visibility( Visibility(
visible: state.itemData.value.keyRight == 1 ? true : false, visible: state.itemData.value.keyRight == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: "仅管理自己创建的用户".tr, leftTitel: '仅管理自己创建的用户'.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
isHaveLine: true, isHaveLine: true,
rightWidget: SizedBox( rightWidget: SizedBox(
@ -239,8 +238,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
? true ? true
: false, : false,
child: CommonItem( child: CommonItem(
leftTitel: "远程开锁".tr, leftTitel: '远程开锁'.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
isHaveLine: true, isHaveLine: true,
rightWidget: SizedBox( rightWidget: SizedBox(
@ -248,17 +247,17 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
), ),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '实名认证'.tr, leftTitel: '实名认证'.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: rightWidget:
SizedBox(width: 60.w, child: _realNameAuthSwitch()))), SizedBox(width: 60.w, child: _realNameAuthSwitch()))),
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: '操作记录'.tr, leftTitel: '操作记录'.tr,
rightTitle: "", rightTitle: '',
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: { Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 5, 'type': 5,
'id': state.itemData.value.keyId.toString(), 'id': state.itemData.value.keyId.toString(),
'recordName': state.itemData.value.keyName 'recordName': state.itemData.value.keyName
@ -289,7 +288,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isRealNameAuth.value, value: state.isRealNameAuth.value,
onChanged: (value) { onChanged: (bool value) {
if (!state.isRealNameAuth.value) { if (!state.isRealNameAuth.value) {
logic.checkRealNameStatus(1); logic.checkRealNameStatus(1);
} else { } else {
@ -305,7 +304,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isRemoteUnlock.value, value: state.isRemoteUnlock.value,
onChanged: (value) { onChanged: (bool value) {
state.isRemoteUnlock.value = !state.isRemoteUnlock.value; state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
logic.updateKeyDateRequest(2); logic.updateKeyDateRequest(2);
}, },
@ -318,7 +317,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.onlyManageYouCreatesUser.value, value: state.onlyManageYouCreatesUser.value,
onChanged: (value) { onChanged: (bool value) {
setState(() { setState(() {
state.onlyManageYouCreatesUser.value = state.onlyManageYouCreatesUser.value =
!state.onlyManageYouCreatesUser.value; !state.onlyManageYouCreatesUser.value;
@ -335,7 +334,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: tipsTitle, title: tipsTitle,
tipTitle: "请输入".tr, tipTitle: '请输入'.tr,
controller: logic.getCurrentController(alertEnum), controller: logic.getCurrentController(alertEnum),
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -14,24 +15,29 @@ class ElectronicKeyListLogic extends BaseGetXController {
final ElectronicKeyListState state = ElectronicKeyListState(); final ElectronicKeyListState state = ElectronicKeyListState();
// //
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async { Future<ElectronicKeyListEntity> mockNetworkDataRequest(
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( {bool isRefresh = false}) async {
endDate: '0', if (isRefresh) {
keyId: CommonDataManage().currentKeyInfo.keyId.toString(), pageNo = 0;
keyStatus: '', }
keyRight: '0', final ElectronicKeyListEntity entity = await ApiRepository.to
lockId: CommonDataManage().currentKeyInfo.lockId.toString(), .electronicKeyList(
pageNo: pageNo.toString(), endDate: '0',
pageSize: pageSize.toString(), keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
startDate: '0', keyStatus: '',
searchStr: state.searchController.text); keyRight: '0',
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
pageNo: pageNo.toString(),
pageSize: pageSize.toString(),
startDate: '0',
searchStr: state.searchController.text);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (pageNo == 1) { if (pageNo == 1) {
state.itemDataList.value = entity.data!.itemList!; state.itemDataList.value = entity.data!.itemList;
pageNo++; pageNo++;
} else { } else {
if (entity.data!.itemList!.isNotEmpty) { if (entity.data!.itemList.isNotEmpty) {
state.itemDataList.value.addAll(entity.data!.itemList!); state.itemDataList.addAll(entity.data!.itemList);
pageNo++; pageNo++;
} }
} }
@ -39,12 +45,26 @@ class ElectronicKeyListLogic extends BaseGetXController {
return entity; return entity;
} }
//
Future<void> refreshIndividualKeys(
{required int lockId, required int keyId}) async {
final ElectronicKeyEntity entity =
await ApiRepository.to.electronicKey(lockId: lockId, keyId: keyId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.itemDataList
.indexWhere((ElectronicKeyListItem item) => item.keyId == keyId);
state.itemDataList.removeAt(index);
state.itemDataList.insert(index, entity.data!);
}
}
// //
Future<void> resetElectronicKeyListRequest() async { Future<void> resetElectronicKeyListRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to final ElectronicKeyListEntity entity = await ApiRepository.to
.resetElectronicKey(CommonDataManage().currentKeyInfo.lockId.toString(), '0'); .resetElectronicKey(
CommonDataManage().currentKeyInfo.lockId.toString(), '0');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("重置成功".tr, something: (){ showToast('重置成功'.tr, something: () {
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest();
}); });
@ -53,28 +73,28 @@ class ElectronicKeyListLogic extends BaseGetXController {
// //
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async { Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
ElectronicKeyListEntity entity = final ElectronicKeyListEntity entity = await ApiRepository.to
await ApiRepository.to.deleteElectronicKey( .deleteElectronicKey(
keyId:keyId, keyId: keyId, includeUnderlings: includeUnderlings);
includeUnderlings:includeUnderlings
);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功".tr,something: (){ showToast('删除成功'.tr, something: () {
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest();
}); });
} }
} }
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){ deletKeyLogic(ElectronicKeyListItem electronicKeyListItem) {
if(electronicKeyListItem.keyRight == 1){ if (electronicKeyListItem.keyRight == 1) {
// //
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) { ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0); '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool isAllData) {
deleteKeyRequest(
electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
}); });
}else{ } else {
// //
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){ ShowTipView().showIosTipWithContentDialog('删除钥匙会在用户APP连网后生效'.tr, () {
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0); deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
}); });
} }
@ -82,9 +102,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
/// ///
StreamSubscription? _getElectronicKeyListRefreshUIEvent; StreamSubscription? _getElectronicKeyListRefreshUIEvent;
void _getElectronicKeyListRefreshUIAction() { void _getElectronicKeyListRefreshUIAction() {
// eventBus // eventBus
_getElectronicKeyListRefreshUIEvent = eventBus.on<ElectronicKeyListRefreshUI>().listen((event) { _getElectronicKeyListRefreshUIEvent = eventBus
.on<ElectronicKeyListRefreshUI>()
.listen((ElectronicKeyListRefreshUI event) {
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest();
}); });

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
@ -63,9 +62,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
), ),
onPressed: () async { onPressed: () async {
// //
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog('该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest); ShowTipView().showIosTipWithContentDialog(
'该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest);
} else { } else {
logic.showToast('演示模式'.tr); logic.showToast('演示模式'.tr);
} }
@ -101,7 +102,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
AddBottomWhiteBtn( AddBottomWhiteBtn(
btnName: TranslationLoader.lanKeys!.sendKey!.tr, btnName: TranslationLoader.lanKeys!.sendKey!.tr,
onClick: () { onClick: () {
Navigator.pushNamed(context, Routers.sendElectronicKeyPage).then((Object? val) { Navigator.pushNamed(context, Routers.sendElectronicKeyPage)
.then((Object? val) {
if (val != null) { if (val != null) {
logic.pageNo = 1; logic.pageNo = 1;
mockRequest(); mockRequest();
@ -130,7 +132,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
shrinkWrap: true, shrinkWrap: true,
itemCount: state.itemDataList.value.length, itemCount: state.itemDataList.value.length,
itemBuilder: (BuildContext c, int index) { itemBuilder: (BuildContext c, int index) {
ElectronicKeyListItem indexEntity = state.itemDataList.value[index]; ElectronicKeyListItem indexEntity =
state.itemDataList.value[index];
String useDateStr = ''; //使 String useDateStr = ''; //使
String keyStatus = ''; // String keyStatus = ''; //
@ -138,7 +141,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
useDateStr = getUseDateStr(indexEntity); useDateStr = getUseDateStr(indexEntity);
// //
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!); keyStatus =
XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
// //
bool isAdminKey = false; bool isAdminKey = false;
@ -171,15 +175,18 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
useDateStr, useDateStr,
keyStatus, keyStatus,
isAdminKey, isAdminKey,
indexEntity.remoteEnable == 1 ? true : false, () { indexEntity.remoteEnable == 1, () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.electronicKeyDetailPage, context, Routers.electronicKeyDetailPage,
arguments: <String, ElectronicKeyListItem>{ arguments: <String, ElectronicKeyListItem>{
'itemData': indexEntity, 'itemData': indexEntity,
}).then((Object? val) { }).then((Object? val) {
if (val != null) { if (val != null) {
logic.mockNetworkDataRequest(); logic
setState(() {}); .refreshIndividualKeys(
lockId: indexEntity.lockId!,
keyId: indexEntity.keyId!)
.then((dynamic value) => setState(() {}));
} }
}); });
}), }),
@ -210,11 +217,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
// //
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr}'; useDateStr =
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
// //
useDateStr = '单次'.tr; useDateStr = '单次'.tr;
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; useDateStr =
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
// //
useDateStr = '循环'.tr; useDateStr = '循环'.tr;
@ -223,8 +232,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
return useDateStr; return useDateStr;
} }
Widget _electronicKeyItem(String avatarURL, String receiveUser, Widget _electronicKeyItem(
String useDate, String keyStatus, bool isAdminKey, bool isRemteUnlocking, Function() action) { String avatarURL,
String receiveUser,
String useDate,
String keyStatus,
bool isAdminKey,
bool isRemteUnlocking,
Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
@ -261,10 +276,10 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
SizedBox(width: 5.w), SizedBox(width: 5.w),
isRemteUnlocking isRemteUnlocking
? Image.asset( ? Image.asset(
'images/icon_electronicKey_remteUnlocking.png', 'images/icon_electronicKey_remteUnlocking.png',
width: 24.w, width: 24.w,
height: 20.w, height: 20.w,
) )
: Container(), : Container(),
SizedBox(width: 5.w), SizedBox(width: 5.w),
isAdminKey isAdminKey
@ -308,5 +323,4 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
), ),
); );
} }
} }

View File

@ -0,0 +1,31 @@
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
class ElectronicKeyEntity {
int? errorCode;
String? description;
String? errorMsg;
ElectronicKeyListItem? data;
ElectronicKeyEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
ElectronicKeyEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null
? ElectronicKeyListItem.fromJson(json['data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}

View File

@ -3,6 +3,8 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart'; import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
@ -427,6 +429,19 @@ class FingerprintListLogic extends BaseGetXController {
return keyDateTypeStr; return keyDateTypeStr;
} }
//
Future<void> refreshIndividualKeys(
{required int fingerprintId}) async {
final FingerprintEntity entity =
await ApiRepository.to.getFingerprintsData(fingerprintId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.fingerprintItemListData
.indexWhere((FingerprintItemData item) => item.fingerprintId == fingerprintId);
state.fingerprintItemListData.removeAt(index);
state.fingerprintItemListData.insert(index, entity.data!);
}
}
@override @override
Future<void> onReady() async { Future<void> onReady() async {
super.onReady(); super.onReady();

View File

@ -71,14 +71,14 @@ class _FingerprintListPageState extends State<FingerprintListPage>
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog( ShowTipView().showIosTipWithContentDialog(
"重置后,该锁的指纹都将被删除哦,确认要重置吗?".tr, () async { '重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true; state.isDeletAll = true;
state.deletKeyID = "1"; state.deletKeyID = '1';
state.deletFingerNo = 0; state.deletFingerNo = 0;
logic.senderAddFingerprint(); logic.senderAddFingerprint();
}); });
} else { } else {
logic.showToast("演示模式".tr); logic.showToast('演示模式'.tr);
} }
}, },
), ),
@ -109,8 +109,8 @@ class _FingerprintListPageState extends State<FingerprintListPage>
onClick: () async { onClick: () async {
var data = await Get.toNamed(Routers.addFingerprintTypePage, var data = await Get.toNamed(Routers.addFingerprintTypePage,
arguments: { arguments: {
"lockId": state.lockId.value, 'lockId': state.lockId.value,
"fromType": 1 // 1 2 'fromType': 1 // 1 2
}); });
if (data != null) { if (data != null) {
getHttpData(isRefresh: true); getHttpData(isRefresh: true);
@ -142,7 +142,7 @@ class _FingerprintListPageState extends State<FingerprintListPage>
SlidableAction( SlidableAction(
onPressed: (BuildContext context) { onPressed: (BuildContext context) {
ShowTipView().showIosTipWithContentDialog( ShowTipView().showIosTipWithContentDialog(
"确定要删除吗?".tr, () async { '确定要删除吗?'.tr, () async {
state.isDeletAll = false; state.isDeletAll = false;
state.deletKeyID = state.deletKeyID =
fingerprintItemData.fingerprintId.toString(); fingerprintItemData.fingerprintId.toString();
@ -165,10 +165,13 @@ class _FingerprintListPageState extends State<FingerprintListPage>
logic.getKeyDateType(fingerprintItemData), () async { logic.getKeyDateType(fingerprintItemData), () async {
var data = await Get.toNamed(Routers.fingerprintDetailPage, var data = await Get.toNamed(Routers.fingerprintDetailPage,
arguments: { arguments: {
"fingerprintItemData": fingerprintItemData, 'fingerprintItemData': fingerprintItemData,
}); });
if (data != null) { if (data != null) {
getHttpData(isRefresh: true); logic
.refreshIndividualKeys(
fingerprintId: fingerprintItemData.fingerprintId!)
.then((dynamic value) => setState(() {}));
} }
}), }),
); );

View File

@ -0,0 +1,29 @@
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
class FingerprintEntity {
FingerprintEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
FingerprintEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? FingerprintItemData.fromJson(json['data']) : null;
}
int? errorCode;
String? description;
String? errorMsg;
FingerprintItemData? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}

View File

@ -0,0 +1,31 @@
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
class PasswordKeyEntity {
int? errorCode;
String? description;
String? errorMsg;
PasswordKeyListItem? data;
PasswordKeyEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
PasswordKeyEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null
? PasswordKeyListItem.fromJson(json['data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
@ -391,6 +392,19 @@ class PasswordKeyListLogic extends BaseGetXController {
return useDateStr; return useDateStr;
} }
//
Future<void> refreshIndividualKeys(
{required int lockId, required int keyboardPwdId}) async {
final PasswordKeyEntity entity =
await ApiRepository.to.passwordKey(lockId, keyboardPwdId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.itemDataList
.indexWhere((PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId);
state.itemDataList.removeAt(index);
state.itemDataList.insert(index, entity.data!);
}
}
/// ///
StreamSubscription? _getPasswordListRefreshUIEvent; StreamSubscription? _getPasswordListRefreshUIEvent;
void _getPasswordListRefreshUIAction() { void _getPasswordListRefreshUIAction() {

View File

@ -165,7 +165,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem}) Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem})
.then((Object? val) { .then((Object? val) {
if (val != null) { if (val != null) {
getHttpData(isRefresh: true); // getHttpData(isRefresh: true);
} }
}); });
}), }),

View File

@ -1,8 +1,10 @@
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
class PasswordKeyEntity { class PasswordKeyEntity {
int? errorCode; int? errorCode;
String? description; String? description;
String? errorMsg; String? errorMsg;
PasswordKeyData? data; PasswordKeyListItem? data;
PasswordKeyEntity( PasswordKeyEntity(
{this.errorCode, this.description, this.errorMsg, this.data}); {this.errorCode, this.description, this.errorMsg, this.data});
@ -11,7 +13,7 @@ class PasswordKeyEntity {
errorCode = json['errorCode']; errorCode = json['errorCode'];
description = json['description']; description = json['description'];
errorMsg = json['errorMsg']; errorMsg = json['errorMsg'];
data = json['data'] != null ? PasswordKeyData.fromJson(json['data']) : null; data = json['data'] != null ? PasswordKeyListItem.fromJson(json['data']) : null;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -25,22 +27,3 @@ class PasswordKeyEntity {
return data; return data;
} }
} }
class PasswordKeyData {
String? keyboardPwd;
int? keyboardPwdId;
PasswordKeyData({this.keyboardPwd, this.keyboardPwdId});
PasswordKeyData.fromJson(Map<String, dynamic> json) {
keyboardPwd = json['keyboardPwd'];
keyboardPwdId = json['keyboardPwdId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['keyboardPwd'] = keyboardPwd;
data['keyboardPwdId'] = keyboardPwdId;
return data;
}
}

View File

@ -30,6 +30,7 @@ abstract class Api {
'/key/modifyKeyNameForAdmin'; // '/key/modifyKeyNameForAdmin'; //
final String updateKeyDateURL = '/key/updateKeyDate'; // final String updateKeyDateURL = '/key/updateKeyDate'; //
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; // final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //
final String passwordKeyDetailURL = '/keyboardPwd/detail'; //
final String keyboardPwdResetURL = '/keyboardPwd/reset'; // final String keyboardPwdResetURL = '/keyboardPwd/reset'; //
final String deleteElectronicKeyURL = '/key/delete'; // final String deleteElectronicKeyURL = '/key/delete'; //
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; // final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //
@ -101,6 +102,8 @@ abstract class Api {
final String editCheckInSetInfoURL = '/attendanceCompany/update'; // final String editCheckInSetInfoURL = '/attendanceCompany/update'; //
final String getFingerprintListURL = '/fingerprint/list'; // final String getFingerprintListURL = '/fingerprint/list'; //
final String getFingerprintDetailURL =
'/fingerprint/detail'; //
final String addFingerprintURL = '/fingerprint/add'; // final String addFingerprintURL = '/fingerprint/add'; //
final String editFingerprintURL = '/fingerprint/changePeriod'; // final String editFingerprintURL = '/fingerprint/changePeriod'; //
final String deleteFingerprintURL = '/fingerprint/delete'; // final String deleteFingerprintURL = '/fingerprint/delete'; //
@ -241,4 +244,5 @@ abstract class Api {
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; // final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //
final String appGetAppInfoURL = '/app/getAppInfo'; //APP基本信息 final String appGetAppInfoURL = '/app/getAppInfo'; //APP基本信息
final String appGetFwVersionURL = '/app/getFwVersion'; // final String appGetFwVersionURL = '/app/getFwVersion'; //
final String keydetail = ' /key/detail'; //
} }

View File

@ -126,6 +126,16 @@ class ApiProvider extends BaseProvider {
'searchStr': searchStr 'searchStr': searchStr
})); }));
Future<Response> electronicKey(
int lockId, int keyId
) =>
post(
keydetail.toUrl,
jsonEncode({
'lockId': lockId.toString(),
'keyId': keyId.toString(),
}));
Future<Response> sendElectronicKey( Future<Response> sendElectronicKey(
int createUser, int createUser,
String countryCode, String countryCode,
@ -439,6 +449,14 @@ class ApiProvider extends BaseProvider {
'searchStr': searchStr 'searchStr': searchStr
})); }));
Future<Response> passwordKey(int lockId, int keyboardPwdId,) =>
post(
passwordKeyDetailURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyboardPwdId': keyboardPwdId
}));
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post( Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
resetPasswordURL.toUrl, resetPasswordURL.toUrl,
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
@ -1097,9 +1115,18 @@ class ApiProvider extends BaseProvider {
'staffId': staffId, 'staffId': staffId,
})); }));
//
Future<Response> getFingerprintsData(
int fingerprintId) =>
post(
getFingerprintDetailURL.toUrl,
jsonEncode({
'fingerprintId': fingerprintId,
}));
// //
Future<Response> getFingerprintsListData( Future<Response> getFingerprintsListData(
String lockId, String pageNo, String pageSize, String searchStr) => String lockId, String pageNo, String pageSize, String searchStr) =>
post( post(
getFingerprintListURL.toUrl, getFingerprintListURL.toUrl,
jsonEncode({ jsonEncode({

View File

@ -4,10 +4,12 @@ import 'package:star_lock/login/login/app_get_version.dart';
import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart'; import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart'; import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockEscalation/version_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockEscalation/version_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart'; import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
@ -169,6 +171,14 @@ class ApiRepository {
return ElectronicKeyListEntity.fromJson(res.body); return ElectronicKeyListEntity.fromJson(res.body);
} }
//
Future<ElectronicKeyEntity> electronicKey({
required int lockId,required int keyId
}) async {
final res = await apiProvider.electronicKey(lockId,keyId);
return ElectronicKeyEntity.fromJson(res.body);
}
// //
Future<AuthorizedAdminSendEntity> sendElectronicKey( Future<AuthorizedAdminSendEntity> sendElectronicKey(
{required int createUser, {required int createUser,
@ -412,6 +422,14 @@ class ApiRepository {
return PasswordKeyListEntity.fromJson(res.body); return PasswordKeyListEntity.fromJson(res.body);
} }
//
Future<PasswordKeyEntity> passwordKey( int lockId,int keyboardPwdId) async {
final res = await apiProvider.passwordKey(
lockId, keyboardPwdId);
return PasswordKeyEntity.fromJson(res.body);
}
// //
Future<PasswordKeyListEntity> resetPasswordKey( Future<PasswordKeyListEntity> resetPasswordKey(
String lockId, String operatorUid) async { String lockId, String operatorUid) async {
@ -1289,6 +1307,12 @@ class ApiRepository {
return FingerprintListDataEntity.fromJson(res.body); return FingerprintListDataEntity.fromJson(res.body);
} }
//
Future<FingerprintEntity> getFingerprintsData(int fingerprintId) async {
final res = await apiProvider.getFingerprintsData(fingerprintId);
return FingerprintEntity.fromJson(res.body);
}
// //
Future<AddFingerprintEntity> addFingerprintsData({ Future<AddFingerprintEntity> addFingerprintsData({
required String lockId, required String lockId,