Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
7917f585ab
@ -182,6 +182,7 @@ import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServices
|
|||||||
import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart';
|
import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart';
|
||||||
import 'mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart';
|
import 'mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart';
|
||||||
import 'starLockApplication/starLockApplication.dart';
|
import 'starLockApplication/starLockApplication.dart';
|
||||||
|
import 'tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart';
|
||||||
|
|
||||||
abstract class Routers {
|
abstract class Routers {
|
||||||
static const initial = '/'; // 加载页
|
static const initial = '/'; // 加载页
|
||||||
@ -429,6 +430,7 @@ abstract class Routers {
|
|||||||
static const liveVideoPage = '/liveVideoPage'; //实时画面
|
static const liveVideoPage = '/liveVideoPage'; //实时画面
|
||||||
|
|
||||||
static const accessoriesListPage = '/accessoriesListPage'; //配件列表
|
static const accessoriesListPage = '/accessoriesListPage'; //配件列表
|
||||||
|
static const seletKeyCyclicDatePage = '/SeletKeyCyclicDatePage';// 电子钥匙、授权管理员、卡、指纹、遥控等添加添加循环日期公共界面
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AppRouters {
|
abstract class AppRouters {
|
||||||
@ -1034,6 +1036,9 @@ abstract class AppRouters {
|
|||||||
page: (() => const AccessoriesListPage())),
|
page: (() => const AccessoriesListPage())),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.wifiListPage,
|
name: Routers.wifiListPage,
|
||||||
page: (() => const WifiListPage()))
|
page: (() => const WifiListPage())),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.seletKeyCyclicDatePage,
|
||||||
|
page: (() => const SeletKeyCyclicDatePage()))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -178,9 +178,9 @@ class BlueManage {
|
|||||||
// if (scanResult.device.advName.isEmpty) {
|
// if (scanResult.device.advName.isEmpty) {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
Get.log("scanResult.device.advName:${scanResult.device.advName}"
|
// Get.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||||
" scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||||
" rssi:${scanResult.rssi}");
|
// " rssi:${scanResult.rssi}");
|
||||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
||||||
// 查询id相同的元素
|
// 查询id相同的元素
|
||||||
final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class CommandReciverManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parseData(oriDataList).then((value) async {
|
parseData(oriDataList).then((value) async {
|
||||||
Get.log("parseData222 data:$value");
|
// Get.log("parseData222 data:$value");
|
||||||
EasyLoading.dismiss();
|
EasyLoading.dismiss();
|
||||||
await EventBusManager().eventBusFir(value);
|
await EventBusManager().eventBusFir(value);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
|||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import 'addCardType_state.dart';
|
import 'addCardType_state.dart';
|
||||||
|
|
||||||
class AddCardTypeLogic extends BaseGetXController{
|
class AddCardTypeLogic extends BaseGetXController{
|
||||||
@ -14,17 +15,26 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4
|
var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4
|
||||||
var startDate = "";
|
var startDate = "";
|
||||||
var endDate = "";
|
var endDate = "";
|
||||||
|
var startTime = "";
|
||||||
|
var endTime = "";
|
||||||
if (state.selectType.value == "0") {
|
if (state.selectType.value == "0") {
|
||||||
fingerprintType = 1;
|
fingerprintType = 1;
|
||||||
startDate = "0";
|
startDate = "0";
|
||||||
endDate = "0";
|
endDate = "0";
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
} else if (state.selectType.value == "1") {
|
} else if (state.selectType.value == "1") {
|
||||||
fingerprintType = 2;
|
fingerprintType = 2;
|
||||||
if (state.beginTimeTimestamp.value.isEmpty) {
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
showToast("请选择开始时间");
|
showToast("请选择开始时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.endTimeTimestamp.value.isEmpty) {
|
if (endDate.isEmpty) {
|
||||||
showToast("请选择结束时间");
|
showToast("请选择结束时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -34,40 +44,19 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (int.parse(state.beginTimeTimestamp.value) >=
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
int.parse(state.endTimeTimestamp.value)) {
|
|
||||||
showToast("失效时间要大于生效时间");
|
showToast("失效时间要大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
startDate = state.beginTimeTimestamp.value;
|
|
||||||
endDate = state.endTimeTimestamp.value;
|
|
||||||
} else if (state.selectType.value == "2") {
|
} else if (state.selectType.value == "2") {
|
||||||
if (state.effectiveDateTime.value <= 0) {
|
if (state.beginTime.value.isEmpty) {
|
||||||
showToast("请选择生效时间");
|
showToast("请选择有效期");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.failureDateTime.value <= 0) {
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
showToast("请选择失效时间");
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
return;
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
}
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
|
|
||||||
if (state.weekdaysList.value.isEmpty) {
|
|
||||||
showToast("请选择有效日");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(DateTime.now().millisecondsSinceEpoch >= state.effectiveDateTime.value){
|
|
||||||
// Toast.show(msg: "生效时间要大于当前时间");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (state.effectiveDateTime.value >= state.failureDateTime.value) {
|
|
||||||
showToast("失效时间要大于生效时间");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startDate = state.effectiveDateTime.value.toString();
|
|
||||||
endDate = state.failureDateTime.value.toString();
|
|
||||||
fingerprintType = 4;
|
fingerprintType = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +74,8 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
"weekDay": state.weekdaysList.value,
|
"weekDay": state.weekdaysList.value,
|
||||||
"fromType": state.fromType.value,
|
"fromType": state.fromType.value,
|
||||||
"isAdministrator": state.isAdministrator.value == false ? "1" : "2", // 1:不是管理员 2:是管理员
|
"isAdministrator": state.isAdministrator.value == false ? "1" : "2", // 1:不是管理员 2:是管理员
|
||||||
|
"effectiveTime": startTime,
|
||||||
|
"failureTime": endTime,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -91,21 +92,7 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
state.nameController),
|
state.nameController),
|
||||||
CommonItem(
|
keyCyclicDate(),
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () async {
|
|
||||||
Map result = await Get.toNamed(
|
|
||||||
Routers.electronicKeyPeriodValidityPage);
|
|
||||||
state.weekdaysList.value = result['validityValue'];
|
|
||||||
state.effectiveDateTime.value =
|
|
||||||
result['starDate'].millisecondsSinceEpoch;
|
|
||||||
state.failureDateTime.value =
|
|
||||||
result['endDate'].millisecondsSinceEpoch;
|
|
||||||
print(
|
|
||||||
'得到的有效期数据:${state.weekdaysList.value} == ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
|
||||||
}),
|
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
keyBottomWidget()
|
keyBottomWidget()
|
||||||
],
|
],
|
||||||
@ -141,14 +128,8 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
onConfirm: (p) {
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.beginTime.value =
|
|
||||||
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
|
||||||
state.beginTimeTimestamp.value =
|
|
||||||
DateTime.parse(state.beginTime.value)
|
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -156,14 +137,8 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
rightTitle: state.endTime.value,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
onConfirm: (p) {
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.endTime.value =
|
|
||||||
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
|
||||||
state.endTimeTimestamp.value =
|
|
||||||
DateTime.parse(state.endTime.value)
|
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -171,6 +146,66 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 循环顶部选择日期
|
||||||
|
Widget keyCyclicDate(){
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日",
|
||||||
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.back(result: result);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -5,18 +5,15 @@ import 'package:get/get.dart';
|
|||||||
class AddCardTypeState{
|
class AddCardTypeState{
|
||||||
|
|
||||||
final lockId = 0.obs;
|
final lockId = 0.obs;
|
||||||
final selectType = "0".obs;// 0永久 1显示 2循环
|
final selectType = "0".obs;// 0永久 1限时 2循环
|
||||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
final isStressFingerprint = false.obs;
|
final isStressFingerprint = false.obs;
|
||||||
final isAdministrator = false.obs;// 是否是管理员
|
final isAdministrator = false.obs;// 是否是管理员
|
||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
var beginTime = "".obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
var endTime = "".obs;// 结束时间
|
||||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
var failureDateTime = "".obs;// 失效时间
|
||||||
|
|
||||||
var effectiveDateTime = 0.obs;// 生效时间
|
|
||||||
var failureDateTime = 0.obs;// 失效时间
|
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
|
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_protocol/io_addICCard.dart';
|
import '../../../../blue/io_protocol/io_addICCard.dart';
|
||||||
@ -234,7 +235,6 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
var token = await Storage.getStringList(saveBlueToken);
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
print("openDoorTokenPubToken:$getTokenList");
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
IoSenderManage.senderAddICCardCommand(
|
IoSenderManage.senderAddICCardCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
@ -282,10 +282,10 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
icCardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
icCardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||||
cardType:1,
|
cardType:1,
|
||||||
useCountLimit:1,
|
useCountLimit:1,
|
||||||
startTime:0x11223344,
|
// startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
// endTime:0x11223344,
|
||||||
// startTime:int.parse(state.startDate.value)~/1000,
|
startTime:int.parse(state.startDate.value)~/1000,
|
||||||
// endTime:int.parse(state.endDate.value)~/1000,
|
endTime:int.parse(state.endDate.value)~/1000,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -297,16 +297,20 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addICCardData() async {
|
void addICCardData() async {
|
||||||
|
print("state.startDate.value:${state.startDate.value} state.effectiveDateTime.value:${state.effectiveDateTime.value} state.failureDateTime.value:${state.failureDateTime.value}");
|
||||||
var entity = await ApiRepository.to.addICCardData(
|
var entity = await ApiRepository.to.addICCardData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
endDate: state.endDate.value.toString(),
|
endDate: state.endDate.value,
|
||||||
cardName: state.cardName.value.toString(),
|
cardName: state.cardName.value.toString(),
|
||||||
cardNumber: state.cardNumber.value.toString(),
|
cardNumber: state.cardNumber.value.toString(),
|
||||||
cardType: state.cardType.value.toString(),
|
cardType: int.parse(state.cardType.value),
|
||||||
addType: state.addType.value.toString(),
|
addType: state.addType.value.toString(),
|
||||||
startDate: state.startDate.value.toString(),
|
startDate: state.startDate.value,
|
||||||
isCoerced: state.isCoerced.value.toString(),
|
isCoerced: state.isCoerced.value.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
|
startTime: int.parse(state.effectiveDateTime.value),
|
||||||
|
endTime: int.parse(state.failureDateTime.value),
|
||||||
|
cardRight: state.isAdministrator.value == "2" ? 1 : 0,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
updateIdCardUserNoLoadData(entity.data!.cardId.toString());
|
updateIdCardUserNoLoadData(entity.data!.cardId.toString());
|
||||||
|
|||||||
@ -17,6 +17,8 @@ class AddICCardState{
|
|||||||
final startDate = "".obs;
|
final startDate = "".obs;
|
||||||
final weekDay = [].obs;
|
final weekDay = [].obs;
|
||||||
final fromType = 0.obs;
|
final fromType = 0.obs;
|
||||||
|
final effectiveDateTime = "".obs;// 生效时间
|
||||||
|
final failureDateTime = "".obs;// 失效时间
|
||||||
|
|
||||||
AddICCardState() {
|
AddICCardState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
@ -33,5 +35,7 @@ class AddICCardState{
|
|||||||
lockId.value = map["lockId"];
|
lockId.value = map["lockId"];
|
||||||
weekDay.value = map["weekDay"];
|
weekDay.value = map["weekDay"];
|
||||||
fromType.value = map["fromType"];
|
fromType.value = map["fromType"];
|
||||||
|
effectiveDateTime.value = map["effectiveTime"];
|
||||||
|
failureDateTime.value = map["failureTime"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,6 +14,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 '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'cardDetail_state.dart';
|
import 'cardDetail_state.dart';
|
||||||
|
|
||||||
@ -62,8 +63,8 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
userID:userID,
|
userID:userID,
|
||||||
cardNo:int.parse(state.typeNumber.value),
|
cardNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:state.effectiveDateTime.value,
|
startTime:int.parse(state.starDate.value),
|
||||||
endTime:state.failureDateTime.value,
|
endTime:int.parse(state.endDate.value),
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -118,8 +119,8 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
userID:userID,
|
userID:userID,
|
||||||
cardNo:int.parse(state.typeNumber.value),
|
cardNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:state.effectiveDateTime.value,
|
startTime:int.parse(state.starDate.value),
|
||||||
endTime:state.failureDateTime.value,
|
endTime:int.parse(state.endDate.value),
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -142,14 +143,14 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
cardId: state.keyId.value.toString(),
|
cardId: state.keyId.value.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: state.effectiveDateTime.value.toString(),
|
startDate: state.starDate.value,
|
||||||
endDate: state.failureDateTime.value.toString(),
|
endDate: state.endDate.value,
|
||||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||||
cardName: state.changeNameController.text,
|
cardName: state.changeNameController.text,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
startTime: 0,
|
startTime: int.parse(state.starTime.value),
|
||||||
endTime: 0,
|
endTime: int.parse(state.endTime.value),
|
||||||
cardType: 0,
|
cardType:state.keyType.value,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: (){
|
||||||
@ -167,11 +168,23 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
deleteType:"1"
|
deleteType:"1"
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("删除成功");
|
showToast("删除成功", something: (){
|
||||||
Get.back(result: "addScuess");
|
Get.back(result: "addScuess");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime(){
|
||||||
|
String useDateStr = '';
|
||||||
|
if(state.keyType.value == 1){
|
||||||
|
useDateStr = "永久";
|
||||||
|
}else if(state.keyType.value == 2){
|
||||||
|
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
|
} else if(state.keyType.value == 4){
|
||||||
|
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
|
}return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
// ),
|
// ),
|
||||||
// ],
|
// ],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: "${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
leftTitel: "${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||||
@ -68,11 +68,10 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||||
rightTitle: state.keyType.value == 1 ? "永久" : "${DateTool().dateToYMDHNString(state.effectiveDateTime.value.toString())}\n${DateTool().dateToYMDHNString(state.failureDateTime.value.toString())}",
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
// 当是指纹的时候
|
|
||||||
if(state.keyType.value == 2 || state.keyType.value == 1){
|
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||||
// 限时
|
// 限时
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
||||||
@ -81,8 +80,8 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
state.starDate.value = data["beginTimeTimestamp"];
|
||||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
state.endDate.value = data["endTimeTimestamp"];
|
||||||
state.keyType.value = 2;
|
state.keyType.value = 2;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -94,9 +93,18 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
print("state.starDate.value:${data["starDate"]} "
|
||||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
"state.endDate.value:${data["endDate"]} "
|
||||||
|
"state.starTime.value:${data["starTime"]} "
|
||||||
|
"state.endTime.value:${data["endTime"]} "
|
||||||
|
"state.weekDay.value:${data["weekDay"]}");
|
||||||
|
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data["weekDay"];
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,6 +115,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
rightTitle: state.weekDay.value.join(','),
|
rightTitle: state.weekDay.value.join(','),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||||
"pushType": 0,
|
"pushType": 0,
|
||||||
@ -114,34 +123,50 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
state.starDate.value = data["starDate"];
|
||||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data["weekDay"];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})))
|
})))),
|
||||||
),
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData": state.fingerprintItemData.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"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||||
rightTitle: state.adder.value,
|
rightTitle: state.adder.value,)),
|
||||||
action: () {
|
|
||||||
|
|
||||||
})),
|
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||||
rightTitle: DateTool().dateToYMDHNString(state.addTime.value.toString()),
|
rightTitle: DateTool().dateToYMDHNString(state.addTime.value.toString()),
|
||||||
action: () {
|
)),
|
||||||
|
|
||||||
})),
|
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isTipsImg: false,
|
isTipsImg: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||||
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
|
|||||||
@ -15,8 +15,10 @@ class CardDetailState{
|
|||||||
|
|
||||||
final typeNumber = "".obs;// 指纹号
|
final typeNumber = "".obs;// 指纹号
|
||||||
final typeName = "".obs;// 指纹名字
|
final typeName = "".obs;// 指纹名字
|
||||||
var effectiveDateTime = 0.obs;// 生效时间
|
var starDate = "".obs;// 开始时间
|
||||||
var failureDateTime = 0.obs;// 失效时间
|
var endDate = "".obs;// 结束时间
|
||||||
|
var starTime = "".obs;// 生效时间
|
||||||
|
var endTime = "".obs;// 失效时间
|
||||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||||
var weekDay = [].obs;// 有效日
|
var weekDay = [].obs;// 有效日
|
||||||
var adder = "".obs;// 添加者
|
var adder = "".obs;// 添加者
|
||||||
@ -32,8 +34,10 @@ class CardDetailState{
|
|||||||
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
||||||
typeName.value = fingerprintItemData.value.cardName!;
|
typeName.value = fingerprintItemData.value.cardName!;
|
||||||
changeNameController.text = typeName.value;
|
changeNameController.text = typeName.value;
|
||||||
effectiveDateTime.value = fingerprintItemData.value.startDate!;
|
starDate.value = fingerprintItemData.value.startDate!.toString();
|
||||||
failureDateTime.value = fingerprintItemData.value.endDate!;
|
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||||
keyType.value = fingerprintItemData.value.cardType!;
|
keyType.value = fingerprintItemData.value.cardType!;
|
||||||
adder.value = fingerprintItemData.value.senderUsername!;
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
addTime.value = fingerprintItemData.value.createDate!;
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'dart:async';
|
|||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_protocol/io_addICCard.dart';
|
import '../../../../blue/io_protocol/io_addICCard.dart';
|
||||||
import '../../../../blue/io_protocol/io_checkingCardStatus.dart';
|
import '../../../../blue/io_protocol/io_checkingCardStatus.dart';
|
||||||
@ -364,6 +365,18 @@ class CardListLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
||||||
|
var keyDateTypeStr = "";// 永久:1;限时2,单次3,循环:4
|
||||||
|
if(fingerprintItemData.cardType! == 1){
|
||||||
|
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久";
|
||||||
|
}else if(fingerprintItemData.cardType! == 2){
|
||||||
|
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
||||||
|
}else if(fingerprintItemData.cardType! == 4){
|
||||||
|
keyDateTypeStr = "循环";
|
||||||
|
}
|
||||||
|
return keyDateTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -145,7 +145,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
'images/icon_card.png',
|
'images/icon_card.png',
|
||||||
fingerprintItemData.cardName!,
|
fingerprintItemData.cardName!,
|
||||||
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
||||||
fingerprintItemData.validTimeStr!, () async {
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.cardDetailPage, arguments: {
|
Routers.cardDetailPage, arguments: {
|
||||||
"fingerprintItemData": fingerprintItemData,
|
"fingerprintItemData": fingerprintItemData,
|
||||||
|
|||||||
@ -30,14 +30,18 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
|
startTime: 0,
|
||||||
|
endTime: 0,
|
||||||
|
fingerprintType: state.fingerprintItemData.value.fingerprintType! == 4 ? 4 : 2,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功");
|
showToast("修改成功", something: (){
|
||||||
Get.back(result: {
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
Get.back(result: {
|
||||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||||
|
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,15 +70,16 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
changeType: '1',
|
changeType: '1',
|
||||||
startTime: 0,
|
startTime: 0,
|
||||||
endTime: 0,
|
endTime: 0,
|
||||||
cardType: 0,
|
cardType: 2,// 2:限时 无论之前是永久还是限时,修改之后都是限时
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功");
|
showToast("修改成功", something: (){
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||||
|
});
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,6 +8,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
import 'otherTypeKeyChangeDate_logic.dart';
|
import 'otherTypeKeyChangeDate_logic.dart';
|
||||||
@ -76,8 +77,8 @@ class _OtherTypeKeyChangeDatePageState
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.beginTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
|
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
@ -89,8 +90,8 @@ class _OtherTypeKeyChangeDatePageState
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.endTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
|
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
|
|||||||
@ -10,17 +10,23 @@ class OtherTypeKeyChangeDateState{
|
|||||||
var endTime = "".obs;// 结束时间
|
var endTime = "".obs;// 结束时间
|
||||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
||||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
||||||
|
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||||
|
|
||||||
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
||||||
|
|
||||||
OtherTypeKeyChangeDateState() {
|
OtherTypeKeyChangeDateState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if(map["pushType"] != null){
|
if(map["pushType"] != null){
|
||||||
fingerprintItemData.value = map["fingerprintItemData"];
|
pushType.value = map["pushType"];
|
||||||
}
|
}
|
||||||
pushType.value = map["pushType"];
|
|
||||||
if(map["fingerprintItemData"] != null){
|
if(map["fingerprintItemData"] != null){
|
||||||
fingerprintItemData.value = map["fingerprintItemData"];
|
fingerprintItemData.value = map["fingerprintItemData"];
|
||||||
|
if(pushType.value == 0) {
|
||||||
|
keyType.value = fingerprintItemData.value.cardType!;
|
||||||
|
}else if(pushType.value == 1){
|
||||||
|
keyType.value = fingerprintItemData.value.fingerprintType!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import 'otherTypeKeyChangeValidityDate_state.dart';
|
import 'otherTypeKeyChangeValidityDate_state.dart';
|
||||||
|
|
||||||
@ -11,48 +12,86 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 修改指纹信息
|
// 修改指纹信息
|
||||||
void editFingerprintsData() async{
|
void editFingerprintsData() async{
|
||||||
|
var starDateTimestamp = DateTool().dateToTimestamp(state.starDate.value, 1);
|
||||||
|
var endDateTimestamp = DateTool().dateToTimestamp(state.endDate.value, 1);
|
||||||
|
var starTimeTimestamp = DateTool().dateToTimestamp(state.starTime.value, 0);
|
||||||
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||||
|
|
||||||
|
if (starDateTimestamp >= endDateTimestamp) {
|
||||||
|
showToast("失效日期要大于生效日期");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (starTimeTimestamp >= endTimeTimestamp) {
|
||||||
|
showToast("失效时间要大于生效时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
var entity = await ApiRepository.to.editFingerprintsData(
|
var entity = await ApiRepository.to.editFingerprintsData(
|
||||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: state.beginTimeTimestamp.value.toString(),
|
startDate: starDateTimestamp.toString(),
|
||||||
endDate: state.endTimeTimestamp.value.toString(),
|
endDate: endDateTimestamp.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
|
startTime: starTimeTimestamp,
|
||||||
|
endTime: endTimeTimestamp,
|
||||||
|
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功");
|
showToast("修改成功", something: (){
|
||||||
Get.back(result: {
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
Get.back(result: {
|
||||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
"starDate":starDateTimestamp.toString(),
|
||||||
"weekDay":state.weekDay.value,
|
"endDate":endDateTimestamp.toString(),
|
||||||
|
"starTime":starTimeTimestamp.toString(),
|
||||||
|
"endTime":endTimeTimestamp.toString(),
|
||||||
|
"validityValue":state.weekDay.value,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑iC卡
|
// 编辑iC卡
|
||||||
void editICCardData() async{
|
void editICCardData() async{
|
||||||
|
var starDateTimestamp = DateTool().dateToTimestamp(state.starDate.value, 1);
|
||||||
|
var endDateTimestamp = DateTool().dateToTimestamp(state.endDate.value, 1);
|
||||||
|
var starTimeTimestamp = DateTool().dateToTimestamp(state.starTime.value, 0);
|
||||||
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||||
|
|
||||||
|
if (starDateTimestamp >= endDateTimestamp) {
|
||||||
|
showToast("失效日期要大于生效日期");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (starTimeTimestamp >= endTimeTimestamp) {
|
||||||
|
showToast("失效时间要大于生效时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
var entity = await ApiRepository.to.editICCardData(
|
var entity = await ApiRepository.to.editICCardData(
|
||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: state.beginTimeTimestamp.value.toString(),
|
startDate: starDateTimestamp.toString(),
|
||||||
endDate: state.endTimeTimestamp.value.toString(),
|
endDate: endDateTimestamp.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||||
cardName: state.fingerprintItemData.value.cardName!,
|
cardName: state.fingerprintItemData.value.cardName!,
|
||||||
changeType: '1',
|
changeType: '1',
|
||||||
startTime: 0,
|
startTime: starTimeTimestamp,
|
||||||
endTime: 0,
|
endTime: endTimeTimestamp,
|
||||||
cardType: 0,
|
cardType: state.fingerprintItemData.value.cardType!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功");
|
showToast("修改成功", something: (){
|
||||||
Get.back(result: {
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
Get.back(result: {
|
||||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
"starDate":starDateTimestamp.toString(),
|
||||||
"weekDay":state.weekDay.value,
|
"endDate":endDateTimestamp.toString(),
|
||||||
|
"starTime":starTimeTimestamp.toString(),
|
||||||
|
"endTime":endTimeTimestamp.toString(),
|
||||||
|
"validityValue":state.weekDay.value,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
// import 'package:flutter_pickers/pickers.dart';
|
|
||||||
// import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
@ -8,6 +6,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -21,8 +20,7 @@ class OtherTypeKeyChangeValidityDatePage extends StatefulWidget {
|
|||||||
_OtherTypeKeyChangeValidityDatePageState();
|
_OtherTypeKeyChangeValidityDatePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _OtherTypeKeyChangeValidityDatePageState
|
class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeValidityDatePage> {
|
||||||
extends State<OtherTypeKeyChangeValidityDatePage> {
|
|
||||||
final logic = Get.put(OtherTypeKeyChangeValidityDateLogic());
|
final logic = Get.put(OtherTypeKeyChangeValidityDateLogic());
|
||||||
final state = Get.find<OtherTypeKeyChangeValidityDateLogic>().state;
|
final state = Get.find<OtherTypeKeyChangeValidityDateLogic>().state;
|
||||||
|
|
||||||
@ -36,12 +34,10 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
|
||||||
height: 10.h,
|
|
||||||
color: AppColors.mainBackgroundColor,
|
|
||||||
),
|
|
||||||
topWidget(),
|
topWidget(),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
|
middleWidget(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
bottomWidget(),
|
bottomWidget(),
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
||||||
@ -60,6 +56,42 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget topWidget() {
|
Widget topWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "生效日期",
|
||||||
|
rightTitle: state.starDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "失效日期",
|
||||||
|
rightTitle: state.endDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget middleWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
height: 160.h,
|
height: 160.h,
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
@ -73,7 +105,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
padding: EdgeInsets.only(left: 30.w, top: 15.h),
|
padding: EdgeInsets.only(left: 30.w, top: 15.h),
|
||||||
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
|
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
|
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
|
||||||
Container(
|
Container(
|
||||||
height: 100.h,
|
height: 100.h,
|
||||||
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
|
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
|
||||||
@ -164,18 +196,14 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
||||||
rightTitle: state.beginTime.value,
|
rightTitle: state.starTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.beginTimeTimestamp.value = DateTime.parse(
|
state.starTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
|
|
||||||
.millisecondsSinceEpoch;
|
|
||||||
state.beginTime.value =
|
|
||||||
"${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
@ -185,14 +213,10 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
rightTitle: state.endTime.value,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.endTimeTimestamp.value = DateTime.parse(
|
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
|
|
||||||
.millisecondsSinceEpoch;
|
|
||||||
state.endTime.value =
|
|
||||||
"${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
|||||||
class OtherTypeKeyChangeValidityDateState{
|
class OtherTypeKeyChangeValidityDateState{
|
||||||
final fingerprintItemData = FingerprintItemData().obs;
|
final fingerprintItemData = FingerprintItemData().obs;
|
||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
var starDate = "".obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
var endDate = "".obs;// 结束时间
|
||||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
var starTime = "".obs;// 生效时间
|
||||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
var endTime = "".obs;// 失效时间
|
||||||
|
|
||||||
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
||||||
var weekDay = [].obs;
|
var weekDay = [].obs;
|
||||||
@ -20,10 +20,10 @@ class OtherTypeKeyChangeValidityDateState{
|
|||||||
pushType.value = map["pushType"];
|
pushType.value = map["pushType"];
|
||||||
fingerprintItemData.value = map["fingerprintItemData"];
|
fingerprintItemData.value = map["fingerprintItemData"];
|
||||||
|
|
||||||
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
starDate.value = DateTool().dateToYMDString(fingerprintItemData.value.startDate.toString());
|
||||||
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
endDate.value = DateTool().dateToYMDString(fingerprintItemData.value.endDate.toString());
|
||||||
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
|
starTime.value = DateTool().dateToHNString(fingerprintItemData.value.startDate.toString());
|
||||||
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
|
endTime.value = DateTool().dateToHNString(fingerprintItemData.value.endDate.toString());
|
||||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,11 +82,11 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
reply.data.removeRange(0, 6);
|
reply.data.removeRange(0, 6);
|
||||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||||
var getList = splitList(reply.data, 8);
|
var getList = splitList(reply.data, 8);
|
||||||
print("getList:$getList");
|
// print("getList:$getList");
|
||||||
var uploadList = [];
|
var uploadList = [];
|
||||||
for (int i = 0; i < getList.length; i++) {
|
for (int i = 0; i < getList.length; i++) {
|
||||||
var indexList = getList[i];
|
var indexList = getList[i];
|
||||||
print("indexList:$indexList");
|
// print("indexList:$indexList");
|
||||||
var indexMap = {};
|
var indexMap = {};
|
||||||
indexMap["seq"] = indexList[0].toString();
|
indexMap["seq"] = indexList[0].toString();
|
||||||
indexMap["user"] = indexList[3].toString();
|
indexMap["user"] = indexList[3].toString();
|
||||||
|
|||||||
@ -1,31 +1,279 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../../blue/io_protocol/io_referEventRecordTime.dart';
|
||||||
|
import '../../../../../blue/io_reply.dart';
|
||||||
|
import '../../../../../blue/io_tool/io_tool.dart';
|
||||||
|
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
|
import '../../../../../blue/sender_manage.dart';
|
||||||
|
import '../../../../../tools/storage.dart';
|
||||||
|
import '../../../lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
||||||
|
|
||||||
class KeyOperationRecordLogic extends BaseGetXController {
|
class KeyOperationRecordLogic extends BaseGetXController {
|
||||||
final KeyOperationRecordState state = KeyOperationRecordState();
|
final KeyOperationRecordState state = KeyOperationRecordState();
|
||||||
|
|
||||||
|
// 获取解析后的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
|
// if(reply is SenderReferEventRecordNumberReply) {
|
||||||
|
// _replyReferEventRecordNumber(reply);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (reply is SenderReferEventRecordTimeReply) {
|
||||||
|
_replyReferEventRecordTime(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据数量查解析数据
|
||||||
|
// Future<void> _replyReferEventRecordNumber(Reply reply) async {
|
||||||
|
// int status = reply.data[2];
|
||||||
|
// switch(status){
|
||||||
|
// case 0x00:
|
||||||
|
// //成功
|
||||||
|
// print("${reply.commandType}数据解析成功");
|
||||||
|
// // _getLockStatus();
|
||||||
|
// break;
|
||||||
|
// case 0x06:
|
||||||
|
// //无权限
|
||||||
|
// print("${reply.commandType}需要鉴权");
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// case 0x07:
|
||||||
|
// //无权限
|
||||||
|
// print("${reply.commandType}用户无权限");
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// case 0x09:
|
||||||
|
// // 权限校验错误
|
||||||
|
// print("${reply.commandType}权限校验错误");
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// //失败
|
||||||
|
// print("${reply.commandType}失败");
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 根据时间查解析数据
|
||||||
|
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType}数据解析成功");
|
||||||
|
if (reply.data[5] > 0) {
|
||||||
|
reply.data.removeRange(0, 6);
|
||||||
|
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||||
|
var getList = splitList(reply.data, 8);
|
||||||
|
print("getList:$getList");
|
||||||
|
var uploadList = [];
|
||||||
|
for (int i = 0; i < getList.length; i++) {
|
||||||
|
var indexList = getList[i];
|
||||||
|
print("indexList:$indexList");
|
||||||
|
var indexMap = {};
|
||||||
|
indexMap["seq"] = indexList[0].toString();
|
||||||
|
indexMap["user"] = indexList[3].toString();
|
||||||
|
indexMap["pwd"] = indexList[2].toString();
|
||||||
|
indexMap["success"] = "1";
|
||||||
|
indexMap["type"] = indexList[1].toString();
|
||||||
|
|
||||||
|
int value = ((0xff & indexList[(4)]) << 24 |
|
||||||
|
(0xff & indexList[5]) << 16 |
|
||||||
|
(0xff & indexList[6]) << 8 |
|
||||||
|
(0xFF & indexList[7]));
|
||||||
|
// indexMap["date"] = DateTool().dateToYMDHNSString("$value");
|
||||||
|
// print("value:${DateTool().dateToYMDHNSString("$value")}");
|
||||||
|
|
||||||
|
indexMap["date"] = "${value * 1000}";
|
||||||
|
uploadList.add(indexMap);
|
||||||
|
}
|
||||||
|
lockRecordUploadData(uploadList);
|
||||||
|
// print("reply.data:${reply.data} getList:$getList}");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType}权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType}失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询事件记录(页数查询)
|
||||||
|
// Future<void> senderReferEventRecordNumber() async {
|
||||||
|
// BlueManage().bludSendData(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||||
|
// if (state == DeviceConnectionState.connected) {
|
||||||
|
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
//
|
||||||
|
// var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
//
|
||||||
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||||
|
//
|
||||||
|
// IoSenderManage.senderReferEventRecordNumberCommand(
|
||||||
|
// keyID:BlueManage().connectDeviceName,
|
||||||
|
// userID:await Storage.getUid(),
|
||||||
|
// logsCount:20,
|
||||||
|
// logsNo:1,
|
||||||
|
// token:getTokenList,
|
||||||
|
// needAuthor:1,
|
||||||
|
// publicKey:getPublicKeyList,
|
||||||
|
// privateKey:getPrivateKeyList,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 查询事件记录(时间查询)
|
||||||
|
Future<void> senderReferEventRecordTime(int time) async {
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState state) async {
|
||||||
|
if (state == BluetoothConnectionState.connected) {
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
EasyLoading.show();
|
||||||
|
IoSenderManage.senderReferEventRecordTimeCommand(
|
||||||
|
keyID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
logsCount: 20,
|
||||||
|
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||||||
|
time: time,
|
||||||
|
token: getTokenList,
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: getPublicKeyList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//请求操作记录列表
|
//请求操作记录列表
|
||||||
Future<void> mockNetworkDataRequest() async {
|
Future<void> mockNetworkDataRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
||||||
'0',
|
endDate:'0',
|
||||||
state.keyId.value,
|
keyId:state.keyId.value,
|
||||||
'0',
|
keyStatus:'0',
|
||||||
state.lockId.value,
|
lockId:state.lockId.value,
|
||||||
'1',
|
operatorUid:'1',
|
||||||
'1',
|
pageNo:'1',
|
||||||
'20',
|
pageSize:'20',
|
||||||
'0',
|
startDate:'0',
|
||||||
'',
|
recordType:'',
|
||||||
'',
|
searchStr:'',
|
||||||
'',
|
timezoneRawOffSet:'',
|
||||||
state.keyboardPwdId.value,
|
keyboardPwdId:state.keyboardPwdId.value,
|
||||||
state.cardId.value,
|
cardId:state.cardId.value,
|
||||||
state.fingerprintId.value);
|
fingerprintId:state.fingerprintId.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("操作记录列表成功:${entity.data?.itemList}");
|
print("操作记录列表成功:${entity.data?.itemList}");
|
||||||
state.dataList.value = entity.data!.itemList!;
|
state.dataList.value = entity.data!.itemList!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询锁记录最后时间
|
||||||
|
void getLockRecordLastUploadDataTime() async {
|
||||||
|
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
||||||
|
.getLockRecordLastUploadDataTime(
|
||||||
|
lockId: state.lockId.value.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
senderReferEventRecordTime(entity.data!.operateDate! ~/ 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 操作记录上传
|
||||||
|
void lockRecordUploadData(List list) async {
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
|
.lockRecordUploadData(
|
||||||
|
lockId: state.lockId.value.toString(), records: list);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//清空操作记录
|
||||||
|
void clearOperationRecordRequest() async {
|
||||||
|
KeyOperationRecordEntity entity =
|
||||||
|
await ApiRepository.to.clearOperationRecord('28');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("清除数据成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onReady() async {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
print("onReady()");
|
||||||
|
|
||||||
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
_initReplySubscription();
|
||||||
|
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onInit() async {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
print("onInit()");
|
||||||
|
|
||||||
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
getLockRecordLastUploadDataTime();
|
||||||
|
// senderReferEventRecordTime();
|
||||||
|
// senderReferEventRecordNumber();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onClose() async {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,9 +42,10 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
|||||||
.resetElectronicKey(state.keyInfo.value.lockId.toString(), '0');
|
.resetElectronicKey(state.keyInfo.value.lockId.toString(), '0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("重置电子钥匙成功啦啦啦啦啦");
|
print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
showToast("重置成功");
|
showToast("重置成功", something: (){
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,9 +55,10 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
|||||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
await ApiRepository.to.deleteElectronicKey(keyId);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("删除电子钥匙成功");
|
print("删除电子钥匙成功");
|
||||||
showToast("删除成功");
|
showToast("删除成功",something: (){
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,10 +21,10 @@ class ElectronicKeyPeriodValidityPage extends StatefulWidget {
|
|||||||
_ElectronicKeyPeriodValidityPageState();
|
_ElectronicKeyPeriodValidityPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ElectronicKeyPeriodValidityPageState
|
class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodValidityPage> {
|
||||||
extends State<ElectronicKeyPeriodValidityPage> {
|
|
||||||
final logic = Get.put(ElectronicKeyPeriodValidityLogic());
|
final logic = Get.put(ElectronicKeyPeriodValidityLogic());
|
||||||
final state = Get.find<ElectronicKeyPeriodValidityLogic>().state;
|
final state = Get.find<ElectronicKeyPeriodValidityLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -36,8 +36,7 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
} else {
|
} else {
|
||||||
validityValue = i;
|
validityValue = i;
|
||||||
}
|
}
|
||||||
KeyPeriodValidityModel model = KeyPeriodValidityModel(
|
KeyPeriodValidityModel model = KeyPeriodValidityModel(state.validityTextList.value[i], i, false, validityValue);
|
||||||
state.validityTextList.value[i], i, false, validityValue);
|
|
||||||
state.validityDataList.value.add(model);
|
state.validityDataList.value.add(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,6 +193,14 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
'${p.hour!}:${p.minute!}', 'HH:mm');
|
'${p.hour!}:${p.minute!}', 'HH:mm');
|
||||||
state.selectEffectiveTime.value = XSDateUtils.formatDateTime(
|
state.selectEffectiveTime.value = XSDateUtils.formatDateTime(
|
||||||
state.effectiveTime.value, 'HH:mm');
|
state.effectiveTime.value, 'HH:mm');
|
||||||
|
Get.log("p.year:${p.year} p.month:${p.month} p.day:${p.day} state.effectiveTime.value:${state.effectiveTime.value} state.selectEffectiveTime.value:${state.selectEffectiveTime.value}");
|
||||||
|
|
||||||
|
String time = '${p.hour!}:${p.minute!}';// 你的时分字符串
|
||||||
|
List<String> timeParts = time.split(":");
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
DateTime dateTime = DateTime(now.year, now.month, now.day, int.parse(timeParts[0]), int.parse(timeParts[1]));
|
||||||
|
int timestamp = dateTime.millisecondsSinceEpoch;
|
||||||
|
Get.log("timestamptimestamptimestamp:$timestamp");
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
|
|||||||
@ -341,6 +341,8 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 添加指纹
|
// 添加指纹
|
||||||
void addFingerprintsData() async{
|
void addFingerprintsData() async{
|
||||||
|
Get.log("effectiveDateTime:${state.effectiveDateTime.value} failureDateTime:${state.failureDateTime.value}");
|
||||||
|
|
||||||
var entity = await ApiRepository.to.addFingerprintsData(
|
var entity = await ApiRepository.to.addFingerprintsData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
endDate: state.endDate.value,
|
endDate: state.endDate.value,
|
||||||
@ -351,6 +353,9 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
isCoerced: state.isCoerced.value,
|
isCoerced: state.isCoerced.value,
|
||||||
startDate: state.startDate.value,
|
startDate: state.startDate.value,
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
|
fingerRight:state.isAdministrator.value == "2" ? 1 : 0,
|
||||||
|
startTime: int.parse(state.effectiveDateTime.value),
|
||||||
|
endTime: int.parse(state.failureDateTime.value),
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
// Toast.show(msg: "添加成功");
|
// Toast.show(msg: "添加成功");
|
||||||
|
|||||||
@ -21,6 +21,8 @@ class AddFingerprintState{
|
|||||||
final startDate = "".obs;
|
final startDate = "".obs;
|
||||||
final weekDay = [].obs;
|
final weekDay = [].obs;
|
||||||
final fromType = 1.obs;
|
final fromType = 1.obs;
|
||||||
|
final effectiveDateTime = "".obs;// 生效时间
|
||||||
|
final failureDateTime = "".obs;// 失效时间
|
||||||
|
|
||||||
AddFingerprintState() {
|
AddFingerprintState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
@ -38,5 +40,7 @@ class AddFingerprintState{
|
|||||||
lockId.value = map["lockId"];
|
lockId.value = map["lockId"];
|
||||||
weekDay.value = map["weekDay"];
|
weekDay.value = map["weekDay"];
|
||||||
fromType.value = map["fromType"];
|
fromType.value = map["fromType"];
|
||||||
|
effectiveDateTime.value = map["effectiveTime"];
|
||||||
|
failureDateTime.value = map["failureTime"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import 'addFingerprintType_state.dart';
|
import 'addFingerprintType_state.dart';
|
||||||
|
|
||||||
class AddFingerprintTypeLogic extends BaseGetXController{
|
class AddFingerprintTypeLogic extends BaseGetXController{
|
||||||
@ -13,17 +14,26 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
|||||||
var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4
|
var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4
|
||||||
var startDate = "";
|
var startDate = "";
|
||||||
var endDate = "";
|
var endDate = "";
|
||||||
|
var startTime = "";
|
||||||
|
var endTime = "";
|
||||||
if (state.selectType.value == "0") {
|
if (state.selectType.value == "0") {
|
||||||
fingerprintType = 1;
|
fingerprintType = 1;
|
||||||
startDate = "0";
|
startDate = "0";
|
||||||
endDate = "0";
|
endDate = "0";
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
} else if (state.selectType.value == "1") {
|
} else if (state.selectType.value == "1") {
|
||||||
fingerprintType = 2;
|
fingerprintType = 2;
|
||||||
if (state.beginTimeTimestamp.value.isEmpty) {
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
showToast("请选择开始时间");
|
showToast("请选择开始时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.endTimeTimestamp.value.isEmpty) {
|
if (endDate.isEmpty) {
|
||||||
showToast("请选择结束时间");
|
showToast("请选择结束时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -33,45 +43,25 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (int.parse(state.beginTimeTimestamp.value) >=
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
int.parse(state.endTimeTimestamp.value)) {
|
|
||||||
showToast("失效时间要大于生效时间");
|
showToast("失效时间要大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
startDate = state.beginTimeTimestamp.value;
|
|
||||||
endDate = state.endTimeTimestamp.value;
|
|
||||||
} else if (state.selectType.value == "2") {
|
} else if (state.selectType.value == "2") {
|
||||||
if (state.effectiveDateTime.value <= 0) {
|
if (state.beginTime.value.isEmpty) {
|
||||||
showToast("请选择生效时间");
|
showToast("请选择有效期");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.failureDateTime.value <= 0) {
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
showToast("请选择失效时间");
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
return;
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
}
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
|
|
||||||
if (state.weekdaysList.value.isEmpty) {
|
|
||||||
showToast("请选择有效日");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(DateTime.now().millisecondsSinceEpoch >= state.effectiveDateTime.value){
|
|
||||||
// Toast.show(msg: "生效时间要大于当前时间");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (state.effectiveDateTime.value >= state.failureDateTime.value) {
|
|
||||||
showToast("失效时间要大于生效时间");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startDate = state.effectiveDateTime.value.toString();
|
|
||||||
endDate = state.failureDateTime.value.toString();
|
|
||||||
fingerprintType = 4;
|
fingerprintType = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫指纹 2:胁迫指纹
|
var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫指纹 2:胁迫指纹
|
||||||
print("addOtherType startDate:$startDate endDate:$endDate isCoerced:$isCoerced");
|
print("addOtherType startDate:$startDate endDate:$endDate isCoerced:$isCoerced");
|
||||||
|
|
||||||
// 指纹
|
// 指纹
|
||||||
Get.toNamed(Routers.addFingerprintPage, arguments: {
|
Get.toNamed(Routers.addFingerprintPage, arguments: {
|
||||||
"lockId": state.lockId.value,
|
"lockId": state.lockId.value,
|
||||||
@ -85,6 +75,8 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
|||||||
"weekDay": state.weekdaysList.value,
|
"weekDay": state.weekdaysList.value,
|
||||||
"fromType": state.fromType.value,
|
"fromType": state.fromType.value,
|
||||||
"isAdministrator": state.isAdministrator.value == false ? "1" : "2", // 1:不是管理员 2:是管理员
|
"isAdministrator": state.isAdministrator.value == false ? "1" : "2", // 1:不是管理员 2:是管理员
|
||||||
|
"effectiveTime": startTime,
|
||||||
|
"failureTime": endTime,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -91,21 +92,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
state.nameController),
|
state.nameController),
|
||||||
CommonItem(
|
keyCyclicDate(),
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () async {
|
|
||||||
Map result = await Get.toNamed(
|
|
||||||
Routers.electronicKeyPeriodValidityPage);
|
|
||||||
state.weekdaysList.value = result['validityValue'];
|
|
||||||
state.effectiveDateTime.value =
|
|
||||||
result['starDate'].millisecondsSinceEpoch;
|
|
||||||
state.failureDateTime.value =
|
|
||||||
result['endDate'].millisecondsSinceEpoch;
|
|
||||||
print(
|
|
||||||
'得到的有效期数据:${state.weekdaysList.value} == ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
|
||||||
}),
|
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
keyBottomWidget()
|
keyBottomWidget()
|
||||||
],
|
],
|
||||||
@ -141,11 +128,8 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
onConfirm: (p) {
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.beginTime.value =
|
|
||||||
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
|
||||||
state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch.toString();
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -153,10 +137,8 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
rightTitle: state.endTime.value,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
onConfirm: (p) {
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.endTime.value = '${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
|
||||||
state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch.toString();
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -164,6 +146,66 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 循环顶部选择日期
|
||||||
|
Widget keyCyclicDate(){
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日",
|
||||||
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.back(result: result);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -11,11 +11,8 @@ class AddFingerprintState{
|
|||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
var beginTime = "".obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
var endTime = "".obs;// 结束时间
|
||||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
var failureDateTime = "".obs;// 失效时间
|
||||||
|
|
||||||
var effectiveDateTime = 0.obs;// 生效时间
|
|
||||||
var failureDateTime = 0.obs;// 失效时间
|
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
|
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
|
|||||||
@ -13,6 +13,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 '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'fingerprintDetail_state.dart';
|
import 'fingerprintDetail_state.dart';
|
||||||
|
|
||||||
@ -63,8 +64,8 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
userID:userID,
|
userID:userID,
|
||||||
fingerNo:int.parse(state.typeNumber.value),
|
fingerNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:state.effectiveDateTime.value,
|
startTime:int.parse(state.starDate.value),
|
||||||
endTime:state.failureDateTime.value,
|
endTime:int.parse(state.endDate.value),
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -119,8 +120,8 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
userID:userID,
|
userID:userID,
|
||||||
fingerNo:int.parse(state.typeNumber.value),
|
fingerNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:state.effectiveDateTime.value,
|
startTime:int.parse(state.starDate.value),
|
||||||
endTime:state.failureDateTime.value,
|
endTime:int.parse(state.endDate.value),
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -155,14 +156,17 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
// 编辑指纹
|
// 编辑指纹
|
||||||
void editFingerprintsData() async{
|
void editFingerprintsData() async{
|
||||||
var entity = await ApiRepository.to.editFingerprintsData(
|
var entity = await ApiRepository.to.editFingerprintsData(
|
||||||
fingerprintId: state.keyId.value.toString(),
|
fingerprintId: state.keyId.value.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: state.effectiveDateTime.value.toString(),
|
startDate: state.starDate.value,
|
||||||
endDate: state.failureDateTime.value.toString(),
|
endDate: state.endDate.value,
|
||||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||||
fingerprintName: state.changeNameController.text,
|
fingerprintName: state.changeNameController.text,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
|
startTime: int.parse(state.starTime.value),
|
||||||
|
endTime: int.parse(state.endTime.value),
|
||||||
|
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功",something: (){
|
showToast("修改成功",something: (){
|
||||||
@ -171,6 +175,17 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime(){
|
||||||
|
String useDateStr = '';
|
||||||
|
if(state.keyType.value == 1){
|
||||||
|
useDateStr = "永久";
|
||||||
|
}else if(state.keyType.value == 2){
|
||||||
|
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
|
} else if(state.keyType.value == 4){
|
||||||
|
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
|
}return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -37,14 +37,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
|||||||
barTitle: "指纹详情",
|
barTitle: "指纹详情",
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
// actionsList: [
|
|
||||||
// TextButton(
|
|
||||||
// child: Text(TranslationLoader.lanKeys!.share!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),),
|
|
||||||
// onPressed: () {
|
|
||||||
//
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
@ -62,32 +54,26 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
|||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context);
|
||||||
})),
|
})),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: (state.keyType.value == 4 || state.keyType.value == 2) ? true : false,
|
visible: (state.keyType.value == 4 || state.keyType.value == 2 || state.keyType.value == 1) ? true : false,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||||
rightTitle: state.keyType.value == 1 ? "永久" : "${DateTool().dateToYMDHNString(state.effectiveDateTime.value.toString())}\n${DateTool().dateToYMDHNString(state.failureDateTime.value.toString())}",
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
// switch(state.type.value){
|
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||||
// case 0:
|
|
||||||
// // 卡
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// 当是指纹的时候
|
|
||||||
if(state.keyType.value == 2){
|
|
||||||
// 限时
|
// 限时
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
||||||
"fingerprintItemData": state.fingerprintItemData.value,
|
|
||||||
"pushType": 1,
|
"pushType": 1,
|
||||||
|
"fingerprintItemData": state.fingerprintItemData.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
state.starDate.value = data["beginTimeTimestamp"];
|
||||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
state.endDate.value = data["endTimeTimestamp"];
|
||||||
|
state.keyType.value = 2;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else if(state.keyType.value == 4){
|
}else if(state.keyType.value == 4){
|
||||||
@ -98,13 +84,21 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
|||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
print("state.starDate.value:${data["starDate"]} "
|
||||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
"state.endDate.value:${data["endDate"]} "
|
||||||
|
"state.starTime.value:${data["starTime"]} "
|
||||||
|
"state.endTime.value:${data["endTime"]} "
|
||||||
|
"state.weekDay.value:${data["weekDay"]}");
|
||||||
|
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data["weekDay"];
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}))),
|
}))),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.keyType.value == 4 ? true : false,
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
@ -112,21 +106,43 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
|||||||
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
rightTitle: state.weekDay.value.join(','),
|
rightTitle: state.weekDay.value.join(','),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
// 当是指纹的时候
|
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||||
"pushType": 1,
|
"pushType": 1,
|
||||||
"fingerprintItemData": state.fingerprintItemData.value,
|
"fingerprintItemData": state.fingerprintItemData.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
state.starDate.value = data["starDate"];
|
||||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data["weekDay"];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})))
|
})))),
|
||||||
),
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||||
|
"pushType": 1,
|
||||||
|
"fingerprintItemData": state.fingerprintItemData.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"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||||
@ -193,96 +209,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget addControlsBtn(int type) {
|
|
||||||
// List<Widget> widgetList = [];
|
|
||||||
// List<Map<String, dynamic>> routerList = [];
|
|
||||||
// //卡详情
|
|
||||||
// if (type == 0) {
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置密码',
|
|
||||||
// 'routerName': Routers.passwordKeyDetailPage,
|
|
||||||
// 'type': 9
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置指纹',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 1
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置遥控',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 2
|
|
||||||
// });
|
|
||||||
// } else if (type == 1) {
|
|
||||||
// //指纹详情
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置密码',
|
|
||||||
// 'routerName': Routers.passwordKeyDetailPage,
|
|
||||||
// 'type': 9
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置卡',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 0
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置遥控',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 2
|
|
||||||
// });
|
|
||||||
// } else if (type == 2) {
|
|
||||||
// //遥控详情
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置密码',
|
|
||||||
// 'routerName': Routers.passwordKeyDetailPage,
|
|
||||||
// 'type': 9
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置卡',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 0
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置指纹',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 1
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < routerList.length; i++) {
|
|
||||||
// widgetList.add(SizedBox(
|
|
||||||
// width: ScreenUtil().screenWidth - 40.w,
|
|
||||||
// height: 60.h,
|
|
||||||
// child: OutlinedButton(
|
|
||||||
// style: OutlinedButton.styleFrom(
|
|
||||||
// // backgroundColor: Colors.white,
|
|
||||||
// side: BorderSide(width: 1, color: AppColors.mainColor)),
|
|
||||||
// onPressed: () {
|
|
||||||
// if (routerList[i]['type'] == 9) {
|
|
||||||
// Navigator.pushNamed(context, Routers.passwordKeyManagePage);
|
|
||||||
// } else {
|
|
||||||
// Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
|
||||||
// arguments: routerList[i]['type']);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// routerList[i]['btnTitle'],
|
|
||||||
// style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
|
||||||
// )),
|
|
||||||
// ));
|
|
||||||
//
|
|
||||||
// widgetList.add(
|
|
||||||
// SizedBox(
|
|
||||||
// height: 10.h,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return Column(
|
|
||||||
// children: widgetList,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -11,8 +11,10 @@ class FingerprintDetailState{
|
|||||||
|
|
||||||
final typeNumber = "".obs;// 指纹号
|
final typeNumber = "".obs;// 指纹号
|
||||||
final typeName = "".obs;// 指纹名字
|
final typeName = "".obs;// 指纹名字
|
||||||
var effectiveDateTime = 0.obs;// 生效时间
|
var starDate = "".obs;// 开始时间
|
||||||
var failureDateTime = 0.obs;// 失效时间
|
var endDate = "".obs;// 结束时间
|
||||||
|
var starTime = "".obs;// 生效时间
|
||||||
|
var endTime = "".obs;// 失效时间
|
||||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||||
var weekDay = [].obs;// 有效日
|
var weekDay = [].obs;// 有效日
|
||||||
var adder = "".obs;// 添加者
|
var adder = "".obs;// 添加者
|
||||||
@ -31,8 +33,10 @@ class FingerprintDetailState{
|
|||||||
typeNumber.value = fingerprintItemData.value.fingerprintNumber!;
|
typeNumber.value = fingerprintItemData.value.fingerprintNumber!;
|
||||||
typeName.value = fingerprintItemData.value.fingerprintName!;
|
typeName.value = fingerprintItemData.value.fingerprintName!;
|
||||||
changeNameController.text = typeName.value;
|
changeNameController.text = typeName.value;
|
||||||
effectiveDateTime.value = fingerprintItemData.value.startDate!;
|
starDate.value = fingerprintItemData.value.startDate!.toString();
|
||||||
failureDateTime.value = fingerprintItemData.value.endDate!;
|
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||||
keyType.value = fingerprintItemData.value.fingerprintType!;
|
keyType.value = fingerprintItemData.value.fingerprintType!;
|
||||||
adder.value = fingerprintItemData.value.senderUsername!;
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
addTime.value = fingerprintItemData.value.createDate!;
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
|
|||||||
@ -14,6 +14,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 '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'fingerprintListData_entity.dart';
|
import 'fingerprintListData_entity.dart';
|
||||||
@ -397,6 +398,18 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
||||||
|
var keyDateTypeStr = "";// 永久:1;限时2,单次3,循环:4
|
||||||
|
if(fingerprintItemData.fingerprintType! == 1){
|
||||||
|
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久";
|
||||||
|
}else if(fingerprintItemData.fingerprintType! == 2){
|
||||||
|
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
||||||
|
}else if(fingerprintItemData.fingerprintType! == 4){
|
||||||
|
keyDateTypeStr = "循环";
|
||||||
|
}
|
||||||
|
return keyDateTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -148,7 +148,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
'images/icon_fingerprint.png',
|
'images/icon_fingerprint.png',
|
||||||
fingerprintItemData.fingerprintName!,
|
fingerprintItemData.fingerprintName!,
|
||||||
(fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
(fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
||||||
fingerprintItemData.validTimeStr!,
|
logic.getKeyDateType(fingerprintItemData),
|
||||||
// fingerprintItemData.fingerprintType! == 1
|
// fingerprintItemData.fingerprintType! == 1
|
||||||
// ? "永久"
|
// ? "永久"
|
||||||
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
|
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
void initReplySubscription() {
|
void initReplySubscription() {
|
||||||
state.replySubscription =
|
state.replySubscription =
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
|
// Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
|
||||||
// 开门
|
// 开门
|
||||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||||
_replyOpenLock(reply);
|
_replyOpenLock(reply);
|
||||||
|
|||||||
@ -142,15 +142,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Visibility(
|
Visibility(
|
||||||
visible:
|
visible:
|
||||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
state.keyInfos.value.keyType ==
|
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 0到30天
|
||||||
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
|
||||||
(DateTool().compareTimeGetDaysFromNow(
|
|
||||||
state.keyInfos.value.endDate!) <
|
|
||||||
30 &&
|
|
||||||
DateTool().compareTimeGetDaysFromNow(
|
|
||||||
state.keyInfos.value.endDate!) >
|
|
||||||
0) && // 0到30天
|
|
||||||
(state.keyInfos.value.keyStatus ==
|
(state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusNormalUse ||
|
XSConstantMacro.keyStatusNormalUse ||
|
||||||
state.keyInfos.value.keyStatus ==
|
state.keyInfos.value.keyStatus ==
|
||||||
@ -250,7 +243,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// logic.getStarLockStatus();
|
// logic.getStarLockStatus();
|
||||||
showDeletAlertDialog(
|
showDeletAlertDialog(
|
||||||
context,
|
context,
|
||||||
DateTool().dateToYMDHNSString(state
|
DateTool().dateToYMDHNString(state
|
||||||
.keyInfos.value.electricQuantityDate!
|
.keyInfos.value.electricQuantityDate!
|
||||||
.toString()));
|
.toString()));
|
||||||
},
|
},
|
||||||
|
|||||||
@ -187,20 +187,20 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
|||||||
//请求操作记录列表
|
//请求操作记录列表
|
||||||
void mockNetworkDataRequest() async {
|
void mockNetworkDataRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
||||||
'',
|
endDate:'',
|
||||||
"",
|
keyId:"",
|
||||||
'0',
|
keyStatus:'0',
|
||||||
state.keyInfos.value.lockId.toString(),
|
lockId:state.keyInfos.value.lockId.toString(),
|
||||||
'1',
|
operatorUid:'1',
|
||||||
'1',
|
pageNo:'1',
|
||||||
'20',
|
pageSize:'20',
|
||||||
'',
|
startDate:'',
|
||||||
'',
|
recordType:'',
|
||||||
'',
|
searchStr:'',
|
||||||
'',
|
timezoneRawOffSet:'',
|
||||||
'',
|
keyboardPwdId:'',
|
||||||
'',
|
cardId:'',
|
||||||
'');
|
fingerprintId:'');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("操作记录列表成功:${entity.data?.itemList}");
|
print("操作记录列表成功:${entity.data?.itemList}");
|
||||||
state.lockOperatingRecordListData.value = entity.data!.itemList!;
|
state.lockOperatingRecordListData.value = entity.data!.itemList!;
|
||||||
|
|||||||
@ -40,23 +40,23 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockNumber!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lockNumber!.tr,
|
||||||
rightTitle: state.lockBasicInfo.value.lockName,
|
rightTitle: state.lockBasicInfo.value.lockName ?? "",
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
isHaveLine: true),
|
isHaveLine: true)),
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: "MAC/ID",
|
leftTitel: "MAC/ID",
|
||||||
rightTitle:
|
rightTitle:
|
||||||
"${state.lockBasicInfo.value.mac}/${state.lockBasicInfo.value.lockId}",
|
"${state.lockBasicInfo.value.mac??""}/${state.lockBasicInfo.value.lockId??""}",
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
isHaveLine: false),
|
isHaveLine: false)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.electricQuantity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.electricQuantity!.tr,
|
||||||
rightTitle: "${state.lockBasicInfo.value.electricQuantity}%",
|
rightTitle: "${state.lockBasicInfo.value.electricQuantity??0}%",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -64,40 +64,40 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
'lockSetInfoData': state.lockSetInfoData.value
|
'lockSetInfoData': state.lockSetInfoData.value
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle: logic.getUseKeyTypeStr(
|
rightTitle: logic.getUseKeyTypeStr(
|
||||||
state.lockBasicInfo.value.startDate,
|
state.lockBasicInfo.value.startDate,
|
||||||
state.lockBasicInfo.value.endDate,
|
state.lockBasicInfo.value.endDate,
|
||||||
state.lockBasicInfo.value.keyType),
|
state.lockBasicInfo.value.keyType),
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
isHaveLine: false),
|
isHaveLine: false)),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Visibility(
|
Obx(() => Visibility(
|
||||||
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
|
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
|
||||||
state.lockBasicInfo.value.keyRight == 1)
|
state.lockBasicInfo.value.keyRight == 1)
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
|
||||||
rightTitle: state.lockBasicInfo.value.lockAlias,
|
rightTitle: state.lockBasicInfo.value.lockAlias,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var data = await Get.toNamed(Routers.editLockNamePage,
|
var data = await Get.toNamed(Routers.editLockNamePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
'lockSetInfoData': state.lockSetInfoData.value
|
'lockSetInfoData': state.lockSetInfoData.value
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.lockBasicInfo.value = data["lockBasicInfo"];
|
state.lockBasicInfo.value = data["lockBasicInfo"];
|
||||||
print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}");
|
print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})),
|
}))),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
||||||
rightTitle: state.lockBasicInfo.value.groupName,
|
rightTitle: state.lockBasicInfo.value.groupName ?? "",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
@ -111,15 +111,15 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.lockBasicInfo.value.isLockOwner == 1
|
visible: state.lockBasicInfo.value.isLockOwner == 1
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
||||||
rightTitle:
|
rightTitle:
|
||||||
state.lockSetInfoData.value!.lockBasicInfo!.adminPwd,
|
state.lockBasicInfo!.value.adminPwd,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -127,7 +127,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
'lockSetInfoData': state.lockSetInfoData.value
|
'lockSetInfoData': state.lockSetInfoData.value
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
),
|
)),
|
||||||
/* 2024-01-12 会议确定去掉“微信二维码” by DaisyWu
|
/* 2024-01-12 会议确定去掉“微信二维码” by DaisyWu
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
|
|||||||
@ -13,7 +13,9 @@ class BasicInformationState {
|
|||||||
var map = Get.arguments;
|
var map = Get.arguments;
|
||||||
if(map["lockSetInfoData"] != null){
|
if(map["lockSetInfoData"] != null){
|
||||||
lockSetInfoData.value = map["lockSetInfoData"];
|
lockSetInfoData.value = map["lockSetInfoData"];
|
||||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
if(lockSetInfoData.value.lockBasicInfo!=null){
|
||||||
|
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,11 @@ class LockSelectGroupingState {
|
|||||||
|
|
||||||
LockSelectGroupingState() {
|
LockSelectGroupingState() {
|
||||||
var map = Get.arguments;
|
var map = Get.arguments;
|
||||||
lockSetInfoData.value = map["lockSetInfoData"];
|
if(map["lockSetInfoData"] != null){
|
||||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
lockSetInfoData.value = map["lockSetInfoData"];
|
||||||
|
if(lockSetInfoData.value.lockBasicInfo!=null){
|
||||||
|
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
"电池1${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockSetInfoData.value.lockBasicInfo!.electricQuantity}%",
|
"电池1${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockBasicInfo!.value.electricQuantity ?? ""}%",
|
||||||
style: TextStyle(fontSize: 20.sp),
|
style: TextStyle(fontSize: 20.sp),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import '../../lockSet/lockSetInfo_entity.dart';
|
|||||||
|
|
||||||
class UploadElectricQuantityState {
|
class UploadElectricQuantityState {
|
||||||
var lockSetInfoData = LockSetInfoData().obs;
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
var lockBasicInfo = LockBasicInfo().obs;
|
||||||
var uploadElectricQuantityDate = 0.obs;
|
var uploadElectricQuantityDate = 0.obs;
|
||||||
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
@ -12,8 +13,13 @@ class UploadElectricQuantityState {
|
|||||||
|
|
||||||
UploadElectricQuantityState() {
|
UploadElectricQuantityState() {
|
||||||
var map = Get.arguments;
|
var map = Get.arguments;
|
||||||
lockSetInfoData.value = map["lockSetInfoData"];
|
if(map["lockSetInfoData"]!=null){
|
||||||
uploadElectricQuantityDate.value = lockSetInfoData.value.lockBasicInfo!.electricQuantityDate!;
|
lockSetInfoData.value = map["lockSetInfoData"];
|
||||||
|
if(lockSetInfoData.value.lockBasicInfo!=null){
|
||||||
|
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||||
|
uploadElectricQuantityDate.value = lockSetInfoData.value.lockBasicInfo!.electricQuantityDate!;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
(0xff & indate[1]) << 16 |
|
(0xff & indate[1]) << 16 |
|
||||||
(0xff & indate[2]) << 8 |
|
(0xff & indate[2]) << 8 |
|
||||||
(0xFF & indate[3]));
|
(0xFF & indate[3]));
|
||||||
state.dateTime.value = DateTool().dateToYMDHNSString("$indateValue");
|
state.dateTime.value = DateTool().dateToYMDHNString("$indateValue");
|
||||||
// state.dateTime = indateValue * 1000;
|
// state.dateTime = indateValue * 1000;
|
||||||
print("indate:$indate indateValue:$indateValue");
|
print("indate:$indate indateValue:$indateValue");
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
// String dataEime = DateTool().dateToYMDHNSString("$value");
|
// String dataEime = DateTool().dateToYMDHNSString("$value");
|
||||||
// state.dateTime.value = dataEime;
|
// state.dateTime.value = dataEime;
|
||||||
|
|
||||||
String dataEime = DateTool().dateToYMDHNSString("${state.dateTimestamp.value}");
|
String dataEime = DateTool().dateToYMDHNString("${state.dateTimestamp.value}");
|
||||||
state.dateTime.value = dataEime;
|
state.dateTime.value = dataEime;
|
||||||
|
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
1);
|
1);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功", something: (){
|
showToast("删除成功", something: (){
|
||||||
Get.back();
|
Get.back(result: "deletScuess");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
||||||
|
|||||||
@ -39,10 +39,11 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
PasswordKeyListEntity entity = await ApiRepository.to
|
PasswordKeyListEntity entity = await ApiRepository.to
|
||||||
.keyboardPwdReset(state.keyInfo.value.lockId.toString());
|
.keyboardPwdReset(state.keyInfo.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("重置电子钥匙成功啦啦啦啦啦");
|
// print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
showToast("重置成功");
|
showToast("重置成功", something: (){
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +53,10 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
PasswordKeyEntity entity = await ApiRepository.to
|
PasswordKeyEntity entity = await ApiRepository.to
|
||||||
.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
|
.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功");
|
showToast("删除成功", something: (){
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||||
arguments: {"itemData": passwordKeyListItem}).then((val) {
|
arguments: {"itemData": passwordKeyListItem}).then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
logic.mockNetworkDataRequest();
|
logic.pageNo = 1;
|
||||||
|
getHttpData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -194,7 +194,7 @@ class _LockListPageState extends State<LockListPage> {
|
|||||||
)),
|
)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) < 30 && DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) > 0)) ? true : false,
|
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) >= 0)) ? true : false,
|
||||||
// visible: true,
|
// visible: true,
|
||||||
child:Row(
|
child:Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -220,20 +220,22 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||||
|
|
||||||
Future<Response> lockRecordList(
|
Future<Response> lockRecordList(
|
||||||
String endDate,
|
{
|
||||||
String keyId,
|
required String endDate,
|
||||||
String keyStatus,
|
required String keyId,
|
||||||
String lockId,
|
required String keyStatus,
|
||||||
String operatorUid,
|
required String lockId,
|
||||||
String pageNo,
|
required String operatorUid,
|
||||||
String pageSize,
|
required String pageNo,
|
||||||
String startDate,
|
required String pageSize,
|
||||||
String recordType,
|
required String startDate,
|
||||||
String searchStr,
|
required String recordType,
|
||||||
String timezoneRawOffSet,
|
required String searchStr,
|
||||||
String keyboardPwdId,
|
required String timezoneRawOffSet,
|
||||||
String cardId,
|
required String keyboardPwdId,
|
||||||
String fingerprintId) =>
|
required String cardId,
|
||||||
|
required String fingerprintId
|
||||||
|
}) =>
|
||||||
post(
|
post(
|
||||||
keyOperationRecordURL.toUrl,
|
keyOperationRecordURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -969,6 +971,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
String isCoerced,
|
String isCoerced,
|
||||||
String startDate,
|
String startDate,
|
||||||
List weekDay,
|
List weekDay,
|
||||||
|
int fingerRight,
|
||||||
|
int startTime,
|
||||||
|
int endTime,
|
||||||
) =>
|
) =>
|
||||||
post(
|
post(
|
||||||
addFingerprintURL.toUrl,
|
addFingerprintURL.toUrl,
|
||||||
@ -982,6 +987,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
'isCoerced': isCoerced,
|
'isCoerced': isCoerced,
|
||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'weekDay': weekDay,
|
'weekDay': weekDay,
|
||||||
|
'fingerRight': fingerRight,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 编辑指纹
|
// 编辑指纹
|
||||||
@ -993,7 +1001,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
String endDate,
|
String endDate,
|
||||||
String isCoerced,
|
String isCoerced,
|
||||||
String fingerprintName,
|
String fingerprintName,
|
||||||
String changeType) =>
|
String changeType,
|
||||||
|
int startTime,
|
||||||
|
int endTime,
|
||||||
|
int fingerprintType) =>
|
||||||
post(
|
post(
|
||||||
editFingerprintURL.toUrl,
|
editFingerprintURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -1004,7 +1015,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
'isCoerced': isCoerced,
|
'isCoerced': isCoerced,
|
||||||
'fingerprintName': fingerprintName,
|
'fingerprintName': fingerprintName,
|
||||||
'changeType': changeType
|
'changeType': changeType,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
|
'fingerprintType': fingerprintType,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 删除指纹
|
// 删除指纹
|
||||||
@ -1145,11 +1159,14 @@ class ApiProvider extends BaseProvider {
|
|||||||
String endDate,
|
String endDate,
|
||||||
String cardName,
|
String cardName,
|
||||||
String cardNumber,
|
String cardNumber,
|
||||||
String cardType,
|
int cardType,
|
||||||
String addType,
|
String addType,
|
||||||
String startDate,
|
String startDate,
|
||||||
String isCoerced,
|
String isCoerced,
|
||||||
List weekDay,
|
List weekDay,
|
||||||
|
int startTime,
|
||||||
|
int endTime,
|
||||||
|
int cardRight,
|
||||||
) =>
|
) =>
|
||||||
post(
|
post(
|
||||||
addICCardURL.toUrl,
|
addICCardURL.toUrl,
|
||||||
@ -1162,7 +1179,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
'addType': addType,
|
'addType': addType,
|
||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'isCoerced': isCoerced,
|
'isCoerced': isCoerced,
|
||||||
'weekDay': weekDay
|
'weekDay': weekDay,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
|
'cardRight': cardRight
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 编辑ICCard
|
// 编辑ICCard
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
statusText: res.statusText,
|
statusText: res.statusText,
|
||||||
);
|
);
|
||||||
} else {}
|
} else {}
|
||||||
print('得到的数据======>${res.bodyString}');
|
// print('得到的数据======>${res.bodyString}');
|
||||||
getDataResult(res.body);
|
getDataResult(res.body);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,35 +191,37 @@ class ApiRepository {
|
|||||||
|
|
||||||
//钥匙详情-操作记录
|
//钥匙详情-操作记录
|
||||||
Future<KeyOperationRecordEntity> lockRecordList(
|
Future<KeyOperationRecordEntity> lockRecordList(
|
||||||
String endDate,
|
{
|
||||||
String keyId,
|
required String endDate,
|
||||||
String keyStatus,
|
required String keyId,
|
||||||
String lockId,
|
required String keyStatus,
|
||||||
String operatorUid,
|
required String lockId,
|
||||||
String pageNo,
|
required String operatorUid,
|
||||||
String pageSize,
|
required String pageNo,
|
||||||
String startDate,
|
required String pageSize,
|
||||||
String recordType,
|
required String startDate,
|
||||||
String searchStr,
|
required String recordType,
|
||||||
String timezoneRawOffSet,
|
required String searchStr,
|
||||||
String keyboardPwdId,
|
required String timezoneRawOffSet,
|
||||||
String cardId,
|
required String keyboardPwdId,
|
||||||
String fingerprintId) async {
|
required String cardId,
|
||||||
|
required String fingerprintId
|
||||||
|
}) async {
|
||||||
final res = await apiProvider.lockRecordList(
|
final res = await apiProvider.lockRecordList(
|
||||||
endDate,
|
endDate:endDate,
|
||||||
keyId,
|
keyId:keyId,
|
||||||
keyStatus,
|
keyStatus:keyStatus,
|
||||||
lockId,
|
lockId:lockId,
|
||||||
operatorUid,
|
operatorUid:operatorUid,
|
||||||
pageNo,
|
pageNo:pageNo,
|
||||||
pageSize,
|
pageSize:pageSize,
|
||||||
startDate,
|
startDate:startDate,
|
||||||
recordType,
|
recordType:recordType,
|
||||||
searchStr,
|
searchStr:searchStr,
|
||||||
timezoneRawOffSet,
|
timezoneRawOffSet:timezoneRawOffSet,
|
||||||
keyboardPwdId,
|
keyboardPwdId:keyboardPwdId,
|
||||||
cardId,
|
cardId:cardId,
|
||||||
fingerprintId);
|
fingerprintId:fingerprintId);
|
||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,6 +1125,9 @@ class ApiRepository {
|
|||||||
required String isCoerced,
|
required String isCoerced,
|
||||||
required String startDate,
|
required String startDate,
|
||||||
required List weekDay,
|
required List weekDay,
|
||||||
|
required int fingerRight,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime,
|
||||||
}) async {
|
}) async {
|
||||||
final res = await apiProvider.addFingerprintsData(
|
final res = await apiProvider.addFingerprintsData(
|
||||||
lockId,
|
lockId,
|
||||||
@ -1133,22 +1138,28 @@ class ApiRepository {
|
|||||||
fingerprintType,
|
fingerprintType,
|
||||||
isCoerced,
|
isCoerced,
|
||||||
startDate,
|
startDate,
|
||||||
weekDay);
|
weekDay,
|
||||||
|
fingerRight,
|
||||||
|
startTime,
|
||||||
|
endTime);
|
||||||
return AddFingerprintEntity.fromJson(res.body);
|
return AddFingerprintEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑指纹
|
// 编辑指纹
|
||||||
Future<LoginEntity> editFingerprintsData(
|
Future<LoginEntity> editFingerprintsData(
|
||||||
{required String fingerprintId,
|
{required String fingerprintId,
|
||||||
required String lockId,
|
required String lockId,
|
||||||
required List weekDay,
|
required List weekDay,
|
||||||
required String startDate,
|
required String startDate,
|
||||||
required String endDate,
|
required String endDate,
|
||||||
required String isCoerced,
|
required String isCoerced,
|
||||||
required String fingerprintName,
|
required String fingerprintName,
|
||||||
required String changeType}) async {
|
required String changeType,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime,
|
||||||
|
required int fingerprintType}) async {
|
||||||
final res = await apiProvider.editFingerprintsData(fingerprintId, lockId,
|
final res = await apiProvider.editFingerprintsData(fingerprintId, lockId,
|
||||||
weekDay, startDate, endDate, isCoerced, fingerprintName, changeType);
|
weekDay, startDate, endDate, isCoerced, fingerprintName, changeType, startTime, endTime, fingerprintType);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1296,14 +1307,17 @@ class ApiRepository {
|
|||||||
required String endDate,
|
required String endDate,
|
||||||
required String cardName,
|
required String cardName,
|
||||||
required String cardNumber,
|
required String cardNumber,
|
||||||
required String cardType,
|
required int cardType,
|
||||||
required String addType,
|
required String addType,
|
||||||
required String startDate,
|
required String startDate,
|
||||||
required String isCoerced,
|
required String isCoerced,
|
||||||
required List weekDay,
|
required List weekDay,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime,
|
||||||
|
required int cardRight,
|
||||||
}) async {
|
}) async {
|
||||||
final res = await apiProvider.addICCardData(lockId, endDate, cardName,
|
final res = await apiProvider.addICCardData(lockId, endDate, cardName,
|
||||||
cardNumber, cardType, addType, startDate, isCoerced, weekDay);
|
cardNumber, cardType, addType, startDate, isCoerced, weekDay, startTime, endTime, cardRight);
|
||||||
return AddICCardEntity.fromJson(res.body);
|
return AddICCardEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
|
|
||||||
import 'package:date_format/date_format.dart';
|
import 'package:date_format/date_format.dart';
|
||||||
|
|
||||||
|
import 'pickers/time_picker/model/pduration.dart';
|
||||||
|
|
||||||
class DateTool {
|
class DateTool {
|
||||||
|
|
||||||
|
/// 获取当前年月日时分秒
|
||||||
String getNowDateYMDHM(){
|
String getNowDateYMDHM(){
|
||||||
// 获取当前时间对象
|
// 获取当前时间对象
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
|
|
||||||
//获取当前时间的年
|
//获取当前时间的年
|
||||||
int year = now.year;
|
int year = now.year;
|
||||||
//获取当前时间的月
|
//获取当前时间的月
|
||||||
@ -24,31 +26,79 @@ class DateTool {
|
|||||||
return "$year.$month.$day $hour:$minute";
|
return "$year.$month.$day $hour:$minute";
|
||||||
}
|
}
|
||||||
|
|
||||||
String dateToYMDHNSString(String timeDate){
|
/// 将时间戳传化为年月日时分秒 (年.月.日 时:分)
|
||||||
int time = int.parse(timeDate);
|
// String dateToYMDHNStringWithDot(String timestamp){
|
||||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
// int time = int.parse(timestamp);
|
||||||
String appointmentDate = formatDate(nowDate, [yyyy,'.',mm,'.',dd,' ',HH,':',nn ,':',ss]);
|
// DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
return appointmentDate;
|
// String appointmentDate = formatDate(nowDate, [yyyy,'.',mm,'.',dd,' ',HH,':',nn]);
|
||||||
|
// return appointmentDate;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/// 根据传入的PDuration及时间类型获取时间字符串
|
||||||
|
/// type 1: 年月日时分(2023-01-01 12:00) 2: 年月日(2023-01-01) 3: 时分(12:00)
|
||||||
|
String getYMDHNDateString(PDuration p, int type){
|
||||||
|
var year = p.year == 0 ? DateTime.now().year : p.year;
|
||||||
|
var month = p.month == 0 ? DateTime.now().month : p.month;
|
||||||
|
var day = p.day == 0 ? DateTime.now().day : p.day;
|
||||||
|
var hour = p.hour == 0 ? DateTime.now().hour : p.hour;
|
||||||
|
var minute = p.minute == 0 ? DateTime.now().minute : p.minute;
|
||||||
|
|
||||||
|
var dateStr = '';
|
||||||
|
switch(type){
|
||||||
|
case 1:
|
||||||
|
// 年月日时分(2023-01-01 12:00)
|
||||||
|
dateStr = '$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 年月日(2023-01-01)
|
||||||
|
dateStr = '$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')}';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 时分(12:00)
|
||||||
|
dateStr = '${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dateStr = '$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return dateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
String dateToYMDHNString(String timeDate){
|
/// 日期转化为时间戳
|
||||||
int time = int.parse(timeDate);
|
/// type 0: 12:00 1: 其他
|
||||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
int dateToTimestamp(String dateStr, int type){
|
||||||
|
int timestamp = 0;
|
||||||
|
if(type == 0){
|
||||||
|
List<String> timeParts = dateStr.split(":");
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
DateTime dateTime = DateTime(now.year, now.month, now.day, int.parse(timeParts[0]), int.parse(timeParts[1]));
|
||||||
|
timestamp = dateTime.millisecondsSinceEpoch;
|
||||||
|
}else{
|
||||||
|
DateTime dateTime = DateTime.parse(dateStr);
|
||||||
|
timestamp = dateTime.millisecondsSinceEpoch;
|
||||||
|
}
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 将时间戳传化为年月日 (年-月-日 时:分)
|
||||||
|
String dateToYMDHNString(String timestamp){
|
||||||
|
int time = int.parse(timestamp);
|
||||||
|
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd,' ',HH,':',nn]);
|
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd,' ',HH,':',nn]);
|
||||||
|
|
||||||
return appointmentDate;
|
return appointmentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
String dateToYMDString(String timeDate){
|
/// 将时间戳传化为年月日 (年.月.日)
|
||||||
int time = int.parse(timeDate);
|
String dateToYMDString(String timestamp){
|
||||||
|
int time = int.parse(timestamp);
|
||||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
String appointmentDate = formatDate(nowDate, [yyyy,'.',mm,'.',dd]);
|
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd]);
|
||||||
return appointmentDate;
|
return appointmentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
String dateToHNString(String timeDate){
|
/// 将时间戳传化为年月日 (时:分)
|
||||||
int time = int.parse(timeDate);
|
String dateToHNString(String timestamp){
|
||||||
|
int time = int.parse(timestamp);
|
||||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
String appointmentDate = formatDate(nowDate, [HH,':',nn]);
|
String appointmentDate = formatDate(nowDate, [HH,':',nn]);
|
||||||
return appointmentDate;
|
return appointmentDate;
|
||||||
|
|||||||
@ -42,12 +42,8 @@ class Pickers {
|
|||||||
assert((data is List) || (data is PickerDataType),
|
assert((data is List) || (data is PickerDataType),
|
||||||
'params : data must List or PickerDataType');
|
'params : data must List or PickerDataType');
|
||||||
|
|
||||||
if (pickerStyle == null) {
|
pickerStyle ??= DefaultPickerStyle();
|
||||||
pickerStyle = DefaultPickerStyle();
|
pickerStyle.context ??= context;
|
||||||
}
|
|
||||||
if (pickerStyle.context == null) {
|
|
||||||
pickerStyle.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.of(context, rootNavigator: overlapTabBar).push(SinglePickerRoute(
|
Navigator.of(context, rootNavigator: overlapTabBar).push(SinglePickerRoute(
|
||||||
data: data,
|
data: data,
|
||||||
@ -74,16 +70,10 @@ class Pickers {
|
|||||||
MultipleCallback? onConfirm,
|
MultipleCallback? onConfirm,
|
||||||
Function(bool isCancel)? onCancel,
|
Function(bool isCancel)? onCancel,
|
||||||
bool overlapTabBar = false}) {
|
bool overlapTabBar = false}) {
|
||||||
if (selectData == null) {
|
selectData ??= [];
|
||||||
selectData = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pickerStyle == null) {
|
pickerStyle ??= DefaultPickerStyle();
|
||||||
pickerStyle = DefaultPickerStyle();
|
pickerStyle.context ??= context;
|
||||||
}
|
|
||||||
if (pickerStyle.context == null) {
|
|
||||||
pickerStyle.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.of(context, rootNavigator: overlapTabBar)
|
Navigator.of(context, rootNavigator: overlapTabBar)
|
||||||
.push(MultiplePickerRoute(
|
.push(MultiplePickerRoute(
|
||||||
@ -115,16 +105,10 @@ class Pickers {
|
|||||||
bool overlapTabBar = false}) {
|
bool overlapTabBar = false}) {
|
||||||
assert(data is Map, 'params : data must Map');
|
assert(data is Map, 'params : data must Map');
|
||||||
|
|
||||||
if (selectData == null) {
|
selectData ??= [];
|
||||||
selectData = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pickerStyle == null) {
|
pickerStyle ??= DefaultPickerStyle();
|
||||||
pickerStyle = DefaultPickerStyle();
|
pickerStyle.context ??= context;
|
||||||
}
|
|
||||||
if (pickerStyle.context == null) {
|
|
||||||
pickerStyle.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.of(context, rootNavigator: overlapTabBar)
|
Navigator.of(context, rootNavigator: overlapTabBar)
|
||||||
.push(MultipleLinkPickerRoute(
|
.push(MultipleLinkPickerRoute(
|
||||||
@ -159,12 +143,8 @@ class Pickers {
|
|||||||
AddressCallback? onConfirm,
|
AddressCallback? onConfirm,
|
||||||
Function(bool isCancel)? onCancel,
|
Function(bool isCancel)? onCancel,
|
||||||
bool overlapTabBar = false}) {
|
bool overlapTabBar = false}) {
|
||||||
if (pickerStyle == null) {
|
pickerStyle ??= DefaultPickerStyle();
|
||||||
pickerStyle = DefaultPickerStyle();
|
pickerStyle.context ??= context;
|
||||||
}
|
|
||||||
if (pickerStyle.context == null) {
|
|
||||||
pickerStyle.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.of(context, rootNavigator: overlapTabBar).push(AddressPickerRoute(
|
Navigator.of(context, rootNavigator: overlapTabBar).push(AddressPickerRoute(
|
||||||
pickerStyle: pickerStyle,
|
pickerStyle: pickerStyle,
|
||||||
@ -201,21 +181,17 @@ class Pickers {
|
|||||||
DateCallback? onConfirm,
|
DateCallback? onConfirm,
|
||||||
Function(bool isCancel)? onCancel,
|
Function(bool isCancel)? onCancel,
|
||||||
bool overlapTabBar = false}) {
|
bool overlapTabBar = false}) {
|
||||||
if (pickerStyle == null) {
|
pickerStyle ??= DefaultPickerStyle();
|
||||||
pickerStyle = DefaultPickerStyle();
|
pickerStyle.context ??= context;
|
||||||
}
|
|
||||||
if (pickerStyle.context == null) {
|
|
||||||
pickerStyle.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectDate == null) selectDate = PDuration.now();
|
selectDate ??= PDuration.now();
|
||||||
if (suffix == null) suffix = Suffix.normal();
|
suffix ??= Suffix.normal();
|
||||||
|
|
||||||
// 解析是否有对应数据
|
// 解析是否有对应数据
|
||||||
DateItemModel dateItemModel = DateItemModel.parse(mode);
|
DateItemModel dateItemModel = DateItemModel.parse(mode);
|
||||||
|
|
||||||
if (maxDate == null) maxDate = PDuration(year: 2100);
|
maxDate ??= PDuration(year: 2100);
|
||||||
if (minDate == null) minDate = PDuration(year: 1900);
|
minDate ??= PDuration(year: 1900);
|
||||||
|
|
||||||
if ((dateItemModel.day || dateItemModel.year)) {
|
if ((dateItemModel.day || dateItemModel.year)) {
|
||||||
if (intEmpty(selectDate.year)) {
|
if (intEmpty(selectDate.year)) {
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import '../dateTool.dart';
|
||||||
|
import 'seletKeyCyclicDate_state.dart';
|
||||||
|
|
||||||
|
class SeletKeyCyclicDateLogic extends BaseGetXController {
|
||||||
|
SeletKeyCyclicDateState state = SeletKeyCyclicDateState();
|
||||||
|
|
||||||
|
void subBtnAction(){
|
||||||
|
var starDateTimestamp = DateTool().dateToTimestamp(state.starDate.value, 1).toString();
|
||||||
|
var endDateTimestamp = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
|
||||||
|
var starTimeTimestamp = DateTool().dateToTimestamp(state.starTime.value, 0).toString();
|
||||||
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0).toString();
|
||||||
|
|
||||||
|
if (int.parse(starDateTimestamp) >= int.parse(endDateTimestamp)) {
|
||||||
|
showToast("失效日期要大于生效日期");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (int.parse(starTimeTimestamp) >= int.parse(endTimeTimestamp)) {
|
||||||
|
showToast("失效时间要大于生效时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, dynamic> resultMap = {};
|
||||||
|
resultMap['starDate'] = state.starDate.value;
|
||||||
|
resultMap['endDate'] = state.endDate.value;
|
||||||
|
resultMap['starTime'] = state.starTime.value;
|
||||||
|
resultMap['endTime'] = state.endTime.value;
|
||||||
|
resultMap['validityValue'] = state.weekDay.value;
|
||||||
|
Get.back(result: resultMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,227 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
|
import '../../app_settings/app_colors.dart';
|
||||||
|
import '../../translations/trans_lib.dart';
|
||||||
|
import '../commonItem.dart';
|
||||||
|
import '../pickers/pickers.dart';
|
||||||
|
import '../pickers/time_picker/model/date_mode.dart';
|
||||||
|
import '../submitBtn.dart';
|
||||||
|
import '../titleAppBar.dart';
|
||||||
|
import 'seletKeyCyclicDate_logic.dart';
|
||||||
|
|
||||||
|
/*
|
||||||
|
电子钥匙、授权管理员、卡、指纹、遥控等添加添加循环日期公共界面
|
||||||
|
*/
|
||||||
|
class SeletKeyCyclicDatePage extends StatefulWidget {
|
||||||
|
const SeletKeyCyclicDatePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SeletKeyCyclicDatePage> createState() => _SeletKeyCyclicDatePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
|
||||||
|
final logic = Get.put(SeletKeyCyclicDateLogic());
|
||||||
|
final state = Get.find<SeletKeyCyclicDateLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: "有效期",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
topWidget(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
middleWidget(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
bottomWidget(),
|
||||||
|
Obx(() => Container(
|
||||||
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||||
|
isDisabled:
|
||||||
|
(state.starDate.value.isNotEmpty &&
|
||||||
|
state.endDate.value.isNotEmpty &&
|
||||||
|
state.starTime.value.isNotEmpty &&
|
||||||
|
state.endTime.value.isNotEmpty &&
|
||||||
|
state.weekDay.value.isNotEmpty),
|
||||||
|
onClick: () {
|
||||||
|
logic.subBtnAction();
|
||||||
|
}),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget topWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "生效日期",
|
||||||
|
rightTitle: state.starDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "失效日期",
|
||||||
|
rightTitle: state.endDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget middleWidget() {
|
||||||
|
return Container(
|
||||||
|
height: 160.h,
|
||||||
|
width: 1.sw,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 60.h,
|
||||||
|
// color: Colors.red,
|
||||||
|
padding: EdgeInsets.only(left: 30.w, top: 15.h),
|
||||||
|
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
|
||||||
|
Container(
|
||||||
|
height: 100.h,
|
||||||
|
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 7, childAspectRatio: 1.0),
|
||||||
|
itemCount: 7,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
index += 1;
|
||||||
|
return btnItem(index);
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget btnItem(int index) {
|
||||||
|
String dateStr;
|
||||||
|
switch (index) {
|
||||||
|
case 1:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.mondayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.tuesdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.wednesdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.thursdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.fridayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.saturdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.sundayShort!.tr;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dateStr = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
if (state.weekDay.value.contains(index)) {
|
||||||
|
state.weekDay.value.remove(index);
|
||||||
|
} else {
|
||||||
|
state.weekDay.value.add(index);
|
||||||
|
}
|
||||||
|
state.weekDay.value.sort();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Obx(() => Container(
|
||||||
|
width: 40.w,
|
||||||
|
height: 40.w,
|
||||||
|
margin: EdgeInsets.all(10.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: state.weekDay.value.contains(index)
|
||||||
|
? AppColors.mainColor
|
||||||
|
: Colors.white,
|
||||||
|
border: Border.all(width: 1, color: AppColors.btnDisableColor),
|
||||||
|
borderRadius: BorderRadius.circular(30.w),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
dateStr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.sp,
|
||||||
|
color: state.weekDay.value.contains(index)
|
||||||
|
? Colors.white
|
||||||
|
: AppColors.darkGrayTextColor),
|
||||||
|
)),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget bottomWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "生效时间",
|
||||||
|
rightTitle: state.starTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
|
||||||
|
state.starTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel:"失效时间",
|
||||||
|
rightTitle: state.endTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
|
||||||
|
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class SeletKeyCyclicDateState{
|
||||||
|
var starDate = "".obs;// 开始时间
|
||||||
|
var endDate = "".obs;// 结束时间
|
||||||
|
var starTime = "".obs;// 生效时间
|
||||||
|
var endTime = "".obs;// 失效时间
|
||||||
|
|
||||||
|
var weekDay = [].obs;
|
||||||
|
}
|
||||||
@ -90,7 +90,7 @@ class VersionUndateTool {
|
|||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(versionUndateEntity.data!.description!,
|
child: Text(versionUndateEntity.data!.description! ?? "",
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: TextStyle(fontSize: 20.sp))),
|
style: TextStyle(fontSize: 20.sp))),
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user