添加掌静脉列表、添加、详情、修改掌静脉名字等功能
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/msgNotification/openDoorNotify/openDoorNotify_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_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/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/palm/palmList/palmList_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_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';
|
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/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
||||||
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||||
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_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/passwordKeyDetail/passwordKeyDetail_page.dart';
|
||||||
import 'main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart';
|
import 'main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart';
|
||||||
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_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 addIrisPage = '/AddIrisPage'; // 添加虹膜过程
|
||||||
|
|
||||||
static const String palmListPage = '/PalmListPage'; // 手掌列表
|
static const String palmListPage = '/PalmListPage'; // 手掌列表
|
||||||
static const String addPalmTypeManagePage = '/AddPalmTypeManagePage'; // 添加手掌
|
static const String addPalmTypePage = '/AddPalmTypePage'; // 添加手掌
|
||||||
static const String addPalmPage = '/AddPalmPage'; // 添加手掌过程
|
static const String addPalmPage = '/AddPalmPage'; // 添加手掌过程
|
||||||
|
static const String palmDetailPage = '/PalmDetailPage'; // 手掌详情
|
||||||
|
|
||||||
static const String passwordKeyDetailChangeDatePage =
|
static const String passwordKeyDetailChangeDatePage =
|
||||||
'/passwordKeyDetailChangeDatePage'; //密码更改时间
|
'/passwordKeyDetailChangeDatePage'; //密码更改时间
|
||||||
@ -1126,8 +1128,8 @@ abstract class AppRouters {
|
|||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.palmListPage, page: () => const PalmListPage()),
|
name: Routers.palmListPage, page: () => const PalmListPage()),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.addPalmTypeManagePage,
|
name: Routers.addPalmTypePage,
|
||||||
page: () => const AddPalmTypeManagePage()),
|
page: () => const AddPalmTypePage()),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.addPalmPage, page: () => const AddPalmPage()),
|
name: Routers.addPalmPage, page: () => const AddPalmPage()),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
@ -1158,5 +1160,7 @@ abstract class AppRouters {
|
|||||||
name: Routers.addRemoteControlTypePage, page: () => const AddRemoteControlTypePage()),
|
name: Routers.addRemoteControlTypePage, page: () => const AddRemoteControlTypePage()),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.remoteControlDetailPage, page: () => const RemoteControlDetailPage()),
|
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;
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
///TODO:添加遥控
|
///TODO:添加遥控
|
||||||
/*
|
|
||||||
备注:
|
|
||||||
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
|
||||||
**/
|
|
||||||
class SenderAddRemoteControlWithTimeCycleCoercionCommand extends SenderProtocol {
|
class SenderAddRemoteControlWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||||
|
|
||||||
SenderAddRemoteControlWithTimeCycleCoercionCommand({
|
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/app_settings/app_settings.dart';
|
||||||
import 'package:star_lock/blue/blue_manage.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_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_changeAdministratorPassword.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||||
@ -379,6 +380,20 @@ class CommandReciverManager {
|
|||||||
commandType, data);
|
commandType, data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 42:
|
||||||
|
{
|
||||||
|
// 注册掌静脉开始
|
||||||
|
reply = SenderAddPalmWithTimeCycleCoercionReply.parseData(
|
||||||
|
commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 43:
|
||||||
|
{
|
||||||
|
// 注册掌静脉确认
|
||||||
|
reply = SenderAddPalmConfirmationReply.parseData(
|
||||||
|
commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
// case 50:
|
// case 50:
|
||||||
// {
|
// {
|
||||||
// // wifi配网
|
// // wifi配网
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import 'io_protocol/io_addFaceCancel.dart';
|
|||||||
import 'io_protocol/io_addFingerprintCancel.dart';
|
import 'io_protocol/io_addFingerprintCancel.dart';
|
||||||
import 'io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
import 'io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
||||||
import 'io_protocol/io_addICCardWithTimeCycleCoercion.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_addRemoteControlCancel.dart';
|
||||||
import 'io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart';
|
import 'io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart';
|
||||||
import 'io_protocol/io_addStressPassword.dart';
|
import 'io_protocol/io_addStressPassword.dart';
|
||||||
@ -740,6 +742,72 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
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:校验时间
|
//todo:校验时间
|
||||||
static void senderTimingCommand(
|
static void senderTimingCommand(
|
||||||
{required String? lockID,
|
{required String? lockID,
|
||||||
|
|||||||
@ -47,6 +47,7 @@ class CardDetailLogic extends BaseGetXController {
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
if (state.isDeletCard.value == true) {
|
if (state.isDeletCard.value == true) {
|
||||||
@ -97,6 +98,7 @@ class CardDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,6 +92,7 @@ class FaceDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,6 +86,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,7 +105,14 @@ class FingerprintItemData {
|
|||||||
this.remoteType,
|
this.remoteType,
|
||||||
this.adminUid,
|
this.adminUid,
|
||||||
this.remoteRight,
|
this.remoteRight,
|
||||||
this.lockAlias
|
this.lockAlias,
|
||||||
|
|
||||||
|
this.palmVeinId,
|
||||||
|
this.palmVeinName,
|
||||||
|
this.palmVeinNumber,
|
||||||
|
this.palmVeinStatus,
|
||||||
|
this.palmVeinType,
|
||||||
|
this.palmVeinRight
|
||||||
});
|
});
|
||||||
|
|
||||||
FingerprintItemData.fromJson(Map<String, dynamic> json) {
|
FingerprintItemData.fromJson(Map<String, dynamic> json) {
|
||||||
@ -151,6 +158,13 @@ class FingerprintItemData {
|
|||||||
adminUid = json['adminUid'];
|
adminUid = json['adminUid'];
|
||||||
remoteRight = json['remoteRight'];
|
remoteRight = json['remoteRight'];
|
||||||
lockAlias = json['lockAlias'];
|
lockAlias = json['lockAlias'];
|
||||||
|
|
||||||
|
palmVeinId = json['palmVeinId'];
|
||||||
|
palmVeinName = json['palmVeinName'];
|
||||||
|
palmVeinNumber = json['palmVeinNumber'];
|
||||||
|
palmVeinStatus = json['palmVeinStatus'];
|
||||||
|
palmVeinType = json['palmVeinType'];
|
||||||
|
palmVeinRight = json['palmVeinRight'];
|
||||||
}
|
}
|
||||||
int? fingerprintStatus;
|
int? fingerprintStatus;
|
||||||
int? lockId;
|
int? lockId;
|
||||||
@ -197,6 +211,13 @@ class FingerprintItemData {
|
|||||||
int? remoteRight;
|
int? remoteRight;
|
||||||
String? lockAlias;
|
String? lockAlias;
|
||||||
|
|
||||||
|
int? palmVeinId;
|
||||||
|
String? palmVeinName;
|
||||||
|
String? palmVeinNumber;
|
||||||
|
int? palmVeinStatus;
|
||||||
|
int? palmVeinType;
|
||||||
|
int? palmVeinRight;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['fingerprintStatus'] = fingerprintStatus;
|
data['fingerprintStatus'] = fingerprintStatus;
|
||||||
@ -241,6 +262,14 @@ class FingerprintItemData {
|
|||||||
data['adminUid'] = adminUid;
|
data['adminUid'] = adminUid;
|
||||||
data['remoteRight'] = remoteRight;
|
data['remoteRight'] = remoteRight;
|
||||||
data['lockAlias'] = lockAlias;
|
data['lockAlias'] = lockAlias;
|
||||||
|
|
||||||
|
data['palmVeinId'] = palmVeinId;
|
||||||
|
data['palmVeinName'] = palmVeinName;
|
||||||
|
data['palmVeinNumber'] = palmVeinNumber;
|
||||||
|
data['palmVeinStatus'] = palmVeinStatus;
|
||||||
|
data['palmVeinType'] = palmVeinType;
|
||||||
|
data['palmVeinRight'] = palmVeinRight;
|
||||||
|
|
||||||
return data;
|
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 '../../../../../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 {
|
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
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// _initReplySubscription();
|
_initReplySubscription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
//开始添加后发送指令
|
|
||||||
// senderAddFace();
|
senderAddPalm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
_replySubscription.cancel();
|
||||||
super.onClose();
|
|
||||||
|
|
||||||
// _replySubscription.cancel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class _AddPalmPageState extends State<AddPalmPage> {
|
|||||||
height: 50.h,
|
height: 50.h,
|
||||||
),
|
),
|
||||||
Obx(() => Image.asset(
|
Obx(() => Image.asset(
|
||||||
state.isClickAddFace.value == false
|
state.isClickAddPalm.value == false
|
||||||
? 'images/main/icon_addPalm_step1.png'
|
? 'images/main/icon_addPalm_step1.png'
|
||||||
: 'images/main/icon_addPalm_step1.png',
|
: 'images/main/icon_addPalm_step1.png',
|
||||||
width: 100.w,
|
width: 100.w,
|
||||||
@ -63,29 +63,36 @@ class _AddPalmPageState extends State<AddPalmPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 120.h,
|
height: 120.h,
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(() => state.isClickAddPalm.value == false
|
||||||
() => state.isClickAddFace.value == false
|
? GestureDetector(
|
||||||
? Container(
|
onTap: () {
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
state.isClickAddPalm.value = true;
|
||||||
child: SubmitBtn(
|
},
|
||||||
btnName: '准备好了,开始添加',
|
child: Container(
|
||||||
borderRadius: 20.w,
|
width: 1.sw,
|
||||||
onClick: () {
|
padding: EdgeInsets.all(10.w),
|
||||||
state.isClickAddFace.value = true;
|
margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
|
||||||
}),
|
decoration: BoxDecoration(
|
||||||
)
|
color: AppColors.mainColor,
|
||||||
: Row(
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
children: <Widget>[
|
child: Center(child: Text('准备好了,开始添加', style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
|
||||||
Text(
|
)
|
||||||
'正在录入中...',
|
: Container(
|
||||||
style: TextStyle(
|
width: 1.sw,
|
||||||
color: AppColors.darkGrayTextColor,
|
padding: EdgeInsets.all(10.w),
|
||||||
fontSize: 22.sp),
|
margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
|
||||||
textAlign: TextAlign.center,
|
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 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../app_settings/app_settings.dart';
|
||||||
|
import '../../../../tools/commonDataManage.dart';
|
||||||
|
|
||||||
class AddPalmState {
|
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() {
|
AddPalmState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
lockId.value = map["lockId"];
|
lockId.value = map['lockId'];
|
||||||
endDate.value = map["endDate"];
|
addType.value = map['addType'];
|
||||||
addType.value = map["addType"];
|
palmName.value = map['palmName'];
|
||||||
faceName.value = map["faceName"];
|
palmNumber.value = map['palmNumber'];
|
||||||
faceType.value = map["faceType"];
|
palmType.value = map['palmType'];
|
||||||
startDate.value = map["startDate"];
|
isCoerced.value = map['isCoerced'];
|
||||||
lockId.value = map["lockId"];
|
AppLog.log('1111-isCoerced.value:${isCoerced.value}');
|
||||||
cyclicConfig.value = map["cyclicConfig"];
|
isAdministrator.value = map['isAdministrator'];
|
||||||
fromType.value = map["fromType"];
|
startDate.value = map['startDate'];
|
||||||
isAdministrator.value = map["isAdministrator"];
|
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/dateTool.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/time_utils.dart';
|
import 'package:star_lock/tools/pickers/time_picker/time_utils.dart';
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../login/login/entity/LoginEntity.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
|
||||||
class AddPalmTypeLogic extends BaseGetXController {
|
class AddPalmTypeLogic extends BaseGetXController {
|
||||||
@ -13,33 +14,32 @@ class AddPalmTypeLogic extends BaseGetXController {
|
|||||||
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList();
|
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加指纹
|
// 添加卡数据
|
||||||
void addPalmData() async {
|
Future<void> _addPalmData() async {
|
||||||
var palmType = 0; // 永久:1;限时2,单次3,循环:4
|
int carType = 0; // 永久:1;限时2,单次3,循环:4
|
||||||
var startDate = "";
|
String startDate = '';
|
||||||
var endDate = "";
|
String endDate = '';
|
||||||
var startTime = "";
|
String startTime = '';
|
||||||
var endTime = "";
|
String endTime = '';
|
||||||
if (state.selectType.value == "0") {
|
if (state.selectType.value == '0') {
|
||||||
palmType = 1;
|
carType = 1;
|
||||||
startDate = "0";
|
startDate = '0';
|
||||||
endDate = "0";
|
endDate = '0';
|
||||||
startTime = "0";
|
startTime = '0';
|
||||||
endTime = "0";
|
endTime = '0';
|
||||||
} else if (state.selectType.value == "1") {
|
} else if (state.selectType.value == '1') {
|
||||||
palmType = 2;
|
carType = 2;
|
||||||
startDate =
|
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||||
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
startTime = '0';
|
||||||
startTime = "0";
|
endTime = '0';
|
||||||
endTime = "0";
|
|
||||||
|
|
||||||
if (startDate.isEmpty) {
|
if (startDate.isEmpty) {
|
||||||
showToast("请选择开始时间".tr);
|
showToast('请选择开始时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (endDate.isEmpty) {
|
if (endDate.isEmpty) {
|
||||||
showToast("请选择结束时间".tr);
|
showToast('请选择结束时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,47 +49,50 @@ class AddPalmTypeLogic extends BaseGetXController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
showToast("失效时间要大于生效时间".tr);
|
showToast('失效时间要大于生效时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (state.selectType.value == "2") {
|
// AppLog.log("state.timeLimitBeginTime.value:${state.timeLimitBeginTime.value} startDate:$startDate");
|
||||||
if (state.beginTime.value.isEmpty) {
|
// AppLog.log("state.timeLimitEndTime.value:${state.timeLimitEndTime.value} endDate:$endDate");
|
||||||
showToast("请选择有效期".tr);
|
} else if (state.selectType.value == '2') {
|
||||||
|
if (state.cycleBeginTime.value.isEmpty) {
|
||||||
|
showToast('请选择有效期'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startDate =
|
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
|
||||||
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
startTime = DateTool()
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
.dateToTimestamp(state.effectiveDateTime.value, 0)
|
carType = 4;
|
||||||
.toString();
|
|
||||||
endTime =
|
|
||||||
DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
|
||||||
palmType = 4;
|
|
||||||
}
|
}
|
||||||
// 人脸
|
|
||||||
Get.toNamed(Routers.addPalmPage, arguments: {
|
Get.toNamed(Routers.addPalmPage, arguments: <String, Object>{
|
||||||
"lockId": state.lockId.value,
|
'lockId': state.lockId.value,
|
||||||
"endDate": int.parse(endDate),
|
'endDate': endDate,
|
||||||
"addType": "1",
|
'addType': '1',
|
||||||
"faceName": state.nameController.text,
|
'palmName': state.nameController.text,
|
||||||
"faceNumber": "123456",
|
'palmNumber': '123456',
|
||||||
"faceType": palmType,
|
'palmType': carType.toString(),
|
||||||
"startDate": int.parse(startDate),
|
'isCoerced': state.isStressFingerprint.value == false ? '2' : '1',
|
||||||
"cyclicConfig": state.weekdaysList.value,
|
'startDate': startDate,
|
||||||
"fromType": state.fromType.value,
|
'weekDay': state.weekdaysList.value,
|
||||||
"isAdministrator": state.isAdministrator.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 {
|
Future<void> checkpalmNameDuplicated(String palmName) async{
|
||||||
var entity = await ApiRepository.to.checkFaceNameDuplicatedData(
|
final LoginEntity entity = await ApiRepository.to.checkPalmNameDuplicatedData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
faceName: palmName,
|
palmVeinName: palmName,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
addPalmData();
|
_addPalmData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,101 +13,112 @@ import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
|||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
class AddPalmTypePage extends StatefulWidget { // 从添加员工进入 传入员工名字
|
class AddPalmTypePage extends StatefulWidget { // 从添加员工进入 传入员工名字
|
||||||
|
|
||||||
const AddPalmTypePage(
|
const AddPalmTypePage({Key? key}) : super(key: key);
|
||||||
{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;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddPalmTypePage> createState() => _AddPalmTypePageState();
|
State<AddPalmTypePage> createState() => _AddPalmTypePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
class _AddPalmTypePageState extends State<AddPalmTypePage> with SingleTickerProviderStateMixin {
|
||||||
final AddPalmTypeLogic logic = Get.put(AddPalmTypeLogic());
|
final AddPalmTypeLogic logic = Get.put(AddPalmTypeLogic());
|
||||||
final AddPalmTypeState state = Get.find<AddPalmTypeLogic>().state;
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
state.tabController = TabController(
|
||||||
if (state.selectType.value == '1') {
|
vsync: this,
|
||||||
state.beginTime.value = DateTool().dateToYMDHNString(
|
length: state.fromType.value == 1
|
||||||
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
? _itemTabs.length
|
||||||
state.endTime.value = DateTool().dateToYMDHNString(
|
: _fromCheckInTypeItemTabs.length,
|
||||||
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
initialIndex: 0);
|
||||||
} else {
|
state.tabController.addListener(() {
|
||||||
state.beginTime.value = ''; //默认为当前时间
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
state.endTime.value = ''; //默认为当前时间
|
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() {
|
Widget indexChangeWidget() {
|
||||||
switch (int.parse(widget.selectType)) {
|
switch (int.parse(state.selectType.value)) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: <Widget>[
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: <Widget>[
|
||||||
'姓名'.tr,
|
perpetualKeyWidget(
|
||||||
'请输入'.tr,
|
'姓名'.tr,
|
||||||
state.nameController),
|
'请输入'.tr,
|
||||||
keyBottomWidget()
|
state.nameController),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// 限时
|
// 限时
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: <Widget>[
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: <Widget>[
|
||||||
'姓名'.tr,
|
perpetualKeyWidget(
|
||||||
'请输入'.tr,
|
'姓名'.tr,
|
||||||
state.nameController),
|
'请输入'.tr,
|
||||||
keyTimeLimitWidget(),
|
state.nameController),
|
||||||
keyBottomWidget()
|
keyTimeLimitWidget(),
|
||||||
],
|
// SizedBox(height: 10.h),
|
||||||
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
// 循环
|
// 循环
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: <Widget>[
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: <Widget>[
|
||||||
'姓名'.tr,
|
perpetualKeyWidget(
|
||||||
'请输入'.tr,
|
'姓名'.tr,
|
||||||
state.nameController),
|
'请输入'.tr,
|
||||||
keyCyclicDate(),
|
state.nameController),
|
||||||
SizedBox(height: 10.h),
|
keyCyclicDate(),
|
||||||
keyBottomWidget()
|
SizedBox(height: 10.h),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -120,7 +131,6 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
String titleStr, String rightTitle, TextEditingController controller) {
|
String titleStr, String rightTitle, TextEditingController controller) {
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(height: 10.h),
|
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: titleStr,
|
leftTitel: titleStr,
|
||||||
rightTitle: '',
|
rightTitle: '',
|
||||||
@ -137,28 +147,30 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '生效时间'.tr,
|
leftTitel: '生效时间'.tr,
|
||||||
rightTitle: state.beginTime.value,
|
rightTitle: state.timeLimitBeginTime.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
final PDuration selectDate =
|
final PDuration selectDate = PDuration.parse(
|
||||||
PDuration.parse(DateTime.tryParse(state.beginTime.value));
|
DateTime.parse(state.timeLimitBeginTime.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.timeLimitBeginTime.value =
|
||||||
});
|
DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '失效时间'.tr,
|
leftTitel: '失效时间'.tr,
|
||||||
rightTitle: state.endTime.value,
|
rightTitle: state.timeLimitEndTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
final PDuration selectDate =
|
final PDuration selectDate =
|
||||||
PDuration.parse(DateTime.tryParse(state.endTime.value));
|
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
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),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
@ -171,22 +183,23 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '有效期'.tr,
|
leftTitel: '有效期'.tr,
|
||||||
rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
|
rightTitle:
|
||||||
|
'${state.cycleBeginTime.value}\n${state.cycleEndTime.value}',
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
final result =
|
final result =
|
||||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
|
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.beginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.endTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'endTime': state.failureDateTime.value
|
'endTime': state.failureDateTime.value
|
||||||
});
|
});
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
}
|
}
|
||||||
@ -202,15 +215,15 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: <String, Object>{
|
arguments: <String, Object>{
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.beginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.endTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'endTime': state.failureDateTime.value
|
'endTime': state.failureDateTime.value
|
||||||
});
|
});
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
}
|
}
|
||||||
@ -219,25 +232,23 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: '有效时间'.tr,
|
leftTitel: '有效时间'.tr,
|
||||||
rightTitle:
|
rightTitle: '${state.effectiveDateTime.value}-${state.failureDateTime.value}',
|
||||||
'${state.effectiveDateTime.value}-${state.failureDateTime.value}',
|
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: <String, Object>{
|
arguments: <String, Object>{
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.beginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.endTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'endTime': state.failureDateTime.value
|
'endTime': state.failureDateTime.value
|
||||||
});
|
});
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
Get.back(result: result);
|
|
||||||
}
|
}
|
||||||
}))),
|
}))),
|
||||||
],
|
],
|
||||||
@ -255,7 +266,23 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
isTipsImg: false,
|
isTipsImg: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
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),
|
SizedBox(height: 30.h),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||||
@ -263,13 +290,14 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
if (state.nameController.text.isEmpty) {
|
if (state.nameController.text.isEmpty) {
|
||||||
logic.showToast('请输入姓名');
|
logic.showToast('请输入姓名'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logic.checkPalmNameDuplicated(state.nameController.text);
|
|
||||||
|
logic.checkpalmNameDuplicated(state.nameController.text);
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast('演示模式');
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -293,7 +321,7 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: <TextInputFormatter>[
|
||||||
FilteringTextInputFormatter.deny('\n'),
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
LengthLimitingTextInputFormatter(18),
|
LengthLimitingTextInputFormatter(50),
|
||||||
],
|
],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
@ -307,16 +335,16 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
|||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
focusedBorder: const OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
disabledBorder: const OutlineInputBorder(
|
disabledBorder: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
border: const OutlineInputBorder(
|
border: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
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() {
|
CupertinoSwitch _isAdmin() {
|
||||||
return CupertinoSwitch(
|
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:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class AddPalmTypeState {
|
import '../../../../tools/dateTool.dart';
|
||||||
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; // 是否为管理员
|
|
||||||
|
|
||||||
var beginTime = "".obs; // 开始时间
|
class AddPalmTypeState {
|
||||||
var endTime = "".obs; // 结束时间
|
AddPalmTypeState() {
|
||||||
var effectiveDateTime = "".obs; // 生效时间
|
Map map = Get.arguments;
|
||||||
var failureDateTime = "".obs; // 失效时间
|
lockId.value = map['lockId'];
|
||||||
var weekdaysList = [].obs;
|
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();
|
final TextEditingController nameController = TextEditingController();
|
||||||
AddPalmTypeState() {
|
late TabController tabController;
|
||||||
// Map map = Get.arguments;
|
|
||||||
// lockId.value = map["lockId"];
|
|
||||||
// fromType.value = map["fromType"];
|
|
||||||
// if(fromType.value == 2){
|
|
||||||
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
|
||||||
// // nameController.text = fromTypeTwoStaffName.value;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:get/get.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/blue/io_type.dart';
|
||||||
import 'package:star_lock/main/lockDetail/palm/palmDetail/palmDetail_state.dart';
|
import 'package:star_lock/main/lockDetail/palm/palmDetail/palmDetail_state.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.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_reply.dart';
|
||||||
import '../../../../blue/io_tool/io_tool.dart';
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
|
import '../../../../blue/sender_manage.dart';
|
||||||
|
import '../../../../login/login/entity/LoginEntity.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
@ -25,62 +28,77 @@ class PalmDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription =
|
_replySubscription =
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
// if ((reply is SenderAddICCardReply)) {
|
if ((reply is SenderAddPalmWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
// _replyAddICCardBegin(reply);
|
_replyAddPalmControlBegin(reply);
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加卡片开始(此处用作删除卡片)
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
Future<void> _replyAddPalmControlBegin(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
deletPalmData();
|
if (state.isDeletPalmVein.value == true) {
|
||||||
|
deletPalmData();
|
||||||
|
} else {
|
||||||
|
editPalmData();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: await Storage.getUid(),
|
||||||
String? userID = await Storage.getUid();
|
palmNo: int.parse(state.typeNumber.value),
|
||||||
// IoSenderManage.senderAddICCardCommand(
|
useCountLimit: 0xffff,
|
||||||
// keyID: state.keyId.value.toString(),
|
operate: state.isDeletPalmVein.value ? 2 : 1,
|
||||||
// userID: userID,
|
// 0:注册 1:修改 2:删除 3:删除全部
|
||||||
// cardNo: int.parse(state.typeNumber.value),
|
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
// useCountLimit: 0,
|
isForce: state.isStressPalm.value == true ? 1 : 0, // 是否是胁迫
|
||||||
// startTime: int.parse(state.starDate.value),
|
isRound: state.keyType.value == 4 ? 1 : 0, // 是否是循环
|
||||||
// endTime: int.parse(state.endDate.value),
|
weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
// needAuthor: 1,
|
startDate: int.parse(state.startDate.value) ~/ 1000,
|
||||||
// signKey: signKeyDataList,
|
endDate: int.parse(state.endDate.value) ~/ 1000,
|
||||||
// privateKey: getPrivateKeyList,
|
startTime: DateTool().dateToHNString(state.starTime.value),
|
||||||
// token: getTokenList,
|
endTime: DateTool().dateToHNString(state.endTime.value),
|
||||||
// );
|
needAuthor: 1,
|
||||||
|
signKey: signKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加手掌
|
// 添加卡片
|
||||||
Future<void> senderAddPalm() async {
|
Future<void> senderAddPalm() async {
|
||||||
if (state.sureBtnState.value == 1) {
|
if (state.sureBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
@ -92,34 +110,37 @@ class PalmDetailLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: await Storage.getUid(),
|
||||||
String? userID = await Storage.getUid();
|
palmNo: int.parse(state.typeNumber.value),
|
||||||
// IoSenderManage.senderAddICCardCommand(
|
useCountLimit: 0xffff,
|
||||||
// keyID: state.keyId.value.toString(),
|
operate: state.isDeletPalmVein.value ? 2 : 1,
|
||||||
// userID: userID,
|
// 0:注册 1:修改 2:删除 3:删除全部
|
||||||
// cardNo: int.parse(state.typeNumber.value),
|
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
// useCountLimit: 0,
|
isForce: state.isStressPalm.value == true ? 1 : 0, // 是否是胁迫
|
||||||
// startTime: int.parse(state.starDate.value),
|
isRound: state.keyType.value == 4 ? 1 : 0, // 是否是循环
|
||||||
// endTime: int.parse(state.endDate.value),
|
weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
// needAuthor: 1,
|
startDate: int.parse(state.startDate.value) ~/ 1000,
|
||||||
// signKey: signKeyDataList,
|
endDate: int.parse(state.endDate.value) ~/ 1000,
|
||||||
// privateKey: getPrivateKeyList,
|
startTime: DateTool().dateToHNString(state.starTime.value),
|
||||||
// token: getTokenList,
|
endTime: DateTool().dateToHNString(state.endTime.value),
|
||||||
// );
|
needAuthor: 1,
|
||||||
|
signKey: signKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: false);
|
||||||
} else if (deviceConnectionState ==
|
} else if (deviceConnectionState ==
|
||||||
BluetoothConnectionState.disconnected) {
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
@ -132,74 +153,67 @@ class PalmDetailLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑iC卡
|
// 编辑遥控
|
||||||
void editPalmData() async {
|
Future<void> editPalmData() async {
|
||||||
var entity = await ApiRepository.to.editICCardData(
|
final LoginEntity entity = await ApiRepository.to.editPalmData(
|
||||||
cardId: state.keyId.value.toString(),
|
lockId: state.fingerprintItemData.value.lockId ?? 0,
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
palmVeinId: state.keyId.value,
|
||||||
weekDay: state.weekDay.value,
|
startDate: int.parse(state.startDate.value),
|
||||||
startDate: state.starDate.value * 1000,
|
endDate: int.parse(state.endDate.value),
|
||||||
endDate: state.endDate.value * 1000,
|
|
||||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
|
||||||
cardName: state.changeNameController.text,
|
|
||||||
changeType: "1",
|
|
||||||
startTime: int.parse(state.starTime.value),
|
startTime: int.parse(state.starTime.value),
|
||||||
endTime: int.parse(state.endTime.value),
|
endTime: int.parse(state.endTime.value),
|
||||||
cardType: state.keyType.value,
|
palmVeinType: state.keyType.value,
|
||||||
cardRight: 0,
|
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) {
|
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());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除IC卡
|
// 删除遥控
|
||||||
void deletPalmData() async {
|
Future<void> deletPalmData() async {
|
||||||
var entity = await ApiRepository.to.deletIcCardData(
|
// final LoginEntity entity = await ApiRepository.to.deletRemoteControlData(
|
||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
// remoteId: state.fingerprintItemData.value.remoteId ?? 0,
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
// );
|
||||||
type: "0",
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
deleteType: "1");
|
// showToast('删除成功'.tr, something: () {
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
// Get.back(result: 'addScuess');
|
||||||
showToast("删除成功", something: () {
|
// });
|
||||||
Get.back(result: "addScuess");
|
// }
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyTypeShowDateTime() {
|
String getKeyTypeShowDateTime() {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if (state.keyType.value == 1) {
|
if (state.keyType.value == 1) {
|
||||||
useDateStr = "永久";
|
useDateStr = '永久'.tr;
|
||||||
} else if (state.keyType.value == 2) {
|
} else if (state.keyType.value == 2) {
|
||||||
useDateStr =
|
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) {
|
} else if (state.keyType.value == 4) {
|
||||||
useDateStr =
|
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;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
|
|||||||
@ -4,8 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_logic.dart';
|
import 'package:star_lock/main/lockDetail/palm/palmDetail/palmDetail_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_state.dart';
|
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -17,6 +16,7 @@ import '../../../../tools/showTFView.dart';
|
|||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
import 'palmDetail_state.dart';
|
||||||
|
|
||||||
class PalmDetailPage extends StatefulWidget {
|
class PalmDetailPage extends StatefulWidget {
|
||||||
const PalmDetailPage({Key? key}) : super(key: key);
|
const PalmDetailPage({Key? key}) : super(key: key);
|
||||||
@ -26,8 +26,8 @@ class PalmDetailPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||||
final IrisDetailLogic logic = Get.put(IrisDetailLogic());
|
final PalmDetailLogic logic = Get.put(PalmDetailLogic());
|
||||||
final IrisDetailState state = Get.find<IrisDetailLogic>().state;
|
final PalmDetailState state = Get.find<PalmDetailLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -76,7 +76,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
|||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.starDate.value = data['beginTimeTimestamp'];
|
state.startDate.value = data['beginTimeTimestamp'];
|
||||||
state.endDate.value = data['endTimeTimestamp'];
|
state.endDate.value = data['endTimeTimestamp'];
|
||||||
state.keyType.value = 2;
|
state.keyType.value = 2;
|
||||||
});
|
});
|
||||||
@ -92,7 +92,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
|||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.starDate.value = data['starDate'];
|
state.startDate.value = data['starDate'];
|
||||||
state.endDate.value = data['endDate'];
|
state.endDate.value = data['endDate'];
|
||||||
state.starTime.value = data['starTime'];
|
state.starTime.value = data['starTime'];
|
||||||
state.endTime.value = data['endTime'];
|
state.endTime.value = data['endTime'];
|
||||||
@ -118,7 +118,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
|||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.starDate.value = data['starDate'];
|
state.startDate.value = data['starDate'];
|
||||||
state.endDate.value = data['endDate'];
|
state.endDate.value = data['endDate'];
|
||||||
state.starTime.value = data['starTime'];
|
state.starTime.value = data['starTime'];
|
||||||
state.endTime.value = data['endTime'];
|
state.endTime.value = data['endTime'];
|
||||||
@ -143,7 +143,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
|||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.starDate.value = data['starDate'];
|
state.startDate.value = data['starDate'];
|
||||||
state.endDate.value = data['endDate'];
|
state.endDate.value = data['endDate'];
|
||||||
state.starTime.value = data['starTime'];
|
state.starTime.value = data['starTime'];
|
||||||
state.endTime.value = data['endTime'];
|
state.endTime.value = data['endTime'];
|
||||||
@ -162,6 +162,22 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
|||||||
.dateToYMDHNString(state.addTime.value.toString()),
|
.dateToYMDHNString(state.addTime.value.toString()),
|
||||||
)),
|
)),
|
||||||
SizedBox(height: 10.h),
|
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(
|
CommonItem(
|
||||||
leftTitel: '操作记录'.tr,
|
leftTitel: '操作记录'.tr,
|
||||||
rightTitle: '',
|
rightTitle: '',
|
||||||
@ -224,7 +240,7 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
|||||||
sureClick: () async {
|
sureClick: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
// String? idStr = await Storage.getUid();
|
// String? idStr = await Storage.getUid();
|
||||||
logic.senderAddICCard();
|
logic.senderAddPalm();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
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
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|||||||
@ -4,44 +4,45 @@ import 'package:get/get.dart';
|
|||||||
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
class PalmDetailState {
|
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() {
|
PalmDetailState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if ((map["fingerprintItemData"] != null)) {
|
if (map['fingerprintItemData'] != null) {
|
||||||
fingerprintItemData.value = map["fingerprintItemData"];
|
fingerprintItemData.value = map['fingerprintItemData'];
|
||||||
keyId.value = fingerprintItemData.value.cardId!;
|
keyId.value = fingerprintItemData.value.palmVeinId!;
|
||||||
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
typeNumber.value = fingerprintItemData.value.palmVeinNumber!;
|
||||||
typeName.value = fingerprintItemData.value.cardName!;
|
typeName.value = fingerprintItemData.value.palmVeinName!;
|
||||||
changeNameController.text = typeName.value;
|
changeNameController.text = typeName.value;
|
||||||
starDate.value = fingerprintItemData.value.startDate!.toString();
|
startDate.value = fingerprintItemData.value.startDate!.toString();
|
||||||
endDate.value = fingerprintItemData.value.endDate!.toString();
|
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||||
starTime.value = fingerprintItemData.value.startDate!.toString();
|
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||||
endTime.value = fingerprintItemData.value.endDate!.toString();
|
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||||
keyType.value = fingerprintItemData.value.cardType!;
|
keyType.value = fingerprintItemData.value.palmVeinType!;
|
||||||
adder.value = fingerprintItemData.value.senderUsername!;
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
addTime.value = fingerprintItemData.value.createDate!;
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
isStressFingerprint.value =
|
isStressPalm.value = fingerprintItemData.value.isCoerced! == 1;
|
||||||
fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
|
||||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
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 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_queryingFaceStatus.dart';
|
import 'package:star_lock/blue/io_protocol/io_addPalmWithTimeCycleCoercion.dart';
|
||||||
import 'package:star_lock/blue/io_type.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/main/lockDetail/palm/palmList/palmList_state.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_protocol/io_checkingUserInfoCount.dart';
|
|
||||||
import '../../../../blue/io_reply.dart';
|
import '../../../../blue/io_reply.dart';
|
||||||
import '../../../../blue/io_tool/io_tool.dart';
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../../blue/sender_manage.dart';
|
import '../../../../blue/sender_manage.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
|
|
||||||
@ -22,365 +23,228 @@ class PalmListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription =
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
// 添加掌静脉开始(重置锁里面所有掌静脉)
|
||||||
// 添加人脸开始(此处用作删除人脸)
|
if ((reply is SenderAddPalmWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
if ((reply is SenderAddFaceReply) && (state.isDeletFaceData == true)) {
|
_replyAddPalmBegin(reply);
|
||||||
_replyAddFaceBegin(reply);
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
if (reply is SenderQueryingFaceStatusReply) {
|
|
||||||
// 获取人脸状态
|
|
||||||
_replyQueryingFaceStatus(reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply is SenderCheckingUserInfoCountReply) {
|
|
||||||
_replyCheckingUserInfoCount(reply);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加人脸开始---这里用作删除人脸
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
Future<void> _replyAddPalmBegin(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
state.isDeletFaceData = false;
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
dismissEasyLoading();
|
deletICPalmData();
|
||||||
if (state.isDeletAll == false) {
|
|
||||||
deletFacesData();
|
|
||||||
} else {
|
|
||||||
clearAllFacesData();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
// IoSenderManage.senderAddFaceCommand(
|
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||||
// keyID:state.deletKeyID,
|
keyID: state.deletKeyID,
|
||||||
// userID:state.deletUserID,
|
userID: (await Storage.getUid())!,
|
||||||
// faceNo:state.deletFaceNo,
|
palmNo: state.deletPalmVeinNo,
|
||||||
// useCountLimit:0,
|
useCountLimit: 0xffff,
|
||||||
// isForce:0, // 是否是胁迫
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
// isRound:0, // 是否是循环
|
isAdmin: 0,
|
||||||
// weekRound:0, // 周循环
|
isForce: 0, // 是否是胁迫
|
||||||
// startDate: 0x11223344,
|
isRound: 0, // 是否是循环
|
||||||
// endDate: 0x11223344,
|
weekRound: 0, // 周循环
|
||||||
// startTime:"0",
|
startDate: 0x11223344,
|
||||||
// endTime:"0",
|
endDate: 0x11223344,
|
||||||
// needAuthor:1,
|
startTime: '0',
|
||||||
// signKey:signKeyDataList,
|
endTime: '0',
|
||||||
// privateKey:getPrivateKeyList,
|
needAuthor: 1,
|
||||||
// token: getTokenList,
|
signKey: signKeyDataList,
|
||||||
// );
|
privateKey: getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取人脸状态
|
// 删除卡片
|
||||||
Future<void> _replyQueryingFaceStatus(Reply reply) async {
|
Future<void> senderAddPalm() 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 {
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
// IoSenderManage.senderAddFaceCommand(
|
IoSenderManage.senderAddPalmWithTimeCycleCoercionCommand(
|
||||||
// keyID:state.deletKeyID,
|
keyID: state.deletKeyID,
|
||||||
// userID:state.deletUserID,
|
userID: (await Storage.getUid())!,
|
||||||
// faceNo:state.deletFaceNo,
|
palmNo: state.deletPalmVeinNo,
|
||||||
// useCountLimit:0,
|
useCountLimit: 0xffff,
|
||||||
// isForce:0, // 是否是胁迫
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
// isRound:0, // 是否是循环
|
isAdmin: 0,
|
||||||
// weekRound:0, // 周循环
|
isForce: 0, // 是否是胁迫
|
||||||
// startDate: 0x11223344,
|
isRound: 0, // 是否是循环
|
||||||
// endDate: 0x11223344,
|
weekRound: 0, // 周循环
|
||||||
// startTime:"0",
|
startDate: 0x11223344,
|
||||||
// endTime:"0",
|
endDate: 0x11223344,
|
||||||
// needAuthor:1,
|
startTime: '0',
|
||||||
// signKey:signKeyDataList,
|
endTime: '0',
|
||||||
// privateKey:getPrivateKeyList,
|
needAuthor: 1,
|
||||||
// token: getTokenList,
|
signKey: signKeyDataList,
|
||||||
// );
|
privateKey: getPrivateKeyList,
|
||||||
} else if (deviceConnectionState ==
|
token: getTokenList,
|
||||||
BluetoothConnectionState.disconnected) {
|
isBeforeAddUser: false);
|
||||||
dismissEasyLoading();
|
} else if (deviceConnectionState ==
|
||||||
cancelBlueConnetctToastTimer();
|
BluetoothConnectionState.disconnected) {
|
||||||
if (state.ifCurrentScreen.value == true) {
|
dismissEasyLoading();
|
||||||
showBlueConnetctToast();
|
cancelBlueConnetctToastTimer();
|
||||||
}
|
if (state.ifCurrentScreen.value == true) {
|
||||||
}
|
showBlueConnetctToast();
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取人脸列表
|
// 获取IC卡列表
|
||||||
void getFaceListData() async {
|
Future<FingerprintListDataEntity> getPalmListData({required bool isRefresh}) async {
|
||||||
var entity = await ApiRepository.to.getFaceListData(
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.fingerprintItemListData.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
final FingerprintListDataEntity entity =
|
||||||
|
await ApiRepository.to.getPalmListData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
pageNo: '1',
|
pageNo: pageNo.toString(),
|
||||||
pageSize: '20',
|
pageSize: pageSize,
|
||||||
searchStr: state.searchController.text,
|
searchStr: state.searchController.text,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.faceItemListData.value = entity.data!.list!;
|
// 更新数据列表
|
||||||
|
state.fingerprintItemListData.addAll(entity.data!.list!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
}
|
}
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除的人脸
|
// 删除所有IC卡
|
||||||
void deletFacesData() async {
|
Future<void> deletICPalmData() async {
|
||||||
var faceId = "";
|
String palmId = '';
|
||||||
var type = "1";
|
String type = '1';
|
||||||
if (state.isDeletAll == false) {
|
if (state.isDeletAll == false) {
|
||||||
faceId = state.deletKeyID;
|
palmId = state.deletKeyID;
|
||||||
type = "0";
|
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();
|
|
||||||
}
|
}
|
||||||
|
// 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;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
|
_teamEvent = eventBus
|
||||||
getFaceListData();
|
.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
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
// _initReplySubscription();
|
_initReplySubscription();
|
||||||
|
|
||||||
// _initRefreshAction();
|
_initRefreshAction();
|
||||||
|
|
||||||
// getFaceListData();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onInit() async {
|
Future<void> onInit() async {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
|
||||||
if (isDemoMode == false) {
|
|
||||||
// senderQueryingFingerprintStatus();
|
|
||||||
// senderCheckingCardStatus();
|
|
||||||
|
|
||||||
// senderCheckingUserInfoCount();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onClose() async {
|
Future<void> onClose() async {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
// _replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
_teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,23 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.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_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/main/lockMian/lockMain/lockMain_logic.dart';
|
||||||
import 'package:star_lock/tools/keySearchWidget.dart';
|
import 'package:star_lock/tools/keySearchWidget.dart';
|
||||||
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
|
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/showIosTipView.dart';
|
||||||
|
import '../../../../tools/showTipView.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
@ -24,179 +30,174 @@ class PalmListPage extends StatefulWidget {
|
|||||||
State<PalmListPage> createState() => _PalmListPageState();
|
State<PalmListPage> createState() => _PalmListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PalmListPageState extends State<PalmListPage> {
|
class _PalmListPageState extends State<PalmListPage> with RouteAware {
|
||||||
final logic = Get.put(PalmListLogic());
|
final PalmListLogic logic = Get.put(PalmListLogic());
|
||||||
final state = Get.find<PalmListLogic>().state;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: '手掌',
|
barTitle: '掌静脉',
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text('重置'.tr,
|
||||||
'重置'.tr,
|
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
final bool isNetWork =
|
final bool isNetWork =
|
||||||
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
|
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
|
||||||
if (!isNetWork) {
|
if (!isNetWork) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showDeletAlertDialog(context);
|
|
||||||
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
|
||||||
|
state.isDeletAll = true;
|
||||||
|
state.deletKeyID = '0';
|
||||||
|
state.deletPalmVeinNo = 0;
|
||||||
|
logic.senderAddPalm();
|
||||||
|
});
|
||||||
|
// showDeletAlertDialog(context);
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
logic.showToast('演示模式'.tr);
|
||||||
logic.showToast('演示模式');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: EasyRefreshTool(
|
||||||
children: [
|
onRefresh: () {
|
||||||
KeySearchWidget(
|
getHttpData(isRefresh: true);
|
||||||
editingController: state.searchController,
|
},
|
||||||
onSubmittedAction: () {
|
onLoad: () {
|
||||||
// logic.getFaceListData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
),
|
child: Column(
|
||||||
SizedBox(
|
children: <Widget>[
|
||||||
height: 20.h,
|
KeySearchWidget(
|
||||||
),
|
editingController: state.searchController,
|
||||||
Expanded(child: _buildMainUI()),
|
onSubmittedAction: () {
|
||||||
AddBottomWhiteBtn(
|
getHttpData(isRefresh: true);
|
||||||
btnName: '添加手掌'.tr,
|
},
|
||||||
onClick: () async {
|
),
|
||||||
// var data =
|
SizedBox(height: 20.h),
|
||||||
// await Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
Expanded(child: _buildMainUI()),
|
||||||
// "lockId": state.lockId.value,
|
AddBottomWhiteBtn(
|
||||||
// "fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
btnName: '添加掌静脉',
|
||||||
// });
|
onClick: () async {
|
||||||
var data =
|
final data = await Get.toNamed(Routers.addPalmTypePage, arguments: <String, int>{
|
||||||
await Get.toNamed(Routers.addPalmTypeManagePage, arguments: {
|
'lockId': state.lockId.value,
|
||||||
'lockId': state.lockId.value,
|
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
});
|
||||||
});
|
if (data != null) {
|
||||||
if (data != null) {
|
getHttpData(isRefresh: true);
|
||||||
// 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();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
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) {
|
Widget _buildMainUI() {
|
||||||
showDialog(
|
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
||||||
context: context,
|
? SlidableAutoCloseBehavior(
|
||||||
builder: (BuildContext context) {
|
child: ListView.separated(
|
||||||
return ShowIosTipView(
|
itemCount: state.fingerprintItemListData.value.length,
|
||||||
title: '提示',
|
itemBuilder: (BuildContext c, int index) {
|
||||||
tipTitle: '确定要删除吗?',
|
final FingerprintItemData fingerprintItemData =
|
||||||
sureClick: () async {
|
state.fingerprintItemListData.value[index];
|
||||||
Get.back();
|
return Slidable(
|
||||||
state.isDeletFaceData = true;
|
key: ValueKey(fingerprintItemData.fingerprintId),
|
||||||
state.isDeletAll = false;
|
endActionPane: ActionPane(
|
||||||
state.deletUserID = (await Storage.getUid())!;
|
extentRatio: 0.2,
|
||||||
// logic.senderAddFace();
|
motion: const ScrollMotion(),
|
||||||
},
|
children: <Widget>[
|
||||||
cancelClick: () {
|
SlidableAction(
|
||||||
Get.back();
|
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,
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
@ -207,26 +208,43 @@ class _PalmListPageState extends State<PalmListPage> {
|
|||||||
height: 90.h,
|
height: 90.h,
|
||||||
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Colors.white,
|
|
||||||
// // borderRadius: BorderRadius.circular(10.w),
|
|
||||||
// ),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 30.w),
|
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),
|
SizedBox(width: 20.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(lockTypeTitle,
|
SizedBox(
|
||||||
style: TextStyle(
|
width: 1.sw - 110.w - 100.w,
|
||||||
fontSize: 24.sp, color: AppColors.blackColor)),
|
child: Row(
|
||||||
Expanded(child: Container()),
|
children: <Widget>[
|
||||||
|
Flexible(
|
||||||
|
child: Text(lockTypeTitle,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp,
|
||||||
|
color: AppColors.blackColor)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Text(ifInvalidation,
|
Text(ifInvalidation,
|
||||||
style: TextStyle(fontSize: 22.sp, color: Colors.red)),
|
style: TextStyle(fontSize: 22.sp, color: Colors.red)),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
@ -235,11 +253,15 @@ class _PalmListPageState extends State<PalmListPage> {
|
|||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(showTime,
|
Flexible(
|
||||||
style: TextStyle(
|
child: Text(showTime,
|
||||||
fontSize: 18.sp,
|
maxLines: 1,
|
||||||
color: AppColors.placeholderTextColor)),
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
color: AppColors.placeholderTextColor)),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.h),
|
SizedBox(width: 20.h),
|
||||||
@ -253,35 +275,54 @@ class _PalmListPageState extends State<PalmListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDeletAlertDialog(BuildContext context) {
|
@override
|
||||||
showCupertinoDialog(
|
void didChangeDependencies() {
|
||||||
context: context,
|
super.didChangeDependencies();
|
||||||
builder: (context) {
|
|
||||||
return CupertinoAlertDialog(
|
/// 路由订阅
|
||||||
title: const Text('提示'),
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
content: const Text('重置后,该锁的人脸都将被删除哦,确认要重置吗?'),
|
}
|
||||||
actions: [
|
|
||||||
CupertinoDialogAction(
|
@override
|
||||||
child: Text('取消'.tr),
|
void dispose() {
|
||||||
onPressed: () {
|
/// 取消路由订阅
|
||||||
Navigator.pop(context);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
},
|
super.dispose();
|
||||||
),
|
}
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text('确定'.tr),
|
/// 从上级界面进入 当前界面即将出现
|
||||||
onPressed: () {
|
@override
|
||||||
Navigator.pop(context);
|
void didPush() {
|
||||||
state.isDeletFaceData = true;
|
super.didPush();
|
||||||
state.isDeletAll = true;
|
state.ifCurrentScreen.value = true;
|
||||||
state.deletKeyID = '1';
|
}
|
||||||
state.deletUserID = 'DeleteAll!@#';
|
|
||||||
state.deletFaceNo = 255;
|
/// 返回上一个界面 当前界面即将消失
|
||||||
// logic.senderAddFace();
|
@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';
|
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
class PalmListState {
|
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() {
|
PalmListState() {
|
||||||
Map map = Get.arguments;
|
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 addICCardURL = '/identityCard/add'; // 添加IC卡
|
||||||
final String editICCardURL = '/identityCard/update'; // 编辑IC卡
|
final String editICCardURL = '/identityCard/update'; // 编辑IC卡
|
||||||
final String deleteICCardURL = '/identityCard/delete'; // 删除IC卡
|
final String deleteICCardURL = '/identityCard/delete'; // 删除IC卡
|
||||||
final String updateICCardUserNoURL =
|
final String updateICCardUserNoURL = '/identityCard/updateCardUserNo'; // 更新ic卡用户序号
|
||||||
'/identityCard/updateCardUserNo'; // 更新ic卡用户序号
|
final String checkCardNameURL = '/identityCard/checkIdentityCardName'; // 校验卡名字是否存在
|
||||||
final String checkCardNameURL =
|
|
||||||
'/identityCard/checkIdentityCardName'; // 校验卡名字是否存在
|
|
||||||
|
|
||||||
final String getRemoteControlListURL = '/remote/list'; // 遥控列表
|
final String getRemoteControlListURL = '/remote/list'; // 遥控列表
|
||||||
final String addRemoteControlURL = '/remote/add'; // 添加遥控
|
final String addRemoteControlURL = '/remote/add'; // 添加遥控
|
||||||
@ -135,8 +133,13 @@ abstract class Api {
|
|||||||
final String editRemoteControlURL = '/remote/update'; // 编辑遥控
|
final String editRemoteControlURL = '/remote/update'; // 编辑遥控
|
||||||
final String deleteRemoteControlURL = '/remote/delete'; // 删除遥控
|
final String deleteRemoteControlURL = '/remote/delete'; // 删除遥控
|
||||||
final String clearRemoteControlURL = '/remote/clear'; // 清空遥控
|
final String clearRemoteControlURL = '/remote/clear'; // 清空遥控
|
||||||
final String checkRemoteControlNameURL =
|
final String checkRemoteControlNameURL = '/remote/checkRemoteName'; // 校验遥控名字是否存在
|
||||||
'/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 transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表
|
||||||
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
||||||
|
|||||||
@ -1569,7 +1569,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
'remoteId': remoteId,
|
'remoteId': remoteId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 删除遥控
|
// 重置遥控
|
||||||
Future<Response> resetRemoteControlData(int lockId) =>
|
Future<Response> resetRemoteControlData(int lockId) =>
|
||||||
post(
|
post(
|
||||||
clearRemoteControlURL.toUrl,
|
clearRemoteControlURL.toUrl,
|
||||||
@ -1583,6 +1583,94 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(checkRemoteControlNameURL.toUrl,
|
post(checkRemoteControlNameURL.toUrl,
|
||||||
jsonEncode({'lockId': lockId, 'remoteName': remoteName}));
|
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) =>
|
Future<Response> getTransferLockListData(String searchStr) =>
|
||||||
post(transferLockListURL.toUrl, jsonEncode({'searchStr': 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/lockSet/lockSetInfo_entity.dart';
|
||||||
import '../main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
import '../main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||||
import '../main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_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/lockDetail/remoteControl/addRemoteControl/addRemoteControl_entity.dart';
|
||||||
import '../main/lockMian/entity/lockListInfo_entity.dart';
|
import '../main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
|
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
|
||||||
@ -1759,6 +1760,95 @@ class ApiRepository {
|
|||||||
return LoginEntity.fromJson(res.body);
|
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 {
|
Future<LoginEntity> userLogout({required String deviceld}) async {
|
||||||
final res = await apiProvider.userLogout(deviceld);
|
final res = await apiProvider.userLogout(deviceld);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user