merge:合并代码
This commit is contained in:
commit
1c36f11194
@ -2,6 +2,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
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/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -60,6 +61,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
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
|
||||
@ -152,8 +152,11 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
'itemData': indexEntity,
|
||||
}).then((Object? val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
logic
|
||||
.refreshIndividualKeys(
|
||||
lockId: indexEntity.lockId!,
|
||||
keyId: indexEntity.keyId!)
|
||||
.then((dynamic value) => setState(() {}));
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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_state.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
@ -27,8 +28,8 @@ class ElectronicKeyDetailPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
final logic = Get.put(ElectronicKeyDetailLogic());
|
||||
final state = Get.find<ElectronicKeyDetailLogic>().state;
|
||||
final ElectronicKeyDetailLogic logic = Get.put(ElectronicKeyDetailLogic());
|
||||
final ElectronicKeyDetailState state = Get.find<ElectronicKeyDetailLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -39,7 +40,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
barTitle: '钥匙详情'.tr,
|
||||
haveBack: true,
|
||||
actionsList: (state.keyType.value != 3)
|
||||
? [
|
||||
? <Widget>[
|
||||
IconButton(
|
||||
icon: Image.asset(
|
||||
'images/icon_bar_more.png',
|
||||
@ -54,7 +55,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
: null,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '姓名'.tr,
|
||||
rightTitle: state.keyName.value,
|
||||
@ -62,7 +63,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
showCupertinoAlertDialog(
|
||||
tipsTitle: "修改姓名".tr, alertEnum: ShowAlertEnum.name);
|
||||
tipsTitle: '修改姓名'.tr, alertEnum: ShowAlertEnum.name);
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.isRealNameAuth.value,
|
||||
@ -73,7 +74,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
showCupertinoAlertDialog(
|
||||
tipsTitle: "修改真实姓名".tr,
|
||||
tipsTitle: '修改真实姓名'.tr,
|
||||
alertEnum: ShowAlertEnum.realName);
|
||||
}))),
|
||||
Obx(() => Visibility(
|
||||
@ -85,7 +86,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
showCupertinoAlertDialog(
|
||||
tipsTitle: "修改身份证号".tr,
|
||||
tipsTitle: '修改身份证号'.tr,
|
||||
alertEnum: ShowAlertEnum.idCardNumber);
|
||||
}))),
|
||||
Obx(() => CommonItem(
|
||||
@ -96,16 +97,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
isHaveDirection: state.itemData.value.keyStatus! ==
|
||||
XSConstantMacro.keyStatusExpired
|
||||
? false
|
||||
: state.keyType.value == 3
|
||||
? false
|
||||
: true,
|
||||
: state.keyType.value != 3,
|
||||
isHaveLine: true,
|
||||
action: state.itemData.value.keyStatus! ==
|
||||
XSConstantMacro.keyStatusExpired
|
||||
? null
|
||||
: () async {
|
||||
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
|
||||
logic.showToast("冻结状态下不允许修改钥匙权限".tr);
|
||||
logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -113,14 +112,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
// 限时/永久
|
||||
var data = await Get.toNamed(
|
||||
Routers.electronicKeyDetailChangeDate,
|
||||
arguments: {
|
||||
"pushType": 0,
|
||||
"itemData": state.itemData.value,
|
||||
arguments: <String, Object>{
|
||||
'pushType': 0,
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||
state.endDate.value = data["endTimeTimestamp"].toString();
|
||||
state.starDate.value = data['beginTimeTimestamp'].toString();
|
||||
state.endDate.value = data['endTimeTimestamp'].toString();
|
||||
state.keyType.value = 2;
|
||||
});
|
||||
}
|
||||
@ -128,23 +127,23 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
// 循环
|
||||
var data = await Get.toNamed(
|
||||
Routers.electronicKeyPeriodValidityPage,
|
||||
arguments: {
|
||||
"pushType": 0,
|
||||
"itemData": state.itemData.value,
|
||||
arguments: <String, Object>{
|
||||
'pushType': 0,
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
state.starTime.value = data["starTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.weekDay.value = data["validityValue"];
|
||||
state.starDate.value = data['starDate'];
|
||||
state.endDate.value = data['endDate'];
|
||||
state.starTime.value = data['starTime'];
|
||||
state.endTime.value = data['endTime'];
|
||||
state.weekDay.value = data['validityValue'];
|
||||
});
|
||||
}
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.keyType.value == 4 ? true : false,
|
||||
visible: state.keyType.value == 4 ,
|
||||
child: Obx(() => CommonItem(
|
||||
leftTitel: '有效日'.tr,
|
||||
rightTitle: logic.weekDayStr.join(','),
|
||||
@ -152,63 +151,63 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
|
||||
logic.showToast("冻结状态下不允许修改钥匙权限".tr);
|
||||
logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = await Get.toNamed(
|
||||
Routers.electronicKeyPeriodValidityPage,
|
||||
arguments: {
|
||||
"pushType": 0,
|
||||
"itemData": state.itemData.value,
|
||||
arguments: <String, Object>{
|
||||
'pushType': 0,
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
state.starTime.value = data["starTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.weekDay.value = data["validityValue"];
|
||||
state.starDate.value = data['starDate'];
|
||||
state.endDate.value = data['endDate'];
|
||||
state.starTime.value = data['starTime'];
|
||||
state.endTime.value = data['endTime'];
|
||||
state.weekDay.value = data['validityValue'];
|
||||
});
|
||||
}
|
||||
})))),
|
||||
Obx(() => Visibility(
|
||||
visible: state.keyType.value == 4 ? true : false,
|
||||
child: Obx(() => CommonItem(
|
||||
leftTitel: "有效时间".tr,
|
||||
leftTitel: '有效时间'.tr,
|
||||
rightTitle:
|
||||
"${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||
'${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
|
||||
logic.showToast("冻结状态下不允许修改钥匙权限".tr);
|
||||
logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = await Get.toNamed(
|
||||
Routers.electronicKeyPeriodValidityPage,
|
||||
arguments: {
|
||||
"pushType": 0,
|
||||
"itemData": state.itemData.value,
|
||||
arguments: <String, Object>{
|
||||
'pushType': 0,
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
state.starTime.value = data["starTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.weekDay.value = data["validityValue"];
|
||||
state.starDate.value = data['starDate'];
|
||||
state.endDate.value = data['endDate'];
|
||||
state.starTime.value = data['starTime'];
|
||||
state.endTime.value = data['endTime'];
|
||||
state.weekDay.value = data['validityValue'];
|
||||
});
|
||||
}
|
||||
})))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: "接收者".tr,
|
||||
rightTitle: state.itemData.value.username ?? ""),
|
||||
leftTitel: '接收者'.tr,
|
||||
rightTitle: state.itemData.value.username ?? ''),
|
||||
const SizedBox(height: 1),
|
||||
CommonItem(
|
||||
leftTitel: "发送人".tr,
|
||||
rightTitle: state.itemData.value.senderUsername ?? ""),
|
||||
leftTitel: '发送人'.tr,
|
||||
rightTitle: state.itemData.value.senderUsername ?? ''),
|
||||
const SizedBox(height: 1),
|
||||
CommonItem(
|
||||
leftTitel: '发送时间'.tr,
|
||||
@ -218,8 +217,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
Visibility(
|
||||
visible: state.itemData.value.keyRight == 1 ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "仅管理自己创建的用户".tr,
|
||||
rightTitle: "",
|
||||
leftTitel: '仅管理自己创建的用户'.tr,
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: true,
|
||||
rightWidget: SizedBox(
|
||||
@ -239,8 +238,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: "远程开锁".tr,
|
||||
rightTitle: "",
|
||||
leftTitel: '远程开锁'.tr,
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: true,
|
||||
rightWidget: SizedBox(
|
||||
@ -248,17 +247,17 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '实名认证'.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, child: _realNameAuthSwitch()))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: '操作记录'.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
|
||||
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
|
||||
'type': 5,
|
||||
'id': state.itemData.value.keyId.toString(),
|
||||
'recordName': state.itemData.value.keyName
|
||||
@ -289,7 +288,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isRealNameAuth.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
if (!state.isRealNameAuth.value) {
|
||||
logic.checkRealNameStatus(1);
|
||||
} else {
|
||||
@ -305,7 +304,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isRemoteUnlock.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||
logic.updateKeyDateRequest(2);
|
||||
},
|
||||
@ -318,7 +317,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.onlyManageYouCreatesUser.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
state.onlyManageYouCreatesUser.value =
|
||||
!state.onlyManageYouCreatesUser.value;
|
||||
@ -335,7 +334,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: tipsTitle,
|
||||
tipTitle: "请输入".tr,
|
||||
tipTitle: '请输入'.tr,
|
||||
controller: logic.getCurrentController(alertEnum),
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:get/get.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/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -15,16 +16,17 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
|
||||
//请求电子钥匙列表
|
||||
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
|
||||
final ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
endDate: '0',
|
||||
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
keyStatus: '',
|
||||
keyRight: '0',
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
startDate: '0',
|
||||
searchStr: state.searchController.text);
|
||||
final ElectronicKeyListEntity entity = await ApiRepository.to
|
||||
.electronicKeyList(
|
||||
endDate: '0',
|
||||
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
keyStatus: '',
|
||||
keyRight: '0',
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
startDate: '0',
|
||||
searchStr: state.searchController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (pageNo == 1) {
|
||||
state.itemDataList.value = entity.data!.itemList;
|
||||
@ -39,6 +41,19 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
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 {
|
||||
final ElectronicKeyListEntity entity = await ApiRepository.to
|
||||
@ -69,10 +84,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
void deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
|
||||
if(electronicKeyListItem.keyRight == 1){
|
||||
// 授权管理员
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
|
||||
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool isAllData) {
|
||||
deleteKeyRequest(
|
||||
electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
|
||||
});
|
||||
}else{
|
||||
} else {
|
||||
// 普通用户
|
||||
ShowTipView().showIosTipWithContentDialog('删除钥匙会在用户APP连网后生效'.tr,(){
|
||||
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
|
||||
@ -82,9 +99,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
|
||||
/// 刷新电子钥匙列表
|
||||
StreamSubscription? _getElectronicKeyListRefreshUIEvent;
|
||||
|
||||
void _getElectronicKeyListRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getElectronicKeyListRefreshUIEvent = eventBus.on<ElectronicKeyListRefreshUI>().listen((event) {
|
||||
_getElectronicKeyListRefreshUIEvent = eventBus
|
||||
.on<ElectronicKeyListRefreshUI>()
|
||||
.listen((ElectronicKeyListRefreshUI event) {
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
@ -64,9 +63,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
),
|
||||
onPressed: () async {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode =
|
||||
await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
ShowTipView().showIosTipWithContentDialog('该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest);
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest);
|
||||
} else {
|
||||
logic.showToast('演示模式'.tr);
|
||||
}
|
||||
@ -102,7 +103,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.sendElectronicKeyPage).then((Object? val) {
|
||||
Navigator.pushNamed(context, Routers.sendElectronicKeyPage)
|
||||
.then((Object? val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
mockRequest();
|
||||
@ -131,7 +133,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
shrinkWrap: true,
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
|
||||
final ElectronicKeyListItem indexEntity =
|
||||
state.itemDataList.value[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String keyStatus = ''; //钥匙状态
|
||||
|
||||
@ -139,7 +142,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
useDateStr = getUseDateStr(indexEntity);
|
||||
|
||||
//钥匙状态
|
||||
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||
keyStatus =
|
||||
XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||
|
||||
//是否为管理钥匙
|
||||
bool isAdminKey = false;
|
||||
@ -179,8 +183,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
'itemData': indexEntity,
|
||||
}).then((Object? val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
logic
|
||||
.refreshIndividualKeys(
|
||||
lockId: indexEntity.lockId!,
|
||||
keyId: indexEntity.keyId!)
|
||||
.then((dynamic value) => setState(() {}));
|
||||
}
|
||||
});
|
||||
}),
|
||||
@ -211,11 +218,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} 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) {
|
||||
//单次
|
||||
useDateStr = '单次'.tr;
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环'.tr;
|
||||
@ -224,8 +233,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
||||
String useDate, String keyStatus, bool isAdminKey, bool isRemteUnlocking, Function() action) {
|
||||
Widget _electronicKeyItem(
|
||||
String avatarURL,
|
||||
String receiveUser,
|
||||
String useDate,
|
||||
String keyStatus,
|
||||
bool isAdminKey,
|
||||
bool isRemteUnlocking,
|
||||
Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
@ -273,17 +288,23 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
color: AppColors.blackColor)),
|
||||
),
|
||||
SizedBox(width: 5.w),
|
||||
if (isRemteUnlocking) Image.asset(
|
||||
'images/icon_electronicKey_remteUnlocking.png',
|
||||
width: 24.w,
|
||||
height: 20.w,
|
||||
) else Container(),
|
||||
if (isRemteUnlocking)
|
||||
Image.asset(
|
||||
'images/icon_electronicKey_remteUnlocking.png',
|
||||
width: 24.w,
|
||||
height: 20.w,
|
||||
)
|
||||
else
|
||||
Container(),
|
||||
SizedBox(width: 5.w),
|
||||
if (isAdminKey) Image.asset(
|
||||
'images/icon_electronicKey_admin.png',
|
||||
width: 24.w,
|
||||
height: 20.w,
|
||||
) else Container(),
|
||||
if (isAdminKey)
|
||||
Image.asset(
|
||||
'images/icon_electronicKey_admin.png',
|
||||
width: 24.w,
|
||||
height: 20.w,
|
||||
)
|
||||
else
|
||||
Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -317,5 +338,4 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@ import 'dart:async';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.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 '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
||||
@ -427,6 +429,19 @@ class FingerprintListLogic extends BaseGetXController {
|
||||
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
|
||||
Future<void> onReady() async {
|
||||
super.onReady();
|
||||
|
||||
@ -166,7 +166,10 @@ class _FingerprintListPageState extends State<FingerprintListPage>
|
||||
'fingerprintItemData': fingerprintItemData,
|
||||
});
|
||||
if (data != null) {
|
||||
getHttpData(isRefresh: true);
|
||||
logic
|
||||
.refreshIndividualKeys(
|
||||
fingerprintId: fingerprintItemData.fingerprintId!)
|
||||
.then((dynamic value) => setState(() {}));
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
29
lib/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart
Executable file
29
lib/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart
Executable 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;
|
||||
}
|
||||
}
|
||||
31
lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyEntity.dart
Executable file
31
lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyEntity.dart
Executable 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;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.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/passwordKeyList_state.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
@ -391,6 +392,19 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
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;
|
||||
void _getPasswordListRefreshUIAction() {
|
||||
|
||||
@ -165,7 +165,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem})
|
||||
.then((Object? val) {
|
||||
if (val != null) {
|
||||
getHttpData(isRefresh: true);
|
||||
// getHttpData(isRefresh: true);
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
|
||||
class PasswordKeyEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
PasswordKeyData? data;
|
||||
PasswordKeyListItem? data;
|
||||
|
||||
PasswordKeyEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
@ -11,7 +13,7 @@ class PasswordKeyEntity {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
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() {
|
||||
@ -25,22 +27,3 @@ class PasswordKeyEntity {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ abstract class Api {
|
||||
'/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字
|
||||
final String updateKeyDateURL = '/key/updateKeyDate'; //编辑电子钥匙的有效期、有效时间、有效日
|
||||
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表
|
||||
final String passwordKeyDetailURL = '/keyboardPwd/detail'; //密码获取
|
||||
final String keyboardPwdResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
||||
final String deleteElectronicKeyURL = '/key/delete'; //删除电子钥匙
|
||||
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码
|
||||
@ -101,6 +102,8 @@ abstract class Api {
|
||||
final String editCheckInSetInfoURL = '/attendanceCompany/update'; // 修改考勤设置信息
|
||||
|
||||
final String getFingerprintListURL = '/fingerprint/list'; // 指纹列表
|
||||
final String getFingerprintDetailURL =
|
||||
'/fingerprint/detail'; // 指纹详情
|
||||
final String addFingerprintURL = '/fingerprint/add'; // 添加指纹
|
||||
final String editFingerprintURL = '/fingerprint/changePeriod'; // 编辑指纹
|
||||
final String deleteFingerprintURL = '/fingerprint/delete'; // 删除指纹
|
||||
@ -241,4 +244,5 @@ abstract class Api {
|
||||
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板
|
||||
final String appGetAppInfoURL = '/app/getAppInfo'; //获取APP基本信息
|
||||
final String appGetFwVersionURL = '/app/getFwVersion'; //获取固件信息
|
||||
final String keydetail = ' /key/detail'; //获取钥匙详情
|
||||
}
|
||||
|
||||
@ -126,6 +126,16 @@ class ApiProvider extends BaseProvider {
|
||||
'searchStr': searchStr
|
||||
}));
|
||||
|
||||
Future<Response> electronicKey(
|
||||
int lockId, int keyId
|
||||
) =>
|
||||
post(
|
||||
keydetail.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId.toString(),
|
||||
'keyId': keyId.toString(),
|
||||
}));
|
||||
|
||||
Future<Response> sendElectronicKey(
|
||||
int createUser,
|
||||
String countryCode,
|
||||
@ -439,6 +449,14 @@ class ApiProvider extends BaseProvider {
|
||||
'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(
|
||||
resetPasswordURL.toUrl,
|
||||
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||
@ -1097,9 +1115,18 @@ class ApiProvider extends BaseProvider {
|
||||
'staffId': staffId,
|
||||
}));
|
||||
|
||||
// 获取指纹详情
|
||||
Future<Response> getFingerprintsData(
|
||||
int fingerprintId) =>
|
||||
post(
|
||||
getFingerprintDetailURL.toUrl,
|
||||
jsonEncode({
|
||||
'fingerprintId': fingerprintId,
|
||||
}));
|
||||
|
||||
// 获取指纹列表
|
||||
Future<Response> getFingerprintsListData(
|
||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||
post(
|
||||
getFingerprintListURL.toUrl,
|
||||
jsonEncode({
|
||||
|
||||
@ -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/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_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/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.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/fingerprint/fingerprintList/fingerprint_entity.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/messageWarn/lockUser/lockUser_entity.dart';
|
||||
@ -169,6 +171,14 @@ class ApiRepository {
|
||||
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(
|
||||
{required int createUser,
|
||||
@ -412,6 +422,14 @@ class ApiRepository {
|
||||
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(
|
||||
String lockId, String operatorUid) async {
|
||||
@ -1289,6 +1307,12 @@ class ApiRepository {
|
||||
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({
|
||||
required String lockId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user