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

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

View File

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

View File

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