fix:修复限时密码的起始时间问题,修复设置页面上传数据后没有刷新

This commit is contained in:
anfe 2024-06-20 18:09:24 +08:00
parent 4cf9c99e5d
commit 60fd4f635d
5 changed files with 266 additions and 205 deletions

View File

@ -4,7 +4,7 @@
class IoModelVendor {
static String vendor_XHJ = 'XHJ';
static String model_XHJ_SYD = 'SYD-BLE-01';
static String model_XHJ_SYD = 'SYD8811-751';
static String model_XHJ_JL = 'JL-BLE-01';
static String vendor_XL = 'XL';

View File

@ -649,7 +649,10 @@ class LockSetLogic extends BaseGetXController {
recordType: recordType,
records: records,
isUnShowLoading: true);
if (entity.errorCode!.codeIsSuccessful) {}
if (entity.errorCode!.codeIsSuccessful) {
await getLockSettingInfoData();
update();
}
}
@override

View File

@ -28,7 +28,9 @@ class LockSetPage extends StatefulWidget {
class _LockSetPageState extends State<LockSetPage> with RouteAware {
final LockSetLogic logic = Get.put(LockSetLogic());
final LockSetState state = Get.find<LockSetLogic>().state;
final LockSetState state = Get
.find<LockSetLogic>()
.state;
Future<void> getHttpData() async {
logic.getLockSettingInfoData().then((LockSetInfoEntity value) {
@ -49,26 +51,29 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.set!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: EasyRefreshTool(
onRefresh: () {
getHttpData();
},
child: Column(
children: <Widget>[
Expanded(
child: Obx(() => ListView(
children: getListWidget(),
)),
),
],
),
));
return GetBuilder<LockSetLogic>(builder: (LockSetLogic logic) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.set!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: EasyRefreshTool(
onRefresh: () {
getHttpData();
},
child: Column(
children: <Widget>[
Expanded(
child: Obx(() =>
ListView(
children: getListWidget(),
)),
),
],
),
));
});
}
//
@ -93,45 +98,53 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveDirection: true,
action: () {
Get.toNamed(Routers.basicInformationPage,
arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}),
SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? '${state.lockSetInfoData.value.lockSettingInfo!
.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value
});
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage, arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockFeature.value.passageMode == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Visibility(
visible: true,
child: CommonItem(
@ -140,7 +153,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockTimePage, arguments: <String, LockSetInfoData>{
Get.toNamed(
Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
@ -174,7 +188,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveDirection: true,
action: () {
Get.toNamed(Routers.basicInformationPage,
arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}),
SizedBox(height: 10.h),
//by DaisyWu
@ -226,24 +242,27 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// })),
// SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0
? '${state.lockSetInfoData.value.lockSettingInfo!
.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() {
String titleStr = '';
@ -276,73 +295,87 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockSoundSetPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
Get.toNamed(Routers.lockSoundSetPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}));
}),
//
Obx(() => Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ??
0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockFeature.value.passageMode == 1,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.resetSwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.resetSwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//---
// Obx(() =>
@ -355,9 +388,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.faceUnlockPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
Get.toNamed(Routers.faceUnlockPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ),
//
@ -370,21 +404,25 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveDirection: true,
action: () {
Get.toNamed(Routers.msgNotificationPage,
arguments: <String, int?>{'lockId': state.lockSetInfoData.value.lockId});
arguments: <String, int?>{
'lockId': state.lockSetInfoData.value.lockId
});
})),
//
Obx(() => Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() =>
Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
// Obx(() =>
//
// Visibility(
@ -420,9 +458,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveDirection: true,
isHaveLine: true,
action: () {
Get.toNamed(Routers.openDoorDirectionPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
Get.toNamed(Routers.openDoorDirectionPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
//
Visibility(
@ -472,58 +511,66 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// }),
//
Obx(
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.attendance == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())),
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.attendance == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())),
),
//
Obx(
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.unlockReminder == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())),
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())),
),
// APP开锁时是否需联网
Obx(
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.appUnlockOnline == 1,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()),
),
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.appUnlockOnline == 1,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()),
),
),
SizedBox(height: 10.h),
// wifi配网
Obx(
() => Visibility(
visible: state.lockFeature.value.wifi == 1,
child: CommonItem(
leftTitel:
() =>
Visibility(
visible: state.lockFeature.value.wifi == 1,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wifiListPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
// Get.toNamed(Routers.configuringWifiPage, arguments: {
// 'lockSetInfoData': state.lockSetInfoData.value
// });
})),
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wifiListPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
// Get.toNamed(Routers.configuringWifiPage, arguments: {
// 'lockSetInfoData': state.lockSetInfoData.value
// });
})),
),
// Obx(() =>
//
@ -535,7 +582,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockTimePage, arguments: <String, LockSetInfoData>{
Get.toNamed(
Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
@ -628,13 +676,17 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
thumbColor: CupertinoColors.white,
value: state.isAttendance.value == 1,
onChanged: (bool value) {
logic.openCheckingInData((CheckingInInfoDataEntity checkingInInfoDataEntity) {
logic.openCheckingInData((
CheckingInInfoDataEntity checkingInInfoDataEntity) {
if (checkingInInfoDataEntity.data!.companyId == 0) {
// logic.showCupertinoAlertDialog(context);
ShowTipView().showIosTipWithContentDialog('创建公司后,考勤功能才能使用'.tr, () {
ShowTipView().showIosTipWithContentDialog(
'创建公司后,考勤功能才能使用'.tr, () {
//
Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
});
} else {
logic.setLockSetGeneralSetting();

View File

@ -27,7 +27,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
//
Future<void> getKeyboardPwdRequest() async {
int startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
final int endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
int endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
final int lockId = state.keyInfo.value.lockId!;
String getKeyType = '0';
@ -55,6 +55,10 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
showToast('失效时间要大于当前时间'.tr);
return;
}
//endDate 0
final DateTime now = DateTime.now();
startDate =
DateTime(now.year, now.month, now.day).millisecondsSinceEpoch;
}
//
@ -221,6 +225,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// late DateTime getStartDateTime;
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
@ -436,7 +441,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 3:
//
if (state.isPermanent.value == false) {
useDateStr = '类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
useDateStr =
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
} else {
useDateStr = '类型:自定义-永久';
}

View File

@ -225,7 +225,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
return Column(
children: <Widget>[
Visibility(
visible: CommonDataManage().currentKeyInfo.vendor == 'XHJ',
visible: CommonDataManage().currentKeyInfo.vendor != 'XHJ',
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.beginTime.value,