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