fix:修复删除密码/卡/指纹/管理员/不会消失的问题
This commit is contained in:
parent
9174935452
commit
a515433345
@ -151,7 +151,13 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
arguments: <String, ElectronicKeyListItem>{
|
arguments: <String, ElectronicKeyListItem>{
|
||||||
'itemData': indexEntity,
|
'itemData': indexEntity,
|
||||||
}).then((Object? val) {
|
}).then((Object? val) {
|
||||||
if (val != null) {
|
if (val == 'deletScuess') {
|
||||||
|
state.itemDataList.removeWhere(
|
||||||
|
( ElectronicKeyListItem item) =>
|
||||||
|
item.keyId ==
|
||||||
|
indexEntity.keyId!);
|
||||||
|
setState(() {});
|
||||||
|
} else if (val != null) {
|
||||||
logic
|
logic
|
||||||
.refreshIndividualKeys(
|
.refreshIndividualKeys(
|
||||||
lockId: indexEntity.lockId!,
|
lockId: indexEntity.lockId!,
|
||||||
|
|||||||
@ -182,7 +182,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
arguments: <String, ElectronicKeyListItem>{
|
arguments: <String, ElectronicKeyListItem>{
|
||||||
'itemData': indexEntity,
|
'itemData': indexEntity,
|
||||||
}).then((Object? val) {
|
}).then((Object? val) {
|
||||||
if (val != null) {
|
if (val == 'deletScuess') {
|
||||||
|
state.itemDataList.removeWhere(
|
||||||
|
( ElectronicKeyListItem item) =>
|
||||||
|
item.keyId ==
|
||||||
|
indexEntity.keyId!);
|
||||||
|
setState(() {});
|
||||||
|
} else if (val != null) {
|
||||||
logic
|
logic
|
||||||
.refreshIndividualKeys(
|
.refreshIndividualKeys(
|
||||||
lockId: indexEntity.lockId!,
|
lockId: indexEntity.lockId!,
|
||||||
|
|||||||
@ -154,7 +154,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast('删除成功'.tr, something: (){
|
showToast('删除成功'.tr, something: (){
|
||||||
Get.back(result: 'addScuess');
|
Get.back(result: 'deletScuess');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -69,7 +68,8 @@ class _FingerprintListPageState extends State<FingerprintListPage>
|
|||||||
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, () async {
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
|
||||||
state.isDeletAll = true;
|
state.isDeletAll = true;
|
||||||
state.deletKeyID = '1';
|
state.deletKeyID = '1';
|
||||||
state.deletFingerNo = 0;
|
state.deletFingerNo = 0;
|
||||||
@ -161,11 +161,18 @@ class _FingerprintListPageState extends State<FingerprintListPage>
|
|||||||
fingerprintItemData.fingerprintName!,
|
fingerprintItemData.fingerprintName!,
|
||||||
logic.getKeyType(fingerprintItemData),
|
logic.getKeyType(fingerprintItemData),
|
||||||
logic.getKeyDateType(fingerprintItemData), () async {
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
final data = await Get.toNamed(Routers.fingerprintDetailPage,
|
final data = await Get.toNamed(
|
||||||
|
Routers.fingerprintDetailPage,
|
||||||
arguments: <String, FingerprintItemData>{
|
arguments: <String, FingerprintItemData>{
|
||||||
'fingerprintItemData': fingerprintItemData,
|
'fingerprintItemData': fingerprintItemData,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data == 'deletScuess') {
|
||||||
|
state.fingerprintItemListData.removeWhere(
|
||||||
|
(FingerprintItemData item) =>
|
||||||
|
item.fingerprintId ==
|
||||||
|
fingerprintItemData.fingerprintId!);
|
||||||
|
setState(() {});
|
||||||
|
} else if (data != null) {
|
||||||
logic
|
logic
|
||||||
.refreshIndividualKeys(
|
.refreshIndividualKeys(
|
||||||
fingerprintId: fingerprintItemData.fingerprintId!)
|
fingerprintId: fingerprintItemData.fingerprintId!)
|
||||||
|
|||||||
@ -25,6 +25,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription =
|
_replySubscription =
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
@ -70,7 +71,8 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
keyID: '0',
|
keyID: '0',
|
||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||||
pwd: state.pwd, //state.deletPWD,
|
pwd: state.pwd,
|
||||||
|
//state.deletPWD,
|
||||||
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
@ -157,7 +159,8 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
keyID: '0',
|
keyID: '0',
|
||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||||
pwd: state.pwd, //state.deletPWD,
|
pwd: state.pwd,
|
||||||
|
//state.deletPWD,
|
||||||
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
@ -228,28 +231,28 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* //请求操作记录列表(门锁日志)
|
* //请求操作记录列表(门锁日志)
|
||||||
void mockNetworkDataRequest({required bool isRefresh}) async {
|
void mockNetworkDataRequest({required bool isRefresh}) async {
|
||||||
// 如果是下拉刷新,清空已有数据
|
// 如果是下拉刷新,清空已有数据
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
state.lockLogItemList.clear();
|
state.lockLogItemList.clear();
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
}
|
}
|
||||||
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||||
lockId: state.keyInfos.value.lockId!,
|
lockId: state.keyInfos.value.lockId!,
|
||||||
lockEventType: state.dropdownValue.value,
|
lockEventType: state.dropdownValue.value,
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
pageSize: int.parse(pageSize),
|
pageSize: int.parse(pageSize),
|
||||||
startDate: state.startDate.value,
|
startDate: state.startDate.value,
|
||||||
endDate: state.endDate.value);
|
endDate: state.endDate.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// 更新数据列表
|
// 更新数据列表
|
||||||
state.lockLogItemList.addAll(entity.data!.itemList!);
|
state.lockLogItemList.addAll(entity.data!.itemList!);
|
||||||
// 更新页码
|
// 更新页码
|
||||||
pageNo++;
|
pageNo++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//请求密码钥匙列表
|
//请求密码钥匙列表
|
||||||
Future<PasswordKeyListEntity> mockNetworkDataRequest(
|
Future<PasswordKeyListEntity> mockNetworkDataRequest(
|
||||||
@ -396,10 +399,10 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
Future<void> refreshIndividualKeys(
|
Future<void> refreshIndividualKeys(
|
||||||
{required int lockId, required int keyboardPwdId}) async {
|
{required int lockId, required int keyboardPwdId}) async {
|
||||||
final PasswordKeyEntity entity =
|
final PasswordKeyEntity entity =
|
||||||
await ApiRepository.to.passwordKey(lockId, keyboardPwdId);
|
await ApiRepository.to.passwordKey(lockId, keyboardPwdId);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
final int index = state.itemDataList
|
final int index = state.itemDataList.indexWhere(
|
||||||
.indexWhere((PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId);
|
(PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId);
|
||||||
state.itemDataList.removeAt(index);
|
state.itemDataList.removeAt(index);
|
||||||
state.itemDataList.insert(index, entity.data!);
|
state.itemDataList.insert(index, entity.data!);
|
||||||
}
|
}
|
||||||
@ -407,6 +410,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
/// 刷新密码列表
|
/// 刷新密码列表
|
||||||
StreamSubscription? _getPasswordListRefreshUIEvent;
|
StreamSubscription? _getPasswordListRefreshUIEvent;
|
||||||
|
|
||||||
void _getPasswordListRefreshUIAction() {
|
void _getPasswordListRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getPasswordListRefreshUIEvent = eventBus
|
_getPasswordListRefreshUIEvent = eventBus
|
||||||
|
|||||||
@ -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';
|
||||||
@ -64,13 +63,15 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode =
|
||||||
|
await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
if (state.itemDataList.isEmpty) {
|
if (state.itemDataList.isEmpty) {
|
||||||
logic.showToast('暂无密码,无需重置'.tr);
|
logic.showToast('暂无密码,无需重置'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, logic.getUserInfoRequest);
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'该锁的密码都将被删除'.tr, logic.getUserInfoRequest);
|
||||||
} else {
|
} else {
|
||||||
logic.showToast('演示模式'.tr);
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
@ -105,9 +106,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.passwordKeyPerpetualPage,
|
context, Routers.passwordKeyPerpetualPage,
|
||||||
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfo.value})
|
arguments: <String, LockListInfoItemEntity>{
|
||||||
.then((Object? val) {
|
'keyInfo': state.keyInfo.value
|
||||||
|
}).then((Object? val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
getHttpData(isRefresh: true);
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
@ -146,7 +148,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'确定要删除吗?'.tr, () async {
|
||||||
state.itemData = passwordKeyListItem;
|
state.itemData = passwordKeyListItem;
|
||||||
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
||||||
state.pwd = passwordKeyListItem.keyboardPwd!;
|
state.pwd = passwordKeyListItem.keyboardPwd!;
|
||||||
@ -162,10 +165,23 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
),
|
),
|
||||||
child: _electronicKeyItem(index, 'images/icon_password.png',
|
child: _electronicKeyItem(index, 'images/icon_password.png',
|
||||||
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem})
|
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||||
.then((Object? val) {
|
arguments: <String, PasswordKeyListItem>{
|
||||||
if (val != null) {
|
'itemData': passwordKeyListItem
|
||||||
// getHttpData(isRefresh: true);
|
}).then((Object? val) {
|
||||||
|
if (val == 'deletScuess') {
|
||||||
|
state.itemDataList.removeWhere(
|
||||||
|
(PasswordKeyListItem item) =>
|
||||||
|
item.keyboardPwdId ==
|
||||||
|
passwordKeyListItem.keyboardPwdId!);
|
||||||
|
setState(() {});
|
||||||
|
} else if (val != null) {
|
||||||
|
logic
|
||||||
|
.refreshIndividualKeys(
|
||||||
|
lockId: passwordKeyListItem.lockId!,
|
||||||
|
keyboardPwdId:
|
||||||
|
passwordKeyListItem.keyboardPwdId!)
|
||||||
|
.then((dynamic value) => setState(() {}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -181,8 +197,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) {
|
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
||||||
final PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
String lockTypeTitle, String useDateStr, Function()? action) {
|
||||||
|
final PasswordKeyListItem passwordKeyListItem =
|
||||||
|
state.itemDataList[itemIndex];
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
@ -223,11 +241,13 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
if (passwordKeyListItem.keyboardPwdStatus == 2) Text(
|
if (passwordKeyListItem.keyboardPwdStatus == 2)
|
||||||
'已过期'.tr,
|
Text(
|
||||||
style:
|
'已过期'.tr,
|
||||||
TextStyle(color: Colors.red, fontSize: 20.sp),
|
style: TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||||
) else Container(),
|
)
|
||||||
|
else
|
||||||
|
Container(),
|
||||||
// SizedBox(width: 15.w)
|
// SizedBox(width: 15.w)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -126,15 +126,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
'searchStr': searchStr
|
'searchStr': searchStr
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> electronicKey(
|
Future<Response> electronicKey(int lockId, int keyId) => post(
|
||||||
int lockId, int keyId
|
keydetail.toUrl,
|
||||||
) =>
|
jsonEncode({
|
||||||
post(
|
'lockId': lockId.toString(),
|
||||||
keydetail.toUrl,
|
'keyId': keyId.toString(),
|
||||||
jsonEncode({
|
}));
|
||||||
'lockId': lockId.toString(),
|
|
||||||
'keyId': keyId.toString(),
|
|
||||||
}));
|
|
||||||
|
|
||||||
Future<Response> sendElectronicKey(
|
Future<Response> sendElectronicKey(
|
||||||
int createUser,
|
int createUser,
|
||||||
@ -449,13 +446,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
'searchStr': searchStr
|
'searchStr': searchStr
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> passwordKey(int lockId, int keyboardPwdId,) =>
|
Future<Response> passwordKey(
|
||||||
post(
|
int lockId,
|
||||||
passwordKeyDetailURL.toUrl,
|
int keyboardPwdId,
|
||||||
jsonEncode({
|
) =>
|
||||||
'lockId': lockId,
|
post(passwordKeyDetailURL.toUrl,
|
||||||
'keyboardPwdId': keyboardPwdId
|
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,
|
||||||
@ -1116,17 +1112,15 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 获取指纹详情
|
// 获取指纹详情
|
||||||
Future<Response> getFingerprintsData(
|
Future<Response> getFingerprintsData(int fingerprintId) => post(
|
||||||
int fingerprintId) =>
|
getFingerprintDetailURL.toUrl,
|
||||||
post(
|
jsonEncode({
|
||||||
getFingerprintDetailURL.toUrl,
|
'fingerprintId': fingerprintId,
|
||||||
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({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user