修改卡、指纹模块循环添加逻辑及bug
This commit is contained in:
parent
104fbcc188
commit
c2a6591dd7
@ -182,6 +182,7 @@ import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServices
|
||||
import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart';
|
||||
import 'mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart';
|
||||
import 'starLockApplication/starLockApplication.dart';
|
||||
import 'tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart';
|
||||
|
||||
abstract class Routers {
|
||||
static const initial = '/'; // 加载页
|
||||
@ -429,6 +430,7 @@ abstract class Routers {
|
||||
static const liveVideoPage = '/liveVideoPage'; //实时画面
|
||||
|
||||
static const accessoriesListPage = '/accessoriesListPage'; //配件列表
|
||||
static const seletKeyCyclicDatePage = '/SeletKeyCyclicDatePage';// 电子钥匙、授权管理员、卡、指纹、遥控等添加添加循环日期公共界面
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -1034,6 +1036,9 @@ abstract class AppRouters {
|
||||
page: (() => const AccessoriesListPage())),
|
||||
GetPage(
|
||||
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) {
|
||||
// return;
|
||||
// }
|
||||
Get.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||
" scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
" rssi:${scanResult.rssi}");
|
||||
// Get.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
// " rssi:${scanResult.rssi}");
|
||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
||||
// 查询id相同的元素
|
||||
final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
||||
|
||||
@ -111,7 +111,7 @@ class CommandReciverManager {
|
||||
break;
|
||||
}
|
||||
parseData(oriDataList).then((value) async {
|
||||
Get.log("parseData222 data:$value");
|
||||
// Get.log("parseData222 data:$value");
|
||||
EasyLoading.dismiss();
|
||||
await EventBusManager().eventBusFir(value);
|
||||
}).catchError((error) {
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import 'addCardType_state.dart';
|
||||
|
||||
class AddCardTypeLogic extends BaseGetXController{
|
||||
@ -14,17 +15,26 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4
|
||||
var startDate = "";
|
||||
var endDate = "";
|
||||
var startTime = "";
|
||||
var endTime = "";
|
||||
if (state.selectType.value == "0") {
|
||||
fingerprintType = 1;
|
||||
startDate = "0";
|
||||
endDate = "0";
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
} else if (state.selectType.value == "1") {
|
||||
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("请选择开始时间");
|
||||
return;
|
||||
}
|
||||
if (state.endTimeTimestamp.value.isEmpty) {
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间");
|
||||
return;
|
||||
}
|
||||
@ -34,40 +44,19 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (int.parse(state.beginTimeTimestamp.value) >=
|
||||
int.parse(state.endTimeTimestamp.value)) {
|
||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
startDate = state.beginTimeTimestamp.value;
|
||||
endDate = state.endTimeTimestamp.value;
|
||||
} else if (state.selectType.value == "2") {
|
||||
if (state.effectiveDateTime.value <= 0) {
|
||||
showToast("请选择生效时间");
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择有效期");
|
||||
return;
|
||||
}
|
||||
if (state.failureDateTime.value <= 0) {
|
||||
showToast("请选择失效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||
fingerprintType = 4;
|
||||
}
|
||||
|
||||
@ -85,6 +74,8 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
"weekDay": state.weekdaysList.value,
|
||||
"fromType": state.fromType.value,
|
||||
"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 '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -91,21 +92,7 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
CommonItem(
|
||||
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}');
|
||||
}),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
@ -141,14 +128,8 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
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();
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -156,14 +137,8 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
rightTitle: state.endTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
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();
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
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() {
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
@ -5,18 +5,15 @@ import 'package:get/get.dart';
|
||||
class AddCardTypeState{
|
||||
|
||||
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 isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs;// 是否是管理员
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
||||
|
||||
var effectiveDateTime = 0.obs;// 生效时间
|
||||
var failureDateTime = 0.obs;// 失效时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
|
||||
@ -6,6 +6,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_addICCard.dart';
|
||||
@ -234,7 +235,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
IoSenderManage.senderAddICCardCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
@ -282,10 +282,10 @@ class AddICCardLogic extends BaseGetXController{
|
||||
icCardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
cardType:1,
|
||||
useCountLimit:1,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
// startTime:int.parse(state.startDate.value)~/1000,
|
||||
// endTime:int.parse(state.endDate.value)~/1000,
|
||||
// startTime:0x11223344,
|
||||
// endTime:0x11223344,
|
||||
startTime:int.parse(state.startDate.value)~/1000,
|
||||
endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -297,16 +297,20 @@ class AddICCardLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
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(
|
||||
lockId: state.lockId.value.toString(),
|
||||
endDate: state.endDate.value.toString(),
|
||||
endDate: state.endDate.value,
|
||||
cardName: state.cardName.value.toString(),
|
||||
cardNumber: state.cardNumber.value.toString(),
|
||||
cardType: state.cardType.value.toString(),
|
||||
cardType: int.parse(state.cardType.value),
|
||||
addType: state.addType.value.toString(),
|
||||
startDate: state.startDate.value.toString(),
|
||||
startDate: state.startDate.value,
|
||||
isCoerced: state.isCoerced.value.toString(),
|
||||
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) {
|
||||
updateIdCardUserNoLoadData(entity.data!.cardId.toString());
|
||||
|
||||
@ -17,6 +17,8 @@ class AddICCardState{
|
||||
final startDate = "".obs;
|
||||
final weekDay = [].obs;
|
||||
final fromType = 0.obs;
|
||||
final effectiveDateTime = "".obs;// 生效时间
|
||||
final failureDateTime = "".obs;// 失效时间
|
||||
|
||||
AddICCardState() {
|
||||
Map map = Get.arguments;
|
||||
@ -33,5 +35,7 @@ class AddICCardState{
|
||||
lockId.value = map["lockId"];
|
||||
weekDay.value = map["weekDay"];
|
||||
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/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import 'cardDetail_state.dart';
|
||||
|
||||
@ -62,8 +63,8 @@ class CardDetailLogic extends BaseGetXController{
|
||||
userID:userID,
|
||||
cardNo:int.parse(state.typeNumber.value),
|
||||
useCountLimit:0,
|
||||
startTime:state.effectiveDateTime.value,
|
||||
endTime:state.failureDateTime.value,
|
||||
startTime:int.parse(state.starDate.value),
|
||||
endTime:int.parse(state.endDate.value),
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -118,8 +119,8 @@ class CardDetailLogic extends BaseGetXController{
|
||||
userID:userID,
|
||||
cardNo:int.parse(state.typeNumber.value),
|
||||
useCountLimit:0,
|
||||
startTime:state.effectiveDateTime.value,
|
||||
endTime:state.failureDateTime.value,
|
||||
startTime:int.parse(state.starDate.value),
|
||||
endTime:int.parse(state.endDate.value),
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -142,14 +143,14 @@ class CardDetailLogic extends BaseGetXController{
|
||||
cardId: state.keyId.value.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startDate: state.effectiveDateTime.value.toString(),
|
||||
endDate: state.failureDateTime.value.toString(),
|
||||
startDate: state.starDate.value,
|
||||
endDate: state.endDate.value,
|
||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||
cardName: state.changeNameController.text,
|
||||
changeType: "1",
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
cardType: 0,
|
||||
startTime: int.parse(state.starTime.value),
|
||||
endTime: int.parse(state.endTime.value),
|
||||
cardType:state.keyType.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功", something: (){
|
||||
@ -167,11 +168,23 @@ class CardDetailLogic extends BaseGetXController{
|
||||
deleteType:"1"
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("删除成功");
|
||||
Get.back(result: "addScuess");
|
||||
showToast("删除成功", something: (){
|
||||
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
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -47,7 +47,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
// ),
|
||||
// ],
|
||||
),
|
||||
body: Column(
|
||||
body: ListView(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
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,
|
||||
allHeight: 70.h,
|
||||
// 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,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
// 当是指纹的时候
|
||||
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||
// 限时
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
||||
@ -81,8 +80,8 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
state.starDate.value = data["beginTimeTimestamp"];
|
||||
state.endDate.value = data["endTimeTimestamp"];
|
||||
state.keyType.value = 2;
|
||||
});
|
||||
}
|
||||
@ -94,9 +93,18 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
print("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.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
state.starTime.value = data["starTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.weekDay.value = data["weekDay"];
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -107,6 +115,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||
rightTitle: state.weekDay.value.join(','),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": 0,
|
||||
@ -114,34 +123,50 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
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"];
|
||||
});
|
||||
}
|
||||
})))
|
||||
),
|
||||
})))),
|
||||
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),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||
rightTitle: state.adder.value,
|
||||
action: () {
|
||||
|
||||
})),
|
||||
rightTitle: state.adder.value,)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||
rightTitle: DateTool().dateToYMDHNString(state.addTime.value.toString()),
|
||||
action: () {
|
||||
|
||||
})),
|
||||
)),
|
||||
SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
|
||||
@ -15,8 +15,10 @@ class CardDetailState{
|
||||
|
||||
final typeNumber = "".obs;// 指纹号
|
||||
final typeName = "".obs;// 指纹名字
|
||||
var effectiveDateTime = 0.obs;// 生效时间
|
||||
var failureDateTime = 0.obs;// 失效时间
|
||||
var starDate = "".obs;// 开始时间
|
||||
var endDate = "".obs;// 结束时间
|
||||
var starTime = "".obs;// 生效时间
|
||||
var endTime = "".obs;// 失效时间
|
||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs;// 有效日
|
||||
var adder = "".obs;// 添加者
|
||||
@ -32,8 +34,10 @@ class CardDetailState{
|
||||
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
||||
typeName.value = fingerprintItemData.value.cardName!;
|
||||
changeNameController.text = typeName.value;
|
||||
effectiveDateTime.value = fingerprintItemData.value.startDate!;
|
||||
failureDateTime.value = fingerprintItemData.value.endDate!;
|
||||
starDate.value = fingerprintItemData.value.startDate!.toString();
|
||||
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||
keyType.value = fingerprintItemData.value.cardType!;
|
||||
adder.value = fingerprintItemData.value.senderUsername!;
|
||||
addTime.value = fingerprintItemData.value.createDate!;
|
||||
|
||||
@ -5,6 +5,7 @@ import 'dart:async';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_addICCard.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
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -145,7 +145,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
'images/icon_card.png',
|
||||
fingerprintItemData.cardName!,
|
||||
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
||||
fingerprintItemData.validTimeStr!, () async {
|
||||
logic.getKeyDateType(fingerprintItemData), () async {
|
||||
var data = await Get.toNamed(
|
||||
Routers.cardDetailPage, arguments: {
|
||||
"fingerprintItemData": fingerprintItemData,
|
||||
|
||||
@ -30,14 +30,18 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||
changeType: "1",
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
fingerprintType: state.fingerprintItemData.value.fingerprintType! == 4 ? 4 : 2,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功");
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
||||
showToast("修改成功", something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||
});
|
||||
});
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,15 +70,16 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
changeType: '1',
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
cardType: 0,
|
||||
cardType: 2,// 2:限时 无论之前是永久还是限时,修改之后都是限时
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功");
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
||||
showToast("修改成功", something: (){
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||
"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 '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'otherTypeKeyChangeDate_logic.dart';
|
||||
@ -76,8 +77,8 @@ class _OtherTypeKeyChangeDatePageState
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
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.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
});
|
||||
});
|
||||
})),
|
||||
@ -89,8 +90,8 @@ class _OtherTypeKeyChangeDatePageState
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
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.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
});
|
||||
});
|
||||
})),
|
||||
|
||||
@ -10,17 +10,23 @@ class OtherTypeKeyChangeDateState{
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||
|
||||
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
||||
|
||||
OtherTypeKeyChangeDateState() {
|
||||
Map map = Get.arguments;
|
||||
if(map["pushType"] != null){
|
||||
fingerprintItemData.value = map["fingerprintItemData"];
|
||||
pushType.value = map["pushType"];
|
||||
}
|
||||
pushType.value = map["pushType"];
|
||||
|
||||
if(map["fingerprintItemData"] != null){
|
||||
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){
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import 'otherTypeKeyChangeValidityDate_state.dart';
|
||||
|
||||
@ -11,48 +12,86 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
|
||||
// 修改指纹信息
|
||||
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(
|
||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startDate: state.beginTimeTimestamp.value.toString(),
|
||||
endDate: state.endTimeTimestamp.value.toString(),
|
||||
startDate: starDateTimestamp.toString(),
|
||||
endDate: endDateTimestamp.toString(),
|
||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||
changeType: "1",
|
||||
startTime: starTimeTimestamp,
|
||||
endTime: endTimeTimestamp,
|
||||
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功");
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
||||
"weekDay":state.weekDay.value,
|
||||
showToast("修改成功", something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
Get.back(result: {
|
||||
"starDate":starDateTimestamp.toString(),
|
||||
"endDate":endDateTimestamp.toString(),
|
||||
"starTime":starTimeTimestamp.toString(),
|
||||
"endTime":endTimeTimestamp.toString(),
|
||||
"validityValue":state.weekDay.value,
|
||||
});
|
||||
});
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑iC卡
|
||||
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(
|
||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startDate: state.beginTimeTimestamp.value.toString(),
|
||||
endDate: state.endTimeTimestamp.value.toString(),
|
||||
startDate: starDateTimestamp.toString(),
|
||||
endDate: endDateTimestamp.toString(),
|
||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||
cardName: state.fingerprintItemData.value.cardName!,
|
||||
changeType: '1',
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
cardType: 0,
|
||||
startTime: starTimeTimestamp,
|
||||
endTime: endTimeTimestamp,
|
||||
cardType: state.fingerprintItemData.value.cardType!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功");
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
||||
"weekDay":state.weekDay.value,
|
||||
showToast("修改成功", something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
Get.back(result: {
|
||||
"starDate":starDateTimestamp.toString(),
|
||||
"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_pickers/pickers.dart';
|
||||
// import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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 '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -21,8 +20,7 @@ class OtherTypeKeyChangeValidityDatePage extends StatefulWidget {
|
||||
_OtherTypeKeyChangeValidityDatePageState();
|
||||
}
|
||||
|
||||
class _OtherTypeKeyChangeValidityDatePageState
|
||||
extends State<OtherTypeKeyChangeValidityDatePage> {
|
||||
class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeValidityDatePage> {
|
||||
final logic = Get.put(OtherTypeKeyChangeValidityDateLogic());
|
||||
final state = Get.find<OtherTypeKeyChangeValidityDateLogic>().state;
|
||||
|
||||
@ -36,12 +34,10 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
children: [
|
||||
Container(
|
||||
height: 10.h,
|
||||
color: AppColors.mainBackgroundColor,
|
||||
),
|
||||
topWidget(),
|
||||
SizedBox(height: 10.h),
|
||||
middleWidget(),
|
||||
SizedBox(height: 10.h),
|
||||
bottomWidget(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
||||
@ -60,6 +56,42 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
}
|
||||
|
||||
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,
|
||||
@ -73,7 +105,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
padding: EdgeInsets.only(left: 30.w, top: 15.h),
|
||||
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||
style:
|
||||
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
|
||||
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
|
||||
Container(
|
||||
height: 100.h,
|
||||
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
|
||||
@ -164,18 +196,14 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
Obx(() => CommonItem(
|
||||
leftTitel:
|
||||
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
||||
rightTitle: state.beginTime.value,
|
||||
rightTitle: state.starTime.value,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
state.beginTimeTimestamp.value = DateTime.parse(
|
||||
'${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')}";
|
||||
state.starTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||
});
|
||||
});
|
||||
})),
|
||||
@ -185,14 +213,10 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
rightTitle: state.endTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
state.endTimeTimestamp.value = DateTime.parse(
|
||||
'${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')}";
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||
});
|
||||
});
|
||||
})),
|
||||
|
||||
@ -7,10 +7,10 @@ import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
class OtherTypeKeyChangeValidityDateState{
|
||||
final fingerprintItemData = FingerprintItemData().obs;
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
||||
var starDate = "".obs;// 开始时间
|
||||
var endDate = "".obs;// 结束时间
|
||||
var starTime = "".obs;// 生效时间
|
||||
var endTime = "".obs;// 失效时间
|
||||
|
||||
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
||||
var weekDay = [].obs;
|
||||
@ -20,10 +20,10 @@ class OtherTypeKeyChangeValidityDateState{
|
||||
pushType.value = map["pushType"];
|
||||
fingerprintItemData.value = map["fingerprintItemData"];
|
||||
|
||||
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
||||
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
||||
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
|
||||
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
|
||||
starDate.value = DateTool().dateToYMDString(fingerprintItemData.value.startDate.toString());
|
||||
endDate.value = DateTool().dateToYMDString(fingerprintItemData.value.endDate.toString());
|
||||
starTime.value = DateTool().dateToHNString(fingerprintItemData.value.startDate.toString());
|
||||
endTime.value = DateTool().dateToHNString(fingerprintItemData.value.endDate.toString());
|
||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||
}
|
||||
}
|
||||
@ -82,11 +82,11 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
reply.data.removeRange(0, 6);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
var getList = splitList(reply.data, 8);
|
||||
print("getList:$getList");
|
||||
// print("getList:$getList");
|
||||
var uploadList = [];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
var indexList = getList[i];
|
||||
print("indexList:$indexList");
|
||||
// print("indexList:$indexList");
|
||||
var indexMap = {};
|
||||
indexMap["seq"] = indexList[0].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_state.dart';
|
||||
import 'package:star_lock/network/api_repository.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 {
|
||||
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 {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
||||
'0',
|
||||
state.keyId.value,
|
||||
'0',
|
||||
state.lockId.value,
|
||||
'1',
|
||||
'1',
|
||||
'20',
|
||||
'0',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
state.keyboardPwdId.value,
|
||||
state.cardId.value,
|
||||
state.fingerprintId.value);
|
||||
endDate:'0',
|
||||
keyId:state.keyId.value,
|
||||
keyStatus:'0',
|
||||
lockId:state.lockId.value,
|
||||
operatorUid:'1',
|
||||
pageNo:'1',
|
||||
pageSize:'20',
|
||||
startDate:'0',
|
||||
recordType:'',
|
||||
searchStr:'',
|
||||
timezoneRawOffSet:'',
|
||||
keyboardPwdId:state.keyboardPwdId.value,
|
||||
cardId:state.cardId.value,
|
||||
fingerprintId:state.fingerprintId.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("操作记录列表成功:${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');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("重置电子钥匙成功啦啦啦啦啦");
|
||||
showToast("重置成功");
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
showToast("重置成功", something: (){
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,9 +55,10 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("删除电子钥匙成功");
|
||||
showToast("删除成功");
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
showToast("删除成功",something: (){
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,10 @@ class ElectronicKeyPeriodValidityPage extends StatefulWidget {
|
||||
_ElectronicKeyPeriodValidityPageState();
|
||||
}
|
||||
|
||||
class _ElectronicKeyPeriodValidityPageState
|
||||
extends State<ElectronicKeyPeriodValidityPage> {
|
||||
class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodValidityPage> {
|
||||
final logic = Get.put(ElectronicKeyPeriodValidityLogic());
|
||||
final state = Get.find<ElectronicKeyPeriodValidityLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -36,8 +36,7 @@ class _ElectronicKeyPeriodValidityPageState
|
||||
} else {
|
||||
validityValue = i;
|
||||
}
|
||||
KeyPeriodValidityModel model = KeyPeriodValidityModel(
|
||||
state.validityTextList.value[i], i, false, validityValue);
|
||||
KeyPeriodValidityModel model = KeyPeriodValidityModel(state.validityTextList.value[i], i, false, validityValue);
|
||||
state.validityDataList.value.add(model);
|
||||
}
|
||||
}
|
||||
@ -194,6 +193,14 @@ class _ElectronicKeyPeriodValidityPageState
|
||||
'${p.hour!}:${p.minute!}', 'HH:mm');
|
||||
state.selectEffectiveTime.value = XSDateUtils.formatDateTime(
|
||||
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(
|
||||
|
||||
@ -341,6 +341,8 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
|
||||
// 添加指纹
|
||||
void addFingerprintsData() async{
|
||||
Get.log("effectiveDateTime:${state.effectiveDateTime.value} failureDateTime:${state.failureDateTime.value}");
|
||||
|
||||
var entity = await ApiRepository.to.addFingerprintsData(
|
||||
lockId: state.lockId.value.toString(),
|
||||
endDate: state.endDate.value,
|
||||
@ -351,6 +353,9 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
isCoerced: state.isCoerced.value,
|
||||
startDate: state.startDate.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){
|
||||
// Toast.show(msg: "添加成功");
|
||||
|
||||
@ -21,6 +21,8 @@ class AddFingerprintState{
|
||||
final startDate = "".obs;
|
||||
final weekDay = [].obs;
|
||||
final fromType = 1.obs;
|
||||
final effectiveDateTime = "".obs;// 生效时间
|
||||
final failureDateTime = "".obs;// 失效时间
|
||||
|
||||
AddFingerprintState() {
|
||||
Map map = Get.arguments;
|
||||
@ -38,5 +40,7 @@ class AddFingerprintState{
|
||||
lockId.value = map["lockId"];
|
||||
weekDay.value = map["weekDay"];
|
||||
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 '../../../../appRouters.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import 'addFingerprintType_state.dart';
|
||||
|
||||
class AddFingerprintTypeLogic extends BaseGetXController{
|
||||
@ -13,17 +14,26 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
||||
var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4
|
||||
var startDate = "";
|
||||
var endDate = "";
|
||||
var startTime = "";
|
||||
var endTime = "";
|
||||
if (state.selectType.value == "0") {
|
||||
fingerprintType = 1;
|
||||
startDate = "0";
|
||||
endDate = "0";
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
} else if (state.selectType.value == "1") {
|
||||
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("请选择开始时间");
|
||||
return;
|
||||
}
|
||||
if (state.endTimeTimestamp.value.isEmpty) {
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间");
|
||||
return;
|
||||
}
|
||||
@ -33,45 +43,25 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (int.parse(state.beginTimeTimestamp.value) >=
|
||||
int.parse(state.endTimeTimestamp.value)) {
|
||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
startDate = state.beginTimeTimestamp.value;
|
||||
endDate = state.endTimeTimestamp.value;
|
||||
} else if (state.selectType.value == "2") {
|
||||
if (state.effectiveDateTime.value <= 0) {
|
||||
showToast("请选择生效时间");
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择有效期");
|
||||
return;
|
||||
}
|
||||
if (state.failureDateTime.value <= 0) {
|
||||
showToast("请选择失效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||
fingerprintType = 4;
|
||||
}
|
||||
|
||||
var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫指纹 2:胁迫指纹
|
||||
print("addOtherType startDate:$startDate endDate:$endDate isCoerced:$isCoerced");
|
||||
|
||||
// 指纹
|
||||
Get.toNamed(Routers.addFingerprintPage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
@ -85,6 +75,8 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
||||
"weekDay": state.weekdaysList.value,
|
||||
"fromType": state.fromType.value,
|
||||
"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 '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -91,21 +92,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
CommonItem(
|
||||
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}');
|
||||
}),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
@ -141,11 +128,8 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
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();
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -153,10 +137,8 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
rightTitle: state.endTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
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();
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
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() {
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
@ -11,11 +11,8 @@ class AddFingerprintState{
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
||||
|
||||
var effectiveDateTime = 0.obs;// 生效时间
|
||||
var failureDateTime = 0.obs;// 失效时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
|
||||
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/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import 'fingerprintDetail_state.dart';
|
||||
|
||||
@ -63,8 +64,8 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
userID:userID,
|
||||
fingerNo:int.parse(state.typeNumber.value),
|
||||
useCountLimit:0,
|
||||
startTime:state.effectiveDateTime.value,
|
||||
endTime:state.failureDateTime.value,
|
||||
startTime:int.parse(state.starDate.value),
|
||||
endTime:int.parse(state.endDate.value),
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -119,8 +120,8 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
userID:userID,
|
||||
fingerNo:int.parse(state.typeNumber.value),
|
||||
useCountLimit:0,
|
||||
startTime:state.effectiveDateTime.value,
|
||||
endTime:state.failureDateTime.value,
|
||||
startTime:int.parse(state.starDate.value),
|
||||
endTime:int.parse(state.endDate.value),
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -155,14 +156,17 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
// 编辑指纹
|
||||
void editFingerprintsData() async{
|
||||
var entity = await ApiRepository.to.editFingerprintsData(
|
||||
fingerprintId: state.keyId.value.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startDate: state.effectiveDateTime.value.toString(),
|
||||
endDate: state.failureDateTime.value.toString(),
|
||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||
fingerprintName: state.changeNameController.text,
|
||||
changeType: "1",
|
||||
fingerprintId: state.keyId.value.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startDate: state.starDate.value,
|
||||
endDate: state.endDate.value,
|
||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||
fingerprintName: state.changeNameController.text,
|
||||
changeType: "1",
|
||||
startTime: int.parse(state.starTime.value),
|
||||
endTime: int.parse(state.endTime.value),
|
||||
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
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
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -37,14 +37,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
barTitle: "指纹详情",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
// actionsList: [
|
||||
// TextButton(
|
||||
// child: Text(TranslationLoader.lanKeys!.share!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),),
|
||||
// onPressed: () {
|
||||
//
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
@ -62,32 +54,26 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
showCupertinoAlertDialog(context);
|
||||
})),
|
||||
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(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
allHeight: 70.h,
|
||||
// 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,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
// switch(state.type.value){
|
||||
// case 0:
|
||||
// // 卡
|
||||
//
|
||||
// break;
|
||||
// case 1:
|
||||
// 当是指纹的时候
|
||||
if(state.keyType.value == 2){
|
||||
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||
// 限时
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
state.starDate.value = data["beginTimeTimestamp"];
|
||||
state.endDate.value = data["endTimeTimestamp"];
|
||||
state.keyType.value = 2;
|
||||
});
|
||||
}
|
||||
}else if(state.keyType.value == 4){
|
||||
@ -98,13 +84,21 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
print("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.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
state.starTime.value = data["starTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.weekDay.value = data["weekDay"];
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}))),
|
||||
Obx(() => Visibility(
|
||||
visible: state.keyType.value == 4 ? true : false,
|
||||
@ -112,21 +106,43 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||
rightTitle: state.weekDay.value.join(','),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
// 当是指纹的时候
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
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"];
|
||||
});
|
||||
}
|
||||
})))
|
||||
),
|
||||
})))),
|
||||
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),
|
||||
Obx(() => CommonItem(
|
||||
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) {
|
||||
showDialog(
|
||||
context: context,
|
||||
|
||||
@ -11,8 +11,10 @@ class FingerprintDetailState{
|
||||
|
||||
final typeNumber = "".obs;// 指纹号
|
||||
final typeName = "".obs;// 指纹名字
|
||||
var effectiveDateTime = 0.obs;// 生效时间
|
||||
var failureDateTime = 0.obs;// 失效时间
|
||||
var starDate = "".obs;// 开始时间
|
||||
var endDate = "".obs;// 结束时间
|
||||
var starTime = "".obs;// 生效时间
|
||||
var endTime = "".obs;// 失效时间
|
||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs;// 有效日
|
||||
var adder = "".obs;// 添加者
|
||||
@ -31,8 +33,10 @@ class FingerprintDetailState{
|
||||
typeNumber.value = fingerprintItemData.value.fingerprintNumber!;
|
||||
typeName.value = fingerprintItemData.value.fingerprintName!;
|
||||
changeNameController.text = typeName.value;
|
||||
effectiveDateTime.value = fingerprintItemData.value.startDate!;
|
||||
failureDateTime.value = fingerprintItemData.value.endDate!;
|
||||
starDate.value = fingerprintItemData.value.startDate!.toString();
|
||||
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||
keyType.value = fingerprintItemData.value.fingerprintType!;
|
||||
adder.value = fingerprintItemData.value.senderUsername!;
|
||||
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/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/storage.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
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -148,7 +148,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
||||
'images/icon_fingerprint.png',
|
||||
fingerprintItemData.fingerprintName!,
|
||||
(fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
||||
fingerprintItemData.validTimeStr!,
|
||||
logic.getKeyDateType(fingerprintItemData),
|
||||
// fingerprintItemData.fingerprintType! == 1
|
||||
// ? "永久"
|
||||
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
|
||||
|
||||
@ -33,7 +33,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
void initReplySubscription() {
|
||||
state.replySubscription =
|
||||
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) {
|
||||
_replyOpenLock(reply);
|
||||
|
||||
@ -142,15 +142,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
children: [
|
||||
Visibility(
|
||||
visible:
|
||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||
state.keyInfos.value.keyType ==
|
||||
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||
(DateTool().compareTimeGetDaysFromNow(
|
||||
state.keyInfos.value.endDate!) <
|
||||
30 &&
|
||||
DateTool().compareTimeGetDaysFromNow(
|
||||
state.keyInfos.value.endDate!) >
|
||||
0) && // 0到30天
|
||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 0到30天
|
||||
(state.keyInfos.value.keyStatus ==
|
||||
XSConstantMacro.keyStatusNormalUse ||
|
||||
state.keyInfos.value.keyStatus ==
|
||||
@ -250,7 +243,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// logic.getStarLockStatus();
|
||||
showDeletAlertDialog(
|
||||
context,
|
||||
DateTool().dateToYMDHNSString(state
|
||||
DateTool().dateToYMDHNString(state
|
||||
.keyInfos.value.electricQuantityDate!
|
||||
.toString()));
|
||||
},
|
||||
|
||||
@ -187,20 +187,20 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
//请求操作记录列表
|
||||
void mockNetworkDataRequest() async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
||||
'',
|
||||
"",
|
||||
'0',
|
||||
state.keyInfos.value.lockId.toString(),
|
||||
'1',
|
||||
'1',
|
||||
'20',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'');
|
||||
endDate:'',
|
||||
keyId:"",
|
||||
keyStatus:'0',
|
||||
lockId:state.keyInfos.value.lockId.toString(),
|
||||
operatorUid:'1',
|
||||
pageNo:'1',
|
||||
pageSize:'20',
|
||||
startDate:'',
|
||||
recordType:'',
|
||||
searchStr:'',
|
||||
timezoneRawOffSet:'',
|
||||
keyboardPwdId:'',
|
||||
cardId:'',
|
||||
fingerprintId:'');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("操作记录列表成功:${entity.data?.itemList}");
|
||||
state.lockOperatingRecordListData.value = entity.data!.itemList!;
|
||||
|
||||
@ -40,23 +40,23 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockNumber!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.lockName,
|
||||
rightTitle: state.lockBasicInfo.value.lockName ?? "",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true),
|
||||
CommonItem(
|
||||
isHaveLine: true)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "MAC/ID",
|
||||
rightTitle:
|
||||
"${state.lockBasicInfo.value.mac}/${state.lockBasicInfo.value.lockId}",
|
||||
"${state.lockBasicInfo.value.mac??""}/${state.lockBasicInfo.value.lockId??""}",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: false),
|
||||
isHaveLine: false)),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.electricQuantity!.tr,
|
||||
rightTitle: "${state.lockBasicInfo.value.electricQuantity}%",
|
||||
rightTitle: "${state.lockBasicInfo.value.electricQuantity??0}%",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -64,40 +64,40 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
})),
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: logic.getUseKeyTypeStr(
|
||||
state.lockBasicInfo.value.startDate,
|
||||
state.lockBasicInfo.value.endDate,
|
||||
state.lockBasicInfo.value.keyType),
|
||||
allHeight: 70.h,
|
||||
isHaveLine: false),
|
||||
isHaveLine: false)),
|
||||
SizedBox(height: 10.h),
|
||||
Visibility(
|
||||
Obx(() => Visibility(
|
||||
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
|
||||
state.lockBasicInfo.value.keyRight == 1)
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.lockAlias,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.editLockNamePage,
|
||||
arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.lockBasicInfo.value = data["lockBasicInfo"];
|
||||
print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}");
|
||||
});
|
||||
}
|
||||
})),
|
||||
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.lockAlias,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.editLockNamePage,
|
||||
arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.lockBasicInfo.value = data["lockBasicInfo"];
|
||||
print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}");
|
||||
});
|
||||
}
|
||||
}))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.groupName,
|
||||
rightTitle: state.lockBasicInfo.value.groupName ?? "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
@ -111,15 +111,15 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
}
|
||||
});
|
||||
})),
|
||||
Visibility(
|
||||
Obx(() => Visibility(
|
||||
visible: state.lockBasicInfo.value.isLockOwner == 1
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
||||
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
||||
rightTitle:
|
||||
state.lockSetInfoData.value!.lockBasicInfo!.adminPwd,
|
||||
state.lockBasicInfo!.value.adminPwd,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -127,7 +127,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
}),
|
||||
),
|
||||
)),
|
||||
/* 2024-01-12 会议确定去掉“微信二维码” by DaisyWu
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
|
||||
@ -13,7 +13,9 @@ class BasicInformationState {
|
||||
var map = Get.arguments;
|
||||
if(map["lockSetInfoData"] != null){
|
||||
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() {
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||
if(map["lockSetInfoData"] != null){
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
if(lockSetInfoData.value.lockBasicInfo!=null){
|
||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
children: [
|
||||
Expanded(
|
||||
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),
|
||||
)),
|
||||
],
|
||||
|
||||
@ -5,6 +5,7 @@ import '../../lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class UploadElectricQuantityState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var lockBasicInfo = LockBasicInfo().obs;
|
||||
var uploadElectricQuantityDate = 0.obs;
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
@ -12,8 +13,13 @@ class UploadElectricQuantityState {
|
||||
|
||||
UploadElectricQuantityState() {
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
uploadElectricQuantityDate.value = lockSetInfoData.value.lockBasicInfo!.electricQuantityDate!;
|
||||
if(map["lockSetInfoData"]!=null){
|
||||
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[2]) << 8 |
|
||||
(0xFF & indate[3]));
|
||||
state.dateTime.value = DateTool().dateToYMDHNSString("$indateValue");
|
||||
state.dateTime.value = DateTool().dateToYMDHNString("$indateValue");
|
||||
// state.dateTime = indateValue * 1000;
|
||||
print("indate:$indate indateValue:$indateValue");
|
||||
|
||||
@ -97,7 +97,7 @@ class LockTimeLogic extends BaseGetXController{
|
||||
// String dataEime = DateTool().dateToYMDHNSString("$value");
|
||||
// state.dateTime.value = dataEime;
|
||||
|
||||
String dataEime = DateTool().dateToYMDHNSString("${state.dateTimestamp.value}");
|
||||
String dataEime = DateTool().dateToYMDHNString("${state.dateTimestamp.value}");
|
||||
state.dateTime.value = dataEime;
|
||||
|
||||
state.sureBtnState.value = 0;
|
||||
|
||||
@ -16,7 +16,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
1);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功", something: (){
|
||||
Get.back();
|
||||
Get.back(result: "deletScuess");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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
|
||||
.keyboardPwdReset(state.keyInfo.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("重置电子钥匙成功啦啦啦啦啦");
|
||||
showToast("重置成功");
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
// print("重置电子钥匙成功啦啦啦啦啦");
|
||||
showToast("重置成功", something: (){
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,9 +53,10 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
PasswordKeyEntity entity = await ApiRepository.to
|
||||
.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功");
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
showToast("删除成功", something: (){
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +147,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||
arguments: {"itemData": passwordKeyListItem}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
@ -194,7 +194,7 @@ class _LockListPageState extends State<LockListPage> {
|
||||
)),
|
||||
SizedBox(height: 20.h),
|
||||
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,
|
||||
child:Row(
|
||||
children: [
|
||||
|
||||
@ -220,20 +220,22 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||
|
||||
Future<Response> lockRecordList(
|
||||
String endDate,
|
||||
String keyId,
|
||||
String keyStatus,
|
||||
String lockId,
|
||||
String operatorUid,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String startDate,
|
||||
String recordType,
|
||||
String searchStr,
|
||||
String timezoneRawOffSet,
|
||||
String keyboardPwdId,
|
||||
String cardId,
|
||||
String fingerprintId) =>
|
||||
{
|
||||
required String endDate,
|
||||
required String keyId,
|
||||
required String keyStatus,
|
||||
required String lockId,
|
||||
required String operatorUid,
|
||||
required String pageNo,
|
||||
required String pageSize,
|
||||
required String startDate,
|
||||
required String recordType,
|
||||
required String searchStr,
|
||||
required String timezoneRawOffSet,
|
||||
required String keyboardPwdId,
|
||||
required String cardId,
|
||||
required String fingerprintId
|
||||
}) =>
|
||||
post(
|
||||
keyOperationRecordURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -969,6 +971,9 @@ class ApiProvider extends BaseProvider {
|
||||
String isCoerced,
|
||||
String startDate,
|
||||
List weekDay,
|
||||
int fingerRight,
|
||||
int startTime,
|
||||
int endTime,
|
||||
) =>
|
||||
post(
|
||||
addFingerprintURL.toUrl,
|
||||
@ -982,6 +987,9 @@ class ApiProvider extends BaseProvider {
|
||||
'isCoerced': isCoerced,
|
||||
'startDate': startDate,
|
||||
'weekDay': weekDay,
|
||||
'fingerRight': fingerRight,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
}));
|
||||
|
||||
// 编辑指纹
|
||||
@ -993,7 +1001,10 @@ class ApiProvider extends BaseProvider {
|
||||
String endDate,
|
||||
String isCoerced,
|
||||
String fingerprintName,
|
||||
String changeType) =>
|
||||
String changeType,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int fingerprintType) =>
|
||||
post(
|
||||
editFingerprintURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1004,7 +1015,10 @@ class ApiProvider extends BaseProvider {
|
||||
'endDate': endDate,
|
||||
'isCoerced': isCoerced,
|
||||
'fingerprintName': fingerprintName,
|
||||
'changeType': changeType
|
||||
'changeType': changeType,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'fingerprintType': fingerprintType,
|
||||
}));
|
||||
|
||||
// 删除指纹
|
||||
@ -1145,11 +1159,14 @@ class ApiProvider extends BaseProvider {
|
||||
String endDate,
|
||||
String cardName,
|
||||
String cardNumber,
|
||||
String cardType,
|
||||
int cardType,
|
||||
String addType,
|
||||
String startDate,
|
||||
String isCoerced,
|
||||
List weekDay,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int cardRight,
|
||||
) =>
|
||||
post(
|
||||
addICCardURL.toUrl,
|
||||
@ -1162,7 +1179,10 @@ class ApiProvider extends BaseProvider {
|
||||
'addType': addType,
|
||||
'startDate': startDate,
|
||||
'isCoerced': isCoerced,
|
||||
'weekDay': weekDay
|
||||
'weekDay': weekDay,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'cardRight': cardRight
|
||||
}));
|
||||
|
||||
// 编辑ICCard
|
||||
|
||||
@ -57,7 +57,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
statusText: res.statusText,
|
||||
);
|
||||
} else {}
|
||||
print('得到的数据======>${res.bodyString}');
|
||||
// print('得到的数据======>${res.bodyString}');
|
||||
getDataResult(res.body);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -191,35 +191,37 @@ class ApiRepository {
|
||||
|
||||
//钥匙详情-操作记录
|
||||
Future<KeyOperationRecordEntity> lockRecordList(
|
||||
String endDate,
|
||||
String keyId,
|
||||
String keyStatus,
|
||||
String lockId,
|
||||
String operatorUid,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String startDate,
|
||||
String recordType,
|
||||
String searchStr,
|
||||
String timezoneRawOffSet,
|
||||
String keyboardPwdId,
|
||||
String cardId,
|
||||
String fingerprintId) async {
|
||||
{
|
||||
required String endDate,
|
||||
required String keyId,
|
||||
required String keyStatus,
|
||||
required String lockId,
|
||||
required String operatorUid,
|
||||
required String pageNo,
|
||||
required String pageSize,
|
||||
required String startDate,
|
||||
required String recordType,
|
||||
required String searchStr,
|
||||
required String timezoneRawOffSet,
|
||||
required String keyboardPwdId,
|
||||
required String cardId,
|
||||
required String fingerprintId
|
||||
}) async {
|
||||
final res = await apiProvider.lockRecordList(
|
||||
endDate,
|
||||
keyId,
|
||||
keyStatus,
|
||||
lockId,
|
||||
operatorUid,
|
||||
pageNo,
|
||||
pageSize,
|
||||
startDate,
|
||||
recordType,
|
||||
searchStr,
|
||||
timezoneRawOffSet,
|
||||
keyboardPwdId,
|
||||
cardId,
|
||||
fingerprintId);
|
||||
endDate:endDate,
|
||||
keyId:keyId,
|
||||
keyStatus:keyStatus,
|
||||
lockId:lockId,
|
||||
operatorUid:operatorUid,
|
||||
pageNo:pageNo,
|
||||
pageSize:pageSize,
|
||||
startDate:startDate,
|
||||
recordType:recordType,
|
||||
searchStr:searchStr,
|
||||
timezoneRawOffSet:timezoneRawOffSet,
|
||||
keyboardPwdId:keyboardPwdId,
|
||||
cardId:cardId,
|
||||
fingerprintId:fingerprintId);
|
||||
return KeyOperationRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1123,6 +1125,9 @@ class ApiRepository {
|
||||
required String isCoerced,
|
||||
required String startDate,
|
||||
required List weekDay,
|
||||
required int fingerRight,
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
}) async {
|
||||
final res = await apiProvider.addFingerprintsData(
|
||||
lockId,
|
||||
@ -1133,22 +1138,28 @@ class ApiRepository {
|
||||
fingerprintType,
|
||||
isCoerced,
|
||||
startDate,
|
||||
weekDay);
|
||||
weekDay,
|
||||
fingerRight,
|
||||
startTime,
|
||||
endTime);
|
||||
return AddFingerprintEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 编辑指纹
|
||||
Future<LoginEntity> editFingerprintsData(
|
||||
{required String fingerprintId,
|
||||
required String lockId,
|
||||
required List weekDay,
|
||||
required String startDate,
|
||||
required String endDate,
|
||||
required String isCoerced,
|
||||
required String fingerprintName,
|
||||
required String changeType}) async {
|
||||
required String lockId,
|
||||
required List weekDay,
|
||||
required String startDate,
|
||||
required String endDate,
|
||||
required String isCoerced,
|
||||
required String fingerprintName,
|
||||
required String changeType,
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int fingerprintType}) async {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1296,14 +1307,17 @@ class ApiRepository {
|
||||
required String endDate,
|
||||
required String cardName,
|
||||
required String cardNumber,
|
||||
required String cardType,
|
||||
required int cardType,
|
||||
required String addType,
|
||||
required String startDate,
|
||||
required String isCoerced,
|
||||
required List weekDay,
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int cardRight,
|
||||
}) async {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
|
||||
import 'package:date_format/date_format.dart';
|
||||
|
||||
import 'pickers/time_picker/model/pduration.dart';
|
||||
|
||||
class DateTool {
|
||||
|
||||
/// 获取当前年月日时分秒
|
||||
String getNowDateYMDHM(){
|
||||
// 获取当前时间对象
|
||||
DateTime now = DateTime.now();
|
||||
|
||||
//获取当前时间的年
|
||||
int year = now.year;
|
||||
//获取当前时间的月
|
||||
@ -24,31 +26,79 @@ class DateTool {
|
||||
return "$year.$month.$day $hour:$minute";
|
||||
}
|
||||
|
||||
String dateToYMDHNSString(String timeDate){
|
||||
int time = int.parse(timeDate);
|
||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||
String appointmentDate = formatDate(nowDate, [yyyy,'.',mm,'.',dd,' ',HH,':',nn ,':',ss]);
|
||||
return appointmentDate;
|
||||
/// 将时间戳传化为年月日时分秒 (年.月.日 时:分)
|
||||
// String dateToYMDHNStringWithDot(String timestamp){
|
||||
// int time = int.parse(timestamp);
|
||||
// DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||
// 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);
|
||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||
/// 日期转化为时间戳
|
||||
/// type 0: 12:00 1: 其他
|
||||
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]);
|
||||
|
||||
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);
|
||||
String appointmentDate = formatDate(nowDate, [yyyy,'.',mm,'.',dd]);
|
||||
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd]);
|
||||
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);
|
||||
String appointmentDate = formatDate(nowDate, [HH,':',nn]);
|
||||
return appointmentDate;
|
||||
|
||||
@ -42,12 +42,8 @@ class Pickers {
|
||||
assert((data is List) || (data is PickerDataType),
|
||||
'params : data must List or PickerDataType');
|
||||
|
||||
if (pickerStyle == null) {
|
||||
pickerStyle = DefaultPickerStyle();
|
||||
}
|
||||
if (pickerStyle.context == null) {
|
||||
pickerStyle.context = context;
|
||||
}
|
||||
pickerStyle ??= DefaultPickerStyle();
|
||||
pickerStyle.context ??= context;
|
||||
|
||||
Navigator.of(context, rootNavigator: overlapTabBar).push(SinglePickerRoute(
|
||||
data: data,
|
||||
@ -74,16 +70,10 @@ class Pickers {
|
||||
MultipleCallback? onConfirm,
|
||||
Function(bool isCancel)? onCancel,
|
||||
bool overlapTabBar = false}) {
|
||||
if (selectData == null) {
|
||||
selectData = [];
|
||||
}
|
||||
selectData ??= [];
|
||||
|
||||
if (pickerStyle == null) {
|
||||
pickerStyle = DefaultPickerStyle();
|
||||
}
|
||||
if (pickerStyle.context == null) {
|
||||
pickerStyle.context = context;
|
||||
}
|
||||
pickerStyle ??= DefaultPickerStyle();
|
||||
pickerStyle.context ??= context;
|
||||
|
||||
Navigator.of(context, rootNavigator: overlapTabBar)
|
||||
.push(MultiplePickerRoute(
|
||||
@ -115,16 +105,10 @@ class Pickers {
|
||||
bool overlapTabBar = false}) {
|
||||
assert(data is Map, 'params : data must Map');
|
||||
|
||||
if (selectData == null) {
|
||||
selectData = [];
|
||||
}
|
||||
selectData ??= [];
|
||||
|
||||
if (pickerStyle == null) {
|
||||
pickerStyle = DefaultPickerStyle();
|
||||
}
|
||||
if (pickerStyle.context == null) {
|
||||
pickerStyle.context = context;
|
||||
}
|
||||
pickerStyle ??= DefaultPickerStyle();
|
||||
pickerStyle.context ??= context;
|
||||
|
||||
Navigator.of(context, rootNavigator: overlapTabBar)
|
||||
.push(MultipleLinkPickerRoute(
|
||||
@ -159,12 +143,8 @@ class Pickers {
|
||||
AddressCallback? onConfirm,
|
||||
Function(bool isCancel)? onCancel,
|
||||
bool overlapTabBar = false}) {
|
||||
if (pickerStyle == null) {
|
||||
pickerStyle = DefaultPickerStyle();
|
||||
}
|
||||
if (pickerStyle.context == null) {
|
||||
pickerStyle.context = context;
|
||||
}
|
||||
pickerStyle ??= DefaultPickerStyle();
|
||||
pickerStyle.context ??= context;
|
||||
|
||||
Navigator.of(context, rootNavigator: overlapTabBar).push(AddressPickerRoute(
|
||||
pickerStyle: pickerStyle,
|
||||
@ -201,21 +181,17 @@ class Pickers {
|
||||
DateCallback? onConfirm,
|
||||
Function(bool isCancel)? onCancel,
|
||||
bool overlapTabBar = false}) {
|
||||
if (pickerStyle == null) {
|
||||
pickerStyle = DefaultPickerStyle();
|
||||
}
|
||||
if (pickerStyle.context == null) {
|
||||
pickerStyle.context = context;
|
||||
}
|
||||
pickerStyle ??= DefaultPickerStyle();
|
||||
pickerStyle.context ??= context;
|
||||
|
||||
if (selectDate == null) selectDate = PDuration.now();
|
||||
if (suffix == null) suffix = Suffix.normal();
|
||||
selectDate ??= PDuration.now();
|
||||
suffix ??= Suffix.normal();
|
||||
|
||||
// 解析是否有对应数据
|
||||
DateItemModel dateItemModel = DateItemModel.parse(mode);
|
||||
|
||||
if (maxDate == null) maxDate = PDuration(year: 2100);
|
||||
if (minDate == null) minDate = PDuration(year: 1900);
|
||||
maxDate ??= PDuration(year: 2100);
|
||||
minDate ??= PDuration(year: 1900);
|
||||
|
||||
if ((dateItemModel.day || dateItemModel.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(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(versionUndateEntity.data!.description!,
|
||||
child: Text(versionUndateEntity.data!.description! ?? "",
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontSize: 20.sp))),
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user