添加掌静脉列表、添加、详情、修改掌静脉名字等功能
This commit is contained in:
parent
6505ec535a
commit
706003021c
BIN
images/.DS_Store
vendored
BIN
images/.DS_Store
vendored
Binary file not shown.
BIN
images/icon_palm.png
Normal file
BIN
images/icon_palm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 821 B |
@ -37,7 +37,6 @@ import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/nDaysUnope
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/addPalm/addPalm_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmTypeManage/addPalmTypeManage_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart';
|
||||
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart';
|
||||
@ -133,6 +132,8 @@ import 'main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWi
|
||||
import 'main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
||||
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
|
||||
import 'main/lockDetail/palm/addPalmType/addPalmType_page.dart';
|
||||
import 'main/lockDetail/palm/palmDetail/palmDetail_page.dart';
|
||||
import 'main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart';
|
||||
import 'main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart';
|
||||
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart';
|
||||
@ -470,8 +471,9 @@ abstract class Routers {
|
||||
static const String addIrisPage = '/AddIrisPage'; // 添加虹膜过程
|
||||
|
||||
static const String palmListPage = '/PalmListPage'; // 手掌列表
|
||||
static const String addPalmTypeManagePage = '/AddPalmTypeManagePage'; // 添加手掌
|
||||
static const String addPalmTypePage = '/AddPalmTypePage'; // 添加手掌
|
||||
static const String addPalmPage = '/AddPalmPage'; // 添加手掌过程
|
||||
static const String palmDetailPage = '/PalmDetailPage'; // 手掌详情
|
||||
|
||||
static const String passwordKeyDetailChangeDatePage =
|
||||
'/passwordKeyDetailChangeDatePage'; //密码更改时间
|
||||
@ -1126,8 +1128,8 @@ abstract class AppRouters {
|
||||
GetPage<dynamic>(
|
||||
name: Routers.palmListPage, page: () => const PalmListPage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.addPalmTypeManagePage,
|
||||
page: () => const AddPalmTypeManagePage()),
|
||||
name: Routers.addPalmTypePage,
|
||||
page: () => const AddPalmTypePage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.addPalmPage, page: () => const AddPalmPage()),
|
||||
GetPage<dynamic>(
|
||||
@ -1158,5 +1160,7 @@ abstract class AppRouters {
|
||||
name: Routers.addRemoteControlTypePage, page: () => const AddRemoteControlTypePage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.remoteControlDetailPage, page: () => const RemoteControlDetailPage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.palmDetailPage, page: () => const PalmDetailPage()),
|
||||
];
|
||||
}
|
||||
|
||||
95
lib/blue/io_protocol/io_addPalmCancel.dart
Normal file
95
lib/blue/io_protocol/io_addPalmCancel.dart
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../io_type.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
|
||||
/// TODO:取消添加掌纹
|
||||
class SenderCancelAddPalmCommand extends SenderProtocol {
|
||||
|
||||
SenderCancelAddPalmCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.token,
|
||||
this.needAuthor,
|
||||
this.signKey,
|
||||
this.privateKey,
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
String? keyID;
|
||||
String? userID;
|
||||
List<int>? token;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SenderCancelAddPalmCommand{keyID: $keyID, '
|
||||
'userID: $userID, token: $token, needAuthor: $needAuthor, signKey: $signKey, privateKey: $privateKey}';
|
||||
}
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
data.addAll(intChangList(commandType!.typeValue));
|
||||
|
||||
// 子命令类型
|
||||
data.add(44);
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
subData.add(0);
|
||||
} else {
|
||||
List<int> authCodeData = [];
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//authUserID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = 16 - data.length % 16;
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
|
||||
printLog(data);
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
203
lib/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart
Normal file
203
lib/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart
Normal file
@ -0,0 +1,203 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
import '../../tools/dateTool.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../io_type.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
|
||||
///TODO:添加掌纹
|
||||
class SenderAddPalmWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
|
||||
SenderAddPalmWithTimeCycleCoercionCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.palmNo,
|
||||
this.useCountLimit,
|
||||
this.isForce,
|
||||
this.operate,
|
||||
this.isAdmin,
|
||||
this.token,
|
||||
this.isRound,
|
||||
this.weekRound,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.needAuthor,
|
||||
this.signKey,
|
||||
this.privateKey,
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
|
||||
String? keyID;
|
||||
String? userID;
|
||||
int? palmNo;
|
||||
int? useCountLimit;
|
||||
int? isForce;
|
||||
int? operate;
|
||||
int? isAdmin;
|
||||
List<int>? token;
|
||||
int? isRound;
|
||||
int? weekRound;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
String? startTime;
|
||||
String? endTime;
|
||||
int? needAuthor;
|
||||
List<int>? signKey;
|
||||
List<int>? privateKey;
|
||||
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SenderAddPalmWithTimeCycleCoercionCommand{keyID: $keyID, '
|
||||
'userID: $userID, palmNo: $palmNo, useCountLimit: $useCountLimit, 子命令: 42, '
|
||||
'isForce: $isForce, token: $token, isRound: $isRound, '
|
||||
'weekRound: $weekRound, '
|
||||
'startDate: ${DateTool().dateIntToYMDHNString(startDate)}, '
|
||||
'endDate: ${DateTool().dateIntToYMDHNString(endDate)}, '
|
||||
'startTime: $startTime,'
|
||||
'endTime: $endTime, '
|
||||
'needAuthor: $needAuthor, signKey: $signKey, privateKey: $privateKey}';
|
||||
}
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
final List<int> data = <int>[];
|
||||
List<int> subData = <int>[];
|
||||
List<int> ebcData = <int>[];
|
||||
|
||||
// 指令类型
|
||||
data.addAll(intChangList(commandType!.typeValue));
|
||||
|
||||
// 子命令类型
|
||||
data.add(42);
|
||||
|
||||
// keyID 40
|
||||
final int keyIDLength = utf8.encode(keyID!).length;
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
final int userIDLength = utf8.encode(userID!).length;
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// palmNo
|
||||
subData.addAll(intChangList(palmNo!));
|
||||
|
||||
// UseCountLimit
|
||||
subData.addAll(intChangList(useCountLimit!));
|
||||
|
||||
// Operate 0:注册 1:修改 2:删除 3:删除全部
|
||||
subData.add(operate!);
|
||||
// AppLog.log("addCard operate:$operate");
|
||||
|
||||
// isAdmin
|
||||
subData.add(isAdmin!);
|
||||
// AppLog.log("addCard isAdmin:$isAdmin");
|
||||
|
||||
// isForce
|
||||
subData.add(isForce!);
|
||||
// AppLog.log("addCard isForce:$isForce");
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
// isRound
|
||||
subData.add(isRound!);
|
||||
|
||||
// weekRound
|
||||
subData.add(weekRound!);
|
||||
|
||||
// startDate 4
|
||||
subData.add((startDate! & 0xff000000) >> 24);
|
||||
subData.add((startDate! & 0xff0000) >> 16);
|
||||
subData.add((startDate! & 0xff00) >> 8);
|
||||
subData.add(startDate! & 0xff);
|
||||
|
||||
// endDate 4
|
||||
subData.add((endDate! & 0xff000000) >> 24);
|
||||
subData.add((endDate! & 0xff0000) >> 16);
|
||||
subData.add((endDate! & 0xff00) >> 8);
|
||||
subData.add(endDate! & 0xff);
|
||||
|
||||
// startTime 4
|
||||
final List<int> startTimeList = <int>[0,0,0,0];
|
||||
if(startTime!.contains(':')){
|
||||
final List<String> getStartTimeList = startTime!.split(':');
|
||||
startTimeList[2] = int.parse(getStartTimeList[0]);
|
||||
startTimeList[3] = int.parse(getStartTimeList[1]);
|
||||
}
|
||||
subData.addAll(startTimeList);
|
||||
|
||||
// endTime 4
|
||||
final List<int> endTimeList = <int>[0,0,0,0];
|
||||
if(endTime!.contains(':')){
|
||||
final List<String> getendTimeList = endTime!.split(':');
|
||||
endTimeList[2] = int.parse(getendTimeList[0]);
|
||||
endTimeList[3] = int.parse(getendTimeList[1]);
|
||||
}
|
||||
subData.addAll(endTimeList);
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
subData.add(0);
|
||||
} else {
|
||||
final List<int> authCodeData = <int>[];
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//authUserID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
final int add = 16 - data.length % 16;
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
|
||||
printLog(data);
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddPalmWithTimeCycleCoercionReply extends Reply {
|
||||
SenderAddPalmWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
final int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
class SenderAddPalmConfirmationReply extends Reply {
|
||||
SenderAddPalmConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
final int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -11,10 +11,6 @@ import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
///TODO:添加遥控
|
||||
/*
|
||||
备注:
|
||||
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||
**/
|
||||
class SenderAddRemoteControlWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
|
||||
SenderAddRemoteControlWithTimeCycleCoercionCommand({
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_changeAdministratorPassword.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||
@ -379,6 +380,20 @@ class CommandReciverManager {
|
||||
commandType, data);
|
||||
}
|
||||
break;
|
||||
case 42:
|
||||
{
|
||||
// 注册掌静脉开始
|
||||
reply = SenderAddPalmWithTimeCycleCoercionReply.parseData(
|
||||
commandType, data);
|
||||
}
|
||||
break;
|
||||
case 43:
|
||||
{
|
||||
// 注册掌静脉确认
|
||||
reply = SenderAddPalmConfirmationReply.parseData(
|
||||
commandType, data);
|
||||
}
|
||||
break;
|
||||
// case 50:
|
||||
// {
|
||||
// // wifi配网
|
||||
|
||||
@ -13,6 +13,8 @@ import 'io_protocol/io_addFaceCancel.dart';
|
||||
import 'io_protocol/io_addFingerprintCancel.dart';
|
||||
import 'io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
||||
import 'io_protocol/io_addICCardWithTimeCycleCoercion.dart';
|
||||
import 'io_protocol/io_addPalmCancel.dart';
|
||||
import 'io_protocol/io_addPalmWithTimeCycleCoercion.dart';
|
||||
import 'io_protocol/io_addRemoteControlCancel.dart';
|
||||
import 'io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart';
|
||||
import 'io_protocol/io_addStressPassword.dart';
|
||||
@ -740,6 +742,72 @@ class IoSenderManage {
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
//todo:添加掌静脉开始(带限时、循环、胁迫...)
|
||||
static void senderAddPalmWithTimeCycleCoercionCommand(
|
||||
{required String? keyID,
|
||||
required String? userID,
|
||||
required int? palmNo,
|
||||
required int? useCountLimit,
|
||||
required int? operate,
|
||||
required int? isAdmin,
|
||||
required int? isForce,
|
||||
required List<int>? token,
|
||||
required int? isRound,
|
||||
required int? weekRound,
|
||||
required int? startDate,
|
||||
required int? endDate,
|
||||
required String? startTime,
|
||||
required String? endTime,
|
||||
required int? needAuthor,
|
||||
required List<int>? signKey,
|
||||
required List<int>? privateKey,
|
||||
required bool? isBeforeAddUser,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: SenderAddPalmWithTimeCycleCoercionCommand(
|
||||
keyID: keyID,
|
||||
userID: userID,
|
||||
palmNo: palmNo,
|
||||
useCountLimit: useCountLimit,
|
||||
operate: operate,
|
||||
isAdmin: isAdmin,
|
||||
isForce: isForce,
|
||||
token: token,
|
||||
isRound: isRound,
|
||||
weekRound: weekRound,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
needAuthor: needAuthor,
|
||||
signKey: signKey,
|
||||
privateKey: privateKey,
|
||||
),
|
||||
isBeforeAddUser: isBeforeAddUser!,
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
//todo:取消添加掌静脉
|
||||
static void senderCancelAddPalmCommand(
|
||||
{required String? keyID,
|
||||
required String? userID,
|
||||
required List<int>? token,
|
||||
required int? needAuthor,
|
||||
required List<int>? signKey,
|
||||
required List<int>? privateKey,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: SenderCancelAddPalmCommand(
|
||||
keyID: keyID,
|
||||
userID: userID,
|
||||
token: token,
|
||||
needAuthor: needAuthor,
|
||||
signKey: signKey,
|
||||
privateKey: privateKey,
|
||||
),
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
//todo:校验时间
|
||||
static void senderTimingCommand(
|
||||
{required String? lockID,
|
||||
|
||||
@ -47,6 +47,7 @@ class CardDetailLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
if (state.isDeletCard.value == true) {
|
||||
@ -97,6 +98,7 @@ class CardDetailLogic extends BaseGetXController {
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
state.sureBtnState.value = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
state.sureBtnState.value = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +86,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
state.sureBtnState.value = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +105,14 @@ class FingerprintItemData {
|
||||
this.remoteType,
|
||||
this.adminUid,
|
||||
this.remoteRight,
|
||||
this.lockAlias
|
||||
this.lockAlias,
|
||||
|
||||
this.palmVeinId,
|
||||
this.palmVeinName,
|
||||
this.palmVeinNumber,
|
||||
this.palmVeinStatus,
|
||||
this.palmVeinType,
|
||||
this.palmVeinRight
|
||||
});
|
||||
|
||||
FingerprintItemData.fromJson(Map<String, dynamic> json) {
|
||||
@ -151,6 +158,13 @@ class FingerprintItemData {
|
||||
adminUid = json['adminUid'];
|
||||
remoteRight = json['remoteRight'];
|
||||
lockAlias = json['lockAlias'];
|
||||
|
||||
palmVeinId = json['palmVeinId'];
|
||||
palmVeinName = json['palmVeinName'];
|
||||
palmVeinNumber = json['palmVeinNumber'];
|
||||
palmVeinStatus = json['palmVeinStatus'];
|
||||
palmVeinType = json['palmVeinType'];
|
||||
palmVeinRight = json['palmVeinRight'];
|
||||
}
|
||||
int? fingerprintStatus;
|
||||
int? lockId;
|
||||
@ -197,6 +211,13 @@ class FingerprintItemData {
|
||||
int? remoteRight;
|
||||
String? lockAlias;
|
||||
|
||||
int? palmVeinId;
|
||||
String? palmVeinName;
|
||||
String? palmVeinNumber;
|
||||
int? palmVeinStatus;
|
||||
int? palmVeinType;
|
||||
int? palmVeinRight;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['fingerprintStatus'] = fingerprintStatus;
|
||||
@ -241,6 +262,14 @@ class FingerprintItemData {
|
||||
data['adminUid'] = adminUid;
|
||||
data['remoteRight'] = remoteRight;
|
||||
data['lockAlias'] = lockAlias;
|
||||
|
||||
data['palmVeinId'] = palmVeinId;
|
||||
data['palmVeinName'] = palmVeinName;
|
||||
data['palmVeinNumber'] = palmVeinNumber;
|
||||
data['palmVeinStatus'] = palmVeinStatus;
|
||||
data['palmVeinType'] = palmVeinType;
|
||||
data['palmVeinRight'] = palmVeinRight;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
43
lib/main/lockDetail/palm/addPalm/addPalm_entity.dart
Normal file
43
lib/main/lockDetail/palm/addPalm/addPalm_entity.dart
Normal file
@ -0,0 +1,43 @@
|
||||
class AddPalmEntity {
|
||||
|
||||
AddPalmEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
AddPalmEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||
}
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['errorCode'] = errorCode;
|
||||
data['description'] = description;
|
||||
data['errorMsg'] = errorMsg;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
|
||||
Data({this.palmVeinId});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
palmVeinId = json['palmVeinId'];
|
||||
}
|
||||
int? palmVeinId;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['palmVeinId'] = palmVeinId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,31 +1,283 @@
|
||||
import 'package:star_lock/main/lockDetail/palm/addPalm/addPalm_state.dart';
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart';
|
||||
|
||||
import '../../../../../tools/baseGetXController.dart';
|
||||
import '../../../../app_settings/app_settings.dart';
|
||||
import '../../../../blue/blue_manage.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 'addPalm_entity.dart';
|
||||
import 'addPalm_state.dart';
|
||||
|
||||
class AddPalmLogic extends BaseGetXController {
|
||||
final AddPalmState state = AddPalmState();
|
||||
AddPalmState state = AddPalmState();
|
||||
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
// 添加掌静脉开始
|
||||
if((reply is SenderAddPalmWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||
_replyAddICCardBegin(reply);
|
||||
}
|
||||
|
||||
// 添加掌静脉确认
|
||||
if(reply is SenderAddPalmConfirmationReply) {
|
||||
_replyAddICCardConfirmation(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
final List<int> cardNumberList = reply.data.sublist(reply.data.length - 2);
|
||||
final String cardNumber = listChangInt(cardNumberList).toString();
|
||||
// AppLog.log("添加卡号:$cardNumberList cardNumber:$cardNumber");
|
||||
state.palmNumber.value = cardNumber.toString();
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
state.ifAddState.value = true;
|
||||
state.ifConnectScuess.value = true;
|
||||
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!);
|
||||
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
final List<int> token = reply.data.sublist(5, 9);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
AppLog.log('添加卡token:$token');
|
||||
|
||||
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||
keyID:'1',
|
||||
userID:await Storage.getUid(),
|
||||
palmNo:0,
|
||||
useCountLimit:0xffff,
|
||||
operate:0, // 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin:state.isAdministrator.value == '2' ? 1 : 0,
|
||||
isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||
startDate: int.parse(state.startDate.value)~/1000,
|
||||
endDate: int.parse(state.endDate.value)~/1000,
|
||||
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: token,
|
||||
isBeforeAddUser: false
|
||||
);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
state.ifAddState.value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
state.ifAddState.value = false;
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
switch(reply.data[5]){
|
||||
case 0xff:
|
||||
// 注册指纹失败
|
||||
showToast('退出添加'.tr);
|
||||
Get.close(1);
|
||||
break;
|
||||
case 0xFE:
|
||||
// 管理员已满
|
||||
showToast('管理员已满'.tr);
|
||||
Get.close(1);
|
||||
break;
|
||||
case 0xFD:
|
||||
// 用户已满
|
||||
showToast('用户已满'.tr);
|
||||
Get.close(1);
|
||||
break;
|
||||
case 0xFC:
|
||||
// 指纹已满
|
||||
showToast('锁上面添加卡已满'.tr);
|
||||
Get.close(1);
|
||||
break;
|
||||
case 0xFB:
|
||||
// 指纹已存在
|
||||
showToast('掌静脉已存在'.tr);
|
||||
break;
|
||||
default:
|
||||
// 添加指纹中
|
||||
// 当前注册数
|
||||
addICCardData();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加掌静脉
|
||||
Future<void> senderAddPalm() async {
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
Get.close(1);
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
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.senderAddPalmWithTimeCycleCoercionCommand(
|
||||
keyID:'1',
|
||||
userID:await Storage.getUid(),
|
||||
palmNo:0,
|
||||
useCountLimit:0xffff,
|
||||
operate:0, // 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin:state.isAdministrator.value == '2' ? 1 : 0,
|
||||
isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||
startDate: int.parse(state.startDate.value)~/1000,
|
||||
endDate: int.parse(state.endDate.value)~/1000,
|
||||
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
isBeforeAddUser: false
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected){
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
cancelBlueConnetctToastTimer();
|
||||
Get.close(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 取消添加指纹
|
||||
Future<void> senderCancelAddCardCommand() async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||
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<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.senderCancelAddPalmCommand(
|
||||
keyID:'1',
|
||||
userID:await Storage.getUid(),
|
||||
needAuthor:1,
|
||||
signKey:signKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
}else if (deviceConnectionState == BluetoothConnectionState.disconnected){
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
cancelBlueConnetctToastTimer();
|
||||
Get.close(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> addICCardData() async {
|
||||
final AddPalmEntity entity = await ApiRepository.to.addPalmData(
|
||||
lockId: state.lockId.value.toString(),
|
||||
palmVeinName: state.palmName.value.toString(),
|
||||
palmVeinNumber: state.palmNumber.value.toString(),
|
||||
palmVeinType: int.parse(state.palmType.value),
|
||||
startDate: int.parse(state.startDate.value),
|
||||
endDate: int.parse(state.endDate.value),
|
||||
addType: int.parse(state.addType.value),
|
||||
weekDay: state.weekDay.value,
|
||||
startTime: int.parse(state.effectiveDateTime.value),
|
||||
endTime: int.parse(state.failureDateTime.value),
|
||||
// remoteRight: state.isAdministrator.value == '2' ? 1 : 0,
|
||||
palmVeinRight: 0,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
updateIdCardUserNoLoadData(entity.data!.palmVeinId ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateIdCardUserNoLoadData(int palmVeinId) async{
|
||||
final LoginEntity entity = await ApiRepository.to.updatePalmUserNoLoadData(
|
||||
lockId: state.lockId.value,
|
||||
palmVeinId: palmVeinId,
|
||||
palmVeinUserNo: state.palmNumber.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast('添加成功'.tr, something:(){
|
||||
if(state.fromType.value == 2){
|
||||
// 回调指纹号
|
||||
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.palmNumber.value));
|
||||
}else if(state.fromType.value == 1){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
Get.close(2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
// _initReplySubscription();
|
||||
_initReplySubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
//开始添加后发送指令
|
||||
// senderAddFace();
|
||||
|
||||
senderAddPalm();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
// _replySubscription.cancel();
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ class _AddPalmPageState extends State<AddPalmPage> {
|
||||
height: 50.h,
|
||||
),
|
||||
Obx(() => Image.asset(
|
||||
state.isClickAddFace.value == false
|
||||
state.isClickAddPalm.value == false
|
||||
? 'images/main/icon_addPalm_step1.png'
|
||||
: 'images/main/icon_addPalm_step1.png',
|
||||
width: 100.w,
|
||||
@ -63,29 +63,36 @@ class _AddPalmPageState extends State<AddPalmPage> {
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
Obx(
|
||||
() => state.isClickAddFace.value == false
|
||||
? Container(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: SubmitBtn(
|
||||
btnName: '准备好了,开始添加',
|
||||
borderRadius: 20.w,
|
||||
onClick: () {
|
||||
state.isClickAddFace.value = true;
|
||||
}),
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'正在录入中...',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 22.sp),
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
],
|
||||
),
|
||||
Obx(() => state.isClickAddPalm.value == false
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
state.isClickAddPalm.value = true;
|
||||
},
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
),
|
||||
child: Center(child: Text('准备好了,开始添加', style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
|
||||
)
|
||||
: Container(
|
||||
width: 1.sw,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
state.ifConnectScuess.value
|
||||
? '已连接到锁,请自然张开手掌,掌心正对摄像头'
|
||||
: '尝试连接设备...',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp))),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@ -1,37 +1,50 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../app_settings/app_settings.dart';
|
||||
import '../../../../tools/commonDataManage.dart';
|
||||
|
||||
class AddPalmState {
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
|
||||
var ifConnectScuess = false.obs;
|
||||
var maxRegCount = 0.obs; // 最大注册次数
|
||||
var regIndex = 0.obs; // 当前注册次数
|
||||
|
||||
var faceNumber = "".obs;
|
||||
|
||||
final lockId = 0.obs;
|
||||
final endDate = 0.obs;
|
||||
final addType = "".obs;
|
||||
final faceName = "".obs;
|
||||
final faceType = 0.obs;
|
||||
final startDate = 0.obs;
|
||||
final cyclicConfig = [].obs;
|
||||
final fromType = 1.obs;
|
||||
final featureData = ''.obs;
|
||||
final isClickAddFace = false.obs;
|
||||
final isAdministrator = false.obs;
|
||||
|
||||
AddPalmState() {
|
||||
Map map = Get.arguments;
|
||||
lockId.value = map["lockId"];
|
||||
endDate.value = map["endDate"];
|
||||
addType.value = map["addType"];
|
||||
faceName.value = map["faceName"];
|
||||
faceType.value = map["faceType"];
|
||||
startDate.value = map["startDate"];
|
||||
lockId.value = map["lockId"];
|
||||
cyclicConfig.value = map["cyclicConfig"];
|
||||
fromType.value = map["fromType"];
|
||||
isAdministrator.value = map["isAdministrator"];
|
||||
lockId.value = map['lockId'];
|
||||
addType.value = map['addType'];
|
||||
palmName.value = map['palmName'];
|
||||
palmNumber.value = map['palmNumber'];
|
||||
palmType.value = map['palmType'];
|
||||
isCoerced.value = map['isCoerced'];
|
||||
AppLog.log('1111-isCoerced.value:${isCoerced.value}');
|
||||
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'];
|
||||
//循环类型下,结束时间加一天
|
||||
if (selectType.value == '2') {
|
||||
endDate.value = "${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}";
|
||||
} else {
|
||||
endDate.value = map['endDate'];
|
||||
}
|
||||
}
|
||||
RxBool ifConnectScuess = false.obs;
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
RxBool ifAddState = false.obs;// 是否是添加状态,如果是添加状态,返回上级界面发送取消添加指令
|
||||
|
||||
RxInt addFingerprintProcessNumber = 0.obs;
|
||||
final RxInt lockId = 0.obs;
|
||||
final RxString endDate = ''.obs;
|
||||
final RxString addType = ''.obs;
|
||||
final RxString palmName = ''.obs;
|
||||
final RxString palmNumber = ''.obs;
|
||||
final RxString palmType = ''.obs;
|
||||
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;
|
||||
final isClickAddPalm = false.obs;
|
||||
}
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmTypeManage/addPalmTypeManage_tabbar.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
class AddPalmTypeManagePage extends StatefulWidget {
|
||||
const AddPalmTypeManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddPalmTypeManagePage> createState() => _AddPalmTypeManagePageState();
|
||||
}
|
||||
|
||||
class _AddPalmTypeManagePageState extends State<AddPalmTypeManagePage> {
|
||||
int index = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Map map = Get.arguments;
|
||||
final lockId = map['lockId'];
|
||||
final fromType = map['fromType']; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
String fromTypeTwoStaffName = '';
|
||||
if (fromType == 2) {
|
||||
fromTypeTwoStaffName = map['fromTypeTwoStaffName']; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '添加手掌',
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
AddPalmTypeManageTabbar(
|
||||
lockId: lockId,
|
||||
fromType: fromType,
|
||||
fromTypeTwoStaffName: fromTypeTwoStaffName,
|
||||
initialIndex: index),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,131 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmType_page.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
class AddPalmTypeManageTabbar extends StatefulWidget { // 从添加员工进入 传入员工名字
|
||||
AddPalmTypeManageTabbar(
|
||||
{required this.lockId, required this.fromType, required this.fromTypeTwoStaffName, required this.initialIndex, Key? key})
|
||||
: super(key: key);
|
||||
int initialIndex = 1;
|
||||
int lockId = 0;
|
||||
int fromType = 1; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
String fromTypeTwoStaffName = '';
|
||||
|
||||
@override
|
||||
State<AddPalmTypeManageTabbar> createState() =>
|
||||
_AddPalmTypeManageTabbarState();
|
||||
}
|
||||
|
||||
class _AddPalmTypeManageTabbarState extends State<AddPalmTypeManageTabbar>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: '永久'.tr, selectType: '0'),
|
||||
ItemView(title: '限时'.tr, selectType: '1'),
|
||||
ItemView(title: '循环'.tr, selectType: '2'),
|
||||
];
|
||||
|
||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
ItemView(title: '永久'.tr, selectType: '0'),
|
||||
ItemView(title: '限时'.tr, selectType: '1'),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
|
||||
_tabController.addListener(() {
|
||||
if (_tabController.animation!.value == _tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
tabs: widget.fromType == 1
|
||||
? _itemTabs.map(_tab).toList()
|
||||
: _fromCheckInTypeItemTabs
|
||||
.map(_tab)
|
||||
.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: _tabController,
|
||||
children: widget.fromType == 1
|
||||
? _itemTabs
|
||||
.map((ItemView item) => AddPalmTypePage(
|
||||
selectType: item.selectType,
|
||||
lockId: widget.lockId,
|
||||
fromType: widget.fromType,
|
||||
fromTypeTwoStaffName: widget.fromTypeTwoStaffName))
|
||||
.toList()
|
||||
: _itemTabs
|
||||
.map((ItemView item) => AddPalmTypePage(
|
||||
selectType: item.selectType,
|
||||
lockId: widget.lockId,
|
||||
fromType: widget.fromType,
|
||||
fromTypeTwoStaffName: widget.fromTypeTwoStaffName))
|
||||
.toList(),
|
||||
|
||||
// _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
@ -4,6 +4,7 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/time_utils.dart';
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../login/login/entity/LoginEntity.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
|
||||
class AddPalmTypeLogic extends BaseGetXController {
|
||||
@ -13,33 +14,32 @@ class AddPalmTypeLogic extends BaseGetXController {
|
||||
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList();
|
||||
}
|
||||
|
||||
// 添加指纹
|
||||
void addPalmData() async {
|
||||
var palmType = 0; // 永久:1;限时2,单次3,循环:4
|
||||
var startDate = "";
|
||||
var endDate = "";
|
||||
var startTime = "";
|
||||
var endTime = "";
|
||||
if (state.selectType.value == "0") {
|
||||
palmType = 1;
|
||||
startDate = "0";
|
||||
endDate = "0";
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
} else if (state.selectType.value == "1") {
|
||||
palmType = 2;
|
||||
startDate =
|
||||
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
// 添加卡数据
|
||||
Future<void> _addPalmData() async {
|
||||
int carType = 0; // 永久:1;限时2,单次3,循环:4
|
||||
String startDate = '';
|
||||
String endDate = '';
|
||||
String startTime = '';
|
||||
String endTime = '';
|
||||
if (state.selectType.value == '0') {
|
||||
carType = 1;
|
||||
startDate = '0';
|
||||
endDate = '0';
|
||||
startTime = '0';
|
||||
endTime = '0';
|
||||
} else if (state.selectType.value == '1') {
|
||||
carType = 2;
|
||||
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||
startTime = '0';
|
||||
endTime = '0';
|
||||
|
||||
if (startDate.isEmpty) {
|
||||
showToast("请选择开始时间".tr);
|
||||
showToast('请选择开始时间'.tr);
|
||||
return;
|
||||
}
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间".tr);
|
||||
showToast('请选择结束时间'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -49,47 +49,50 @@ class AddPalmTypeLogic extends BaseGetXController {
|
||||
// }
|
||||
|
||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
showToast('失效时间要大于生效时间'.tr);
|
||||
return;
|
||||
}
|
||||
} else if (state.selectType.value == "2") {
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择有效期".tr);
|
||||
// AppLog.log("state.timeLimitBeginTime.value:${state.timeLimitBeginTime.value} startDate:$startDate");
|
||||
// AppLog.log("state.timeLimitEndTime.value:${state.timeLimitEndTime.value} endDate:$endDate");
|
||||
} else if (state.selectType.value == '2') {
|
||||
if (state.cycleBeginTime.value.isEmpty) {
|
||||
showToast('请选择有效期'.tr);
|
||||
return;
|
||||
}
|
||||
startDate =
|
||||
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startTime = DateTool()
|
||||
.dateToTimestamp(state.effectiveDateTime.value, 0)
|
||||
.toString();
|
||||
endTime =
|
||||
DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||
palmType = 4;
|
||||
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();
|
||||
carType = 4;
|
||||
}
|
||||
// 人脸
|
||||
Get.toNamed(Routers.addPalmPage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
"endDate": int.parse(endDate),
|
||||
"addType": "1",
|
||||
"faceName": state.nameController.text,
|
||||
"faceNumber": "123456",
|
||||
"faceType": palmType,
|
||||
"startDate": int.parse(startDate),
|
||||
"cyclicConfig": state.weekdaysList.value,
|
||||
"fromType": state.fromType.value,
|
||||
"isAdministrator": state.isAdministrator.value,
|
||||
|
||||
Get.toNamed(Routers.addPalmPage, arguments: <String, Object>{
|
||||
'lockId': state.lockId.value,
|
||||
'endDate': endDate,
|
||||
'addType': '1',
|
||||
'palmName': state.nameController.text,
|
||||
'palmNumber': '123456',
|
||||
'palmType': carType.toString(),
|
||||
'isCoerced': state.isStressFingerprint.value == false ? '2' : '1',
|
||||
'startDate': startDate,
|
||||
'weekDay': state.weekdaysList.value,
|
||||
'fromType': state.fromType.value,
|
||||
'isAdministrator': state.isAdministrator.value == false ? '1' : '2', // 1:不是管理员 2:是管理员
|
||||
'effectiveTime': startTime,
|
||||
'failureTime': endTime,
|
||||
'selectType': state.selectType.value,
|
||||
});
|
||||
}
|
||||
|
||||
// 校验手掌名字是否重复
|
||||
void checkPalmNameDuplicated(String palmName) async {
|
||||
var entity = await ApiRepository.to.checkFaceNameDuplicatedData(
|
||||
// 校验卡名字是否重复
|
||||
Future<void> checkpalmNameDuplicated(String palmName) async{
|
||||
final LoginEntity entity = await ApiRepository.to.checkPalmNameDuplicatedData(
|
||||
lockId: state.lockId.value.toString(),
|
||||
faceName: palmName,
|
||||
palmVeinName: palmName,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
addPalmData();
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
_addPalmData();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,101 +13,112 @@ import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
|
||||
class AddPalmTypePage extends StatefulWidget { // 从添加员工进入 传入员工名字
|
||||
|
||||
const AddPalmTypePage(
|
||||
{required this.selectType, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName, Key? key})
|
||||
: super(key: key);
|
||||
final String selectType; // 永久限时循环下标
|
||||
final int lockId;
|
||||
final int fromType; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final String fromTypeTwoStaffName;
|
||||
const AddPalmTypePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddPalmTypePage> createState() => _AddPalmTypePageState();
|
||||
}
|
||||
|
||||
class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
class _AddPalmTypePageState extends State<AddPalmTypePage> with SingleTickerProviderStateMixin {
|
||||
final AddPalmTypeLogic logic = Get.put(AddPalmTypeLogic());
|
||||
final AddPalmTypeState state = Get.find<AddPalmTypeLogic>().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 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: '添加掌静脉'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
switch (int.parse(widget.selectType)) {
|
||||
switch (int.parse(state.selectType.value)) {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
perpetualKeyWidget(
|
||||
'姓名'.tr,
|
||||
'请输入'.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
perpetualKeyWidget(
|
||||
'姓名'.tr,
|
||||
'请输入'.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
perpetualKeyWidget(
|
||||
'姓名'.tr,
|
||||
'请输入'.tr,
|
||||
state.nameController),
|
||||
keyTimeLimitWidget(),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
perpetualKeyWidget(
|
||||
'姓名'.tr,
|
||||
'请输入'.tr,
|
||||
state.nameController),
|
||||
keyTimeLimitWidget(),
|
||||
// SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
perpetualKeyWidget(
|
||||
'姓名'.tr,
|
||||
'请输入'.tr,
|
||||
state.nameController),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
perpetualKeyWidget(
|
||||
'姓名'.tr,
|
||||
'请输入'.tr,
|
||||
state.nameController),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
default:
|
||||
@ -120,7 +131,6 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
String titleStr, String rightTitle, TextEditingController controller) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: titleStr,
|
||||
rightTitle: '',
|
||||
@ -137,28 +147,30 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '生效时间'.tr,
|
||||
rightTitle: state.beginTime.value,
|
||||
rightTitle: state.timeLimitBeginTime.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
final PDuration selectDate =
|
||||
PDuration.parse(DateTime.tryParse(state.beginTime.value));
|
||||
final PDuration selectDate = PDuration.parse(
|
||||
DateTime.parse(state.timeLimitBeginTime.value));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
state.timeLimitBeginTime.value =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '失效时间'.tr,
|
||||
rightTitle: state.endTime.value,
|
||||
rightTitle: state.timeLimitEndTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
final PDuration selectDate =
|
||||
PDuration.parse(DateTime.tryParse(state.endTime.value));
|
||||
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
state.timeLimitEndTime.value =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
@ -171,22 +183,23 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '有效期'.tr,
|
||||
rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
|
||||
rightTitle:
|
||||
'${state.cycleBeginTime.value}\n${state.cycleEndTime.value}',
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
final result =
|
||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
|
||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
|
||||
'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'];
|
||||
}
|
||||
@ -202,15 +215,15 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: <String, Object>{
|
||||
'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'];
|
||||
}
|
||||
@ -219,25 +232,23 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
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 {
|
||||
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: <String, Object>{
|
||||
'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'];
|
||||
Get.back(result: result);
|
||||
}
|
||||
}))),
|
||||
],
|
||||
@ -255,7 +266,23 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin())))),
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin())))),
|
||||
SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '胁迫掌静脉',
|
||||
rightTitle: '',
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h),
|
||||
child: Text(
|
||||
"${"当被胁迫要求强行开锁时,使用胁迫卡会触发报警,报警信息会推送给管理员,该功能需要锁联网。".tr}\n${"请不要将胁迫掌静脉用于日常开锁"}",
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
)),
|
||||
SizedBox(height: 30.h),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||
@ -263,13 +290,14 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
if (state.nameController.text.isEmpty) {
|
||||
logic.showToast('请输入姓名');
|
||||
logic.showToast('请输入姓名'.tr);
|
||||
return;
|
||||
}
|
||||
logic.checkPalmNameDuplicated(state.nameController.text);
|
||||
|
||||
logic.checkpalmNameDuplicated(state.nameController.text);
|
||||
} else {
|
||||
// Get.toNamed(Routers.selectLockTypePage);
|
||||
logic.showToast('演示模式');
|
||||
logic.showToast('演示模式'.tr);
|
||||
}
|
||||
}),
|
||||
],
|
||||
@ -293,7 +321,7 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
maxLines: 1,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(18),
|
||||
LengthLimitingTextInputFormatter(50),
|
||||
],
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
@ -307,16 +335,16 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
hintStyle: TextStyle(fontSize: 22.sp),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
disabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
border: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||
),
|
||||
),
|
||||
@ -329,6 +357,19 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
);
|
||||
}
|
||||
|
||||
//isStressFingerprint false:不是胁迫指纹 ture:胁迫指纹
|
||||
CupertinoSwitch _isStressFingerprint() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isStressFingerprint.value,
|
||||
onChanged: (bool value) {
|
||||
state.isStressFingerprint.value = value;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
@ -341,4 +382,75 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: '永久'.tr, selectType: '0'),
|
||||
ItemView(title: '限时'.tr, selectType: '1'),
|
||||
ItemView(title: '循环'.tr, selectType: '2'),
|
||||
];
|
||||
|
||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
ItemView(title: '永久'.tr, selectType: '0'),
|
||||
ItemView(title: '限时'.tr, selectType: '1'),
|
||||
];
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: state.tabController,
|
||||
onTap: (int index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: state.fromType.value == 1
|
||||
? _itemTabs.map(_tab).toList()
|
||||
: _fromCheckInTypeItemTabs
|
||||
.map(_tab)
|
||||
.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;
|
||||
}
|
||||
@ -1,28 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AddPalmTypeState {
|
||||
final lockId = 0.obs;
|
||||
final selectType = "0".obs; // 0永久 1显示 2循环
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
||||
final isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs; // 是否为管理员
|
||||
import '../../../../tools/dateTool.dart';
|
||||
|
||||
var beginTime = "".obs; // 开始时间
|
||||
var endTime = "".obs; // 结束时间
|
||||
var effectiveDateTime = "".obs; // 生效时间
|
||||
var failureDateTime = "".obs; // 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
class AddPalmTypeState {
|
||||
AddPalmTypeState() {
|
||||
Map map = Get.arguments;
|
||||
lockId.value = map['lockId'];
|
||||
fromType.value = map['fromType'];
|
||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
if(fromType.value == 2){
|
||||
fromTypeTwoStaffName.value = map['fromTypeTwoStaffName']; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
}
|
||||
|
||||
final RxInt lockId = 0.obs;
|
||||
final RxString selectType = '0'.obs;// 0永久 1限时 2循环
|
||||
final RxInt fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final RxBool isStressFingerprint = false.obs;
|
||||
final RxBool isAdministrator = false.obs;// 是否是管理员
|
||||
|
||||
RxString timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||
RxString timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||
RxString cycleBeginTime = ''.obs;// 循环开始时间
|
||||
RxString cycleEndTime = ''.obs;// 循环结束时间
|
||||
RxString effectiveDateTime = ''.obs;// 生效时间
|
||||
RxString failureDateTime = ''.obs;// 失效时间
|
||||
RxList weekdaysList = [].obs;
|
||||
RxString fromTypeTwoStaffName = ''.obs; // 从添加员工进入 传入员工名字
|
||||
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
AddPalmTypeState() {
|
||||
// Map map = Get.arguments;
|
||||
// lockId.value = map["lockId"];
|
||||
// fromType.value = map["fromType"];
|
||||
// if(fromType.value == 2){
|
||||
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
// // nameController.text = fromTypeTwoStaffName.value;
|
||||
// }
|
||||
}
|
||||
late TabController tabController;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/palmDetail/palmDetail_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -12,6 +13,8 @@ import '../../../../blue/blue_manage.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/storage.dart';
|
||||
@ -25,62 +28,77 @@ class PalmDetailLogic extends BaseGetXController {
|
||||
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 添加卡片开始(重置锁里面所有卡)
|
||||
// if ((reply is SenderAddICCardReply)) {
|
||||
// _replyAddICCardBegin(reply);
|
||||
// }
|
||||
});
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
// 添加卡片开始(重置锁里面所有卡)
|
||||
if ((reply is SenderAddPalmWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||
_replyAddPalmControlBegin(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 添加卡片开始(此处用作删除卡片)
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Future<void> _replyAddPalmControlBegin(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
deletPalmData();
|
||||
if (state.isDeletPalmVein.value == true) {
|
||||
deletPalmData();
|
||||
} else {
|
||||
editPalmData();
|
||||
}
|
||||
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!);
|
||||
final List<int> token = reply.data.sublist(5, 9);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
String? userID = await Storage.getUid();
|
||||
// IoSenderManage.senderAddICCardCommand(
|
||||
// keyID: state.keyId.value.toString(),
|
||||
// userID: userID,
|
||||
// cardNo: int.parse(state.typeNumber.value),
|
||||
// useCountLimit: 0,
|
||||
// startTime: int.parse(state.starDate.value),
|
||||
// endTime: int.parse(state.endDate.value),
|
||||
// needAuthor: 1,
|
||||
// signKey: signKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: getTokenList,
|
||||
// );
|
||||
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||
keyID: state.keyId.value.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
palmNo: int.parse(state.typeNumber.value),
|
||||
useCountLimit: 0xffff,
|
||||
operate: state.isDeletPalmVein.value ? 2 : 1,
|
||||
// 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||
isForce: state.isStressPalm.value == true ? 1 : 0, // 是否是胁迫
|
||||
isRound: state.keyType.value == 4 ? 1 : 0, // 是否是循环
|
||||
weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||
startDate: int.parse(state.startDate.value) ~/ 1000,
|
||||
endDate: int.parse(state.endDate.value) ~/ 1000,
|
||||
startTime: DateTool().dateToHNString(state.starTime.value),
|
||||
endTime: DateTool().dateToHNString(state.endTime.value),
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token,
|
||||
isBeforeAddUser: false);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
//失败
|
||||
state.sureBtnState.value = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加手掌
|
||||
// 添加卡片
|
||||
Future<void> senderAddPalm() async {
|
||||
if (state.sureBtnState.value == 1) {
|
||||
return;
|
||||
@ -92,34 +110,37 @@ class PalmDetailLogic extends BaseGetXController {
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (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!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
String? userID = await Storage.getUid();
|
||||
// IoSenderManage.senderAddICCardCommand(
|
||||
// keyID: state.keyId.value.toString(),
|
||||
// userID: userID,
|
||||
// cardNo: int.parse(state.typeNumber.value),
|
||||
// useCountLimit: 0,
|
||||
// startTime: int.parse(state.starDate.value),
|
||||
// endTime: int.parse(state.endDate.value),
|
||||
// needAuthor: 1,
|
||||
// signKey: signKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: getTokenList,
|
||||
// );
|
||||
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||
keyID: state.keyId.value.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
palmNo: int.parse(state.typeNumber.value),
|
||||
useCountLimit: 0xffff,
|
||||
operate: state.isDeletPalmVein.value ? 2 : 1,
|
||||
// 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||
isForce: state.isStressPalm.value == true ? 1 : 0, // 是否是胁迫
|
||||
isRound: state.keyType.value == 4 ? 1 : 0, // 是否是循环
|
||||
weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||
startDate: int.parse(state.startDate.value) ~/ 1000,
|
||||
endDate: int.parse(state.endDate.value) ~/ 1000,
|
||||
startTime: DateTool().dateToHNString(state.starTime.value),
|
||||
endTime: DateTool().dateToHNString(state.endTime.value),
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
isBeforeAddUser: false);
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
@ -132,74 +153,67 @@ class PalmDetailLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
// 编辑iC卡
|
||||
void editPalmData() async {
|
||||
var entity = await ApiRepository.to.editICCardData(
|
||||
cardId: state.keyId.value.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startDate: state.starDate.value * 1000,
|
||||
endDate: state.endDate.value * 1000,
|
||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||
cardName: state.changeNameController.text,
|
||||
changeType: "1",
|
||||
// 编辑遥控
|
||||
Future<void> editPalmData() async {
|
||||
final LoginEntity entity = await ApiRepository.to.editPalmData(
|
||||
lockId: state.fingerprintItemData.value.lockId ?? 0,
|
||||
palmVeinId: state.keyId.value,
|
||||
startDate: int.parse(state.startDate.value),
|
||||
endDate: int.parse(state.endDate.value),
|
||||
startTime: int.parse(state.starTime.value),
|
||||
endTime: int.parse(state.endTime.value),
|
||||
cardType: state.keyType.value,
|
||||
cardRight: 0,
|
||||
palmVeinType: state.keyType.value,
|
||||
isCoerced: state.isStressPalm.value ? 1 : 2,
|
||||
weekDay: state.weekDay.value,
|
||||
palmVeinName: state.changeNameController.text,
|
||||
addType: 1,
|
||||
palmVeinRight: state.isAdministrator.value ? 1 : 0,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: () {
|
||||
state.fingerprintItemData.value.palmVeinName = state.changeNameController.text;
|
||||
// state.fingerprintItemData.value.isCoerced = state.isStressCard.value ? 1 : 2;
|
||||
// state.fingerprintItemData.value.cardRight = state.isAdministrator.value ? 1 : 0;
|
||||
showToast('修改成功'.tr, something: () {
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 删除IC卡
|
||||
void deletPalmData() async {
|
||||
var entity = await ApiRepository.to.deletIcCardData(
|
||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
type: "0",
|
||||
deleteType: "1");
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功", something: () {
|
||||
Get.back(result: "addScuess");
|
||||
});
|
||||
}
|
||||
// 删除遥控
|
||||
Future<void> deletPalmData() async {
|
||||
// final LoginEntity entity = await ApiRepository.to.deletRemoteControlData(
|
||||
// remoteId: state.fingerprintItemData.value.remoteId ?? 0,
|
||||
// );
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// showToast('删除成功'.tr, something: () {
|
||||
// Get.back(result: 'addScuess');
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
String getKeyTypeShowDateTime() {
|
||||
String useDateStr = '';
|
||||
if (state.keyType.value == 1) {
|
||||
useDateStr = "永久";
|
||||
useDateStr = '永久'.tr;
|
||||
} else if (state.keyType.value == 2) {
|
||||
useDateStr =
|
||||
"${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||
'${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}';
|
||||
} else if (state.keyType.value == 4) {
|
||||
useDateStr =
|
||||
"${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||
'${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
_replySubscription.cancel();
|
||||
|
||||
@ -4,8 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/palmDetail/palmDetail_logic.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
@ -17,6 +16,7 @@ import '../../../../tools/showTFView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'palmDetail_state.dart';
|
||||
|
||||
class PalmDetailPage extends StatefulWidget {
|
||||
const PalmDetailPage({Key? key}) : super(key: key);
|
||||
@ -26,8 +26,8 @@ class PalmDetailPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
final IrisDetailLogic logic = Get.put(IrisDetailLogic());
|
||||
final IrisDetailState state = Get.find<IrisDetailLogic>().state;
|
||||
final PalmDetailLogic logic = Get.put(PalmDetailLogic());
|
||||
final PalmDetailState state = Get.find<PalmDetailLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -76,7 +76,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data['beginTimeTimestamp'];
|
||||
state.startDate.value = data['beginTimeTimestamp'];
|
||||
state.endDate.value = data['endTimeTimestamp'];
|
||||
state.keyType.value = 2;
|
||||
});
|
||||
@ -92,7 +92,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data['starDate'];
|
||||
state.startDate.value = data['starDate'];
|
||||
state.endDate.value = data['endDate'];
|
||||
state.starTime.value = data['starTime'];
|
||||
state.endTime.value = data['endTime'];
|
||||
@ -118,7 +118,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data['starDate'];
|
||||
state.startDate.value = data['starDate'];
|
||||
state.endDate.value = data['endDate'];
|
||||
state.starTime.value = data['starTime'];
|
||||
state.endTime.value = data['endTime'];
|
||||
@ -143,7 +143,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data['starDate'];
|
||||
state.startDate.value = data['starDate'];
|
||||
state.endDate.value = data['endDate'];
|
||||
state.starTime.value = data['starTime'];
|
||||
state.endTime.value = data['endTime'];
|
||||
@ -162,6 +162,22 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
.dateToYMDHNString(state.addTime.value.toString()),
|
||||
)),
|
||||
SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '胁迫掌静脉',
|
||||
rightTitle: '',
|
||||
isTipsImg: false,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isStressPalm()))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '是否为管理员'.tr,
|
||||
rightTitle: '',
|
||||
isTipsImg: false,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
CommonItem(
|
||||
leftTitel: '操作记录'.tr,
|
||||
rightTitle: '',
|
||||
@ -224,7 +240,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
sureClick: () async {
|
||||
Get.back();
|
||||
// String? idStr = await Storage.getUid();
|
||||
logic.senderAddICCard();
|
||||
logic.senderAddPalm();
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
@ -233,6 +249,37 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
});
|
||||
}
|
||||
|
||||
CupertinoSwitch _isStressPalm() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isStressPalm.value,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
state.isStressPalm.value = value;
|
||||
state.isDeletPalmVein.value = false;
|
||||
logic.senderAddPalm();
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isAdministrator.value,
|
||||
onChanged: (bool value) {
|
||||
// state.isAdministrator.value = value;
|
||||
// state.isDeletPalmVein.value = false;
|
||||
// logic.senderAddPalm();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
|
||||
@ -4,44 +4,45 @@ import 'package:get/get.dart';
|
||||
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
|
||||
class PalmDetailState {
|
||||
final fingerprintItemData = FingerprintItemData().obs;
|
||||
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||
|
||||
final typeNumber = "".obs; // 指纹号
|
||||
final typeName = "".obs; // 指纹名字
|
||||
var starDate = "".obs; // 开始时间
|
||||
var endDate = "".obs; // 结束时间
|
||||
var starTime = "".obs; // 生效时间
|
||||
var endTime = "".obs; // 失效时间
|
||||
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs; // 有效日
|
||||
var adder = "".obs; // 添加者
|
||||
var addTime = 0.obs; // 添加时间
|
||||
var keyId = 0.obs; // 卡id
|
||||
|
||||
final isStressFingerprint = false.obs;
|
||||
PalmDetailState() {
|
||||
Map map = Get.arguments;
|
||||
if ((map["fingerprintItemData"] != null)) {
|
||||
fingerprintItemData.value = map["fingerprintItemData"];
|
||||
keyId.value = fingerprintItemData.value.cardId!;
|
||||
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
||||
typeName.value = fingerprintItemData.value.cardName!;
|
||||
if (map['fingerprintItemData'] != null) {
|
||||
fingerprintItemData.value = map['fingerprintItemData'];
|
||||
keyId.value = fingerprintItemData.value.palmVeinId!;
|
||||
typeNumber.value = fingerprintItemData.value.palmVeinNumber!;
|
||||
typeName.value = fingerprintItemData.value.palmVeinName!;
|
||||
changeNameController.text = typeName.value;
|
||||
starDate.value = fingerprintItemData.value.startDate!.toString();
|
||||
startDate.value = fingerprintItemData.value.startDate!.toString();
|
||||
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||
keyType.value = fingerprintItemData.value.cardType!;
|
||||
keyType.value = fingerprintItemData.value.palmVeinType!;
|
||||
adder.value = fingerprintItemData.value.senderUsername!;
|
||||
addTime.value = fingerprintItemData.value.createDate!;
|
||||
isStressFingerprint.value =
|
||||
fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||
isStressPalm.value = fingerprintItemData.value.isCoerced! == 1;
|
||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||
isAdministrator.value = fingerprintItemData.value.palmVeinRight! == 1;
|
||||
}
|
||||
}
|
||||
final Rx<FingerprintItemData> fingerprintItemData = FingerprintItemData().obs;
|
||||
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
RxInt sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||
RxBool isDeletPalmVein = true.obs; // 是否删除卡
|
||||
RxBool isStressPalm = false.obs; // 是否胁迫
|
||||
RxBool isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
final RxString typeNumber = ''.obs; // 指纹号
|
||||
final RxString typeName = ''.obs; // 指纹名字
|
||||
RxString startDate = ''.obs; // 开始时间
|
||||
RxString endDate = ''.obs; // 结束时间
|
||||
RxString starTime = ''.obs; // 生效时间
|
||||
RxString endTime = ''.obs; // 失效时间
|
||||
final RxInt keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||
RxList weekDay = [].obs; // 有效日
|
||||
RxString adder = ''.obs; // 添加者
|
||||
RxInt addTime = 0.obs; // 添加时间
|
||||
RxInt keyId = 0.obs; // 卡id
|
||||
}
|
||||
|
||||
@ -1,18 +1,19 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_queryingFaceStatus.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_checkingUserInfoCount.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 '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
|
||||
@ -22,365 +23,228 @@ class PalmListLogic extends BaseGetXController {
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
// 添加人脸开始(此处用作删除人脸)
|
||||
if ((reply is SenderAddFaceReply) && (state.isDeletFaceData == true)) {
|
||||
_replyAddFaceBegin(reply);
|
||||
}
|
||||
|
||||
if (reply is SenderQueryingFaceStatusReply) {
|
||||
// 获取人脸状态
|
||||
_replyQueryingFaceStatus(reply);
|
||||
}
|
||||
|
||||
if (reply is SenderCheckingUserInfoCountReply) {
|
||||
_replyCheckingUserInfoCount(reply);
|
||||
}
|
||||
});
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||
// 添加掌静脉开始(重置锁里面所有掌静脉)
|
||||
if ((reply is SenderAddPalmWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||
_replyAddPalmBegin(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 添加人脸开始---这里用作删除人脸
|
||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
// 添加卡片开始(此处用作删除卡片)
|
||||
Future<void> _replyAddPalmBegin(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
state.isDeletFaceData = false;
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
if (state.isDeletAll == false) {
|
||||
deletFacesData();
|
||||
} else {
|
||||
clearAllFacesData();
|
||||
}
|
||||
deletICPalmData();
|
||||
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 token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
final List<int> token = reply.data.sublist(5, 9);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
// IoSenderManage.senderAddFaceCommand(
|
||||
// keyID:state.deletKeyID,
|
||||
// userID:state.deletUserID,
|
||||
// faceNo:state.deletFaceNo,
|
||||
// useCountLimit:0,
|
||||
// isForce:0, // 是否是胁迫
|
||||
// isRound:0, // 是否是循环
|
||||
// weekRound:0, // 周循环
|
||||
// startDate: 0x11223344,
|
||||
// endDate: 0x11223344,
|
||||
// startTime:"0",
|
||||
// endTime:"0",
|
||||
// needAuthor:1,
|
||||
// signKey:signKeyDataList,
|
||||
// privateKey:getPrivateKeyList,
|
||||
// token: getTokenList,
|
||||
// );
|
||||
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||
keyID: state.deletKeyID,
|
||||
userID: (await Storage.getUid())!,
|
||||
palmNo: state.deletPalmVeinNo,
|
||||
useCountLimit: 0xffff,
|
||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin: 0,
|
||||
isForce: 0, // 是否是胁迫
|
||||
isRound: 0, // 是否是循环
|
||||
weekRound: 0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime: '0',
|
||||
endTime: '0',
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token,
|
||||
isBeforeAddUser: false);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
//失败
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取人脸状态
|
||||
Future<void> _replyQueryingFaceStatus(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取卡片状态
|
||||
Future<void> _replyReferEventRecordNumber(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||
Future<void> _replyCheckingUserInfoCount(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
|
||||
// 用户数量
|
||||
int userNum = reply.data[5];
|
||||
|
||||
// 指纹数量
|
||||
int fingerNum = reply.data[6];
|
||||
|
||||
// 密码数量
|
||||
int pwdNum = reply.data[7];
|
||||
|
||||
// 卡片数量
|
||||
int cardNum = reply.data[8];
|
||||
|
||||
// 记录数量
|
||||
int logsNum = reply.data[9];
|
||||
|
||||
// 版本
|
||||
int verNo = reply.data[10];
|
||||
|
||||
// 最大管理员指纹数量
|
||||
int maxAdminFingerNum = reply.data[11];
|
||||
|
||||
// 最大用户指纹数量
|
||||
int maxUserFingerNum = reply.data[12];
|
||||
|
||||
// 最大管理员密码数量
|
||||
int maxAdminPassNum = reply.data[13];
|
||||
|
||||
// 最大用户密码数量
|
||||
int maxUserPassNum = reply.data[14];
|
||||
|
||||
// 最大管理员卡片数量
|
||||
int maxAdminCardNum = reply.data[15];
|
||||
|
||||
// 最大用户卡片数量
|
||||
int maxUserCardNum = reply.data[16];
|
||||
|
||||
// 序列号
|
||||
var serialNo = reply.data.sublist(17, 21);
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取人脸状态
|
||||
Future<void> senderQueryingFaceStatus() async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState state) async {
|
||||
if (state == BluetoothConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||
|
||||
// IoSenderManage.senderQueryingFaceStatusCommand(
|
||||
// keyID: BlueManage().connectDeviceName,
|
||||
// userID: await Storage.getUid(),
|
||||
// role: 0xff,
|
||||
// faceCount: 20,
|
||||
// faceNo: 1,
|
||||
// token: getTokenList,
|
||||
// needAuthor: 1,
|
||||
// publicKey: getPublicKeyList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||
Future<void> senderCheckingUserInfoCount() async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState state) async {
|
||||
if (state == BluetoothConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||
|
||||
// IoSenderManage.senderCheckingUserInfoCountCommand(
|
||||
// keyID: BlueManage().connectDeviceName,
|
||||
// userID: await Storage.getUid(),
|
||||
// role: 0xff,
|
||||
// nowTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||
// token: getTokenList,
|
||||
// needAuthor: 1,
|
||||
// publicKey: getPublicKeyList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 删除人脸
|
||||
Future<void> senderAddFace() async {
|
||||
// 删除卡片
|
||||
Future<void> senderAddPalm() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
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.senderAddFaceCommand(
|
||||
// keyID:state.deletKeyID,
|
||||
// userID:state.deletUserID,
|
||||
// faceNo:state.deletFaceNo,
|
||||
// useCountLimit:0,
|
||||
// isForce:0, // 是否是胁迫
|
||||
// isRound:0, // 是否是循环
|
||||
// weekRound:0, // 周循环
|
||||
// startDate: 0x11223344,
|
||||
// endDate: 0x11223344,
|
||||
// startTime:"0",
|
||||
// endTime:"0",
|
||||
// needAuthor:1,
|
||||
// signKey:signKeyDataList,
|
||||
// privateKey:getPrivateKeyList,
|
||||
// token: getTokenList,
|
||||
// );
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||
keyID: state.deletKeyID,
|
||||
userID: (await Storage.getUid())!,
|
||||
palmNo: state.deletPalmVeinNo,
|
||||
useCountLimit: 0xffff,
|
||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin: 0,
|
||||
isForce: 0, // 是否是胁迫
|
||||
isRound: 0, // 是否是循环
|
||||
weekRound: 0, // 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime: '0',
|
||||
endTime: '0',
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
isBeforeAddUser: false);
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 获取人脸列表
|
||||
void getFaceListData() async {
|
||||
var entity = await ApiRepository.to.getFaceListData(
|
||||
// 获取IC卡列表
|
||||
Future<FingerprintListDataEntity> getPalmListData({required bool isRefresh}) async {
|
||||
// 如果是下拉刷新,清空已有数据
|
||||
if (isRefresh) {
|
||||
state.fingerprintItemListData.clear();
|
||||
pageNo = 1;
|
||||
}
|
||||
final FingerprintListDataEntity entity =
|
||||
await ApiRepository.to.getPalmListData(
|
||||
lockId: state.lockId.value.toString(),
|
||||
pageNo: '1',
|
||||
pageSize: '20',
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize,
|
||||
searchStr: state.searchController.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.faceItemListData.value = entity.data!.list!;
|
||||
// 更新数据列表
|
||||
state.fingerprintItemListData.addAll(entity.data!.list!);
|
||||
// 更新页码
|
||||
pageNo++;
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
// 删除的人脸
|
||||
void deletFacesData() async {
|
||||
var faceId = "";
|
||||
var type = "1";
|
||||
// 删除所有IC卡
|
||||
Future<void> deletICPalmData() async {
|
||||
String palmId = '';
|
||||
String type = '1';
|
||||
if (state.isDeletAll == false) {
|
||||
faceId = state.deletKeyID;
|
||||
type = "0";
|
||||
}
|
||||
var entity = await ApiRepository.to.deleteFaceData(
|
||||
faceId: int.parse(faceId),
|
||||
lockId: state.lockId.value,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功");
|
||||
state.isDeletFaceData = false;
|
||||
getFaceListData();
|
||||
}
|
||||
}
|
||||
|
||||
// 重置所有的人脸
|
||||
void clearAllFacesData() async {
|
||||
var faceId = "";
|
||||
var type = "1";
|
||||
if (state.isDeletAll == false) {
|
||||
faceId = state.deletKeyID;
|
||||
type = "0";
|
||||
}
|
||||
var entity = await ApiRepository.to.clearFaceData(
|
||||
lockId: state.lockId.value,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("重置成功");
|
||||
state.isDeletFaceData = false;
|
||||
getFaceListData();
|
||||
palmId = state.deletKeyID;
|
||||
type = '0';
|
||||
}
|
||||
// final LoginEntity entity = await ApiRepository.to.deletIcPalmData(
|
||||
// cardId: palmId,
|
||||
// lockId: state.lockId.value.toString(),
|
||||
// type: type,
|
||||
// deleteType: '1');
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// if (state.isDeletAll == false) {
|
||||
// showToast('删除成功'.tr, something: () {
|
||||
// getICCardListData(isRefresh: true);
|
||||
// });
|
||||
// } else {
|
||||
// showToast('重置成功'.tr, something: () {
|
||||
// getICCardListData(isRefresh: true);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// 监听修改完详情之后刷新列表
|
||||
late StreamSubscription _teamEvent;
|
||||
void _initRefreshAction() {
|
||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
|
||||
getFaceListData();
|
||||
_teamEvent = eventBus
|
||||
.on<OtherTypeRefreshListEvent>()
|
||||
.listen((OtherTypeRefreshListEvent event) {
|
||||
getPalmListData(isRefresh: true);
|
||||
});
|
||||
}
|
||||
|
||||
String getKeyType(FingerprintItemData fingerprintItemData) {
|
||||
String keyTypeStr = ''; //
|
||||
if (fingerprintItemData.palmVeinStatus == 1) {
|
||||
if (fingerprintItemData.startDate! >
|
||||
DateTime.now().millisecondsSinceEpoch) {
|
||||
keyTypeStr = '未生效'.tr;
|
||||
}
|
||||
} else if (fingerprintItemData.palmVeinStatus == 2) {
|
||||
keyTypeStr = '已失效'.tr;
|
||||
}
|
||||
return keyTypeStr;
|
||||
}
|
||||
|
||||
String getKeyDateType(FingerprintItemData fingerprintItemData) {
|
||||
String keyDateTypeStr = ''; // 永久:1;限时2,单次3,循环:4
|
||||
if (fingerprintItemData.palmVeinType! == 1) {
|
||||
keyDateTypeStr =
|
||||
'${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久';
|
||||
} else if (fingerprintItemData.palmVeinType! == 2) {
|
||||
keyDateTypeStr =
|
||||
'${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
||||
} else if (fingerprintItemData.palmVeinType! == 4) {
|
||||
keyDateTypeStr =
|
||||
'${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
||||
}
|
||||
return keyDateTypeStr;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
// _initReplySubscription();
|
||||
_initReplySubscription();
|
||||
|
||||
// _initRefreshAction();
|
||||
|
||||
// getFaceListData();
|
||||
_initRefreshAction();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onInit() async {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
// senderQueryingFingerprintStatus();
|
||||
// senderCheckingCardStatus();
|
||||
|
||||
// senderCheckingUserInfoCount();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onClose() async {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
// _replySubscription.cancel();
|
||||
_replySubscription.cancel();
|
||||
_teamEvent.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,23 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_state.dart';
|
||||
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
|
||||
import 'package:star_lock/tools/keySearchWidget.dart';
|
||||
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
@ -24,179 +30,174 @@ class PalmListPage extends StatefulWidget {
|
||||
State<PalmListPage> createState() => _PalmListPageState();
|
||||
}
|
||||
|
||||
class _PalmListPageState extends State<PalmListPage> {
|
||||
final logic = Get.put(PalmListLogic());
|
||||
final state = Get.find<PalmListLogic>().state;
|
||||
class _PalmListPageState extends State<PalmListPage> with RouteAware {
|
||||
final PalmListLogic logic = Get.put(PalmListLogic());
|
||||
final PalmListState state = Get.find<PalmListLogic>().state;
|
||||
|
||||
Future<void> getHttpData({required bool isRefresh}) async {
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.getPalmListData(isRefresh: isRefresh)
|
||||
.then((FingerprintListDataEntity value) {
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData(isRefresh: true);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '手掌',
|
||||
barTitle: '掌静脉',
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
actionsList: <Widget>[
|
||||
TextButton(
|
||||
child: Text(
|
||||
'重置'.tr,
|
||||
child: Text('重置'.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
final bool isNetWork =
|
||||
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
|
||||
if (!isNetWork) {
|
||||
return;
|
||||
}
|
||||
showDeletAlertDialog(context);
|
||||
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
|
||||
state.isDeletAll = true;
|
||||
state.deletKeyID = '0';
|
||||
state.deletPalmVeinNo = 0;
|
||||
logic.senderAddPalm();
|
||||
});
|
||||
// showDeletAlertDialog(context);
|
||||
} else {
|
||||
// Get.toNamed(Routers.selectLockTypePage);
|
||||
logic.showToast('演示模式');
|
||||
logic.showToast('演示模式'.tr);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
KeySearchWidget(
|
||||
editingController: state.searchController,
|
||||
onSubmittedAction: () {
|
||||
// logic.getFaceListData();
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: '添加手掌'.tr,
|
||||
onClick: () async {
|
||||
// var data =
|
||||
// await Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
||||
// "lockId": state.lockId.value,
|
||||
// "fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
// });
|
||||
var data =
|
||||
await Get.toNamed(Routers.addPalmTypeManagePage, arguments: {
|
||||
'lockId': state.lockId.value,
|
||||
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
});
|
||||
if (data != null) {
|
||||
// logic.getFaceListData();
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 64.h)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
{
|
||||
return Obx(() => state.faceItemListData.value.isNotEmpty
|
||||
? ListView.separated(
|
||||
itemCount: state.faceItemListData.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
FingerprintItemData getFaceItemData =
|
||||
state.faceItemListData.value[index];
|
||||
// 人脸
|
||||
if (index < state.faceItemListData.value.length) {
|
||||
return LeftSlideActions(
|
||||
tag: getFaceItemData.faceName!,
|
||||
key: Key(getFaceItemData.faceName!),
|
||||
actionsWidth: 60,
|
||||
actions: [
|
||||
_buildDeleteBtn(getFaceItemData),
|
||||
],
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
),
|
||||
child: _keyItem(
|
||||
'images/icon_face.png',
|
||||
getFaceItemData.faceName!,
|
||||
(getFaceItemData.faceType! != 1)
|
||||
? (getFaceItemData.endDate! <
|
||||
DateTime.now().millisecondsSinceEpoch
|
||||
? '已失效'
|
||||
: '')
|
||||
: '',
|
||||
getFaceItemData.validTimeStr!,
|
||||
// fingerprintItemData.fingerprintType! == 1
|
||||
// ? "永久"
|
||||
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
|
||||
() async {
|
||||
var data =
|
||||
await Get.toNamed(Routers.faceDetailPage, arguments: {
|
||||
'faceItemData': getFaceItemData,
|
||||
});
|
||||
if (data != null) {
|
||||
// logic.getFaceListData();
|
||||
}
|
||||
}),
|
||||
);
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: () {
|
||||
getHttpData(isRefresh: true);
|
||||
},
|
||||
onLoad: () {
|
||||
getHttpData(isRefresh: false);
|
||||
},
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
KeySearchWidget(
|
||||
editingController: state.searchController,
|
||||
onSubmittedAction: () {
|
||||
getHttpData(isRefresh: true);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
Expanded(child: _buildMainUI()),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: '添加掌静脉',
|
||||
onClick: () async {
|
||||
final data = await Get.toNamed(Routers.addPalmTypePage, arguments: <String, int>{
|
||||
'lockId': state.lockId.value,
|
||||
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
});
|
||||
if (data != null) {
|
||||
getHttpData(isRefresh: true);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
: NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - 170.h));
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildDeleteBtn(FingerprintItemData faceItemData) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// 省略: 弹出是否删除的确认对话框。
|
||||
state.deletKeyID = faceItemData.faceId.toString();
|
||||
state.deletFaceNo = int.parse(faceItemData.faceNumber!);
|
||||
showIosTipViewDialog(context);
|
||||
},
|
||||
child: Container(
|
||||
width: 60,
|
||||
color: const Color(0xFFF20101),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'删除',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
height: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showIosTipViewDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: '提示',
|
||||
tipTitle: '确定要删除吗?',
|
||||
sureClick: () async {
|
||||
Get.back();
|
||||
state.isDeletFaceData = true;
|
||||
state.isDeletAll = false;
|
||||
state.deletUserID = (await Storage.getUid())!;
|
||||
// logic.senderAddFace();
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
||||
? SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.fingerprintItemListData.value.length,
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final FingerprintItemData fingerprintItemData =
|
||||
state.fingerprintItemListData.value[index];
|
||||
return Slidable(
|
||||
key: ValueKey(fingerprintItemData.fingerprintId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: <Widget>[
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context) async {
|
||||
final bool isNetWork =
|
||||
await LockMainLogic.to()?.judgeTheNetwork() ??
|
||||
false;
|
||||
if (!isNetWork) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'确定要删除吗?'.tr, () async {
|
||||
state.isDeletAll = false;
|
||||
state.deletKeyID =
|
||||
fingerprintItemData.palmVeinId.toString();
|
||||
state.deletPalmVeinNo =
|
||||
int.parse(fingerprintItemData.palmVeinNumber!);
|
||||
logic.senderAddPalm();
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除'.tr,
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _keyItem(
|
||||
'images/icon_palm.png',
|
||||
fingerprintItemData.palmVeinName!,
|
||||
logic.getKeyType(fingerprintItemData),
|
||||
logic.getKeyDateType(fingerprintItemData), () async {
|
||||
final data = await Get.toNamed(Routers.palmDetailPage,
|
||||
arguments: <String, FingerprintItemData>{
|
||||
'fingerprintItemData': fingerprintItemData,
|
||||
});
|
||||
if (data != null) {
|
||||
getHttpData(isRefresh: true);
|
||||
}
|
||||
}),
|
||||
);
|
||||
},
|
||||
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 _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||
@ -207,26 +208,43 @@ class _PalmListPageState extends State<PalmListPage> {
|
||||
height: 90.h,
|
||||
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
color: Colors.white,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// // borderRadius: BorderRadius.circular(10.w),
|
||||
// ),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(width: 30.w),
|
||||
Image.asset(lockTypeIcon, width: 60.w, height: 60.w),
|
||||
// Image.asset(lockTypeIcon, width: 60.w, height: 60.w),
|
||||
Container(
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30.w),
|
||||
color: AppColors.mainColor,
|
||||
),
|
||||
child: Image.asset(lockTypeIcon, width: 30.w, height: 30.w,)
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(lockTypeTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor)),
|
||||
Expanded(child: Container()),
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 1.sw - 110.w - 100.w,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Text(lockTypeTitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(ifInvalidation,
|
||||
style: TextStyle(fontSize: 22.sp, color: Colors.red)),
|
||||
SizedBox(width: 10.w),
|
||||
@ -235,11 +253,15 @@ class _PalmListPageState extends State<PalmListPage> {
|
||||
SizedBox(height: 5.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(showTime,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor)),
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Text(showTime,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor)),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
@ -253,35 +275,54 @@ class _PalmListPageState extends State<PalmListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void showDeletAlertDialog(BuildContext context) {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: const Text('重置后,该锁的人脸都将被删除哦,确认要重置吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('确定'.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
state.isDeletFaceData = true;
|
||||
state.isDeletAll = true;
|
||||
state.deletKeyID = '1';
|
||||
state.deletUserID = 'DeleteAll!@#';
|
||||
state.deletFaceNo = 255;
|
||||
// logic.senderAddFace();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
|
||||
/// 路由订阅
|
||||
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
/// 取消路由订阅
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// 从上级界面进入 当前界面即将出现
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
/// 返回上一个界面 当前界面即将消失
|
||||
@override
|
||||
void didPop() {
|
||||
super.didPop();
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) {
|
||||
EasyLoading.dismiss(animation: true);
|
||||
}
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
|
||||
/// 从下级返回 当前界面即将出现
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
/// 进入下级界面 当前界面即将消失
|
||||
@override
|
||||
void didPushNext() {
|
||||
super.didPushNext();
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) {
|
||||
EasyLoading.dismiss(animation: true);
|
||||
}
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,22 +3,20 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
|
||||
class PalmListState {
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
final lockId = 0.obs;
|
||||
|
||||
// 因为删除跟添加人脸用的同一个协议 所以这里用做判断
|
||||
var isDeletFaceData = false;
|
||||
var isDeletAll = false;
|
||||
var deletKeyID = "";
|
||||
var deletUserID = "DeleteAll!@#";
|
||||
var deletFaceNo = 0;
|
||||
|
||||
final faceItemListData = <FingerprintItemData>[].obs;
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
|
||||
PalmListState() {
|
||||
Map map = Get.arguments;
|
||||
lockId.value = map["lockId"];
|
||||
lockId.value = map['lockId'];
|
||||
}
|
||||
final RxInt lockId = 0.obs;
|
||||
|
||||
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
||||
bool isDeletAll = false;
|
||||
String deletKeyID = '0';
|
||||
int deletPalmVeinNo = 0;
|
||||
|
||||
final RxList<FingerprintItemData> fingerprintItemListData = <FingerprintItemData>[].obs;
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
|
||||
RxBool ifCurrentScreen = true.obs;// 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
}
|
||||
|
||||
@ -124,10 +124,8 @@ abstract class Api {
|
||||
final String addICCardURL = '/identityCard/add'; // 添加IC卡
|
||||
final String editICCardURL = '/identityCard/update'; // 编辑IC卡
|
||||
final String deleteICCardURL = '/identityCard/delete'; // 删除IC卡
|
||||
final String updateICCardUserNoURL =
|
||||
'/identityCard/updateCardUserNo'; // 更新ic卡用户序号
|
||||
final String checkCardNameURL =
|
||||
'/identityCard/checkIdentityCardName'; // 校验卡名字是否存在
|
||||
final String updateICCardUserNoURL = '/identityCard/updateCardUserNo'; // 更新ic卡用户序号
|
||||
final String checkCardNameURL = '/identityCard/checkIdentityCardName'; // 校验卡名字是否存在
|
||||
|
||||
final String getRemoteControlListURL = '/remote/list'; // 遥控列表
|
||||
final String addRemoteControlURL = '/remote/add'; // 添加遥控
|
||||
@ -135,8 +133,13 @@ abstract class Api {
|
||||
final String editRemoteControlURL = '/remote/update'; // 编辑遥控
|
||||
final String deleteRemoteControlURL = '/remote/delete'; // 删除遥控
|
||||
final String clearRemoteControlURL = '/remote/clear'; // 清空遥控
|
||||
final String checkRemoteControlNameURL =
|
||||
'/remote/checkRemoteName'; // 校验遥控名字是否存在
|
||||
final String checkRemoteControlNameURL = '/remote/checkRemoteName'; // 校验遥控名字是否存在
|
||||
|
||||
final String getPalmListURL = '/palmVein/list'; // 掌静脉列表
|
||||
final String addPalmURL = '/palmVein/add'; // 添加掌静脉
|
||||
final String updatePalmUserNoURL = '/palmVein/updatePalmVeinUserNo'; // 更新掌静脉用户序号
|
||||
final String editPalmURL = '/palmVein/update'; // 编辑掌静脉
|
||||
final String checkPalmNameURL = '/palmVein/checkPalmVeinName'; // 校验掌静脉名字是否存在
|
||||
|
||||
final String transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表
|
||||
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
||||
|
||||
@ -1569,7 +1569,7 @@ class ApiProvider extends BaseProvider {
|
||||
'remoteId': remoteId,
|
||||
}));
|
||||
|
||||
// 删除遥控
|
||||
// 重置遥控
|
||||
Future<Response> resetRemoteControlData(int lockId) =>
|
||||
post(
|
||||
clearRemoteControlURL.toUrl,
|
||||
@ -1583,6 +1583,94 @@ class ApiProvider extends BaseProvider {
|
||||
post(checkRemoteControlNameURL.toUrl,
|
||||
jsonEncode({'lockId': lockId, 'remoteName': remoteName}));
|
||||
|
||||
// 获取掌静脉列表
|
||||
Future<Response> getPalmListData(
|
||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||
post(
|
||||
getPalmListURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
'searchStr': searchStr,
|
||||
}));
|
||||
|
||||
// 添加掌静脉
|
||||
Future<Response> addPalmData(
|
||||
String lockId,
|
||||
String palmVeinName,
|
||||
String palmVeinNumber,
|
||||
int palmVeinType,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int addType,
|
||||
List weekDay,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int palmVeinRight
|
||||
) =>
|
||||
post(
|
||||
addPalmURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'palmVeinName': palmVeinName,
|
||||
'palmVeinNumber': palmVeinNumber,
|
||||
'palmVeinType': palmVeinType,
|
||||
'startDate': startDate,
|
||||
'endDate': endDate,
|
||||
'addType': addType,
|
||||
'weekDay': weekDay,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'palmVeinRight': palmVeinRight
|
||||
}));
|
||||
|
||||
// 更新掌静脉序号
|
||||
Future<Response> updatePalmUserNoLoadData(
|
||||
int lockId, int palmVeinId, String palmVeinUserNo) =>
|
||||
post(
|
||||
updatePalmUserNoURL.toUrl,
|
||||
jsonEncode(
|
||||
{'lockId': lockId, 'palmVeinId': palmVeinId, 'palmVeinUserNo': palmVeinUserNo}));
|
||||
|
||||
// 编辑掌静脉
|
||||
Future<Response> editPalmData(
|
||||
int lockId,
|
||||
int palmVeinId,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int palmVeinType,
|
||||
List weekDay,
|
||||
String palmVeinName,
|
||||
int addType,
|
||||
int isCoerced,
|
||||
int palmVeinRight,
|
||||
) =>
|
||||
post(
|
||||
editPalmURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'palmVeinId': palmVeinId,
|
||||
'startDate': startDate,
|
||||
'endDate': endDate,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'palmVeinType': palmVeinType,
|
||||
'weekDay': weekDay,
|
||||
'palmVeinName': palmVeinName,
|
||||
'addType': addType,
|
||||
'isCoerced': isCoerced,
|
||||
'palmVeinRight': palmVeinRight
|
||||
}));
|
||||
|
||||
// 校验掌静脉名字是否重复
|
||||
Future<Response> checkPalmNameDuplicatedData(
|
||||
String lockId, String palmVeinName) =>
|
||||
post(checkPalmNameURL.toUrl,
|
||||
jsonEncode({'lockId': lockId, 'palmVeinName': palmVeinName}));
|
||||
|
||||
// 获取转移锁锁列表
|
||||
Future<Response> getTransferLockListData(String searchStr) =>
|
||||
post(transferLockListURL.toUrl, jsonEncode({'searchStr': searchStr}));
|
||||
|
||||
@ -69,6 +69,7 @@ import '../main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
|
||||
import '../main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
import '../main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||
import '../main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
||||
import '../main/lockDetail/palm/addPalm/addPalm_entity.dart';
|
||||
import '../main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_entity.dart';
|
||||
import '../main/lockMian/entity/lockListInfo_entity.dart';
|
||||
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
|
||||
@ -1759,6 +1760,95 @@ class ApiRepository {
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取掌静脉列表
|
||||
Future<FingerprintListDataEntity> getPalmListData({
|
||||
required String lockId,
|
||||
required String pageNo,
|
||||
required String pageSize,
|
||||
required String searchStr,
|
||||
}) async {
|
||||
final res = await apiProvider.getPalmListData(
|
||||
lockId, pageNo, pageSize, searchStr);
|
||||
return FingerprintListDataEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 添加掌静脉
|
||||
Future<AddPalmEntity> addPalmData({
|
||||
required String lockId,
|
||||
required String palmVeinName,
|
||||
required String palmVeinNumber,
|
||||
required int palmVeinType,
|
||||
required int startDate,
|
||||
required int endDate,
|
||||
required int addType,
|
||||
required List weekDay,
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int palmVeinRight,
|
||||
}) async {
|
||||
final res = await apiProvider.addPalmData(
|
||||
lockId,
|
||||
palmVeinName,
|
||||
palmVeinNumber,
|
||||
palmVeinType,
|
||||
startDate,
|
||||
endDate,
|
||||
addType,
|
||||
weekDay,
|
||||
startTime,
|
||||
endTime,
|
||||
palmVeinRight);
|
||||
return AddPalmEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 更新掌静脉用户序号
|
||||
Future<LoginEntity> updatePalmUserNoLoadData(
|
||||
{required int lockId,
|
||||
required int palmVeinId,
|
||||
required String palmVeinUserNo}) async {
|
||||
final res = await apiProvider.updatePalmUserNoLoadData(
|
||||
lockId, palmVeinId, palmVeinUserNo);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 编辑遥控
|
||||
Future<LoginEntity> editPalmData({
|
||||
required int lockId,
|
||||
required int palmVeinId,
|
||||
required int startDate,
|
||||
required int endDate,
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int palmVeinType,
|
||||
required List weekDay,
|
||||
required String palmVeinName,
|
||||
required int addType,
|
||||
required int isCoerced,
|
||||
required int palmVeinRight,
|
||||
}) async {
|
||||
final res = await apiProvider.editPalmData(
|
||||
lockId,
|
||||
palmVeinId,
|
||||
startDate,
|
||||
endDate,
|
||||
startTime,
|
||||
endTime,
|
||||
palmVeinType,
|
||||
weekDay,
|
||||
palmVeinName,
|
||||
addType,
|
||||
isCoerced,
|
||||
palmVeinRight);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 校验掌静脉名字是否重复
|
||||
Future<LoginEntity> checkPalmNameDuplicatedData(
|
||||
{required String lockId, required String palmVeinName}) async {
|
||||
final res = await apiProvider.checkRemoteControlNameDuplicatedData(lockId, palmVeinName);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
Future<LoginEntity> userLogout({required String deviceld}) async {
|
||||
final res = await apiProvider.userLogout(deviceld);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user