添加遥控模块
This commit is contained in:
parent
109ff2a253
commit
629b8ca17e
BIN
images/.DS_Store
vendored
BIN
images/.DS_Store
vendored
Binary file not shown.
BIN
images/icon_remoteControl.png
Normal file
BIN
images/icon_remoteControl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 929 B |
@ -931,5 +931,6 @@
|
|||||||
"感应到门前约0.8米有人时,将自动启动面部识别开锁。": "When someone is sensed about 0.8 meters in front of the door, the face recognition unlocking will be automatically started.",
|
"感应到门前约0.8米有人时,将自动启动面部识别开锁。": "When someone is sensed about 0.8 meters in front of the door, the face recognition unlocking will be automatically started.",
|
||||||
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "When someone is sensed about 0.5 meters in front of the door, the face recognition unlocking will be automatically started.",
|
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "When someone is sensed about 0.5 meters in front of the door, the face recognition unlocking will be automatically started.",
|
||||||
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "The sensing distance has been turned off, you need to manually touch any key on the keyboard to perform face recognition unlocking.",
|
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "The sensing distance has been turned off, you need to manually touch any key on the keyboard to perform face recognition unlocking.",
|
||||||
"防误开已打开,时间是": "The anti-mistake opening has been turned on, and the time is"
|
"防误开已打开,开锁后": "The anti-mistake opening has been turned on, and after unlocking",
|
||||||
|
"秒内不可使用面容开锁": "Face unlocking cannot be used within seconds"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -964,5 +964,6 @@
|
|||||||
"感应到门前约0.8米有人时,将自动启动面部识别开锁。": "感应到门前约0.8米有人时,将自动启动面部识别开锁。",
|
"感应到门前约0.8米有人时,将自动启动面部识别开锁。": "感应到门前约0.8米有人时,将自动启动面部识别开锁。",
|
||||||
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。",
|
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。",
|
||||||
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。",
|
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。",
|
||||||
"防误开已打开,时间是": "防误开已打开,时间是"
|
"防误开已打开,开锁后": "防误开已打开,开锁后",
|
||||||
|
"秒内不可使用面容开锁": "秒内不可使用面容开锁"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -929,5 +929,6 @@
|
|||||||
"感应到门前约0.8米有人时,将自动启动面部识别开锁。": "感应到门前约0.8米有人时,将自动启动面部识别开锁。",
|
"感应到门前约0.8米有人时,将自动启动面部识别开锁。": "感应到门前约0.8米有人时,将自动启动面部识别开锁。",
|
||||||
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。",
|
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。",
|
||||||
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。",
|
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。",
|
||||||
"防误开已打开,时间是": "防误开已打开,时间是"
|
"防误开已打开,开锁后": "防误开已打开,开锁后",
|
||||||
|
"秒内不可使用面容开锁": "秒内不可使用面容开锁"
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
images/main/icon_addRemoteControl_tip.png
Normal file
BIN
images/main/icon_addRemoteControl_tip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
@ -138,6 +138,8 @@ 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';
|
||||||
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
|
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
|
||||||
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart';
|
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart';
|
||||||
|
import 'main/lockDetail/remoteControl/addRemoteControlType/addRemoteControlType_page.dart';
|
||||||
|
import 'main/lockDetail/remoteControl/remoteControlDetail/remoteControlDetail_page.dart';
|
||||||
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
|
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
|
||||||
import 'main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart';
|
import 'main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart';
|
||||||
import 'main/lockDetail/videoLog/videoLog/videoLog_page.dart';
|
import 'main/lockDetail/videoLog/videoLog/videoLog_page.dart';
|
||||||
@ -448,6 +450,8 @@ abstract class Routers {
|
|||||||
|
|
||||||
static const String remoteControlListPage = '/RemoteControlListPage'; // 遥控列表
|
static const String remoteControlListPage = '/RemoteControlListPage'; // 遥控列表
|
||||||
static const String addRemoteControlPage = '/AddRemoteControlPage'; // 添加遥控
|
static const String addRemoteControlPage = '/AddRemoteControlPage'; // 添加遥控
|
||||||
|
static const String addRemoteControlTypePage = '/AddRemoteControlTypePage'; // 添加遥控类型
|
||||||
|
static const String remoteControlDetailPage = '/RemoteControlDetailPage'; // 遥控详情
|
||||||
|
|
||||||
static const String cardListPage = '/CardListPage'; // 卡列表
|
static const String cardListPage = '/CardListPage'; // 卡列表
|
||||||
// static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡
|
// static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡
|
||||||
@ -1150,5 +1154,9 @@ abstract class AppRouters {
|
|||||||
name: Routers.expireKeyChangeValidityDatePage, page: () => const ExpireKeyChangeValidityDatePage()),
|
name: Routers.expireKeyChangeValidityDatePage, page: () => const ExpireKeyChangeValidityDatePage()),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.doorLockLogDetailPage, page: () => const DoorLockLogDetailPage()),
|
name: Routers.doorLockLogDetailPage, page: () => const DoorLockLogDetailPage()),
|
||||||
|
GetPage<dynamic>(
|
||||||
|
name: Routers.addRemoteControlTypePage, page: () => const AddRemoteControlTypePage()),
|
||||||
|
GetPage<dynamic>(
|
||||||
|
name: Routers.remoteControlDetailPage, page: () => const RemoteControlDetailPage()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
95
lib/blue/io_protocol/io_addRemoteControlCancel.dart
Normal file
95
lib/blue/io_protocol/io_addRemoteControlCancel.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 SenderCancelAddRemoteControlCommand extends SenderProtocol {
|
||||||
|
|
||||||
|
SenderCancelAddRemoteControlCommand({
|
||||||
|
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 'SenderCancelAddRemoteControlCommand{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(28);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,207 @@
|
|||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
import '../io_reply.dart';
|
||||||
|
import '../io_sender.dart';
|
||||||
|
import '../io_type.dart';
|
||||||
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
|
///TODO:添加遥控
|
||||||
|
/*
|
||||||
|
备注:
|
||||||
|
删除单个指纹规则:UseCountLimit 设置为 0。删除全部指纹规则: UseCountLimit 设置为 0,FingerNo 设置为 255,userId 设置为“Delete All !@#”,只有门锁管理员才有权限
|
||||||
|
**/
|
||||||
|
class SenderAddRemoteControlWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||||
|
|
||||||
|
SenderAddRemoteControlWithTimeCycleCoercionCommand({
|
||||||
|
this.keyID,
|
||||||
|
this.userID,
|
||||||
|
this.remoteControlNo,
|
||||||
|
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? remoteControlNo;
|
||||||
|
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 'SenderAddRemoteControlWithTimeCycleCoercionCommand{keyID: $keyID, '
|
||||||
|
'userID: $userID, remoteControlNo: $remoteControlNo, useCountLimit: $useCountLimit, '
|
||||||
|
'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 = [];
|
||||||
|
List<int> subData = [];
|
||||||
|
List<int> ebcData = [];
|
||||||
|
|
||||||
|
// 指令类型
|
||||||
|
data.addAll(intChangList(commandType!.typeValue));
|
||||||
|
|
||||||
|
// 子命令类型
|
||||||
|
data.add(26);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// remoteControlNo
|
||||||
|
subData.addAll(intChangList(remoteControlNo!));
|
||||||
|
|
||||||
|
// 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 = [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 = [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 = [];
|
||||||
|
//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 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 SenderAddRemoteControlWithTimeCycleCoercionReply extends Reply {
|
||||||
|
SenderAddRemoteControlWithTimeCycleCoercionReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
final int status = data[2];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SenderAddRemoteControlConfirmationReply extends Reply {
|
||||||
|
SenderAddRemoteControlConfirmationReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
final int status = data[2];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -24,6 +24,7 @@ import 'package:star_lock/blue/io_protocol/io_transferPermissions.dart';
|
|||||||
import '../tools/storage.dart';
|
import '../tools/storage.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_addRemoteControlWithTimeCycleCoercion.dart';
|
||||||
import 'io_protocol/io_addStressPassword.dart';
|
import 'io_protocol/io_addStressPassword.dart';
|
||||||
import 'io_protocol/io_addUser.dart';
|
import 'io_protocol/io_addUser.dart';
|
||||||
import 'io_protocol/io_checkingCardStatus.dart';
|
import 'io_protocol/io_checkingCardStatus.dart';
|
||||||
@ -308,6 +309,20 @@ class CommandReciverManager {
|
|||||||
commandType, data);
|
commandType, data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 26:
|
||||||
|
{
|
||||||
|
// 注册遥控开始
|
||||||
|
reply = SenderAddRemoteControlWithTimeCycleCoercionReply.parseData(
|
||||||
|
commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
{
|
||||||
|
// 注册遥控确认
|
||||||
|
reply = SenderAddRemoteControlConfirmationReply.parseData(
|
||||||
|
commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 30:
|
case 30:
|
||||||
{
|
{
|
||||||
// 查询指纹状态
|
// 查询指纹状态
|
||||||
|
|||||||
@ -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_addRemoteControlCancel.dart';
|
||||||
|
import 'io_protocol/io_addRemoteControlWithTimeCycleCoercion.dart';
|
||||||
import 'io_protocol/io_addStressPassword.dart';
|
import 'io_protocol/io_addStressPassword.dart';
|
||||||
import 'io_protocol/io_addUser.dart';
|
import 'io_protocol/io_addUser.dart';
|
||||||
import 'io_protocol/io_checkingCardStatus.dart';
|
import 'io_protocol/io_checkingCardStatus.dart';
|
||||||
@ -605,6 +607,72 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo:添加遥控开始(带限时、循环、胁迫...)
|
||||||
|
static void senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
{required String? keyID,
|
||||||
|
required String? userID,
|
||||||
|
required int? remoteControlNo,
|
||||||
|
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: SenderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID: keyID,
|
||||||
|
userID: userID,
|
||||||
|
remoteControlNo: remoteControlNo,
|
||||||
|
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 senderCancelAddRemoteControlCommand(
|
||||||
|
{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: SenderCancelAddRemoteControlCommand(
|
||||||
|
keyID: keyID,
|
||||||
|
userID: userID,
|
||||||
|
token: token,
|
||||||
|
needAuthor: needAuthor,
|
||||||
|
signKey: signKey,
|
||||||
|
privateKey: privateKey,
|
||||||
|
),
|
||||||
|
callBack: callBack);
|
||||||
|
}
|
||||||
|
|
||||||
//todo:添加人脸开始
|
//todo:添加人脸开始
|
||||||
static void senderAddFaceCommand(
|
static void senderAddFaceCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
|||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/push/xs_jPhush.dart';
|
import 'package:star_lock/tools/push/xs_jPhush.dart';
|
||||||
|
|
||||||
|
import '../../main/lockMian/lockMain/lockMain_logic.dart';
|
||||||
import '../../mine/mine/starLockMine_logic.dart';
|
import '../../mine/mine/starLockMine_logic.dart';
|
||||||
import '../../network/api_repository.dart';
|
import '../../network/api_repository.dart';
|
||||||
import '../../tools/eventBusEventManage.dart';
|
import '../../tools/eventBusEventManage.dart';
|
||||||
@ -53,6 +54,9 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
Storage.saveLoginData(entity.data);
|
Storage.saveLoginData(entity.data);
|
||||||
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
|
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
|
||||||
eventBus.fire(MineInfoChangeRefreshUI());
|
eventBus.fire(MineInfoChangeRefreshUI());
|
||||||
|
if (Get.isRegistered<LockMainLogic>()) {
|
||||||
|
Get.find<LockMainLogic>().getStarLockInfo(isUnShowLoading: true);
|
||||||
|
}
|
||||||
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||||
BlueManage().scanDevices.clear(); //清除设备缓存
|
BlueManage().scanDevices.clear(); //清除设备缓存
|
||||||
// 初始化JPush服务并绑定设备ID
|
// 初始化JPush服务并绑定设备ID
|
||||||
|
|||||||
@ -3,6 +3,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_addRemoteControlWithTimeCycleCoercion.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.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';
|
||||||
@ -35,6 +36,11 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
_replyAddFingerprintBegin(reply);
|
_replyAddFingerprintBegin(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加遥控开始(此处用作修改遥控)
|
||||||
|
if ((reply is SenderAddRemoteControlWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddRemoteControlBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
// 添加人脸开始(此处用作修改人脸)
|
// 添加人脸开始(此处用作修改人脸)
|
||||||
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddFaceBegin(reply);
|
_replyAddFaceBegin(reply);
|
||||||
@ -42,7 +48,157 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加人脸开始
|
// 修改卡片,接收消息
|
||||||
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editICCardData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.cardRight!,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:0, // 是否是循环
|
||||||
|
weekRound:0, // 周循环
|
||||||
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
|
startTime:'0',
|
||||||
|
endTime:'0',
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改指纹,接收消息
|
||||||
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editFingerprintsData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate:1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.fingerRight,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:0, // 是否是循环
|
||||||
|
weekRound:0, // 周循环
|
||||||
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
|
startTime:'0',
|
||||||
|
endTime:'0',
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改遥控,接收消息
|
||||||
|
Future<void> _replyAddRemoteControlBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editRemoteControlData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.remoteId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
remoteControlNo:int.parse(state.fingerprintItemData.value.remoteNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.remoteRight!,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:0, // 是否是循环
|
||||||
|
weekRound:0, // 周循环
|
||||||
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
|
startTime:'0',
|
||||||
|
endTime:'0',
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改人脸,接收消息
|
||||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
@ -67,23 +223,23 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderAddFaceCommand(
|
IoSenderManage.senderAddFaceCommand(
|
||||||
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
||||||
useCountLimit:0xffff,
|
useCountLimit:0xffff,
|
||||||
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:state.fingerprintItemData.value.faceRight!,
|
isAdmin:state.fingerprintItemData.value.faceRight!,
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:0, // 周循环
|
weekRound:0, // 周循环
|
||||||
startDate: state.beginTimeTimestamp.value~/1000,
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
endDate: state.endTimeTimestamp.value~/1000,
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
startTime:'0',
|
startTime:'0',
|
||||||
endTime:'0',
|
endTime:'0',
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: token,
|
token: token,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -93,162 +249,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除/修改人脸信息
|
// 修改指纹调用协议
|
||||||
Future<void> senderAddFace() async {
|
|
||||||
if (state.sureBtnState.value == 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
state.sureBtnState.value = 1;
|
|
||||||
|
|
||||||
showEasyLoading();
|
|
||||||
showBlueConnetctToastTimer(action: () {
|
|
||||||
dismissEasyLoading();
|
|
||||||
state.sureBtnState.value = 0;
|
|
||||||
});
|
|
||||||
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>? token = await Storage.getStringList(saveBlueToken);
|
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
IoSenderManage.senderAddFaceCommand(
|
|
||||||
keyID:state.fingerprintItemData.value.faceId!.toString(),
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
|
||||||
useCountLimit:0xffff,
|
|
||||||
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
|
||||||
isAdmin:state.fingerprintItemData.value.faceRight!,
|
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
|
||||||
isRound:0, // 是否是循环
|
|
||||||
weekRound:0, // 周循环
|
|
||||||
startDate: state.beginTimeTimestamp.value~/1000,
|
|
||||||
endDate: state.endTimeTimestamp.value~/1000,
|
|
||||||
startTime:'0',
|
|
||||||
endTime:'0',
|
|
||||||
needAuthor:1,
|
|
||||||
signKey:signKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: getTokenList,
|
|
||||||
isBeforeAddUser: false
|
|
||||||
);
|
|
||||||
} else if (deviceConnectionState ==
|
|
||||||
BluetoothConnectionState.disconnected) {
|
|
||||||
dismissEasyLoading();
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
state.sureBtnState.value = 0;
|
|
||||||
if (state.ifCurrentScreen.value == true) {
|
|
||||||
showBlueConnetctToast();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加卡片开始(此处用作删除卡片)
|
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
|
||||||
final int status = reply.data[2];
|
|
||||||
|
|
||||||
switch(status){
|
|
||||||
case 0x00:
|
|
||||||
//成功
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
dismissEasyLoading();
|
|
||||||
editICCardData();
|
|
||||||
break;
|
|
||||||
case 0x06:
|
|
||||||
//无权限
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
|
||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
|
||||||
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
|
||||||
useCountLimit:0xffff,
|
|
||||||
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
|
||||||
isAdmin:state.fingerprintItemData.value.cardRight!,
|
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
|
||||||
isRound:0, // 是否是循环
|
|
||||||
weekRound:0, // 周循环
|
|
||||||
startDate: state.beginTimeTimestamp.value~/1000,
|
|
||||||
endDate: state.endTimeTimestamp.value~/1000,
|
|
||||||
startTime:'0',
|
|
||||||
endTime:'0',
|
|
||||||
needAuthor:1,
|
|
||||||
signKey:signKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: token,
|
|
||||||
isBeforeAddUser: false
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//失败
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加指纹开始
|
|
||||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
|
||||||
final int status = reply.data[2];
|
|
||||||
switch(status){
|
|
||||||
case 0x00:
|
|
||||||
//成功
|
|
||||||
state.sureBtnState.value = 0;
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
dismissEasyLoading();
|
|
||||||
editFingerprintsData();
|
|
||||||
break;
|
|
||||||
case 0x06:
|
|
||||||
//无权限
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
|
||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
|
||||||
keyID:state.fingerprintItemData.value.fingerprintId.toString(),
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!),
|
|
||||||
useCountLimit:0xffff,
|
|
||||||
operate:1, // 0:注册 1:修改 2:删除 3:删除全部
|
|
||||||
isAdmin:state.fingerprintItemData.value.fingerRight,
|
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
|
||||||
isRound:0, // 是否是循环
|
|
||||||
weekRound:0, // 周循环
|
|
||||||
startDate: state.beginTimeTimestamp.value~/1000,
|
|
||||||
endDate: state.endTimeTimestamp.value~/1000,
|
|
||||||
startTime:'0',
|
|
||||||
endTime:'0',
|
|
||||||
needAuthor:1,
|
|
||||||
signKey:signKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: token,
|
|
||||||
isBeforeAddUser: false
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//失败
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除指纹
|
|
||||||
Future<void> senderAddFingerprint() async {
|
Future<void> senderAddFingerprint() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if(state.sureBtnState.value == 1){
|
||||||
return;
|
return;
|
||||||
@ -305,7 +306,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加卡片
|
// 修改卡片调用协议
|
||||||
Future<void> senderAddICCard() async {
|
Future<void> senderAddICCard() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if(state.sureBtnState.value == 1){
|
||||||
return;
|
return;
|
||||||
@ -360,7 +361,117 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改指纹信息
|
// 修改遥控调用协议
|
||||||
|
Future<void> senderAddRemoteControl() async {
|
||||||
|
if(state.sureBtnState.value == 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: (){
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.remoteId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
remoteControlNo:int.parse(state.fingerprintItemData.value.remoteNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.remoteRight!,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:0, // 是否是循环
|
||||||
|
weekRound:0, // 周循环
|
||||||
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
|
startTime:'0',
|
||||||
|
endTime:'0',
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改人脸调用协议
|
||||||
|
Future<void> senderAddFace() async {
|
||||||
|
if (state.sureBtnState.value == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(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>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.faceId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.faceRight!,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:0, // 是否是循环
|
||||||
|
weekRound:0, // 周循环
|
||||||
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
|
startTime:'0',
|
||||||
|
endTime:'0',
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改指纹调用接口
|
||||||
Future<void> editFingerprintsData() async{
|
Future<void> editFingerprintsData() async{
|
||||||
final LoginEntity entity = await ApiRepository.to.editFingerprintsData(
|
final LoginEntity entity = await ApiRepository.to.editFingerprintsData(
|
||||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
@ -387,7 +498,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑iC卡
|
// 修改卡片调用接口
|
||||||
Future<void> editICCardData() async{
|
Future<void> editICCardData() async{
|
||||||
final LoginEntity entity = await ApiRepository.to.editICCardData(
|
final LoginEntity entity = await ApiRepository.to.editICCardData(
|
||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
@ -414,7 +525,34 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改人脸有效期
|
// 编辑遥控
|
||||||
|
Future<void> editRemoteControlData() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.editRemoteControlData(
|
||||||
|
lockId: state.fingerprintItemData.value.lockId ?? 0,
|
||||||
|
remoteId: state.fingerprintItemData.value.remoteId!,
|
||||||
|
startDate: state.beginTimeTimestamp.value,
|
||||||
|
endDate: state.endTimeTimestamp.value,
|
||||||
|
startTime: 0,
|
||||||
|
endTime: 0,
|
||||||
|
remoteType: 2,
|
||||||
|
weekDay: [],
|
||||||
|
remoteName: state.fingerprintItemData.value.remoteName!,
|
||||||
|
addType: 1,
|
||||||
|
isCoerced: 2,
|
||||||
|
remoteRight: 2,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('修改成功'.tr, something: (){
|
||||||
|
Get.back(result: <String, String>{
|
||||||
|
'beginTimeTimestamp':state.beginTimeTimestamp.value.toString(),
|
||||||
|
'endTimeTimestamp':state.endTimeTimestamp.value.toString(),
|
||||||
|
});
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改人脸调用接口
|
||||||
Future<void> editFaceData() async {
|
Future<void> editFaceData() async {
|
||||||
final LoginEntity entity = await ApiRepository.to.updateFaceValidity(
|
final LoginEntity entity = await ApiRepository.to.updateFaceValidity(
|
||||||
lockId: state.fingerprintItemData.value.lockId!,
|
lockId: state.fingerprintItemData.value.lockId!,
|
||||||
|
|||||||
@ -53,13 +53,13 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
state.endTimeTimestamp.value ||
|
state.endTimeTimestamp.value ||
|
||||||
state.beginTimeTimestamp.value ==
|
state.beginTimeTimestamp.value ==
|
||||||
state.endTimeTimestamp.value) {
|
state.endTimeTimestamp.value) {
|
||||||
logic.showToast("失效时间需大于生效时间".tr);
|
logic.showToast('失效时间需大于生效时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.endTimeTimestamp.value <
|
if (state.endTimeTimestamp.value <
|
||||||
DateTime.now().millisecondsSinceEpoch) {
|
DateTime.now().millisecondsSinceEpoch) {
|
||||||
logic.showToast("生效时间需大于当前时间".tr);
|
logic.showToast('生效时间需大于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (state.pushType.value) {
|
switch (state.pushType.value) {
|
||||||
@ -73,7 +73,7 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 遥控
|
// 遥控
|
||||||
|
logic.senderAddRemoteControl();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// 人脸
|
// 人脸
|
||||||
@ -99,7 +99,7 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate =
|
final PDuration selectDate =
|
||||||
PDuration.parse(DateTime.tryParse(state.beginTime.value));
|
PDuration.parse(DateTime.tryParse(state.beginTime.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
@ -113,7 +113,7 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
rightTitle: state.endTime.value,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate =
|
final PDuration selectDate =
|
||||||
PDuration.parse(DateTime.tryParse(state.endTime.value));
|
PDuration.parse(DateTime.tryParse(state.endTime.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
@ -153,7 +153,9 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
void didPop() {
|
void didPop() {
|
||||||
super.didPop();
|
super.didPop();
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
@ -170,7 +172,9 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
void didPushNext() {
|
void didPushNext() {
|
||||||
super.didPushNext();
|
super.didPushNext();
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,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_addRemoteControlWithTimeCycleCoercion.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
@ -37,6 +38,11 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
_replyAddFingerprintBegin(reply);
|
_replyAddFingerprintBegin(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加遥控开始(此处用作修改或者删除指纹)
|
||||||
|
if((reply is SenderAddRemoteControlWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddRemoteControlBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
// 添加人脸开始(此处用作修改人脸)
|
// 添加人脸开始(此处用作修改人脸)
|
||||||
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddFaceBegin(reply);
|
_replyAddFaceBegin(reply);
|
||||||
@ -44,10 +50,159 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加人脸开始
|
// 修改卡片,接收协议数据
|
||||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editICCardData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.cardRight!,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改指纹,接收协议数据
|
||||||
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editFingerprintsData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate:1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.fingerRight,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改遥控,接收协议数据
|
||||||
|
Future<void> _replyAddRemoteControlBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editRemoteControlData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.remoteId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
remoteControlNo:int.parse(state.fingerprintItemData.value.remoteNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.remoteRight!,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改人脸,接收协议数据
|
||||||
|
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
@ -95,162 +250,63 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除/修改人脸信息
|
|
||||||
Future<void> senderAddFace() async {
|
// 修改卡片,发送协议
|
||||||
if (state.sureBtnState.value == 1) {
|
Future<void> senderAddICCard() async {
|
||||||
|
if(state.sureBtnState.value == 1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.sureBtnState.value = 1;
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
IoSenderManage.senderAddFaceCommand(
|
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
||||||
keyID:state.fingerprintItemData.value.faceId!.toString(),
|
useCountLimit:0xffff,
|
||||||
userID:await Storage.getUid(),
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
isAdmin:state.fingerprintItemData.value.cardRight!,
|
||||||
useCountLimit:0xffff,
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
isRound:1, // 是否是循环
|
||||||
isAdmin:state.fingerprintItemData.value.faceRight!,
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
isRound:1, // 是否是循环
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
startDate: state.starDateTimestamp.value~/1000,
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
endDate: state.endDateTimestamp.value~/1000,
|
needAuthor:1,
|
||||||
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
signKey:signKeyDataList,
|
||||||
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
privateKey:getPrivateKeyList,
|
||||||
needAuthor:1,
|
token: getTokenList,
|
||||||
signKey:signKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: getTokenList,
|
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState ==
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
BluetoothConnectionState.disconnected) {
|
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if(state.ifCurrentScreen.value == true){
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加卡片开始(此处用作删除卡片)
|
// 修改指纹,发送协议
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
|
||||||
final int status = reply.data[2];
|
|
||||||
|
|
||||||
switch(status){
|
|
||||||
case 0x00:
|
|
||||||
//成功
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
dismissEasyLoading();
|
|
||||||
editICCardData();
|
|
||||||
break;
|
|
||||||
case 0x06:
|
|
||||||
//无权限
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
|
||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
|
||||||
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
|
||||||
useCountLimit:0xffff,
|
|
||||||
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
|
||||||
isAdmin:state.fingerprintItemData.value.cardRight!,
|
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
|
||||||
isRound:1, // 是否是循环
|
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
|
||||||
startDate: state.starDateTimestamp.value~/1000,
|
|
||||||
endDate: state.endDateTimestamp.value~/1000,
|
|
||||||
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
|
||||||
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
|
||||||
needAuthor:1,
|
|
||||||
signKey:signKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: token,
|
|
||||||
isBeforeAddUser: false
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//失败
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加指纹开始
|
|
||||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
|
||||||
final int status = reply.data[2];
|
|
||||||
switch(status){
|
|
||||||
case 0x00:
|
|
||||||
//成功
|
|
||||||
state.sureBtnState.value = 0;
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
dismissEasyLoading();
|
|
||||||
editFingerprintsData();
|
|
||||||
break;
|
|
||||||
case 0x06:
|
|
||||||
//无权限
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
|
||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
|
||||||
keyID:state.fingerprintItemData.value.fingerprintId.toString(),
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!),
|
|
||||||
useCountLimit:0xffff,
|
|
||||||
operate:1, // 0:注册 1:修改 2:删除 3:删除全部
|
|
||||||
isAdmin:state.fingerprintItemData.value.fingerRight,
|
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
|
||||||
isRound:1, // 是否是循环
|
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
|
||||||
startDate: state.starDateTimestamp.value~/1000,
|
|
||||||
endDate: state.endDateTimestamp.value~/1000,
|
|
||||||
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
|
||||||
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
|
||||||
needAuthor:1,
|
|
||||||
signKey:signKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: token,
|
|
||||||
isBeforeAddUser: false
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//失败
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除指纹
|
|
||||||
Future<void> senderAddFingerprint() async {
|
Future<void> senderAddFingerprint() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if(state.sureBtnState.value == 1){
|
||||||
return;
|
return;
|
||||||
@ -307,8 +363,8 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加卡片
|
// 修改遥控,发送协议
|
||||||
Future<void> senderAddICCard() async {
|
Future<void> senderAddRemoteControl() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if(state.sureBtnState.value == 1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -331,25 +387,25 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
keyID:state.fingerprintItemData.value.remoteId!.toString(),
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
remoteControlNo:int.parse(state.fingerprintItemData.value.remoteNumber!),
|
||||||
useCountLimit:0xffff,
|
useCountLimit:0xffff,
|
||||||
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:state.fingerprintItemData.value.cardRight!,
|
isAdmin:state.fingerprintItemData.value.remoteRight!,
|
||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:1, // 是否是循环
|
isRound:1, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
startDate: state.starDateTimestamp.value~/1000,
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
endDate: state.endDateTimestamp.value~/1000,
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
@ -362,8 +418,64 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改指纹信息
|
// 修改人脸,发送协议
|
||||||
void editFingerprintsData() async{
|
Future<void> senderAddFace() async {
|
||||||
|
if (state.sureBtnState.value == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
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>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.faceId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate: 1, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.fingerprintItemData.value.faceRight!,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: false
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 修改指纹,调用接口
|
||||||
|
Future<void> editFingerprintsData() async{
|
||||||
final LoginEntity entity = await ApiRepository.to.editFingerprintsData(
|
final LoginEntity entity = await ApiRepository.to.editFingerprintsData(
|
||||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
@ -392,8 +504,8 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑iC卡
|
// 修改卡片,调用接口
|
||||||
void editICCardData() async{
|
Future<void> editICCardData() async{
|
||||||
final LoginEntity entity = await ApiRepository.to.editICCardData(
|
final LoginEntity entity = await ApiRepository.to.editICCardData(
|
||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
@ -422,8 +534,38 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改人脸有效期
|
// 编辑遥控
|
||||||
void editFaceData() async {
|
Future<void> editRemoteControlData() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.editRemoteControlData(
|
||||||
|
lockId: state.fingerprintItemData.value.lockId ?? 0,
|
||||||
|
remoteId: state.fingerprintItemData.value.remoteId!,
|
||||||
|
startDate: state.starDateTimestamp.value,
|
||||||
|
endDate: state.endDateTimestamp.value,
|
||||||
|
startTime: state.starTimeTimestamp.value,
|
||||||
|
endTime: state.endTimeTimestamp.value,
|
||||||
|
remoteType: state.fingerprintItemData.value.remoteType!,
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
remoteName: state.fingerprintItemData.value.remoteName!,
|
||||||
|
addType: 1,
|
||||||
|
isCoerced: 2,
|
||||||
|
remoteRight: 2,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('修改成功'.tr, something: (){
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
Get.back(result: <String, Object>{
|
||||||
|
'starDate':state.starDateTimestamp.value.toString(),
|
||||||
|
'endDate':state.endDateTimestamp.value.toString(),
|
||||||
|
'starTime':state.starTimeTimestamp.value.toString(),
|
||||||
|
'endTime':state.endTimeTimestamp.value.toString(),
|
||||||
|
'validityValue':state.weekDay.value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改人脸,调用接口
|
||||||
|
Future<void> editFaceData() async {
|
||||||
final LoginEntity entity = await ApiRepository.to.updateFaceValidity(
|
final LoginEntity entity = await ApiRepository.to.updateFaceValidity(
|
||||||
lockId: state.fingerprintItemData.value.lockId!,
|
lockId: state.fingerprintItemData.value.lockId!,
|
||||||
faceId: state.fingerprintItemData.value.faceId!,
|
faceId: state.fingerprintItemData.value.faceId!,
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 遥控
|
// 遥控
|
||||||
|
logic.senderAddRemoteControl();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// 人脸
|
// 人脸
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
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/app_settings/app_settings.dart';
|
||||||
|
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||||
@ -62,10 +63,11 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
if (indexList[0] == 2) {
|
if (indexList[0] == 2) {
|
||||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
indexMap['user'] = userNo.toString();
|
indexMap['user'] = userNo.toString();
|
||||||
|
AppLog.log('userNouserNouserNouserNo:$userNo');
|
||||||
final List<int> passwordData = indexList.sublist(7, 17);
|
final List<int> passwordData = indexList.sublist(7, 17);
|
||||||
final String password = utf8String(passwordData);
|
final String password = utf8String(passwordData);
|
||||||
indexMap['password'] = password.toString();
|
indexMap['password'] = password.toString();
|
||||||
|
AppLog.log('passwordpasswordpassword:$password');
|
||||||
} else {
|
} else {
|
||||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
indexMap['user'] = userNo.toString();
|
indexMap['user'] = userNo.toString();
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
class FingerprintListDataEntity {
|
class FingerprintListDataEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
Data? data;
|
|
||||||
|
|
||||||
FingerprintListDataEntity(
|
FingerprintListDataEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -13,6 +9,10 @@ class FingerprintListDataEntity {
|
|||||||
errorMsg = json['errorMsg'];
|
errorMsg = json['errorMsg'];
|
||||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -27,11 +27,6 @@ class FingerprintListDataEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
List<FingerprintItemData>? list;
|
|
||||||
int? pageNo;
|
|
||||||
int? pageSize;
|
|
||||||
int? pages;
|
|
||||||
int? total;
|
|
||||||
|
|
||||||
Data({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
Data({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||||
|
|
||||||
@ -47,6 +42,11 @@ class Data {
|
|||||||
pages = json['pages'];
|
pages = json['pages'];
|
||||||
total = json['total'];
|
total = json['total'];
|
||||||
}
|
}
|
||||||
|
List<FingerprintItemData>? list;
|
||||||
|
int? pageNo;
|
||||||
|
int? pageSize;
|
||||||
|
int? pages;
|
||||||
|
int? total;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -62,6 +62,96 @@ class Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FingerprintItemData {
|
class FingerprintItemData {
|
||||||
|
|
||||||
|
FingerprintItemData(
|
||||||
|
{this.fingerprintStatus,
|
||||||
|
this.lockId,
|
||||||
|
this.createDate,
|
||||||
|
this.fingerprintName,
|
||||||
|
this.endDate,
|
||||||
|
this.apiUserId,
|
||||||
|
this.nickName,
|
||||||
|
this.isCoerced,
|
||||||
|
this.startDate,
|
||||||
|
this.fingerprintNumber,
|
||||||
|
this.fingerprintType,
|
||||||
|
this.fingerprintId,
|
||||||
|
this.senderUsername,
|
||||||
|
this.weekDay,
|
||||||
|
this.validTimeStr,
|
||||||
|
this.cardName,
|
||||||
|
this.cardNumber,
|
||||||
|
this.cardType,
|
||||||
|
this.cardId,
|
||||||
|
this.faceId,
|
||||||
|
this.faceName,
|
||||||
|
this.faceNumber,
|
||||||
|
this.status,
|
||||||
|
this.addType,
|
||||||
|
this.faceType,
|
||||||
|
this.cyclicConfig,
|
||||||
|
this.featureData,
|
||||||
|
this.faceRight,
|
||||||
|
this.cardStatus,
|
||||||
|
this.cardRight,
|
||||||
|
this.fingerRight,
|
||||||
|
|
||||||
|
this.remoteId,
|
||||||
|
this.remoteName,
|
||||||
|
this.remoteNumber,
|
||||||
|
this.mac,
|
||||||
|
this.electricQuantity,
|
||||||
|
this.remoteStatus,
|
||||||
|
this.remoteType,
|
||||||
|
this.adminUid,
|
||||||
|
this.remoteRight,
|
||||||
|
this.lockAlias
|
||||||
|
});
|
||||||
|
|
||||||
|
FingerprintItemData.fromJson(Map<String, dynamic> json) {
|
||||||
|
fingerprintStatus = json['fingerprintStatus'];
|
||||||
|
lockId = json['lockId'];
|
||||||
|
createDate = json['createDate'];
|
||||||
|
fingerprintName = json['fingerprintName'];
|
||||||
|
endDate = json['endDate'];
|
||||||
|
apiUserId = json['apiUserId'];
|
||||||
|
nickName = json['nickName'];
|
||||||
|
isCoerced = json['isCoerced'];
|
||||||
|
startDate = json['startDate'];
|
||||||
|
fingerprintNumber = json['fingerprintNumber'];
|
||||||
|
fingerprintType = json['fingerprintType'];
|
||||||
|
fingerprintId = json['fingerprintId'];
|
||||||
|
senderUsername = json['senderUsername'];
|
||||||
|
weekDay = json['weekDay'];
|
||||||
|
validTimeStr = json['validTimeStr'];
|
||||||
|
cardName = json['cardName'];
|
||||||
|
cardNumber = json['cardNumber'];
|
||||||
|
cardType = json['cardType'];
|
||||||
|
cardId = json['cardId'];
|
||||||
|
faceId = json['faceId'];
|
||||||
|
faceName = json['faceName'];
|
||||||
|
faceNumber = json['faceNumber'];
|
||||||
|
status = json['status'];
|
||||||
|
addType = json['addType'];
|
||||||
|
faceType = json['faceType'];
|
||||||
|
cyclicConfig = json['cyclicConfig'];
|
||||||
|
featureData = json['featureData'];
|
||||||
|
faceRight = json['faceRight'];
|
||||||
|
cardStatus = json['cardStatus'];
|
||||||
|
cardRight = json['cardRight'];
|
||||||
|
fingerRight = json['fingerRight'];
|
||||||
|
|
||||||
|
remoteId = json['remoteId'];
|
||||||
|
remoteName = json['remoteName'];
|
||||||
|
remoteNumber = json['remoteNumber'];
|
||||||
|
mac = json['mac'];
|
||||||
|
electricQuantity = json['electricQuantity'];
|
||||||
|
remoteStatus = json['remoteStatus'];
|
||||||
|
remoteType = json['remoteType'];
|
||||||
|
adminUid = json['adminUid'];
|
||||||
|
remoteRight = json['remoteRight'];
|
||||||
|
lockAlias = json['lockAlias'];
|
||||||
|
}
|
||||||
int? fingerprintStatus;
|
int? fingerprintStatus;
|
||||||
int? lockId;
|
int? lockId;
|
||||||
int? createDate;
|
int? createDate;
|
||||||
@ -96,72 +186,16 @@ class FingerprintItemData {
|
|||||||
String? featureData;
|
String? featureData;
|
||||||
int? faceRight;
|
int? faceRight;
|
||||||
|
|
||||||
FingerprintItemData(
|
int? remoteId;
|
||||||
{this.fingerprintStatus,
|
String? remoteName;
|
||||||
this.lockId,
|
String? remoteNumber;
|
||||||
this.createDate,
|
String? mac;
|
||||||
this.fingerprintName,
|
int? electricQuantity;
|
||||||
this.endDate,
|
int? remoteStatus;
|
||||||
this.apiUserId,
|
int? remoteType;
|
||||||
this.nickName,
|
int? adminUid;
|
||||||
this.isCoerced,
|
int? remoteRight;
|
||||||
this.startDate,
|
String? lockAlias;
|
||||||
this.fingerprintNumber,
|
|
||||||
this.fingerprintType,
|
|
||||||
this.fingerprintId,
|
|
||||||
this.senderUsername,
|
|
||||||
this.weekDay,
|
|
||||||
this.validTimeStr,
|
|
||||||
this.cardName,
|
|
||||||
this.cardNumber,
|
|
||||||
this.cardType,
|
|
||||||
this.cardId,
|
|
||||||
this.faceId,
|
|
||||||
this.faceName,
|
|
||||||
this.faceNumber,
|
|
||||||
this.status,
|
|
||||||
this.addType,
|
|
||||||
this.faceType,
|
|
||||||
this.cyclicConfig,
|
|
||||||
this.featureData,
|
|
||||||
this.faceRight,
|
|
||||||
this.cardStatus,
|
|
||||||
this.cardRight,
|
|
||||||
this.fingerRight});
|
|
||||||
|
|
||||||
FingerprintItemData.fromJson(Map<String, dynamic> json) {
|
|
||||||
fingerprintStatus = json['fingerprintStatus'];
|
|
||||||
lockId = json['lockId'];
|
|
||||||
createDate = json['createDate'];
|
|
||||||
fingerprintName = json['fingerprintName'];
|
|
||||||
endDate = json['endDate'];
|
|
||||||
apiUserId = json['apiUserId'];
|
|
||||||
nickName = json['nickName'];
|
|
||||||
isCoerced = json['isCoerced'];
|
|
||||||
startDate = json['startDate'];
|
|
||||||
fingerprintNumber = json['fingerprintNumber'];
|
|
||||||
fingerprintType = json['fingerprintType'];
|
|
||||||
fingerprintId = json['fingerprintId'];
|
|
||||||
senderUsername = json['senderUsername'];
|
|
||||||
weekDay = json['weekDay'];
|
|
||||||
validTimeStr = json['validTimeStr'];
|
|
||||||
cardName = json['cardName'];
|
|
||||||
cardNumber = json['cardNumber'];
|
|
||||||
cardType = json['cardType'];
|
|
||||||
cardId = json['cardId'];
|
|
||||||
faceId = json['faceId'];
|
|
||||||
faceName = json['faceName'];
|
|
||||||
faceNumber = json['faceNumber'];
|
|
||||||
status = json['status'];
|
|
||||||
addType = json['addType'];
|
|
||||||
faceType = json['faceType'];
|
|
||||||
cyclicConfig = json['cyclicConfig'];
|
|
||||||
featureData = json['featureData'];
|
|
||||||
faceRight = json['faceRight'];
|
|
||||||
cardStatus = json['cardStatus'];
|
|
||||||
cardRight = json['cardRight'];
|
|
||||||
fingerRight = json['fingerRight'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -196,6 +230,17 @@ class FingerprintItemData {
|
|||||||
data['cardStatus'] = cardStatus;
|
data['cardStatus'] = cardStatus;
|
||||||
data['cardRight'] = cardRight;
|
data['cardRight'] = cardRight;
|
||||||
data['fingerRight'] = fingerRight;
|
data['fingerRight'] = fingerRight;
|
||||||
|
|
||||||
|
data['remoteId'] = remoteId;
|
||||||
|
data['remoteName'] = remoteName;
|
||||||
|
data['remoteNumber'] = remoteNumber;
|
||||||
|
data['mac'] = mac;
|
||||||
|
data['electricQuantity'] = electricQuantity;
|
||||||
|
data['remoteStatus'] = remoteStatus;
|
||||||
|
data['remoteType'] = remoteType;
|
||||||
|
data['adminUid'] = adminUid;
|
||||||
|
data['remoteRight'] = remoteRight;
|
||||||
|
data['lockAlias'] = lockAlias;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1096,7 +1096,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_main_remoteControl.png',
|
'images/main/icon_main_remoteControl.png',
|
||||||
TranslationLoader.lanKeys!.remoteControl!.tr,
|
TranslationLoader.lanKeys!.remoteControl!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.remoteControlListPage);
|
Get.toNamed(Routers.remoteControlListPage, arguments: <String, int?>{
|
||||||
|
'lockId': state.keyInfos.value.lockId,
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,10 +56,18 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
|||||||
indexMap['type'] = indexList[0].toString();
|
indexMap['type'] = indexList[0].toString();
|
||||||
|
|
||||||
if(indexList[0] == 2){
|
if(indexList[0] == 2){
|
||||||
|
// final List<int> passwordData = indexList.sublist(7, 17);
|
||||||
|
// final String password = utf8String(passwordData);
|
||||||
|
// AppLog.log('password:$password passwordData:$passwordData');
|
||||||
|
// indexMap['user'] = password;
|
||||||
|
|
||||||
|
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
|
indexMap['user'] = userNo.toString();
|
||||||
|
AppLog.log('userNouserNouserNouserNo:$userNo');
|
||||||
final List<int> passwordData = indexList.sublist(7, 17);
|
final List<int> passwordData = indexList.sublist(7, 17);
|
||||||
final String password = utf8String(passwordData);
|
final String password = utf8String(passwordData);
|
||||||
AppLog.log('password:$password passwordData:$passwordData');
|
indexMap['password'] = password.toString();
|
||||||
indexMap['user'] = password;
|
AppLog.log('passwordpasswordpassword:$password');
|
||||||
}else{
|
}else{
|
||||||
final int userNo = (indexList[1]*256) + indexList[2];
|
final int userNo = (indexList[1]*256) + indexList[2];
|
||||||
indexMap['user'] = userNo.toString();
|
indexMap['user'] = userNo.toString();
|
||||||
|
|||||||
@ -4,31 +4,31 @@ import 'package:get/get.dart';
|
|||||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
import 'keyOperationRecord_entity.dart';
|
import 'keyOperationRecord_entity.dart';
|
||||||
|
|
||||||
class LockOperatingRecordState {
|
class LockOperatingRecordState { // 记录名称
|
||||||
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
|
||||||
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
|
||||||
var operateDate = 0; // 按日期查询消息记录的时间戳
|
|
||||||
var ifHaveNext = false; // 页码
|
|
||||||
var logCountPage = 10; // 蓝牙记录一页多少个
|
|
||||||
var idStr = ""; //
|
|
||||||
var type = 0; // 1:密码 2:卡 3:指纹 4:人脸 5:钥匙
|
|
||||||
var recordName = "".obs; // 记录名称
|
|
||||||
|
|
||||||
LockOperatingRecordState() {
|
LockOperatingRecordState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if(map["id"] != null){
|
if(map['id'] != null){
|
||||||
idStr = Get.arguments["id"];
|
idStr = Get.arguments['id'];
|
||||||
}
|
}
|
||||||
if(map["idStr"] != null){
|
if(map['idStr'] != null){
|
||||||
idStr = Get.arguments["idStr"];
|
idStr = Get.arguments['idStr'];
|
||||||
}
|
}
|
||||||
if(map["type"] != null){
|
if(map['type'] != null){
|
||||||
type = Get.arguments["type"];
|
type = Get.arguments['type'];
|
||||||
}
|
}
|
||||||
if(map["recordName"] != null){
|
if(map['recordName'] != null){
|
||||||
recordName.value = Get.arguments["recordName"];
|
recordName.value = Get.arguments['recordName'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final RxList<KeyRecordDataItem> lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
||||||
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
int operateDate = 0; // 按日期查询消息记录的时间戳
|
||||||
|
bool ifHaveNext = false; // 页码
|
||||||
|
int logCountPage = 10; // 蓝牙记录一页多少个
|
||||||
|
String idStr = ''; //
|
||||||
|
int type = 0; // 1:密码 2:卡 3:指纹 4:人脸 5:钥匙
|
||||||
|
RxString recordName = ''.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,9 +80,10 @@ class BurglarAlarmLogic extends BaseGetXController{
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
|||||||
TranslationLoader.lanKeys!.preventWrongOpening!.tr,
|
TranslationLoader.lanKeys!.preventWrongOpening!.tr,
|
||||||
state.antiMisoperation.value == 0
|
state.antiMisoperation.value == 0
|
||||||
? TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr
|
? TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr
|
||||||
:'防误开已打开,时间是'.tr + state.antiMisoperation.value.toString() + '秒'.tr,
|
:'防误开已打开,开锁后'.tr + state.antiMisoperation.value.toString() + '秒内不可使用面容开锁'.tr,
|
||||||
// state.antiMisoperation.value == 0 ? '关闭' :
|
// state.antiMisoperation.value == 0 ? '关闭' :
|
||||||
'${state.antiMisoperation.value}' + '秒'.tr,
|
'${state.antiMisoperation.value}' + '秒'.tr,
|
||||||
state.faceOn.value, () {
|
state.faceOn.value, () {
|
||||||
|
|||||||
@ -124,15 +124,11 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
final List<int> getPrivateKeyList =
|
|
||||||
changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? publicKey =
|
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
await Storage.getStringList(saveBluePublicKey);
|
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
final List<int> publicKeyDataList =
|
|
||||||
changeStringListToIntList(publicKey!);
|
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -180,6 +176,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
//成功
|
//成功
|
||||||
// Toast.show(msg: "操作成功");featureEnable = state.isOpenStayWarn.value == 1 ? 0 : 1;
|
// Toast.show(msg: "操作成功");featureEnable = state.isOpenStayWarn.value == 1 ? 0 : 1;
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.settingUpSupportFeatures == 55) {
|
if (state.settingUpSupportFeatures == 55) {
|
||||||
// APP开锁时是否需联网
|
// APP开锁时是否需联网
|
||||||
@ -208,8 +205,10 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,8 +353,14 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 设置支持功能(带参数)
|
// 设置支持功能(带参数)
|
||||||
Future<void> sendBurglarAlarm(int type) async {
|
Future<void> sendBurglarAlarm(int type) async {
|
||||||
|
if(state.sureBtnState.value == 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
@ -402,6 +407,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -701,7 +701,7 @@ class _LockSetPageState extends State<LockSetPage>
|
|||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: state.isOpenLockNeedOnline.value == 1,
|
value: state.isOpenLockNeedOnline.value == 1,
|
||||||
onChanged: (bool value) {
|
onChanged: state.sureBtnState.value == 1 ? null : (bool value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
logic.sendBurglarAlarm(55);
|
logic.sendBurglarAlarm(55);
|
||||||
});
|
});
|
||||||
@ -740,31 +740,31 @@ class _LockSetPageState extends State<LockSetPage>
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 支持蓝牙广播
|
// 支持蓝牙广播
|
||||||
CupertinoSwitch _lockBlueBroadcastSwitch() {
|
// CupertinoSwitch _lockBlueBroadcastSwitch() {
|
||||||
return CupertinoSwitch(
|
// return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
// activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
// trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
// thumbColor: CupertinoColors.white,
|
||||||
value: state.isOpenBlueBroadcast.value == 1,
|
// value: state.isOpenBlueBroadcast.value == 1,
|
||||||
onChanged: (bool value) {
|
// onChanged: (bool value) {
|
||||||
setState(() {
|
// setState(() {
|
||||||
logic.sendBurglarAlarm(56);
|
// logic.sendBurglarAlarm(56);
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
CupertinoSwitch _otherUnHaveDoneSwitch() {
|
// CupertinoSwitch _otherUnHaveDoneSwitch() {
|
||||||
return CupertinoSwitch(
|
// return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
// activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
// trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
// thumbColor: CupertinoColors.white,
|
||||||
value: false,
|
// value: false,
|
||||||
onChanged: (bool value) {
|
// onChanged: (bool value) {
|
||||||
logic.showToast('功能暂未开放');
|
// logic.showToast('功能暂未开放');
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
|
|||||||
@ -27,6 +27,7 @@ class LockSetState {
|
|||||||
int settingUpSupportFeatures = 0;
|
int settingUpSupportFeatures = 0;
|
||||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
RxBool deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据
|
RxBool deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据
|
||||||
|
RxInt sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||||
|
|
||||||
LockSetState() {
|
LockSetState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
class AddRemoteControlEntity {
|
||||||
|
|
||||||
|
AddRemoteControlEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
AddRemoteControlEntity.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.remoteId});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
remoteId = json['remoteId'];
|
||||||
|
}
|
||||||
|
int? remoteId;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['remoteId'] = remoteId;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
266
lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_logic.dart
Executable file → Normal file
266
lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_logic.dart
Executable file → Normal file
@ -1,19 +1,277 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/time_utils.dart';
|
|
||||||
|
|
||||||
|
import '../../../../app_settings/app_settings.dart';
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addRemoteControlWithTimeCycleCoercion.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 'addRemoteControl_entity.dart';
|
||||||
import 'addRemoteControl_state.dart';
|
import 'addRemoteControl_state.dart';
|
||||||
|
|
||||||
class AddRemoteControlLoigc extends BaseGetXController{
|
class AddRemoteControlLogic extends BaseGetXController{
|
||||||
AddRemoteControlState state = AddRemoteControlState();
|
AddRemoteControlState state = AddRemoteControlState();
|
||||||
|
|
||||||
List<dynamic> get weekDayStr {
|
// 监听设备返回的数据
|
||||||
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList();
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
|
// 添加遥控开始
|
||||||
|
if((reply is SenderAddRemoteControlWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddRemoteControlBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加遥控确认
|
||||||
|
if(reply is SenderAddRemoteControlConfirmationReply) {
|
||||||
|
_replyAddRemoteControlConfirmation(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _replyAddRemoteControlBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
final List<int> remoteControlNumberList = reply.data.sublist(reply.data.length - 2);
|
||||||
|
final String remoteControlNumber = listChangInt(remoteControlNumberList).toString();
|
||||||
|
// AppLog.log("添加卡号:$cardNumberList cardNumber:$cardNumber");
|
||||||
|
state.remoteControlNumber.value = remoteControlNumber.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.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID:'1',
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
remoteControlNo: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> _replyAddRemoteControlConfirmation(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:
|
||||||
|
// 添加指纹中
|
||||||
|
// 当前注册数
|
||||||
|
_addRemoteControlData();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片
|
||||||
|
Future<void> senderAddRemoteControl() 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.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID:'1',
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
remoteControlNo: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> senderCancelAddRemoteControlCommand() 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.senderCancelAddRemoteControlCommand(
|
||||||
|
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> _addRemoteControlData() async {
|
||||||
|
final AddRemoteControlEntity entity = await ApiRepository.to.addRemoteControlData(
|
||||||
|
lockId: state.lockId.value.toString(),
|
||||||
|
remoteName: state.remoteControlName.value.toString(),
|
||||||
|
remoteNumber: state.remoteControlNumber.value.toString(),
|
||||||
|
remoteType: int.parse(state.remoteControlType.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,
|
||||||
|
remoteRight: 0,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
updateRemoteUserNoLoadData(entity.data!.remoteId ?? 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateRemoteUserNoLoadData(int cardId) async{
|
||||||
|
final LoginEntity entity = await ApiRepository.to.updateRemoteUserNoLoadData(
|
||||||
|
lockId: state.lockId.value,
|
||||||
|
remoteId: cardId,
|
||||||
|
remoteUserNo: state.remoteControlNumber.value,
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
showToast('添加成功'.tr, something:(){
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
Get.close(2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
|
senderAddRemoteControl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
547
lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart
Executable file → Normal file
547
lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart
Executable file → Normal file
@ -1,22 +1,14 @@
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.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/tools/pickers/pickers.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
|
||||||
import '../../../../tools/dateTool.dart';
|
|
||||||
import '../../../../tools/storage.dart';
|
|
||||||
import '../../../../tools/submitBtn.dart';
|
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
|
||||||
import 'addRemoteControl_logic.dart';
|
import 'addRemoteControl_logic.dart';
|
||||||
|
import 'addRemoteControl_state.dart';
|
||||||
|
|
||||||
class AddRemoteControlPage extends StatefulWidget {
|
class AddRemoteControlPage extends StatefulWidget {
|
||||||
const AddRemoteControlPage({Key? key}) : super(key: key);
|
const AddRemoteControlPage({Key? key}) : super(key: key);
|
||||||
@ -25,472 +17,105 @@ class AddRemoteControlPage extends StatefulWidget {
|
|||||||
State<AddRemoteControlPage> createState() => _AddRemoteControlPageState();
|
State<AddRemoteControlPage> createState() => _AddRemoteControlPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddRemoteControlPageState extends State<AddRemoteControlPage>
|
class _AddRemoteControlPageState extends State<AddRemoteControlPage> with RouteAware {
|
||||||
with SingleTickerProviderStateMixin {
|
final AddRemoteControlLogic logic = Get.put(AddRemoteControlLogic());
|
||||||
final logic = Get.put(AddRemoteControlLoigc());
|
final AddRemoteControlState state = Get.find<AddRemoteControlLogic>().state;
|
||||||
final state = Get.find<AddRemoteControlLoigc>().state;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
state.tabController = TabController(
|
|
||||||
vsync: this,
|
|
||||||
length: state.fromType.value == 1
|
|
||||||
? _itemTabs.length
|
|
||||||
: _fromCheckInTypeItemTabs.length,
|
|
||||||
initialIndex: 0);
|
|
||||||
state.tabController.addListener(() {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
state.selectType.value = state.tabController.index.toString();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (state.tabController.animation!.value == state.tabController.index) {
|
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle:
|
barTitle: '添加遥控',
|
||||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
|
haveBack: true,
|
||||||
haveBack: true,
|
backgroundColor: AppColors.mainColor,
|
||||||
backgroundColor: AppColors.mainColor),
|
),
|
||||||
body: Column(
|
body: ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
_tabBar(),
|
SizedBox(height: 180.h),
|
||||||
_pageWidget(),
|
Center(
|
||||||
|
child: Image.asset(
|
||||||
|
'images/main/icon_addRemoteControl_tip.png',
|
||||||
|
width: 300.w,
|
||||||
|
height: 300.w,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 90.h),
|
||||||
|
CupertinoActivityIndicator(
|
||||||
|
radius: 25.h,
|
||||||
|
),
|
||||||
|
SizedBox(height: 120.h),
|
||||||
|
Container(
|
||||||
|
width: 1.sw,
|
||||||
|
// height: 50.h,
|
||||||
|
padding: EdgeInsets.all(10.w),
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
|
||||||
|
// color: AppColors.blackColor,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.blackColor,
|
||||||
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Obx(() => Text(
|
||||||
|
state.ifConnectScuess.value
|
||||||
|
? '已连接到锁,请按遥控'.tr
|
||||||
|
: '尝试连接设备...'.tr,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
@override
|
||||||
switch (int.parse(state.selectType.value)) {
|
void didChangeDependencies() {
|
||||||
case 0:
|
super.didChangeDependencies();
|
||||||
{
|
|
||||||
// 永久
|
/// 路由订阅
|
||||||
// return sendElectronicKeySucceed();
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
return Column(
|
}
|
||||||
children: [
|
|
||||||
perpetualKeyWidget(
|
@override
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
void dispose() {
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
/// 取消路由订阅
|
||||||
state.nameController),
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
keyBottomWidget()
|
super.dispose();
|
||||||
],
|
}
|
||||||
);
|
|
||||||
}
|
/// 从上级界面进入 当前界面即将出现
|
||||||
case 1:
|
@override
|
||||||
{
|
void didPush() {
|
||||||
// 限时
|
super.didPush();
|
||||||
return Column(
|
state.ifCurrentScreen.value = true;
|
||||||
children: [
|
}
|
||||||
perpetualKeyWidget(
|
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
/// 返回上一个界面 当前界面即将消失
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
@override
|
||||||
state.nameController),
|
void didPop() {
|
||||||
keyTimeLimitWidget(),
|
super.didPop();
|
||||||
SizedBox(height: 10.h),
|
logic.cancelBlueConnetctToastTimer();
|
||||||
keyBottomWidget()
|
state.ifCurrentScreen.value = false;
|
||||||
],
|
|
||||||
);
|
if(state.ifAddState.value){
|
||||||
}
|
logic.senderCancelAddRemoteControlCommand();
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
// 循环
|
|
||||||
return SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
perpetualKeyWidget(
|
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
|
||||||
state.nameController),
|
|
||||||
keyCyclicDate(),
|
|
||||||
SizedBox(height: 10.h),
|
|
||||||
keyBottomWidget()
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return Container();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 密码命名输入框
|
/// 从下级返回 当前界面即将出现
|
||||||
Widget perpetualKeyWidget(
|
@override
|
||||||
String titleStr, String rightTitle, TextEditingController controller) {
|
void didPopNext() {
|
||||||
return Column(
|
super.didPopNext();
|
||||||
children: [
|
state.ifCurrentScreen.value = true;
|
||||||
CommonItem(
|
|
||||||
leftTitel: titleStr,
|
|
||||||
rightTitle: '',
|
|
||||||
isHaveRightWidget: true,
|
|
||||||
rightWidget: getTFWidget(rightTitle)),
|
|
||||||
Container(height: 10.h),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 限时顶部选择日期
|
/// 进入下级界面 当前界面即将消失
|
||||||
Widget keyTimeLimitWidget() {
|
@override
|
||||||
return Column(
|
void didPushNext() {
|
||||||
children: [
|
super.didPushNext();
|
||||||
Obx(() => CommonItem(
|
logic.cancelBlueConnetctToastTimer();
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
|
||||||
rightTitle: state.timeLimitBeginTime.value,
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () async {
|
|
||||||
PDuration selectDate = PDuration.parse(
|
|
||||||
DateTime.parse(state.timeLimitBeginTime.value));
|
|
||||||
Pickers.showDatePicker(context,
|
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
|
||||||
state.timeLimitBeginTime.value =
|
|
||||||
DateTool().getYMDHNDateString(p, 1);
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
Obx(() => CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
|
||||||
rightTitle: state.timeLimitEndTime.value,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
PDuration selectDate = PDuration.parse(
|
|
||||||
DateTime.tryParse(state.timeLimitEndTime.value));
|
|
||||||
Pickers.showDatePicker(context,
|
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
|
||||||
state.timeLimitEndTime.value =
|
|
||||||
DateTool().getYMDHNDateString(p, 1);
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
Container(height: 10.h),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 循环顶部选择日期
|
state.ifCurrentScreen.value = false;
|
||||||
Widget keyCyclicDate() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Obx(() => CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
|
||||||
rightTitle:
|
|
||||||
'${state.cycleBeginTime.value}\n${state.cycleEndTime.value}',
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true,
|
|
||||||
action: () async {
|
|
||||||
var result =
|
|
||||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
|
||||||
'validityValue': state.weekdaysList.value,
|
|
||||||
'starDate': state.cycleBeginTime.value,
|
|
||||||
'endDate': state.cycleEndTime.value,
|
|
||||||
'starTime': state.effectiveDateTime.value,
|
|
||||||
'endTime': state.failureDateTime.value
|
|
||||||
});
|
|
||||||
if (result != null && result.isNotEmpty) {
|
|
||||||
state.weekdaysList.value = result['validityValue'];
|
|
||||||
state.cycleBeginTime.value = result['starDate'];
|
|
||||||
state.cycleEndTime.value = result['endDate'];
|
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
|
||||||
state.failureDateTime.value = result['endTime'];
|
|
||||||
}
|
|
||||||
})),
|
|
||||||
Obx(() => Visibility(
|
|
||||||
visible: state.weekdaysList.isNotEmpty,
|
|
||||||
child: CommonItem(
|
|
||||||
leftTitel: '有效日'.tr,
|
|
||||||
rightTitle: logic.weekDayStr.join(',').toString(),
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true,
|
|
||||||
action: () async {
|
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
|
||||||
arguments: {
|
|
||||||
'validityValue': state.weekdaysList.value,
|
|
||||||
'starDate': state.cycleBeginTime.value,
|
|
||||||
'endDate': state.cycleEndTime.value,
|
|
||||||
'starTime': state.effectiveDateTime.value,
|
|
||||||
'endTime': state.failureDateTime.value
|
|
||||||
});
|
|
||||||
if (result != null && result.isNotEmpty) {
|
|
||||||
state.weekdaysList.value = result['validityValue'];
|
|
||||||
state.cycleBeginTime.value = result['starDate'];
|
|
||||||
state.cycleEndTime.value = result['endDate'];
|
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
|
||||||
state.failureDateTime.value = result['endTime'];
|
|
||||||
}
|
|
||||||
}))),
|
|
||||||
Obx(() => Visibility(
|
|
||||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
|
||||||
child: CommonItem(
|
|
||||||
leftTitel: '有效时间'.tr,
|
|
||||||
rightTitle:
|
|
||||||
'${state.effectiveDateTime.value}-${state.failureDateTime.value}',
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () async {
|
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
|
||||||
arguments: {
|
|
||||||
'validityValue': state.weekdaysList.value,
|
|
||||||
'starDate': state.cycleBeginTime.value,
|
|
||||||
'endDate': state.cycleEndTime.value,
|
|
||||||
'starTime': state.effectiveDateTime.value,
|
|
||||||
'endTime': state.failureDateTime.value
|
|
||||||
});
|
|
||||||
if (result != null && result.isNotEmpty) {
|
|
||||||
state.weekdaysList.value = result['validityValue'];
|
|
||||||
state.cycleBeginTime.value = result['starDate'];
|
|
||||||
state.cycleEndTime.value = result['endDate'];
|
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
|
||||||
state.failureDateTime.value = result['endTime'];
|
|
||||||
}
|
|
||||||
}))),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget keyBottomWidget() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
// CommonItem(
|
|
||||||
// leftTitel: TranslationLoader.lanKeys!.remoteControl!.tr,
|
|
||||||
// rightTitle: "",
|
|
||||||
// isTipsImg: false,
|
|
||||||
// isHaveRightWidget: true,
|
|
||||||
// rightWidget: SizedBox(
|
|
||||||
// width: 60.w, height: 50.h, child: _isStressFingerprint())),
|
|
||||||
SizedBox(height: 30.h),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
|
||||||
onClick: () async {
|
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
|
||||||
if (isDemoMode == false) {
|
|
||||||
if (state.nameController.text.isEmpty) {
|
|
||||||
logic.showToast('请输入姓名');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
logic.showToast('请确保在设备附近');
|
|
||||||
// logic.addFingerprintsData();
|
|
||||||
} else {
|
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
|
||||||
logic.showToast('演示模式');
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
|
||||||
Widget sendElectronicKeySucceed() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: 300.h,
|
|
||||||
width: 1.sw,
|
|
||||||
color: Colors.white,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 30.h,
|
|
||||||
),
|
|
||||||
Image.asset(
|
|
||||||
'images/main/icon_main_addLock.png',
|
|
||||||
width: 150.w,
|
|
||||||
height: 150.w,
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'操作成功,密码为',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 32.sp,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w500),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'62689876',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 60.sp,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w500),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: '完成'.tr,
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: '分享',
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: '标记为:已入住',
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 接受者信息输入框
|
|
||||||
Widget getTFWidget(String tfStr) {
|
|
||||||
return Container(
|
|
||||||
// color: Colors.red,
|
|
||||||
height: 65.h,
|
|
||||||
width: 300.w,
|
|
||||||
padding: EdgeInsets.only(top: 5.h),
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TextField(
|
|
||||||
//输入框一行
|
|
||||||
maxLines: 1,
|
|
||||||
inputFormatters: <TextInputFormatter>[
|
|
||||||
FilteringTextInputFormatter.deny('\n'),
|
|
||||||
LengthLimitingTextInputFormatter(18),
|
|
||||||
],
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
controller: state.nameController,
|
|
||||||
autofocus: false,
|
|
||||||
textAlign: TextAlign.end,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
//输入里面输入文字内边距设置
|
|
||||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
|
||||||
hintText: tfStr,
|
|
||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
|
||||||
focusedBorder: const OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
|
||||||
disabledBorder: const OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
|
||||||
enabledBorder: const OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
|
||||||
border: const OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 10.w,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//isStressFingerprint false:不是胁迫指纹 ture:胁迫指纹
|
|
||||||
CupertinoSwitch _isStressFingerprint() {
|
|
||||||
return CupertinoSwitch(
|
|
||||||
activeColor: CupertinoColors.activeBlue,
|
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
|
||||||
thumbColor: CupertinoColors.white,
|
|
||||||
value: true,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
// state.isStressFingerprint.value = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<ItemView> _itemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: '0'),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: '1'),
|
|
||||||
ItemView(
|
|
||||||
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: '2'),
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: '0'),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: '1'),
|
|
||||||
];
|
|
||||||
|
|
||||||
TabBar _tabBar() {
|
|
||||||
return TabBar(
|
|
||||||
controller: state.tabController,
|
|
||||||
onTap: (index) {
|
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
|
||||||
},
|
|
||||||
tabs: state.fromType.value == 1
|
|
||||||
? _itemTabs.map((ItemView item) => _tab(item)).toList()
|
|
||||||
: _fromCheckInTypeItemTabs
|
|
||||||
.map((ItemView item) => _tab(item))
|
|
||||||
.toList(),
|
|
||||||
isScrollable: true,
|
|
||||||
indicatorColor: Colors.red,
|
|
||||||
unselectedLabelColor: Colors.black,
|
|
||||||
unselectedLabelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
),
|
|
||||||
automaticIndicatorColorAdjustment: true,
|
|
||||||
labelColor: AppColors.mainColor,
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
indicator: CustomUnderlineTabIndicator(
|
|
||||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
|
||||||
strokeCap: StrokeCap.round,
|
|
||||||
width: 30.w),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Tab _tab(ItemView item) {
|
|
||||||
return Tab(
|
|
||||||
child: SizedBox(
|
|
||||||
width: 1.sw / 5,
|
|
||||||
child: Text(item.title, textAlign: TextAlign.center)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _pageWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: state.tabController,
|
|
||||||
children: state.fromType.value == 1
|
|
||||||
? _itemTabs
|
|
||||||
.map((ItemView item) => Obx(() => indexChangeWidget()))
|
|
||||||
.toList()
|
|
||||||
: _fromCheckInTypeItemTabs
|
|
||||||
.map((ItemView item) => Obx(() => indexChangeWidget()))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemView {
|
|
||||||
const ItemView({required this.title, required this.selectType});
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
final String selectType;
|
|
||||||
}
|
|
||||||
|
|||||||
70
lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_state.dart
Executable file → Normal file
70
lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_state.dart
Executable file → Normal file
@ -1,40 +1,50 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../app_settings/app_settings.dart';
|
||||||
|
import '../../../../tools/commonDataManage.dart';
|
||||||
|
|
||||||
class AddRemoteControlState{
|
class AddRemoteControlState{
|
||||||
final lockId = 0.obs;
|
|
||||||
final selectType = "0".obs;// 0永久 1显示 2循环
|
|
||||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
final isStressFingerprint = false.obs;
|
|
||||||
final isAdministrator = false.obs;// 是否是管理员
|
|
||||||
|
|
||||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
|
||||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
|
||||||
var cycleBeginTime = "".obs;// 循环开始时间
|
|
||||||
var cycleEndTime = "".obs;// 循环结束时间
|
|
||||||
var effectiveDateTime = "".obs;// 生效时间
|
|
||||||
var failureDateTime = "".obs;// 失效时间
|
|
||||||
var weekdaysList = [].obs;
|
|
||||||
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
|
||||||
|
|
||||||
final TextEditingController nameController = TextEditingController();
|
|
||||||
late TabController tabController;
|
|
||||||
AddRemoteControlState() {
|
AddRemoteControlState() {
|
||||||
Map map = Get.arguments;
|
final Map map = Get.arguments;
|
||||||
if(map["lockId"]!=null){
|
lockId.value = map['lockId'];
|
||||||
lockId.value = map["lockId"];
|
addType.value = map['addType'];
|
||||||
}
|
remoteControlName.value = map['remoteControlName'];
|
||||||
|
remoteControlNumber.value = map['remoteControlNumber'];
|
||||||
if(map["fromType"]!=null){
|
remoteControlType.value = map['remoteControlType'];
|
||||||
fromType.value = map["fromType"];
|
isCoerced.value = map['isCoerced'];
|
||||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
startDate.value = map['startDate'];
|
||||||
if(fromType.value == 2){
|
weekDay.value = map['weekDay'];
|
||||||
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
// AppLog.log('1111-isCoerced.value:${isCoerced.value}');
|
||||||
}
|
isAdministrator.value = map['isAdministrator'];
|
||||||
|
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 remoteControlName = ''.obs;
|
||||||
|
final RxString remoteControlNumber = ''.obs;
|
||||||
|
final RxString remoteControlType = ''.obs;
|
||||||
|
final RxString isCoerced = ''.obs;
|
||||||
|
final RxString isAdministrator = ''.obs;
|
||||||
|
final RxString startDate = ''.obs;
|
||||||
|
final RxList weekDay = [].obs;
|
||||||
|
final RxString effectiveDateTime = ''.obs; // 生效时间
|
||||||
|
final RxString failureDateTime = ''.obs; // 失效时间
|
||||||
|
final RxString selectType = '0'.obs;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/time_utils.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../login/login/entity/LoginEntity.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import 'addRemoteControlType_state.dart';
|
||||||
|
|
||||||
|
class AddRemoteControlTypeLoigc extends BaseGetXController{
|
||||||
|
AddRemoteControlTypeState state = AddRemoteControlTypeState();
|
||||||
|
|
||||||
|
List<dynamic> get weekDayStr {
|
||||||
|
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡数据
|
||||||
|
Future<void> addRemoteControlData() async {
|
||||||
|
int carType = 0; // 永久:1;限时2,单次3,循环:4
|
||||||
|
String startDate = '';
|
||||||
|
String endDate = '';
|
||||||
|
String startTime = '';
|
||||||
|
String endTime = '';
|
||||||
|
if (state.selectType.value == '0') {
|
||||||
|
carType = 1;
|
||||||
|
startDate = '0';
|
||||||
|
endDate = '0';
|
||||||
|
startTime = '0';
|
||||||
|
endTime = '0';
|
||||||
|
} else if (state.selectType.value == '1') {
|
||||||
|
carType = 2;
|
||||||
|
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||||
|
startTime = '0';
|
||||||
|
endTime = '0';
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
|
showToast('请选择开始时间'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (endDate.isEmpty) {
|
||||||
|
showToast('请选择结束时间'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(DateTime.now().millisecondsSinceEpoch > int.parse(state.beginTimeTimestamp.value)){
|
||||||
|
// Toast.show(msg: "生效时间要大于当前时间");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
|
showToast('失效时间要大于生效时间'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// AppLog.log("state.timeLimitBeginTime.value:${state.timeLimitBeginTime.value} startDate:$startDate");
|
||||||
|
// AppLog.log("state.timeLimitEndTime.value:${state.timeLimitEndTime.value} endDate:$endDate");
|
||||||
|
} else if (state.selectType.value == '2') {
|
||||||
|
if (state.cycleBeginTime.value.isEmpty) {
|
||||||
|
showToast('请选择有效期'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
|
||||||
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
|
carType = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
Get.toNamed(Routers.addRemoteControlPage, arguments: <String, Object>{
|
||||||
|
'lockId': state.lockId.value,
|
||||||
|
'addType': '1',
|
||||||
|
'remoteControlName': state.nameController.text,
|
||||||
|
'remoteControlNumber': '123456',
|
||||||
|
'remoteControlType': carType.toString(),
|
||||||
|
'isCoerced': state.isStressFingerprint.value == false ? '2' : '1',
|
||||||
|
'startDate': startDate,
|
||||||
|
'weekDay': state.weekdaysList.value,
|
||||||
|
'isAdministrator': state.isAdministrator.value == false ? '1' : '2', // 1:不是管理员 2:是管理员
|
||||||
|
'effectiveTime': startTime,
|
||||||
|
'failureTime': endTime,
|
||||||
|
'selectType': state.selectType.value,
|
||||||
|
'endDate': endDate,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验卡名字是否重复
|
||||||
|
Future<void> checkRemoteControlNameDuplicatedData(String remoteName) async{
|
||||||
|
final LoginEntity entity = await ApiRepository.to.checkRemoteControlNameDuplicatedData(
|
||||||
|
lockId: state.lockId.value.toString(),
|
||||||
|
remoteName: remoteName,
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
addRemoteControlData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,444 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
|
import '../../../../tools/commonDataManage.dart';
|
||||||
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
import 'addRemoteControlType_logic.dart';
|
||||||
|
import 'addRemoteControlType_state.dart';
|
||||||
|
|
||||||
|
class AddRemoteControlTypePage extends StatefulWidget {
|
||||||
|
const AddRemoteControlTypePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddRemoteControlTypePage> createState() => _AddRemoteControlTypePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddRemoteControlTypePageState extends State<AddRemoteControlTypePage> with SingleTickerProviderStateMixin {
|
||||||
|
final AddRemoteControlTypeLoigc logic = Get.put(AddRemoteControlTypeLoigc());
|
||||||
|
final AddRemoteControlTypeState state = Get.find<AddRemoteControlTypeLoigc>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
state.tabController = TabController(
|
||||||
|
vsync: this,
|
||||||
|
length: _itemTabs.length,
|
||||||
|
initialIndex: 0);
|
||||||
|
state.tabController.addListener(() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
state.selectType.value = state.tabController.index.toString();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (state.tabController.animation!.value == state.tabController.index) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle:
|
||||||
|
'添加遥控',
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
_tabBar(),
|
||||||
|
_pageWidget(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget indexChangeWidget() {
|
||||||
|
switch (int.parse(state.selectType.value)) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
// 永久
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
perpetualKeyWidget(
|
||||||
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
state.nameController),
|
||||||
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
// 限时
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
perpetualKeyWidget(
|
||||||
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
state.nameController),
|
||||||
|
keyTimeLimitWidget(),
|
||||||
|
// SizedBox(height: 10.h),
|
||||||
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
// 循环
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
perpetualKeyWidget(
|
||||||
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
state.nameController),
|
||||||
|
keyCyclicDate(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 密码命名输入框
|
||||||
|
Widget perpetualKeyWidget(
|
||||||
|
String titleStr, String rightTitle, TextEditingController controller) {
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: titleStr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: getTFWidget(rightTitle)),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 限时顶部选择日期
|
||||||
|
Widget keyTimeLimitWidget() {
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
rightTitle: state.timeLimitBeginTime.value,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
final PDuration selectDate = PDuration.parse(
|
||||||
|
DateTime.parse(state.timeLimitBeginTime.value));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
|
state.timeLimitBeginTime.value =
|
||||||
|
DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
|
rightTitle: state.timeLimitEndTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
final PDuration selectDate =
|
||||||
|
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
|
state.timeLimitEndTime.value =
|
||||||
|
DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 循环顶部选择日期
|
||||||
|
Widget keyCyclicDate() {
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle:
|
||||||
|
'${state.cycleBeginTime.value}\n${state.cycleEndTime.value}',
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
final result =
|
||||||
|
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.cycleBeginTime.value,
|
||||||
|
'endDate': state.cycleEndTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
|
state.cycleEndTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.weekdaysList.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: '有效日'.tr,
|
||||||
|
rightTitle: logic.weekDayStr.join(',').toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: <String, Object>{
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.cycleBeginTime.value,
|
||||||
|
'endDate': state.cycleEndTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
|
state.cycleEndTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: '有效时间'.tr,
|
||||||
|
rightTitle: '${state.effectiveDateTime.value}-${state.failureDateTime.value}',
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: <String, Object>{
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.cycleBeginTime.value,
|
||||||
|
'endDate': state.cycleEndTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
|
state.cycleEndTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget keyBottomWidget() {
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
// Obx(() => Visibility(
|
||||||
|
// visible: CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
||||||
|
// child: CommonItem(
|
||||||
|
// leftTitel: '是否为管理员'.tr,
|
||||||
|
// rightTitle: '',
|
||||||
|
// isTipsImg: false,
|
||||||
|
// isHaveRightWidget: true,
|
||||||
|
// rightWidget:
|
||||||
|
// SizedBox(width: 60.w, height: 50.h, child: _isAdmin())))),
|
||||||
|
// SizedBox(height: 10.h),
|
||||||
|
// Obx(() => CommonItem(
|
||||||
|
// leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||||
|
// 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${"请不要将胁迫卡用于日常开锁".tr}",
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
// )),
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||||
|
onClick: () async {
|
||||||
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
if (state.nameController.text.isEmpty) {
|
||||||
|
logic.showToast('请输入姓名'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logic.checkRemoteControlNameDuplicatedData(state.nameController.text);
|
||||||
|
} else {
|
||||||
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
|
logic.showToast('演示模式'.tr);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接受者信息输入框
|
||||||
|
Widget getTFWidget(String tfStr) {
|
||||||
|
return Container(
|
||||||
|
// color: Colors.red,
|
||||||
|
height: 65.h,
|
||||||
|
width: 300.w,
|
||||||
|
padding: EdgeInsets.only(top: 5.h),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
LengthLimitingTextInputFormatter(50),
|
||||||
|
],
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
controller: state.nameController,
|
||||||
|
autofocus: false,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
|
hintText: tfStr,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
focusedBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
disabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//isStressFingerprint false:不是胁迫指纹 ture:胁迫指纹
|
||||||
|
CupertinoSwitch _isStressFingerprint() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.isStressFingerprint.value,
|
||||||
|
onChanged: (bool value) {
|
||||||
|
state.isStressFingerprint.value = value;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否为管理员
|
||||||
|
CupertinoSwitch _isAdmin() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.isAdministrator.value,
|
||||||
|
onChanged: (bool value) {
|
||||||
|
state.isAdministrator.value = value;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: '0'),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: '1'),
|
||||||
|
ItemView(
|
||||||
|
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: '2'),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
TabBar _tabBar() {
|
||||||
|
return TabBar(
|
||||||
|
controller: state.tabController,
|
||||||
|
onTap: (int index) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
},
|
||||||
|
tabs: _itemTabs.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: _itemTabs
|
||||||
|
.map((ItemView item) => Obx(indexChangeWidget))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemView {
|
||||||
|
const ItemView({required this.title, required this.selectType});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String selectType;
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
|
class AddRemoteControlTypeState{
|
||||||
|
AddRemoteControlTypeState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if(map['lockId']!=null){
|
||||||
|
lockId.value = map['lockId'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final RxInt lockId = 0.obs;
|
||||||
|
final RxString selectType = '0'.obs;// 0永久 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();
|
||||||
|
late TabController tabController;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,226 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addRemoteControlWithTimeCycleCoercion.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/pickers/time_picker/time_utils.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import 'remoteControlDetail_state.dart';
|
||||||
|
|
||||||
|
class RemoteControlDetailLogic extends BaseGetXController {
|
||||||
|
RemoteControlDetailState state = RemoteControlDetailState();
|
||||||
|
|
||||||
|
List<dynamic> get weekDayStr {
|
||||||
|
return state.weekDay.map((e) => TimeUtils.translateWeekday(e)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听设备返回的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
|
if ((reply is SenderAddRemoteControlWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddRemoteControlBegin(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
|
Future<void> _replyAddRemoteControlBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
if (state.isDeletRemoteControl.value == true) {
|
||||||
|
deletRemoteControlData();
|
||||||
|
} else {
|
||||||
|
editRemoteControlData();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey =
|
||||||
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
remoteControlNo: int.parse(state.typeNumber.value),
|
||||||
|
useCountLimit: 0xffff,
|
||||||
|
operate: state.isDeletRemoteControl.value ? 2 : 1,
|
||||||
|
// 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
// isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
|
// isForce: state.isStressCard.value == true ? 1 : 0, // 是否是胁迫
|
||||||
|
isAdmin: 0,
|
||||||
|
isForce: 0, // 是否是胁迫
|
||||||
|
isRound: state.keyType.value == 4 ? 1 : 0, // 是否是循环
|
||||||
|
weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: int.parse(state.startDate.value) ~/ 1000,
|
||||||
|
endDate: int.parse(state.endDate.value) ~/ 1000,
|
||||||
|
startTime: DateTool().dateToHNString(state.starTime.value),
|
||||||
|
endTime: DateTool().dateToHNString(state.endTime.value),
|
||||||
|
needAuthor: 1,
|
||||||
|
signKey: signKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片
|
||||||
|
Future<void> senderAddICCard() async {
|
||||||
|
if (state.sureBtnState.value == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<String>? privateKey =
|
||||||
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
remoteControlNo: int.parse(state.typeNumber.value),
|
||||||
|
useCountLimit: 0xffff,
|
||||||
|
operate: state.isDeletRemoteControl.value ? 2 : 1,
|
||||||
|
// 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
// isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
|
// isForce: state.isStressCard.value == true ? 1 : 0, // 是否是胁迫
|
||||||
|
isAdmin: 0,
|
||||||
|
isForce: 0, // 是否是胁迫
|
||||||
|
isRound: state.keyType.value == 4 ? 1 : 0, // 是否是循环
|
||||||
|
weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: int.parse(state.startDate.value) ~/ 1000,
|
||||||
|
endDate: int.parse(state.endDate.value) ~/ 1000,
|
||||||
|
startTime: DateTool().dateToHNString(state.starTime.value),
|
||||||
|
endTime: DateTool().dateToHNString(state.endTime.value),
|
||||||
|
needAuthor: 1,
|
||||||
|
signKey: signKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: false);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑遥控
|
||||||
|
Future<void> editRemoteControlData() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.editRemoteControlData(
|
||||||
|
lockId: state.fingerprintItemData.value.lockId ?? 0,
|
||||||
|
remoteId: state.keyId.value,
|
||||||
|
startDate: int.parse(state.startDate.value),
|
||||||
|
endDate: int.parse(state.endDate.value),
|
||||||
|
startTime: int.parse(state.starTime.value),
|
||||||
|
endTime: int.parse(state.endTime.value),
|
||||||
|
remoteType: state.keyType.value,
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
remoteName: state.changeNameController.text,
|
||||||
|
addType: 1,
|
||||||
|
isCoerced: 2,
|
||||||
|
remoteRight: 2,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.fingerprintItemData.value.cardName = 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());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除遥控
|
||||||
|
Future<void> deletRemoteControlData() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.deletRemoteControlData(
|
||||||
|
remoteId: state.fingerprintItemData.value.remoteId ?? 0,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('删除成功'.tr, something: () {
|
||||||
|
Get.back(result: 'addScuess');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime() {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (state.keyType.value == 1) {
|
||||||
|
useDateStr = '永久'.tr;
|
||||||
|
} else if (state.keyType.value == 2) {
|
||||||
|
useDateStr =
|
||||||
|
'${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}';
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
useDateStr =
|
||||||
|
'${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}';
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,354 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../tools/showTipView.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
import '../../../lockMian/lockMain/lockMain_logic.dart';
|
||||||
|
import 'remoteControlDetail_logic.dart';
|
||||||
|
import 'remoteControlDetail_state.dart';
|
||||||
|
|
||||||
|
class RemoteControlDetailPage extends StatefulWidget {
|
||||||
|
const RemoteControlDetailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<RemoteControlDetailPage> createState() => _RemoteControlDetailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RemoteControlDetailPageState extends State<RemoteControlDetailPage> with RouteAware {
|
||||||
|
final RemoteControlDetailLogic logic = Get.put(RemoteControlDetailLogic());
|
||||||
|
final RemoteControlDetailState state = Get.find<RemoteControlDetailLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: '遥控详情'.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: '遥控号',
|
||||||
|
rightTitle: state.typeNumber.value,
|
||||||
|
isHaveDirection: false,
|
||||||
|
isHaveLine: true)),
|
||||||
|
Obx(() => lockDataListItem(
|
||||||
|
TranslationLoader.lanKeys!.name!.tr, state.typeName.value,
|
||||||
|
() {
|
||||||
|
ShowTipView().showTFViewAlertDialog(
|
||||||
|
state.changeNameController,
|
||||||
|
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
|
||||||
|
'', () {
|
||||||
|
if (state.changeNameController.text.isEmpty) {
|
||||||
|
logic.showToast('请输入姓名'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
state.typeName.value = state.changeNameController.text;
|
||||||
|
logic.editRemoteControlData();
|
||||||
|
}, inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
LengthLimitingTextInputFormatter(50),
|
||||||
|
]);
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ||
|
||||||
|
state.keyType.value == 2 ||
|
||||||
|
state.keyType.value == 1,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
allHeight: 70.h,
|
||||||
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
if (state.keyType.value == 2 || state.keyType.value == 1) {
|
||||||
|
// 限时
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeDatePage,
|
||||||
|
arguments: <String, Object>{
|
||||||
|
'pushType': 2,
|
||||||
|
'fingerprintItemData':
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.startDate.value = data['beginTimeTimestamp'];
|
||||||
|
state.endDate.value = data['endTimeTimestamp'];
|
||||||
|
state.keyType.value = 2;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
// 循环
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: <String, Object>{
|
||||||
|
'pushType': 2,
|
||||||
|
'fingerprintItemData':
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.startDate.value = data['starDate'];
|
||||||
|
state.endDate.value = data['endDate'];
|
||||||
|
state.starTime.value = data['starTime'];
|
||||||
|
state.endTime.value = data['endTime'];
|
||||||
|
state.weekDay.value = data['weekDay'];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
|
rightTitle: logic.weekDayStr.join(','),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: <String, Object>{
|
||||||
|
'pushType': 0,
|
||||||
|
'fingerprintItemData':
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.startDate.value = data['starDate'];
|
||||||
|
state.endDate.value = data['endDate'];
|
||||||
|
state.starTime.value = data['starTime'];
|
||||||
|
state.endTime.value = data['endTime'];
|
||||||
|
state.weekDay.value = data['weekDay'];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: '有效时间'.tr,
|
||||||
|
rightTitle:
|
||||||
|
'${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: <String, Object>{
|
||||||
|
'pushType': 0,
|
||||||
|
'fingerprintItemData':
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.startDate.value = data['starDate'];
|
||||||
|
state.endDate.value = data['endDate'];
|
||||||
|
state.starTime.value = data['starTime'];
|
||||||
|
state.endTime.value = data['endTime'];
|
||||||
|
state.weekDay.value = data['validityValue'];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
|
Container(height: 10.h),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
rightTitle: state.adder.value,
|
||||||
|
)),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||||
|
rightTitle: DateTool()
|
||||||
|
.dateToYMDHNString(state.addTime.value.toString()),
|
||||||
|
)),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
// Obx(() => CommonItem(
|
||||||
|
// leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||||
|
// rightTitle: '',
|
||||||
|
// isTipsImg: false,
|
||||||
|
// isHaveLine: true,
|
||||||
|
// isHaveRightWidget: true,
|
||||||
|
// rightWidget: SizedBox(
|
||||||
|
// width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||||
|
// Obx(() => CommonItem(
|
||||||
|
// leftTitel: '是否为管理员'.tr,
|
||||||
|
// rightTitle: '',
|
||||||
|
// isTipsImg: false,
|
||||||
|
// isHaveRightWidget: true,
|
||||||
|
// rightWidget:
|
||||||
|
// SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||||
|
// Container(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
|
arguments: <String, Object?>{
|
||||||
|
'type': 2,
|
||||||
|
'id': state.fingerprintItemData.value.cardId.toString(),
|
||||||
|
'recordName': state.fingerprintItemData.value.cardName
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
// SizedBox(height: 40.h),
|
||||||
|
// addControlsBtn(type),
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
||||||
|
isDelete: true,
|
||||||
|
borderRadius: 20.w,
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
|
onClick: () async {
|
||||||
|
final bool isNetWork =
|
||||||
|
await LockMainLogic.to()?.judgeTheNetwork() ?? false;
|
||||||
|
if (!isNetWork) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr,
|
||||||
|
() async {
|
||||||
|
state.isDeletRemoteControl.value = true;
|
||||||
|
logic.senderAddICCard();
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget lockDataListItem(
|
||||||
|
String leftTitle, String conentStr, Function()? action) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: action,
|
||||||
|
child: Container(
|
||||||
|
// height: 70.h,
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: AppColors.greyLineColor, // 设置边框颜色
|
||||||
|
width: 2.0.h, // 设置边框宽度
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
|
||||||
|
SizedBox(width: 10.w),
|
||||||
|
Expanded(
|
||||||
|
child: Text(conentStr,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp,
|
||||||
|
))),
|
||||||
|
SizedBox(width: 10.w),
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_right_grey.png',
|
||||||
|
width: 12.w,
|
||||||
|
height: 21.w,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//isStressFingerprint false:不是胁迫指纹 ture:胁迫指纹
|
||||||
|
// CupertinoSwitch _isStressFingerprint() {
|
||||||
|
// return CupertinoSwitch(
|
||||||
|
// activeColor: CupertinoColors.activeBlue,
|
||||||
|
// trackColor: CupertinoColors.systemGrey5,
|
||||||
|
// thumbColor: CupertinoColors.white,
|
||||||
|
// value: state.isStressCard.value,
|
||||||
|
// onChanged: (bool value) {
|
||||||
|
// setState(() {
|
||||||
|
// state.isStressCard.value = value;
|
||||||
|
// state.isDeletCard.value = false;
|
||||||
|
// logic.senderAddICCard();
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 是否为管理员
|
||||||
|
// 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.isDeletCard.value = false;
|
||||||
|
// // logic.senderAddICCard();
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@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;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
|
class RemoteControlDetailState{
|
||||||
|
RemoteControlDetailState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if (map['fingerprintItemData'] != null) {
|
||||||
|
fingerprintItemData.value = map['fingerprintItemData'];
|
||||||
|
keyId.value = fingerprintItemData.value.remoteId!;
|
||||||
|
typeNumber.value = fingerprintItemData.value.remoteNumber!;
|
||||||
|
typeName.value = fingerprintItemData.value.remoteName!;
|
||||||
|
changeNameController.text = typeName.value;
|
||||||
|
startDate.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
keyType.value = fingerprintItemData.value.remoteType!;
|
||||||
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
|
// isStressCard.value = fingerprintItemData.value.isCoerced! == 1;
|
||||||
|
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||||
|
// isAdministrator.value = fingerprintItemData.value.remoteRight! == 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final Rx<FingerprintItemData> fingerprintItemData = FingerprintItemData().obs;
|
||||||
|
|
||||||
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
|
||||||
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
RxInt sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||||
|
RxBool isDeletRemoteControl = true.obs; // 是否删除卡
|
||||||
|
// RxBool isStressCard = 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,20 +1,253 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addRemoteControlWithTimeCycleCoercion.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 '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
import 'remoteControlList_state.dart';
|
import 'remoteControlList_state.dart';
|
||||||
|
|
||||||
class RemoteControlListLogic extends BaseGetXController{
|
class RemoteControlListLogic extends BaseGetXController{
|
||||||
RemoteControlListState state = RemoteControlListState();
|
RemoteControlListState state = RemoteControlListState();
|
||||||
|
|
||||||
|
// 获取解析后的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
|
if ((reply is SenderAddRemoteControlWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddRemoteControlBegin(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
|
Future<void> _replyAddRemoteControlBegin(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
if(state.isDeletAll == true){
|
||||||
|
resetRemoteControlData();
|
||||||
|
}else{
|
||||||
|
deletRemoteControlData();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey =
|
||||||
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID: state.deletKeyID,
|
||||||
|
userID: (await Storage.getUid())!,
|
||||||
|
remoteControlNo: state.deletRemoteControlNo,
|
||||||
|
useCountLimit: 0xffff,
|
||||||
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin: 0,
|
||||||
|
isForce: 0, // 是否是胁迫
|
||||||
|
isRound: 0, // 是否是循环
|
||||||
|
weekRound: 0, // 周循环
|
||||||
|
startDate: 0x11223344,
|
||||||
|
endDate: 0x11223344,
|
||||||
|
startTime: '0',
|
||||||
|
endTime: '0',
|
||||||
|
needAuthor: 1,
|
||||||
|
signKey: signKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
isBeforeAddUser: false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除卡片
|
||||||
|
Future<void> senderAddRemoteControl() async {
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<String>? privateKey =
|
||||||
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
|
keyID: state.deletKeyID,
|
||||||
|
userID: (await Storage.getUid())!,
|
||||||
|
remoteControlNo: state.deletRemoteControlNo,
|
||||||
|
useCountLimit: 0xffff,
|
||||||
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin: 0,
|
||||||
|
isForce: 0, // 是否是胁迫
|
||||||
|
isRound: 0, // 是否是循环
|
||||||
|
weekRound: 0, // 周循环
|
||||||
|
startDate: 0x11223344,
|
||||||
|
endDate: 0x11223344,
|
||||||
|
startTime: '0',
|
||||||
|
endTime: '0',
|
||||||
|
needAuthor: 1,
|
||||||
|
signKey: signKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: false);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取IC卡列表
|
||||||
|
Future<FingerprintListDataEntity> getRemoteControlListData(
|
||||||
|
{required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.fingerprintItemListData.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
final FingerprintListDataEntity entity = await ApiRepository.to.getRemoteControlListData(
|
||||||
|
lockId: state.lockId.value.toString(),
|
||||||
|
pageNo: pageNo.toString(),
|
||||||
|
pageSize: pageSize,
|
||||||
|
searchStr: state.searchController.text,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// 更新数据列表
|
||||||
|
state.fingerprintItemListData.addAll(entity.data!.list!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除所有IC卡
|
||||||
|
Future<void> resetRemoteControlData() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.resetRemoteControlData(
|
||||||
|
lockId: state.lockId.value
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('重置成功'.tr, something: () {
|
||||||
|
getRemoteControlListData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除遥控
|
||||||
|
Future<void> deletRemoteControlData() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.deletRemoteControlData(
|
||||||
|
remoteId: int.parse(state.deletKeyID),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('删除成功'.tr, something: () {
|
||||||
|
Get.back(result: 'addScuess');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听修改完详情之后刷新列表
|
||||||
|
late StreamSubscription _teamEvent;
|
||||||
|
void _initRefreshAction() {
|
||||||
|
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((OtherTypeRefreshListEvent event) {
|
||||||
|
getRemoteControlListData(isRefresh: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyType(FingerprintItemData fingerprintItemData) {
|
||||||
|
String keyTypeStr = ''; //
|
||||||
|
if (fingerprintItemData.remoteStatus == 1) {
|
||||||
|
if (fingerprintItemData.startDate! >
|
||||||
|
DateTime.now().millisecondsSinceEpoch) {
|
||||||
|
keyTypeStr = '未生效'.tr;
|
||||||
|
}
|
||||||
|
} else if (fingerprintItemData.remoteStatus == 2) {
|
||||||
|
keyTypeStr = '已失效'.tr;
|
||||||
|
}
|
||||||
|
return keyTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyDateType(FingerprintItemData fingerprintItemData) {
|
||||||
|
String keyDateTypeStr = ''; // 永久:1;限时2,单次3,循环:4
|
||||||
|
if (fingerprintItemData.remoteType! == 1) {
|
||||||
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDHNString((fingerprintItemData.createDate ?? 0).toString())} 永久';
|
||||||
|
} else if (fingerprintItemData.remoteType! == 2) {
|
||||||
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
||||||
|
} else if (fingerprintItemData.remoteType! == 4) {
|
||||||
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
||||||
|
}
|
||||||
|
return keyDateTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
Future<void> onReady() async {
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
_initReplySubscription();
|
||||||
|
|
||||||
|
_initRefreshAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onInit() async {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
Future<void> onClose() async {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
|
||||||
|
|
||||||
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
_replySubscription.cancel();
|
||||||
|
_teamEvent.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,21 +1,25 @@
|
|||||||
|
|
||||||
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/lockMian/lockMain/lockMain_logic.dart';
|
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonDataManage.dart';
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/keySearchWidget.dart';
|
import '../../../../tools/keySearchWidget.dart';
|
||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.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';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
import 'remoteControlList_logic.dart';
|
import 'remoteControlList_logic.dart';
|
||||||
|
import 'remoteControlList_state.dart';
|
||||||
|
|
||||||
class RemoteControlListPage extends StatefulWidget {
|
class RemoteControlListPage extends StatefulWidget {
|
||||||
const RemoteControlListPage({Key? key}) : super(key: key);
|
const RemoteControlListPage({Key? key}) : super(key: key);
|
||||||
@ -24,185 +28,238 @@ class RemoteControlListPage extends StatefulWidget {
|
|||||||
State<RemoteControlListPage> createState() => _RemoteControlListPageState();
|
State<RemoteControlListPage> createState() => _RemoteControlListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RemoteControlListPageState extends State<RemoteControlListPage> {
|
class _RemoteControlListPageState extends State<RemoteControlListPage> with RouteAware {
|
||||||
final logic = Get.put(RemoteControlListLogic());
|
final RemoteControlListLogic logic = Get.put(RemoteControlListLogic());
|
||||||
final state = Get.find<RemoteControlListLogic>().state;
|
final RemoteControlListState state = Get.find<RemoteControlListLogic>().state;
|
||||||
|
|
||||||
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
logic.getRemoteControlListData(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: TranslationLoader.lanKeys!.remoteControl!.tr,
|
barTitle: '遥控',
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.reset!.tr,
|
TranslationLoader.lanKeys!.reset!.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.deletRemoteControlNo = 0;
|
||||||
|
logic.senderAddRemoteControl();
|
||||||
|
});
|
||||||
|
// 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: () {
|
||||||
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
),
|
child: Column(
|
||||||
SizedBox(
|
children: <Widget>[
|
||||||
height: 20.h,
|
KeySearchWidget(
|
||||||
),
|
editingController: state.searchController,
|
||||||
Expanded(child: _buildMainUI()),
|
onSubmittedAction: () {
|
||||||
AddBottomWhiteBtn(
|
getHttpData(isRefresh: true);
|
||||||
btnName:
|
},
|
||||||
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}',
|
),
|
||||||
onClick: () async {
|
SizedBox(height: 20.h),
|
||||||
var data =
|
Expanded(child: _buildMainUI()),
|
||||||
await Get.toNamed(Routers.addRemoteControlPage, arguments: {
|
AddBottomWhiteBtn(
|
||||||
"lockId": CommonDataManage().currentLockSetInfoData.lockId,
|
btnName:
|
||||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
'添加遥控',
|
||||||
});
|
onClick: () async {
|
||||||
if (data != null) {
|
final data = await Get.toNamed(Routers.addRemoteControlTypePage,
|
||||||
// 遥控添加
|
arguments: <String, int>{
|
||||||
|
'lockId': state.lockId.value,
|
||||||
}
|
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
},
|
});
|
||||||
),
|
if (data != null) {
|
||||||
SizedBox(
|
getHttpData(isRefresh: true);
|
||||||
height: 64.h,
|
}
|
||||||
)
|
},
|
||||||
],
|
),
|
||||||
),
|
SizedBox(
|
||||||
);
|
height: 64.h,
|
||||||
}
|
)
|
||||||
|
],
|
||||||
// String getAppBarTitle(int type) {
|
|
||||||
// String title = "";
|
|
||||||
// switch (type) {
|
|
||||||
// case 0:
|
|
||||||
// title = TranslationLoader.lanKeys!.card!.tr;
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// title = TranslationLoader.lanKeys!.fingerprint!.tr;
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// title = TranslationLoader.lanKeys!.remoteControl!.tr;
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// title = TranslationLoader.lanKeys!.face!.tr;
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// return title;
|
|
||||||
// }
|
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
|
||||||
String typeImgName = 'images/icon_card.png';
|
|
||||||
|
|
||||||
return NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildDeleteBtn(String idStr) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
// 省略: 弹出是否删除的确认对话框。
|
|
||||||
showIosTipViewDialog(context, idStr);
|
|
||||||
},
|
|
||||||
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, String keyId) {
|
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];
|
||||||
// 遥控删除
|
return Slidable(
|
||||||
|
key: ValueKey(fingerprintItemData.fingerprintId),
|
||||||
|
endActionPane: ActionPane(
|
||||||
|
extentRatio: 0.2,
|
||||||
|
motion: const ScrollMotion(),
|
||||||
|
children: <Widget>[
|
||||||
|
SlidableAction(
|
||||||
|
onPressed: (BuildContext context) async {
|
||||||
|
final bool isNetWork =
|
||||||
|
await LockMainLogic.to()?.judgeTheNetwork() ??
|
||||||
|
false;
|
||||||
|
if (!isNetWork) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
},
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
cancelClick: () {
|
'确定要删除吗?'.tr, () async {
|
||||||
Get.back();
|
state.isDeletAll = false;
|
||||||
},
|
state.deletKeyID = fingerprintItemData.remoteId.toString();
|
||||||
);
|
state.deletRemoteControlNo = int.parse(fingerprintItemData.remoteNumber!);
|
||||||
},
|
logic.senderAddRemoteControl();
|
||||||
);
|
});
|
||||||
|
},
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
label: '删除'.tr,
|
||||||
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _keyItem(
|
||||||
|
'images/icon_remoteControl.png',
|
||||||
|
fingerprintItemData.remoteName!,
|
||||||
|
logic.getKeyType(fingerprintItemData),
|
||||||
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
|
final data = await Get.toNamed(Routers.remoteControlDetailPage,
|
||||||
|
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, String showTime,
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
Function() action) {
|
String ifInvalidation, String showTime, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
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),
|
Container(
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
padding: EdgeInsets.all(20.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(30.w),
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
child: Image.asset(lockTypeIcon, )
|
||||||
|
),
|
||||||
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.start,
|
// 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(
|
||||||
|
children: <Widget>[
|
||||||
|
Flexible(
|
||||||
|
child: Text(lockTypeTitle,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp,
|
||||||
|
color: AppColors.blackColor)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(ifInvalidation,
|
||||||
|
style: TextStyle(fontSize: 22.sp, color: Colors.red)),
|
||||||
|
SizedBox(width: 10.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Container(
|
Row(
|
||||||
child: Row(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
children: <Widget>[
|
||||||
children: [
|
Flexible(
|
||||||
Text(showTime,
|
child: Text(showTime,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.placeholderTextColor)),
|
color: AppColors.placeholderTextColor)),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.h),
|
SizedBox(width: 20.h),
|
||||||
],
|
],
|
||||||
@ -215,32 +272,54 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDeletAlertDialog(
|
@override
|
||||||
BuildContext context,
|
void didChangeDependencies() {
|
||||||
) {
|
super.didChangeDependencies();
|
||||||
showCupertinoDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return CupertinoAlertDialog(
|
|
||||||
title: const Text("提示"),
|
|
||||||
content: const Text('重置后遥控信息都会清除哦,确认要重置吗?'),
|
|
||||||
actions: [
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
|
||||||
onPressed: () {
|
|
||||||
// 遥控重置
|
|
||||||
|
|
||||||
},
|
/// 路由订阅
|
||||||
),
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
],
|
}
|
||||||
);
|
|
||||||
},
|
@override
|
||||||
);
|
void dispose() {
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,24 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
class RemoteControlListState{
|
class RemoteControlListState{
|
||||||
|
RemoteControlListState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockId.value = map['lockId'];
|
||||||
|
}
|
||||||
|
final RxInt lockId = 0.obs;
|
||||||
|
|
||||||
|
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
||||||
|
bool isDeletAll = false;
|
||||||
|
String deletKeyID = '0';
|
||||||
|
int deletRemoteControlNo = 0;
|
||||||
|
|
||||||
|
final RxList<FingerprintItemData> fingerprintItemListData = <FingerprintItemData>[].obs;
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
RxBool ifCurrentScreen = true.obs;// 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
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/app_settings/app_settings.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';
|
||||||
@ -31,6 +32,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
LockListInfoGroupEntity? entity;
|
LockListInfoGroupEntity? entity;
|
||||||
|
|
||||||
List<GroupList> get groupDataList {
|
List<GroupList> get groupDataList {
|
||||||
|
|
||||||
final List<GroupList> list =
|
final List<GroupList> list =
|
||||||
_groupDataList.map((GroupList e) => e.copy()).toList();
|
_groupDataList.map((GroupList e) => e.copy()).toList();
|
||||||
if (state.searchStr.value != '' && state.showSearch.value) {
|
if (state.searchStr.value != '' && state.showSearch.value) {
|
||||||
@ -39,6 +41,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
!(element.lockAlias?.contains(state.searchStr.value) ?? true));
|
!(element.lockAlias?.contains(state.searchStr.value) ?? true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
AppLog.log('lockList!.length:${_groupDataList[0].lockList!.length}');
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +52,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
_groupDataList = <GroupList>[];
|
_groupDataList = <GroupList>[];
|
||||||
}
|
}
|
||||||
_groupDataList.addAll(entity.groupList!);
|
_groupDataList.addAll(entity.groupList!);
|
||||||
|
AppLog.log('_groupDataList[0].lockList!.length:${_groupDataList[0].lockList!.length}');
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,6 +319,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
AppLog.log('onInit调用了 setLockListInfoGroupEntity');
|
||||||
setLockListInfoGroupEntity(entity!);
|
setLockListInfoGroupEntity(entity!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
|
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
@ -125,8 +126,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
|
AppLog.log('logic.groupDataList[0].lockList!.length:${logic.groupDataList[0].lockList!.length}');
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: logic.groupDataList.length,
|
itemCount: logic.groupDataList.length ?? 0,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final GroupList itemData = logic.groupDataList[index];
|
final GroupList itemData = logic.groupDataList[index];
|
||||||
return _buildLockExpandedList(context, index, itemData);
|
return _buildLockExpandedList(context, index, itemData);
|
||||||
@ -143,10 +145,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//设备多层级列表
|
//设备多层级列表
|
||||||
Widget _buildLockExpandedList(
|
Widget _buildLockExpandedList(BuildContext context, int index, GroupList itemData) {
|
||||||
BuildContext context, int index, GroupList itemData) {
|
final List<LockListInfoItemEntity> lockItemList = itemData.lockList ?? <LockListInfoItemEntity>[];
|
||||||
final List<LockListInfoItemEntity> lockItemList =
|
AppLog.log('lockItemList[0].lockAlias:${lockItemList[0].lockAlias}');
|
||||||
itemData.lockList ?? <LockListInfoItemEntity>[];
|
|
||||||
final List<Widget> list = forItems(lockItemList);
|
final List<Widget> list = forItems(lockItemList);
|
||||||
return LockListGroupView(
|
return LockListGroupView(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@ -36,6 +36,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
isUnShowLoading: isUnShowLoading,
|
isUnShowLoading: isUnShowLoading,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
AppLog.log('请求列表调用 loadMainDataLogic');
|
||||||
await loadMainDataLogic(entity.data!);
|
await loadMainDataLogic(entity.data!);
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
@ -58,15 +59,18 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
state.dataLength.value = 2;
|
state.dataLength.value = 2;
|
||||||
}
|
}
|
||||||
state.lockListInfoGroupEntity.value = entity;
|
state.lockListInfoGroupEntity.value = entity;
|
||||||
|
AppLog.log('entity:$entity state.lockListInfoGroupEntity.value.groupList!.length:${state.lockListInfoGroupEntity.value.groupList![0].lockList!.length}');
|
||||||
//检测控制器是否存在
|
//检测控制器是否存在
|
||||||
if (Get.isRegistered<LockListLogic>()) {
|
if (Get.isRegistered<LockListLogic>()) {
|
||||||
//设置控制器数据并刷新
|
//设置控制器数据并刷新
|
||||||
|
AppLog.log('检测控制器是否存 调用了 setLockListInfoGroupEntity');
|
||||||
Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
||||||
} else {
|
} else {
|
||||||
//延迟加载
|
//延迟加载
|
||||||
Future<dynamic>.delayed(200.milliseconds, () {
|
Future<dynamic>.delayed(200.milliseconds, () {
|
||||||
if (Get.isRegistered<LockListLogic>()) {
|
if (Get.isRegistered<LockListLogic>()) {
|
||||||
//设置控制器数据并刷新
|
//设置控制器数据并刷新
|
||||||
|
AppLog.log('检测控制器是否存 延迟调用了 setLockListInfoGroupEntity');
|
||||||
Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -157,6 +161,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//刷新锁设备
|
//刷新锁设备
|
||||||
Future<void> flushedStarLockInfo(int keyId, int lockId) async {
|
Future<void> flushedStarLockInfo(int keyId, int lockId) async {
|
||||||
|
AppLog.log('刷新锁设备: keyId:$keyId lockId:$lockId');
|
||||||
final LockListInfoEntity entity = await ApiRepository.to.getStarLockInfo(
|
final LockListInfoEntity entity = await ApiRepository.to.getStarLockInfo(
|
||||||
keyId: keyId,
|
keyId: keyId,
|
||||||
);
|
);
|
||||||
@ -201,6 +206,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
state.lockListInfoGroupEntity.value.groupList!.insert(0, list);
|
state.lockListInfoGroupEntity.value.groupList!.insert(0, list);
|
||||||
}
|
}
|
||||||
state.lockListInfoGroupEntity.refresh();
|
state.lockListInfoGroupEntity.refresh();
|
||||||
|
AppLog.log('刷新调用 loadMainDataLogic');
|
||||||
loadMainDataLogic(state.lockListInfoGroupEntity.value);
|
loadMainDataLogic(state.lockListInfoGroupEntity.value);
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
@ -214,6 +220,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
?.removeWhere((LockListInfoItemEntity lock) => lock.keyId == keyId);
|
?.removeWhere((LockListInfoItemEntity lock) => lock.keyId == keyId);
|
||||||
});
|
});
|
||||||
state.lockListInfoGroupEntity.refresh();
|
state.lockListInfoGroupEntity.refresh();
|
||||||
|
AppLog.log('删除调用 loadMainDataLogic');
|
||||||
loadMainDataLogic(state.lockListInfoGroupEntity.value);
|
loadMainDataLogic(state.lockListInfoGroupEntity.value);
|
||||||
if (Get.isRegistered<LockDetailLogic>()) {
|
if (Get.isRegistered<LockDetailLogic>()) {
|
||||||
final bool isKey =
|
final bool isKey =
|
||||||
|
|||||||
@ -31,7 +31,9 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
|
|||||||
|
|
||||||
void getHttpData() {
|
void getHttpData() {
|
||||||
logic.messageListDataRequest().then((MessageListEntity value) {
|
logic.messageListDataRequest().then((MessageListEntity value) {
|
||||||
setState(() {});
|
if (mounted) {
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -129,6 +129,15 @@ abstract class Api {
|
|||||||
final String checkCardNameURL =
|
final String checkCardNameURL =
|
||||||
'/identityCard/checkIdentityCardName'; // 校验卡名字是否存在
|
'/identityCard/checkIdentityCardName'; // 校验卡名字是否存在
|
||||||
|
|
||||||
|
final String getRemoteControlListURL = '/remote/list'; // 遥控列表
|
||||||
|
final String addRemoteControlURL = '/remote/add'; // 添加遥控
|
||||||
|
final String updateRemoteUserNoURL = '/remote/updateRemoteUserNo'; // 更新遥控用户序号
|
||||||
|
final String editRemoteControlURL = '/remote/update'; // 编辑遥控
|
||||||
|
final String deleteRemoteControlURL = '/remote/delete'; // 删除遥控
|
||||||
|
final String clearRemoteControlURL = '/remote/clear'; // 清空遥控
|
||||||
|
final String checkRemoteControlNameURL =
|
||||||
|
'/remote/checkRemoteName'; // 校验遥控名字是否存在
|
||||||
|
|
||||||
final String transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表
|
final String transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表
|
||||||
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
||||||
final String transferLockURL = '/room/transfer'; // 转移智能锁
|
final String transferLockURL = '/room/transfer'; // 转移智能锁
|
||||||
|
|||||||
@ -1462,9 +1462,119 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(checkCardNameURL.toUrl,
|
post(checkCardNameURL.toUrl,
|
||||||
jsonEncode({'lockId': lockId, 'cardName': cardName}));
|
jsonEncode({'lockId': lockId, 'cardName': cardName}));
|
||||||
|
|
||||||
|
// 获取遥控列表
|
||||||
|
Future<Response> getRemoteControlListData(
|
||||||
|
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||||
|
post(
|
||||||
|
getRemoteControlListURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'pageNo': pageNo,
|
||||||
|
'pageSize': pageSize,
|
||||||
|
'searchStr': searchStr,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 添加遥控
|
||||||
|
Future<Response> addRemoteControlData(
|
||||||
|
String lockId,
|
||||||
|
String remoteName,
|
||||||
|
String remoteNumber,
|
||||||
|
int remoteType,
|
||||||
|
int startDate,
|
||||||
|
int endDate,
|
||||||
|
int addType,
|
||||||
|
List weekDay,
|
||||||
|
int startTime,
|
||||||
|
int endTime,
|
||||||
|
int remoteRight,
|
||||||
|
// String mac,
|
||||||
|
// int electricQuantity,
|
||||||
|
// List firmwareInfo
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
addRemoteControlURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'remoteName': remoteName,
|
||||||
|
'remoteNumber': remoteNumber,
|
||||||
|
'remoteType': remoteType,
|
||||||
|
'startDate': startDate,
|
||||||
|
'endDate': endDate,
|
||||||
|
'addType': addType,
|
||||||
|
'weekDay': weekDay,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
|
'remoteRight': remoteRight,
|
||||||
|
// 'mac': '',
|
||||||
|
// 'electricQuantity': electricQuantity,
|
||||||
|
// 'firmwareInfo': firmwareInfo,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 更新遥控序号
|
||||||
|
Future<Response> updateRemoteUserNoLoadData(
|
||||||
|
int lockId, int remoteId, String remoteUserNo) =>
|
||||||
|
post(
|
||||||
|
updateRemoteUserNoURL.toUrl,
|
||||||
|
jsonEncode(
|
||||||
|
{'lockId': lockId, 'remoteId': remoteId, 'remoteUserNo': remoteUserNo}));
|
||||||
|
|
||||||
|
// 编辑遥控
|
||||||
|
Future<Response> editRemoteControlData(
|
||||||
|
int lockId,
|
||||||
|
int remoteId,
|
||||||
|
int startDate,
|
||||||
|
int endDate,
|
||||||
|
int startTime,
|
||||||
|
int endTime,
|
||||||
|
int remoteType,
|
||||||
|
List weekDay,
|
||||||
|
String remoteName,
|
||||||
|
int addType,
|
||||||
|
int isCoerced,
|
||||||
|
int remoteRight,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
editRemoteControlURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'remoteId': remoteId,
|
||||||
|
'startDate': startDate,
|
||||||
|
'endDate': endDate,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
|
'remoteType': remoteType,
|
||||||
|
'weekDay': weekDay,
|
||||||
|
'remoteName': remoteName,
|
||||||
|
'addType': addType,
|
||||||
|
'isCoerced': isCoerced,
|
||||||
|
'remoteRight': remoteRight
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 删除遥控
|
||||||
|
Future<Response> deletRemoteControlData(int remoteId) =>
|
||||||
|
post(
|
||||||
|
deleteRemoteControlURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'remoteId': remoteId,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 删除遥控
|
||||||
|
Future<Response> resetRemoteControlData(int lockId) =>
|
||||||
|
post(
|
||||||
|
clearRemoteControlURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 校验遥控名字是否重复
|
||||||
|
Future<Response> checkRemoteControlNameDuplicatedData(
|
||||||
|
String lockId, String remoteName) =>
|
||||||
|
post(checkRemoteControlNameURL.toUrl,
|
||||||
|
jsonEncode({'lockId': lockId, 'remoteName': remoteName}));
|
||||||
|
|
||||||
// 获取转移锁锁列表
|
// 获取转移锁锁列表
|
||||||
Future<Response> getTransferLockListData(String searchStr) =>
|
Future<Response> getTransferLockListData(String searchStr) =>
|
||||||
post(transferLockListURL.toUrl, jsonEncode({"searchStr": searchStr}));
|
post(transferLockListURL.toUrl, jsonEncode({'searchStr': searchStr}));
|
||||||
|
|
||||||
// 转移智能锁确认
|
// 转移智能锁确认
|
||||||
Future<Response> transferLockConfirmInfoData(
|
Future<Response> transferLockConfirmInfoData(
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/
|
|||||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
||||||
import 'package:star_lock/tools/aliyunRealNameAuth/realNameVertify_entity.dart';
|
import 'package:star_lock/tools/aliyunRealNameAuth/realNameVertify_entity.dart';
|
||||||
import 'package:star_lock/tools/aliyunRealNameAuth/serviceAuthResult_entity.dart';
|
import 'package:star_lock/tools/aliyunRealNameAuth/serviceAuthResult_entity.dart';
|
||||||
|
|
||||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||||
import '../login/login/entity/LoginEntity.dart';
|
import '../login/login/entity/LoginEntity.dart';
|
||||||
@ -59,15 +60,16 @@ import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/chec
|
|||||||
import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart';
|
import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart';
|
||||||
import '../main/lockDetail/fingerprint/addFingerprint/addFingerprint_entity.dart';
|
import '../main/lockDetail/fingerprint/addFingerprint/addFingerprint_entity.dart';
|
||||||
import '../main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
import '../main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
import '../main/lockDetail/lockDetail/lockNetToken_entity.dart';
|
||||||
import '../main/lockDetail/lockOperatingRecord/keyOperationRecord_entity.dart';
|
import '../main/lockDetail/lockOperatingRecord/keyOperationRecord_entity.dart';
|
||||||
|
import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
||||||
import '../main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_entity.dart';
|
import '../main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_entity.dart';
|
||||||
import '../main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifiEntity.dart';
|
import '../main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifiEntity.dart';
|
||||||
import '../main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
|
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/lockDetail/lockNetToken_entity.dart';
|
|
||||||
import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
|
||||||
import '../main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
import '../main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_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';
|
||||||
import '../mine/message/messageList/messageList_entity.dart';
|
import '../mine/message/messageList/messageList_entity.dart';
|
||||||
@ -1647,6 +1649,107 @@ class ApiRepository {
|
|||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取遥控列表
|
||||||
|
Future<FingerprintListDataEntity> getRemoteControlListData({
|
||||||
|
required String lockId,
|
||||||
|
required String pageNo,
|
||||||
|
required String pageSize,
|
||||||
|
required String searchStr,
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.getRemoteControlListData(
|
||||||
|
lockId, pageNo, pageSize, searchStr);
|
||||||
|
return FingerprintListDataEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加遥控
|
||||||
|
Future<AddRemoteControlEntity> addRemoteControlData({
|
||||||
|
required String lockId,
|
||||||
|
required String remoteName,
|
||||||
|
required String remoteNumber,
|
||||||
|
required int remoteType,
|
||||||
|
required int startDate,
|
||||||
|
required int endDate,
|
||||||
|
required int addType,
|
||||||
|
required List weekDay,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime,
|
||||||
|
required int remoteRight,
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.addRemoteControlData(
|
||||||
|
lockId,
|
||||||
|
remoteName,
|
||||||
|
remoteNumber,
|
||||||
|
remoteType,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
addType,
|
||||||
|
weekDay,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
remoteRight);
|
||||||
|
return AddRemoteControlEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新ICCard用户序号
|
||||||
|
Future<LoginEntity> updateRemoteUserNoLoadData(
|
||||||
|
{required int lockId,
|
||||||
|
required int remoteId,
|
||||||
|
required String remoteUserNo}) async {
|
||||||
|
final res = await apiProvider.updateRemoteUserNoLoadData(
|
||||||
|
lockId, remoteId, remoteUserNo);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑遥控
|
||||||
|
Future<LoginEntity> editRemoteControlData({
|
||||||
|
required int lockId,
|
||||||
|
required int remoteId,
|
||||||
|
required int startDate,
|
||||||
|
required int endDate,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime,
|
||||||
|
required int remoteType,
|
||||||
|
required List weekDay,
|
||||||
|
required String remoteName,
|
||||||
|
required int addType,
|
||||||
|
required int isCoerced,
|
||||||
|
required int remoteRight,
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.editRemoteControlData(
|
||||||
|
lockId,
|
||||||
|
remoteId,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
remoteType,
|
||||||
|
weekDay,
|
||||||
|
remoteName,
|
||||||
|
addType,
|
||||||
|
isCoerced,
|
||||||
|
remoteRight);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除遥控
|
||||||
|
Future<LoginEntity> deletRemoteControlData({required int remoteId}) async {
|
||||||
|
final res = await apiProvider.deletRemoteControlData(remoteId);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置遥控
|
||||||
|
Future<LoginEntity> resetRemoteControlData({required int lockId}) async {
|
||||||
|
final res = await apiProvider.resetRemoteControlData(lockId);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验遥控名字是否重复
|
||||||
|
Future<LoginEntity> checkRemoteControlNameDuplicatedData(
|
||||||
|
{required String lockId, required String remoteName}) async {
|
||||||
|
final res = await apiProvider.checkRemoteControlNameDuplicatedData(lockId, remoteName);
|
||||||
|
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