1、添加人脸添加过程的功能
2、修改账号页-设置-锁用户管理-即将到期,密码删除未刷新,删除的是最下面的一个密码不是当前选的问题 3、修改账号页-设置-锁用户管理-即将到期,卡、指纹、人脸删除未刷新问题 4、修改账号页-设置-锁用户管理-即将到期,密码修改提示用户未登记 5、添加修改账号页-设置-锁用户管理-即将到期模块,卡、指纹、人脸修改循环功能
This commit is contained in:
parent
8ce45c56c8
commit
c3d391090b
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
@ -182,6 +183,7 @@ import 'mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart';
|
|||||||
import 'mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart';
|
import 'mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart';
|
||||||
import 'mine/mineSet/lockScreen/lockScreen_page.dart';
|
import 'mine/mineSet/lockScreen/lockScreen_page.dart';
|
||||||
import 'mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_page.dart';
|
import 'mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_page.dart';
|
||||||
|
import 'mine/mineSet/lockUserManage/expireLockList/expireKeyChangeValidityDate/expireKeyChangeValidityDate_page.dart';
|
||||||
import 'mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart';
|
import 'mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart';
|
||||||
import 'mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart';
|
import 'mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart';
|
||||||
import 'mine/supportStaff/supportStaff_page.dart';
|
import 'mine/supportStaff/supportStaff_page.dart';
|
||||||
@ -410,8 +412,8 @@ abstract class Routers {
|
|||||||
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
||||||
static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情
|
static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情
|
||||||
static const expireLockManagePage = '/expireLockManagePage'; //即将到期
|
static const expireLockManagePage = '/expireLockManagePage'; //即将到期
|
||||||
static const expireKeyChangeDatePage =
|
static const expireKeyChangeDatePage = '/ExpireKeyChangeDatePage'; //即将到期卡、指纹、遥控钥匙详情修改日期
|
||||||
'/ExpireKeyChangeDatePage'; //即将到期卡、指纹、遥控钥匙详情修改日期
|
static const expireKeyChangeValidityDatePage = '/ExpireKeyChangeValidityDatePage'; //即将到期卡、指纹、遥控钥匙详情修改循环日期
|
||||||
static const adminDetailChangeDatePage =
|
static const adminDetailChangeDatePage =
|
||||||
'/adminDetailChangeDatePage'; //管理员详情修改生效时间
|
'/adminDetailChangeDatePage'; //管理员详情修改生效时间
|
||||||
static const String adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
static const String adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
||||||
@ -1159,5 +1161,7 @@ abstract class AppRouters {
|
|||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.viewExportRecordPage,
|
name: Routers.viewExportRecordPage,
|
||||||
page: () => const ViewExportRecordPage()),
|
page: () => const ViewExportRecordPage()),
|
||||||
|
GetPage<dynamic>(
|
||||||
|
name: Routers.expireKeyChangeValidityDatePage, page: () => const ExpireKeyChangeValidityDatePage()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -372,21 +372,21 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
endDate: state.endDateTimestamp.value.toString(),
|
endDate: state.endDateTimestamp.value.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced.toString(),
|
isCoerced: state.fingerprintItemData.value.isCoerced.toString(),
|
||||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||||
changeType: "1",
|
changeType: '1',
|
||||||
startTime: state.starTimeTimestamp.value,
|
startTime: state.starTimeTimestamp.value,
|
||||||
endTime: state.endTimeTimestamp.value,
|
endTime: state.endTimeTimestamp.value,
|
||||||
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
||||||
fingerRight: state.fingerprintItemData.value.fingerRight!
|
fingerRight: state.fingerprintItemData.value.fingerRight!
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功".tr, something: (){
|
showToast('修改成功'.tr, something: (){
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
Get.back(result: <String, Object>{
|
Get.back(result: <String, Object>{
|
||||||
"starDate":state.starDateTimestamp.value.toString(),
|
'starDate':state.starDateTimestamp.value.toString(),
|
||||||
"endDate":state.endDateTimestamp.value.toString(),
|
'endDate':state.endDateTimestamp.value.toString(),
|
||||||
"starTime":state.starTimeTimestamp.value.toString(),
|
'starTime':state.starTimeTimestamp.value.toString(),
|
||||||
"endTime":state.endTimeTimestamp.value.toString(),
|
'endTime':state.endTimeTimestamp.value.toString(),
|
||||||
"validityValue":state.weekDay.value,
|
'validityValue':state.weekDay.value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -409,14 +409,14 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
cardRight: state.fingerprintItemData.value.cardRight!,
|
cardRight: state.fingerprintItemData.value.cardRight!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功".tr, something: (){
|
showToast('修改成功'.tr, something: (){
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
Get.back(result: <String, Object>{
|
Get.back(result: <String, Object>{
|
||||||
"starDate":state.starDateTimestamp.value.toString(),
|
'starDate':state.starDateTimestamp.value.toString(),
|
||||||
"endDate":state.endDateTimestamp.value.toString(),
|
'endDate':state.endDateTimestamp.value.toString(),
|
||||||
"starTime":state.starTimeTimestamp.value.toString(),
|
'starTime':state.starTimeTimestamp.value.toString(),
|
||||||
"endTime":state.endTimeTimestamp.value.toString(),
|
'endTime':state.endTimeTimestamp.value.toString(),
|
||||||
"validityValue":state.weekDay.value,
|
'validityValue':state.weekDay.value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -434,19 +434,19 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
faceType: 4,
|
faceType: 4,
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
faceName: state.fingerprintItemData.value.faceName!,
|
faceName: state.fingerprintItemData.value.faceName!,
|
||||||
addType: "1",
|
addType: '1',
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced!,
|
isCoerced: state.fingerprintItemData.value.isCoerced!,
|
||||||
faceRight: state.fingerprintItemData.value.faceRight!,
|
faceRight: state.fingerprintItemData.value.faceRight!,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("修改成功", something: () {
|
showToast('修改成功', something: () {
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
Get.back(result: <String, Object>{
|
Get.back(result: <String, Object>{
|
||||||
"starDate":state.starDateTimestamp.value.toString(),
|
'starDate':state.starDateTimestamp.value.toString(),
|
||||||
"endDate":state.endDateTimestamp.value.toString(),
|
'endDate':state.endDateTimestamp.value.toString(),
|
||||||
"starTime":state.starTimeTimestamp.value.toString(),
|
'starTime':state.starTimeTimestamp.value.toString(),
|
||||||
"endTime":state.endTimeTimestamp.value.toString(),
|
'endTime':state.endTimeTimestamp.value.toString(),
|
||||||
"validityValue":state.weekDay.value,
|
'validityValue':state.weekDay.value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -454,7 +454,6 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
@ -462,14 +461,12 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_state.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||||
@ -22,21 +23,20 @@ class OtherTypeKeyChangeValidityDatePage extends StatefulWidget {
|
|||||||
_OtherTypeKeyChangeValidityDatePageState();
|
_OtherTypeKeyChangeValidityDatePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _OtherTypeKeyChangeValidityDatePageState
|
class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeValidityDatePage> {
|
||||||
extends State<OtherTypeKeyChangeValidityDatePage> {
|
final OtherTypeKeyChangeValidityDateLogic logic = Get.put(OtherTypeKeyChangeValidityDateLogic());
|
||||||
final logic = Get.put(OtherTypeKeyChangeValidityDateLogic());
|
final OtherTypeKeyChangeValidityDateState state = Get.find<OtherTypeKeyChangeValidityDateLogic>().state;
|
||||||
final state = Get.find<OtherTypeKeyChangeValidityDateLogic>().state;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: "修改有效期".tr,
|
barTitle: '修改有效期'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
topWidget(),
|
topWidget(),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
middleWidget(),
|
middleWidget(),
|
||||||
@ -58,18 +58,18 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
|
|
||||||
if (state.starDateTimestamp.value >
|
if (state.starDateTimestamp.value >
|
||||||
state.endDateTimestamp.value) {
|
state.endDateTimestamp.value) {
|
||||||
logic.showToast("失效日期要大于生效日期".tr);
|
logic.showToast('失效日期要大于生效日期'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.weekDay.value.isEmpty){
|
if(state.weekDay.value.isEmpty){
|
||||||
logic.showToast("请选择有效日".tr);
|
logic.showToast('请选择有效日'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.starTimeTimestamp.value >=
|
if (state.starTimeTimestamp.value >=
|
||||||
state.endTimeTimestamp.value) {
|
state.endTimeTimestamp.value) {
|
||||||
logic.showToast("失效时间要大于生效时间".tr);
|
logic.showToast('失效时间要大于生效时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,13 +101,13 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
|
|
||||||
Widget topWidget() {
|
Widget topWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: "生效日期".tr,
|
leftTitel: '生效日期'.tr,
|
||||||
rightTitle: state.starDate.value,
|
rightTitle: state.starDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
@ -116,12 +116,12 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
PDuration.parse(DateTime.tryParse(state.starDate.value));
|
PDuration.parse(DateTime.tryParse(state.starDate.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate,
|
selectDate: selectDate,
|
||||||
mode: DateMode.YMD, onConfirm: (p) {
|
mode: DateMode.YMD, onConfirm: (PDuration p) {
|
||||||
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
|
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: "失效日期".tr,
|
leftTitel: '失效日期'.tr,
|
||||||
rightTitle: state.endDate.value,
|
rightTitle: state.endDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -129,7 +129,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
PDuration.parse(DateTime.tryParse(state.endDate.value));
|
PDuration.parse(DateTime.tryParse(state.endDate.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate,
|
selectDate: selectDate,
|
||||||
mode: DateMode.YMD, onConfirm: (p) {
|
mode: DateMode.YMD, onConfirm: (PDuration p) {
|
||||||
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
|
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
@ -148,7 +148,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
@ -164,7 +164,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
crossAxisCount: 7, childAspectRatio: 1.0),
|
crossAxisCount: 7, childAspectRatio: 1.0),
|
||||||
itemCount: 7,
|
itemCount: 7,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
index += 1;
|
index += 1;
|
||||||
return btnItem(index);
|
return btnItem(index);
|
||||||
})),
|
})),
|
||||||
@ -198,7 +198,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
dateStr = TranslationLoader.lanKeys!.sundayShort!.tr;
|
dateStr = TranslationLoader.lanKeys!.sundayShort!.tr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dateStr = "";
|
dateStr = '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@ -238,11 +238,11 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
|
|
||||||
Widget bottomWidget() {
|
Widget bottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
||||||
@ -253,7 +253,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.starTime.value, 0));
|
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.starTime.value, 0));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate,
|
selectDate: selectDate,
|
||||||
mode: DateMode.HM, onConfirm: (p) {
|
mode: DateMode.HM, onConfirm: (PDuration p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.starTime.value =
|
state.starTime.value =
|
||||||
DateTool().getYMDHNDateString(p, 3);
|
DateTool().getYMDHNDateString(p, 3);
|
||||||
@ -269,7 +269,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
|||||||
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
|
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate,
|
selectDate: selectDate,
|
||||||
mode: DateMode.HM, onConfirm: (p) {
|
mode: DateMode.HM, onConfirm: (PDuration p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.endTime.value =
|
state.endTime.value =
|
||||||
DateTool().getYMDHNDateString(p, 3);
|
DateTool().getYMDHNDateString(p, 3);
|
||||||
|
|||||||
@ -4,28 +4,12 @@ import 'package:get/get.dart';
|
|||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
class OtherTypeKeyChangeValidityDateState{
|
class OtherTypeKeyChangeValidityDateState{// 0普通状态(可用) 1连接中(不可用)
|
||||||
final fingerprintItemData = FingerprintItemData().obs;
|
|
||||||
|
|
||||||
var starDate = "".obs;// 开始时间
|
|
||||||
var endDate = "".obs;// 结束时间
|
|
||||||
var starTime = "".obs;// 生效时间
|
|
||||||
var endTime = "".obs;// 失效时间
|
|
||||||
|
|
||||||
var starDateTimestamp = 0.obs;// 开始时间
|
|
||||||
var endDateTimestamp = 0.obs;// 结束时间
|
|
||||||
var starTimeTimestamp = 0.obs;// 生效时间
|
|
||||||
var endTimeTimestamp = 0.obs;// 失效时间
|
|
||||||
|
|
||||||
var pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸
|
|
||||||
var weekDay = [].obs;
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
|
||||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
|
||||||
|
|
||||||
OtherTypeKeyChangeValidityDateState() {
|
OtherTypeKeyChangeValidityDateState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
pushType.value = map["pushType"];
|
pushType.value = map['pushType'];
|
||||||
fingerprintItemData.value = map["fingerprintItemData"];
|
fingerprintItemData.value = map['fingerprintItemData'];
|
||||||
|
|
||||||
starDate.value = DateTool().dateToYMDString(fingerprintItemData.value.startDate.toString());
|
starDate.value = DateTool().dateToYMDString(fingerprintItemData.value.startDate.toString());
|
||||||
endDate.value = DateTool().dateToYMDString(fingerprintItemData.value.endDate.toString());
|
endDate.value = DateTool().dateToYMDString(fingerprintItemData.value.endDate.toString());
|
||||||
@ -33,4 +17,20 @@ class OtherTypeKeyChangeValidityDateState{
|
|||||||
endTime.value = DateTool().dateToHNString(fingerprintItemData.value.endDate.toString());
|
endTime.value = DateTool().dateToHNString(fingerprintItemData.value.endDate.toString());
|
||||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||||
}
|
}
|
||||||
|
final Rx<FingerprintItemData> fingerprintItemData = FingerprintItemData().obs;
|
||||||
|
|
||||||
|
RxString starDate = ''.obs;// 开始时间
|
||||||
|
RxString endDate = ''.obs;// 结束时间
|
||||||
|
RxString starTime = ''.obs;// 生效时间
|
||||||
|
RxString endTime = ''.obs;// 失效时间
|
||||||
|
|
||||||
|
RxInt starDateTimestamp = 0.obs;// 开始时间
|
||||||
|
RxInt endDateTimestamp = 0.obs;// 结束时间
|
||||||
|
RxInt starTimeTimestamp = 0.obs;// 生效时间
|
||||||
|
RxInt endTimeTimestamp = 0.obs;// 失效时间
|
||||||
|
|
||||||
|
RxInt pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸
|
||||||
|
RxList weekDay = [].obs;
|
||||||
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
RxInt sureBtnState = 0.obs;
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ import '../../../../../blue/sender_manage.dart';
|
|||||||
import '../../../../../network/api_repository.dart';
|
import '../../../../../network/api_repository.dart';
|
||||||
import '../../../../../tools/baseGetXController.dart';
|
import '../../../../../tools/baseGetXController.dart';
|
||||||
import '../../../../../tools/storage.dart';
|
import '../../../../../tools/storage.dart';
|
||||||
|
import '../../../../app_settings/app_settings.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
class AddFaceLogic extends BaseGetXController {
|
class AddFaceLogic extends BaseGetXController {
|
||||||
@ -53,7 +54,7 @@ class AddFaceLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 最大图片数
|
// 最大图片数
|
||||||
state.maxRegCount.value = reply.data[11];
|
state.maxRegCount.value = reply.data[11];
|
||||||
// AppLog.log("人脸开始state.maxRegCount.value:${state.maxRegCount.value}");
|
AppLog.log('人脸开始state.maxRegCount.value:${state.maxRegCount.value}');
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
@ -137,7 +138,7 @@ class AddFaceLogic extends BaseGetXController {
|
|||||||
// 添加人脸中
|
// 添加人脸中
|
||||||
// 当前注册数
|
// 当前注册数
|
||||||
state.regIndex.value = reply.data[6];
|
state.regIndex.value = reply.data[6];
|
||||||
// AppLog.log("注册人脸过程state.regIndex.value:${state.regIndex.value}");
|
AppLog.log('注册人脸过程state.regIndex.value:${state.regIndex.value}');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +222,7 @@ class AddFaceLogic extends BaseGetXController {
|
|||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/face/addFace/addFace_logic.dart';
|
import 'package:star_lock/main/lockDetail/face/addFace/addFace_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/face/addFace/addFace_state.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/submitBtn.dart';
|
import '../../../../../tools/submitBtn.dart';
|
||||||
@ -18,20 +19,19 @@ class AddFacePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AddFacePageState extends State<AddFacePage> with RouteAware {
|
class _AddFacePageState extends State<AddFacePage> with RouteAware {
|
||||||
final logic = Get.put(AddFaceLogic());
|
final AddFaceLogic logic = Get.put(AddFaceLogic());
|
||||||
final state = Get.find<AddFaceLogic>().state;
|
final AddFaceState state = Get.find<AddFaceLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle:
|
barTitle: '${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}',
|
||||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
|
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
),
|
),
|
||||||
@ -50,10 +50,10 @@ class _AddFacePageState extends State<AddFacePage> with RouteAware {
|
|||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
"请单人正对门锁,距离一个成年人手臂长度\n(约0.6米)。\n保持脸部无遮挡,露出五官。",
|
'请单人正对门锁,距离一个成年人手臂长度\n(约0.6米)。\n保持脸部无遮挡,露出五官。',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
style:
|
style:
|
||||||
@ -71,7 +71,7 @@ class _AddFacePageState extends State<AddFacePage> with RouteAware {
|
|||||||
? Container(
|
? Container(
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: "准备好了,开始添加",
|
btnName: '准备好了,开始添加',
|
||||||
borderRadius: 20.w,
|
borderRadius: 20.w,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
state.isClickAddFace.value = true;
|
state.isClickAddFace.value = true;
|
||||||
@ -80,13 +80,27 @@ class _AddFacePageState extends State<AddFacePage> with RouteAware {
|
|||||||
)
|
)
|
||||||
: Row(
|
: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Column(
|
||||||
'正在录入中...',
|
children: <Widget>[
|
||||||
style: TextStyle(
|
Text(
|
||||||
color: AppColors.darkGrayTextColor,
|
'正在录入中...',
|
||||||
fontSize: 22.sp),
|
style: TextStyle(
|
||||||
textAlign: TextAlign.center,
|
color: AppColors.darkGrayTextColor,
|
||||||
|
fontSize: 22.sp),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: state.maxRegCount.value > 1,
|
||||||
|
child: Text(
|
||||||
|
'${state.regIndex.value}/${state.maxRegCount.value}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor,
|
||||||
|
fontSize: 22.sp),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -98,7 +112,6 @@ class _AddFacePageState extends State<AddFacePage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
// TODO: implement didChangeDependencies
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
/// 路由订阅
|
/// 路由订阅
|
||||||
@ -107,7 +120,6 @@ class _AddFacePageState extends State<AddFacePage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|||||||
@ -1,58 +1,59 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../../../tools/commonDataManage.dart';
|
import '../../../../tools/commonDataManage.dart';
|
||||||
|
|
||||||
class AddFaceState {
|
class AddFaceState {
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
var ifAddState = false.obs;// 是否是添加状态,如果是添加状态,返回上级界面发送取消添加指令
|
RxBool ifAddState = false.obs;// 是否是添加状态,如果是添加状态,返回上级界面发送取消添加指令
|
||||||
|
|
||||||
var ifConnectScuess = false.obs;
|
RxBool ifConnectScuess = false.obs;
|
||||||
var maxRegCount = 0.obs; // 最大注册次数
|
RxInt maxRegCount = 0.obs; // 最大注册次数
|
||||||
var regIndex = 0.obs; // 当前注册次数
|
RxInt regIndex = 0.obs; // 当前注册次数
|
||||||
|
|
||||||
var faceNumber = "".obs;
|
RxString faceNumber = ''.obs;
|
||||||
|
|
||||||
final lockId = 0.obs;
|
final RxInt lockId = 0.obs;
|
||||||
final endDate = "".obs;
|
final RxString endDate = ''.obs;
|
||||||
final addType = "".obs;
|
final RxString addType = ''.obs;
|
||||||
final faceName = "".obs;
|
final RxString faceName = ''.obs;
|
||||||
final faceType = 0.obs;
|
final RxInt faceType = 0.obs;
|
||||||
// final cyclicConfig = [].obs;
|
// final cyclicConfig = [].obs;
|
||||||
final featureData = ''.obs;
|
final RxString featureData = ''.obs;
|
||||||
final isClickAddFace = false.obs;
|
final RxBool isClickAddFace = false.obs;
|
||||||
|
|
||||||
final isCoerced = "".obs;
|
final RxString isCoerced = ''.obs;
|
||||||
final isAdministrator = "".obs;
|
final RxString isAdministrator = ''.obs;
|
||||||
final startDate = "".obs;
|
final RxString startDate = ''.obs;
|
||||||
final weekDay = [].obs;
|
final RxList weekDay = [].obs;
|
||||||
final fromType = 0.obs;
|
final RxInt fromType = 0.obs;
|
||||||
final effectiveDateTime = "".obs; // 生效时间
|
final RxString effectiveDateTime = ''.obs; // 生效时间
|
||||||
final failureDateTime = "".obs; // 失效时间
|
final RxString failureDateTime = ''.obs; // 失效时间
|
||||||
final selectType = "0".obs; // 0永久 1显示 2循环
|
final RxString selectType = '0'.obs; // 0永久 1显示 2循环
|
||||||
|
|
||||||
AddFaceState() {
|
AddFaceState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
lockId.value = map["lockId"];
|
lockId.value = map['lockId'];
|
||||||
addType.value = map["addType"];
|
addType.value = map['addType'];
|
||||||
faceName.value = map["faceName"];
|
faceName.value = map['faceName'];
|
||||||
faceType.value = map["faceType"];
|
faceType.value = map['faceType'];
|
||||||
startDate.value = map["startDate"];
|
startDate.value = map['startDate'];
|
||||||
lockId.value = map["lockId"];
|
lockId.value = map['lockId'];
|
||||||
weekDay.value = map["cyclicConfig"];
|
weekDay.value = map['cyclicConfig'];
|
||||||
fromType.value = map["fromType"];
|
fromType.value = map['fromType'];
|
||||||
isAdministrator.value = map["isAdministrator"];
|
isAdministrator.value = map['isAdministrator'];
|
||||||
startDate.value = map["startDate"];
|
startDate.value = map['startDate'];
|
||||||
// weekDay.value = map["weekDay"];
|
// weekDay.value = map["weekDay"];
|
||||||
fromType.value = map["fromType"];
|
fromType.value = map['fromType'];
|
||||||
effectiveDateTime.value = map["effectiveTime"];
|
effectiveDateTime.value = map['effectiveTime'];
|
||||||
failureDateTime.value = map["failureTime"];
|
failureDateTime.value = map['failureTime'];
|
||||||
selectType.value = map["selectType"];
|
selectType.value = map['selectType'];
|
||||||
//循环类型下,结束时间加一天
|
//循环类型下,结束时间加一天
|
||||||
if (selectType.value == '2') {
|
if (selectType.value == '2') {
|
||||||
endDate.value =
|
endDate.value =
|
||||||
"${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}";
|
"${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}";
|
||||||
} else {
|
} else {
|
||||||
endDate.value = map["endDate"];
|
endDate.value = map['endDate'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,9 +98,9 @@ class ExpireCardItemEntity {
|
|||||||
cardStatus = json['cardStatus'];
|
cardStatus = json['cardStatus'];
|
||||||
cardType = json['cardType'];
|
cardType = json['cardType'];
|
||||||
cardRight = json['cardRight'];
|
cardRight = json['cardRight'];
|
||||||
if (json['weekDays'] != null) {
|
if (json['weekDay'] != null) {
|
||||||
weekDay = [];
|
weekDay = [];
|
||||||
json['weekDays'].forEach((v) {
|
json['weekDay'].forEach((v) {
|
||||||
weekDay!.add(v);
|
weekDay!.add(v);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import 'package:star_lock/blue/blue_manage.dart';
|
|||||||
import 'package:star_lock/blue/io_reply.dart';
|
import 'package:star_lock/blue/io_reply.dart';
|
||||||
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||||
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/dateTool.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddICCardBegin(reply);
|
_replyAddICCardBegin(reply);
|
||||||
@ -34,7 +34,7 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 添加卡片开始(此处用作删除卡片)
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -45,20 +45,20 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:"1",
|
keyID:'1',
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
cardNo:state.deletExpireCardItemEntity.cardUserNo!,
|
cardNo:state.deletExpireCardItemEntity.cardUserNo!,
|
||||||
useCountLimit:0xffff,
|
useCountLimit:0xffff,
|
||||||
@ -69,8 +69,8 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
weekRound:0, // 周循环
|
weekRound:0, // 周循环
|
||||||
startDate: 0x11223344,
|
startDate: 0x11223344,
|
||||||
endDate: 0x11223344,
|
endDate: 0x11223344,
|
||||||
startTime:"0",
|
startTime:'0',
|
||||||
endTime:"0",
|
endTime:'0',
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -100,17 +100,17 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:"1",
|
keyID:'1',
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
cardNo:state.deletExpireCardItemEntity.cardUserNo!,
|
cardNo:state.deletExpireCardItemEntity.cardUserNo!,
|
||||||
useCountLimit:0xffff,
|
useCountLimit:0xffff,
|
||||||
@ -121,8 +121,8 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
weekRound:0, // 周循环
|
weekRound:0, // 周循环
|
||||||
startDate: 0x11223344,
|
startDate: 0x11223344,
|
||||||
endDate: 0x11223344,
|
endDate: 0x11223344,
|
||||||
startTime:"0",
|
startTime:'0',
|
||||||
endTime:"0",
|
endTime:'0',
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -141,36 +141,39 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//请求卡即将到期列表
|
//请求卡即将到期列表
|
||||||
Future<ExpireCardEntity> expirCardListRequest() async {
|
Future<ExpireCardEntity> expirCardListRequest({required bool isRefresh, bool isRefreshLockUserManageList = false}) async {
|
||||||
ExpireCardEntity entity = await ApiRepository.to.expireCardList(pageNo.toString(), pageSize.toString());
|
if (isRefresh) {
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
state.dataList.clear();
|
||||||
if (pageNo == 1) {
|
pageNo = 1;
|
||||||
state.dataList.value = entity.data!.list!;
|
}
|
||||||
pageNo++;
|
final ExpireCardEntity entity = await ApiRepository.to.expireCardList(pageNo.toString(), pageSize.toString());
|
||||||
} else {
|
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.dataList.value.addAll(entity.data!.list!);
|
// 更新数据列表
|
||||||
pageNo++;
|
state.dataList.addAll(entity.data!.list!);
|
||||||
}
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
|
||||||
|
if(isRefreshLockUserManageList){
|
||||||
|
eventBus.fire(LockUserManageListRefreshUI());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除IC卡
|
// 删除IC卡
|
||||||
void deletICCardData() async{
|
Future<void> deletICCardData() async{
|
||||||
var entity = await ApiRepository.to.deletIcCardData(
|
final LoginEntity entity = await ApiRepository.to.deletIcCardData(
|
||||||
cardId: state.deletExpireCardItemEntity.cardId.toString(),
|
cardId: state.deletExpireCardItemEntity.cardId.toString(),
|
||||||
lockId: state.deletExpireCardItemEntity.lockId.toString(),
|
lockId: state.deletExpireCardItemEntity.lockId.toString(),
|
||||||
type: "0",
|
type: '0',
|
||||||
deleteType:"1"
|
deleteType:'1'
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("删除成功", something: (){
|
showToast('删除成功', something: (){
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
expirCardListRequest();
|
expirCardListRequest(isRefresh: true, isRefreshLockUserManageList: true);
|
||||||
eventBus.fire(LockUserManageListRefreshUI());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,7 +191,6 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
@ -196,14 +198,12 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
|
|||||||
@ -26,8 +26,8 @@ class _ExpireCardPageState extends State<ExpireCardPage> with RouteAware {
|
|||||||
final ExpireCardLogic logic = Get.put(ExpireCardLogic());
|
final ExpireCardLogic logic = Get.put(ExpireCardLogic());
|
||||||
final ExpireCardState state = Get.find<ExpireCardLogic>().state;
|
final ExpireCardState state = Get.find<ExpireCardLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
logic.expirCardListRequest().then((ExpireCardEntity value){
|
logic.expirCardListRequest(isRefresh: isRefresh).then((ExpireCardEntity value){
|
||||||
if(mounted) {
|
if(mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ class _ExpireCardPageState extends State<ExpireCardPage> with RouteAware {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,12 +46,12 @@ class _ExpireCardPageState extends State<ExpireCardPage> with RouteAware {
|
|||||||
return EasyRefreshTool(
|
return EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: (){
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: (){
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Obx(() => _buildMainUI())
|
child: Obx(_buildMainUI)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,23 +99,45 @@ class _ExpireCardPageState extends State<ExpireCardPage> with RouteAware {
|
|||||||
Widget _electronicKeyItem(ExpireCardItemEntity itemData) {
|
Widget _electronicKeyItem(ExpireCardItemEntity itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var data = await Get.toNamed(Routers.expireKeyChangeDatePage, arguments: {
|
if(itemData.cardType == 4){
|
||||||
'pushType': 0,
|
var data = await Get.toNamed(Routers.expireKeyChangeValidityDatePage, arguments: {
|
||||||
'lockName': itemData.lockInfo!.btDeviceName,
|
'pushType': 0,
|
||||||
'startDate': itemData.startDate,
|
'lockName': itemData.lockInfo!.btDeviceName,
|
||||||
'endDate': itemData.endDate,
|
'startDate': itemData.startDate,
|
||||||
'lockId': itemData.lockId,
|
'endDate': itemData.endDate,
|
||||||
'keyID': itemData.cardId,
|
'lockId': itemData.lockId,
|
||||||
'keyNumber': int.parse(itemData.cardNumber!),
|
'keyID': itemData.cardId,
|
||||||
'keyName': itemData.nickname,
|
'keyNumber': int.parse(itemData.cardNumber!),
|
||||||
'isAdmin': itemData.cardRight,
|
'keyName': itemData.nickname,
|
||||||
'isForce': itemData.isCoerced,
|
'isAdmin': itemData.cardRight,
|
||||||
});
|
'isForce': itemData.isCoerced,
|
||||||
if(data != null) {
|
'weekDay': itemData.weekDay,
|
||||||
setState(() {
|
|
||||||
logic.pageNo = 1;
|
|
||||||
getHttpData();
|
|
||||||
});
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
logic.pageNo = 1;
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var data = await Get.toNamed(Routers.expireKeyChangeDatePage, arguments: {
|
||||||
|
'pushType': 0,
|
||||||
|
'lockName': itemData.lockInfo!.btDeviceName,
|
||||||
|
'startDate': itemData.startDate,
|
||||||
|
'endDate': itemData.endDate,
|
||||||
|
'lockId': itemData.lockId,
|
||||||
|
'keyID': itemData.cardId,
|
||||||
|
'keyNumber': int.parse(itemData.cardNumber!),
|
||||||
|
'keyName': itemData.nickname,
|
||||||
|
'isAdmin': itemData.cardRight,
|
||||||
|
'isForce': itemData.isCoerced,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
logic.pageNo = 1;
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@ -14,17 +14,21 @@ class ExpireLockListLogic extends BaseGetXController{
|
|||||||
ExpireLockListState state = ExpireLockListState();
|
ExpireLockListState state = ExpireLockListState();
|
||||||
|
|
||||||
//请求即将到期列表
|
//请求即将到期列表
|
||||||
Future<ExpireLockListEntity> expireLockListRequest() async {
|
Future<ExpireLockListEntity> expireLockListRequest({required bool isRefresh, bool isRefreshLockUserManageList = false}) async {
|
||||||
ExpireLockListEntity entity = await ApiRepository.to.expireLockList(pageNo.toString(), pageSize.toString());
|
if (isRefresh) {
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
state.dataList.clear();
|
||||||
if (pageNo == 1) {
|
pageNo = 1;
|
||||||
state.dataList.value = entity.data!.itemList!;
|
}
|
||||||
pageNo++;
|
|
||||||
} else {
|
final ExpireLockListEntity entity = await ApiRepository.to.expireLockList(pageNo.toString(), pageSize.toString());
|
||||||
if (entity.data!.itemList!.isNotEmpty) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.dataList.value.addAll(entity.data!.itemList!);
|
// 更新数据列表
|
||||||
pageNo++;
|
state.dataList.addAll(entity.data!.itemList!);
|
||||||
}
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
|
||||||
|
if(isRefreshLockUserManageList){
|
||||||
|
eventBus.fire(LockUserManageListRefreshUI());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
@ -32,15 +36,13 @@ class ExpireLockListLogic extends BaseGetXController{
|
|||||||
|
|
||||||
//删除电子钥匙名称请求
|
//删除电子钥匙名称请求
|
||||||
Future<void> deleteKeyRequest(int includeUnderlings, ExpireLockItem expireLockItem) async {
|
Future<void> deleteKeyRequest(int includeUnderlings, ExpireLockItem expireLockItem) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
final ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
||||||
keyId:expireLockItem.keyId.toString(),
|
keyId:expireLockItem.keyId.toString(),
|
||||||
includeUnderlings: includeUnderlings
|
includeUnderlings: includeUnderlings
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功", something: () {
|
showToast('删除成功', something: () {
|
||||||
pageNo = 1;
|
expireLockListRequest(isRefresh: true, isRefreshLockUserManageList: true);
|
||||||
expireLockListRequest();
|
|
||||||
eventBus.fire(LockUserManageListRefreshUI());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +66,7 @@ class ExpireLockListLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
// 普通用户
|
// 普通用户
|
||||||
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效", (){
|
ShowTipView().showIosTipWithContentDialog('删除钥匙会在用户APP连网后生效', (){
|
||||||
deleteKeyRequest(0, expireLockItem);
|
deleteKeyRequest(0, expireLockItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,8 +25,8 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
final ExpireLockListLogic logic = Get.put(ExpireLockListLogic());
|
final ExpireLockListLogic logic = Get.put(ExpireLockListLogic());
|
||||||
final ExpireLockListState state = Get.find<ExpireLockListLogic>().state;
|
final ExpireLockListState state = Get.find<ExpireLockListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
logic.expireLockListRequest().then((ExpireLockListEntity value){
|
logic.expireLockListRequest(isRefresh: isRefresh).then((ExpireLockListEntity value){
|
||||||
if(mounted) setState(() {});
|
if(mounted) setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -35,31 +35,29 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return EasyRefreshTool(
|
return EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: (){
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: (){
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Obx(_buildMainUI)
|
child: _buildMainUI()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return state.dataList.isEmpty
|
return Obx(() => state.dataList.isNotEmpty
|
||||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
? SlidableAutoCloseBehavior(
|
||||||
: SlidableAutoCloseBehavior(
|
child: ListView.separated(
|
||||||
child: ListView.separated(
|
itemCount: state.dataList.length,
|
||||||
itemCount: state.dataList.length,
|
itemBuilder: (BuildContext c, int index) {
|
||||||
itemBuilder: (BuildContext c, int index) {
|
final ExpireLockItem indexEntity = state.dataList[index];
|
||||||
ExpireLockItem indexEntity = state.dataList[index];
|
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key:ValueKey(indexEntity.uid),
|
key:ValueKey(indexEntity.uid),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
@ -79,15 +77,16 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
),
|
),
|
||||||
child: _electronicKeyItem(indexEntity),
|
child: _electronicKeyItem(indexEntity),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return const Divider(
|
return const Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: AppColors.greyLineColor,
|
color: AppColors.greyLineColor,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
|
: NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
||||||
@ -95,7 +94,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
if(itemData.keyType! == 4){
|
if(itemData.keyType! == 4){
|
||||||
// 循环
|
// 循环
|
||||||
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: <String, Object>{
|
final data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: <String, Object>{
|
||||||
'pushType': 0,
|
'pushType': 0,
|
||||||
'expireLockItem': itemData,
|
'expireLockItem': itemData,
|
||||||
});
|
});
|
||||||
@ -107,11 +106,10 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
// state.endTime.value = data["endTime"];
|
// state.endTime.value = data["endTime"];
|
||||||
// state.weekDay.value = data["validityValue"];
|
// state.weekDay.value = data["validityValue"];
|
||||||
// });
|
// });
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: <String, Object>{
|
final data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: <String, Object>{
|
||||||
'pushType': 0,
|
'pushType': 0,
|
||||||
'expireLockItem': itemData,
|
'expireLockItem': itemData,
|
||||||
});
|
});
|
||||||
@ -120,8 +118,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
// state.starDate.value = data["beginTimeTimestamp"].toString();
|
// state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||||
// state.endDate.value = data["endTimeTimestamp"].toString();
|
// state.endDate.value = data["endTimeTimestamp"].toString();
|
||||||
// state.keyType.value = 2;
|
// state.keyType.value = 2;
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import 'expireLockList_entity.dart';
|
import 'expireLockList_entity.dart';
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import '../../../../../blue/io_tool/io_tool.dart';
|
|||||||
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../../../blue/sender_manage.dart';
|
import '../../../../../blue/sender_manage.dart';
|
||||||
import '../../../../../network/api_repository.dart';
|
import '../../../../../network/api_repository.dart';
|
||||||
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../../tools/storage.dart';
|
import '../../../../../tools/storage.dart';
|
||||||
import 'expireFace_entity.dart';
|
import 'expireFace_entity.dart';
|
||||||
import 'expireFace_state.dart';
|
import 'expireFace_state.dart';
|
||||||
@ -135,24 +136,38 @@ class ExpireFaceLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('删除成功', something: (){
|
showToast('删除成功', something: (){
|
||||||
pageNo = 1;
|
expireFaceList(isRefresh: true, isRefreshLockUserManageList: true);
|
||||||
expireFaceList();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求人脸即将到期列表
|
//请求人脸即将到期列表
|
||||||
Future<ExpireFaceEntity> expireFaceList() async {
|
Future<ExpireFaceEntity> expireFaceList({required bool isRefresh, bool isRefreshLockUserManageList = false}) async {
|
||||||
|
if (isRefresh) {
|
||||||
|
state.dataList.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
final ExpireFaceEntity entity = await ApiRepository.to.expireFaceList(pageNo.toString(), pageSize.toString());
|
final ExpireFaceEntity entity = await ApiRepository.to.expireFaceList(pageNo.toString(), pageSize.toString());
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
// if(entity.errorCode!.codeIsSuccessful){
|
||||||
if (pageNo == 1) {
|
// if (pageNo == 1) {
|
||||||
state.dataList.value = entity.data!.list!;
|
// state.dataList.value = entity.data!.list!;
|
||||||
pageNo++;
|
// pageNo++;
|
||||||
} else {
|
// } else {
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
// if (entity.data!.list!.isNotEmpty) {
|
||||||
state.dataList.value.addAll(entity.data!.list!);
|
// state.dataList.value.addAll(entity.data!.list!);
|
||||||
pageNo++;
|
// pageNo++;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// 更新数据列表
|
||||||
|
state.dataList.addAll(entity.data!.list!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
|
||||||
|
if(isRefreshLockUserManageList){
|
||||||
|
eventBus.fire(LockUserManageListRefreshUI());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
|
|||||||
@ -26,8 +26,8 @@ class _ExpireFacePageState extends State<ExpireFacePage> with RouteAware {
|
|||||||
final ExpireFaceLogic logic = Get.put(ExpireFaceLogic());
|
final ExpireFaceLogic logic = Get.put(ExpireFaceLogic());
|
||||||
final ExpireFaceState state = Get.find<ExpireFaceLogic>().state;
|
final ExpireFaceState state = Get.find<ExpireFaceLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
logic.expireFaceList().then((ExpireFaceEntity value){
|
logic.expireFaceList(isRefresh:isRefresh).then((ExpireFaceEntity value){
|
||||||
if(mounted) {
|
if(mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ class _ExpireFacePageState extends State<ExpireFacePage> with RouteAware {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,10 +46,10 @@ class _ExpireFacePageState extends State<ExpireFacePage> with RouteAware {
|
|||||||
return EasyRefreshTool(
|
return EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: (){
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: (){
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Obx(_buildMainUI)
|
child: Obx(_buildMainUI)
|
||||||
);
|
);
|
||||||
@ -99,23 +99,43 @@ class _ExpireFacePageState extends State<ExpireFacePage> with RouteAware {
|
|||||||
Widget _electronicKeyItem(ExpireFaceListItemEntity itemData) {
|
Widget _electronicKeyItem(ExpireFaceListItemEntity itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var data = await Get.toNamed(Routers.expireKeyChangeDatePage, arguments: {
|
if(itemData.faceType == 4){
|
||||||
'pushType': 3,
|
var data = await Get.toNamed(Routers.expireKeyChangeValidityDatePage, arguments: {
|
||||||
'lockName': itemData.lockInfo!.btDeviceName,
|
'pushType': 3,
|
||||||
'startDate': itemData.startDate,
|
'lockName': itemData.lockInfo!.btDeviceName,
|
||||||
'endDate': itemData.endDate,
|
'startDate': itemData.startDate,
|
||||||
'lockId': itemData.lockId,
|
'endDate': itemData.endDate,
|
||||||
'keyID': itemData.faceId,
|
'lockId': itemData.lockId,
|
||||||
'keyNumber': int.parse(itemData.faceNumber!),
|
'keyID': itemData.faceId,
|
||||||
'keyName': itemData.nickname,
|
'keyNumber': int.parse(itemData.faceNumber!),
|
||||||
'isAdmin': itemData.faceRight,
|
'keyName': itemData.nickname,
|
||||||
'isForce': itemData.isCoerced,
|
'isAdmin': itemData.faceRight,
|
||||||
});
|
'isForce': itemData.isCoerced,
|
||||||
if(data != null) {
|
'weekDay': itemData.weekDay,
|
||||||
setState(() {
|
|
||||||
logic.pageNo = 1;
|
|
||||||
getHttpData();
|
|
||||||
});
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var data = await Get.toNamed(Routers.expireKeyChangeDatePage, arguments: {
|
||||||
|
'pushType': 3,
|
||||||
|
'lockName': itemData.lockInfo!.btDeviceName,
|
||||||
|
'startDate': itemData.startDate,
|
||||||
|
'endDate': itemData.endDate,
|
||||||
|
'lockId': itemData.lockId,
|
||||||
|
'keyID': itemData.faceId,
|
||||||
|
'keyNumber': int.parse(itemData.faceNumber!),
|
||||||
|
'keyName': itemData.nickname,
|
||||||
|
'isAdmin': itemData.faceRight,
|
||||||
|
'isForce': itemData.isCoerced,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@ -98,9 +98,9 @@ class ExpireFingerprintItemEntity {
|
|||||||
fingerprintType = json['fingerprintType'];
|
fingerprintType = json['fingerprintType'];
|
||||||
startDate = json['startDate'];
|
startDate = json['startDate'];
|
||||||
endDate = json['endDate'];
|
endDate = json['endDate'];
|
||||||
if (json['weekDays'] != null) {
|
if (json['weekDay'] != null) {
|
||||||
weekDay = [];
|
weekDay = [];
|
||||||
json['weekDays'].forEach((v) {
|
json['weekDay'].forEach((v) {
|
||||||
weekDay!.add(v);
|
weekDay!.add(v);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,25 +145,26 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
|||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast('删除成功',something: (){
|
showToast('删除成功',something: (){
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
pageNo = 1;
|
expirFingerprintListRequest(isRefresh: true, isRefreshLockUserManageList: true);
|
||||||
expirFingerprintListRequest();
|
|
||||||
eventBus.fire(LockUserManageListRefreshUI());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求指纹即将到期列表
|
//请求指纹即将到期列表
|
||||||
Future<ExpireFingerprintEntity> expirFingerprintListRequest() async {
|
Future<ExpireFingerprintEntity> expirFingerprintListRequest({required bool isRefresh, bool isRefreshLockUserManageList = false}) async {
|
||||||
|
if (isRefresh) {
|
||||||
|
state.dataList.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
final ExpireFingerprintEntity entity = await ApiRepository.to.expireFingerprintList(pageNo.toString(), pageSize.toString());
|
final ExpireFingerprintEntity entity = await ApiRepository.to.expireFingerprintList(pageNo.toString(), pageSize.toString());
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
// 更新数据列表
|
||||||
state.dataList.value = entity.data!.list!;
|
state.dataList.addAll(entity.data!.list!);
|
||||||
pageNo++;
|
// 更新页码
|
||||||
} else {
|
pageNo++;
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
|
||||||
state.dataList.value.addAll(entity.data!.list!);
|
if(isRefreshLockUserManageList){
|
||||||
pageNo++;
|
eventBus.fire(LockUserManageListRefreshUI());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
|
|||||||
@ -25,8 +25,8 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> with Rout
|
|||||||
final ExpireFingerprintLogic logic = Get.put(ExpireFingerprintLogic());
|
final ExpireFingerprintLogic logic = Get.put(ExpireFingerprintLogic());
|
||||||
final ExpireFingerprintState state = Get.find<ExpireFingerprintLogic>().state;
|
final ExpireFingerprintState state = Get.find<ExpireFingerprintLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
logic.expirFingerprintListRequest().then((ExpireFingerprintEntity value) {
|
logic.expirFingerprintListRequest(isRefresh: isRefresh).then((ExpireFingerprintEntity value) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -37,89 +37,110 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> with Rout
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return EasyRefreshTool(
|
return EasyRefreshTool(
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
onLoad: () {
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Obx(_buildMainUI));
|
child: _buildMainUI()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return state.dataList.isEmpty
|
return Obx(()=>state.dataList.isNotEmpty
|
||||||
? NoData(
|
? SlidableAutoCloseBehavior(
|
||||||
noDataHeight: 1.sh -
|
child: ListView.separated(
|
||||||
ScreenUtil().statusBarHeight -
|
itemCount: state.dataList.length,
|
||||||
ScreenUtil().bottomBarHeight -
|
itemBuilder: (BuildContext c, int index) {
|
||||||
190.h -
|
final ExpireFingerprintItemEntity indexEntity = state.dataList[index];
|
||||||
64.h)
|
return Slidable(
|
||||||
: SlidableAutoCloseBehavior(
|
key: ValueKey(indexEntity.uid),
|
||||||
child: ListView.separated(
|
endActionPane: ActionPane(
|
||||||
itemCount: state.dataList.length,
|
extentRatio: 0.2,
|
||||||
itemBuilder: (BuildContext c, int index) {
|
motion: const ScrollMotion(),
|
||||||
final ExpireFingerprintItemEntity indexEntity = state.dataList[index];
|
children: <Widget>[
|
||||||
return Slidable(
|
SlidableAction(
|
||||||
key: ValueKey(indexEntity.uid),
|
onPressed: (BuildContext context) {
|
||||||
endActionPane: ActionPane(
|
ShowTipView().showIosTipWithContentDialog('确定删除指纹吗?', () {
|
||||||
extentRatio: 0.2,
|
state.deletExpireFingerprintItemEntity = indexEntity;
|
||||||
motion: const ScrollMotion(),
|
logic.senderAddFingerprint();
|
||||||
children: <Widget>[
|
});
|
||||||
SlidableAction(
|
},
|
||||||
onPressed: (BuildContext context) {
|
backgroundColor: Colors.red,
|
||||||
ShowTipView().showIosTipWithContentDialog('确定删除指纹吗?', () {
|
foregroundColor: Colors.white,
|
||||||
state.deletExpireFingerprintItemEntity =
|
label: '删除',
|
||||||
indexEntity;
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
logic.senderAddFingerprint();
|
),
|
||||||
});
|
],
|
||||||
},
|
|
||||||
backgroundColor: Colors.red,
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
label: '删除',
|
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: _electronicKeyItem(indexEntity),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
child: _electronicKeyItem(indexEntity),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: NoData(
|
||||||
|
noDataHeight: 1.sh -
|
||||||
|
ScreenUtil().statusBarHeight -
|
||||||
|
ScreenUtil().bottomBarHeight -
|
||||||
|
190.h -
|
||||||
|
64.h));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) {
|
Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var data = await Get.toNamed(Routers.expireKeyChangeDatePage, arguments: {
|
if(itemData.fingerprintType == 4){
|
||||||
'pushType': 1,
|
print('itemData.weekDay:${itemData.weekDay} itemData.lockName:${itemData.lockInfo!.btDeviceName}');
|
||||||
'lockName': itemData.lockInfo!.btDeviceName,
|
|
||||||
'startDate': itemData.startDate,
|
var data = await Get.toNamed(Routers.expireKeyChangeValidityDatePage, arguments: {
|
||||||
'endDate': itemData.endDate,
|
'pushType': 1,
|
||||||
'lockId': itemData.lockId,
|
'lockName': itemData.lockInfo!.btDeviceName,
|
||||||
'keyID': itemData.fingerprintId,
|
'startDate': itemData.startDate,
|
||||||
'keyNumber': int.parse(itemData.fingerprintNumber!),
|
'endDate': itemData.endDate,
|
||||||
'keyName': itemData.nickname,
|
'lockId': itemData.lockId,
|
||||||
'isAdmin': itemData.fingerRight,
|
'keyID': itemData.fingerprintId,
|
||||||
'isForce': itemData.isCoerced,
|
'keyNumber': int.parse(itemData.fingerprintNumber!),
|
||||||
});
|
'keyName': itemData.nickname,
|
||||||
if(data != null) {
|
'isAdmin': itemData.fingerRight,
|
||||||
setState(() {
|
'isForce': itemData.isCoerced,
|
||||||
logic.pageNo = 1;
|
'weekDay': itemData.weekDay,
|
||||||
getHttpData();
|
|
||||||
});
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var data = await Get.toNamed(Routers.expireKeyChangeDatePage, arguments: {
|
||||||
|
'pushType': 1,
|
||||||
|
'lockName': itemData.lockInfo!.btDeviceName,
|
||||||
|
'startDate': itemData.startDate,
|
||||||
|
'endDate': itemData.endDate,
|
||||||
|
'lockId': itemData.lockId,
|
||||||
|
'keyID': itemData.fingerprintId,
|
||||||
|
'keyNumber': int.parse(itemData.fingerprintNumber!),
|
||||||
|
'keyName': itemData.nickname,
|
||||||
|
'isAdmin': itemData.fingerRight,
|
||||||
|
'isForce': itemData.isCoerced,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@ -0,0 +1,475 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../../blue/io_protocol/io_addFace.dart';
|
||||||
|
import '../../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
||||||
|
import '../../../../../blue/io_protocol/io_addICCardWithTimeCycleCoercion.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 '../../../../../login/login/entity/LoginEntity.dart';
|
||||||
|
import '../../../../../network/api_repository.dart';
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
|
import '../../../../../tools/storage.dart';
|
||||||
|
import 'expireKeyChangeValidityDate_state.dart';
|
||||||
|
|
||||||
|
class ExpireKeyChangeValidityDateLogic extends BaseGetXController {
|
||||||
|
ExpireKeyChangeValidityDateState state = ExpireKeyChangeValidityDateState();
|
||||||
|
|
||||||
|
// 监听设备返回的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
|
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddICCardBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加指纹开始(此处用作修改或者删除指纹)
|
||||||
|
if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddFingerprintBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加人脸开始(此处用作修改人脸)
|
||||||
|
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddFaceBegin(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加人脸开始
|
||||||
|
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editFaceData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID:state.keyID.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
faceNo:state.keyNumber,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.isAdmin,
|
||||||
|
isForce:state.isForce, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: true
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editICCardData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.keyID.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
cardNo:state.keyNumber,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.isAdmin,
|
||||||
|
isForce:state.isForce, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: true
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加指纹开始
|
||||||
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editFingerprintsData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.keyID.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:state.keyNumber,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate:1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.isAdmin,
|
||||||
|
isForce:state.isForce, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: true
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除指纹
|
||||||
|
Future<void> senderAddFingerprint() async {
|
||||||
|
if(state.sureBtnState.value == 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: (){
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(state.lockName.isEmpty ? BlueManage().connectDeviceName : state.lockName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.keyID.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:state.keyNumber,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate:1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.isAdmin,
|
||||||
|
isForce:state.isForce, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: true
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片
|
||||||
|
Future<void> senderAddICCard() async {
|
||||||
|
if(state.sureBtnState.value == 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: (){
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(state.lockName.isEmpty ? BlueManage().connectDeviceName : state.lockName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.keyID.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
cardNo:state.keyNumber,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.isAdmin,
|
||||||
|
isForce:state.isForce, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: true
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除/修改人脸信息
|
||||||
|
Future<void> senderAddFace() async {
|
||||||
|
if (state.sureBtnState.value == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(state.lockName.isEmpty ? BlueManage().connectDeviceName : state.lockName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID:state.keyID.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
faceNo:state.keyNumber,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.isAdmin,
|
||||||
|
isForce:state.isForce, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: true
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改指纹信息
|
||||||
|
Future<void> editFingerprintsData() async{
|
||||||
|
final LoginEntity entity = await ApiRepository.to.editFingerprintsData(
|
||||||
|
fingerprintId: state.keyID.toString(),
|
||||||
|
lockId: state.lockId.toString(),
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
startDate: state.starDateTimestamp.value.toString(),
|
||||||
|
endDate: state.endDateTimestamp.value.toString(),
|
||||||
|
isCoerced: state.isForce.toString(),
|
||||||
|
fingerprintName: state.keyName,
|
||||||
|
changeType: '1',
|
||||||
|
startTime: state.starTimeTimestamp.value,
|
||||||
|
endTime: state.endTimeTimestamp.value,
|
||||||
|
fingerprintType: 4,
|
||||||
|
fingerRight: state.isAdmin
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
showToast('修改成功'.tr, something: (){
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
Get.back(result: <String, Object>{
|
||||||
|
'starDate':state.starDateTimestamp.value.toString(),
|
||||||
|
'endDate':state.endDateTimestamp.value.toString(),
|
||||||
|
'starTime':state.starTimeTimestamp.value.toString(),
|
||||||
|
'endTime':state.endTimeTimestamp.value.toString(),
|
||||||
|
'validityValue':state.weekDay.value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑iC卡
|
||||||
|
void editICCardData() async{
|
||||||
|
final LoginEntity entity = await ApiRepository.to.editICCardData(
|
||||||
|
cardId: state.keyID.toString(),
|
||||||
|
lockId: state.lockId.toString(),
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
startDate: state.starDateTimestamp.value.toString(),
|
||||||
|
endDate: state.endDateTimestamp.value.toString(),
|
||||||
|
isCoerced: state.isForce.toString(),
|
||||||
|
cardName: state.keyName,
|
||||||
|
changeType: '1',
|
||||||
|
startTime: state.starTimeTimestamp.value,
|
||||||
|
endTime: state.endTimeTimestamp.value,
|
||||||
|
cardType: 4,
|
||||||
|
cardRight: state.isAdmin,
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
showToast('修改成功'.tr, something: (){
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
Get.back(result: <String, Object>{
|
||||||
|
'starDate':state.starDateTimestamp.value.toString(),
|
||||||
|
'endDate':state.endDateTimestamp.value.toString(),
|
||||||
|
'starTime':state.starTimeTimestamp.value.toString(),
|
||||||
|
'endTime':state.endTimeTimestamp.value.toString(),
|
||||||
|
'validityValue':state.weekDay.value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改人脸有效期
|
||||||
|
void editFaceData() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.updateFaceValidity(
|
||||||
|
lockId: state.lockId,
|
||||||
|
faceId: state.keyID,
|
||||||
|
startDate: state.starDateTimestamp.value,
|
||||||
|
endDate: state.endDateTimestamp.value,
|
||||||
|
startTime: state.starTimeTimestamp.value,
|
||||||
|
endTime: state.endTimeTimestamp.value,
|
||||||
|
faceType: 4,
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
faceName: state.keyName,
|
||||||
|
addType: '1',
|
||||||
|
isCoerced: state.isForce,
|
||||||
|
faceRight: state.isAdmin,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('修改成功', something: () {
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
Get.back(result: <String, Object>{
|
||||||
|
'starDate':state.starDateTimestamp.value.toString(),
|
||||||
|
'endDate':state.endDateTimestamp.value.toString(),
|
||||||
|
'starTime':state.starTimeTimestamp.value.toString(),
|
||||||
|
'endTime':state.endTimeTimestamp.value.toString(),
|
||||||
|
'validityValue':state.weekDay.value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,286 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/commonDataManage.dart';
|
||||||
|
import '../../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../../tools/pickers/pickers.dart';
|
||||||
|
import '../../../../../tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
import '../../../../../tools/pickers/time_picker/model/pduration.dart';
|
||||||
|
import '../../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
import 'expireKeyChangeValidityDate_logic.dart';
|
||||||
|
import 'expireKeyChangeValidityDate_state.dart';
|
||||||
|
|
||||||
|
class ExpireKeyChangeValidityDatePage extends StatefulWidget {
|
||||||
|
const ExpireKeyChangeValidityDatePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ExpireKeyChangeValidityDatePage> createState() => _ExpireKeyChangeValidityDatePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ExpireKeyChangeValidityDatePageState extends State<ExpireKeyChangeValidityDatePage> {
|
||||||
|
final ExpireKeyChangeValidityDateLogic logic = Get.put(ExpireKeyChangeValidityDateLogic());
|
||||||
|
final ExpireKeyChangeValidityDateState state = Get.find<ExpireKeyChangeValidityDateLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: '修改有效期'.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
topWidget(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
middleWidget(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
bottomWidget(),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||||
|
onClick: () {
|
||||||
|
state.starDateTimestamp.value =
|
||||||
|
DateTool().dateToTimestamp(state.starDate.value, 1);
|
||||||
|
state.endDateTimestamp.value =
|
||||||
|
DateTool().dateToTimestamp(state.endDate.value, 1) + CommonDataManage().dayLatestTime;
|
||||||
|
state.starTimeTimestamp.value =
|
||||||
|
DateTool().dateToTimestamp(state.starTime.value, 0);
|
||||||
|
state.endTimeTimestamp.value =
|
||||||
|
DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||||
|
|
||||||
|
if (state.starDateTimestamp.value >
|
||||||
|
state.endDateTimestamp.value) {
|
||||||
|
logic.showToast('失效日期要大于生效日期'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(state.weekDay.value.isEmpty){
|
||||||
|
logic.showToast('请选择有效日'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.starTimeTimestamp.value >=
|
||||||
|
state.endTimeTimestamp.value) {
|
||||||
|
logic.showToast('失效时间要大于生效时间'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (state.pushType.value) {
|
||||||
|
case 0:
|
||||||
|
// 卡
|
||||||
|
logic.senderAddICCard();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// 指纹
|
||||||
|
logic.senderAddFingerprint();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 遥控
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 人脸
|
||||||
|
logic.senderAddFace();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget topWidget() {
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: '生效日期'.tr,
|
||||||
|
rightTitle: state.starDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
final PDuration selectDate =
|
||||||
|
PDuration.parse(DateTime.tryParse(state.starDate.value));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.YMD, onConfirm: (PDuration p) {
|
||||||
|
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: '失效日期'.tr,
|
||||||
|
rightTitle: state.endDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
final PDuration selectDate =
|
||||||
|
PDuration.parse(DateTime.tryParse(state.endDate.value));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.YMD, onConfirm: (PDuration 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: <Widget>[
|
||||||
|
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: (BuildContext context, int 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: <Widget>[
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
||||||
|
rightTitle: state.starTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
final PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.starTime.value, 0));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.HM, onConfirm: (PDuration p) {
|
||||||
|
setState(() {
|
||||||
|
state.starTime.value =
|
||||||
|
DateTool().getYMDHNDateString(p, 3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
"${TranslationLoader.lanKeys!.end!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
||||||
|
rightTitle: state.endTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
final PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.HM, onConfirm: (PDuration p) {
|
||||||
|
setState(() {
|
||||||
|
state.endTime.value =
|
||||||
|
DateTool().getYMDHNDateString(p, 3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
|
class ExpireKeyChangeValidityDateState{
|
||||||
|
ExpireKeyChangeValidityDateState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if(map['pushType'] != null){
|
||||||
|
pushType.value = map['pushType'];
|
||||||
|
}
|
||||||
|
if(map['lockName'] != null){
|
||||||
|
lockName = map['lockName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(map['startDate'] != null){
|
||||||
|
final int getStartDate = map['startDate'];
|
||||||
|
final int getEndDate = map['endDate'];
|
||||||
|
starDate.value = DateTool().dateToYMDString(getStartDate.toString());
|
||||||
|
endDate.value = DateTool().dateToYMDString(getEndDate.toString());
|
||||||
|
starTime.value = DateTool().dateToHNString(getStartDate.toString());
|
||||||
|
endTime.value = DateTool().dateToHNString(getEndDate.toString());
|
||||||
|
// weekDay.value = getWeekDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(map['weekDay'] != null){
|
||||||
|
weekDay.value = map['weekDay'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(map['lockId'] != null){
|
||||||
|
lockId = map['lockId'];
|
||||||
|
}
|
||||||
|
if(map['keyID'] != null){
|
||||||
|
keyID = map['keyID'];
|
||||||
|
}
|
||||||
|
if(map['keyNumber'] != null){
|
||||||
|
keyNumber = map['keyNumber'];
|
||||||
|
}
|
||||||
|
if(map['keyName'] != null){
|
||||||
|
keyName = map['keyName'];
|
||||||
|
}
|
||||||
|
if(map['isAdmin'] != null){
|
||||||
|
isAdmin = map['isAdmin'];
|
||||||
|
}
|
||||||
|
if(map['isForce'] != null){
|
||||||
|
isForce = map['isForce'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RxString beginTime = ''.obs;// 开始时间
|
||||||
|
// RxString endTime = ''.obs;// 结束时间
|
||||||
|
// RxInt beginTimeTimestamp = 0.obs;// 开始时间
|
||||||
|
// RxInt endTimeTimestamp = 0.obs;// 结束时间
|
||||||
|
|
||||||
|
RxString starDate = ''.obs;// 开始时间
|
||||||
|
RxString endDate = ''.obs;// 结束时间
|
||||||
|
RxString starTime = ''.obs;// 生效时间
|
||||||
|
RxString endTime = ''.obs;// 失效时间
|
||||||
|
|
||||||
|
RxInt starDateTimestamp = 0.obs;// 开始时间
|
||||||
|
RxInt endDateTimestamp = 0.obs;// 结束时间
|
||||||
|
RxInt starTimeTimestamp = 0.obs;// 生效时间
|
||||||
|
RxInt endTimeTimestamp = 0.obs;// 失效时间
|
||||||
|
|
||||||
|
RxList weekDay = [].obs;
|
||||||
|
|
||||||
|
String lockName = '';
|
||||||
|
int lockId = 0;
|
||||||
|
int keyID = 0;
|
||||||
|
String keyName = '';
|
||||||
|
int keyNumber = 0;
|
||||||
|
int isAdmin = 0;
|
||||||
|
int isForce = 0;
|
||||||
|
|
||||||
|
RxInt pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸
|
||||||
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
RxInt sureBtnState = 0.obs;
|
||||||
|
|
||||||
|
// ExpireKeyChangeValidityDateState() {
|
||||||
|
// Map map = Get.arguments;
|
||||||
|
// pushType.value = map['pushType'];
|
||||||
|
// fingerprintItemData.value = map['fingerprintItemData'];
|
||||||
|
//
|
||||||
|
// 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!;
|
||||||
|
// }
|
||||||
|
// // final Rx<FingerprintItemData> fingerprintItemData = FingerprintItemData().obs;
|
||||||
|
//
|
||||||
|
// RxString starDate = ''.obs;// 开始时间
|
||||||
|
// RxString endDate = ''.obs;// 结束时间
|
||||||
|
// RxString starTime = ''.obs;// 生效时间
|
||||||
|
// RxString endTime = ''.obs;// 失效时间
|
||||||
|
//
|
||||||
|
// RxInt starDateTimestamp = 0.obs;// 开始时间
|
||||||
|
// RxInt endDateTimestamp = 0.obs;// 结束时间
|
||||||
|
// RxInt starTimeTimestamp = 0.obs;// 生效时间
|
||||||
|
// RxInt endTimeTimestamp = 0.obs;// 失效时间
|
||||||
|
//
|
||||||
|
// RxInt pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸
|
||||||
|
// RxList weekDay = [].obs;
|
||||||
|
// RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
// RxInt sureBtnState = 0.obs;
|
||||||
|
}
|
||||||
@ -122,17 +122,21 @@ class ExpirePasswordLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//请求即将到期列表
|
//请求即将到期列表
|
||||||
Future<ExpirePasswordEntity> expirePasswordListRequest() async {
|
Future<ExpirePasswordEntity> expirePasswordListRequest({required bool isRefresh, bool isRefreshLockUserManageList = false}) async {
|
||||||
|
if (isRefresh) {
|
||||||
|
state.dataList.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
final ExpirePasswordEntity entity = await ApiRepository.to.expirePasswordList(pageNo.toString(), pageSize.toString());
|
final ExpirePasswordEntity entity = await ApiRepository.to.expirePasswordList(pageNo.toString(), pageSize.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
// 更新数据列表
|
||||||
state.dataList.value = entity.data!.list!;
|
state.dataList.addAll(entity.data!.list!);
|
||||||
pageNo++;
|
// 更新页码
|
||||||
} else {
|
pageNo++;
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
|
||||||
state.dataList.value.addAll(entity.data!.list!);
|
if(isRefreshLockUserManageList){
|
||||||
pageNo++;
|
eventBus.fire(LockUserManageListRefreshUI());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
@ -146,9 +150,7 @@ class ExpirePasswordLogic extends BaseGetXController {
|
|||||||
deleteType: 1);
|
deleteType: 1);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('删除成功', something: () {
|
showToast('删除成功', something: () {
|
||||||
pageNo = 1;
|
expirePasswordListRequest(isRefresh: true, isRefreshLockUserManageList: true);
|
||||||
expirePasswordListRequest();
|
|
||||||
eventBus.fire(LockUserManageListRefreshUI());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,8 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> with RouteAware
|
|||||||
final ExpirePasswordLogic logic = Get.put(ExpirePasswordLogic());
|
final ExpirePasswordLogic logic = Get.put(ExpirePasswordLogic());
|
||||||
final ExpirePasswordState state = Get.find<ExpirePasswordLogic>().state;
|
final ExpirePasswordState state = Get.find<ExpirePasswordLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
logic.expirePasswordListRequest().then((ExpirePasswordEntity value) {
|
logic.expirePasswordListRequest(isRefresh: isRefresh).then((ExpirePasswordEntity value) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> with RouteAware
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,10 +46,10 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> with RouteAware
|
|||||||
return EasyRefreshTool(
|
return EasyRefreshTool(
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
},
|
},
|
||||||
onLoad: () {
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Obx(_buildMainUI));
|
child: Obx(_buildMainUI));
|
||||||
}
|
}
|
||||||
@ -67,7 +67,6 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> with RouteAware
|
|||||||
itemCount: state.dataList.length,
|
itemCount: state.dataList.length,
|
||||||
itemBuilder: (BuildContext c, int index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
final ExpirePasswordItemData indexEntity = state.dataList[index];
|
final ExpirePasswordItemData indexEntity = state.dataList[index];
|
||||||
state.seletIndexEntity = indexEntity;
|
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key: ValueKey(indexEntity.uid),
|
key: ValueKey(indexEntity.uid),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
@ -77,6 +76,7 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> with RouteAware
|
|||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog('确定删除该密码吗?', () {
|
ShowTipView().showIosTipWithContentDialog('确定删除该密码吗?', () {
|
||||||
|
state.seletIndexEntity = indexEntity;
|
||||||
logic.senderCustomPasswords();
|
logic.senderCustomPasswords();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -103,42 +103,18 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> with RouteAware
|
|||||||
Widget _electronicKeyItem(ExpirePasswordItemData itemData) {
|
Widget _electronicKeyItem(ExpirePasswordItemData itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// if (itemData.keyboardPwdType! > 4) {
|
if(itemData.isCustom == 1){
|
||||||
// // 循环
|
|
||||||
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage,
|
|
||||||
// arguments: {
|
|
||||||
// "pushType": 0,
|
|
||||||
// "expirePasswordItem": itemData,
|
|
||||||
// });
|
|
||||||
// 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"];
|
|
||||||
// // });
|
|
||||||
// logic.pageNo = 1;
|
|
||||||
// getHttpData();
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
var backData = await Get.toNamed(
|
var backData = await Get.toNamed(
|
||||||
Routers.passwordKeyDetailChangeDatePage,
|
Routers.passwordKeyDetailChangeDatePage,
|
||||||
arguments: <String, ExpirePasswordItemData>{
|
arguments: <String, ExpirePasswordItemData>{
|
||||||
'expirePasswordItemData': itemData,
|
'expirePasswordItemData': itemData,
|
||||||
});
|
});
|
||||||
if (backData != null) {
|
if (backData != null) {
|
||||||
// itemData.startDate =
|
getHttpData(isRefresh: true);
|
||||||
// int.parse(backData['beginTimeTimestamp']) * 1000;
|
|
||||||
// itemData.endDate = int.parse(backData['endTimeTimestamp']) * 1000;
|
|
||||||
// // 改了日期之后,永久只能改限时的
|
|
||||||
// itemData.keyboardPwdType = 3;
|
|
||||||
// setState(() {});
|
|
||||||
|
|
||||||
logic.pageNo = 1;
|
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
// }
|
}else {
|
||||||
|
logic.showToast('该密码不是自定义密码,无法修改');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 90.h,
|
height: 90.h,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user