1、优化只有一把锁时,添加锁之后,开不锁问题。2、优化其他bug
This commit is contained in:
parent
0df12fcac3
commit
4f2520e0c8
@ -69,7 +69,7 @@ class BlueManage {
|
||||
BlueManage? get manager => shareManager();
|
||||
|
||||
void _initBlue(){
|
||||
print("蓝牙功能初始化监听");
|
||||
Get.log("蓝牙功能初始化监听");
|
||||
_initSendStreamSubscription();
|
||||
_initAdapterStateStateSubscription();
|
||||
// _initListenscanResults();
|
||||
@ -79,7 +79,7 @@ class BlueManage {
|
||||
void _initGetMtuSubscription() {
|
||||
_mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((value) {
|
||||
_mtuSize = value - 3;
|
||||
print('mtuSize:$_mtuSize');
|
||||
Get.log('mtuSize:$_mtuSize');
|
||||
});
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ class BlueManage {
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// FlutterBluePlus.stopScan();
|
||||
}, onError: (e) {
|
||||
print("Scan Error:$e", );
|
||||
Get.log("Scan Error:$e", );
|
||||
});
|
||||
|
||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
@ -257,7 +257,7 @@ class BlueManage {
|
||||
List<ScanResult> devicesList = scanDevices;
|
||||
if(isAddEquipment == false){
|
||||
startScan(10, (List<ScanResult> scanDevices){
|
||||
print("扫描到的设备:$scanDevices");
|
||||
Get.log("扫描到的设备:$scanDevices");
|
||||
devicesList = scanDevices;
|
||||
_connectDevice(devicesList, deviceName, connectStateCallBack, isAddEquipment: isAddEquipment);
|
||||
});
|
||||
@ -268,20 +268,20 @@ class BlueManage {
|
||||
|
||||
Future<void> _connectDevice( List<ScanResult> devicesList, String deviceName, ConnectStateCallBack connectStateCallBack, {bool isAddEquipment = false}) async {
|
||||
// 判断数组列表里面是否有这个设备
|
||||
print("devicesList:$devicesList");
|
||||
Get.log("devicesList:$devicesList");
|
||||
final knownDeviceIndex = devicesList.indexWhere((d) => d.advertisementData.advName == deviceName);
|
||||
if (knownDeviceIndex >= 0) {
|
||||
// 存在的时候赋值
|
||||
connectDeviceMacAddress = devicesList[knownDeviceIndex].advertisementData.advName;
|
||||
|
||||
bluetoothConnectDevice = devicesList[knownDeviceIndex].device;
|
||||
print('bluetoothConnectDevice: $bluetoothConnectDevice');
|
||||
Get.log('bluetoothConnectDevice: $bluetoothConnectDevice');
|
||||
scanResult = devicesList[knownDeviceIndex];
|
||||
|
||||
_initGetMtuSubscription();
|
||||
_initListenConnectionState();
|
||||
}
|
||||
print("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
Get.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
// stopScan();
|
||||
if (connectDeviceMacAddress.isEmpty) {
|
||||
// connectStateCallBack(BluetoothConnectionState.disconnected!);
|
||||
@ -319,26 +319,26 @@ class BlueManage {
|
||||
}
|
||||
|
||||
// await bluetoothConnectDevice!.connect();
|
||||
print("5555555:回调状态:$bluetoothConnectionState");
|
||||
Get.log("5555555:回调状态:$bluetoothConnectionState");
|
||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||
try {
|
||||
bluetoothConnectDevice!.discoverServices().then((services) {
|
||||
print("333333333");
|
||||
Get.log("333333333");
|
||||
for (BluetoothService service in services) {
|
||||
// print("11111service.remoteId:${service.remoteId}"
|
||||
// Get.log("11111service.remoteId:${service.remoteId}"
|
||||
// " service.uuid:${service.uuid}"
|
||||
// " service.characteristics:${service.characteristics}"
|
||||
// " service.includedServices:${service.includedServices}");
|
||||
if(service.uuid == _serviceIdConnect){
|
||||
for (BluetoothCharacteristic characteristic in service.characteristics) {
|
||||
// print("22222characteristic.remoteId:${characteristic.remoteId}"
|
||||
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
|
||||
// " characteristic.uuid:${characteristic.uuid}"
|
||||
// " characteristic.secondaryServiceUuid:${characteristic.secondaryServiceUuid}"
|
||||
// " characteristic.characteristicUuid:${characteristic.characteristicUuid}");
|
||||
if (characteristic.characteristicUuid == _characteristicIdSubscription) {
|
||||
print("44444444");
|
||||
Get.log("44444444");
|
||||
_subScribeToCharacteristic(characteristic);
|
||||
print('Discovering services finished');
|
||||
Get.log('Discovering services finished');
|
||||
bluetoothConnectionState = BluetoothConnectionState.connected;
|
||||
connectStateCallBack(bluetoothConnectionState!);
|
||||
}
|
||||
@ -350,7 +350,7 @@ class BlueManage {
|
||||
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
||||
Get.log("5555 回调状态:$bluetoothConnectionState");
|
||||
connectStateCallBack(bluetoothConnectionState!);
|
||||
print('Error occurred when discovering services: $e');
|
||||
Get.log('Error occurred when discovering services: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
@ -363,27 +363,27 @@ class BlueManage {
|
||||
int? dataLen;
|
||||
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
|
||||
final subscription = characteristic.onValueReceived.listen((data) {
|
||||
print("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
|
||||
print("订阅获取的数据:$data");
|
||||
Get.log("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
|
||||
Get.log("订阅获取的数据:$data");
|
||||
if(data == lastTimeData || data.isEmpty){
|
||||
return;
|
||||
}else{
|
||||
lastTimeData = data;
|
||||
}
|
||||
// code to handle incoming data
|
||||
// print("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
// Get.log("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
if ((data[0] == 0xEF) && (data[1] == 0x01) && (data[2] == 0xEE) && (data[3] == 0x02)) {
|
||||
// 当包有头时
|
||||
// 判断是否需要分包
|
||||
dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||
// print("dataLen1111:$dataLen getDataLength:${data.length}");
|
||||
// Get.log("dataLen1111:$dataLen getDataLength:${data.length}");
|
||||
if (dataLen! + 12 > data.length) {
|
||||
// 当前包的长度小于实际的包时 分包添加 不解析
|
||||
allData.addAll(data);
|
||||
} else {
|
||||
// 当前包的长度小于实际的包时 不分包 解析
|
||||
allData.addAll(data);
|
||||
// print("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
// Get.log("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
CommandReciverManager.appDataReceive(allData);
|
||||
// 发送完解析初始化数组
|
||||
allData = <int>[];
|
||||
@ -475,20 +475,20 @@ class BlueManage {
|
||||
try {
|
||||
List<int> valueList = value;
|
||||
List subData = splitList(valueList, _mtuSize!);
|
||||
print(
|
||||
Get.log(
|
||||
'writeCharacteristicWithResponse 得到的分割数据:$subData');
|
||||
|
||||
for (int i = 0; i < subData.length; i++) {
|
||||
await characteristic.write(subData[i]).then((value) async {
|
||||
await Future.delayed(const Duration(milliseconds: 1)).then((
|
||||
value) async {
|
||||
print('分包发送成功了');
|
||||
Get.log('分包发送成功了');
|
||||
});
|
||||
});
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
print('Error occurred when writing: $e');
|
||||
print(s);
|
||||
Get.log('Error occurred when writing: $e');
|
||||
// Get.log(s);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
@ -563,7 +563,7 @@ class BlueManage {
|
||||
await bluetoothConnectDevice!.disconnect();
|
||||
Get.log("断开连接成功");
|
||||
} on Exception catch (e, _) {
|
||||
print("Error disconnecting from a device: $e");
|
||||
Get.log("Error disconnecting from a device: $e");
|
||||
} finally {
|
||||
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// PwdNo
|
||||
subData.add(1);
|
||||
subData.add(pwdNo!);
|
||||
|
||||
// pwd 20
|
||||
int pwdLength = utf8.encode(pwd!).length;
|
||||
@ -79,7 +79,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
subData = getFixedLengthList(subData, 20 - pwdLength);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(0xff);
|
||||
subData.add(useCountLimit!);
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_changeAdministratorPassword.dart';
|
||||
@ -56,7 +57,7 @@ class CommandReciverManager {
|
||||
return;
|
||||
}
|
||||
|
||||
print("appDataReceiveData:$data"); // &&(data[4] == 0x11)
|
||||
Get.log("appDataReceiveData:$data"); // &&(data[4] == 0x11)
|
||||
if ((data[0] == 0xEF) &&
|
||||
(data[1] == 0x01) &&
|
||||
(data[2] == 0xEE) &&
|
||||
@ -110,11 +111,11 @@ class CommandReciverManager {
|
||||
break;
|
||||
}
|
||||
parseData(oriDataList).then((value) async {
|
||||
print("parseData222 data:$value");
|
||||
Get.log("parseData222 data:$value");
|
||||
EasyLoading.dismiss();
|
||||
await EventBusManager().eventBusFir(value);
|
||||
}).catchError((error) {
|
||||
print("Error occurred while parsing data: $error");
|
||||
Get.log("Error occurred while parsing data: $error");
|
||||
});
|
||||
}
|
||||
// print('✅ 执行结束 _buffer:${_buffer.length}');
|
||||
@ -126,7 +127,7 @@ class CommandReciverManager {
|
||||
CommandType commandType = ExtensionCommandType.getCommandType(cmd);
|
||||
await IoManager().increaseCommandIndex();
|
||||
// data.removeRange(0, 2);
|
||||
print("parseData cmd:$cmd commandType:$commandType data:$data");
|
||||
Get.log("parseData cmd:$cmd commandType:$commandType data:$data");
|
||||
var reply;
|
||||
switch (commandType) {
|
||||
case CommandType.getLockPublicKey:
|
||||
@ -151,7 +152,7 @@ class CommandReciverManager {
|
||||
break;
|
||||
case CommandType.openLock:
|
||||
{
|
||||
print("openLockReply data:$data");
|
||||
Get.log("openLockReply data:$data");
|
||||
reply = OpenDoorReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -135,7 +135,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.about!.tr,
|
||||
barTitle: "安全验证",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Container(
|
||||
|
||||
@ -47,7 +47,7 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
void sendValidationCode() async {
|
||||
var entity = await ApiRepository.to.sendValidationCode(
|
||||
// state.countryCode.value,
|
||||
countryCode:"+86",
|
||||
countryCode:state.countryCode.value,
|
||||
account:state.phoneStr.value,
|
||||
channel:state.codeType.value,
|
||||
codeType:'2',
|
||||
|
||||
@ -33,7 +33,7 @@ class _StarLockForgetPasswordPageState
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
"忘记密码",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
|
||||
@ -147,10 +147,14 @@ class CardDetailLogic extends BaseGetXController{
|
||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||
cardName: state.changeNameController.text,
|
||||
changeType: "1",
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
cardType: 0,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功");
|
||||
Get.back(result: "addScuess");
|
||||
showToast("修改成功", something: (){
|
||||
Get.back(result: "addScuess");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
showCupertinoAlertDialog(context);
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: (state.keyType.value == 4 || state.keyType.value == 2) ? true : false,
|
||||
visible: (state.keyType.value == 4 || state.keyType.value == 2 || state.keyType.value == 1) ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
allHeight: 70.h,
|
||||
@ -72,29 +72,24 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
// switch(state.type.value){
|
||||
// case 0:
|
||||
// // 卡
|
||||
//
|
||||
// break;
|
||||
// case 1:
|
||||
// 当是指纹的时候
|
||||
if(state.keyType.value == 2){
|
||||
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||
// 限时
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
||||
"pushType": state.type.value,
|
||||
"pushType": 0,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
state.keyType.value = 2;
|
||||
});
|
||||
}
|
||||
}else if(state.keyType.value == 4){
|
||||
// 循环
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": state.type.value,
|
||||
"pushType": 0,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
@ -105,12 +100,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
});
|
||||
}
|
||||
}
|
||||
// break;
|
||||
// case 2:
|
||||
// // 遥控
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
}))),
|
||||
Obx(() => Visibility(
|
||||
visible: state.keyType.value == 4 ? true : false,
|
||||
@ -119,15 +108,8 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
rightTitle: state.weekDay.value.join(','),
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
// switch(state.type.value){
|
||||
// case 0:
|
||||
// // 卡
|
||||
//
|
||||
// break;
|
||||
// case 1:
|
||||
// 当是指纹的时候
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": state.type.value,
|
||||
"pushType": 0,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
@ -137,12 +119,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
state.weekDay.value = data["weekDay"];
|
||||
});
|
||||
}
|
||||
// break;
|
||||
// case 2:
|
||||
// // 遥控
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
})))
|
||||
),
|
||||
Container(height: 10.h),
|
||||
@ -172,28 +148,10 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
rightTitle: "",
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
switch (state.type.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
||||
'lockId': state.fingerprintItemData.value.lockId.toString(),
|
||||
'cardId': state.fingerprintItemData.value.cardId.toString()
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
||||
'lockId': state.fingerprintItemData.value.lockId.toString(),
|
||||
'fingerprintId': state.fingerprintItemData.value.fingerprintId.toString()
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
||||
'lockId': state.fingerprintItemData.value.lockId.toString(),
|
||||
'cardId': state.fingerprintItemData.value.cardId.toString()
|
||||
});
|
||||
}),
|
||||
// SizedBox(height: 40.h),
|
||||
// addControlsBtn(type),
|
||||
|
||||
@ -7,7 +7,6 @@ import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
|
||||
class CardDetailState{
|
||||
final fingerprintItemData = FingerprintItemData().obs;
|
||||
final type = 0.obs;// 0卡 1指纹 2遥控
|
||||
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
|
||||
|
||||
@ -98,8 +98,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
btnName:
|
||||
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
||||
onClick: () async {
|
||||
var data =
|
||||
await Get.toNamed(Routers.addCardTypeManagePage, arguments: {
|
||||
var data = await Get.toNamed(Routers.addCardTypeManagePage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
});
|
||||
@ -133,7 +132,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
showIosTipViewDialog(context);
|
||||
showIosTipViewDialog(fingerprintItemData);
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
@ -152,7 +151,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
"fingerprintItemData": fingerprintItemData,
|
||||
});
|
||||
if (data != null) {
|
||||
logic.getICCardListData();
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
}
|
||||
}),
|
||||
);
|
||||
@ -167,9 +167,9 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
|
||||
}
|
||||
|
||||
void showIosTipViewDialog(BuildContext context) {
|
||||
void showIosTipViewDialog(FingerprintItemData fingerprintItemData) {
|
||||
showDialog(
|
||||
context: context,
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
@ -179,6 +179,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
state.isDeletCardData = true;
|
||||
state.isDeletAll = false;
|
||||
state.deletUserID = (await Storage.getUid())!;
|
||||
state.deletKeyID = fingerprintItemData.cardId.toString();
|
||||
state.deletCardNo = int.parse(fingerprintItemData.cardNumber!);
|
||||
logic.senderAddICCard();
|
||||
},
|
||||
cancelClick: () {
|
||||
@ -235,16 +237,18 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(showTime,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(showTime,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
|
||||
@ -64,6 +64,9 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||
cardName: state.fingerprintItemData.value.cardName!,
|
||||
changeType: '1',
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
cardType: 0,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功");
|
||||
@ -71,6 +74,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value,
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value,
|
||||
});
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,7 @@ class _OtherTypeKeyChangeDatePageState
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
state.beginTime.value = "${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
state.beginTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
|
||||
});
|
||||
});
|
||||
@ -89,7 +89,7 @@ class _OtherTypeKeyChangeDatePageState
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
state.endTime.value = "${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
state.endTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
|
||||
});
|
||||
});
|
||||
|
||||
@ -15,12 +15,28 @@ class OtherTypeKeyChangeDateState{
|
||||
|
||||
OtherTypeKeyChangeDateState() {
|
||||
Map map = Get.arguments;
|
||||
if(map["pushType"] != null){
|
||||
fingerprintItemData.value = map["fingerprintItemData"];
|
||||
}
|
||||
pushType.value = map["pushType"];
|
||||
fingerprintItemData.value = map["fingerprintItemData"];
|
||||
if(map["fingerprintItemData"] != null){
|
||||
fingerprintItemData.value = map["fingerprintItemData"];
|
||||
}
|
||||
|
||||
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
||||
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
||||
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
|
||||
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
|
||||
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
||||
// getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间
|
||||
// // state.selectEffectiveDate.value = getStartDate;
|
||||
// state.itemData.value.startDate = DateTime.parse(getStartDate).millisecondsSinceEpoch;
|
||||
|
||||
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||
endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||
beginTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch;
|
||||
endTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch;
|
||||
}else{
|
||||
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
||||
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
||||
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
|
||||
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -43,6 +43,9 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||
cardName: state.fingerprintItemData.value.cardName!,
|
||||
changeType: '1',
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
cardType: 0,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功");
|
||||
|
||||
@ -31,7 +31,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
||||
barTitle: "修改有效期",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
@ -175,7 +175,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
|
||||
.millisecondsSinceEpoch;
|
||||
state.beginTime.value =
|
||||
"${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
"${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
});
|
||||
});
|
||||
})),
|
||||
@ -192,7 +192,7 @@ class _OtherTypeKeyChangeValidityDatePageState
|
||||
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
|
||||
.millisecondsSinceEpoch;
|
||||
state.endTime.value =
|
||||
"${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
"${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
||||
});
|
||||
});
|
||||
})),
|
||||
|
||||
@ -163,9 +163,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
||||
state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
||||
state.beginTime.value = DateTool()
|
||||
.dateToYMDHNString(state.beginTimeTimestamp.value.toString());
|
||||
.dateToYMDHNString((state.beginTimeTimestamp.value*1000).toString());
|
||||
state.endTime.value = DateTool()
|
||||
.dateToYMDHNString(state.endTimeTimestamp.value.toString());
|
||||
.dateToYMDHNString((state.endTimeTimestamp.value*1000).toString());
|
||||
// print("state.beginTime.value:${state.beginTime.value}"
|
||||
// "state.endTime.value:${state.endTime.value}"
|
||||
// "state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"
|
||||
// "state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -11,33 +11,26 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
final ElectronicKeyDetailChangeDateState state =
|
||||
ElectronicKeyDetailChangeDateState();
|
||||
|
||||
//更新密码请求
|
||||
Future<void> updatePwdRequest() async {
|
||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||
lockId: state.itemData.value.lockId!,
|
||||
keyboardPwdId: state.pwdId.value.toString(),
|
||||
keyboardPwdName: state.inputNameController.text,
|
||||
newKeyboardPwd: state.inputPwdController.text,
|
||||
startDate: state.effectiveDateTime.millisecondsSinceEpoch,
|
||||
endDate: state.failureDateTime.millisecondsSinceEpoch,
|
||||
changeType: state.changeType.value,
|
||||
hoursStart: state.hoursStart.value,
|
||||
hoursEnd: state.hoursEnd.value,
|
||||
isCoerced: state.isCoerced.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//编辑电子钥匙有效期请求
|
||||
Future<void> updateKeyDateRequest() async {
|
||||
var beginTimeTimestamp =
|
||||
state.effectiveDateTime.millisecondsSinceEpoch ~/ 1000;
|
||||
var endTimeTimestamp = state.failureDateTime.millisecondsSinceEpoch ~/ 1000;
|
||||
// var beginTimeTimestamp =
|
||||
// state.effectiveDateTime.millisecondsSinceEpoch ~/ 1000;
|
||||
// var endTimeTimestamp = state.failureDateTime.millisecondsSinceEpoch ~/ 1000;
|
||||
// if (beginTimeTimestamp > endTimeTimestamp ||
|
||||
// beginTimeTimestamp == endTimeTimestamp) {
|
||||
// showToast("失效时间需大于生效时间");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
|
||||
// showToast("生效时间需大于当前时间");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// print("state.itemData.value.startDate!:${state.itemData.value.startDate!}");
|
||||
// print("state.itemData.value.endDate!:${state.itemData.value.endDate!}");
|
||||
var beginTimeTimestamp = state.itemData.value.startDate! ~/ 1000;
|
||||
var endTimeTimestamp = state.itemData.value.endDate! ~/ 1000;
|
||||
if (beginTimeTimestamp > endTimeTimestamp ||
|
||||
beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
@ -48,11 +41,12 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
showToast("生效时间需大于当前时间");
|
||||
return;
|
||||
}
|
||||
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||
state.itemData.value.keyId.toString(),
|
||||
state.itemData.value.lockId.toString(),
|
||||
state.failureDateTime.millisecondsSinceEpoch.toString(),
|
||||
state.effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||
state.itemData.value.endDate!.toString(),
|
||||
state.itemData.value.startDate!.toString(),
|
||||
state.weekDays.value,
|
||||
state.itemData.value.keyType! == 1 ? 2 : state.itemData.value.keyType!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -40,14 +41,7 @@ class _ElectronicKeyDetailChangeDateState
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if (state.fromType.value == "1") {
|
||||
} else {
|
||||
if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) {
|
||||
logic.updatePwdRequest();
|
||||
} else {
|
||||
logic.updateKeyDateRequest();
|
||||
}
|
||||
}
|
||||
logic.updateKeyDateRequest();
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -57,51 +51,76 @@ class _ElectronicKeyDetailChangeDateState
|
||||
}
|
||||
|
||||
Widget buildMainUI() {
|
||||
// String getStartDate = "";
|
||||
// String getEndDate = "";
|
||||
// if (state.itemData.value.startDate != null) {
|
||||
// DateTime startDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
// getStartDate = startDateStr.toLocal().toString().substring(0, 16);
|
||||
// }
|
||||
//
|
||||
// if (state.itemData.value.endDate != null) {
|
||||
// DateTime endDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
// getEndDate = endDateStr.toLocal().toString().substring(0, 16);
|
||||
// }
|
||||
String getStartDate = "";
|
||||
String getEndDate = "";
|
||||
if (state.itemData.value.startDate != 0) {
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
getStartDate = startDateStr.toLocal().toString().substring(0, 16);
|
||||
}else{
|
||||
// DateTime startDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(DateTime.now().millisecondsSinceEpoch);
|
||||
// getStartDate = startDateStr.toLocal().toString().substring(0, 16);
|
||||
|
||||
getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间
|
||||
// state.selectEffectiveDate.value = getStartDate;
|
||||
state.itemData.value.startDate = DateTime.parse(getStartDate).millisecondsSinceEpoch;
|
||||
// print("state.selectEffectiveDate.value:${state.selectEffectiveDate.value}");
|
||||
}
|
||||
|
||||
if (state.itemData.value.endDate != 0) {
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
getEndDate = endDateStr.toLocal().toString().substring(0, 16);
|
||||
}else{
|
||||
// DateTime endDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(DateTime.now().millisecondsSinceEpoch);
|
||||
// getEndDate = endDateStr.toLocal().toString().substring(0, 16);
|
||||
|
||||
getEndDate = "${formatDate(DateTime.now(), [yyyy, '-', mm, '-', dd, ' ', HH,])}:00"; //失效时间
|
||||
state.itemData.value.endDate = DateTime.parse(getEndDate).millisecondsSinceEpoch;
|
||||
// print("state.selectFailureDate.value:${state.selectFailureDate.value}");
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.selectEffectiveDate.value,
|
||||
rightTitle: state.selectEffectiveDate.value.isNotEmpty
|
||||
? state.selectEffectiveDate.value
|
||||
: getStartDate,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.effectiveDateTime = XSDateUtils.parseDateTime(
|
||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||
'yyyy-MM-dd HH:mm');
|
||||
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
||||
state.effectiveDateTime, 'yyyy-MM-dd HH:mm');
|
||||
state.selectEffectiveDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
// state.effectiveDateTime = DateTime.parse(state.selectEffectiveDate.value);
|
||||
state.itemData.value.startDate = DateTime.parse(state.selectEffectiveDate.value).millisecondsSinceEpoch;
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.selectFailureDate.value,
|
||||
rightTitle: state.selectFailureDate.value.isNotEmpty
|
||||
? state.selectFailureDate.value
|
||||
: getEndDate,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.failureDateTime = XSDateUtils.parseDateTime(
|
||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||
'yyyy-MM-dd HH:mm');
|
||||
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
||||
state.failureDateTime, 'yyyy-MM-dd HH:mm');
|
||||
state.selectFailureDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
// state.failureDateTime = DateTime.parse(state.selectFailureDate.value);
|
||||
state.itemData.value.endDate = DateTime.parse(state.selectFailureDate.value).millisecondsSinceEpoch; //更新结束时间
|
||||
});
|
||||
})),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
String intToStr(int v) {
|
||||
return (v < 10) ? "0$v" : "$v";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,11 +15,11 @@ class ElectronicKeyDetailChangeDateState {
|
||||
final hoursEnd = 0.obs;
|
||||
final pwdId = ''.obs;
|
||||
final lockId = 0.obs;
|
||||
final fromType = ''.obs;
|
||||
// final fromType = ''.obs;
|
||||
final selectEffectiveDate = ''.obs; //生效时间
|
||||
final selectFailureDate = ''.obs; //失效时间
|
||||
DateTime effectiveDateTime = DateTime.now();
|
||||
DateTime failureDateTime = DateTime.now();
|
||||
// DateTime effectiveDateTime = DateTime.now();
|
||||
// DateTime failureDateTime = DateTime.now();
|
||||
final weekDays = [].obs;
|
||||
|
||||
ElectronicKeyDetailChangeDateState() {
|
||||
@ -38,8 +38,8 @@ class ElectronicKeyDetailChangeDateState {
|
||||
if ((map["lockId"] != null)) {
|
||||
lockId.value = map["lockId"];
|
||||
}
|
||||
if ((map["fromType"] != null)) {
|
||||
fromType.value = map["fromType"];
|
||||
}
|
||||
// if ((map["fromType"] != null)) {
|
||||
// fromType.value = map["fromType"];
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@ class SendElectronicKeyPage extends StatefulWidget {
|
||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
final logic = Get.put(SendElectronicKeyLogic());
|
||||
final state = Get.find<SendElectronicKeyLogic>().state;
|
||||
bool isDemoMode = true;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
@ -41,7 +40,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
}
|
||||
|
||||
Future<void> getDemoMode() async {
|
||||
isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!;
|
||||
state.isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -49,7 +48,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
state.type.value = widget.type;
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||
);
|
||||
}
|
||||
|
||||
@ -269,7 +268,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () {
|
||||
if (isDemoMode == false) {
|
||||
if (state.isDemoMode == false) {
|
||||
// DateTime startDateTime = DateTime(
|
||||
// state.effectiveDateTime.value.year,
|
||||
// state.effectiveDateTime.value.month,
|
||||
@ -313,7 +312,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
if (isDemoMode == false) {
|
||||
if (state.isDemoMode == false) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.massSendElectronicKeyManagePage);
|
||||
} else {
|
||||
@ -520,7 +519,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
// 远程开锁
|
||||
Widget remoteUnlockingWidget() {
|
||||
return Visibility(
|
||||
visible: isDemoMode
|
||||
visible: state.isDemoMode
|
||||
? false
|
||||
: (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false),
|
||||
child: Column(
|
||||
|
||||
@ -36,6 +36,7 @@ class SendElectronicKeyState {
|
||||
var weekdaysList = [].obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
|
||||
var isDemoMode = false;
|
||||
final sendSucceedType = 0.obs;
|
||||
|
||||
final timeLimitTips = '接收者在有效期内可以不限次数使用'; //限时
|
||||
|
||||
@ -93,6 +93,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
}else if(state.keyType.value == 4){
|
||||
// 循环
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
@ -114,6 +115,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
action: () async {
|
||||
// 当是指纹的时候
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
|
||||
@ -245,16 +245,18 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(showTime,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(showTime,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
|
||||
@ -29,12 +29,11 @@ class LockDetailLogic extends BaseGetXController {
|
||||
final LockDetailState state = LockDetailState();
|
||||
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
void initReplySubscription() {
|
||||
state.replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
|
||||
// 开门
|
||||
if (reply is OpenDoorReply) {
|
||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||
_replyOpenLock(reply);
|
||||
}
|
||||
|
||||
@ -63,12 +62,12 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// 开门数据解析
|
||||
Future<void> _replyOpenLock(Reply reply) async {
|
||||
int status = reply.data[6];
|
||||
print("replyOpenLock status:$status");
|
||||
Get.log("replyOpenLock status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
// _showFullScreenOverlay(Get.context!);
|
||||
|
||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||
@ -98,7 +97,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
@ -109,7 +108,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
var tokenData = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(tokenData);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
print("openDoorToken:$tokenData");
|
||||
Get.log("openDoorToken:$tokenData");
|
||||
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
@ -243,7 +242,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
if (reply.data[5] > 0) {
|
||||
reply.data.removeRange(0, 6);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
@ -277,22 +276,22 @@ class LockDetailLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
Get.log("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -330,7 +329,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("需要鉴权");
|
||||
Get.log("需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -355,17 +354,17 @@ class LockDetailLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("用户无权限");
|
||||
Get.log("用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("添加用户权限校验错误");
|
||||
Get.log("添加用户权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("领锁失败");
|
||||
Get.log("领锁失败");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -393,7 +392,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
if (token != null) {
|
||||
getTokenList = changeStringListToIntList(token);
|
||||
}
|
||||
print(
|
||||
Get.log(
|
||||
"BlueManage().connectDeviceName:${BlueManage().connectDeviceName} authUserID:${state.senderUserId.toString()} keyID:${state.keyInfos.value.keyId.toString()} userID:${await Storage.getUid()}");
|
||||
IoSenderManage.senderAddUser(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
@ -638,7 +637,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.lockNetToken = entity.data!.token!;
|
||||
print("state.lockNetToken:${state.lockNetToken}");
|
||||
Get.log("state.lockNetToken:${state.lockNetToken}");
|
||||
openDoorAction(1);
|
||||
}
|
||||
}
|
||||
@ -693,11 +692,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// }
|
||||
|
||||
/// 锁设置里面开启关闭考勤刷新锁详情
|
||||
StreamSubscription?
|
||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||
void _initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
||||
void initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
|
||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
|
||||
if (event.type == 0) {
|
||||
// 0考勤
|
||||
state.isAttendance.value = int.parse(event.setResult);
|
||||
@ -707,7 +704,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||
int.parse(event.setResult);
|
||||
print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
||||
Get.log("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
||||
} else if (event.type == 2) {
|
||||
// 2 常开模式
|
||||
state.isOpenPassageMode.value = int.parse(event.setResult);
|
||||
@ -720,6 +717,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// 4 更新了电量
|
||||
state.electricQuantity.value = int.parse(event.setResult);
|
||||
state.keyInfos.value.electricQuantity = int.parse(event.setResult);
|
||||
} else if (event.type == 5) {
|
||||
// 5 远程开锁
|
||||
state.keyInfos.value.lockSetting!.remoteUnlock = int.parse(event.setResult);
|
||||
}
|
||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||
});
|
||||
@ -862,9 +862,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
super.onReady();
|
||||
|
||||
openBlueSet();
|
||||
|
||||
_initReplySubscription();
|
||||
_initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
||||
Get.log("LockDetailPage onReady");
|
||||
// _initReplySubscription();
|
||||
// _initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
||||
// _scanListDiscoveredDeviceSubscriptionAction();
|
||||
}
|
||||
|
||||
@ -872,6 +872,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
Get.log("LockDetailPage onInit");
|
||||
|
||||
// 进来获取锁状态
|
||||
// connectBlue();
|
||||
@ -880,9 +881,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
Get.log("LockDetailPage onClose");
|
||||
|
||||
_replySubscription.cancel();
|
||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
||||
// _scanListDiscoveredDeviceSubscription.cancel();
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +53,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
||||
});
|
||||
|
||||
_initRefreshLockDetailInfoDataEventAction();
|
||||
logic.initReplySubscription();
|
||||
logic.initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -936,6 +938,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
state.closedUnlockSuccessfulTimer?.cancel();
|
||||
_lockRefreshLockDetailInfoDataEvent?.cancel();
|
||||
state.replySubscription.cancel();
|
||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
||||
|
||||
if (state.animationController != null) {
|
||||
state.animationController!.dispose();
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../blue/io_reply.dart';
|
||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
// enum RKConnectState {
|
||||
@ -17,6 +18,9 @@ import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||
class LockDetailState {
|
||||
Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
|
||||
|
||||
late StreamSubscription<Reply> replySubscription;
|
||||
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||
|
||||
String lockNetToken = "";
|
||||
var lockUserNo = 0;
|
||||
var senderUserId = 0;
|
||||
|
||||
@ -30,6 +30,8 @@ class RemoteUnlockingLogic extends BaseGetXController{
|
||||
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value;
|
||||
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}");
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(5, state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock!.toString()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
|
||||
class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
final PasswordKeyDetailState state = PasswordKeyDetailState();
|
||||
PasswordKeyDetailState state = PasswordKeyDetailState();
|
||||
|
||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||
Future<void> deletePwdRequest() async {
|
||||
@ -15,8 +15,9 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
state.itemData.value.keyboardPwdId.toString(),
|
||||
1);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功");
|
||||
Get.back();
|
||||
showToast("删除成功", something: (){
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,19 +33,21 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
changeType: state.changeType.value,
|
||||
hoursStart: state.itemData.value.hoursStart!,
|
||||
hoursEnd: state.itemData.value.hoursEnd!,
|
||||
isCoerced: state.itemData.value.isCoerced!.toString());
|
||||
isCoerced: state.itemData.value.isCoerced!.toString(),
|
||||
keyboardPwdType: state.itemData.value.keyboardPwdType!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功");
|
||||
if(changType == 1){
|
||||
// 修改名字
|
||||
state.keyboardPwdName.value = state.inputNameController.text;
|
||||
}else if(changType == 2){
|
||||
// 修改密码
|
||||
state.keyboardPwd.value = state.inputPwdController.text;
|
||||
}
|
||||
print("state.itemData.value.keyboardPwd:${state.itemData.value.keyboardPwd} state.itemData.value.keyboardPwdName:${state.itemData.value.keyboardPwdName}");
|
||||
Get.back();
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
showToast("修改成功", something: (){
|
||||
if(changType == 1){
|
||||
// 修改名字
|
||||
state.keyboardPwdName.value = state.inputNameController.text;
|
||||
}else if(changType == 2){
|
||||
// 修改密码
|
||||
state.keyboardPwd.value = state.inputPwdController.text;
|
||||
}
|
||||
print("state.itemData.value.keyboardPwd:${state.itemData.value.keyboardPwd} state.itemData.value.keyboardPwdName:${state.itemData.value.keyboardPwdName}");
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -74,23 +74,30 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
showCupertinoAlertDialog(
|
||||
context, state.inputNameController);
|
||||
})),
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "有效期",
|
||||
rightTitle: logic.getUseDateStr(),
|
||||
isHaveDirection: ((state.itemData.value.keyboardPwdType! > 3 &&
|
||||
state.itemData.value.keyboardPwdType! < 15) || state.itemData.value.keyboardPwdType! == 1) ? false : true,
|
||||
allHeight:
|
||||
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
|
||||
action: () {
|
||||
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
|
||||
action: () async {
|
||||
if ((state.itemData.value.keyboardPwdType! > 3 &&
|
||||
state.itemData.value.keyboardPwdType! < 15 ) || state.itemData.value.keyboardPwdType! == 1) {
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.passwordKeyDetailChangeDatePage,
|
||||
arguments: {
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
}),
|
||||
var backData = await Get.toNamed(Routers.passwordKeyDetailChangeDatePage, arguments: {
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
if (backData != null) {
|
||||
print("backData:$backData beginTimeTimestamp:${backData["beginTimeTimestamp"]} endTimeTimestamp:${backData["endTimeTimestamp"]}");
|
||||
state.itemData.value.startDate = int.parse(backData["beginTimeTimestamp"])*1000;
|
||||
state.itemData.value.endDate = int.parse(backData["endTimeTimestamp"])*1000;
|
||||
// 改了日期之后,永久只能改限时的
|
||||
state.itemData.value.keyboardPwdType = 3;
|
||||
setState(() {});
|
||||
}
|
||||
})),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||
@ -213,16 +220,21 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
title: inputController == state.inputNameController
|
||||
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
|
||||
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
tipTitle: inputController.text.isNotEmpty ? inputController.text : "请输入",
|
||||
tipTitle: inputController.text.isNotEmpty ? inputController.text : "请输入6-9位密码",
|
||||
controller: inputController,
|
||||
keyboardType: inputController == state.inputNameController
|
||||
? TextInputType.text
|
||||
: TextInputType.number,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (inputController.text.isNotEmpty) {
|
||||
logic.updatePwdRequest(inputController == state.inputNameController ? 1 : 2);
|
||||
if(inputController == state.inputPwdController){
|
||||
if (inputController.text.isEmpty || inputController.text.length < 6 || inputController.text.length > 9) {
|
||||
logic.showToast("请输入6-9位密码");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
logic.updatePwdRequest(inputController == state.inputNameController ? 1 : 2);
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
|
||||
@ -7,9 +7,25 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
|
||||
class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
final PasswordKeyDetailChangeDateState state = PasswordKeyDetailChangeDateState();
|
||||
PasswordKeyDetailChangeDateState state = PasswordKeyDetailChangeDateState();
|
||||
|
||||
//更新密码请求
|
||||
Future<void> updatePwdRequest() async {
|
||||
// print("state.itemData.value.startDate!:${state.itemData.value.startDate!}");
|
||||
// print("state.itemData.value.endDate!:${state.itemData.value.endDate!}");
|
||||
var beginTimeTimestamp = state.itemData.value.startDate! ~/ 1000;
|
||||
var endTimeTimestamp = state.itemData.value.endDate! ~/ 1000;
|
||||
if (beginTimeTimestamp > endTimeTimestamp ||
|
||||
beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
return;
|
||||
}
|
||||
|
||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||
lockId: state.itemData.value.lockId!,
|
||||
keyboardPwdId: state.itemData.value.keyboardPwdId.toString(),
|
||||
@ -20,11 +36,15 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
changeType: '1',
|
||||
hoursStart: state.itemData.value.hoursStart!,
|
||||
hoursEnd: state.itemData.value.hoursEnd!,
|
||||
isCoerced: "1");
|
||||
isCoerced: "1",
|
||||
keyboardPwdType: 3);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: (){
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
Get.back();
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp": beginTimeTimestamp.toString(),
|
||||
"endTimeTimestamp": endTimeTimestamp.toString(),
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -53,16 +54,33 @@ class _PasswordKeyDetailChangeDatePage
|
||||
Widget buildMainUI() {
|
||||
String getStartDate = "";
|
||||
String getEndDate = "";
|
||||
if (state.itemData.value.startDate != null) {
|
||||
if (state.itemData.value.startDate != 0) {
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
getStartDate = startDateStr.toLocal().toString().substring(0, 16);
|
||||
}else{
|
||||
// DateTime startDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(DateTime.now().millisecondsSinceEpoch);
|
||||
// getStartDate = startDateStr.toLocal().toString().substring(0, 16);
|
||||
|
||||
getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间
|
||||
// state.selectEffectiveDate.value = getStartDate;
|
||||
state.itemData.value.startDate = DateTime.parse(getStartDate).millisecondsSinceEpoch;
|
||||
// print("state.selectEffectiveDate.value:${state.selectEffectiveDate.value}");
|
||||
}
|
||||
|
||||
if (state.itemData.value.endDate != null) {
|
||||
if (state.itemData.value.endDate != 0) {
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
getEndDate = endDateStr.toLocal().toString().substring(0, 16);
|
||||
}else{
|
||||
// DateTime endDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(DateTime.now().millisecondsSinceEpoch);
|
||||
// getEndDate = endDateStr.toLocal().toString().substring(0, 16);
|
||||
|
||||
getEndDate = "${formatDate(DateTime.now(), [yyyy, '-', mm, '-', dd, ' ', HH,])}:00"; //失效时间
|
||||
state.itemData.value.endDate = DateTime.parse(getEndDate).millisecondsSinceEpoch;
|
||||
// print("state.selectFailureDate.value:${state.selectFailureDate.value}");
|
||||
}
|
||||
|
||||
return Column(
|
||||
|
||||
@ -90,7 +90,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环';
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
|
||||
@ -221,18 +221,22 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期', style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(),
|
||||
SizedBox(width: 15.w)
|
||||
// SizedBox(width: 15.w)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
useDateStr,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
Flexible(
|
||||
child: Text(
|
||||
useDateStr,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -141,7 +141,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
keyID: "1",
|
||||
userID: await Storage.getUid(),
|
||||
pwdNo: 254,
|
||||
pwd: "123456",
|
||||
pwd: state.adminPasswordTF.text,
|
||||
useCountLimit: 0xff,
|
||||
startTime: 0x11223344,
|
||||
endTime: 0x11223344,
|
||||
|
||||
@ -440,7 +440,8 @@ class ApiProvider extends BaseProvider {
|
||||
String changeType,
|
||||
String isCoerced,
|
||||
int hoursStart,
|
||||
int hoursEnd) =>
|
||||
int hoursEnd,
|
||||
int keyboardPwdType) =>
|
||||
post(
|
||||
updatePasswordKeyURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -453,7 +454,8 @@ class ApiProvider extends BaseProvider {
|
||||
'changeType': changeType,
|
||||
'isCoerced': isCoerced,
|
||||
'hoursStart': hoursStart,
|
||||
'hoursEnd': hoursEnd
|
||||
'hoursEnd': hoursEnd,
|
||||
"keyboardPwdType": keyboardPwdType
|
||||
}));
|
||||
|
||||
Future<Response> clearOperationRecord(String lockId) =>
|
||||
@ -1172,7 +1174,10 @@ class ApiProvider extends BaseProvider {
|
||||
String endDate,
|
||||
String isCoerced,
|
||||
List weekDay,
|
||||
String changeType) =>
|
||||
String changeType,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int cardType,) =>
|
||||
post(
|
||||
editICCardURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1183,7 +1188,10 @@ class ApiProvider extends BaseProvider {
|
||||
'endDate': endDate,
|
||||
'isCoerced': isCoerced,
|
||||
'weekDay': weekDay,
|
||||
'changeType': changeType
|
||||
'changeType': changeType,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'cardType': cardType
|
||||
}));
|
||||
|
||||
// 删除卡
|
||||
|
||||
@ -57,7 +57,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
statusText: res.statusText,
|
||||
);
|
||||
} else {}
|
||||
// print('得到的数据======>${res.bodyString}');
|
||||
print('得到的数据======>${res.bodyString}');
|
||||
getDataResult(res.body);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -435,7 +435,8 @@ class ApiRepository {
|
||||
required String changeType,
|
||||
required String isCoerced,
|
||||
required int hoursStart,
|
||||
required int hoursEnd}) async {
|
||||
required int hoursEnd,
|
||||
required int keyboardPwdType}) async {
|
||||
final res = await apiProvider.updateKeyboardPwd(
|
||||
lockId,
|
||||
keyboardPwdId,
|
||||
@ -446,7 +447,8 @@ class ApiRepository {
|
||||
changeType,
|
||||
isCoerced,
|
||||
hoursStart,
|
||||
hoursEnd);
|
||||
hoursEnd,
|
||||
keyboardPwdType);
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1314,9 +1316,12 @@ class ApiRepository {
|
||||
required String endDate,
|
||||
required String isCoerced,
|
||||
required List weekDay,
|
||||
required String changeType}) async {
|
||||
required String changeType,
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int cardType,}) async {
|
||||
final res = await apiProvider.editICCardData(lockId, cardId, cardName,
|
||||
startDate, endDate, isCoerced, weekDay, changeType);
|
||||
startDate, endDate, isCoerced, weekDay, changeType, startTime, endTime, cardType);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class LockGroupEditGroupLockRefreshEvent {
|
||||
|
||||
/// 锁设置里面开启关闭刷新锁详情
|
||||
class LockSetChangeSetRefreshLockDetailWithType {
|
||||
int type; // 0 考勤 1开锁时是否需联网 2常开模式 3修改了锁名字 4修改了电量
|
||||
int type; // 0 考勤 1开锁时是否需联网 2常开模式 3修改了锁名字 4修改了电量 5远程开锁
|
||||
String setResult;
|
||||
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user