根据厂商类型添加离线限时密码是否选择开始时间

This commit is contained in:
魏少阳 2024-04-24 13:39:47 +08:00
parent c505fcd2f3
commit edd99cbe48
4 changed files with 64 additions and 55 deletions

View File

@ -290,25 +290,6 @@ class _AddCardPageState extends State<AddCardPage> {
); );
} }
String getAppBarTitle(int type) {
String title;
switch (type) {
case 0:
title = TranslationLoader.lanKeys!.stressCard!.tr;
break;
case 1:
title = TranslationLoader.lanKeys!.stressFingerprint!.tr;
break;
case 2:
title = TranslationLoader.lanKeys!.remoteControl!.tr;
break;
default:
title = "";
break;
}
return title;
}
// //
Widget getTFWidget(String tfStr) { Widget getTFWidget(String tfStr) {
return Container( return Container(

View File

@ -16,6 +16,7 @@ import '../../../../blue/io_tool/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../blue/sender_manage.dart'; import '../../../../blue/sender_manage.dart';
import '../../../../tools/baseGetXController.dart'; import '../../../../tools/baseGetXController.dart';
import '../../../../tools/commonDataManage.dart';
import '../../../../tools/dateTool.dart'; import '../../../../tools/dateTool.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
@ -46,31 +47,34 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
String lockId = state.keyInfo.value.lockId.toString(); String lockId = state.keyInfo.value.lockId.toString();
String getKeyType = state.widgetType.value.toString(); String getKeyType = state.widgetType.value.toString();
if (state.nameController.text.isEmpty) { if (state.nameController.text.isEmpty) {
showToast("请输入姓名".tr); showToast("请输入姓名".tr);
return; return;
} }
//
if (state.widgetType.value == 4) {
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间不能小于当前时间".tr);
return;
}
}
if (state.widgetType.value == 0) { if (state.widgetType.value == 0) {
// //
getKeyType = '2'; getKeyType = '2';
} else if (state.widgetType.value == 1) { } else if (state.widgetType.value == 1) {
// //
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { if(CommonDataManage().currentKeyInfo.vendor == "XL"){
showToast("生效时间不能小于当前时间".tr); // 鸿
return; //
} if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间不能小于当前时间".tr);
return;
}
if (startDate >= endDate) { if (startDate >= endDate) {
showToast("失效时间要大于生效时间".tr); showToast("失效时间要大于生效时间".tr);
return; return;
}
}else{
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间不能小于当前时间".tr);
return;
}
startDate = 0;
} }
getKeyType = '3'; getKeyType = '3';
} else if (state.widgetType.value == 2) { } else if (state.widgetType.value == 2) {
@ -80,7 +84,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// //
} else if (state.widgetType.value == 4) { } else if (state.widgetType.value == 4) {
// //
// if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间不能小于当前时间".tr);
return;
}
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("结束时间不能小于当前时间".tr); showToast("结束时间不能小于当前时间".tr);
return; return;

View File

@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/pickers/pickers.dart'; import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/style/default_style.dart'; import 'package:star_lock/tools/pickers/style/default_style.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
@ -193,22 +194,25 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
Widget keyTimeLimitWidget() { Widget keyTimeLimitWidget() {
return Column( return Column(
children: [ children: [
CommonItem( Visibility(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, visible: CommonDataManage().currentKeyInfo.vendor == "XHJ" ? false : true,
rightTitle: state.beginTime.value, child: CommonItem(
isHaveLine: true, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
isHaveDirection: true, rightTitle: state.beginTime.value,
action: () { isHaveLine: true,
Pickers.showDatePicker(context, mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH, onConfirm: (p) { isHaveDirection: true,
if (state.widgetType.value == 3) { action: () {
// Pickers.showDatePicker(context, mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH, onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1); if (state.widgetType.value == 3) {
} else { //
state.beginTime.value = DateTool().getYMDHNDateString(p, 4); state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
} } else {
Get.log("beginTime:${state.beginTime.value}"); state.beginTime.value = DateTool().getYMDHNDateString(p, 4);
}); }
}), Get.log("beginTime:${state.beginTime.value}");
});
}),
),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.endTime.value, rightTitle: state.endTime.value,

View File

@ -122,6 +122,10 @@ class LockListInfoItemEntity {
int? senderUserId; int? senderUserId;
int? electricQuantityDate; int? electricQuantityDate;
int? electricQuantityStandby; int? electricQuantityStandby;
int? isOnlyManageSelf;
int? restoreCount;
String? model;
String? vendor;
Bluetooth? bluetooth; Bluetooth? bluetooth;
LockFeature? lockFeature; LockFeature? lockFeature;
LockSetting? lockSetting; LockSetting? lockSetting;
@ -153,7 +157,11 @@ class LockListInfoItemEntity {
this.lockUserNo, this.lockUserNo,
this.electricQuantityDate, this.electricQuantityDate,
this.electricQuantityStandby, this.electricQuantityStandby,
this.senderUserId}); this.senderUserId,
this.isOnlyManageSelf,
this.restoreCount,
this.model,
this.vendor});
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) { LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
keyId = json['keyId']; keyId = json['keyId'];
@ -180,6 +188,10 @@ class LockListInfoItemEntity {
senderUserId = json['senderUserId']; senderUserId = json['senderUserId'];
electricQuantityDate = json['electricQuantityDate']; electricQuantityDate = json['electricQuantityDate'];
electricQuantityStandby = json['electricQuantityStandby']; electricQuantityStandby = json['electricQuantityStandby'];
isOnlyManageSelf = json['isOnlyManageSelf'];
restoreCount = json['restoreCount'];
model = json['model'];
vendor = json['vendor'];
bluetooth = json['bluetooth'] != null bluetooth = json['bluetooth'] != null
? Bluetooth.fromJson(json['bluetooth']) ? Bluetooth.fromJson(json['bluetooth'])
: null; : null;
@ -217,6 +229,10 @@ class LockListInfoItemEntity {
data['senderUserId'] = senderUserId; data['senderUserId'] = senderUserId;
data['electricQuantityDate'] = electricQuantityDate; data['electricQuantityDate'] = electricQuantityDate;
data['electricQuantityStandby'] = electricQuantityStandby; data['electricQuantityStandby'] = electricQuantityStandby;
data['isOnlyManageSelf'] = isOnlyManageSelf;
data['restoreCount'] = restoreCount;
data['model'] = model;
data['vendor'] = vendor;
if (bluetooth != null) { if (bluetooth != null) {
data['bluetooth'] = bluetooth!.toJson(); data['bluetooth'] = bluetooth!.toJson();
} }