From 02ad8cd2e84a4be7d203270d0bf98c0f35abbc8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Wed, 24 Apr 2024 17:01:59 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8D=A1=E8=BD=BB=E5=BE=AE=E5=B7=A6=E5=8F=B3=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=A1=E7=B1=BB=E5=9E=8B=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=822=E3=80=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=91=AB=E9=94=81=E8=B7=9F=E9=94=81=E9=80=9A?= =?UTF-8?q?=E9=80=9A=E7=AE=97=E6=B3=95=E4=B8=8D=E5=90=8C=20APP=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E7=94=9F=E6=88=90=E7=A6=BB=E7=BA=BF=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/lib/appRouters.dart | 11 +- star_lock/lib/blue/io_modelVendor.dart | 13 + .../addCardTypeManage_tabbar.dart | 5 +- .../card/addCardType/addCardType_logic.dart | 23 +- .../card/addCardType/addCardType_page.dart | 260 +++++++++++------- .../card/addCardType/addCardType_state.dart | 20 +- .../card/cardList/cardList_page.dart | 2 +- .../checkingInAddStaff_page.dart | 2 +- .../lockDetail/lockDetail_logic.dart | 2 +- .../lockDetail/lockNetToken_entity.dart | 2 +- .../passwordKey_perpetual_logic.dart | 32 ++- .../passwordKey_perpetual_page.dart | 24 +- 12 files changed, 252 insertions(+), 144 deletions(-) create mode 100644 star_lock/lib/blue/io_modelVendor.dart diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 9b54cce3..af486893 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -57,6 +57,7 @@ import 'login/login/starLock_login_page.dart'; import 'login/register/starLock_register_page.dart'; import 'login/selectCountryRegion/selectCountryRegion_page.dart'; import 'main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_page.dart'; +import 'main/lockDetail/card/addCardType/addCardType_page.dart'; import 'main/lockDetail/card/addICCard/addICCard_page.dart'; import 'main/lockDetail/card/cardDetail/cardDetail_page.dart'; import 'main/lockDetail/card/cardList/cardList_page.dart'; @@ -416,7 +417,8 @@ abstract class Routers { '/AddRemoteControlManagePage'; // 添加遥控 static const cardListPage = '/CardListPage'; // 卡列表 - static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡 + // static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡 + static const addCardPage = '/AddCardPage'; // 添加卡 static const cardDetailPage = '/CardDetailPage'; // 卡详情 static const fingerprintListPage = '/FingerprintListPage'; // 指纹列表 static const addFingerprintTypeManagePage = @@ -1009,9 +1011,12 @@ abstract class AppRouters { name: Routers.addRemoteControlManagePage, page: () => const AddRemoteControlManagePage()), GetPage(name: Routers.cardListPage, page: () => const CardListPage()), + // GetPage( + // name: Routers.addCardTypeManagePage, + // page: () => const AddCardTypeManagePage()), GetPage( - name: Routers.addCardTypeManagePage, - page: () => const AddCardTypeManagePage()), + name: Routers.addCardPage, + page: () => const AddCardPage()), GetPage(name: Routers.cardDetailPage, page: () => const CardDetailPage()), GetPage( name: Routers.fingerprintListPage, diff --git a/star_lock/lib/blue/io_modelVendor.dart b/star_lock/lib/blue/io_modelVendor.dart new file mode 100644 index 00000000..268b206b --- /dev/null +++ b/star_lock/lib/blue/io_modelVendor.dart @@ -0,0 +1,13 @@ + +// ignore_for_file: non_constant_identifier_names + +class IoModelVendor { + + static String vendor_XHJ = 'XHJ'; + static String model_XHJ_SYD = 'SYD-BLE-01'; + static String model_XHJ_JL = 'JL-BLE-01'; + + static String vendor_XL = 'XL'; + static String model_XL_BLE = 'JL-BLE-01'; + static String model_XL_WIFI = 'JL-WIFI-01'; +} diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart index db9c485d..12d283e2 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart @@ -50,6 +50,7 @@ class _AddCardManageTabbarState extends State length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length, initialIndex: widget.initialIndex); _tabController.addListener(() { + print("_tabController.indexIsChanging:${_tabController.indexIsChanging} _tabController.index:${_tabController.index}"); if (_tabController.animation!.value == _tabController.index) { FocusScope.of(context).requestFocus(FocusNode()); } @@ -107,8 +108,8 @@ class _AddCardManageTabbarState extends State controller: _tabController, children: widget.fromType == 1 - ? _itemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList() - : _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList(), + ? _itemTabs.map((ItemView item) => AddCardPage()).toList() + : _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage()).toList(), ), ); } diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_logic.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_logic.dart index ad989d33..ab7f5561 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_logic.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_logic.dart @@ -12,21 +12,23 @@ class AddCardTypeLogic extends BaseGetXController{ // 添加卡数据 void addCardData() async { - var fingerprintType = 0; // 永久:1;限时2,单次3,循环:4 + var carType = 0; // 永久:1;限时2,单次3,循环:4 var startDate = ""; var endDate = ""; var startTime = ""; var endTime = ""; if (state.selectType.value == "0") { - fingerprintType = 1; + print("永久卡永久卡永久卡"); + carType = 1; startDate = "0"; endDate = "0"; startTime = "0"; endTime = "0"; } else if (state.selectType.value == "1") { - fingerprintType = 2; - startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); - endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); + print("限时卡限时卡限时卡"); + carType = 2; + startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString(); + endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString(); startTime = "0"; endTime = "0"; @@ -49,15 +51,16 @@ class AddCardTypeLogic extends BaseGetXController{ return; } } else if (state.selectType.value == "2") { - if (state.beginTime.value.isEmpty) { + print("循环卡循环卡循环卡"); + if (state.cycleBeginTime.value.isEmpty) { showToast("请选择有效期".tr); return; } - startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); - endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); + startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString(); + endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString(); startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString(); endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString(); - fingerprintType = 4; + carType = 4; } // var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫卡 2:胁迫卡 @@ -67,7 +70,7 @@ class AddCardTypeLogic extends BaseGetXController{ "addType": "1", "cardName": state.nameController.text, "cardNumber": "123456", - "cardType": fingerprintType.toString(), + "cardType": carType.toString(), "isCoerced": state.isStressFingerprint.value == false ? "1" : "2", "startDate": startDate, "weekDay": state.weekdaysList.value, diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart index a773a8df..feba7075 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -8,110 +9,113 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/CustomUnderlineTabIndicator.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/dateTool.dart'; import '../../../../tools/storage.dart'; import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; import 'addCardType_logic.dart'; class AddCardPage extends StatefulWidget { - final String selectType; // 永久限时循环下标 - final int lockId; - final int fromType; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入 - final String fromTypeTwoStaffName; // 从添加员工进入 传入员工名字 - - const AddCardPage( - {Key? key, - required this.selectType, - required this.lockId, - required this.fromType, - required this.fromTypeTwoStaffName}) - : super(key: key); + const AddCardPage({Key? key}) : super(key: key); @override State createState() => _AddCardPageState(); } -class _AddCardPageState extends State { +class _AddCardPageState extends State with SingleTickerProviderStateMixin { final logic = Get.put(AddCardTypeLogic()); final state = Get.find().state; - @override - Widget build(BuildContext context) { - state.selectType.value = widget.selectType; - state.lockId.value = widget.lockId; - if (widget.fromTypeTwoStaffName.isNotEmpty) { - state.nameController.text = widget.fromTypeTwoStaffName; - } - state.fromType.value = widget.fromType; - - return SingleChildScrollView( - child: indexChangeWidget() - ); - } - @override void initState() { // TODO: implement initState super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) { - if (state.selectType.value == "1") { - state.beginTime.value = DateTool().dateToYMDHNString( - DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间 - state.endTime.value = DateTool().dateToYMDHNString( - DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间 - } else { - state.beginTime.value = ""; //默认为当前时间 - state.endTime.value = ""; //默认为当前时间 + state.tabController = TabController( + vsync: this, + length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length, + initialIndex: 0); + state.tabController.addListener(() { + WidgetsBinding.instance.addPostFrameCallback((_) { + state.selectType.value = state.tabController.index.toString(); + }); + + if (state.tabController.animation!.value == state.tabController.index) { + FocusScope.of(context).requestFocus(FocusNode()); } }); } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: + "${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}", + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Column( + children: [ + _tabBar(), + _pageWidget(), + ], + ), + ); + } Widget indexChangeWidget() { - switch (int.parse(widget.selectType)) { + switch (int.parse(state.selectType.value)) { case 0: { // 永久 - return Column( - children: [ - perpetualKeyWidget( - TranslationLoader.lanKeys!.name!.tr, - TranslationLoader.lanKeys!.pleaseEnter!.tr, - state.nameController), - keyBottomWidget() - ], + return SingleChildScrollView( + child: Column( + children: [ + perpetualKeyWidget( + TranslationLoader.lanKeys!.name!.tr, + TranslationLoader.lanKeys!.pleaseEnter!.tr, + state.nameController), + keyBottomWidget() + ], + ), ); } case 1: { // 限时 - return Column( - children: [ - perpetualKeyWidget( - TranslationLoader.lanKeys!.name!.tr, - TranslationLoader.lanKeys!.pleaseEnter!.tr, - state.nameController), - keyTimeLimitWidget(), - // SizedBox(height: 10.h), - keyBottomWidget() - ], + return SingleChildScrollView( + child: Column( + children: [ + perpetualKeyWidget( + TranslationLoader.lanKeys!.name!.tr, + TranslationLoader.lanKeys!.pleaseEnter!.tr, + state.nameController), + keyTimeLimitWidget(), + // SizedBox(height: 10.h), + keyBottomWidget() + ], + ), ); } case 2: { // 循环 - return Column( - children: [ - perpetualKeyWidget( - TranslationLoader.lanKeys!.name!.tr, - TranslationLoader.lanKeys!.pleaseEnter!.tr, - state.nameController), - keyCyclicDate(), - SizedBox(height: 10.h), - keyBottomWidget() - ], + return SingleChildScrollView( + child: Column( + children: [ + perpetualKeyWidget( + TranslationLoader.lanKeys!.name!.tr, + TranslationLoader.lanKeys!.pleaseEnter!.tr, + state.nameController), + keyCyclicDate(), + SizedBox(height: 10.h), + keyBottomWidget() + ], + ), ); } default: @@ -140,23 +144,23 @@ class _AddCardPageState extends State { children: [ Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, - rightTitle: state.beginTime.value, + rightTitle: state.timeLimitBeginTime.value, isHaveLine: true, isHaveDirection: true, action: () async { Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) { - state.beginTime.value = DateTool().getYMDHNDateString(p, 1); + state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1); }); })), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, - rightTitle: state.endTime.value, + rightTitle: state.timeLimitEndTime.value, isHaveDirection: true, action: () { Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) { - state.endTime.value = DateTool().getYMDHNDateString(p, 1); + state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1); }); })), Container(height: 10.h), @@ -170,21 +174,21 @@ class _AddCardPageState extends State { children: [ Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, - rightTitle: "${state.beginTime.value}\n${state.endTime.value}", + rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}", isHaveDirection: true, isHaveLine: true, action: () async { var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: { 'validityValue': state.weekdaysList.value, - 'starDate': state.beginTime.value, - 'endDate': state.endTime.value, + 'starDate': state.cycleBeginTime.value, + 'endDate': state.cycleEndTime.value, 'starTime': state.effectiveDateTime.value, 'endTime': state.failureDateTime.value }); if (result != null && result.isNotEmpty) { state.weekdaysList.value = result['validityValue']; - state.beginTime.value = result['starDate']; - state.endTime.value = result['endDate']; + state.cycleBeginTime.value = result['starDate']; + state.cycleEndTime.value = result['endDate']; state.effectiveDateTime.value = result['starTime']; state.failureDateTime.value = result['endTime']; } @@ -197,18 +201,17 @@ class _AddCardPageState extends State { isHaveDirection: true, isHaveLine: true, action: () async { - var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, - arguments: { - 'validityValue': state.weekdaysList.value, - 'starDate': state.beginTime.value, - 'endDate': state.endTime.value, - 'starTime': state.effectiveDateTime.value, - 'endTime': state.failureDateTime.value - }); + var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: { + 'validityValue': state.weekdaysList.value, + 'starDate': state.cycleBeginTime.value, + 'endDate': state.cycleEndTime.value, + 'starTime': state.effectiveDateTime.value, + 'endTime': state.failureDateTime.value + }); if (result != null && result.isNotEmpty) { state.weekdaysList.value = result['validityValue']; - state.beginTime.value = result['starDate']; - state.endTime.value = result['endDate']; + state.cycleBeginTime.value = result['starDate']; + state.cycleEndTime.value = result['endDate']; state.effectiveDateTime.value = result['starTime']; state.failureDateTime.value = result['endTime']; } @@ -217,25 +220,22 @@ class _AddCardPageState extends State { visible: state.effectiveDateTime.value.isNotEmpty, child: CommonItem( leftTitel: "有效时间".tr, - rightTitle: - "${state.effectiveDateTime.value}-${state.failureDateTime.value}", + rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}", isHaveDirection: true, action: () async { - var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, - arguments: { - 'validityValue': state.weekdaysList.value, - 'starDate': state.beginTime.value, - 'endDate': state.endTime.value, - 'starTime': state.effectiveDateTime.value, - 'endTime': state.failureDateTime.value - }); + var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: { + 'validityValue': state.weekdaysList.value, + 'starDate': state.cycleBeginTime.value, + 'endDate': state.cycleEndTime.value, + 'starTime': state.effectiveDateTime.value, + 'endTime': state.failureDateTime.value + }); if (result != null && result.isNotEmpty) { state.weekdaysList.value = result['validityValue']; - state.beginTime.value = result['starDate']; - state.endTime.value = result['endDate']; + state.cycleBeginTime.value = result['starDate']; + state.cycleEndTime.value = result['endDate']; state.effectiveDateTime.value = result['starTime']; state.failureDateTime.value = result['endTime']; - Get.back(result: result); } }))), ], @@ -368,4 +368,70 @@ class _AddCardPageState extends State { }, ); } + + final List _itemTabs = [ + ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), + ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), + ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"), + ]; + + final List _fromCheckInTypeItemTabs = [ + ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"), + ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"), + ]; + + TabBar _tabBar() { + return TabBar( + controller: state.tabController, + onTap: (index) { + FocusScope.of(context).requestFocus(FocusNode()); + }, + tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(), + isScrollable: true, + indicatorColor: Colors.red, + unselectedLabelColor: Colors.black, + unselectedLabelStyle: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + ), + automaticIndicatorColorAdjustment: true, + labelColor: AppColors.mainColor, + labelStyle: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + fontWeight: FontWeight.w600), + indicator: CustomUnderlineTabIndicator( + borderSide: BorderSide(color: AppColors.mainColor, width: 4.w), + strokeCap: StrokeCap.round, + width: 30.w), + ); + } + + Tab _tab(ItemView item) { + return Tab( + child: SizedBox( + width: 1.sw / 5, + child: Text(item.title, textAlign: TextAlign.center))); + } + + Widget _pageWidget() { + return Expanded( + child: TabBarView( + controller: state.tabController, + children: + state.fromType.value == 1 + ? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList() + : _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(), + ), + ); + } + } + +class ItemView { + const ItemView({required this.title, required this.selectType}); + + final String title; + final String selectType; +} + diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_state.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_state.dart index 411be2e8..1c234082 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_state.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_state.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import '../../../../tools/dateTool.dart'; + class AddCardTypeState{ final lockId = 0.obs; @@ -10,16 +12,24 @@ class AddCardTypeState{ final isStressFingerprint = false.obs; final isAdministrator = false.obs;// 是否是管理员 - var beginTime = "".obs;// 开始时间 - var endTime = "".obs;// 结束时间 + var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间 + var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间 + var cycleBeginTime = "".obs;// 循环开始时间 + var cycleEndTime = "".obs;// 循环结束时间 var effectiveDateTime = "".obs;// 生效时间 var failureDateTime = "".obs;// 失效时间 var weekdaysList = [].obs; + var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字 final TextEditingController nameController = TextEditingController(); + late TabController tabController; AddCardTypeState() { - // Map map = Get.arguments; - // lockId.value = map["lockId"]; - // fromType.value = map["fromType"]; + Map map = Get.arguments; + lockId.value = map["lockId"]; + fromType.value = map["fromType"]; + // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + if(fromType.value == 2){ + fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字 + } } } diff --git a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart index 4e1c399c..47508f6c 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart @@ -104,7 +104,7 @@ class _CardListPageState extends State with RouteAware { AddBottomWhiteBtn( btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}', onClick: () async { - var data = await Get.toNamed(Routers.addCardTypeManagePage, arguments: { + var data = await Get.toNamed(Routers.addCardPage, arguments: { "lockId": state.lockId.value, "fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入 }); diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart index ba974948..385570d5 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart @@ -151,7 +151,7 @@ class _CheckingInAddStaffPageState extends State { } var data = await Get.toNamed( - Routers.addCardTypeManagePage, + Routers.addCardPage, arguments: { "lockId": state.getKeyInfosData.value.lockId, "fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入 diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 99bce8e2..07ae34bb 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -496,7 +496,7 @@ class LockDetailLogic extends BaseGetXController { void getLockNetToken() async { LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { - state.lockNetToken = entity.data!.token!; + state.lockNetToken = entity.data!.token!.toString(); Get.log("state.lockNetToken:${state.lockNetToken}"); openDoorAction(); }else{ diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockNetToken_entity.dart b/star_lock/lib/main/lockDetail/lockDetail/lockNetToken_entity.dart index fc74063a..b1be8d76 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockNetToken_entity.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockNetToken_entity.dart @@ -27,7 +27,7 @@ class LockNetTokenEntity { } class Data { - String? token; + int? token; Data({this.token}); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index 3e595dad..80294890 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -10,6 +10,7 @@ import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; import '../../../../blue/blue_manage.dart'; +import '../../../../blue/io_modelVendor.dart'; import '../../../../blue/io_reply.dart'; import '../../../../blue/io_protocol/io_senderCustomPasswords.dart'; import '../../../../blue/io_tool/io_tool.dart'; @@ -57,8 +58,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { getKeyType = '2'; } else if (state.widgetType.value == 1) { //限时 - if(CommonDataManage().currentKeyInfo.vendor == "XL"){ - // 鑫鸿佳 + // 鑫鸿佳不需要生效时间 + if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XHJ && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_SYD || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_JL)){ + if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + showToast("失效时间要大于当前时间".tr); + return; + } + } + + // 芯连需要生效时间 + if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){ //限时 if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { showToast("生效时间不能小于当前时间".tr); @@ -69,12 +78,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { showToast("失效时间要大于生效时间".tr); return; } - }else{ - if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { - showToast("生效时间要大于当前时间".tr); - return; - } - // startDate = 0; } getKeyType = '3'; } else if (state.widgetType.value == 2) { @@ -84,13 +87,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { //自定义 } else if (state.widgetType.value == 4) { //循环 - if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { - showToast("生效时间不能小于当前时间".tr); - return; + // 芯连需要结束时间 + if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){ + if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + showToast("结束时间不能小于当前时间".tr); + return; + } } - if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { - showToast("结束时间不能小于当前时间".tr); + if (state.loopStartHours.value >= state.loopEndHours.value) { + showToast("失效时间要大于生效时间".tr); return; } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index ac718ede..3f10ff8e 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -15,6 +15,7 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../blue/blue_manage.dart'; +import '../../../../blue/io_modelVendor.dart'; import '../../../../tools/NativeInteractionTool.dart'; import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/commonItem.dart'; @@ -290,16 +291,19 @@ class _PasswordKeyPerpetualPageState extends State wit ]; showPickerView(context, pickerDataList); }), - CommonItem( - leftTitel: '结束日期', - rightTitle: state.endTime.value, - isHaveLine: true, - isHaveDirection: true, - action: () { - Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { - state.endTime.value = DateTool().getYMDHNDateString(p, 4); - }); - }), + Visibility( + visible: (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)) ? true : false, + child: CommonItem( + leftTitel: '结束日期', + rightTitle: state.endTime.value, + isHaveLine: true, + isHaveDirection: true, + action: () { + Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { + state.endTime.value = DateTool().getYMDHNDateString(p, 4); + }); + }), + ), CommonItem( leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, rightTitle: state.loopEffectiveDate.value,