1、修复添加卡轻微左右滑动添加卡类型不同问题。2、添加根据鑫锁跟锁通通算法不同 APP区分生成离线密码
This commit is contained in:
parent
5561996f05
commit
02ad8cd2e8
@ -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,
|
||||
|
||||
13
star_lock/lib/blue/io_modelVendor.dart
Normal file
13
star_lock/lib/blue/io_modelVendor.dart
Normal file
@ -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';
|
||||
}
|
||||
@ -50,6 +50,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
|
||||
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<AddCardManageTabbar>
|
||||
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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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<AddCardPage> createState() => _AddCardPageState();
|
||||
}
|
||||
|
||||
class _AddCardPageState extends State<AddCardPage> {
|
||||
class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStateMixin {
|
||||
final logic = Get.put(AddCardTypeLogic());
|
||||
final state = Get.find<AddCardTypeLogic>().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<AddCardPage> {
|
||||
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<AddCardPage> {
|
||||
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<AddCardPage> {
|
||||
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<AddCardPage> {
|
||||
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<AddCardPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
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<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -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"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ class _CardListPageState extends State<CardListPage> 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从考勤添加员工入口进入
|
||||
});
|
||||
|
||||
@ -151,7 +151,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
}
|
||||
|
||||
var data = await Get.toNamed(
|
||||
Routers.addCardTypeManagePage,
|
||||
Routers.addCardPage,
|
||||
arguments: {
|
||||
"lockId": state.getKeyInfosData.value.lockId,
|
||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
|
||||
@ -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{
|
||||
|
||||
@ -27,7 +27,7 @@ class LockNetTokenEntity {
|
||||
}
|
||||
|
||||
class Data {
|
||||
String? token;
|
||||
int? token;
|
||||
|
||||
Data({this.token});
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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<PasswordKeyPerpetualPage> 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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user