Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
2f54846739
@ -1,6 +1,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.star_lock">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.star_lock">
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
|
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />-->
|
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />-->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />-->
|
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />-->
|
||||||
<!--允许访问网络,必选权限-->
|
<!--允许访问网络,必选权限-->
|
||||||
|
|||||||
BIN
star_lock/images/icon_electronicKey_remteUnlocking.png
Normal file
BIN
star_lock/images/icon_electronicKey_remteUnlocking.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@ -1,6 +1,6 @@
|
|||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|
||||||
FLUTTER_TARGET=lib/main_sky.dart
|
FLUTTER_TARGET=lib/main_sky_full.dart
|
||||||
ASSET_PREFIX=sky
|
ASSET_PREFIX=sky
|
||||||
BUNDLE_NAME=锁通通
|
BUNDLE_NAME=锁通通
|
||||||
BUNDLE_DISPLAY_NAME=锁通通
|
BUNDLE_DISPLAY_NAME=锁通通
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|
||||||
FLUTTER_TARGET=lib/main_sky.dart
|
FLUTTER_TARGET=lib/main_sky_full.dart
|
||||||
ASSET_PREFIX=sky
|
ASSET_PREFIX=sky
|
||||||
BUNDLE_NAME=锁通通
|
BUNDLE_NAME=锁通通
|
||||||
BUNDLE_DISPLAY_NAME=锁通通
|
BUNDLE_DISPLAY_NAME=锁通通
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|
||||||
FLUTTER_TARGET=lib/main_sky.dart
|
FLUTTER_TARGET=lib/main_sky_full.dart
|
||||||
ASSET_PREFIX=sky
|
ASSET_PREFIX=sky
|
||||||
BUNDLE_NAME=锁通通
|
BUNDLE_NAME=锁通通
|
||||||
BUNDLE_DISPLAY_NAME=锁通通
|
BUNDLE_DISPLAY_NAME=锁通通
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
</Testables>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug-sky"
|
buildConfiguration = "Release-sky"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
|
|||||||
@ -30,7 +30,6 @@ import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/mi
|
|||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart';
|
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockChangeDate_page.dart';
|
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
|
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart';
|
import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart';
|
||||||
@ -60,6 +59,8 @@ import 'main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdayS
|
|||||||
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart';
|
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart';
|
||||||
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart';
|
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart';
|
||||||
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart';
|
import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart';
|
||||||
|
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart';
|
||||||
|
import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart';
|
||||||
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
||||||
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart';
|
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart';
|
||||||
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
||||||
@ -124,8 +125,6 @@ import 'main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizat
|
|||||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart';
|
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart';
|
||||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart';
|
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart';
|
||||||
import 'main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart';
|
import 'main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart';
|
||||||
import 'main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart';
|
|
||||||
import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart';
|
|
||||||
import 'main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_page.dart';
|
import 'main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_page.dart';
|
||||||
import 'main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart';
|
import 'main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart';
|
||||||
import 'main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart';
|
import 'main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart';
|
||||||
@ -922,9 +921,6 @@ abstract class AppRouters {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.lockAddressGaoDePage,
|
name: Routers.lockAddressGaoDePage,
|
||||||
page: () => const LockAddressGaoDePage()),
|
page: () => const LockAddressGaoDePage()),
|
||||||
GetPage(
|
|
||||||
name: Routers.expireLockChangeDatePage,
|
|
||||||
page: () => const ExpireLockChangeDatePage()),
|
|
||||||
GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()),
|
GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.minePersonInfoViewSafetyProblemPage,
|
name: Routers.minePersonInfoViewSafetyProblemPage,
|
||||||
|
|||||||
@ -37,7 +37,8 @@ class XSConstantMacro {
|
|||||||
static String getKeyStatusStr(int keyStatus) {
|
static String getKeyStatusStr(int keyStatus) {
|
||||||
switch (keyStatus) {
|
switch (keyStatus) {
|
||||||
case 110401:
|
case 110401:
|
||||||
return "正常使用";
|
// 正常使用
|
||||||
|
return "";
|
||||||
case 110402:
|
case 110402:
|
||||||
return "待接收";
|
return "待接收";
|
||||||
case 110403:
|
case 110403:
|
||||||
|
|||||||
@ -180,7 +180,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
onTap: state.phoneStrIsOK.value
|
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
||||||
? () async {
|
? () async {
|
||||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
|
|||||||
@ -41,8 +41,14 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
TranslationLoader.lanKeys!.register!.tr,
|
TranslationLoader.lanKeys!.register!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Navigator.pushNamed(context, Routers.starLockRegisterPage);
|
var data = await Get.toNamed(Routers.starLockRegisterPage);
|
||||||
|
if(data != null){
|
||||||
|
state.emailOrPhoneController.text = data['phoneOrEmailStr'];
|
||||||
|
logic.checkNext(state.emailOrPhoneController);
|
||||||
|
state.pwdController.text = data['pwd'];
|
||||||
|
logic.checkNext(state.pwdController);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -39,8 +39,11 @@ class StarLockRegisterLogic extends BaseGetXController {
|
|||||||
// await loginSuccess(loginEntity: entity);
|
// await loginSuccess(loginEntity: entity);
|
||||||
// Toast.show(msg: "注册成功");
|
// Toast.show(msg: "注册成功");
|
||||||
showToast("注册成功");
|
showToast("注册成功");
|
||||||
Get.back();
|
Get.back(result:{
|
||||||
} else {}
|
"phoneOrEmailStr":state.phoneOrEmailStr.value,
|
||||||
|
"pwd":state.pwd.value
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendValidationCode() async {
|
void sendValidationCode() async {
|
||||||
|
|||||||
@ -289,7 +289,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
onTap: state.phoneOrEmailStrIsOK.value
|
onTap: state.phoneOrEmailStrIsOK.value && state.canResend.value
|
||||||
? () async {
|
? () async {
|
||||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
@ -237,39 +237,32 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String getFailureDateTime = '0';
|
var startDate = "0";
|
||||||
// String getEffectiveDateTime = '0';
|
var endDate = "0";
|
||||||
|
var startTime = "0";
|
||||||
|
var endTime = "0";
|
||||||
String lockID = state.keyInfo.value.lockId.toString();
|
String lockID = state.keyInfo.value.lockId.toString();
|
||||||
Get.log("state.type.value:${state.type.value}");
|
Get.log("state.type.value:${state.type.value}");
|
||||||
String getKeyType = "1";
|
String getKeyType = "1";
|
||||||
if (state.type.value == '0') {
|
if (state.type.value == '0') {
|
||||||
getKeyType = "2";
|
getKeyType = "2";
|
||||||
// getFailureDateTime =
|
|
||||||
// state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
|
||||||
// getEffectiveDateTime =
|
|
||||||
// state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
|
||||||
|
|
||||||
DateTime startDateTime = DateTime(
|
startDate = DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
||||||
state.effectiveDateTime.value.year,
|
endDate = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
|
||||||
state.effectiveDateTime.value.month,
|
startTime = "0";
|
||||||
state.effectiveDateTime.value.day,
|
endTime = "0";
|
||||||
state.effectiveDateTime.value.hour,
|
|
||||||
state.effectiveDateTime.value.minute);
|
if (startDate.isEmpty) {
|
||||||
DateTime endDateTime = DateTime(
|
showToast("请选择开始时间");
|
||||||
state.failureDateTime.value.year,
|
return;
|
||||||
state.failureDateTime.value.month,
|
}
|
||||||
state.failureDateTime.value.day,
|
if (endDate.isEmpty) {
|
||||||
state.failureDateTime.value.hour,
|
showToast("请选择结束时间");
|
||||||
state.failureDateTime.value.minute);
|
|
||||||
if (!startDateTime.isBefore(endDateTime) ||
|
|
||||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
|
||||||
showToast("失效时间需大于生效时间");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startDateTime.isBefore(DateTime.now()) ||
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
startDateTime.isAtSameMomentAs(DateTime.now())) {
|
showToast("失效时间要大于生效时间");
|
||||||
showToast("生效时间需大于当前时间");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +271,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
createUser: state.isCreateUser.value ? "1" : "0",
|
createUser: state.isCreateUser.value ? "1" : "0",
|
||||||
countryCode: state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
usernameType: '1',
|
usernameType: '1',
|
||||||
endDate: state.failureDateTime.value.millisecondsSinceEpoch,
|
endDate: int.parse(endDate),
|
||||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||||
isCameraEnable: '2',
|
isCameraEnable: '2',
|
||||||
isRemoteUnlock: '2',
|
isRemoteUnlock: '2',
|
||||||
@ -289,12 +282,14 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
operatorUid: '',
|
operatorUid: '',
|
||||||
receiverUsername: state.emailOrPhoneController.text,
|
receiverUsername: state.emailOrPhoneController.text,
|
||||||
remarks: '',
|
remarks: '',
|
||||||
startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
|
startDate: int.parse(startDate),
|
||||||
weekDays: state.weekdaysList,
|
weekDays: state.weekdaysList,
|
||||||
startTime: state.startTime.value,
|
startTime: int.parse(startTime),
|
||||||
endTime: state.endTime.value);
|
endTime: int.parse(endTime),
|
||||||
|
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
|
state.isCreateUser.value = false;
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
// Toast.show(msg: "添加成功");
|
// Toast.show(msg: "添加成功");
|
||||||
state.addUserId.value = entity.data!.receiverUser!.id.toString();
|
state.addUserId.value = entity.data!.receiverUser!.id.toString();
|
||||||
@ -310,22 +305,11 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||||
Future<void> updateRoomCheckIn() async {
|
Future<void> updateRoomCheckIn() async {
|
||||||
// var entity = await ApiRepository.to
|
|
||||||
// .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
|
|
||||||
// if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
// print("标记为已入住成功啦啦啦啦啦");
|
|
||||||
// Toast.show(msg: "标记成功");
|
|
||||||
// setState(() {});
|
|
||||||
// } else {
|
|
||||||
// Toast.show(msg: '操作失败');
|
|
||||||
// }
|
|
||||||
|
|
||||||
var entity = await ApiRepository.to.setRoomStatusData(
|
var entity = await ApiRepository.to.setRoomStatusData(
|
||||||
lockId: state.keyInfo.value.lockId!,
|
lockId: state.keyInfo.value.lockId!,
|
||||||
roomStatus: 1,
|
roomStatus: 1,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("标记为已入住成功啦啦啦啦啦");
|
|
||||||
showToast("标记成功");
|
showToast("标记成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,11 +4,12 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.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/network/api_repository.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/dateUtils.dart';
|
import 'package:star_lock/tools/dateUtils.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.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/date_mode.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
@ -81,7 +82,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
Widget keyInfoWidget() {
|
Widget keyInfoWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(height: 10.h),
|
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
@ -129,34 +129,25 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.selectEffectiveDate.value,
|
rightTitle: state.beginDate.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
onConfirm: (p) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
|
state.beginDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
|
||||||
'yyyy-MM-dd HH:mm');
|
|
||||||
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.effectiveDateTime.value, 'yyyy-MM-dd HH:mm');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.selectFailureDate.value,
|
rightTitle: state.endDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.failureDateTime.value = XSDateUtils.parseDateTime(
|
state.endDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
|
||||||
'yyyy-MM-dd HH:mm');
|
|
||||||
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.failureDateTime.value, 'yyyy-MM-dd HH:mm');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -169,9 +160,23 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
Widget keyRealNameWidget() {
|
Widget keyRealNameWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: "仅管理自己创建的用户",
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
isTipsImg: true,
|
||||||
|
tipsImgAction: () {
|
||||||
|
ShowTipView().showSureAlertDialog("授权管理员只能查看和管理自己下发的钥匙、密码等权限");
|
||||||
|
},
|
||||||
|
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _onlyManageYouCreatesUserSwitch())),
|
||||||
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
|
isTipsImg: true,
|
||||||
|
tipsImgAction: () {
|
||||||
|
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||||
|
},
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
@ -315,12 +320,12 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
OutLineBtn(
|
// OutLineBtn(
|
||||||
btnName: '标记为:已入住',
|
// btnName: '标记为:已入住',
|
||||||
onClick: () {
|
// onClick: () {
|
||||||
logic.updateRoomCheckIn();
|
// logic.updateRoomCheckIn();
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -430,6 +435,21 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//仅管理自己创建的用户
|
||||||
|
CupertinoSwitch _onlyManageYouCreatesUserSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.onlyManageYouCreatesUser.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future _openModalBottomSheet() async {
|
Future _openModalBottomSheet() async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
@ -17,19 +18,10 @@ class AuthorizedAdminState {
|
|||||||
final keyInfo = LockListInfoItemEntity().obs;
|
final keyInfo = LockListInfoItemEntity().obs;
|
||||||
// final lockMainEntity = LockMainEntity().obs;
|
// final lockMainEntity = LockMainEntity().obs;
|
||||||
final isAuthentication = false.obs; //是否可以实名认证
|
final isAuthentication = false.obs; //是否可以实名认证
|
||||||
DateTime dateTime = DateTime.now();
|
final onlyManageYouCreatesUser = false.obs; // 只能管理自己创建的用户
|
||||||
final effectiveDateTime = DateTime.now().obs;
|
|
||||||
final failureDateTime = DateTime.now().obs;
|
|
||||||
|
|
||||||
var selectEffectiveDate =
|
var beginDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs; //默认为当前时间 开始时间
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
var endDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//默认为当前时间 结束时间
|
||||||
.obs; //默认为当前时间
|
|
||||||
var selectFailureDate =
|
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
|
||||||
.obs; //默认为当前时间
|
|
||||||
|
|
||||||
var startTime = 0.obs;
|
|
||||||
var endTime = 0.obs;
|
|
||||||
|
|
||||||
var isSendSuccess = false.obs;
|
var isSendSuccess = false.obs;
|
||||||
var countryName = '中国'.obs;
|
var countryName = '中国'.obs;
|
||||||
|
|||||||
@ -243,7 +243,10 @@ class _AuthorizedAdminDetailPageState extends State<AuthorizedAdminDetailPage> {
|
|||||||
//删除电子钥匙名称请求
|
//删除电子钥匙名称请求
|
||||||
Future<void> deleteKeyRequest(String keyId) async {
|
Future<void> deleteKeyRequest(String keyId) async {
|
||||||
ElectronicKeyListEntity entity =
|
ElectronicKeyListEntity entity =
|
||||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
await ApiRepository.to.deleteElectronicKey(
|
||||||
|
keyId:keyId,
|
||||||
|
includeUnderlings: 0
|
||||||
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
EasyLoading.showToast("删除成功",duration: 2000.milliseconds);
|
EasyLoading.showToast("删除成功",duration: 2000.milliseconds);
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@ -37,11 +37,15 @@ class AuthorizedAdminListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除电子钥匙名称请求
|
//删除电子钥匙名称请求
|
||||||
Future<void> deleteKeyRequest(String keyId) async {
|
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity =
|
ElectronicKeyListEntity entity =
|
||||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
await ApiRepository.to.deleteElectronicKey(
|
||||||
|
keyId:keyId,
|
||||||
|
includeUnderlings: includeUnderlings
|
||||||
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功");
|
showToast("删除成功");
|
||||||
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import '../../../../appRouters.dart';
|
|||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/EasyRefreshTool.dart';
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/showIosTipView.dart';
|
||||||
|
import '../../../../tools/showTipView.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';
|
||||||
@ -107,7 +108,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
useDateStr = getUseDateStr(indexEntity);
|
useDateStr = getUseDateStr(indexEntity);
|
||||||
|
|
||||||
//钥匙状态
|
//钥匙状态
|
||||||
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||||
|
|
||||||
//是否为管理钥匙
|
//是否为管理钥匙
|
||||||
bool isAdminKey = false;
|
bool isAdminKey = false;
|
||||||
@ -125,7 +126,9 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context){
|
||||||
showIosTipViewDialog(context, indexEntity.keyId!.toString());
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
||||||
|
logic.deleteKeyRequest(indexEntity.keyId.toString(), isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -135,8 +138,10 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
|
Navigator.pushNamed(context, Routers.electronicKeyDetailPage, arguments: {
|
||||||
arguments: {"itemData": indexEntity}).then((val) {
|
"itemData": indexEntity,
|
||||||
|
"keyInfo": state.keyInfo.value
|
||||||
|
}).then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
logic.mockNetworkDataRequest();
|
logic.mockNetworkDataRequest();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -184,24 +189,24 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void showIosTipViewDialog(
|
// void showIosTipViewDialog(
|
||||||
BuildContext context, String keyId) {
|
// BuildContext context, String keyId) {
|
||||||
showDialog(
|
// showDialog(
|
||||||
context: context,
|
// context: context,
|
||||||
builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
return ShowIosTipView(
|
// return ShowIosTipView(
|
||||||
title: "提示",
|
// title: "提示",
|
||||||
tipTitle: "确定要删除吗?",
|
// tipTitle: "确定要删除吗?",
|
||||||
sureClick: () {
|
// sureClick: () {
|
||||||
Get.back();
|
// Get.back();
|
||||||
logic.deleteKeyRequest(keyId);
|
// logic.deleteKeyRequest(keyId);
|
||||||
},
|
// },
|
||||||
cancelClick: () {
|
// cancelClick: () {
|
||||||
Get.back();
|
// Get.back();
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||||
@ -235,28 +240,28 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//钥匙状态
|
//钥匙状态
|
||||||
String getKeyStatus(int? keyStatusFlag) {
|
// String getKeyStatus(int? keyStatusFlag) {
|
||||||
String keyStatus = '';
|
// String keyStatus = '';
|
||||||
|
//
|
||||||
if (keyStatusFlag == 110401) {
|
// if (keyStatusFlag == 110401) {
|
||||||
//正常使用
|
// //正常使用
|
||||||
keyStatus = '';
|
// keyStatus = '';
|
||||||
} else if (keyStatusFlag == 110402) {
|
// } else if (keyStatusFlag == 110402) {
|
||||||
//待接收
|
// //待接收
|
||||||
keyStatus = '待接收';
|
// keyStatus = '待接收';
|
||||||
} else if (keyStatusFlag == 110405) {
|
// } else if (keyStatusFlag == 110405) {
|
||||||
//已冻结
|
// //已冻结
|
||||||
keyStatus = '已冻结';
|
// keyStatus = '已冻结';
|
||||||
} else if (keyStatusFlag == 110408) {
|
// } else if (keyStatusFlag == 110408) {
|
||||||
//已删除
|
// //已删除
|
||||||
keyStatus = '已删除';
|
// keyStatus = '已删除';
|
||||||
} else if (keyStatusFlag == 110410) {
|
// } else if (keyStatusFlag == 110410) {
|
||||||
//已重置
|
// //已重置
|
||||||
keyStatus = '已重置';
|
// keyStatus = '已重置';
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return keyStatus;
|
// return keyStatus;
|
||||||
}
|
// }
|
||||||
|
|
||||||
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
||||||
String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
||||||
|
|||||||
@ -46,12 +46,25 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
}
|
}
|
||||||
state.fromType.value = widget.fromType;
|
state.fromType.value = widget.fromType;
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
// Your code here
|
|
||||||
});
|
|
||||||
return indexChangeWidget();
|
return indexChangeWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if(state.selectType.value == "1"){
|
||||||
|
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
|
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());//默认为当前时间
|
||||||
|
}else{
|
||||||
|
state.beginTime.value = ""; //默认为当前时间
|
||||||
|
state.endTime.value = "";//默认为当前时间
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
switch (int.parse(widget.selectType)) {
|
switch (int.parse(widget.selectType)) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -156,7 +169,14 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.beginTime.value = result['starDate'];
|
||||||
@ -174,7 +194,14 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.beginTime.value = result['starDate'];
|
||||||
@ -191,7 +218,14 @@ class _AddCardPageState extends State<AddCardPage> {
|
|||||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.beginTime.value = result['starDate'];
|
||||||
|
|||||||
@ -10,6 +10,8 @@ class AddCardTypeState{
|
|||||||
final isStressFingerprint = false.obs;
|
final isStressFingerprint = false.obs;
|
||||||
final isAdministrator = false.obs;// 是否是管理员
|
final isAdministrator = false.obs;// 是否是管理员
|
||||||
|
|
||||||
|
// var beginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 开始时间
|
||||||
|
// var endTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 结束时间
|
||||||
var beginTime = "".obs;// 开始时间
|
var beginTime = "".obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
var endTime = "".obs;// 结束时间
|
||||||
var effectiveDateTime = "".obs;// 生效时间
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
|
|||||||
@ -6,6 +6,7 @@ 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_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_protocol/io_addICCard.dart';
|
import '../../../../blue/io_protocol/io_addICCard.dart';
|
||||||
@ -154,7 +155,7 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: (){
|
||||||
Get.back(result: "addScuess");
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,7 +183,8 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
} else if(state.keyType.value == 4){
|
} else if(state.keyType.value == 4){
|
||||||
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}";
|
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
}return useDateStr;
|
}
|
||||||
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -316,6 +316,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
|
state.typeName.value = state.changeNameController.text;
|
||||||
logic.editICCardData();
|
logic.editICCardData();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import 'otherTypeKeyChangeDate_state.dart';
|
import 'otherTypeKeyChangeDate_state.dart';
|
||||||
|
|
||||||
@ -10,8 +11,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 修改指纹信息
|
// 修改指纹信息
|
||||||
void editFingerprintsData() async{
|
void editFingerprintsData() async{
|
||||||
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
|
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000;
|
||||||
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000;
|
||||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
@ -25,8 +26,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.fingerprintItemData.value.weekDay!,
|
weekDay: state.fingerprintItemData.value.weekDay!,
|
||||||
startDate: state.beginTimeTimestamp.value.toString(),
|
startDate: beginTimeTimestamp.toString(),
|
||||||
endDate: state.endTimeTimestamp.value.toString(),
|
endDate: endTimeTimestamp.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
@ -38,8 +39,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: (){
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
"beginTimeTimestamp":beginTimeTimestamp.toString(),
|
||||||
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
"endTimeTimestamp":endTimeTimestamp.toString(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -47,8 +48,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 编辑iC卡
|
// 编辑iC卡
|
||||||
void editICCardData() async{
|
void editICCardData() async{
|
||||||
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
|
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000;
|
||||||
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000;
|
||||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
@ -63,8 +64,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.fingerprintItemData.value.weekDay!,
|
weekDay: state.fingerprintItemData.value.weekDay!,
|
||||||
startDate: state.beginTimeTimestamp.value.toString(),
|
startDate: beginTimeTimestamp.toString(),
|
||||||
endDate: state.endTimeTimestamp.value.toString(),
|
endDate: endTimeTimestamp.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||||
cardName: state.fingerprintItemData.value.cardName!,
|
cardName: state.fingerprintItemData.value.cardName!,
|
||||||
changeType: '1',
|
changeType: '1',
|
||||||
@ -75,8 +76,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: (){
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
"beginTimeTimestamp":beginTimeTimestamp.toString(),
|
||||||
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
"endTimeTimestamp":endTimeTimestamp.toString(),
|
||||||
});
|
});
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
// import 'package:flutter_pickers/pickers.dart';
|
|
||||||
// import 'package:flutter_pickers/time_picker/model/date_mode.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/pickers.dart';
|
||||||
@ -78,7 +76,6 @@ class _OtherTypeKeyChangeDatePageState
|
|||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
@ -91,7 +88,6 @@ class _OtherTypeKeyChangeDatePageState
|
|||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 1);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
|
|||||||
@ -8,9 +8,6 @@ class OtherTypeKeyChangeDateState{
|
|||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
var beginTime = "".obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
var endTime = "".obs;// 结束时间
|
||||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
|
||||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
|
||||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
|
||||||
|
|
||||||
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
||||||
|
|
||||||
@ -20,15 +17,6 @@ class OtherTypeKeyChangeDateState{
|
|||||||
pushType.value = map["pushType"];
|
pushType.value = map["pushType"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(map["fingerprintItemData"] != null){
|
|
||||||
fingerprintItemData.value = map["fingerprintItemData"];
|
|
||||||
if(pushType.value == 0) {
|
|
||||||
keyType.value = fingerprintItemData.value.cardType!;
|
|
||||||
}else if(pushType.value == 1){
|
|
||||||
keyType.value = fingerprintItemData.value.fingerprintType!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
||||||
// getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间
|
// getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间
|
||||||
// // state.selectEffectiveDate.value = getStartDate;
|
// // state.selectEffectiveDate.value = getStartDate;
|
||||||
@ -36,13 +24,9 @@ class OtherTypeKeyChangeDateState{
|
|||||||
|
|
||||||
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||||
endTime.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{
|
}else{
|
||||||
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
||||||
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
||||||
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
|
|
||||||
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,12 +94,12 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
"checkingInSetInfo": state.checkingInSetInfo.value,
|
"checkingInSetInfo": state.checkingInSetInfo.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
print("data: $data");
|
||||||
// state.isCustom.value = data["attendanceType"];
|
state.isCustom.value = data["attendanceType"];
|
||||||
// state.weekDays.value = data["weekDays"];
|
state.weekDays.value = data["weekDays"];
|
||||||
// state.weekDaysStr.value = state.weekDays.value.join(",");
|
state.weekDaysStr.value = state.weekDays.value.join(",");
|
||||||
logic.getCheckInSetInfoData();
|
// logic.getCheckInSetInfoData();
|
||||||
});
|
setState(() {});
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
|
|||||||
@ -20,8 +20,9 @@ class CheckingInSetWorkTimeLogic extends BaseGetXController{
|
|||||||
workDay:state.checkingInSetInfo.value.workDay!,
|
workDay:state.checkingInSetInfo.value.workDay!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Get.back(result: "scuess");
|
showToast("修改成功", something: (){
|
||||||
// Toast.show(msg: "修改成功");
|
Get.back(result: "scuess");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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/dateTool.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.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/date_mode.dart';
|
||||||
|
|
||||||
@ -48,13 +49,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
DateTime today = DateTime.now();
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
state.beginTimeTimestamp.value = DateTime.parse(
|
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 0).toString();
|
||||||
'${today.year}-${today.month.toString().padLeft(2, '0')}-${today.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
|
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
state.beginTime.value =
|
|
||||||
"${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
@ -66,13 +62,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
DateTime today = DateTime.now();
|
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
state.endTimeTimestamp.value = DateTime.parse(
|
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 0).toString();
|
||||||
'${today.year}-${today.month.toString().padLeft(2, '0')}-${today.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
|
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
state.endTime.value =
|
|
||||||
"${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
@ -96,7 +87,7 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (int.parse(state.beginTimeTimestamp.value) > int.parse(state.endTimeTimestamp.value)) {
|
if (int.parse(state.beginTimeTimestamp.value) >= int.parse(state.endTimeTimestamp.value)) {
|
||||||
logic.showToast("结束时间必须要比开始时间晚,请重新选择");
|
logic.showToast("结束时间必须要比开始时间晚,请重新选择");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,12 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
|||||||
workDay:state.weekDays.value,
|
workDay:state.weekDays.value,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Get.back(result: "scuess");
|
showToast("修改成功", something: (){
|
||||||
// Toast.show(msg: "修改成功");
|
Get.back(result: {
|
||||||
|
"attendanceType":state.isCustom.value,
|
||||||
|
"weekDays":state.weekDays.value,
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -150,7 +150,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
action: (){
|
action: (){
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isSingledayWeekend.value = 1;
|
state.isSingledayWeekend.value = 1;
|
||||||
state.weekDays.value = [6, 7];
|
state.weekDays.value = [1, 2 , 3, 4, 5];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
|
|||||||
@ -12,7 +12,7 @@ class CheckingInSetWorkdaySetState{
|
|||||||
final checkingInSetInfo = CheckingInSetInfo().obs;
|
final checkingInSetInfo = CheckingInSetInfo().obs;
|
||||||
final companyId = "".obs;
|
final companyId = "".obs;
|
||||||
|
|
||||||
var pushType = "".obs;// 2考勤设置信息选择时间 1考勤创建公司
|
var pushType = "".obs;// 2考勤设置信息 1考勤创建公司
|
||||||
|
|
||||||
CheckingInSetWorkdaySetState() {
|
CheckingInSetWorkdaySetState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
|
|||||||
@ -30,6 +30,11 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
|||||||
usernameType = "2";
|
usernameType = "2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
|
||||||
|
if(state.appUnHaveAccount.value && state.selectPrintingMethodType.value == "1"){
|
||||||
|
state.attendanceWayNumber.value = state.staffAccountController.text;
|
||||||
|
}
|
||||||
|
|
||||||
var entity = await ApiRepository.to.addStaffData(
|
var entity = await ApiRepository.to.addStaffData(
|
||||||
attendanceType: state.selectPrintingMethodType.value,
|
attendanceType: state.selectPrintingMethodType.value,
|
||||||
attendanceWay: state.attendanceWayNumber.value,
|
attendanceWay: state.attendanceWayNumber.value,
|
||||||
|
|||||||
@ -136,69 +136,70 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => Text(state.attendanceWayNumber.value, style: TextStyle(fontSize: 24.sp))),
|
Obx(() => Text(state.attendanceWayNumber.value, style: TextStyle(fontSize: 24.sp))),
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
SizedBox(
|
GestureDetector(
|
||||||
width: 150.w,
|
onTap: () async {
|
||||||
height: 40.h,
|
switch (int.parse(state.selectPrintingMethodType.value)) {
|
||||||
child: ElevatedButton(
|
case 2:
|
||||||
style: ElevatedButton.styleFrom(
|
// 获取密码
|
||||||
backgroundColor: AppColors.mainColor,
|
logic.getKeyboardPwdRequest();
|
||||||
),
|
break;
|
||||||
child: Text(addStaffSelectKeyType(),
|
case 3:
|
||||||
style: TextStyle(
|
// 卡
|
||||||
color: Colors.white, fontSize: 22.sp)),
|
if (state.staffNameController.text.isEmpty) {
|
||||||
onPressed: () async {
|
logic.showToast("请输入姓名");
|
||||||
switch (int.parse(
|
return;
|
||||||
state.selectPrintingMethodType.value)) {
|
}
|
||||||
case 2:
|
|
||||||
// 获取密码
|
|
||||||
logic.getKeyboardPwdRequest();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// 卡
|
|
||||||
if (state.staffNameController.text.isEmpty) {
|
|
||||||
logic.showToast("请输入姓名");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.addCardTypeManagePage,
|
Routers.addCardTypeManagePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"lockId": state.getKeyInfosData.value.lockId,
|
|
||||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
"fromTypeTwoStaffName": state.staffNameController.text
|
|
||||||
});
|
|
||||||
if (data != null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
// 指纹
|
|
||||||
if (state.staffNameController.text.isEmpty) {
|
|
||||||
logic.showToast("请输入姓名");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var data = await Get.toNamed(
|
|
||||||
Routers.addFingerprintTypeManagePage,
|
|
||||||
arguments: {
|
|
||||||
"lockId": state.getKeyInfosData.value.lockId,
|
|
||||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
"fromTypeTwoStaffName": state.staffNameController.text
|
|
||||||
});
|
|
||||||
if (data != null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
|
||||||
"lockId": state.getKeyInfosData.value.lockId,
|
"lockId": state.getKeyInfosData.value.lockId,
|
||||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
"fromTypeTwoStaffName": state.staffNameController.text
|
"fromTypeTwoStaffName": state.staffNameController.text
|
||||||
});
|
});
|
||||||
|
if (data != null) {
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}),
|
break;
|
||||||
|
case 4:
|
||||||
|
// 指纹
|
||||||
|
if (state.staffNameController.text.isEmpty) {
|
||||||
|
logic.showToast("请输入姓名");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.addFingerprintTypeManagePage,
|
||||||
|
arguments: {
|
||||||
|
"lockId": state.getKeyInfosData.value.lockId,
|
||||||
|
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
"fromTypeTwoStaffName": state.staffNameController.text
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
||||||
|
"lockId": state.getKeyInfosData.value.lockId,
|
||||||
|
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
"fromTypeTwoStaffName": state.staffNameController.text
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: 40.h,
|
||||||
|
padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 2.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
borderRadius: BorderRadius.circular(20.h),
|
||||||
|
),
|
||||||
|
child: Text(addStaffSelectKeyType(), textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 22.sp)
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -43,7 +43,6 @@ class CheckingInAddStaffState{
|
|||||||
staffNameController.text = staffListItemData.value.staffName!;
|
staffNameController.text = staffListItemData.value.staffName!;
|
||||||
|
|
||||||
selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString();
|
selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString();
|
||||||
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
|
|
||||||
switch(staffListItemData.value.attendanceType){
|
switch(staffListItemData.value.attendanceType){
|
||||||
case 1:
|
case 1:
|
||||||
selectPrintingMethodStr.value = "APP";
|
selectPrintingMethodStr.value = "APP";
|
||||||
@ -60,8 +59,12 @@ class CheckingInAddStaffState{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(staffListItemData.value.attendanceWay!.isNotEmpty){
|
if(staffListItemData.value.attendanceWay!.isNotEmpty){
|
||||||
appUnHaveAccount.value = false;
|
if(staffListItemData.value.cardStatus != 0){
|
||||||
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
|
appUnHaveAccount.value = false;
|
||||||
|
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
|
||||||
|
}else{
|
||||||
|
appUnHaveAccount.value = true;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
appUnHaveAccount.value = true;
|
appUnHaveAccount.value = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,10 +55,21 @@ class _CheckingInStaffDetailPageState extends State<CheckingInStaffDetailPage> {
|
|||||||
leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr,
|
leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr,
|
||||||
rightTitle: state.attendanceType.value,
|
rightTitle: state.attendanceType.value,
|
||||||
isHaveLine: true)),
|
isHaveLine: true)),
|
||||||
Obx(() => CommonItem(
|
// Obx(() => CommonItem(
|
||||||
leftTitel: "APP",
|
// leftTitel: "APP",
|
||||||
rightTitle: state.staffListItemData.value.attendanceWay,
|
// rightTitle: state.staffListItemData.value.attendanceWay,
|
||||||
isHaveLine: true)),
|
// isHaveLine: true)),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.staffListItemData.value.cardStatus == 0,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 50.h,
|
||||||
|
padding: EdgeInsets.only(left: 20.w),
|
||||||
|
child: Text("钥匙已被删除,打卡方式无效", style: TextStyle(fontSize: 22.sp, color: AppColors.openPassageModeColor)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.attendanceRecord!.tr,
|
leftTitel: TranslationLoader.lanKeys!.attendanceRecord!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
@ -5,7 +7,10 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
|
|||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
|
import '../../../../../tools/jh_pop_menus.dart';
|
||||||
|
import '../../../../../tools/showTipView.dart';
|
||||||
|
|
||||||
class ElectronicKeyDetailLogic extends BaseGetXController {
|
class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||||
final ElectronicKeyDetailState state = ElectronicKeyDetailState();
|
final ElectronicKeyDetailState state = ElectronicKeyDetailState();
|
||||||
@ -30,10 +35,33 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除电子钥匙名称请求
|
//编辑电子钥匙有效期请求
|
||||||
Future<void> deleteKeyRequest() async {
|
Future<void> updateKeyDateRequest() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
.deleteElectronicKey(state.itemData.value.keyId.toString());
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
lockId:state.itemData.value.lockId.toString(),
|
||||||
|
endDate:state.starDate.value.toString(),
|
||||||
|
startDate:state.endDate.value.toString(),
|
||||||
|
weekDays:state.itemData.value.weekDays!,
|
||||||
|
keyType:state.itemData.value.keyType!,
|
||||||
|
startTime:int.parse(state.starTime.value),
|
||||||
|
endTime:int.parse(state.endTime.value),
|
||||||
|
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0,
|
||||||
|
remoteEnable: state.isRemoteUnlock.value ? 1 : 0);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("修改成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除电子钥匙名称请求 setAdministrator
|
||||||
|
Future<void> deleteKeyRequest(int includeUnderlings) async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
includeUnderlings: 0
|
||||||
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("删除电子钥匙成功");
|
print("删除电子钥匙成功");
|
||||||
showToast("删除成功", something: () {
|
showToast("删除成功", something: () {
|
||||||
@ -43,4 +71,120 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置授权管理员
|
||||||
|
Future<void> setAdministrator() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.setAdministrator(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("设置成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消授权管理员
|
||||||
|
Future<void> cancelAdministrator() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.cancelAdministrator(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("设置成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//冻结
|
||||||
|
Future<void> freezeKey() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("设置成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消冻结
|
||||||
|
Future<void> cancelFreeze() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("设置成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime(){
|
||||||
|
String useDateStr = '';
|
||||||
|
if(state.keyType.value == 1){
|
||||||
|
useDateStr = "永久";
|
||||||
|
}else if(state.keyType.value == 2){
|
||||||
|
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
|
}else if(state.keyType.value == 3){
|
||||||
|
useDateStr = "单次";
|
||||||
|
}else if(state.keyType.value == 4){
|
||||||
|
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
showPopMenus(){
|
||||||
|
var textList = [];
|
||||||
|
// keyType // 永久:1;限时2,单次3,循环:4
|
||||||
|
// itemData.keyRight == 1 // 1:管理员 2:普通用户
|
||||||
|
// indexEntity.keyStatus! 110405:已冻结 110412:已过期 110408:已删除 110410:已重置
|
||||||
|
if(state.keyType.value == 1 || state.keyType.value == 2){
|
||||||
|
textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}, {'text': state.itemData.value.keyRight == 1 ? '取消授权' : '授权'}];
|
||||||
|
} else if(state.keyType.value == 4){
|
||||||
|
textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}];
|
||||||
|
}
|
||||||
|
JhPopMenus.showLinePop(Get.context!, clickCallback: (index, selText) {
|
||||||
|
print('选中index: $index');
|
||||||
|
print('选中text: $selText');
|
||||||
|
if(index == 0){
|
||||||
|
if(state.itemData.value.keyStatus == 110405){
|
||||||
|
// 取消冻结
|
||||||
|
cancelFreeze();
|
||||||
|
}else{
|
||||||
|
freezeKey();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 取消/授权管理员
|
||||||
|
if(state.itemData.value.keyRight == 1){
|
||||||
|
// 管理员
|
||||||
|
cancelAdministrator();
|
||||||
|
}else{
|
||||||
|
setAdministrator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, listData: textList);
|
||||||
|
}
|
||||||
|
|
||||||
|
deletKeyLogic(){
|
||||||
|
if(state.itemData.value.keyRight == 1){
|
||||||
|
// 授权管理员
|
||||||
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
||||||
|
deleteKeyRequest(isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
// 普通用户
|
||||||
|
ShowTipView().showDeleteKeyDataDialogDialog((){
|
||||||
|
deleteKeyRequest(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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/common/XSConstantMacro/XSConstantMacro.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
|
||||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
@ -21,8 +19,7 @@ class ElectronicKeyDetailPage extends StatefulWidget {
|
|||||||
const ElectronicKeyDetailPage({Key? key}) : super(key: key);
|
const ElectronicKeyDetailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ElectronicKeyDetailPage> createState() =>
|
State<ElectronicKeyDetailPage> createState() => _ElectronicKeyDetailPageState();
|
||||||
_ElectronicKeyDetailPageState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||||
@ -37,27 +34,20 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.keyDetail!.tr,
|
barTitle: TranslationLoader.lanKeys!.keyDetail!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
actionsList: [
|
actionsList: (state.keyType.value!=3) ? [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'images/icon_bar_more.png',
|
'images/icon_bar_more.png',
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: state.keyType.value != 3 ? () {
|
||||||
JhPopMenus.showLinePop(context,
|
logic.showPopMenus();
|
||||||
clickCallback: (index, selText) {
|
} : null,
|
||||||
print('选中index: $index');
|
|
||||||
print('选中text: $selText');
|
|
||||||
}, listData: [
|
|
||||||
{'text': '冻结'},
|
|
||||||
{'text': '取消授权'}
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
]:null,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
@ -67,23 +57,130 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context);
|
||||||
})),
|
})),
|
||||||
Obx(() => getPeriodValidityWidget()),
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
allHeight: 70.h,
|
||||||
|
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||||
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||||
|
isHaveDirection: state.keyType.value == 3 ? false : true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||||
|
// 限时/永久
|
||||||
|
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"itemData": state.itemData.value,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||||
|
state.endDate.value = data["endTimeTimestamp"].toString();
|
||||||
|
state.keyType.value = 2;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else if(state.keyType.value == 4){
|
||||||
|
// 循环
|
||||||
|
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"itemData": state.itemData.value,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
print("state.starDate.value:${data["starDate"]} "
|
||||||
|
"state.endDate.value:${data["endDate"]} "
|
||||||
|
"state.starTime.value:${data["starTime"]} "
|
||||||
|
"state.endTime.value:${data["endTime"]} "
|
||||||
|
"state.weekDay.value:${data["validityValue"]}");
|
||||||
|
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["validityValue"];
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
|
rightTitle: state.weekDay.value.join(','),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"itemData": state.itemData.value,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["validityValue"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"itemData": state.itemData.value,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.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),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: "接收者",
|
leftTitel: "接收者",
|
||||||
rightTitle: state.itemData.value.username ?? "",
|
rightTitle: state.itemData.value.username ?? ""),
|
||||||
action: () {}),
|
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||||
rightTitle: state.itemData.value.senderUsername ?? "",
|
rightTitle: state.itemData.value.senderUsername ?? ""),
|
||||||
action: () {}),
|
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
||||||
rightTitle: getSenderDate(state.itemData.value) ?? "",
|
rightTitle: DateTool().dateToYMDHNString(
|
||||||
action: () {}),
|
state.itemData.value.sendDate.toString())),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
|
Visibility(
|
||||||
|
visible: state.itemData.value.keyRight == 1 ? true:false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "仅管理自己创建的用户",
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
child: _onlyManageYouCreatesUserSwitch())),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: (state.itemData.value.keyRight == 1 && state.keyInfo.value.lockSetting!.remoteUnlock == 1) ? false:true,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "远程开锁",
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
child: _remoteUnlockingSwitch())),
|
||||||
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
@ -92,8 +189,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
width: 60.w,
|
width: 60.w,
|
||||||
child: _switch(state.itemData.value.faceAuthentication == 1
|
child: _switch(state.itemData.value.faceAuthentication == 1
|
||||||
? true
|
? true
|
||||||
: false)),
|
: false))),
|
||||||
action: () {}),
|
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
@ -115,7 +211,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
showIosTipViewDialog(context);
|
logic.deletKeyLogic();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -123,139 +219,147 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//根据类型获取限时有效期样式
|
//根据类型获取限时有效期样式
|
||||||
Widget getPeriodValidityWidget() {
|
// Widget getPeriodValidityWidget() {
|
||||||
int? dateType = state.itemData.value.keyType;
|
// int? dateType = state.keyType.value;
|
||||||
if (dateType == XSConstantMacro.keyTypeLong) {
|
// Get.log('dateType:$dateType');
|
||||||
return getLongTypeDateWidget();
|
// if (dateType == XSConstantMacro.keyTypeLong) {
|
||||||
} else if (dateType == XSConstantMacro.keyTypeTime) {
|
// return getLongTypeDateWidget();
|
||||||
return getTimeLimitTypeDateWidget();
|
// } else if (dateType == XSConstantMacro.keyTypeTime) {
|
||||||
} else if (dateType == XSConstantMacro.keyTypeOnce) {
|
// return getTimeLimitTypeDateWidget();
|
||||||
return getOnceTypeDateWidget();
|
// } else if (dateType == XSConstantMacro.keyTypeOnce) {
|
||||||
} else if (dateType == XSConstantMacro.keyTypeLoop) {
|
// return getOnceTypeDateWidget();
|
||||||
return getLoopTypeDateWidget();
|
// } else if (dateType == XSConstantMacro.keyTypeLoop) {
|
||||||
}
|
// return getLoopTypeDateWidget();
|
||||||
return Container();
|
// }
|
||||||
}
|
// return Container();
|
||||||
|
// }
|
||||||
//永久钥匙
|
//
|
||||||
Widget getLongTypeDateWidget() {
|
// //永久钥匙
|
||||||
return CommonItem(
|
// Widget getLongTypeDateWidget() {
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
// return CommonItem(
|
||||||
rightTitle: '永久',
|
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
isHaveDirection: true,
|
// rightTitle: '永久',
|
||||||
action: () {
|
// isHaveDirection: true,
|
||||||
Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
|
// action: () {
|
||||||
arguments: {"itemData": state.itemData.value});
|
// Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
|
||||||
});
|
// arguments: {"itemData": state.itemData.value});
|
||||||
}
|
// });
|
||||||
|
// }
|
||||||
//限时钥匙
|
//
|
||||||
Widget getTimeLimitTypeDateWidget() {
|
// //限时钥匙
|
||||||
return CommonItem(
|
// Widget getTimeLimitTypeDateWidget() {
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
// return CommonItem(
|
||||||
allHeight: 90.h,
|
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
|
// allHeight: 90.h,
|
||||||
isHaveDirection: true,
|
// rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
|
||||||
action: () async {
|
// isHaveDirection: true,
|
||||||
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate,
|
// action: () async {
|
||||||
arguments: {"itemData": state.itemData.value});
|
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate,
|
||||||
if (data != null) {
|
// arguments: {"itemData": state.itemData.value});
|
||||||
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
// if (data != null) {
|
||||||
state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
//
|
||||||
state.beginTime.value = DateTool()
|
// // print("state.beginTime.value:${state.beginTime.value}"
|
||||||
.dateToYMDHNString((state.beginTimeTimestamp.value*1000).toString());
|
// // "state.endTime.value:${state.endTime.value}"
|
||||||
state.endTime.value = DateTool()
|
// // "state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"
|
||||||
.dateToYMDHNString((state.endTimeTimestamp.value*1000).toString());
|
// // "state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
|
||||||
// print("state.beginTime.value:${state.beginTime.value}"
|
// setState(() {
|
||||||
// "state.endTime.value:${state.endTime.value}"
|
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
||||||
// "state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"
|
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
||||||
// "state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
|
// state.beginTime.value = DateTool()
|
||||||
setState(() {});
|
// .dateToYMDHNString((state.beginTimeTimestamp.value*1000).toString());
|
||||||
}
|
// state.endTime.value = DateTool()
|
||||||
});
|
// .dateToYMDHNString((state.endTimeTimestamp.value*1000).toString());
|
||||||
}
|
// state.keyType.value = 2;
|
||||||
|
// Get.log("2222222222222");
|
||||||
//单次钥匙
|
// });
|
||||||
Widget getOnceTypeDateWidget() {
|
// Get.log("1111111111111");
|
||||||
return CommonItem(
|
// }
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
// });
|
||||||
rightTitle: '单次',
|
// }
|
||||||
isHaveDirection: false,
|
//
|
||||||
);
|
// //单次钥匙
|
||||||
}
|
// Widget getOnceTypeDateWidget() {
|
||||||
|
// return CommonItem(
|
||||||
//循环钥匙
|
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
Widget getLoopTypeDateWidget() {
|
// rightTitle: '单次',
|
||||||
DateTime startDateStr =
|
// isHaveDirection: false,
|
||||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
// );
|
||||||
DateTime endDateStr =
|
// }
|
||||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
//
|
||||||
String useDateStr =
|
// //循环钥匙
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)} \n ${endDateStr.toLocal().toString().substring(0, 16)}';
|
// Widget getLoopTypeDateWidget() {
|
||||||
|
// DateTime startDateStr =
|
||||||
List getEffectiveDateList = [];
|
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||||
List weekDaysList = state.itemData.value.weekDays!;
|
// DateTime endDateStr =
|
||||||
if (weekDaysList.isNotEmpty) {
|
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||||
String effectiveDateStr = '';
|
// String useDateStr =
|
||||||
for (int i = 0; i < weekDaysList.length; i++) {
|
// '${startDateStr.toLocal().toString().substring(0, 16)} \n ${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
if (weekDaysList[i] == 1) {
|
//
|
||||||
effectiveDateStr = '一';
|
// List getEffectiveDateList = [];
|
||||||
getEffectiveDateList.add(effectiveDateStr);
|
// List weekDaysList = state.itemData.value.weekDays!;
|
||||||
} else if (weekDaysList[i] == 2) {
|
// if (weekDaysList.isNotEmpty) {
|
||||||
effectiveDateStr = '二';
|
// String effectiveDateStr = '';
|
||||||
getEffectiveDateList.add(effectiveDateStr);
|
// for (int i = 0; i < weekDaysList.length; i++) {
|
||||||
} else if (weekDaysList[i] == 3) {
|
// if (weekDaysList[i] == 1) {
|
||||||
effectiveDateStr = '三';
|
// effectiveDateStr = '一';
|
||||||
getEffectiveDateList.add(effectiveDateStr);
|
// getEffectiveDateList.add(effectiveDateStr);
|
||||||
} else if (weekDaysList[i] == 4) {
|
// } else if (weekDaysList[i] == 2) {
|
||||||
effectiveDateStr = '四';
|
// effectiveDateStr = '二';
|
||||||
getEffectiveDateList.add(effectiveDateStr);
|
// getEffectiveDateList.add(effectiveDateStr);
|
||||||
} else if (weekDaysList[i] == 5) {
|
// } else if (weekDaysList[i] == 3) {
|
||||||
effectiveDateStr = '五';
|
// effectiveDateStr = '三';
|
||||||
getEffectiveDateList.add(effectiveDateStr);
|
// getEffectiveDateList.add(effectiveDateStr);
|
||||||
} else if (weekDaysList[i] == 6) {
|
// } else if (weekDaysList[i] == 4) {
|
||||||
effectiveDateStr = '六';
|
// effectiveDateStr = '四';
|
||||||
getEffectiveDateList.add(effectiveDateStr);
|
// getEffectiveDateList.add(effectiveDateStr);
|
||||||
} else if (weekDaysList[i] == 7) {
|
// } else if (weekDaysList[i] == 5) {
|
||||||
effectiveDateStr = '日';
|
// effectiveDateStr = '五';
|
||||||
getEffectiveDateList.add(effectiveDateStr);
|
// getEffectiveDateList.add(effectiveDateStr);
|
||||||
}
|
// } else if (weekDaysList[i] == 6) {
|
||||||
}
|
// effectiveDateStr = '六';
|
||||||
}
|
// getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
// } else if (weekDaysList[i] == 7) {
|
||||||
return Column(
|
// effectiveDateStr = '日';
|
||||||
children: [
|
// getEffectiveDateList.add(effectiveDateStr);
|
||||||
CommonItem(
|
// }
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
// }
|
||||||
allHeight: 90.h,
|
// }
|
||||||
rightTitle: useDateStr,
|
//
|
||||||
isHaveDirection: true,
|
// return Column(
|
||||||
isHaveLine: true,
|
// children: [
|
||||||
action: () {
|
// CommonItem(
|
||||||
Navigator.pushNamed(
|
// leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
context, Routers.electronicKeyPeriodValidityPage);
|
// allHeight: 90.h,
|
||||||
}),
|
// rightTitle: useDateStr,
|
||||||
CommonItem(
|
// isHaveDirection: true,
|
||||||
leftTitel: '有效日',
|
// isHaveLine: true,
|
||||||
rightTitle: getEffectiveDateList.map((e) => e.toString()).join(','),
|
// action: () {
|
||||||
isHaveDirection: true,
|
// Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||||
isHaveLine: true,
|
// "itemData": state.itemData.value,
|
||||||
action: () {
|
// "keyType": 1
|
||||||
Navigator.pushNamed(
|
// });
|
||||||
context, Routers.electronicKeyPeriodValidityPage);
|
// }),
|
||||||
}),
|
// CommonItem(
|
||||||
],
|
// leftTitel: '有效日',
|
||||||
);
|
// rightTitle: getEffectiveDateList.map((e) => e.toString()).join(','),
|
||||||
}
|
// isHaveDirection: true,
|
||||||
|
// isHaveLine: true,
|
||||||
//发送时间
|
// action: () {
|
||||||
String getSenderDate(ElectronicKeyListItem indexEntity) {
|
// Navigator.pushNamed(
|
||||||
String senderDate = '';
|
// context, Routers.electronicKeyPeriodValidityPage);
|
||||||
DateTime dateStr =
|
// }),
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
// ],
|
||||||
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
// );
|
||||||
return senderDate;
|
// }
|
||||||
}
|
//
|
||||||
|
// //发送时间
|
||||||
|
// String getSenderDate(ElectronicKeyListItem indexEntity) {
|
||||||
|
// String senderDate = '';
|
||||||
|
// DateTime dateStr =
|
||||||
|
// DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
|
// senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||||
|
// return senderDate;
|
||||||
|
// }
|
||||||
|
|
||||||
CupertinoSwitch _switch(isOn) {
|
CupertinoSwitch _switch(isOn) {
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
@ -271,6 +375,36 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CupertinoSwitch _remoteUnlockingSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.isRemoteUnlock.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
|
logic.updateKeyDateRequest();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CupertinoSwitch _onlyManageYouCreatesUserSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.onlyManageYouCreatesUser.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value;
|
||||||
|
logic.updateKeyDateRequest();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -294,21 +428,4 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showIosTipViewDialog(BuildContext context) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return ShowIosTipView(
|
|
||||||
title: "提示",
|
|
||||||
tipTitle: "确定要删除吗?",
|
|
||||||
sureClick: () {
|
|
||||||
Get.back();
|
|
||||||
logic.deleteKeyRequest();
|
|
||||||
},
|
|
||||||
cancelClick: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,27 +2,43 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
|
||||||
import '../../../../../tools/dateTool.dart';
|
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class ElectronicKeyDetailState {
|
class ElectronicKeyDetailState {
|
||||||
final itemData = ElectronicKeyListItem().obs;
|
final itemData = ElectronicKeyListItem().obs;
|
||||||
|
final keyInfo = LockListInfoItemEntity().obs;
|
||||||
|
|
||||||
final keyName = "".obs;
|
final keyName = "".obs;
|
||||||
final TextEditingController changeNameController = TextEditingController();
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
var starDate = "".obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
var endDate = "".obs;// 结束时间
|
||||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
var starTime = "".obs;// 生效时间
|
||||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
var endTime = "".obs;// 失效时间
|
||||||
|
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||||
|
var weekDay = [].obs;// 有效日
|
||||||
|
|
||||||
|
var onlyManageYouCreatesUser = false.obs;// 0:可以管理所有用户 1:只能管理自己创建的用户
|
||||||
|
var isRemoteUnlock = false.obs; //是否允许远程开锁 0:不允许 1:允许
|
||||||
|
|
||||||
ElectronicKeyDetailState() {
|
ElectronicKeyDetailState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
itemData.value = map["itemData"];
|
itemData.value = map["itemData"];
|
||||||
|
if(map["keyInfo"]!=null){
|
||||||
|
keyInfo.value = map["keyInfo"];
|
||||||
|
}
|
||||||
changeNameController.text = itemData.value.keyName!;
|
changeNameController.text = itemData.value.keyName!;
|
||||||
keyName.value = itemData.value.keyName!;
|
keyName.value = itemData.value.keyName!;
|
||||||
|
|
||||||
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
|
isRemoteUnlock.value = itemData.value.remoteEnable! == 0 ? false : true;
|
||||||
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
|
onlyManageYouCreatesUser.value = itemData.value.isOnlyManageSelf! == 0 ? false : true;
|
||||||
beginTimeTimestamp.value = itemData.value.startDate!;
|
|
||||||
endTimeTimestamp.value = itemData.value.endDate!;
|
starDate.value = itemData.value.startDate!.toString();
|
||||||
|
endDate.value = itemData.value.endDate!.toString();
|
||||||
|
starTime.value = itemData.value.startDate!.toString();
|
||||||
|
endTime.value = itemData.value.endDate!.toString();
|
||||||
|
weekDay.value = itemData.value.weekDays!;
|
||||||
|
// Get.log("starTime.value: ${starTime.value} endTime.value: ${endTime.value}");
|
||||||
|
keyType.value = itemData.value.keyType!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||||
@ -13,42 +13,30 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//编辑电子钥匙有效期请求
|
//编辑电子钥匙有效期请求
|
||||||
Future<void> updateKeyDateRequest() async {
|
Future<void> updateKeyDateRequest() async {
|
||||||
// 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!}");
|
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||||
// print("state.itemData.value.endDate!:${state.itemData.value.endDate!}");
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||||
var beginTimeTimestamp = state.itemData.value.startDate! ~/ 1000;
|
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||||
var endTimeTimestamp = state.itemData.value.endDate! ~/ 1000;
|
|
||||||
if (beginTimeTimestamp > endTimeTimestamp ||
|
|
||||||
beginTimeTimestamp == endTimeTimestamp) {
|
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
|
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||||
showToast("生效时间需大于当前时间");
|
showToast("生效时间需大于当前时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
state.itemData.value.keyId.toString(),
|
keyId:state.keyId.value.toString(),
|
||||||
state.itemData.value.lockId.toString(),
|
lockId:state.lockId.value.toString(),
|
||||||
state.itemData.value.endDate!.toString(),
|
endDate:endTimeTimestamp.toString(),
|
||||||
state.itemData.value.startDate!.toString(),
|
startDate:beginTimeTimestamp.toString(),
|
||||||
state.weekDays.value,
|
weekDays:[],
|
||||||
state.itemData.value.keyType! == 1 ? 2 : state.itemData.value.keyType!);
|
keyType:2,
|
||||||
|
startTime: 0,
|
||||||
|
endTime: 0,
|
||||||
|
isOnlyManageSelf: state.isOnlyManageSelf!.value,
|
||||||
|
remoteEnable: state.remoteEnable!.value
|
||||||
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("修改成功", something: () {
|
showToast("修改成功", something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
@ -60,4 +48,5 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart';
|
||||||
import 'package:star_lock/tools/dateUtils.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/pickers.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/date_mode.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -51,76 +51,35 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildMainUI() {
|
Widget buildMainUI() {
|
||||||
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(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.selectEffectiveDate.value.isNotEmpty
|
rightTitle: state.beginTime.value,
|
||||||
? state.selectEffectiveDate.value
|
|
||||||
: getStartDate,
|
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.selectEffectiveDate.value =
|
setState(() {
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
// state.effectiveDateTime = DateTime.parse(state.selectEffectiveDate.value);
|
});
|
||||||
state.itemData.value.startDate = DateTime.parse(state.selectEffectiveDate.value).millisecondsSinceEpoch;
|
});
|
||||||
});
|
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.selectFailureDate.value.isNotEmpty
|
rightTitle: state.endTime.value,
|
||||||
? state.selectFailureDate.value
|
|
||||||
: getEndDate,
|
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.selectFailureDate.value =
|
setState(() {
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
// 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";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,45 +1,64 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||||
|
|
||||||
import '../../../../../tools/dateTool.dart';
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
class ElectronicKeyDetailChangeDateState {
|
class ElectronicKeyDetailChangeDateState {
|
||||||
final itemData = ElectronicKeyListItem().obs;
|
final itemData = ElectronicKeyListItem().obs;
|
||||||
final TextEditingController inputPwdController = TextEditingController();
|
final expireLockItem = ExpireLockItem().obs;
|
||||||
final TextEditingController inputNameController = TextEditingController();
|
|
||||||
final changeType = '1'
|
var beginTime = "".obs;// 开始时间
|
||||||
.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效
|
var endTime = "".obs;// 结束时间
|
||||||
final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警)
|
|
||||||
final hoursStart = 0.obs;
|
var pushType = 0.obs;// 0电子钥匙 1授权管理员
|
||||||
final hoursEnd = 0.obs;
|
|
||||||
final pwdId = ''.obs;
|
var keyId = 0.obs;
|
||||||
final lockId = 0.obs;
|
var lockId = 0.obs;
|
||||||
// final fromType = ''.obs;
|
var isOnlyManageSelf = 0.obs;
|
||||||
final selectEffectiveDate = ''.obs; //生效时间
|
var remoteEnable = 0.obs;
|
||||||
final selectFailureDate = ''.obs; //失效时间
|
|
||||||
// DateTime effectiveDateTime = DateTime.now();
|
|
||||||
// DateTime failureDateTime = DateTime.now();
|
|
||||||
final weekDays = [].obs;
|
|
||||||
|
|
||||||
ElectronicKeyDetailChangeDateState() {
|
ElectronicKeyDetailChangeDateState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
// itemData.value = map["itemData"];
|
|
||||||
if ((map["itemData"] != null)) {
|
if ((map["itemData"] != null)) {
|
||||||
itemData.value = map["itemData"];
|
itemData.value = map["itemData"];
|
||||||
// beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
|
Get.log("itemData.value.keyId:${itemData.value.keyId}");
|
||||||
// endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
|
if(map["pushType"] != null){
|
||||||
// beginTimeTimestamp.value = itemData.value.startDate!;
|
pushType.value = map["pushType"];
|
||||||
// endTimeTimestamp.value = itemData.value.endDate!;
|
}
|
||||||
|
|
||||||
|
keyId.value = itemData.value.keyId!;
|
||||||
|
lockId.value = itemData.value.lockId!;
|
||||||
|
isOnlyManageSelf.value = itemData.value.isOnlyManageSelf!;
|
||||||
|
remoteEnable.value = itemData.value.remoteEnable!;
|
||||||
|
|
||||||
|
if(itemData.value.startDate == 0 && itemData.value.endDate == 0){
|
||||||
|
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||||
|
endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||||
|
}else{
|
||||||
|
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
|
||||||
|
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((map["pwdId"] != null)) {
|
|
||||||
pwdId.value = map["pwdId"];
|
if ((map["expireLockItem"] != null)) {
|
||||||
|
expireLockItem.value = map["expireLockItem"];
|
||||||
|
Get.log("itemData.value.keyId:${expireLockItem.value.keyId}");
|
||||||
|
|
||||||
|
keyId.value = expireLockItem.value.keyId!;
|
||||||
|
lockId.value = expireLockItem.value.lockId!;
|
||||||
|
isOnlyManageSelf.value = expireLockItem.value.isOnlyManageSelf!;
|
||||||
|
remoteEnable.value = expireLockItem.value.remoteEnable!;
|
||||||
|
|
||||||
|
if(expireLockItem.value.startDate == 0 && expireLockItem.value.endDate == 0){
|
||||||
|
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||||
|
endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||||
|
}else{
|
||||||
|
beginTime.value = DateTool().dateToYMDHNString(expireLockItem.value.startDate.toString());
|
||||||
|
endTime.value = DateTool().dateToYMDHNString(expireLockItem.value.endDate.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((map["lockId"] != null)) {
|
|
||||||
lockId.value = map["lockId"];
|
|
||||||
}
|
|
||||||
// if ((map["fromType"] != null)) {
|
|
||||||
// fromType.value = map["fromType"];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../../network/api_repository.dart';
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
|
import '../keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
import 'electronicKeyPeriodValidity_state.dart';
|
||||||
|
|
||||||
|
class ElectronicKeyPeriodValidityLogic extends BaseGetXController {
|
||||||
|
final ElectronicKeyPeriodValidityState state = ElectronicKeyPeriodValidityState();
|
||||||
|
|
||||||
|
//编辑电子钥匙有效期请求
|
||||||
|
Future<void> updateKeyDateRequest() async {
|
||||||
|
|
||||||
|
var starDateTimestamp = DateTool().dateToTimestamp(state.starDate.value, 1);
|
||||||
|
var endDateTimestamp = DateTool().dateToTimestamp(state.endDate.value, 1);
|
||||||
|
var starTimeTimestamp = DateTool().dateToTimestamp(state.starTime.value, 0);
|
||||||
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||||
|
|
||||||
|
if (starDateTimestamp >= endDateTimestamp) {
|
||||||
|
showToast("失效日期要大于生效日期");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (starTimeTimestamp >= endTimeTimestamp) {
|
||||||
|
showToast("失效时间要大于生效时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
|
keyId:state.keyId.value.toString(),
|
||||||
|
lockId:state.lockId.value.toString(),
|
||||||
|
endDate:endDateTimestamp.toString(),
|
||||||
|
startDate:starDateTimestamp.toString(),
|
||||||
|
weekDays:state.weekDay.value,
|
||||||
|
keyType:state.keyType.value!,
|
||||||
|
startTime: starTimeTimestamp,
|
||||||
|
endTime: endTimeTimestamp,
|
||||||
|
isOnlyManageSelf: state.isOnlyManageSelf.value!,
|
||||||
|
remoteEnable: state.remoteEnable.value!);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("修改成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back(result: {
|
||||||
|
"starDate":starDateTimestamp.toString(),
|
||||||
|
"endDate":endDateTimestamp.toString(),
|
||||||
|
"starTime":starTimeTimestamp.toString(),
|
||||||
|
"endTime":endTimeTimestamp.toString(),
|
||||||
|
"validityValue":state.weekDay.value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,230 @@
|
|||||||
|
import 'package:flutter/material.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 '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
import 'electronicKeyPeriodValidity_logic.dart';
|
||||||
|
|
||||||
|
class ElectronicKeyPeriodValidityPage extends StatefulWidget {
|
||||||
|
const ElectronicKeyPeriodValidityPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ElectronicKeyPeriodValidityPage> createState() =>
|
||||||
|
_ElectronicKeyPeriodValidityPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodValidityPage> {
|
||||||
|
final logic = Get.put(ElectronicKeyPeriodValidityLogic());
|
||||||
|
final state = Get.find<ElectronicKeyPeriodValidityLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: "修改有效期",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
topWidget(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
middleWidget(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
bottomWidget(),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||||
|
onClick: () {
|
||||||
|
if (state.pushType.value == 0) {
|
||||||
|
logic.updateKeyDateRequest();
|
||||||
|
} else if (state.pushType.value == 1) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget topWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "生效日期",
|
||||||
|
rightTitle: state.starDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "失效日期",
|
||||||
|
rightTitle: state.endDate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget middleWidget() {
|
||||||
|
return Container(
|
||||||
|
height: 160.h,
|
||||||
|
width: 1.sw,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 60.h,
|
||||||
|
// color: Colors.red,
|
||||||
|
padding: EdgeInsets.only(left: 30.w, top: 15.h),
|
||||||
|
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
|
||||||
|
Container(
|
||||||
|
height: 100.h,
|
||||||
|
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 7, childAspectRatio: 1.0),
|
||||||
|
itemCount: 7,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
index += 1;
|
||||||
|
return btnItem(index);
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget btnItem(int index) {
|
||||||
|
String dateStr;
|
||||||
|
switch (index) {
|
||||||
|
case 1:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.mondayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.tuesdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.wednesdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.thursdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.fridayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.saturdayShort!.tr;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
dateStr = TranslationLoader.lanKeys!.sundayShort!.tr;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dateStr = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
if (state.weekDay.value.contains(index)) {
|
||||||
|
state.weekDay.value.remove(index);
|
||||||
|
} else {
|
||||||
|
state.weekDay.value.add(index);
|
||||||
|
}
|
||||||
|
state.weekDay.value.sort();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Obx(() => Container(
|
||||||
|
width: 40.w,
|
||||||
|
height: 40.w,
|
||||||
|
margin: EdgeInsets.all(10.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: state.weekDay.value.contains(index)
|
||||||
|
? AppColors.mainColor
|
||||||
|
: Colors.white,
|
||||||
|
border: Border.all(width: 1, color: AppColors.btnDisableColor),
|
||||||
|
borderRadius: BorderRadius.circular(30.w),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
dateStr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.sp,
|
||||||
|
color: state.weekDay.value.contains(index)
|
||||||
|
? Colors.white
|
||||||
|
: AppColors.darkGrayTextColor),
|
||||||
|
)),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget bottomWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
||||||
|
rightTitle: state.starTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
state.starTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
"${TranslationLoader.lanKeys!.end!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
||||||
|
rightTitle: state.endTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
||||||
|
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
|
class ElectronicKeyPeriodValidityState {
|
||||||
|
TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框
|
||||||
|
final itemData = ElectronicKeyListItem().obs;
|
||||||
|
final expireLockItem = ExpireLockItem().obs;
|
||||||
|
|
||||||
|
var starDate = "".obs;// 开始时间
|
||||||
|
var endDate = "".obs;// 结束时间
|
||||||
|
var starTime = "".obs;// 生效时间
|
||||||
|
var endTime = "".obs;// 失效时间
|
||||||
|
|
||||||
|
var pushType = 0.obs;// 0电子钥匙 1授权管理员
|
||||||
|
var weekDay = [].obs;
|
||||||
|
|
||||||
|
var keyId = 0.obs;
|
||||||
|
var lockId = 0.obs;
|
||||||
|
var isOnlyManageSelf = 0.obs;
|
||||||
|
var remoteEnable = 0.obs;
|
||||||
|
var keyType = 0.obs;
|
||||||
|
ElectronicKeyPeriodValidityState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if ((map["itemData"] != null)) {
|
||||||
|
itemData.value = map["itemData"];
|
||||||
|
|
||||||
|
if(map["pushType"] != null){
|
||||||
|
pushType.value = map["pushType"];
|
||||||
|
}
|
||||||
|
|
||||||
|
keyId.value = itemData.value.keyId!;
|
||||||
|
lockId.value = itemData.value.lockId!;
|
||||||
|
isOnlyManageSelf.value = itemData.value.isOnlyManageSelf!;
|
||||||
|
remoteEnable.value = itemData.value.remoteEnable!;
|
||||||
|
keyType.value = itemData.value.keyType!;
|
||||||
|
|
||||||
|
starDate.value = DateTool().dateToYMDString(itemData.value.startDate.toString());
|
||||||
|
endDate.value = DateTool().dateToYMDString(itemData.value.endDate.toString());
|
||||||
|
starTime.value = DateTool().dateToHNString(itemData.value.startDate.toString());
|
||||||
|
endTime.value = DateTool().dateToHNString(itemData.value.endDate.toString());
|
||||||
|
weekDay.value = itemData.value.weekDays!;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((map["expireLockItem"] != null)) {
|
||||||
|
expireLockItem.value = map["expireLockItem"];
|
||||||
|
Get.log("itemData.value.keyId:${expireLockItem.value.keyId}");
|
||||||
|
|
||||||
|
keyId.value = expireLockItem.value.keyId!;
|
||||||
|
lockId.value = expireLockItem.value.lockId!;
|
||||||
|
isOnlyManageSelf.value = expireLockItem.value.isOnlyManageSelf!;
|
||||||
|
remoteEnable.value = expireLockItem.value.remoteEnable!;
|
||||||
|
keyType.value = expireLockItem.value.keyType!;
|
||||||
|
|
||||||
|
starDate.value = DateTool().dateToYMDString(expireLockItem.value.startDate.toString());
|
||||||
|
endDate.value = DateTool().dateToYMDString(expireLockItem.value.endDate.toString());
|
||||||
|
starTime.value = DateTool().dateToHNString(expireLockItem.value.startDate.toString());
|
||||||
|
endTime.value = DateTool().dateToHNString(expireLockItem.value.endDate.toString());
|
||||||
|
weekDay.value = expireLockItem.value.weekDays!;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electr
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
@ -50,9 +51,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除电子钥匙名称请求
|
//删除电子钥匙名称请求
|
||||||
Future<void> deleteKeyRequest(String keyId) async {
|
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity =
|
ElectronicKeyListEntity entity =
|
||||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
await ApiRepository.to.deleteElectronicKey(
|
||||||
|
keyId:keyId,
|
||||||
|
includeUnderlings:includeUnderlings
|
||||||
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("删除电子钥匙成功");
|
print("删除电子钥匙成功");
|
||||||
showToast("删除成功",something: (){
|
showToast("删除成功",something: (){
|
||||||
@ -62,6 +66,20 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
|
||||||
|
if(electronicKeyListItem.keyRight == 1){
|
||||||
|
// 授权管理员
|
||||||
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
||||||
|
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
// 普通用户
|
||||||
|
ShowTipView().showDeleteKeyDataDialogDialog((){
|
||||||
|
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 刷新电子钥匙列表
|
/// 刷新电子钥匙列表
|
||||||
StreamSubscription? _getElectronicKeyListRefreshUIEvent;
|
StreamSubscription? _getElectronicKeyListRefreshUIEvent;
|
||||||
void _getElectronicKeyListRefreshUIAction() {
|
void _getElectronicKeyListRefreshUIAction() {
|
||||||
|
|||||||
@ -133,8 +133,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: state.itemDataList.value.length,
|
itemCount: state.itemDataList.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
ElectronicKeyListItem indexEntity =
|
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
|
||||||
state.itemDataList.value[index];
|
|
||||||
String useDateStr = ''; //使用期限
|
String useDateStr = ''; //使用期限
|
||||||
String keyStatus = ''; //钥匙状态
|
String keyStatus = ''; //钥匙状态
|
||||||
|
|
||||||
@ -142,7 +141,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
useDateStr = getUseDateStr(indexEntity);
|
useDateStr = getUseDateStr(indexEntity);
|
||||||
|
|
||||||
//钥匙状态
|
//钥匙状态
|
||||||
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||||
|
|
||||||
//是否为管理钥匙
|
//是否为管理钥匙
|
||||||
bool isAdminKey = false;
|
bool isAdminKey = false;
|
||||||
@ -160,8 +159,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
showIosTipViewDialog(
|
logic.deletKeyLogic(indexEntity);
|
||||||
context, indexEntity.keyId!.toString());
|
|
||||||
},
|
},
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -175,10 +173,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
indexEntity.keyName!,
|
indexEntity.keyName!,
|
||||||
useDateStr,
|
useDateStr,
|
||||||
keyStatus,
|
keyStatus,
|
||||||
isAdminKey, () {
|
isAdminKey,
|
||||||
|
indexEntity.remoteEnable == 1 ? true : false, () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.electronicKeyDetailPage,
|
context, Routers.electronicKeyDetailPage,
|
||||||
arguments: {"itemData": indexEntity}).then((val) {
|
arguments: {
|
||||||
|
"itemData": indexEntity,
|
||||||
|
"keyInfo": state.keyInfo.value
|
||||||
|
}).then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
logic.mockNetworkDataRequest();
|
logic.mockNetworkDataRequest();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -197,25 +199,6 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void showIosTipViewDialog(BuildContext context, String keyId) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return ShowIosTipView(
|
|
||||||
title: "提示",
|
|
||||||
tipTitle: "确定要删除吗?",
|
|
||||||
sureClick: () {
|
|
||||||
Get.back();
|
|
||||||
logic.deleteKeyRequest(keyId);
|
|
||||||
},
|
|
||||||
cancelClick: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
@ -244,34 +227,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//钥匙状态
|
|
||||||
String getKeyStatus(int? keyStatusFlag) {
|
|
||||||
String keyStatus = '';
|
|
||||||
|
|
||||||
if (keyStatusFlag == 110401) {
|
|
||||||
//正常使用
|
|
||||||
keyStatus = '';
|
|
||||||
} else if (keyStatusFlag == 110402) {
|
|
||||||
//待接收
|
|
||||||
keyStatus = '待接收';
|
|
||||||
} else if (keyStatusFlag == 110405) {
|
|
||||||
//已冻结
|
|
||||||
keyStatus = '已冻结';
|
|
||||||
} else if (keyStatusFlag == 110408) {
|
|
||||||
//已删除
|
|
||||||
keyStatus = '已删除';
|
|
||||||
} else if (keyStatusFlag == 110410) {
|
|
||||||
//已重置
|
|
||||||
keyStatus = '已重置';
|
|
||||||
} else if (keyStatusFlag == 110412) {
|
|
||||||
//已过期
|
|
||||||
keyStatus = '已过期';
|
|
||||||
}
|
|
||||||
return keyStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
||||||
String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
String useDate, String keyStatus, bool isAdminKey, bool isRemteUnlocking, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -305,7 +262,15 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
fontSize: 24.sp,
|
fontSize: 24.sp,
|
||||||
color: AppColors.blackColor)),
|
color: AppColors.blackColor)),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 5.w),
|
||||||
|
isRemteUnlocking
|
||||||
|
? Image.asset(
|
||||||
|
'images/icon_electronicKey_remteUnlocking.png',
|
||||||
|
width: 24.w,
|
||||||
|
height: 20.w,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
SizedBox(width: 5.w),
|
||||||
isAdminKey
|
isAdminKey
|
||||||
? Image.asset(
|
? Image.asset(
|
||||||
'images/icon_electronicKey_admin.png',
|
'images/icon_electronicKey_admin.png',
|
||||||
|
|||||||
@ -87,6 +87,7 @@ class ElectronicKeyListItem {
|
|||||||
int? remoteEnable;
|
int? remoteEnable;
|
||||||
int? appUnlockMustOnline;
|
int? appUnlockMustOnline;
|
||||||
List? weekDays;
|
List? weekDays;
|
||||||
|
int? isOnlyManageSelf;
|
||||||
|
|
||||||
ElectronicKeyListItem(
|
ElectronicKeyListItem(
|
||||||
{this.keyId,
|
{this.keyId,
|
||||||
@ -108,7 +109,9 @@ class ElectronicKeyListItem {
|
|||||||
this.sendDate,
|
this.sendDate,
|
||||||
this.remoteEnable,
|
this.remoteEnable,
|
||||||
this.appUnlockMustOnline,
|
this.appUnlockMustOnline,
|
||||||
this.weekDays});
|
this.weekDays,
|
||||||
|
this.isOnlyManageSelf
|
||||||
|
});
|
||||||
|
|
||||||
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
|
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
|
||||||
keyId = json['keyId'];
|
keyId = json['keyId'];
|
||||||
@ -134,6 +137,7 @@ class ElectronicKeyListItem {
|
|||||||
sendDate = json['sendDate'];
|
sendDate = json['sendDate'];
|
||||||
remoteEnable = json['remoteEnable'];
|
remoteEnable = json['remoteEnable'];
|
||||||
appUnlockMustOnline = json['appUnlockMustOnline'];
|
appUnlockMustOnline = json['appUnlockMustOnline'];
|
||||||
|
isOnlyManageSelf = json['isOnlyManageSelf'];
|
||||||
json['weekDays'] != null ? weekDays = json['weekDays'] : [];
|
json['weekDays'] != null ? weekDays = json['weekDays'] : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +163,7 @@ class ElectronicKeyListItem {
|
|||||||
data['remoteEnable'] = remoteEnable;
|
data['remoteEnable'] = remoteEnable;
|
||||||
data['appUnlockMustOnline'] = appUnlockMustOnline;
|
data['appUnlockMustOnline'] = appUnlockMustOnline;
|
||||||
data['weekDays'] = weekDays;
|
data['weekDays'] = weekDays;
|
||||||
|
data['isOnlyManageSelf'] = isOnlyManageSelf;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_state.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
|
|
||||||
class ElectronicKeyPeriodValidityLogic extends BaseGetXController {
|
|
||||||
final ElectronicKeyPeriodValidityState state =
|
|
||||||
ElectronicKeyPeriodValidityState();
|
|
||||||
}
|
|
||||||
@ -1,274 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyPeriodValidity/KeyPeriodValidityModel.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_logic.dart';
|
|
||||||
import 'package:star_lock/tools/dateUtils.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../tools/commonItem.dart';
|
|
||||||
import '../../../../tools/submitBtn.dart';
|
|
||||||
import '../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
class ElectronicKeyPeriodValidityPage extends StatefulWidget {
|
|
||||||
const ElectronicKeyPeriodValidityPage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ElectronicKeyPeriodValidityPage> createState() =>
|
|
||||||
_ElectronicKeyPeriodValidityPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodValidityPage> {
|
|
||||||
final logic = Get.put(ElectronicKeyPeriodValidityLogic());
|
|
||||||
final state = Get.find<ElectronicKeyPeriodValidityLogic>().state;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
for (var i = 0; i < state.validityTextList.value.length; i++) {
|
|
||||||
int validityValue = 0;
|
|
||||||
if (i == 0) {
|
|
||||||
validityValue = 7;
|
|
||||||
} else {
|
|
||||||
validityValue = i;
|
|
||||||
}
|
|
||||||
KeyPeriodValidityModel model = KeyPeriodValidityModel(state.validityTextList.value[i], i, false, validityValue);
|
|
||||||
state.validityDataList.value.add(model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle: TranslationLoader.lanKeys!.periodValidity!.tr,
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: ListView(
|
|
||||||
children: [
|
|
||||||
effectiveDateWidget(),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
topWidget(),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
effectiveTimeWidget(),
|
|
||||||
bottomWidget()
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget topWidget() {
|
|
||||||
return Container(
|
|
||||||
height: 160.h,
|
|
||||||
width: 1.sw,
|
|
||||||
color: Colors.white,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: 60.h,
|
|
||||||
// color: Colors.red,
|
|
||||||
padding: EdgeInsets.only(left: 15.h, top: 15.h),
|
|
||||||
child: Text(TranslationLoader.lanKeys!.periodValidity!.tr,
|
|
||||||
style:
|
|
||||||
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
|
|
||||||
SizedBox(
|
|
||||||
height: 90.h,
|
|
||||||
child: GridView.builder(
|
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 7, childAspectRatio: 1.0),
|
|
||||||
itemCount: 7,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
KeyPeriodValidityModel model =
|
|
||||||
state.validityDataList.value[index];
|
|
||||||
return btnItem(model);
|
|
||||||
})),
|
|
||||||
Container(
|
|
||||||
color: Colors.white,
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget btnItem(KeyPeriodValidityModel model) {
|
|
||||||
return Obx(() => GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
model.isValidity = !model.isValidity;
|
|
||||||
if (model.isValidity) {
|
|
||||||
state.selectIndexList.value.add(model.validityValue);
|
|
||||||
} else {
|
|
||||||
state.selectIndexList.value.remove(model.validityValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 40.w,
|
|
||||||
height: 40.w,
|
|
||||||
margin: EdgeInsets.all(10.w),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: state.selectIndexList.value.contains(model.validityValue)
|
|
||||||
? Colors.blue
|
|
||||||
: Colors.white,
|
|
||||||
border:
|
|
||||||
Border.all(width: 1, color: AppColors.greyBackgroundColor),
|
|
||||||
borderRadius: BorderRadius.circular(30.w),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
model.validityText,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20.sp,
|
|
||||||
color:
|
|
||||||
state.selectIndexList.value.contains(model.validityValue)
|
|
||||||
? Colors.white
|
|
||||||
: AppColors.darkGrayTextColor),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
//生效日期
|
|
||||||
Widget effectiveDateWidget() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Obx(() => CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveDate!.tr,
|
|
||||||
rightTitle: state.selectEffectiveDate.value,
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true,
|
|
||||||
action: () {
|
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
|
||||||
onConfirm: (p) {
|
|
||||||
state.isHaveEffectiveDate.value = true;
|
|
||||||
state.effectiveDate.value = XSDateUtils.parseDateTime(
|
|
||||||
'${p.year}-${p.month!}-${p.day!}', 'yyyy-MM-dd');
|
|
||||||
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.effectiveDate.value, 'yyyy-MM-dd');
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
Obx(() => CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureDate!.tr,
|
|
||||||
rightTitle: state.selectFailureDate.value,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
|
||||||
onConfirm: (p) {
|
|
||||||
state.isHaveFailureDate.value = true;
|
|
||||||
state.failureDate.value = XSDateUtils.parseDateTime(
|
|
||||||
'${p.year}-${p.month!}-${p.day!}', 'yyyy-MM-dd');
|
|
||||||
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.failureDate.value, 'yyyy-MM-dd');
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//生效时间
|
|
||||||
Widget effectiveTimeWidget() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Obx(() => CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
|
||||||
rightTitle: state.selectEffectiveTime.value,
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true,
|
|
||||||
action: () {
|
|
||||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
|
||||||
onConfirm: (p) {
|
|
||||||
state.isHaveEffectiveTime.value = true;
|
|
||||||
state.effectiveTime.value = XSDateUtils.parseDateTime(
|
|
||||||
'${p.hour!}:${p.minute!}', 'HH:mm');
|
|
||||||
state.selectEffectiveTime.value = XSDateUtils.formatDateTime(
|
|
||||||
state.effectiveTime.value, 'HH:mm');
|
|
||||||
Get.log("p.year:${p.year} p.month:${p.month} p.day:${p.day} state.effectiveTime.value:${state.effectiveTime.value} state.selectEffectiveTime.value:${state.selectEffectiveTime.value}");
|
|
||||||
|
|
||||||
String time = '${p.hour!}:${p.minute!}';// 你的时分字符串
|
|
||||||
List<String> timeParts = time.split(":");
|
|
||||||
DateTime now = DateTime.now();
|
|
||||||
DateTime dateTime = DateTime(now.year, now.month, now.day, int.parse(timeParts[0]), int.parse(timeParts[1]));
|
|
||||||
int timestamp = dateTime.millisecondsSinceEpoch;
|
|
||||||
Get.log("timestamptimestamptimestamp:$timestamp");
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
Obx(() => CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
|
||||||
rightTitle: state.selectFailureTime.value,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
|
||||||
onConfirm: (p) {
|
|
||||||
state.isHaveFailureTime.value = true;
|
|
||||||
state.failureTime.value = XSDateUtils.parseDateTime(
|
|
||||||
'${p.hour!}:${p.minute!}', 'HH:mm');
|
|
||||||
state.selectFailureTime.value = XSDateUtils.formatDateTime(
|
|
||||||
state.failureTime.value, 'HH:mm');
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget bottomWidget() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Container(height: 40.h),
|
|
||||||
Obx(() => SubmitBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
isDisabled: (state.selectIndexList.value.isNotEmpty &&
|
|
||||||
state.isHaveEffectiveDate.value == true &&
|
|
||||||
state.isHaveFailureDate.value == true &&
|
|
||||||
state.isHaveEffectiveTime.value == true &&
|
|
||||||
state.isHaveFailureTime.value == true)
|
|
||||||
? true
|
|
||||||
: false,
|
|
||||||
onClick: () {
|
|
||||||
if ((state.selectIndexList.value.isNotEmpty &&
|
|
||||||
state.isHaveEffectiveDate.value == true &&
|
|
||||||
state.isHaveFailureDate.value == true)) {
|
|
||||||
DateTime startDateTime = DateTime(
|
|
||||||
state.effectiveDate.value.year,
|
|
||||||
state.effectiveDate.value.month,
|
|
||||||
state.effectiveDate.value.day,
|
|
||||||
state.effectiveDate.value.hour,
|
|
||||||
state.effectiveDate.value.minute);
|
|
||||||
DateTime endDateTime = DateTime(
|
|
||||||
state.failureDate.value.year,
|
|
||||||
state.failureDate.value.month,
|
|
||||||
state.failureDate.value.day,
|
|
||||||
state.failureDate.value.hour,
|
|
||||||
state.failureDate.value.minute);
|
|
||||||
//时间判断
|
|
||||||
if (!startDateTime.isBefore(endDateTime) ||
|
|
||||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
|
||||||
logic.showToast("失效时间需大于生效时间");
|
|
||||||
} else {
|
|
||||||
Map<String, dynamic> resultMap = {};
|
|
||||||
resultMap['validityValue'] = state.selectIndexList.value;
|
|
||||||
resultMap['starDate'] = state.effectiveDate.value;
|
|
||||||
resultMap['endDate'] = state.failureDate.value;
|
|
||||||
resultMap['starTime'] = state.effectiveTime.value;
|
|
||||||
resultMap['endTime'] = state.failureTime.value;
|
|
||||||
Navigator.pop(context, resultMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
import 'package:date_format/date_format.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
|
||||||
|
|
||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
|
||||||
|
|
||||||
class ElectronicKeyPeriodValidityState {
|
|
||||||
TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框
|
|
||||||
final keyInfo = LockListInfoItemEntity().obs;
|
|
||||||
// final lockMainEntity = LockMainEntity().obs;
|
|
||||||
var pageNum = 1.obs; //请求页码
|
|
||||||
final pageSize = 20.obs; //请求每页数据条数
|
|
||||||
final itemDataList = <ElectronicKeyListItem>[].obs;
|
|
||||||
|
|
||||||
final validityTextList = [
|
|
||||||
TranslationLoader.lanKeys!.sundayShort!.tr,
|
|
||||||
TranslationLoader.lanKeys!.mondayShort!.tr,
|
|
||||||
TranslationLoader.lanKeys!.tuesdayShort!.tr,
|
|
||||||
TranslationLoader.lanKeys!.wednesdayShort!.tr,
|
|
||||||
TranslationLoader.lanKeys!.thursdayShort!.tr,
|
|
||||||
TranslationLoader.lanKeys!.fridayShort!.tr,
|
|
||||||
TranslationLoader.lanKeys!.saturdayShort!.tr
|
|
||||||
].obs;
|
|
||||||
final validityDataList = [].obs; //自定义数据块
|
|
||||||
final selectIndexList = [].obs; //选中的有效期数组
|
|
||||||
|
|
||||||
DateTime dateTime = DateTime.now();
|
|
||||||
final effectiveDate = DateTime.now().obs;
|
|
||||||
final failureDate = DateTime.now().obs;
|
|
||||||
final selectEffectiveDate = ''.obs; //生效日期
|
|
||||||
final selectFailureDate = ''.obs; //失效日期
|
|
||||||
|
|
||||||
final selectEffectiveTime = ''.obs; //生效时间
|
|
||||||
final selectFailureTime = ''.obs; //失效时间
|
|
||||||
final effectiveTime = DateTime.now().obs;
|
|
||||||
final failureTime = DateTime.now().obs;
|
|
||||||
|
|
||||||
var isHaveEffectiveDate = false.obs;
|
|
||||||
var isHaveFailureDate = false.obs;
|
|
||||||
var isHaveEffectiveTime = false.obs;
|
|
||||||
var isHaveFailureTime = false.obs;
|
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import '../../../../../network/api_repository.dart';
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
import '../massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||||
|
import 'massSendElectronicKey_state.dart';
|
||||||
|
|
||||||
|
class MassSendElectronicKeyLogic extends BaseGetXController{
|
||||||
|
MassSendElectronicKeyState state = MassSendElectronicKeyState();
|
||||||
|
|
||||||
|
//群发钥匙检查
|
||||||
|
Future<void> massKeyChecksRequest() async {
|
||||||
|
String getFailureDateTime = '0';
|
||||||
|
if (int.parse(state.type.value) != 1) {
|
||||||
|
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.canSendKey(getFailureDateTime, state.lockIdList);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
for (int i = 0; i < state.receiverList.length; i++) {
|
||||||
|
LockUserData data = state.receiverList[i];
|
||||||
|
batchSendElectronicKeyRequest(data.userid ?? '');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showToast("检查失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//批处理群发钥匙
|
||||||
|
Future<void> batchSendElectronicKeyRequest(String receiverUserID) async {
|
||||||
|
String getFailureDateTime = '0';
|
||||||
|
String getEffectiveDateTime = '0';
|
||||||
|
if (state.type.value == '0') {
|
||||||
|
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
getEffectiveDateTime = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.batchSendKey(
|
||||||
|
endDate:getFailureDateTime,
|
||||||
|
keyGroupIdList:[],
|
||||||
|
lockIdList:state.lockIdList,
|
||||||
|
createUser:state.isCreateUser.value == true ? '1' : '0',
|
||||||
|
isRemoteUnlock:state.isRemoteUnlock.value ? '1' : '2',
|
||||||
|
keyNameForAdmin:receiverUserID,
|
||||||
|
receiverUsername:receiverUserID,
|
||||||
|
startDate:getEffectiveDateTime,
|
||||||
|
countryCode:state.countryCode.value,
|
||||||
|
usernameType:'1',
|
||||||
|
weekDays:state.weekdaysList);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print('群发电子钥匙成功');
|
||||||
|
state.isSendSuccess.value = true;
|
||||||
|
resetData();
|
||||||
|
} else {
|
||||||
|
showToast('${entity.errorMsg}');
|
||||||
|
if (entity.errorCode == 425) {
|
||||||
|
//用户未注册
|
||||||
|
state.isCreateUser.value = true;
|
||||||
|
batchSendElectronicKeyRequest(receiverUserID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetData() {
|
||||||
|
if(state.type.value == "0"){
|
||||||
|
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
|
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());//默认为当前时间
|
||||||
|
}else{
|
||||||
|
state.beginTime.value = ""; //默认为当前时间
|
||||||
|
state.endTime.value = "";//默认为当前时间
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,20 +1,19 @@
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/pickers.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/date_mode.dart';
|
||||||
|
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../../tools/commonItem.dart';
|
||||||
import '../../../../../tools/submitBtn.dart';
|
import '../../../../../../tools/submitBtn.dart';
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../../tools/storage.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
import 'massSendElectronicKey_logic.dart';
|
||||||
|
|
||||||
class MassSendElectronicKeyPage extends StatefulWidget {
|
class MassSendElectronicKeyPage extends StatefulWidget {
|
||||||
final String type;
|
final String type;
|
||||||
@ -28,43 +27,34 @@ class MassSendElectronicKeyPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
final logic = Get.put(MassSendElectronicKeyLogic());
|
||||||
late Contact _contact;
|
final state = Get.find<MassSendElectronicKeyLogic>().state;
|
||||||
var _selectEffectiveDate = ''; //生效时间
|
|
||||||
var _selectFailureDate = ''; //失效时间
|
@override
|
||||||
late DateTime _effectiveDateTime;
|
initState() {
|
||||||
late DateTime _failureDateTime;
|
super.initState();
|
||||||
late bool _isSendSuccess;
|
getDemoMode();
|
||||||
late bool _isRemote; //是否远程开锁
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
List _receiverList = []; //接受者列表
|
logic.resetData();
|
||||||
List _lockIdList = []; //选中的锁ID列表
|
});
|
||||||
String countryName = '中国';
|
}
|
||||||
String countryCode = '86';
|
|
||||||
List weekdaysList = [];
|
Future<void> getDemoMode() async {
|
||||||
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
state.isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return indexChangeWidget();
|
state.type.value = widget.type;
|
||||||
}
|
Get.log('state.type.value:${state.type.value}');
|
||||||
|
|
||||||
@override
|
return SingleChildScrollView(
|
||||||
void initState() {
|
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||||
super.initState();
|
);
|
||||||
|
|
||||||
DateTime dateTime = DateTime.now();
|
|
||||||
_effectiveDateTime = dateTime;
|
|
||||||
_failureDateTime = dateTime;
|
|
||||||
_selectEffectiveDate =
|
|
||||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
|
||||||
_selectFailureDate =
|
|
||||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
|
||||||
_isSendSuccess = false;
|
|
||||||
_isRemote = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
if (_isSendSuccess) {
|
if (state.isSendSuccess.value) {
|
||||||
return sendElectronicKeySucceed();
|
return sendElectronicKeySucceed();
|
||||||
} else {
|
} else {
|
||||||
switch (int.parse(widget.type)) {
|
switch (int.parse(widget.type)) {
|
||||||
@ -93,11 +83,11 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
// 单次
|
// 循环
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
periodValidityWidget(),
|
keyPeriodValidityWidget(),
|
||||||
remoteUnlockingWidget(),
|
remoteUnlockingWidget(),
|
||||||
keyBottomWidget()
|
keyBottomWidget()
|
||||||
],
|
],
|
||||||
@ -151,76 +141,22 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '完成',
|
btnName: '完成',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
_isSendSuccess = false;
|
state.isSendSuccess.value = false;
|
||||||
Navigator.pop(context, true);
|
Get.back();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//群发钥匙检查
|
|
||||||
Future<void> MassKeyChecksRequest() async {
|
|
||||||
String getFailureDateTime = '0';
|
|
||||||
if (int.parse(widget.type) != 1) {
|
|
||||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
|
||||||
}
|
|
||||||
var entity =
|
|
||||||
await ApiRepository.to.canSendKey(getFailureDateTime, _lockIdList);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
for (int i = 0; i < _receiverList.length; i++) {
|
|
||||||
LockUserData data = _receiverList[i];
|
|
||||||
batchSendElectronicKeyRequest(data.userid ?? '');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
EasyLoading.showToast("检查失败",duration: 2000.milliseconds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//批处理群发钥匙
|
|
||||||
Future<void> batchSendElectronicKeyRequest(String receiverUserID) async {
|
|
||||||
String getFailureDateTime = '0';
|
|
||||||
String getEffectiveDateTime = '0';
|
|
||||||
if (widget.type == '0') {
|
|
||||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
|
||||||
getEffectiveDateTime =
|
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
|
||||||
}
|
|
||||||
var entity = await ApiRepository.to.batchSendKey(
|
|
||||||
getFailureDateTime,
|
|
||||||
[],
|
|
||||||
_lockIdList,
|
|
||||||
_isCreateUser == true ? '1' : '0',
|
|
||||||
_isRemote ? '1' : '2',
|
|
||||||
receiverUserID,
|
|
||||||
receiverUserID,
|
|
||||||
getEffectiveDateTime,
|
|
||||||
countryCode,
|
|
||||||
'1',
|
|
||||||
weekdaysList);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print('群发电子钥匙成功');
|
|
||||||
_isSendSuccess = true;
|
|
||||||
setState(() {});
|
|
||||||
} else {
|
|
||||||
EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds);
|
|
||||||
if (entity.errorCode == 425) {
|
|
||||||
//用户未注册
|
|
||||||
_isCreateUser = true;
|
|
||||||
batchSendElectronicKeyRequest(receiverUserID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 顶部钥匙信息widget
|
// 顶部钥匙信息widget
|
||||||
Widget keyInfoWidget() {
|
Widget keyInfoWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(height: 10.h),
|
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
rightTitle: _receiverList.isEmpty
|
rightTitle: state.receiverList.isEmpty
|
||||||
? TranslationLoader.lanKeys!.pleaseAdd!.tr
|
? TranslationLoader.lanKeys!.pleaseAdd!.tr
|
||||||
: _receiverList.length.toString(),
|
: state.receiverList.length.toString(),
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -228,7 +164,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
.then((value) {
|
.then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
_receiverList = value['lockUserList'];
|
state.receiverList = value['lockUserList'];
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -241,27 +177,26 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
rightWidget: Text(
|
rightWidget: Text(
|
||||||
'$countryName +$countryCode',
|
'${state.countryName.value} +${state.countryCode.value}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style:
|
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
),
|
),
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.selectCountryRegionPage);
|
context, Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
countryCode = result['code'];
|
state.countryCode = result['code'];
|
||||||
countryName = result['countryName'];
|
state.countryName = result['countryName'];
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: _lockIdList.isEmpty
|
rightTitle: state.lockIdList.isEmpty
|
||||||
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
||||||
: _lockIdList.length.toString(),
|
: state.lockIdList.length.toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
||||||
@ -269,8 +204,8 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
//得到选中的锁ID列表
|
//得到选中的锁ID列表
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value as Map<String, dynamic>;
|
value as Map<String, dynamic>;
|
||||||
_lockIdList = value['selectLockIdList'];
|
state.lockIdList = value['selectLockIdList'];
|
||||||
print("_lockIdList:$_lockIdList");
|
print("_lockIdList:$state.lockIdList");
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -284,35 +219,27 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
Widget keyTimeWidget() {
|
Widget keyTimeWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: _selectEffectiveDate,
|
rightTitle: state.beginTime.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
_selectEffectiveDate =
|
});
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
})),
|
||||||
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
Obx(() => CommonItem(
|
||||||
});
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: _selectFailureDate,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
_selectFailureDate =
|
});
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
})),
|
||||||
_failureDateTime = DateTime.parse(_selectFailureDate);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -334,17 +261,82 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 有效期
|
// 有效期
|
||||||
Widget periodValidityWidget() {
|
Widget keyPeriodValidityWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
isHaveLine: true,
|
||||||
Navigator.pushNamed(
|
action: () async {
|
||||||
context, Routers.electronicKeyPeriodValidityPage);
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
}),
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日",
|
||||||
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.back(result: result);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -356,7 +348,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
MassKeyChecksRequest();
|
logic.massKeyChecksRequest();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -367,16 +359,13 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: _isRemote,
|
value: state.isRemoteUnlock.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isRemote = !_isRemote;
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class MassSendElectronicKeyState{
|
||||||
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
|
late Contact contact;
|
||||||
|
|
||||||
|
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||||
|
List receiverList = []; //接受者列表
|
||||||
|
List lockIdList = []; //选中的锁ID列表
|
||||||
|
|
||||||
|
var beginTime = "".obs; //默认为当前时间 开始时间
|
||||||
|
var endTime = "".obs;//默认为当前时间 结束时间
|
||||||
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
|
var failureDateTime = "".obs;// 失效时间
|
||||||
|
var weekdaysList = [].obs;
|
||||||
|
|
||||||
|
var type = ''.obs;// 限时、永久、单次、循环
|
||||||
|
var isSendSuccess = false.obs;
|
||||||
|
var countryName = '中国'.obs;
|
||||||
|
var countryCode = '86'.obs;
|
||||||
|
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||||
|
|
||||||
|
var isDemoMode = false;
|
||||||
|
final sendSucceedType = 0.obs;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,9 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import '../../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../../translations/trans_lib.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import 'massSendElectronicKeyManage_tabbar.dart';
|
import 'massSendElectronicKeyManage_tabbar.dart';
|
||||||
|
|
||||||
class MassSendElectronicKeyManagePage extends StatefulWidget {
|
class MassSendElectronicKeyManagePage extends StatefulWidget {
|
||||||
@ -2,9 +2,9 @@ import 'package:flutter/material.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 '../../../../../app_settings/app_colors.dart';
|
import '../../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
import '../../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../../translations/trans_lib.dart';
|
||||||
import '../massSendElectronicKey_page.dart';
|
import '../massSendElectronicKey_page.dart';
|
||||||
|
|
||||||
class MassSendElectronicKeyManageTabbar extends StatefulWidget {
|
class MassSendElectronicKeyManageTabbar extends StatefulWidget {
|
||||||
@ -6,6 +6,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -24,46 +25,40 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
DateTime startDateTime = DateTime(
|
|
||||||
state.effectiveDateTime.value.year,
|
|
||||||
state.effectiveDateTime.value.month,
|
|
||||||
state.effectiveDateTime.value.day,
|
|
||||||
state.effectiveDateTime.value.hour,
|
|
||||||
state.effectiveDateTime.value.minute);
|
|
||||||
DateTime endDateTime = DateTime(
|
|
||||||
state.failureDateTime.value.year,
|
|
||||||
state.failureDateTime.value.month,
|
|
||||||
state.failureDateTime.value.day,
|
|
||||||
state.failureDateTime.value.hour,
|
|
||||||
state.failureDateTime.value.minute);
|
|
||||||
|
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
if (state.type.value == "0" || state.type.value == "3") {
|
var startDate = "0";
|
||||||
print(
|
var endDate = "0";
|
||||||
"startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
|
var startTime = "0";
|
||||||
if (!startDateTime.isBefore(endDateTime) ||
|
var endTime = "0";
|
||||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
|
||||||
showToast("失效时间需大于生效时间");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!startDateTime.isBefore(DateTime.now()) ||
|
|
||||||
startDateTime.isAtSameMomentAs(DateTime.now())) {
|
|
||||||
showToast("生效时间需大于当前时间");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String lockID = state.keyInfo.value.lockId.toString();
|
String lockID = state.keyInfo.value.lockId.toString();
|
||||||
int typeValue = int.parse(state.type.value);
|
int typeValue = int.parse(state.type.value);
|
||||||
switch (typeValue) {
|
switch (typeValue) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
typeValue = XSConstantMacro.keyTypeTime;
|
typeValue = XSConstantMacro.keyTypeTime;
|
||||||
state.failureTimestamp.value =
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
state.failureDateTime.value.millisecondsSinceEpoch;
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
state.effectiveTimestamp.value =
|
startTime = "0";
|
||||||
state.effectiveDateTime.value.millisecondsSinceEpoch;
|
endTime = "0";
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
|
showToast("请选择开始时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (endDate.isEmpty) {
|
||||||
|
showToast("请选择结束时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(DateTime.now().millisecondsSinceEpoch > int.parse(state.beginTimeTimestamp.value)){
|
||||||
|
// Toast.show(msg: "生效时间要大于当前时间");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
|
showToast("失效时间要大于生效时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -74,6 +69,14 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
typeValue = XSConstantMacro.keyTypeLoop;
|
typeValue = XSConstantMacro.keyTypeLoop;
|
||||||
|
if (state.beginTime.value.isEmpty) {
|
||||||
|
showToast("请选择有效期");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
typeValue = XSConstantMacro.keyTypeTime;
|
typeValue = XSConstantMacro.keyTypeTime;
|
||||||
@ -87,7 +90,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
||||||
? '1'
|
? '1'
|
||||||
: '2',
|
: '2',
|
||||||
endDate: state.failureTimestamp.value,
|
endDate: int.parse(endDate),
|
||||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||||
isCameraEnable: '2',
|
isCameraEnable: '2',
|
||||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||||
@ -98,10 +101,11 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
operatorUid: '',
|
operatorUid: '',
|
||||||
receiverUsername: state.emailOrPhoneController.text,
|
receiverUsername: state.emailOrPhoneController.text,
|
||||||
remarks: '',
|
remarks: '',
|
||||||
startDate: state.effectiveTimestamp.value,
|
startDate: int.parse(startDate),
|
||||||
weekDays: state.weekdaysList.value,
|
weekDays: state.weekdaysList.value,
|
||||||
startTime: state.startTime.value,
|
startTime: int.parse(startTime),
|
||||||
endTime: state.endTime.value);
|
endTime: int.parse(endTime),
|
||||||
|
isOnlyManageSelf: 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
@ -212,11 +216,13 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
void resetData() {
|
void resetData() {
|
||||||
state.emailOrPhoneController.text = "";
|
state.emailOrPhoneController.text = "";
|
||||||
state.keyNameController.text = "";
|
state.keyNameController.text = "";
|
||||||
state.selectEffectiveDate =
|
if(state.type.value == "0"){
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
.obs; //默认为当前时间
|
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());//默认为当前时间
|
||||||
state.selectFailureDate =
|
}else{
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
state.beginTime.value = ""; //默认为当前时间
|
||||||
.obs; //默认为当前时间
|
state.endTime.value = "";//默认为当前时间
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,14 +8,15 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/dateUtils.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/pickers.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/date_mode.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../tools/NativeInteractionTool.dart';
|
import '../../../../../tools/NativeInteractionTool.dart';
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
import '../../../../../tools/submitBtn.dart';
|
import '../../../../../tools/submitBtn.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -35,8 +36,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getDemoMode();
|
getDemoMode();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
logic.resetData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getDemoMode() async {
|
Future<void> getDemoMode() async {
|
||||||
@ -46,6 +49,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
state.type.value = widget.type;
|
state.type.value = widget.type;
|
||||||
|
Get.log('state.type.value:${state.type.value}');
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||||
@ -118,7 +122,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
Widget keyInfoWidget() {
|
Widget keyInfoWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(height: 10.h),
|
// Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
@ -165,31 +169,23 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.selectEffectiveDate.value,
|
rightTitle: state.beginTime.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
|
||||||
'yyyy-MM-dd HH:mm');
|
|
||||||
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.effectiveDateTime.value, 'yyyy-MM-dd HH:mm');
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.selectFailureDate.value,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.failureDateTime.value = XSDateUtils.parseDateTime(
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
|
||||||
'yyyy-MM-dd HH:mm');
|
|
||||||
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.failureDateTime.value, 'yyyy-MM-dd HH:mm');
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -205,6 +201,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isTipsImg: true,
|
isTipsImg: true,
|
||||||
|
tipsImgAction: () {
|
||||||
|
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||||
|
},
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
width: 60.w, height: 50.h, child: _remoteSwitch(false)),
|
width: 60.w, height: 50.h, child: _remoteSwitch(false)),
|
||||||
@ -215,34 +214,83 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有效期
|
// 循环有效期
|
||||||
Widget keyPeriodValidityWidget() {
|
Widget keyPeriodValidityWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle: state.weekdaysList.value.isEmpty
|
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||||
? ''
|
|
||||||
: state.weekdaysList.value.join(','),
|
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
context, Routers.electronicKeyPeriodValidityPage);
|
arguments: {
|
||||||
if (result != null) {
|
'validityValue': state.weekdaysList.value,
|
||||||
result as Map<String, dynamic>;
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.effectiveTimestamp.value =
|
state.beginTime.value = result['starDate'];
|
||||||
result['starDate'].millisecondsSinceEpoch;
|
state.endTime.value = result['endDate'];
|
||||||
state.failureTimestamp.value =
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
result['endDate'].millisecondsSinceEpoch;
|
state.failureDateTime.value = result['endTime'];
|
||||||
state.startTime.value =
|
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||||
result['starTime'].millisecondsSinceEpoch;
|
|
||||||
state.endTime.value = result['endTime'].millisecondsSinceEpoch;
|
|
||||||
}
|
}
|
||||||
}),
|
})),
|
||||||
SizedBox(
|
Obx(() => Visibility(
|
||||||
height: 10.h,
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
)
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日",
|
||||||
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if(result != null && result.isNotEmpty){
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.back(result: result);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -269,33 +317,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (state.isDemoMode == false) {
|
if (state.isDemoMode == false) {
|
||||||
// DateTime startDateTime = DateTime(
|
|
||||||
// state.effectiveDateTime.value.year,
|
|
||||||
// state.effectiveDateTime.value.month,
|
|
||||||
// state.effectiveDateTime.value.day,
|
|
||||||
// state.effectiveDateTime.value.hour,
|
|
||||||
// state.effectiveDateTime.value.minute);
|
|
||||||
// DateTime endDateTime = DateTime(
|
|
||||||
// state.failureDateTime.value.year,
|
|
||||||
// state.failureDateTime.value.month,
|
|
||||||
// state.failureDateTime.value.day,
|
|
||||||
// state.failureDateTime.value.hour,
|
|
||||||
// state.failureDateTime.value.minute);
|
|
||||||
// //发送钥匙请求
|
|
||||||
// if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.text.isNotEmpty) {
|
|
||||||
// if (int.parse(widget.type) == 0) {
|
|
||||||
// if (!startDateTime.isBefore(endDateTime) ||
|
|
||||||
// startDateTime.isAtSameMomentAs(endDateTime)) {
|
|
||||||
// logic.showToast("失效时间需大于生效时间");
|
|
||||||
// } else {
|
|
||||||
// logic.sendElectronicKeyRequest();
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// logic.sendElectronicKeyRequest();
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// logic.showToast("请完善信息");
|
|
||||||
// }
|
|
||||||
logic.sendElectronicKeyRequest();
|
logic.sendElectronicKeyRequest();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
} else {
|
} else {
|
||||||
@ -527,6 +548,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
|
// isTipsImg: true,
|
||||||
|
// tipsImgAction: () {
|
||||||
|
// ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||||
|
// },
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
width: 60.w, height: 50.h, child: _remoteSwitch(true)),
|
width: 60.w, height: 50.h, child: _remoteSwitch(true)),
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../../tools/dateTool.dart';
|
||||||
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class SendElectronicKeyState {
|
class SendElectronicKeyState {
|
||||||
@ -14,26 +15,17 @@ class SendElectronicKeyState {
|
|||||||
|
|
||||||
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||||
final isAuthentication = false.obs; //是否可以实名认证
|
final isAuthentication = false.obs; //是否可以实名认证
|
||||||
DateTime dateTime = DateTime.now();
|
|
||||||
final effectiveDateTime = DateTime.now().obs;
|
|
||||||
final failureDateTime = DateTime.now().obs;
|
|
||||||
final effectiveTimestamp = 0.obs;
|
|
||||||
final failureTimestamp = 0.obs;
|
|
||||||
final startTime = 0.obs;
|
|
||||||
final endTime = 0.obs;
|
|
||||||
|
|
||||||
var selectEffectiveDate =
|
var beginTime = "".obs; //默认为当前时间 开始时间
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
var endTime = "".obs;//默认为当前时间 结束时间
|
||||||
.obs; //默认为当前时间
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
var selectFailureDate =
|
var failureDateTime = "".obs;// 失效时间
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
var weekdaysList = [].obs;
|
||||||
.obs; //默认为当前时间
|
|
||||||
|
|
||||||
var type = ''.obs;
|
var type = ''.obs;// 限时、永久、单次、循环
|
||||||
var isSendSuccess = false.obs;
|
var isSendSuccess = false.obs;
|
||||||
var countryName = '中国'.obs;
|
var countryName = '中国'.obs;
|
||||||
var countryCode = '86'.obs;
|
var countryCode = '86'.obs;
|
||||||
var weekdaysList = [].obs;
|
|
||||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||||
|
|
||||||
var isDemoMode = false;
|
var isDemoMode = false;
|
||||||
|
|||||||
@ -37,6 +37,22 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
final logic = Get.put(AddFingerprintTypeLogic());
|
final logic = Get.put(AddFingerprintTypeLogic());
|
||||||
final state = Get.find<AddFingerprintTypeLogic>().state;
|
final state = Get.find<AddFingerprintTypeLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if(state.selectType.value == "1"){
|
||||||
|
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
|
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());//默认为当前时间
|
||||||
|
}else{
|
||||||
|
state.beginTime.value = ""; //默认为当前时间
|
||||||
|
state.endTime.value = "";//默认为当前时间
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
state.selectType.value = widget.selectType;
|
state.selectType.value = widget.selectType;
|
||||||
@ -46,9 +62,6 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
}
|
}
|
||||||
state.fromType.value = widget.fromType;
|
state.fromType.value = widget.fromType;
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
// Your code here
|
|
||||||
});
|
|
||||||
return indexChangeWidget();
|
return indexChangeWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +169,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.beginTime.value = result['starDate'];
|
||||||
@ -174,7 +194,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.beginTime.value = result['starDate'];
|
||||||
@ -191,7 +218,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
|||||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage);
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.beginTime.value = result['starDate'];
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import '../../../../blue/io_tool/manager_event_bus.dart';
|
|||||||
import '../../../../blue/sender_manage.dart';
|
import '../../../../blue/sender_manage.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'fingerprintDetail_state.dart';
|
import 'fingerprintDetail_state.dart';
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功",something: (){
|
showToast("修改成功",something: (){
|
||||||
Get.back(result: "addScuess");
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,7 +183,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
}else if(state.keyType.value == 2){
|
}else if(state.keyType.value == 2){
|
||||||
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
} else if(state.keyType.value == 4){
|
} else if(state.keyType.value == 4){
|
||||||
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}";
|
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
}return useDateStr;
|
}return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -223,6 +223,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
|
state.typeName.value = state.changeNameController.text;
|
||||||
// 指纹
|
// 指纹
|
||||||
logic.editFingerprintsData();
|
logic.editFingerprintsData();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import '../../../../blue/blue_manage.dart';
|
|||||||
import '../../../../tools/EasyRefreshTool.dart';
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
import '../../../../tools/appRouteObserver.dart';
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/keySearchWidget.dart';
|
import '../../../../tools/keySearchWidget.dart';
|
||||||
import '../../../../tools/left_slide_actions.dart';
|
|
||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/showIosTipView.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
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:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@ -346,8 +347,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
openMode: 1,
|
openMode: 1,
|
||||||
keyType: 0,
|
keyType: 0,
|
||||||
startDate: DateTime.now().millisecondsSinceEpoch,
|
startDate: state.keyInfos.value.startDate!~/10000,
|
||||||
expireDate: 0x11223344,
|
expireDate: state.keyInfos.value.endDate!~/10000,
|
||||||
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
||||||
password: "123456",
|
password: "123456",
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
@ -405,8 +406,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
openMode: 1,
|
openMode: 1,
|
||||||
keyType: 0,
|
keyType: 0,
|
||||||
startDate: DateTime.now().millisecondsSinceEpoch,
|
startDate: state.keyInfos.value.startDate!~/10000,
|
||||||
expireDate: 0x11223344,
|
expireDate: state.keyInfos.value.endDate!~/10000,
|
||||||
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
||||||
password: "123456",
|
password: "123456",
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
@ -682,6 +683,25 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
|
if(state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce){
|
||||||
|
// 单次删除
|
||||||
|
deletKeyData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 普通用户或者授权管理员删除钥匙
|
||||||
|
void deletKeyData() async {
|
||||||
|
var entity = await ApiRepository.to.deleteElectronicKey(
|
||||||
|
keyId:state.keyInfos.value.keyId.toString(),
|
||||||
|
includeUnderlings: 0
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
BlueManage().connectDeviceMacAddress = "";
|
||||||
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
|
});
|
||||||
|
Get.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flutter/material.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:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
@ -242,11 +243,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// logic.getStarLockStatus();
|
// logic.getStarLockStatus();
|
||||||
showDeletAlertDialog(
|
ShowTipView().showSureAlertDialog("锁更新时间:${DateTool().dateToYMDHNString(state
|
||||||
context,
|
.keyInfos.value.electricQuantityDate!
|
||||||
DateTool().dateToYMDHNString(state
|
.toString())}");
|
||||||
.keyInfos.value.electricQuantityDate!
|
|
||||||
.toString()));
|
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
@ -912,24 +911,24 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
return formattedTime;
|
return formattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDeletAlertDialog(BuildContext context, String dateStr) {
|
// void showDeletAlertDialog(BuildContext context, String dateStr) {
|
||||||
showCupertinoDialog(
|
// showCupertinoDialog(
|
||||||
context: context,
|
// context: context,
|
||||||
builder: (context) {
|
// builder: (context) {
|
||||||
return CupertinoAlertDialog(
|
// return CupertinoAlertDialog(
|
||||||
content: Text('锁更新时间:$dateStr'),
|
// content: Text('锁更新时间:$dateStr'),
|
||||||
actions: [
|
// actions: [
|
||||||
CupertinoDialogAction(
|
// CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Get.back();
|
// Get.back();
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
startOpenLock() {
|
startOpenLock() {
|
||||||
// print("11111111");
|
// print("11111111");
|
||||||
|
|||||||
@ -11,6 +11,16 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 设置考勤创建公司
|
// 设置考勤创建公司
|
||||||
void setCheckInCreateCompany() async{
|
void setCheckInCreateCompany() async{
|
||||||
|
if(state.companyNameController.text.length > 50){
|
||||||
|
showToast("公司名称不能超过30个字符");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(state.companyNameController.text.length < 6){
|
||||||
|
showToast("公司名称不能小于6个字符");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var entity = await ApiRepository.to.setCheckInCreateCompanyData(
|
var entity = await ApiRepository.to.setCheckInCreateCompanyData(
|
||||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||||
attendanceType: state.isCustom.value ? "0" :"1",
|
attendanceType: state.isCustom.value ? "0" :"1",
|
||||||
@ -20,7 +30,9 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
|
|||||||
workStartTime: state.beginTimeTimestamp.value,
|
workStartTime: state.beginTimeTimestamp.value,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
setLockSetGeneralSetting();
|
showToast("创建成功", something: (){
|
||||||
|
setLockSetGeneralSetting();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -63,7 +64,7 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAwa
|
|||||||
// 接受者信息输入框
|
// 接受者信息输入框
|
||||||
Widget getTFWidget(String tfStr, TextEditingController controller) {
|
Widget getTFWidget(String tfStr, TextEditingController controller) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 50.h,
|
height: 65.h,
|
||||||
width: 300.w,
|
width: 300.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -71,17 +72,34 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAwa
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
// LengthLimitingTextInputFormatter(30),
|
||||||
|
],
|
||||||
controller: controller,
|
controller: controller,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
hintText: tfStr,
|
hintText: tfStr,
|
||||||
hintStyle: TextStyle(fontSize: 24.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
//不需要输入框下划线
|
focusedBorder: const OutlineInputBorder(
|
||||||
border: InputBorder.none,
|
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),
|
||||||
),
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
// import 'package:flutter_reactive_ble/flutter_reactive_ble.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:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
@ -33,6 +34,7 @@ class LockSoundSetLogic extends BaseGetXController {
|
|||||||
ifCanNext();
|
ifCanNext();
|
||||||
showToast("操作成功", something: (){
|
showToast("操作成功", something: (){
|
||||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||||
|
Get.back();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
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/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
||||||
@ -224,6 +225,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
keyboardType: inputController == state.inputNameController
|
keyboardType: inputController == state.inputNameController
|
||||||
? TextInputType.text
|
? TextInputType.text
|
||||||
: TextInputType.number,
|
: TextInputType.number,
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
LengthLimitingTextInputFormatter(inputController == state.inputNameController ? 50 : 9),
|
||||||
|
],
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if(inputController == state.inputPwdController){
|
if(inputController == state.inputPwdController){
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart';
|
||||||
|
|||||||
@ -545,13 +545,13 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
_openModalBottomSheet();
|
_openModalBottomSheet();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
// SizedBox(
|
||||||
height: 10.h,
|
// height: 10.h,
|
||||||
),
|
// ),
|
||||||
OutLineBtn(
|
// OutLineBtn(
|
||||||
btnName: '标记为:已入住',
|
// btnName: '标记为:已入住',
|
||||||
onClick: () {},
|
// onClick: () {},
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -569,7 +569,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: <TextInputFormatter>[
|
||||||
FilteringTextInputFormatter.deny('\n'),
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
LengthLimitingTextInputFormatter(editController == state.nameController ? 18 : 9),
|
LengthLimitingTextInputFormatter(editController == state.nameController ? 50 : 9),
|
||||||
],
|
],
|
||||||
keyboardType: editController == state.nameController ? TextInputType.text: TextInputType.number,
|
keyboardType: editController == state.nameController ? TextInputType.text: TextInputType.number,
|
||||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
|||||||
@ -71,9 +71,9 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
|
|||||||
width: 200.w,
|
width: 200.w,
|
||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: state.btnText.value,
|
btnName: state.btnText.value,
|
||||||
onClick: () {
|
onClick: state.canResend.value ? () {
|
||||||
logic.sendValidationCode();
|
logic.sendValidationCode();
|
||||||
},
|
} : null,
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@ -51,6 +51,9 @@ class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
|
|||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||||
rightSlot: GestureDetector(
|
rightSlot: GestureDetector(
|
||||||
|
onTap: state.canResend.value ?() {
|
||||||
|
logic.sendValidationCode();
|
||||||
|
} : null,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 180.w,
|
width: 180.w,
|
||||||
height: 90.h,
|
height: 90.h,
|
||||||
@ -65,9 +68,6 @@ class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
|
|||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
|
||||||
logic.sendValidationCode();
|
|
||||||
},
|
|
||||||
)))),
|
)))),
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
Obx(() => SubmitBtn(
|
Obx(() => SubmitBtn(
|
||||||
|
|||||||
@ -9,36 +9,36 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
|||||||
class PersonInfoEditAccountLogic extends BaseGetXController {
|
class PersonInfoEditAccountLogic extends BaseGetXController {
|
||||||
final PersonInfoEditAccountState state = PersonInfoEditAccountState();
|
final PersonInfoEditAccountState state = PersonInfoEditAccountState();
|
||||||
|
|
||||||
late Timer _timer;
|
// late Timer _timer;
|
||||||
void _startTimer() {
|
// void _startTimer() {
|
||||||
_timer = Timer.periodic(1.seconds, (timer) {
|
// _timer = Timer.periodic(1.seconds, (timer) {
|
||||||
if (state.currentSecond > 1) {
|
// if (state.currentSecond > 1) {
|
||||||
state.currentSecond--;
|
// state.currentSecond--;
|
||||||
} else {
|
// } else {
|
||||||
_cancelTimer();
|
// _cancelTimer();
|
||||||
state.currentSecond = state.totalSeconds;
|
// state.currentSecond = state.totalSeconds;
|
||||||
}
|
// }
|
||||||
state.resetResend();
|
// state.resetResend();
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
void _cancelTimer() {
|
// void _cancelTimer() {
|
||||||
_timer.cancel();
|
// _timer.cancel();
|
||||||
}
|
// }
|
||||||
|
|
||||||
//获取验证码请求
|
//获取验证码请求
|
||||||
void sendValidationCode() async {
|
// void sendValidationCode() async {
|
||||||
var entity = await ApiRepository.to.getValidationCodeAuth(
|
// var entity = await ApiRepository.to.getValidationCodeAuth(
|
||||||
state.countryCode.value,
|
// state.countryCode.value,
|
||||||
state.loginData.value.mobile!,
|
// state.loginData.value.mobile!,
|
||||||
state.channel.value,
|
// state.channel.value,
|
||||||
state.codeType.value,
|
// state.codeType.value,
|
||||||
state.uniqueid.value,
|
// state.uniqueid.value,
|
||||||
state.xWidth.value.toString());
|
// state.xWidth.value.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
_startTimer();
|
// _startTimer();
|
||||||
} else {}
|
// } else {}
|
||||||
}
|
// }
|
||||||
|
|
||||||
void checkNext(TextEditingController controller) {
|
void checkNext(TextEditingController controller) {
|
||||||
changeInput(controller);
|
changeInput(controller);
|
||||||
|
|||||||
@ -79,6 +79,11 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
|
|||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
if (state.accountIsOK.value && state.canResend.value) {
|
||||||
|
logic.sendValidationCode();
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 180.w,
|
width: 180.w,
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
@ -97,11 +102,6 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
|
|||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
|
||||||
if (state.accountIsOK.value) {
|
|
||||||
logic.sendValidationCode();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class _LockItemListPageState extends State<LockItemListPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.lock!.tr,
|
barTitle: groupListItem.keyGroupName ?? '',
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
actionsList: (lockList.isNotEmpty && groupListItem.groupType != 0) ? [
|
actionsList: (lockList.isNotEmpty && groupListItem.groupType != 0) ? [
|
||||||
IconButton(
|
IconButton(
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// 处理操作按钮的点击事件-添加锁分组
|
// 处理操作按钮的点击事件-添加锁分组
|
||||||
|
state.changeNameController.text = "";
|
||||||
showCupertinoAlertDialog(context, true, 0);
|
showCupertinoAlertDialog(context, true, 0);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -123,7 +124,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title: TranslationLoader.lanKeys!.createNewGroup!.tr,
|
title: isAdd ? TranslationLoader.lanKeys!.createNewGroup!.tr : "修改名称",
|
||||||
tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
controller: state.changeNameController,
|
controller: state.changeNameController,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
@ -182,7 +183,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.edit!.tr,
|
"重命名",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@ -200,7 +201,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowIosTipView(
|
return ShowIosTipView(
|
||||||
title: TranslationLoader.lanKeys!.hint!.tr,
|
title: TranslationLoader.lanKeys!.hint!.tr,
|
||||||
tipTitle: TranslationLoader.lanKeys!.areYouSureYouWantToDeleteIt!.tr,
|
tipTitle: "分组下的锁将被移到未分组里",
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
|
logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
|
||||||
|
|||||||
@ -1,120 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_entity.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/commonItem.dart';
|
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
class ExpireLockChangeDatePage extends StatefulWidget {
|
|
||||||
const ExpireLockChangeDatePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ExpireLockChangeDatePage> createState() =>
|
|
||||||
_ExpireLockChangeDatePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ExpireLockChangeDatePageState extends State<ExpireLockChangeDatePage> {
|
|
||||||
ExpireLockItem itemData = ExpireLockItem();
|
|
||||||
|
|
||||||
String _selectEffectiveDate = ''; //生效时间
|
|
||||||
String _selectFailureDate = ''; //失效时间
|
|
||||||
late DateTime _effectiveDateTime;
|
|
||||||
late DateTime _failureDateTime;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["itemData"] != null)) {
|
|
||||||
itemData = obj["itemData"];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle:
|
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.periodValidity!.tr}",
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor,
|
|
||||||
actionsList: [
|
|
||||||
TextButton(
|
|
||||||
child: Text(
|
|
||||||
TranslationLoader.lanKeys!.sure!.tr,
|
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
updateKeyDateRequest();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: buildMainUI(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildMainUI() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
|
||||||
rightTitle: _selectEffectiveDate,
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
|
||||||
onConfirm: (p) {
|
|
||||||
setState(() {
|
|
||||||
_selectEffectiveDate =
|
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
|
||||||
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
|
||||||
rightTitle: _selectFailureDate,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
|
||||||
onConfirm: (p) {
|
|
||||||
setState(() {
|
|
||||||
_selectFailureDate =
|
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
|
||||||
_failureDateTime = DateTime.parse(_selectFailureDate);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//修改有效期请求
|
|
||||||
Future<void> updateKeyDateRequest() async {
|
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
|
||||||
itemData.keyId.toString(),
|
|
||||||
itemData.lockId.toString(),
|
|
||||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
[],
|
|
||||||
itemData.keyType!);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("修改要是名称成功啦啦啦啦啦");
|
|
||||||
EasyLoading.showToast('修改成功', duration: 2000.milliseconds);
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? "0$v" : "$v";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -93,6 +93,7 @@ class ExpireLockItem {
|
|||||||
String? nickname2;
|
String? nickname2;
|
||||||
String? headUrl;
|
String? headUrl;
|
||||||
String? userid;
|
String? userid;
|
||||||
|
int? isOnlyManageSelf;
|
||||||
|
|
||||||
ExpireLockItem(
|
ExpireLockItem(
|
||||||
{this.clientId,
|
{this.clientId,
|
||||||
@ -123,7 +124,8 @@ class ExpireLockItem {
|
|||||||
this.expireDate,
|
this.expireDate,
|
||||||
this.nickname2,
|
this.nickname2,
|
||||||
this.headUrl,
|
this.headUrl,
|
||||||
this.userid});
|
this.userid,
|
||||||
|
this.isOnlyManageSelf});
|
||||||
|
|
||||||
ExpireLockItem.fromJson(Map<String, dynamic> json) {
|
ExpireLockItem.fromJson(Map<String, dynamic> json) {
|
||||||
clientId = json['clientId'];
|
clientId = json['clientId'];
|
||||||
@ -161,6 +163,7 @@ class ExpireLockItem {
|
|||||||
nickname2 = json['nickname2'];
|
nickname2 = json['nickname2'];
|
||||||
headUrl = json['headUrl'];
|
headUrl = json['headUrl'];
|
||||||
userid = json['userid'];
|
userid = json['userid'];
|
||||||
|
isOnlyManageSelf = json['isOnlyManageSelf'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -198,6 +201,7 @@ class ExpireLockItem {
|
|||||||
data['nickname2'] = nickname2;
|
data['nickname2'] = nickname2;
|
||||||
data['headUrl'] = headUrl;
|
data['headUrl'] = headUrl;
|
||||||
data['userid'] = userid;
|
data['userid'] = userid;
|
||||||
|
data['isOnlyManageSelf'] = isOnlyManageSelf;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import 'expireLockList_entity.dart';
|
import 'expireLockList_entity.dart';
|
||||||
@ -28,12 +29,13 @@ class ExpireLockListLogic extends BaseGetXController{
|
|||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
String getExpireDateStr(ExpireLockItem itemData) {
|
String getExpireDateStr(ExpireLockItem itemData) {
|
||||||
DateTime startDateStr =
|
String useDateStr = '';
|
||||||
DateTime.fromMillisecondsSinceEpoch(itemData.startDate!);
|
if(itemData.keyType == 4){
|
||||||
DateTime endDateStr =
|
useDateStr = '循环';
|
||||||
DateTime.fromMillisecondsSinceEpoch(itemData.endDate!);
|
}else{
|
||||||
String useDateStr =
|
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||||
'${startDateStr.toLocal().toString().substring(0, 10)}-${endDateStr.toLocal().toString().substring(0, 10)}';
|
}
|
||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -77,9 +77,39 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
|
|
||||||
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
Navigator.pushNamed(context, Routers.expireLockChangeDatePage,
|
if(itemData.keyType! == 4){
|
||||||
arguments: {"itemData": itemData});
|
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"expireLockItem": itemData,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
// setState(() {
|
||||||
|
// state.starDate.value = data["starDate"];
|
||||||
|
// state.endDate.value = data["endDate"];
|
||||||
|
// state.starTime.value = data["starTime"];
|
||||||
|
// state.endTime.value = data["endTime"];
|
||||||
|
// state.weekDay.value = data["validityValue"];
|
||||||
|
// });
|
||||||
|
logic.pageNo = 1;
|
||||||
|
getHttpData();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"expireLockItem": itemData,
|
||||||
|
});
|
||||||
|
if(data != null) {
|
||||||
|
setState(() {
|
||||||
|
// state.starDate.value = data["beginTimeTimestamp"].toString();
|
||||||
|
// state.endDate.value = data["endTimeTimestamp"].toString();
|
||||||
|
// state.keyType.value = 2;
|
||||||
|
logic.pageNo = 1;
|
||||||
|
getHttpData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Get.toNamed(Routers.expireLockChangeDatePage, arguments: {"itemData": itemData});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 90.h,
|
height: 90.h,
|
||||||
@ -135,7 +165,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
),
|
),
|
||||||
itemData.expireDate! > 0
|
itemData.expireDate! > 0
|
||||||
? Container(
|
? Container(
|
||||||
padding: EdgeInsets.only(left: 2.w, right: 2.w),
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.expireTextBgColor,
|
color: AppColors.expireTextBgColor,
|
||||||
borderRadius: BorderRadius.circular(2.0),
|
borderRadius: BorderRadius.circular(2.0),
|
||||||
@ -146,7 +176,18 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
|||||||
color: Colors.white, fontSize: 13.sp),
|
color: Colors.white, fontSize: 13.sp),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container()
|
: Container(
|
||||||
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.red,
|
||||||
|
borderRadius: BorderRadius.circular(2.0),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'已过期',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white, fontSize: 13.sp),
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.h),
|
SizedBox(width: 20.h),
|
||||||
|
|||||||
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../lockUserManageList/keyListByUserEntity.dart';
|
||||||
|
import 'ownedKeyList_state.dart';
|
||||||
|
|
||||||
|
class OwnedKeyListLogic extends BaseGetXController {
|
||||||
|
OwnedKeyListState state = OwnedKeyListState();
|
||||||
|
|
||||||
|
//请求用户拥有的锁
|
||||||
|
Future<List<KeyListItem>> mockNetworkDataRequest() async {
|
||||||
|
KeyListByUserEntity entity = await ApiRepository.to.keyListByUser('1', '20', state.getUidStr);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("请求用户拥有的锁:${entity.data!.keyList}");
|
||||||
|
}
|
||||||
|
if (entity.data != null) {
|
||||||
|
return entity.data!.keyList!;
|
||||||
|
} else {
|
||||||
|
List<KeyListItem> dataList = [];
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//使用期限
|
||||||
|
String getUseDateStr(KeyListItem indexEntity) {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||||
|
//限期
|
||||||
|
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
} else {
|
||||||
|
useDateStr = '限期';
|
||||||
|
}
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||||
|
//永久
|
||||||
|
useDateStr = '永久';
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
|
//单次
|
||||||
|
useDateStr = '单次';
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||||
|
//循环
|
||||||
|
useDateStr = '循环';
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_utils/get_utils.dart';
|
import 'package:get/get_utils/get_utils.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart';
|
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart';
|
||||||
@ -9,6 +10,7 @@ import 'package:star_lock/translations/trans_lib.dart';
|
|||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
import 'ownedKeyList_logic.dart';
|
||||||
|
|
||||||
class OwnedKeyListPage extends StatefulWidget {
|
class OwnedKeyListPage extends StatefulWidget {
|
||||||
const OwnedKeyListPage({Key? key}) : super(key: key);
|
const OwnedKeyListPage({Key? key}) : super(key: key);
|
||||||
@ -18,8 +20,8 @@ class OwnedKeyListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||||
String getUidStr = '';
|
final logic = Get.put(OwnedKeyListLogic());
|
||||||
List dataList = [];
|
final state = Get.find<OwnedKeyListLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -28,11 +30,6 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["uid"] != null)) {
|
|
||||||
getUidStr = obj["uid"].toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -41,7 +38,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
|||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
body: FutureBuilder<List<KeyListItem>>(
|
body: FutureBuilder<List<KeyListItem>>(
|
||||||
future: mockNetworkDataRequest(),
|
future: logic.mockNetworkDataRequest(),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<List<KeyListItem>> snapshot) {
|
AsyncSnapshot<List<KeyListItem>> snapshot) {
|
||||||
//请求结束
|
//请求结束
|
||||||
@ -83,50 +80,6 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求用户拥有的锁
|
|
||||||
Future<List<KeyListItem>> mockNetworkDataRequest() async {
|
|
||||||
KeyListByUserEntity entity =
|
|
||||||
await ApiRepository.to.keyListByUser('1', '20', getUidStr);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("请求用户拥有的锁:${entity.data!.keyList}");
|
|
||||||
}
|
|
||||||
if (entity.data != null) {
|
|
||||||
return entity.data!.keyList!;
|
|
||||||
} else {
|
|
||||||
List<KeyListItem> dataList = [];
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//使用期限
|
|
||||||
String getUseDateStr(KeyListItem indexEntity) {
|
|
||||||
String useDateStr = '';
|
|
||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
|
||||||
//限期
|
|
||||||
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
|
||||||
DateTime startDateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
|
||||||
DateTime endDateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
|
||||||
useDateStr =
|
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
|
||||||
} else {
|
|
||||||
useDateStr = '限期';
|
|
||||||
}
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
|
||||||
//永久
|
|
||||||
useDateStr = '永久';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
|
||||||
//单次
|
|
||||||
useDateStr = '单次';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
|
||||||
//循环
|
|
||||||
useDateStr = '循环';
|
|
||||||
}
|
|
||||||
|
|
||||||
return useDateStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMainUI(List itemList) {
|
Widget _buildMainUI(List itemList) {
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: itemList.length,
|
itemCount: itemList.length,
|
||||||
@ -148,17 +101,9 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(width: 30.w,),
|
||||||
width: 30.w,
|
Image.asset('images/icon_lockGroup_item.png', width: 60.w, height: 60.w),
|
||||||
),
|
SizedBox(width: 20.w),
|
||||||
Image.asset(
|
|
||||||
'images/icon_lockGroup_item.png',
|
|
||||||
width: 60.w,
|
|
||||||
height: 60.w,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 20.w,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -166,11 +111,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(itemData.lockAlias ?? '', style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)),
|
||||||
itemData.lockAlias ?? '',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 24.sp, color: AppColors.blackColor),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
@ -178,10 +119,8 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
getUseDateStr(itemData),
|
logic.getUseDateStr(itemData),
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
||||||
fontSize: 18.sp,
|
|
||||||
color: AppColors.placeholderTextColor),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class OwnedKeyListState{
|
||||||
|
|
||||||
|
var getUidStr = '';
|
||||||
|
var dataList = [].obs;
|
||||||
|
|
||||||
|
OwnedKeyListState(){
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if ((map["uid"] != null)) {
|
||||||
|
getUidStr = map["uid"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.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/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart';
|
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart';
|
||||||
@ -144,10 +145,21 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
GestureDetector(
|
||||||
'images/icon_addressBook.png',
|
onTap: () async {
|
||||||
width: 28.w,
|
Contact? currentContact = await state.contactPicker.selectContact();
|
||||||
height: 28.h,
|
state.contact = currentContact!;
|
||||||
|
if (currentContact.phoneNumbers!.isNotEmpty) {
|
||||||
|
state.numberController.text = currentContact
|
||||||
|
.phoneNumbers![0]
|
||||||
|
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
'images/icon_addressBook.png',
|
||||||
|
width: 28.w,
|
||||||
|
height: 28.h,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 40.w,
|
width: 40.w,
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class RecipientInformationState{
|
class RecipientInformationState{
|
||||||
var type = 1.obs;// 1、个人用户 2、星寓用户
|
var type = 1.obs;// 1、个人用户 2、星寓用户
|
||||||
final TextEditingController numberController = TextEditingController();
|
final TextEditingController numberController = TextEditingController();
|
||||||
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
|
late Contact contact;
|
||||||
|
|
||||||
final countryName = "中国".obs;
|
final countryName = "中国".obs;
|
||||||
final countryCode = "86".obs;
|
final countryCode = "86".obs;
|
||||||
|
|||||||
@ -38,6 +38,10 @@ abstract class Api {
|
|||||||
final String getLockSettingURL = '/lock/getLockSettingData'; // 获取所有锁设置信息
|
final String getLockSettingURL = '/lock/getLockSettingData'; // 获取所有锁设置信息
|
||||||
final String deletLockURL = '/lock/delete'; // 删除锁
|
final String deletLockURL = '/lock/delete'; // 删除锁
|
||||||
final String checkPasswordURL = '/user/checkPassword'; // 检查账户密码
|
final String checkPasswordURL = '/user/checkPassword'; // 检查账户密码
|
||||||
|
final String setAuthorizeURL = '/key/authorize'; //设置授权管理员
|
||||||
|
final String cancelAuthorizeURL = '/key/unauthorize'; //取消授权管理员
|
||||||
|
final String cancelFreezeURL = '/key/unfreeze'; //取消冻结
|
||||||
|
final String freezeKeyURL = '/key/freeze'; //冻结
|
||||||
|
|
||||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||||
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
||||||
|
|||||||
@ -141,7 +141,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
int startDate,
|
int startDate,
|
||||||
List weekDays,
|
List weekDays,
|
||||||
int startTime,
|
int startTime,
|
||||||
int endTime) =>
|
int endTime,
|
||||||
|
int isOnlyManageSelf) =>
|
||||||
post(
|
post(
|
||||||
sendElectronicKeyURL.toUrl,
|
sendElectronicKeyURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -162,7 +163,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'weekDays': weekDays,
|
'weekDays': weekDays,
|
||||||
'startTime': startTime,
|
'startTime': startTime,
|
||||||
'endTime': endTime
|
'endTime': endTime,
|
||||||
|
'isOnlyManageSelf': isOnlyManageSelf,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> uploadElectricQuantity(
|
Future<Response> uploadElectricQuantity(
|
||||||
@ -202,8 +204,17 @@ class ApiProvider extends BaseProvider {
|
|||||||
'operatorUid': operatorUid,
|
'operatorUid': operatorUid,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> updateKeyDate(String keyId, String lockId, String endDate,
|
Future<Response> updateKeyDate(
|
||||||
String startDate, List weekDays, int keyType) =>
|
String keyId,
|
||||||
|
String lockId,
|
||||||
|
String endDate,
|
||||||
|
String startDate,
|
||||||
|
List weekDays,
|
||||||
|
int keyType,
|
||||||
|
int startTime,
|
||||||
|
int endTime,
|
||||||
|
int isOnlyManageSelf,
|
||||||
|
int remoteEnable) =>
|
||||||
post(
|
post(
|
||||||
updateKeyDateURL.toUrl,
|
updateKeyDateURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -212,7 +223,11 @@ class ApiProvider extends BaseProvider {
|
|||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'weekDays': weekDays,
|
'weekDays': weekDays,
|
||||||
'keyType': keyType
|
'keyType': keyType,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
|
'isOnlyManageSelf': isOnlyManageSelf,
|
||||||
|
'remoteEnable': remoteEnable,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||||
@ -512,8 +527,13 @@ class ApiProvider extends BaseProvider {
|
|||||||
Future<Response> setAppUnlockMustOnline(List lockIdList) => post(
|
Future<Response> setAppUnlockMustOnline(List lockIdList) => post(
|
||||||
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
|
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
|
||||||
|
|
||||||
Future<Response> deleteElectronicKey(String keyId) =>
|
Future<Response> deleteElectronicKey(String keyId, int includeUnderlings) =>
|
||||||
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
|
post(
|
||||||
|
deleteElectronicKeyURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
'includeUnderlings': includeUnderlings,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> deleteAdministrator(String uid, String includeUnderlings) =>
|
Future<Response> deleteAdministrator(String uid, String includeUnderlings) =>
|
||||||
post(deleteElectronicKeyURL.toUrl,
|
post(deleteElectronicKeyURL.toUrl,
|
||||||
@ -531,6 +551,34 @@ class ApiProvider extends BaseProvider {
|
|||||||
'remoteEnable': remoteEnable
|
'remoteEnable': remoteEnable
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 设置授权管理员
|
||||||
|
Future<Response> setAdministrator(String keyId) => post(
|
||||||
|
setAuthorizeURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 取消授权管理员
|
||||||
|
Future<Response> cancelAdministrator(String keyId) => post(
|
||||||
|
cancelAuthorizeURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 冻结
|
||||||
|
Future<Response> freezeKey(String keyId) => post(
|
||||||
|
freezeKeyURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 取消冻结
|
||||||
|
Future<Response> cancelFreeze(String keyId) => post(
|
||||||
|
cancelFreezeURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> expireLockList(String pageNo, String pageSize) => post(
|
Future<Response> expireLockList(String pageNo, String pageSize) => post(
|
||||||
expireLockListURL.toUrl,
|
expireLockListURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
|
|||||||
@ -159,7 +159,8 @@ class ApiRepository {
|
|||||||
required int startDate,
|
required int startDate,
|
||||||
required List weekDays,
|
required List weekDays,
|
||||||
required int startTime,
|
required int startTime,
|
||||||
required int endTime}) async {
|
required int endTime,
|
||||||
|
required int isOnlyManageSelf}) async {
|
||||||
final res = await apiProvider.sendElectronicKey(
|
final res = await apiProvider.sendElectronicKey(
|
||||||
createUser,
|
createUser,
|
||||||
countryCode,
|
countryCode,
|
||||||
@ -178,7 +179,8 @@ class ApiRepository {
|
|||||||
startDate,
|
startDate,
|
||||||
weekDays,
|
weekDays,
|
||||||
startTime,
|
startTime,
|
||||||
endTime);
|
endTime,
|
||||||
|
isOnlyManageSelf);
|
||||||
return AuthorizedAdminSendEntity.fromJson(res.body);
|
return AuthorizedAdminSendEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,10 +332,21 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//编辑电子钥匙有效期
|
//编辑电子钥匙有效期
|
||||||
Future<KeyOperationRecordEntity> updateKeyDate(String keyId, String lockId,
|
Future<KeyOperationRecordEntity> updateKeyDate(
|
||||||
String endDate, String startDate, List weekDays, int keyType) async {
|
{
|
||||||
|
required String keyId,
|
||||||
|
required String lockId,
|
||||||
|
required String endDate,
|
||||||
|
required String startDate,
|
||||||
|
required List weekDays,
|
||||||
|
required int keyType,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime,
|
||||||
|
required int isOnlyManageSelf,
|
||||||
|
required int remoteEnable
|
||||||
|
}) async {
|
||||||
final res = await apiProvider.updateKeyDate(
|
final res = await apiProvider.updateKeyDate(
|
||||||
keyId, lockId, endDate, startDate, weekDays, keyType);
|
keyId, lockId, endDate, startDate, weekDays, keyType, startTime, endTime, isOnlyManageSelf, remoteEnable);
|
||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,8 +534,12 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除电子钥匙
|
//删除电子钥匙
|
||||||
Future<ElectronicKeyListEntity> deleteElectronicKey(String keyId) async {
|
Future<ElectronicKeyListEntity> deleteElectronicKey(
|
||||||
final res = await apiProvider.deleteElectronicKey(keyId);
|
{
|
||||||
|
required String keyId,
|
||||||
|
required int includeUnderlings
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.deleteElectronicKey(keyId, includeUnderlings);
|
||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,6 +562,30 @@ class ApiRepository {
|
|||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置授权管理员
|
||||||
|
Future<ElectronicKeyListEntity> setAdministrator({required String keyId}) async {
|
||||||
|
final res = await apiProvider.setAdministrator(keyId);
|
||||||
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消授权管理员
|
||||||
|
Future<ElectronicKeyListEntity> cancelAdministrator({required String keyId}) async {
|
||||||
|
final res = await apiProvider.cancelAdministrator(keyId);
|
||||||
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//冻结
|
||||||
|
Future<ElectronicKeyListEntity> freezeKey({required String keyId}) async {
|
||||||
|
final res = await apiProvider.freezeKey(keyId);
|
||||||
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消冻结
|
||||||
|
Future<ElectronicKeyListEntity> cancelFreeze({required String keyId}) async {
|
||||||
|
final res = await apiProvider.cancelFreeze(keyId);
|
||||||
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//即将到期的锁列表
|
//即将到期的锁列表
|
||||||
Future<ExpireLockListEntity> expireLockList(
|
Future<ExpireLockListEntity> expireLockList(
|
||||||
String pageNo, String pageSize) async {
|
String pageNo, String pageSize) async {
|
||||||
@ -788,17 +829,19 @@ class ApiRepository {
|
|||||||
|
|
||||||
//群发电子钥匙
|
//群发电子钥匙
|
||||||
Future<KeyDetailEntity> batchSendKey(
|
Future<KeyDetailEntity> batchSendKey(
|
||||||
String endDate,
|
{
|
||||||
List keyGroupIdList,
|
required String endDate,
|
||||||
List lockIdList,
|
required List keyGroupIdList,
|
||||||
String createUser,
|
required List lockIdList,
|
||||||
String isRemoteUnlock,
|
required String createUser,
|
||||||
String keyNameForAdmin,
|
required String isRemoteUnlock,
|
||||||
String receiverUsername,
|
required String keyNameForAdmin,
|
||||||
String startDate,
|
required String receiverUsername,
|
||||||
String countryCode,
|
required String startDate,
|
||||||
String usernameType,
|
required String countryCode,
|
||||||
List weekDays) async {
|
required String usernameType,
|
||||||
|
required List weekDays
|
||||||
|
}) async {
|
||||||
final res = await apiProvider.batchSendKey(
|
final res = await apiProvider.batchSendKey(
|
||||||
endDate,
|
endDate,
|
||||||
keyGroupIdList,
|
keyGroupIdList,
|
||||||
|
|||||||
@ -10,6 +10,7 @@ class CommonItem extends StatelessWidget {
|
|||||||
bool? isHaveRightWidget;
|
bool? isHaveRightWidget;
|
||||||
Widget? rightWidget;
|
Widget? rightWidget;
|
||||||
Function()? action;
|
Function()? action;
|
||||||
|
Function()? tipsImgAction;
|
||||||
double? allHeight;
|
double? allHeight;
|
||||||
bool? isTipsImg;
|
bool? isTipsImg;
|
||||||
|
|
||||||
@ -23,7 +24,8 @@ class CommonItem extends StatelessWidget {
|
|||||||
this.isHaveRightWidget = false,
|
this.isHaveRightWidget = false,
|
||||||
this.rightWidget,
|
this.rightWidget,
|
||||||
this.isTipsImg,
|
this.isTipsImg,
|
||||||
this.action})
|
this.action,
|
||||||
|
this.tipsImgAction})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,11 +48,19 @@ class CommonItem extends StatelessWidget {
|
|||||||
child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp))),
|
child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp))),
|
||||||
SizedBox(width: 6.w),
|
SizedBox(width: 6.w),
|
||||||
isTipsImg == true
|
isTipsImg == true
|
||||||
? Image.asset(
|
? GestureDetector(
|
||||||
'images/icon_tips_Q.png',
|
onTap: tipsImgAction,
|
||||||
width: 20.w,
|
child: Container(
|
||||||
height: 20.w,
|
width: 50.h,
|
||||||
)
|
height: 50.h,
|
||||||
|
padding: EdgeInsets.only(right:10.h, top: 15.h, bottom: 10.h),
|
||||||
|
child: Image.asset(
|
||||||
|
'images/icon_tips_Q.png',
|
||||||
|
width: 20.w,
|
||||||
|
height: 20.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
Expanded(child: SizedBox(width: 10.w)),
|
Expanded(child: SizedBox(width: 10.w)),
|
||||||
Row(
|
Row(
|
||||||
|
|||||||
@ -1,30 +1,31 @@
|
|||||||
|
|
||||||
import 'package:date_format/date_format.dart';
|
import 'package:date_format/date_format.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import 'pickers/time_picker/model/pduration.dart';
|
import 'pickers/time_picker/model/pduration.dart';
|
||||||
|
|
||||||
class DateTool {
|
class DateTool {
|
||||||
|
|
||||||
/// 获取当前年月日时分秒
|
/// 获取当前年月日时分秒
|
||||||
String getNowDateYMDHM(){
|
// String getNowDateYMDHM(){
|
||||||
// 获取当前时间对象
|
// // 获取当前时间对象
|
||||||
DateTime now = DateTime.now();
|
// DateTime now = DateTime.now();
|
||||||
//获取当前时间的年
|
// //获取当前时间的年
|
||||||
int year = now.year;
|
// int year = now.year;
|
||||||
//获取当前时间的月
|
// //获取当前时间的月
|
||||||
int month = now.month;
|
// int month = now.month;
|
||||||
//获取当前时间的日
|
// //获取当前时间的日
|
||||||
int day = now.day;
|
// int day = now.day;
|
||||||
//获取当前时间的时
|
// //获取当前时间的时
|
||||||
int hour = now.hour;
|
// int hour = now.hour;
|
||||||
//获取当前时间的分
|
// //获取当前时间的分
|
||||||
int minute = now.minute;
|
// int minute = now.minute;
|
||||||
//获取当前时间的秒
|
// //获取当前时间的秒
|
||||||
int millisecond = now.millisecond;
|
// int millisecond = now.millisecond;
|
||||||
|
//
|
||||||
// print("组合 $year-$month-$day $hour:$minute:$millisecond");
|
// // print("组合 $year-$month-$day $hour:$minute:$millisecond");
|
||||||
return "$year.$month.$day $hour:$minute";
|
// return "$year-$month-$day $hour:$minute";
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// 将时间戳传化为年月日时分秒 (年.月.日 时:分)
|
/// 将时间戳传化为年月日时分秒 (年.月.日 时:分)
|
||||||
// String dateToYMDHNStringWithDot(String timestamp){
|
// String dateToYMDHNStringWithDot(String timestamp){
|
||||||
@ -82,13 +83,14 @@ class DateTool {
|
|||||||
|
|
||||||
/// 将时间戳传化为年月日 (年-月-日 时:分)
|
/// 将时间戳传化为年月日 (年-月-日 时:分)
|
||||||
String dateToYMDHNString(String timestamp){
|
String dateToYMDHNString(String timestamp){
|
||||||
|
// Get.log('dateToYMDHNString timestamp: $timestamp');
|
||||||
int time = int.parse(timestamp);
|
int time = int.parse(timestamp);
|
||||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd,' ',HH,':',nn]);
|
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd,' ',HH,':',nn]);
|
||||||
return appointmentDate;
|
return appointmentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 将时间戳传化为年月日 (年.月.日)
|
/// 将时间戳传化为年月日 (年-月-日)
|
||||||
String dateToYMDString(String timestamp){
|
String dateToYMDString(String timestamp){
|
||||||
int time = int.parse(timestamp);
|
int time = int.parse(timestamp);
|
||||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
@ -101,6 +103,7 @@ class DateTool {
|
|||||||
int time = int.parse(timestamp);
|
int time = int.parse(timestamp);
|
||||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
String appointmentDate = formatDate(nowDate, [HH,':',nn]);
|
String appointmentDate = formatDate(nowDate, [HH,':',nn]);
|
||||||
|
// Get.log('timestamp:$timestamp dateToHNString appointmentDate: $appointmentDate');
|
||||||
return appointmentDate;
|
return appointmentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,8 +115,7 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
|
|||||||
height: 100.h,
|
height: 100.h,
|
||||||
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
|
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 7, childAspectRatio: 1.0),
|
||||||
crossAxisCount: 7, childAspectRatio: 1.0),
|
|
||||||
itemCount: 7,
|
itemCount: 7,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
|||||||
@ -9,4 +9,23 @@ class SeletKeyCyclicDateState{
|
|||||||
var endTime = "".obs;// 失效时间
|
var endTime = "".obs;// 失效时间
|
||||||
|
|
||||||
var weekDay = [].obs;
|
var weekDay = [].obs;
|
||||||
|
|
||||||
|
SeletKeyCyclicDateState() {
|
||||||
|
var map = Get.arguments;
|
||||||
|
if ((map["starDate"] != null)) {
|
||||||
|
starDate.value = map["starDate"];
|
||||||
|
}
|
||||||
|
if ((map["endDate"] != null)) {
|
||||||
|
endDate.value = map["endDate"];
|
||||||
|
}
|
||||||
|
if ((map["starTime"] != null)) {
|
||||||
|
starTime.value = map["starTime"];
|
||||||
|
}
|
||||||
|
if ((map["endTime"] != null)) {
|
||||||
|
endTime.value = map["endTime"];
|
||||||
|
}
|
||||||
|
if ((map["validityValue"] != null)) {
|
||||||
|
weekDay.value = map["validityValue"];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
||||||
|
typedef BlockIsHaveAllDataCallback = void Function(bool isAllData);
|
||||||
|
|
||||||
|
class ShowDeleteAdministratorIsHaveAllDataWidget extends StatefulWidget {
|
||||||
|
BlockIsHaveAllDataCallback? blockIsHaveAllDataCallback;
|
||||||
|
|
||||||
|
ShowDeleteAdministratorIsHaveAllDataWidget({Key? key, this.blockIsHaveAllDataCallback}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ShowDeleteAdministratorIsHaveAllDataWidget> createState() => _ShowDeleteAdministratorIsHaveAllDataWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ShowDeleteAdministratorIsHaveAllDataWidgetState extends State<ShowDeleteAdministratorIsHaveAllDataWidget> {
|
||||||
|
bool selet = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selet = !selet;
|
||||||
|
widget.blockIsHaveAllDataCallback!(selet);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
selet ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
)),
|
||||||
|
SizedBox(width: 15.w,),
|
||||||
|
Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复', maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -32,17 +32,18 @@ class ShowTFView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Container(
|
||||||
|
height: 60.h,
|
||||||
color: const Color(0x00FFFFFF),
|
color: const Color(0x00FFFFFF),
|
||||||
child: CupertinoAlertDialog(
|
child: CupertinoAlertDialog(
|
||||||
title: Text(title!),
|
title: Text(title!),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(
|
// const SizedBox(
|
||||||
height: 10,
|
// height: 10,
|
||||||
),
|
// ),
|
||||||
Container(
|
Container(
|
||||||
height: 50.h,
|
height: 60.h,
|
||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
// padding: EdgeInsets.only(left:20.w, right: 110.w),
|
// padding: EdgeInsets.only(left:20.w, right: 110.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|||||||
96
star_lock/lib/tools/showTipView.dart
Normal file
96
star_lock/lib/tools/showTipView.dart
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../translations/trans_lib.dart';
|
||||||
|
import 'showDeleteAdministratorIsHaveAllDataWidget.dart';
|
||||||
|
|
||||||
|
typedef BlockIsHaveAllDataCallback = void Function(bool isAllData);
|
||||||
|
|
||||||
|
class ShowTipView {
|
||||||
|
|
||||||
|
void showSureAlertDialog(String contentStr) {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
content: Text(contentStr),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 授权管理员调用删除数据
|
||||||
|
void showDeleteAdministratorIsHaveAllDataDialog(BlockIsHaveAllDataCallback blockIsHaveAllDataCallback) {
|
||||||
|
bool selet = false;
|
||||||
|
showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: const Text("提示"),
|
||||||
|
content: SizedBox(
|
||||||
|
// height: 100.h,
|
||||||
|
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
||||||
|
blockIsHaveAllDataCallback: (a){
|
||||||
|
selet = a;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.delete!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
blockIsHaveAllDataCallback(selet);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showDeleteKeyDataDialogDialog(Function sureClick) {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
content: const Text("删除钥匙会在用户APP连网后生效"),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
sureClick();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -23,7 +23,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# 1.0.18+20240321(2024032101):打包给欧阳测试
|
# 1.0.18+20240321(2024032101):打包给欧阳测试
|
||||||
# 1.0.20+2024032102:修复Apple Store App Tracking Transparency权限问题
|
# 1.0.20+2024032102:修复Apple Store App Tracking Transparency权限问题
|
||||||
# 1.0.21+2024032801:同为斯凯环境也区分删减版和完整版,通过main_sky_lite.dart/main_sky_full.dart切换
|
# 1.0.21+2024032801:同为斯凯环境也区分删减版和完整版,通过main_sky_lite.dart/main_sky_full.dart切换
|
||||||
version: 1.0.21+2024032801
|
# 1.0.21+2024032802:1、打包斯凯、预发布环境给欧阳测试
|
||||||
|
version: 1.0.21+2024032802
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user