1、修改TAPDbug。2、打包斯凯环境给欧阳测试
This commit is contained in:
parent
c2a6591dd7
commit
8d02ae463f
@ -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">
|
||||
<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" />
|
||||
<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_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 |
@ -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/administratorDetails_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/mineSet/mineSet_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/checkingInSetStaffList/checkingInStaffList_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/addFaceType/addFaceTypeManage/addFaceTypeManage_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/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_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/sendEmailNotification/sendEmailNotification_page.dart';
|
||||
import 'main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart';
|
||||
@ -922,9 +921,6 @@ abstract class AppRouters {
|
||||
GetPage(
|
||||
name: Routers.lockAddressGaoDePage,
|
||||
page: () => const LockAddressGaoDePage()),
|
||||
GetPage(
|
||||
name: Routers.expireLockChangeDatePage,
|
||||
page: () => const ExpireLockChangeDatePage()),
|
||||
GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()),
|
||||
GetPage(
|
||||
name: Routers.minePersonInfoViewSafetyProblemPage,
|
||||
|
||||
@ -37,7 +37,8 @@ class XSConstantMacro {
|
||||
static String getKeyStatusStr(int keyStatus){
|
||||
switch(keyStatus){
|
||||
case 110401:
|
||||
return "正常使用";
|
||||
// 正常使用
|
||||
return "";
|
||||
case 110402:
|
||||
return "待接收";
|
||||
case 110403:
|
||||
|
||||
@ -180,7 +180,7 @@ class _StarLockForgetPasswordPageState
|
||||
width: 10.w,
|
||||
),
|
||||
Obx(() => GestureDetector(
|
||||
onTap: state.phoneStrIsOK.value
|
||||
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
||||
? () async {
|
||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||
var result = await Navigator.pushNamed(
|
||||
|
||||
@ -41,8 +41,14 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
TranslationLoader.lanKeys!.register!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, Routers.starLockRegisterPage);
|
||||
onPressed: () async {
|
||||
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);
|
||||
// Toast.show(msg: "注册成功");
|
||||
showToast("注册成功");
|
||||
Get.back();
|
||||
} else {}
|
||||
Get.back(result:{
|
||||
"phoneOrEmailStr":state.phoneOrEmailStr.value,
|
||||
"pwd":state.pwd.value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void sendValidationCode() async {
|
||||
|
||||
@ -289,7 +289,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
width: 20.w,
|
||||
),
|
||||
Obx(() => GestureDetector(
|
||||
onTap: state.phoneOrEmailStrIsOK.value
|
||||
onTap: state.phoneOrEmailStrIsOK.value && state.canResend.value
|
||||
? () async {
|
||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||
var result = await Navigator.pushNamed(
|
||||
|
||||
@ -2,10 +2,10 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.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:star_lock/appRouters.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 '../../../../blue/blue_manage.dart';
|
||||
@ -237,39 +237,32 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
return;
|
||||
}
|
||||
|
||||
// String getFailureDateTime = '0';
|
||||
// String getEffectiveDateTime = '0';
|
||||
var startDate = "0";
|
||||
var endDate = "0";
|
||||
var startTime = "0";
|
||||
var endTime = "0";
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
Get.log("state.type.value:${state.type.value}");
|
||||
String getKeyType = "1";
|
||||
if (state.type.value == '0') {
|
||||
getKeyType = "2";
|
||||
// getFailureDateTime =
|
||||
// state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||
// getEffectiveDateTime =
|
||||
// state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||
|
||||
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 (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
startDate = DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
|
||||
if (startDate.isEmpty) {
|
||||
showToast("请选择开始时间");
|
||||
return;
|
||||
}
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!startDateTime.isBefore(DateTime.now()) ||
|
||||
startDateTime.isAtSameMomentAs(DateTime.now())) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -278,7 +271,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
createUser: state.isCreateUser.value ? "1" : "0",
|
||||
countryCode: state.countryCode.value,
|
||||
usernameType: '1',
|
||||
endDate: state.failureDateTime.value.millisecondsSinceEpoch,
|
||||
endDate: int.parse(endDate),
|
||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||
isCameraEnable: '2',
|
||||
isRemoteUnlock: '2',
|
||||
@ -289,12 +282,14 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
operatorUid: '',
|
||||
receiverUsername: state.emailOrPhoneController.text,
|
||||
remarks: '',
|
||||
startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
|
||||
startDate: int.parse(startDate),
|
||||
weekDays: state.weekdaysList,
|
||||
startTime: state.startTime.value,
|
||||
endTime: state.endTime.value);
|
||||
startTime: int.parse(startTime),
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
state.isCreateUser.value = false;
|
||||
state.isSendSuccess.value = true;
|
||||
// Toast.show(msg: "添加成功");
|
||||
state.addUserId.value = entity.data!.receiverUser!.id.toString();
|
||||
@ -310,22 +305,11 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
|
||||
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||
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(
|
||||
lockId: state.keyInfo.value.lockId!,
|
||||
roomStatus: 1,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("标记为已入住成功啦啦啦啦啦");
|
||||
showToast("标记成功");
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,11 +4,12 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.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 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
@ -81,7 +82,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
Widget keyInfoWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: "",
|
||||
@ -129,34 +129,25 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.selectEffectiveDate.value,
|
||||
rightTitle: state.beginDate.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
|
||||
'${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');
|
||||
state.beginDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.selectFailureDate.value,
|
||||
rightTitle: state.endDate.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
state.failureDateTime.value = XSDateUtils.parseDateTime(
|
||||
'${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');
|
||||
state.endDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
});
|
||||
}),
|
||||
@ -169,9 +160,23 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
Widget keyRealNameWidget() {
|
||||
return Column(
|
||||
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(
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
||||
action: () {}),
|
||||
@ -315,12 +320,12 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '标记为:已入住',
|
||||
onClick: () {
|
||||
logic.updateRoomCheckIn();
|
||||
},
|
||||
),
|
||||
// OutLineBtn(
|
||||
// btnName: '标记为:已入住',
|
||||
// onClick: () {
|
||||
// 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 {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
@ -17,19 +18,10 @@ class AuthorizedAdminState {
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final lockMainEntity = LockMainEntity().obs;
|
||||
final isAuthentication = false.obs; //是否可以实名认证
|
||||
DateTime dateTime = DateTime.now();
|
||||
final effectiveDateTime = DateTime.now().obs;
|
||||
final failureDateTime = DateTime.now().obs;
|
||||
final onlyManageYouCreatesUser = false.obs; // 只能管理自己创建的用户
|
||||
|
||||
var selectEffectiveDate =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
.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 beginDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs; //默认为当前时间 开始时间
|
||||
var endDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//默认为当前时间 结束时间
|
||||
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.obs;
|
||||
|
||||
@ -243,7 +243,10 @@ class _AuthorizedAdminDetailPageState extends State<AuthorizedAdminDetailPage> {
|
||||
//删除电子钥匙名称请求
|
||||
Future<void> deleteKeyRequest(String keyId) async {
|
||||
ElectronicKeyListEntity entity =
|
||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
||||
await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:keyId,
|
||||
includeUnderlings: 0
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
EasyLoading.showToast("删除成功",duration: 2000.milliseconds);
|
||||
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 =
|
||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
||||
await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:keyId,
|
||||
includeUnderlings: includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功");
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -107,7 +108,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
useDateStr = getUseDateStr(indexEntity);
|
||||
|
||||
//钥匙状态
|
||||
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
||||
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||
|
||||
//是否为管理钥匙
|
||||
bool isAdminKey = false;
|
||||
@ -125,7 +126,9 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
showIosTipViewDialog(context, indexEntity.keyId!.toString());
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
||||
logic.deleteKeyRequest(indexEntity.keyId.toString(), isAllData ? 1 : 0);
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
@ -135,8 +138,10 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
|
||||
arguments: {"itemData": indexEntity}).then((val) {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage, arguments: {
|
||||
"itemData": indexEntity,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
@ -184,24 +189,24 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
));
|
||||
}
|
||||
|
||||
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();
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
// 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) {
|
||||
@ -235,28 +240,28 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
}
|
||||
|
||||
//钥匙状态
|
||||
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 = '已重置';
|
||||
}
|
||||
|
||||
return keyStatus;
|
||||
}
|
||||
// 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 = '已重置';
|
||||
// }
|
||||
//
|
||||
// return keyStatus;
|
||||
// }
|
||||
|
||||
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
||||
String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
||||
|
||||
@ -46,12 +46,25 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
}
|
||||
state.fromType.value = widget.fromType;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// Your code here
|
||||
});
|
||||
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() {
|
||||
switch (int.parse(widget.selectType)) {
|
||||
case 0:
|
||||
@ -156,7 +169,14 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
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){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
@ -174,7 +194,14 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
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){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
@ -191,7 +218,14 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
isHaveDirection: true,
|
||||
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){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
|
||||
@ -10,6 +10,8 @@ class AddCardTypeState{
|
||||
final isStressFingerprint = 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 endTime = "".obs;// 结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
|
||||
@ -6,6 +6,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_addICCard.dart';
|
||||
@ -154,7 +155,7 @@ class CardDetailLogic extends BaseGetXController{
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
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)}";
|
||||
} else if(state.keyType.value == 4){
|
||||
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}";
|
||||
}return useDateStr;
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -316,6 +316,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
state.typeName.value = state.changeNameController.text;
|
||||
logic.editICCardData();
|
||||
},
|
||||
cancelClick: () {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
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 'otherTypeKeyChangeDate_state.dart';
|
||||
|
||||
@ -10,8 +11,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
|
||||
// 修改指纹信息
|
||||
void editFingerprintsData() async{
|
||||
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
|
||||
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
|
||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000;
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000;
|
||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
@ -25,8 +26,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.fingerprintItemData.value.weekDay!,
|
||||
startDate: state.beginTimeTimestamp.value.toString(),
|
||||
endDate: state.endTimeTimestamp.value.toString(),
|
||||
startDate: beginTimeTimestamp.toString(),
|
||||
endDate: endTimeTimestamp.toString(),
|
||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||
changeType: "1",
|
||||
@ -38,8 +39,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
showToast("修改成功", something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||
"beginTimeTimestamp":beginTimeTimestamp.toString(),
|
||||
"endTimeTimestamp":endTimeTimestamp.toString(),
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -47,8 +48,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
|
||||
// 编辑iC卡
|
||||
void editICCardData() async{
|
||||
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
|
||||
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
|
||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000;
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000;
|
||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
@ -63,8 +64,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.fingerprintItemData.value.weekDay!,
|
||||
startDate: state.beginTimeTimestamp.value.toString(),
|
||||
endDate: state.endTimeTimestamp.value.toString(),
|
||||
startDate: beginTimeTimestamp.toString(),
|
||||
endDate: endTimeTimestamp.toString(),
|
||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||
cardName: state.fingerprintItemData.value.cardName!,
|
||||
changeType: '1',
|
||||
@ -75,8 +76,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功", something: (){
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||
"beginTimeTimestamp":beginTimeTimestamp.toString(),
|
||||
"endTimeTimestamp":endTimeTimestamp.toString(),
|
||||
});
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
});
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
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:get/get.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
@ -78,7 +76,6 @@ class _OtherTypeKeyChangeDatePageState
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
});
|
||||
});
|
||||
})),
|
||||
@ -91,7 +88,6 @@ class _OtherTypeKeyChangeDatePageState
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
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 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遥控
|
||||
|
||||
@ -20,15 +17,6 @@ class OtherTypeKeyChangeDateState{
|
||||
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){
|
||||
// getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间
|
||||
// // state.selectEffectiveDate.value = getStartDate;
|
||||
@ -36,13 +24,9 @@ class OtherTypeKeyChangeDateState{
|
||||
|
||||
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||
endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||
beginTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch;
|
||||
endTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch;
|
||||
}else{
|
||||
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
||||
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
||||
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
|
||||
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,12 +94,12 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
"checkingInSetInfo": state.checkingInSetInfo.value,
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
// state.isCustom.value = data["attendanceType"];
|
||||
// state.weekDays.value = data["weekDays"];
|
||||
// state.weekDaysStr.value = state.weekDays.value.join(",");
|
||||
logic.getCheckInSetInfoData();
|
||||
});
|
||||
print("data: $data");
|
||||
state.isCustom.value = data["attendanceType"];
|
||||
state.weekDays.value = data["weekDays"];
|
||||
state.weekDaysStr.value = state.weekDays.value.join(",");
|
||||
// logic.getCheckInSetInfoData();
|
||||
setState(() {});
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
|
||||
@ -20,8 +20,9 @@ class CheckingInSetWorkTimeLogic extends BaseGetXController{
|
||||
workDay:state.checkingInSetInfo.value.workDay!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Get.back(result: "scuess");
|
||||
// Toast.show(msg: "修改成功");
|
||||
showToast("修改成功", something: (){
|
||||
Get.back(result: "scuess");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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/time_picker/model/date_mode.dart';
|
||||
|
||||
@ -48,13 +49,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
DateTime today = DateTime.now();
|
||||
state.beginTimeTimestamp.value = DateTime.parse(
|
||||
'${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')}";
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 0).toString();
|
||||
});
|
||||
});
|
||||
})),
|
||||
@ -66,13 +62,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
DateTime today = DateTime.now();
|
||||
state.endTimeTimestamp.value = DateTime.parse(
|
||||
'${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')}";
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 0).toString();
|
||||
});
|
||||
});
|
||||
})),
|
||||
@ -96,7 +87,7 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||
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("结束时间必须要比开始时间晚,请重新选择");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -19,8 +19,12 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
||||
workDay:state.weekDays.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Get.back(result: "scuess");
|
||||
// Toast.show(msg: "修改成功");
|
||||
showToast("修改成功", something: (){
|
||||
Get.back(result: {
|
||||
"attendanceType":state.isCustom.value,
|
||||
"weekDays":state.weekDays.value,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
||||
action: (){
|
||||
setState(() {
|
||||
state.isSingledayWeekend.value = 1;
|
||||
state.weekDays.value = [6, 7];
|
||||
state.weekDays.value = [1, 2 , 3, 4, 5];
|
||||
});
|
||||
},
|
||||
rightWidget: Row(
|
||||
|
||||
@ -12,7 +12,7 @@ class CheckingInSetWorkdaySetState{
|
||||
final checkingInSetInfo = CheckingInSetInfo().obs;
|
||||
final companyId = "".obs;
|
||||
|
||||
var pushType = "".obs;// 2考勤设置信息选择时间 1考勤创建公司
|
||||
var pushType = "".obs;// 2考勤设置信息 1考勤创建公司
|
||||
|
||||
CheckingInSetWorkdaySetState() {
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -30,6 +30,11 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
usernameType = "2";
|
||||
}
|
||||
|
||||
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
|
||||
if(state.appUnHaveAccount.value && state.selectPrintingMethodType.value == "1"){
|
||||
state.attendanceWayNumber.value = state.staffAccountController.text;
|
||||
}
|
||||
|
||||
var entity = await ApiRepository.to.addStaffData(
|
||||
attendanceType: state.selectPrintingMethodType.value,
|
||||
attendanceWay: state.attendanceWayNumber.value,
|
||||
|
||||
@ -136,69 +136,70 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
children: [
|
||||
Obx(() => Text(state.attendanceWayNumber.value, style: TextStyle(fontSize: 24.sp))),
|
||||
SizedBox(width: 30.w),
|
||||
SizedBox(
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
child: Text(addStaffSelectKeyType(),
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 22.sp)),
|
||||
onPressed: () async {
|
||||
switch (int.parse(
|
||||
state.selectPrintingMethodType.value)) {
|
||||
case 2:
|
||||
// 获取密码
|
||||
logic.getKeyboardPwdRequest();
|
||||
break;
|
||||
case 3:
|
||||
// 卡
|
||||
if (state.staffNameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名");
|
||||
return;
|
||||
}
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
switch (int.parse(state.selectPrintingMethodType.value)) {
|
||||
case 2:
|
||||
// 获取密码
|
||||
logic.getKeyboardPwdRequest();
|
||||
break;
|
||||
case 3:
|
||||
// 卡
|
||||
if (state.staffNameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名");
|
||||
return;
|
||||
}
|
||||
|
||||
var data = await Get.toNamed(
|
||||
Routers.addCardTypeManagePage,
|
||||
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: {
|
||||
var data = await Get.toNamed(
|
||||
Routers.addCardTypeManagePage,
|
||||
arguments: {
|
||||
"lockId": state.getKeyInfosData.value.lockId,
|
||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
"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!;
|
||||
|
||||
selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString();
|
||||
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
|
||||
switch(staffListItemData.value.attendanceType){
|
||||
case 1:
|
||||
selectPrintingMethodStr.value = "APP";
|
||||
@ -60,8 +59,12 @@ class CheckingInAddStaffState{
|
||||
}
|
||||
|
||||
if(staffListItemData.value.attendanceWay!.isNotEmpty){
|
||||
appUnHaveAccount.value = false;
|
||||
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
|
||||
if(staffListItemData.value.cardStatus != 0){
|
||||
appUnHaveAccount.value = false;
|
||||
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
|
||||
}else{
|
||||
appUnHaveAccount.value = true;
|
||||
}
|
||||
}else{
|
||||
appUnHaveAccount.value = true;
|
||||
}
|
||||
|
||||
@ -55,10 +55,21 @@ class _CheckingInStaffDetailPageState extends State<CheckingInStaffDetailPage> {
|
||||
leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr,
|
||||
rightTitle: state.attendanceType.value,
|
||||
isHaveLine: true)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "APP",
|
||||
rightTitle: state.staffListItemData.value.attendanceWay,
|
||||
isHaveLine: true)),
|
||||
// Obx(() => CommonItem(
|
||||
// leftTitel: "APP",
|
||||
// rightTitle: state.staffListItemData.value.attendanceWay,
|
||||
// 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(
|
||||
leftTitel: TranslationLoader.lanKeys!.attendanceRecord!.tr,
|
||||
rightTitle: "",
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
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/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/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../../tools/jh_pop_menus.dart';
|
||||
import '../../../../../tools/showTipView.dart';
|
||||
|
||||
class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
final ElectronicKeyDetailState state = ElectronicKeyDetailState();
|
||||
@ -30,10 +35,33 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//删除电子钥匙名称请求
|
||||
Future<void> deleteKeyRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||
.deleteElectronicKey(state.itemData.value.keyId.toString());
|
||||
//编辑电子钥匙有效期请求
|
||||
Future<void> updateKeyDateRequest() async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||
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) {
|
||||
print("删除电子钥匙成功");
|
||||
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_screenutil/flutter_screenutil.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/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
@ -21,8 +19,7 @@ class ElectronicKeyDetailPage extends StatefulWidget {
|
||||
const ElectronicKeyDetailPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ElectronicKeyDetailPage> createState() =>
|
||||
_ElectronicKeyDetailPageState();
|
||||
State<ElectronicKeyDetailPage> createState() => _ElectronicKeyDetailPageState();
|
||||
}
|
||||
|
||||
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
@ -37,27 +34,20 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.keyDetail!.tr,
|
||||
haveBack: true,
|
||||
actionsList: [
|
||||
actionsList: (state.keyType.value!=3) ? [
|
||||
IconButton(
|
||||
icon: Image.asset(
|
||||
'images/icon_bar_more.png',
|
||||
height: 30.h,
|
||||
width: 10.w,
|
||||
),
|
||||
onPressed: () {
|
||||
JhPopMenus.showLinePop(context,
|
||||
clickCallback: (index, selText) {
|
||||
print('选中index: $index');
|
||||
print('选中text: $selText');
|
||||
}, listData: [
|
||||
{'text': '冻结'},
|
||||
{'text': '取消授权'}
|
||||
]);
|
||||
},
|
||||
onPressed: state.keyType.value != 3 ? () {
|
||||
logic.showPopMenus();
|
||||
} : null,
|
||||
),
|
||||
],
|
||||
]:null,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
body: ListView(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||
@ -67,23 +57,130 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
action: () {
|
||||
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),
|
||||
CommonItem(
|
||||
leftTitel: "接收者",
|
||||
rightTitle: state.itemData.value.username ?? "",
|
||||
action: () {}),
|
||||
rightTitle: state.itemData.value.username ?? ""),
|
||||
const SizedBox(height: 1),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||
rightTitle: state.itemData.value.senderUsername ?? "",
|
||||
action: () {}),
|
||||
rightTitle: state.itemData.value.senderUsername ?? ""),
|
||||
const SizedBox(height: 1),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
||||
rightTitle: getSenderDate(state.itemData.value) ?? "",
|
||||
action: () {}),
|
||||
rightTitle: DateTool().dateToYMDHNString(
|
||||
state.itemData.value.sendDate.toString())),
|
||||
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(
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
@ -92,8 +189,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
width: 60.w,
|
||||
child: _switch(state.itemData.value.faceAuthentication == 1
|
||||
? true
|
||||
: false)),
|
||||
action: () {}),
|
||||
: false))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
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),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
showIosTipViewDialog(context);
|
||||
logic.deletKeyLogic();
|
||||
}),
|
||||
],
|
||||
),
|
||||
@ -123,139 +219,147 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
}
|
||||
|
||||
//根据类型获取限时有效期样式
|
||||
Widget getPeriodValidityWidget() {
|
||||
int? dateType = state.itemData.value.keyType;
|
||||
if (dateType == XSConstantMacro.keyTypeLong) {
|
||||
return getLongTypeDateWidget();
|
||||
} else if (dateType == XSConstantMacro.keyTypeTime) {
|
||||
return getTimeLimitTypeDateWidget();
|
||||
} else if (dateType == XSConstantMacro.keyTypeOnce) {
|
||||
return getOnceTypeDateWidget();
|
||||
} else if (dateType == XSConstantMacro.keyTypeLoop) {
|
||||
return getLoopTypeDateWidget();
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
|
||||
//永久钥匙
|
||||
Widget getLongTypeDateWidget() {
|
||||
return CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: '永久',
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
|
||||
arguments: {"itemData": state.itemData.value});
|
||||
});
|
||||
}
|
||||
|
||||
//限时钥匙
|
||||
Widget getTimeLimitTypeDateWidget() {
|
||||
return CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
allHeight: 90.h,
|
||||
rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate,
|
||||
arguments: {"itemData": state.itemData.value});
|
||||
if (data != null) {
|
||||
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
||||
state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
||||
state.beginTime.value = DateTool()
|
||||
.dateToYMDHNString((state.beginTimeTimestamp.value*1000).toString());
|
||||
state.endTime.value = DateTool()
|
||||
.dateToYMDHNString((state.endTimeTimestamp.value*1000).toString());
|
||||
// print("state.beginTime.value:${state.beginTime.value}"
|
||||
// "state.endTime.value:${state.endTime.value}"
|
||||
// "state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"
|
||||
// "state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//单次钥匙
|
||||
Widget getOnceTypeDateWidget() {
|
||||
return CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: '单次',
|
||||
isHaveDirection: false,
|
||||
);
|
||||
}
|
||||
|
||||
//循环钥匙
|
||||
Widget getLoopTypeDateWidget() {
|
||||
DateTime startDateStr =
|
||||
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)}';
|
||||
|
||||
List getEffectiveDateList = [];
|
||||
List weekDaysList = state.itemData.value.weekDays!;
|
||||
if (weekDaysList.isNotEmpty) {
|
||||
String effectiveDateStr = '';
|
||||
for (int i = 0; i < weekDaysList.length; i++) {
|
||||
if (weekDaysList[i] == 1) {
|
||||
effectiveDateStr = '一';
|
||||
getEffectiveDateList.add(effectiveDateStr);
|
||||
} else if (weekDaysList[i] == 2) {
|
||||
effectiveDateStr = '二';
|
||||
getEffectiveDateList.add(effectiveDateStr);
|
||||
} else if (weekDaysList[i] == 3) {
|
||||
effectiveDateStr = '三';
|
||||
getEffectiveDateList.add(effectiveDateStr);
|
||||
} else if (weekDaysList[i] == 4) {
|
||||
effectiveDateStr = '四';
|
||||
getEffectiveDateList.add(effectiveDateStr);
|
||||
} else if (weekDaysList[i] == 5) {
|
||||
effectiveDateStr = '五';
|
||||
getEffectiveDateList.add(effectiveDateStr);
|
||||
} else if (weekDaysList[i] == 6) {
|
||||
effectiveDateStr = '六';
|
||||
getEffectiveDateList.add(effectiveDateStr);
|
||||
} else if (weekDaysList[i] == 7) {
|
||||
effectiveDateStr = '日';
|
||||
getEffectiveDateList.add(effectiveDateStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
allHeight: 90.h,
|
||||
rightTitle: useDateStr,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyPeriodValidityPage);
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: '有效日',
|
||||
rightTitle: getEffectiveDateList.map((e) => e.toString()).join(','),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyPeriodValidityPage);
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
//发送时间
|
||||
String getSenderDate(ElectronicKeyListItem indexEntity) {
|
||||
String senderDate = '';
|
||||
DateTime dateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||
return senderDate;
|
||||
}
|
||||
// Widget getPeriodValidityWidget() {
|
||||
// int? dateType = state.keyType.value;
|
||||
// Get.log('dateType:$dateType');
|
||||
// if (dateType == XSConstantMacro.keyTypeLong) {
|
||||
// return getLongTypeDateWidget();
|
||||
// } else if (dateType == XSConstantMacro.keyTypeTime) {
|
||||
// return getTimeLimitTypeDateWidget();
|
||||
// } else if (dateType == XSConstantMacro.keyTypeOnce) {
|
||||
// return getOnceTypeDateWidget();
|
||||
// } else if (dateType == XSConstantMacro.keyTypeLoop) {
|
||||
// return getLoopTypeDateWidget();
|
||||
// }
|
||||
// return Container();
|
||||
// }
|
||||
//
|
||||
// //永久钥匙
|
||||
// Widget getLongTypeDateWidget() {
|
||||
// return CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
// rightTitle: '永久',
|
||||
// isHaveDirection: true,
|
||||
// action: () {
|
||||
// Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
|
||||
// arguments: {"itemData": state.itemData.value});
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// //限时钥匙
|
||||
// Widget getTimeLimitTypeDateWidget() {
|
||||
// return CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
// allHeight: 90.h,
|
||||
// rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
|
||||
// isHaveDirection: true,
|
||||
// action: () async {
|
||||
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate,
|
||||
// arguments: {"itemData": state.itemData.value});
|
||||
// if (data != null) {
|
||||
//
|
||||
// // print("state.beginTime.value:${state.beginTime.value}"
|
||||
// // "state.endTime.value:${state.endTime.value}"
|
||||
// // "state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"
|
||||
// // "state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
|
||||
// setState(() {
|
||||
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
||||
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
||||
// state.beginTime.value = DateTool()
|
||||
// .dateToYMDHNString((state.beginTimeTimestamp.value*1000).toString());
|
||||
// state.endTime.value = DateTool()
|
||||
// .dateToYMDHNString((state.endTimeTimestamp.value*1000).toString());
|
||||
// state.keyType.value = 2;
|
||||
// Get.log("2222222222222");
|
||||
// });
|
||||
// Get.log("1111111111111");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// //单次钥匙
|
||||
// Widget getOnceTypeDateWidget() {
|
||||
// return CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
// rightTitle: '单次',
|
||||
// isHaveDirection: false,
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// //循环钥匙
|
||||
// Widget getLoopTypeDateWidget() {
|
||||
// DateTime startDateStr =
|
||||
// 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)}';
|
||||
//
|
||||
// List getEffectiveDateList = [];
|
||||
// List weekDaysList = state.itemData.value.weekDays!;
|
||||
// if (weekDaysList.isNotEmpty) {
|
||||
// String effectiveDateStr = '';
|
||||
// for (int i = 0; i < weekDaysList.length; i++) {
|
||||
// if (weekDaysList[i] == 1) {
|
||||
// effectiveDateStr = '一';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 2) {
|
||||
// effectiveDateStr = '二';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 3) {
|
||||
// effectiveDateStr = '三';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 4) {
|
||||
// effectiveDateStr = '四';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 5) {
|
||||
// effectiveDateStr = '五';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 6) {
|
||||
// effectiveDateStr = '六';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 7) {
|
||||
// effectiveDateStr = '日';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return Column(
|
||||
// children: [
|
||||
// CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
// allHeight: 90.h,
|
||||
// rightTitle: useDateStr,
|
||||
// isHaveDirection: true,
|
||||
// isHaveLine: true,
|
||||
// action: () {
|
||||
// Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||
// "itemData": state.itemData.value,
|
||||
// "keyType": 1
|
||||
// });
|
||||
// }),
|
||||
// CommonItem(
|
||||
// leftTitel: '有效日',
|
||||
// rightTitle: getEffectiveDateList.map((e) => e.toString()).join(','),
|
||||
// isHaveDirection: true,
|
||||
// isHaveLine: true,
|
||||
// action: () {
|
||||
// Navigator.pushNamed(
|
||||
// context, Routers.electronicKeyPeriodValidityPage);
|
||||
// }),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// //发送时间
|
||||
// String getSenderDate(ElectronicKeyListItem indexEntity) {
|
||||
// String senderDate = '';
|
||||
// DateTime dateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
// senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||
// return senderDate;
|
||||
// }
|
||||
|
||||
CupertinoSwitch _switch(isOn) {
|
||||
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) {
|
||||
showDialog(
|
||||
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:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class ElectronicKeyDetailState {
|
||||
final itemData = ElectronicKeyListItem().obs;
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
|
||||
final keyName = "".obs;
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = 0.obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = 0.obs;// 结束时间时间戳
|
||||
var starDate = "".obs;// 开始时间
|
||||
var endDate = "".obs;// 结束时间
|
||||
var starTime = "".obs;// 生效时间
|
||||
var endTime = "".obs;// 失效时间
|
||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs;// 有效日
|
||||
|
||||
var onlyManageYouCreatesUser = false.obs;// 0:可以管理所有用户 1:只能管理自己创建的用户
|
||||
var isRemoteUnlock = false.obs; //是否允许远程开锁 0:不允许 1:允许
|
||||
|
||||
ElectronicKeyDetailState() {
|
||||
Map map = Get.arguments;
|
||||
itemData.value = map["itemData"];
|
||||
if(map["keyInfo"]!=null){
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
changeNameController.text = itemData.value.keyName!;
|
||||
keyName.value = itemData.value.keyName!;
|
||||
|
||||
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
|
||||
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
|
||||
beginTimeTimestamp.value = itemData.value.startDate!;
|
||||
endTimeTimestamp.value = itemData.value.endDate!;
|
||||
isRemoteUnlock.value = itemData.value.remoteEnable! == 0 ? false : true;
|
||||
onlyManageYouCreatesUser.value = itemData.value.isOnlyManageSelf! == 0 ? false : true;
|
||||
|
||||
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: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/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
|
||||
class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
@ -13,42 +13,30 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
|
||||
//编辑电子钥匙有效期请求
|
||||
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!}");
|
||||
// print("state.itemData.value.endDate!:${state.itemData.value.endDate!}");
|
||||
var beginTimeTimestamp = state.itemData.value.startDate! ~/ 1000;
|
||||
var endTimeTimestamp = state.itemData.value.endDate! ~/ 1000;
|
||||
if (beginTimeTimestamp > endTimeTimestamp ||
|
||||
beginTimeTimestamp == endTimeTimestamp) {
|
||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
|
||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
return;
|
||||
}
|
||||
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||
state.itemData.value.keyId.toString(),
|
||||
state.itemData.value.lockId.toString(),
|
||||
state.itemData.value.endDate!.toString(),
|
||||
state.itemData.value.startDate!.toString(),
|
||||
state.weekDays.value,
|
||||
state.itemData.value.keyType! == 1 ? 2 : state.itemData.value.keyType!);
|
||||
keyId:state.keyId.value.toString(),
|
||||
lockId:state.lockId.value.toString(),
|
||||
endDate:endTimeTimestamp.toString(),
|
||||
startDate:beginTimeTimestamp.toString(),
|
||||
weekDays:[],
|
||||
keyType:2,
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
isOnlyManageSelf: state.isOnlyManageSelf!.value,
|
||||
remoteEnable: state.remoteEnable!.value
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: () {
|
||||
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:get/get.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/time_picker/model/date_mode.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
@ -51,76 +51,35 @@ class _ElectronicKeyDetailChangeDateState
|
||||
}
|
||||
|
||||
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(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.selectEffectiveDate.value.isNotEmpty
|
||||
? state.selectEffectiveDate.value
|
||||
: getStartDate,
|
||||
rightTitle: state.beginTime.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.selectEffectiveDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
// state.effectiveDateTime = DateTime.parse(state.selectEffectiveDate.value);
|
||||
state.itemData.value.startDate = DateTime.parse(state.selectEffectiveDate.value).millisecondsSinceEpoch;
|
||||
});
|
||||
setState(() {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.selectFailureDate.value.isNotEmpty
|
||||
? state.selectFailureDate.value
|
||||
: getEndDate,
|
||||
rightTitle: state.endTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.selectFailureDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
// state.failureDateTime = DateTime.parse(state.selectFailureDate.value);
|
||||
state.itemData.value.endDate = DateTime.parse(state.selectFailureDate.value).millisecondsSinceEpoch; //更新结束时间
|
||||
});
|
||||
setState(() {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
});
|
||||
})),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
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: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 ElectronicKeyDetailChangeDateState {
|
||||
final itemData = ElectronicKeyListItem().obs;
|
||||
final TextEditingController inputPwdController = TextEditingController();
|
||||
final TextEditingController inputNameController = TextEditingController();
|
||||
final changeType = '1'
|
||||
.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效
|
||||
final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警)
|
||||
final hoursStart = 0.obs;
|
||||
final hoursEnd = 0.obs;
|
||||
final pwdId = ''.obs;
|
||||
final lockId = 0.obs;
|
||||
// final fromType = ''.obs;
|
||||
final selectEffectiveDate = ''.obs; //生效时间
|
||||
final selectFailureDate = ''.obs; //失效时间
|
||||
// DateTime effectiveDateTime = DateTime.now();
|
||||
// DateTime failureDateTime = DateTime.now();
|
||||
final weekDays = [].obs;
|
||||
final expireLockItem = ExpireLockItem().obs;
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
|
||||
var pushType = 0.obs;// 0电子钥匙 1授权管理员
|
||||
|
||||
var keyId = 0.obs;
|
||||
var lockId = 0.obs;
|
||||
var isOnlyManageSelf = 0.obs;
|
||||
var remoteEnable = 0.obs;
|
||||
|
||||
ElectronicKeyDetailChangeDateState() {
|
||||
Map map = Get.arguments;
|
||||
// itemData.value = map["itemData"];
|
||||
if ((map["itemData"] != null)) {
|
||||
itemData.value = map["itemData"];
|
||||
// beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
|
||||
// endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
|
||||
// beginTimeTimestamp.value = itemData.value.startDate!;
|
||||
// endTimeTimestamp.value = itemData.value.endDate!;
|
||||
Get.log("itemData.value.keyId:${itemData.value.keyId}");
|
||||
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!;
|
||||
|
||||
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/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/showTipView.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 =
|
||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
||||
await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:keyId,
|
||||
includeUnderlings:includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("删除电子钥匙成功");
|
||||
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;
|
||||
void _getElectronicKeyListRefreshUIAction() {
|
||||
|
||||
@ -133,8 +133,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
shrinkWrap: true,
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
ElectronicKeyListItem indexEntity =
|
||||
state.itemDataList.value[index];
|
||||
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String keyStatus = ''; //钥匙状态
|
||||
|
||||
@ -142,7 +141,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
useDateStr = getUseDateStr(indexEntity);
|
||||
|
||||
//钥匙状态
|
||||
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
||||
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||
|
||||
//是否为管理钥匙
|
||||
bool isAdminKey = false;
|
||||
@ -160,8 +159,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context) {
|
||||
showIosTipViewDialog(
|
||||
context, indexEntity.keyId!.toString());
|
||||
logic.deletKeyLogic(indexEntity);
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
@ -175,10 +173,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
indexEntity.keyName!,
|
||||
useDateStr,
|
||||
keyStatus,
|
||||
isAdminKey, () {
|
||||
isAdminKey,
|
||||
indexEntity.remoteEnable == 1 ? true : false, () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyDetailPage,
|
||||
arguments: {"itemData": indexEntity}).then((val) {
|
||||
arguments: {
|
||||
"itemData": indexEntity,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
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 useDateStr = '';
|
||||
@ -244,34 +227,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
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,
|
||||
String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
||||
String useDate, String keyStatus, bool isAdminKey, bool isRemteUnlocking, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
@ -305,7 +262,15 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
fontSize: 24.sp,
|
||||
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
|
||||
? Image.asset(
|
||||
'images/icon_electronicKey_admin.png',
|
||||
|
||||
@ -87,6 +87,7 @@ class ElectronicKeyListItem {
|
||||
int? remoteEnable;
|
||||
int? appUnlockMustOnline;
|
||||
List? weekDays;
|
||||
int? isOnlyManageSelf;
|
||||
|
||||
ElectronicKeyListItem(
|
||||
{this.keyId,
|
||||
@ -108,7 +109,9 @@ class ElectronicKeyListItem {
|
||||
this.sendDate,
|
||||
this.remoteEnable,
|
||||
this.appUnlockMustOnline,
|
||||
this.weekDays});
|
||||
this.weekDays,
|
||||
this.isOnlyManageSelf
|
||||
});
|
||||
|
||||
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
|
||||
keyId = json['keyId'];
|
||||
@ -134,6 +137,7 @@ class ElectronicKeyListItem {
|
||||
sendDate = json['sendDate'];
|
||||
remoteEnable = json['remoteEnable'];
|
||||
appUnlockMustOnline = json['appUnlockMustOnline'];
|
||||
isOnlyManageSelf = json['isOnlyManageSelf'];
|
||||
json['weekDays'] != null ? weekDays = json['weekDays'] : [];
|
||||
}
|
||||
|
||||
@ -159,6 +163,7 @@ class ElectronicKeyListItem {
|
||||
data['remoteEnable'] = remoteEnable;
|
||||
data['appUnlockMustOnline'] = appUnlockMustOnline;
|
||||
data['weekDays'] = weekDays;
|
||||
data['isOnlyManageSelf'] = isOnlyManageSelf;
|
||||
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/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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/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/time_picker/model/date_mode.dart';
|
||||
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import '../../../../../../tools/commonItem.dart';
|
||||
import '../../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/storage.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'massSendElectronicKey_logic.dart';
|
||||
|
||||
class MassSendElectronicKeyPage extends StatefulWidget {
|
||||
final String type;
|
||||
@ -28,43 +27,34 @@ class MassSendElectronicKeyPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||
late Contact _contact;
|
||||
var _selectEffectiveDate = ''; //生效时间
|
||||
var _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
late bool _isSendSuccess;
|
||||
late bool _isRemote; //是否远程开锁
|
||||
List _receiverList = []; //接受者列表
|
||||
List _lockIdList = []; //选中的锁ID列表
|
||||
String countryName = '中国';
|
||||
String countryCode = '86';
|
||||
List weekdaysList = [];
|
||||
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
||||
final logic = Get.put(MassSendElectronicKeyLogic());
|
||||
final state = Get.find<MassSendElectronicKeyLogic>().state;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
getDemoMode();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
logic.resetData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> getDemoMode() async {
|
||||
state.isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return indexChangeWidget();
|
||||
}
|
||||
state.type.value = widget.type;
|
||||
Get.log('state.type.value:${state.type.value}');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
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;
|
||||
return SingleChildScrollView(
|
||||
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
if (_isSendSuccess) {
|
||||
if (state.isSendSuccess.value) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (int.parse(widget.type)) {
|
||||
@ -93,11 +83,11 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 单次
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
periodValidityWidget(),
|
||||
keyPeriodValidityWidget(),
|
||||
remoteUnlockingWidget(),
|
||||
keyBottomWidget()
|
||||
],
|
||||
@ -151,76 +141,22 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
onClick: () {
|
||||
_isSendSuccess = false;
|
||||
Navigator.pop(context, true);
|
||||
state.isSendSuccess.value = false;
|
||||
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 keyInfoWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: _receiverList.isEmpty
|
||||
rightTitle: state.receiverList.isEmpty
|
||||
? TranslationLoader.lanKeys!.pleaseAdd!.tr
|
||||
: _receiverList.length.toString(),
|
||||
: state.receiverList.length.toString(),
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -228,7 +164,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
.then((value) {
|
||||
if (value != null) {
|
||||
value as Map<String, dynamic>;
|
||||
_receiverList = value['lockUserList'];
|
||||
state.receiverList = value['lockUserList'];
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
@ -241,27 +177,26 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'$countryName +$countryCode',
|
||||
'${state.countryName.value} +${state.countryCode.value}',
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
countryCode = result['code'];
|
||||
countryName = result['countryName'];
|
||||
state.countryCode = result['code'];
|
||||
state.countryName = result['countryName'];
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||
rightTitle: _lockIdList.isEmpty
|
||||
rightTitle: state.lockIdList.isEmpty
|
||||
? TranslationLoader.lanKeys!.pleaseSelect!.tr
|
||||
: _lockIdList.length.toString(),
|
||||
: state.lockIdList.length.toString(),
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
||||
@ -269,8 +204,8 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
//得到选中的锁ID列表
|
||||
if (value != null) {
|
||||
value as Map<String, dynamic>;
|
||||
_lockIdList = value['selectLockIdList'];
|
||||
print("_lockIdList:$_lockIdList");
|
||||
state.lockIdList = value['selectLockIdList'];
|
||||
print("_lockIdList:$state.lockIdList");
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
@ -284,35 +219,27 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
Widget keyTimeWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: _selectEffectiveDate,
|
||||
rightTitle: state.beginTime.value,
|
||||
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(
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: _selectFailureDate,
|
||||
rightTitle: state.endTime.value,
|
||||
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);
|
||||
});
|
||||
});
|
||||
}),
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
);
|
||||
@ -334,17 +261,82 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
}
|
||||
|
||||
// 有效期
|
||||
Widget periodValidityWidget() {
|
||||
Widget keyPeriodValidityWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyPeriodValidityPage);
|
||||
}),
|
||||
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'];
|
||||
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),
|
||||
],
|
||||
);
|
||||
@ -356,7 +348,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () {
|
||||
MassKeyChecksRequest();
|
||||
logic.massKeyChecksRequest();
|
||||
}),
|
||||
],
|
||||
);
|
||||
@ -367,16 +359,13 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: _isRemote,
|
||||
value: state.isRemoteUnlock.value,
|
||||
onChanged: (value) {
|
||||
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:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../../translations/trans_lib.dart';
|
||||
import 'massSendElectronicKeyManage_tabbar.dart';
|
||||
|
||||
class MassSendElectronicKeyManagePage extends StatefulWidget {
|
||||
@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../../translations/trans_lib.dart';
|
||||
import '../massSendElectronicKey_page.dart';
|
||||
|
||||
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/network/api_repository.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/translations/trans_lib.dart';
|
||||
|
||||
@ -24,46 +25,40 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
// 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") {
|
||||
print(
|
||||
"startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
|
||||
if (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!startDateTime.isBefore(DateTime.now()) ||
|
||||
startDateTime.isAtSameMomentAs(DateTime.now())) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var startDate = "0";
|
||||
var endDate = "0";
|
||||
var startTime = "0";
|
||||
var endTime = "0";
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
int typeValue = int.parse(state.type.value);
|
||||
switch (typeValue) {
|
||||
case 0:
|
||||
{
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
state.failureTimestamp.value =
|
||||
state.failureDateTime.value.millisecondsSinceEpoch;
|
||||
state.effectiveTimestamp.value =
|
||||
state.effectiveDateTime.value.millisecondsSinceEpoch;
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startTime = "0";
|
||||
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;
|
||||
case 1:
|
||||
@ -74,6 +69,14 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
break;
|
||||
case 3:
|
||||
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;
|
||||
default:
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
@ -87,7 +90,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
||||
? '1'
|
||||
: '2',
|
||||
endDate: state.failureTimestamp.value,
|
||||
endDate: int.parse(endDate),
|
||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||
isCameraEnable: '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||
@ -98,10 +101,11 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
operatorUid: '',
|
||||
receiverUsername: state.emailOrPhoneController.text,
|
||||
remarks: '',
|
||||
startDate: state.effectiveTimestamp.value,
|
||||
startDate: int.parse(startDate),
|
||||
weekDays: state.weekdaysList.value,
|
||||
startTime: state.startTime.value,
|
||||
endTime: state.endTime.value);
|
||||
startTime: int.parse(startTime),
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
state.isSendSuccess.value = true;
|
||||
@ -212,11 +216,13 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
void resetData() {
|
||||
state.emailOrPhoneController.text = "";
|
||||
state.keyNameController.text = "";
|
||||
state.selectEffectiveDate =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
.obs; //默认为当前时间
|
||||
state.selectFailureDate =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
.obs; //默认为当前时间
|
||||
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 = "";//默认为当前时间
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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/network/api_repository.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/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../tools/NativeInteractionTool.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
@ -35,8 +36,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
|
||||
getDemoMode();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
logic.resetData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> getDemoMode() async {
|
||||
@ -46,6 +49,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.type.value = widget.type;
|
||||
Get.log('state.type.value:${state.type.value}');
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||
@ -118,7 +122,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Widget keyInfoWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(height: 10.h),
|
||||
// Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: "",
|
||||
@ -165,31 +169,23 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.selectEffectiveDate.value,
|
||||
rightTitle: state.beginTime.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
|
||||
'${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');
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.selectFailureDate.value,
|
||||
rightTitle: state.endTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.failureDateTime.value = XSDateUtils.parseDateTime(
|
||||
'${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');
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Container(height: 10.h),
|
||||
@ -205,6 +201,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _remoteSwitch(false)),
|
||||
@ -215,34 +214,83 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 有效期
|
||||
// 循环有效期
|
||||
Widget keyPeriodValidityWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: state.weekdaysList.value.isEmpty
|
||||
? ''
|
||||
: state.weekdaysList.value.join(','),
|
||||
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.electronicKeyPeriodValidityPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
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.effectiveTimestamp.value =
|
||||
result['starDate'].millisecondsSinceEpoch;
|
||||
state.failureTimestamp.value =
|
||||
result['endDate'].millisecondsSinceEpoch;
|
||||
state.startTime.value =
|
||||
result['starTime'].millisecondsSinceEpoch;
|
||||
state.endTime.value = result['endTime'].millisecondsSinceEpoch;
|
||||
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}');
|
||||
}
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
)
|
||||
})),
|
||||
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);
|
||||
}
|
||||
})
|
||||
)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -269,33 +317,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () {
|
||||
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();
|
||||
setState(() {});
|
||||
} else {
|
||||
@ -527,6 +548,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||
rightTitle: "",
|
||||
// isTipsImg: true,
|
||||
// tipsImgAction: () {
|
||||
// ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||
// },
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
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:get/get.dart';
|
||||
|
||||
import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class SendElectronicKeyState {
|
||||
@ -14,26 +15,17 @@ class SendElectronicKeyState {
|
||||
|
||||
final isRemoteUnlock = 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 =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
.obs; //默认为当前时间
|
||||
var selectFailureDate =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
.obs; //默认为当前时间
|
||||
var beginTime = "".obs; //默认为当前时间 开始时间
|
||||
var endTime = "".obs;//默认为当前时间 结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
|
||||
var type = ''.obs;
|
||||
var type = ''.obs;// 限时、永久、单次、循环
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.obs;
|
||||
var countryCode = '86'.obs;
|
||||
var weekdaysList = [].obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
|
||||
var isDemoMode = false;
|
||||
|
||||
@ -37,6 +37,22 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
final logic = Get.put(AddFingerprintTypeLogic());
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
state.selectType.value = widget.selectType;
|
||||
@ -46,9 +62,6 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
}
|
||||
state.fromType.value = widget.fromType;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// Your code here
|
||||
});
|
||||
return indexChangeWidget();
|
||||
}
|
||||
|
||||
@ -156,7 +169,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
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){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
@ -174,7 +194,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
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){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
@ -191,7 +218,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
isHaveDirection: true,
|
||||
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){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
|
||||
@ -14,6 +14,7 @@ import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import 'fingerprintDetail_state.dart';
|
||||
|
||||
@ -170,7 +171,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功",something: (){
|
||||
Get.back(result: "addScuess");
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -182,7 +183,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
}else if(state.keyType.value == 2){
|
||||
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
||||
@ -223,6 +223,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
state.typeName.value = state.changeNameController.text;
|
||||
// 指纹
|
||||
logic.editFingerprintsData();
|
||||
},
|
||||
|
||||
@ -12,7 +12,6 @@ import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/keySearchWidget.dart';
|
||||
import '../../../../tools/left_slide_actions.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
@ -346,8 +347,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
keyType: 0,
|
||||
startDate: DateTime.now().millisecondsSinceEpoch,
|
||||
expireDate: 0x11223344,
|
||||
startDate: state.keyInfos.value.startDate!~/10000,
|
||||
expireDate: state.keyInfos.value.endDate!~/10000,
|
||||
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
||||
password: "123456",
|
||||
needAuthor: 1,
|
||||
@ -405,8 +406,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
keyType: 0,
|
||||
startDate: DateTime.now().millisecondsSinceEpoch,
|
||||
expireDate: 0x11223344,
|
||||
startDate: state.keyInfos.value.startDate!~/10000,
|
||||
expireDate: state.keyInfos.value.endDate!~/10000,
|
||||
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
||||
password: "123456",
|
||||
needAuthor: 1,
|
||||
@ -682,6 +683,25 @@ class LockDetailLogic extends BaseGetXController {
|
||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// 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:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -241,11 +242,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// logic.getStarLockStatus();
|
||||
showDeletAlertDialog(
|
||||
context,
|
||||
DateTool().dateToYMDHNString(state
|
||||
.keyInfos.value.electricQuantityDate!
|
||||
.toString()));
|
||||
ShowTipView().showSureAlertDialog("锁更新时间:${DateTool().dateToYMDHNString(state
|
||||
.keyInfos.value.electricQuantityDate!
|
||||
.toString())}");
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
@ -911,24 +910,24 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
return formattedTime;
|
||||
}
|
||||
|
||||
void showDeletAlertDialog(BuildContext context, String dateStr) {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
content: Text('锁更新时间:$dateStr'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// void showDeletAlertDialog(BuildContext context, String dateStr) {
|
||||
// showCupertinoDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// content: Text('锁更新时间:$dateStr'),
|
||||
// actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
startOpenLock() {
|
||||
// print("11111111");
|
||||
|
||||
@ -11,6 +11,16 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
|
||||
|
||||
// 设置考勤创建公司
|
||||
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(
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
attendanceType: state.isCustom.value ? "0" :"1",
|
||||
@ -20,7 +30,9 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
|
||||
workStartTime: state.beginTimeTimestamp.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
setLockSetGeneralSetting();
|
||||
showToast("创建成功", something: (){
|
||||
setLockSetGeneralSetting();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -63,7 +64,7 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAwa
|
||||
// 接受者信息输入框
|
||||
Widget getTFWidget(String tfStr, TextEditingController controller) {
|
||||
return Container(
|
||||
height: 50.h,
|
||||
height: 65.h,
|
||||
width: 300.w,
|
||||
child: Row(
|
||||
children: [
|
||||
@ -71,17 +72,34 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAwa
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
// LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
controller: controller,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
hintText: tfStr,
|
||||
hintStyle: TextStyle(fontSize: 24.sp),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
hintStyle: TextStyle(fontSize: 22.sp),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
disabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
border: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
@ -33,6 +34,7 @@ class LockSoundSetLogic extends BaseGetXController {
|
||||
ifCanNext();
|
||||
showToast("操作成功", something: (){
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
||||
@ -224,6 +225,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
keyboardType: inputController == state.inputNameController
|
||||
? TextInputType.text
|
||||
: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(inputController == state.inputNameController ? 50 : 9),
|
||||
],
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if(inputController == state.inputPwdController){
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:star_lock/blue/io_type.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();
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '标记为:已入住',
|
||||
onClick: () {},
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10.h,
|
||||
// ),
|
||||
// OutLineBtn(
|
||||
// btnName: '标记为:已入住',
|
||||
// onClick: () {},
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -569,7 +569,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
maxLines: 1,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(editController == state.nameController ? 18 : 9),
|
||||
LengthLimitingTextInputFormatter(editController == state.nameController ? 50 : 9),
|
||||
],
|
||||
keyboardType: editController == state.nameController ? TextInputType.text: TextInputType.number,
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
|
||||
@ -71,9 +71,9 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
|
||||
width: 200.w,
|
||||
child: SubmitBtn(
|
||||
btnName: state.btnText.value,
|
||||
onClick: () {
|
||||
onClick: state.canResend.value ? () {
|
||||
logic.sendValidationCode();
|
||||
},
|
||||
} : null,
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
|
||||
@ -51,6 +51,9 @@ class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
|
||||
label:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||
rightSlot: GestureDetector(
|
||||
onTap: state.canResend.value ?() {
|
||||
logic.sendValidationCode();
|
||||
} : null,
|
||||
child: Container(
|
||||
width: 180.w,
|
||||
height: 90.h,
|
||||
@ -65,9 +68,6 @@ class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
|
||||
)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
logic.sendValidationCode();
|
||||
},
|
||||
)))),
|
||||
SizedBox(height: 50.w),
|
||||
Obx(() => SubmitBtn(
|
||||
|
||||
@ -9,36 +9,36 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
||||
class PersonInfoEditAccountLogic extends BaseGetXController {
|
||||
final PersonInfoEditAccountState state = PersonInfoEditAccountState();
|
||||
|
||||
late Timer _timer;
|
||||
void _startTimer() {
|
||||
_timer = Timer.periodic(1.seconds, (timer) {
|
||||
if (state.currentSecond > 1) {
|
||||
state.currentSecond--;
|
||||
} else {
|
||||
_cancelTimer();
|
||||
state.currentSecond = state.totalSeconds;
|
||||
}
|
||||
state.resetResend();
|
||||
});
|
||||
}
|
||||
|
||||
void _cancelTimer() {
|
||||
_timer.cancel();
|
||||
}
|
||||
// late Timer _timer;
|
||||
// void _startTimer() {
|
||||
// _timer = Timer.periodic(1.seconds, (timer) {
|
||||
// if (state.currentSecond > 1) {
|
||||
// state.currentSecond--;
|
||||
// } else {
|
||||
// _cancelTimer();
|
||||
// state.currentSecond = state.totalSeconds;
|
||||
// }
|
||||
// state.resetResend();
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// void _cancelTimer() {
|
||||
// _timer.cancel();
|
||||
// }
|
||||
|
||||
//获取验证码请求
|
||||
void sendValidationCode() async {
|
||||
var entity = await ApiRepository.to.getValidationCodeAuth(
|
||||
state.countryCode.value,
|
||||
state.loginData.value.mobile!,
|
||||
state.channel.value,
|
||||
state.codeType.value,
|
||||
state.uniqueid.value,
|
||||
state.xWidth.value.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
_startTimer();
|
||||
} else {}
|
||||
}
|
||||
// void sendValidationCode() async {
|
||||
// var entity = await ApiRepository.to.getValidationCodeAuth(
|
||||
// state.countryCode.value,
|
||||
// state.loginData.value.mobile!,
|
||||
// state.channel.value,
|
||||
// state.codeType.value,
|
||||
// state.uniqueid.value,
|
||||
// state.xWidth.value.toString());
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// _startTimer();
|
||||
// } else {}
|
||||
// }
|
||||
|
||||
void checkNext(TextEditingController controller) {
|
||||
changeInput(controller);
|
||||
|
||||
@ -79,6 +79,11 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
|
||||
width: 20.w,
|
||||
),
|
||||
Obx(() => GestureDetector(
|
||||
onTap: () {
|
||||
if (state.accountIsOK.value && state.canResend.value) {
|
||||
logic.sendValidationCode();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 180.w,
|
||||
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(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.lock!.tr,
|
||||
barTitle: groupListItem.keyGroupName ?? '',
|
||||
haveBack: true,
|
||||
actionsList: (lockList.isNotEmpty && groupListItem.groupType != 0) ? [
|
||||
IconButton(
|
||||
|
||||
@ -41,6 +41,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
),
|
||||
onPressed: () {
|
||||
// 处理操作按钮的点击事件-添加锁分组
|
||||
state.changeNameController.text = "";
|
||||
showCupertinoAlertDialog(context, true, 0);
|
||||
},
|
||||
),
|
||||
@ -123,7 +124,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: TranslationLoader.lanKeys!.createNewGroup!.tr,
|
||||
title: isAdd ? TranslationLoader.lanKeys!.createNewGroup!.tr : "修改名称",
|
||||
tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
controller: state.changeNameController,
|
||||
sureClick: () {
|
||||
@ -182,7 +183,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
color: AppColors.mainColor,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.edit!.tr,
|
||||
"重命名",
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
@ -200,7 +201,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: TranslationLoader.lanKeys!.hint!.tr,
|
||||
tipTitle: TranslationLoader.lanKeys!.areYouSureYouWantToDeleteIt!.tr,
|
||||
tipTitle: "分组下的锁将被移到未分组里",
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
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? headUrl;
|
||||
String? userid;
|
||||
int? isOnlyManageSelf;
|
||||
|
||||
ExpireLockItem(
|
||||
{this.clientId,
|
||||
@ -123,7 +124,8 @@ class ExpireLockItem {
|
||||
this.expireDate,
|
||||
this.nickname2,
|
||||
this.headUrl,
|
||||
this.userid});
|
||||
this.userid,
|
||||
this.isOnlyManageSelf});
|
||||
|
||||
ExpireLockItem.fromJson(Map<String, dynamic> json) {
|
||||
clientId = json['clientId'];
|
||||
@ -161,6 +163,7 @@ class ExpireLockItem {
|
||||
nickname2 = json['nickname2'];
|
||||
headUrl = json['headUrl'];
|
||||
userid = json['userid'];
|
||||
isOnlyManageSelf = json['isOnlyManageSelf'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -198,6 +201,7 @@ class ExpireLockItem {
|
||||
data['nickname2'] = nickname2;
|
||||
data['headUrl'] = headUrl;
|
||||
data['userid'] = userid;
|
||||
data['isOnlyManageSelf'] = isOnlyManageSelf;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../network/api_repository.dart';
|
||||
import 'expireLockList_entity.dart';
|
||||
@ -28,12 +29,13 @@ class ExpireLockListLogic extends BaseGetXController{
|
||||
|
||||
//使用期限
|
||||
String getExpireDateStr(ExpireLockItem itemData) {
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(itemData.startDate!);
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(itemData.endDate!);
|
||||
String useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 10)}-${endDateStr.toLocal().toString().substring(0, 10)}';
|
||||
String useDateStr = '';
|
||||
if(itemData.keyType == 4){
|
||||
useDateStr = '循环';
|
||||
}else{
|
||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
}
|
||||
@ -77,9 +77,39 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
||||
|
||||
Widget _electronicKeyItem(ExpireLockItem itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.expireLockChangeDatePage,
|
||||
arguments: {"itemData": itemData});
|
||||
onTap: () async {
|
||||
if(itemData.keyType! == 4){
|
||||
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(
|
||||
height: 90.h,
|
||||
@ -135,7 +165,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
||||
),
|
||||
itemData.expireDate! > 0
|
||||
? Container(
|
||||
padding: EdgeInsets.only(left: 2.w, right: 2.w),
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.expireTextBgColor,
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
@ -146,7 +176,18 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
|
||||
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),
|
||||
|
||||
@ -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_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_utils/get_utils.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.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 '../../../../../tools/titleAppBar.dart';
|
||||
import 'ownedKeyList_logic.dart';
|
||||
|
||||
class OwnedKeyListPage extends StatefulWidget {
|
||||
const OwnedKeyListPage({Key? key}) : super(key: key);
|
||||
@ -18,8 +20,8 @@ class OwnedKeyListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
String getUidStr = '';
|
||||
List dataList = [];
|
||||
final logic = Get.put(OwnedKeyListLogic());
|
||||
final state = Get.find<OwnedKeyListLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -28,11 +30,6 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["uid"] != null)) {
|
||||
getUidStr = obj["uid"].toString();
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
@ -41,7 +38,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: FutureBuilder<List<KeyListItem>>(
|
||||
future: mockNetworkDataRequest(),
|
||||
future: logic.mockNetworkDataRequest(),
|
||||
builder: (BuildContext context,
|
||||
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) {
|
||||
return ListView.builder(
|
||||
itemCount: itemList.length,
|
||||
@ -148,17 +101,9 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_lockGroup_item.png',
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
SizedBox(width: 30.w,),
|
||||
Image.asset('images/icon_lockGroup_item.png', width: 60.w, height: 60.w),
|
||||
SizedBox(width: 20.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -166,11 +111,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Text(itemData.lockAlias ?? '', style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
@ -178,10 +119,8 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
getUseDateStr(itemData),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
logic.getUseDateStr(itemData),
|
||||
style: TextStyle(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_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart';
|
||||
@ -144,10 +145,21 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_addressBook.png',
|
||||
width: 28.w,
|
||||
height: 28.h,
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
Contact? currentContact = await state.contactPicker.selectContact();
|
||||
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(
|
||||
width: 40.w,
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class RecipientInformationState{
|
||||
var type = 1.obs;// 1、个人用户 2、星寓用户
|
||||
final TextEditingController numberController = TextEditingController();
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
final countryName = "中国".obs;
|
||||
final countryCode = "86".obs;
|
||||
|
||||
@ -38,6 +38,10 @@ abstract class Api {
|
||||
final String getLockSettingURL = '/lock/getLockSettingData'; // 获取所有锁设置信息
|
||||
final String deletLockURL = '/lock/delete'; // 删除锁
|
||||
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 passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
||||
|
||||
@ -141,7 +141,8 @@ class ApiProvider extends BaseProvider {
|
||||
int startDate,
|
||||
List weekDays,
|
||||
int startTime,
|
||||
int endTime) =>
|
||||
int endTime,
|
||||
int isOnlyManageSelf) =>
|
||||
post(
|
||||
sendElectronicKeyURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -162,7 +163,8 @@ class ApiProvider extends BaseProvider {
|
||||
'startDate': startDate,
|
||||
'weekDays': weekDays,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime
|
||||
'endTime': endTime,
|
||||
'isOnlyManageSelf': isOnlyManageSelf,
|
||||
}));
|
||||
|
||||
Future<Response> uploadElectricQuantity(
|
||||
@ -203,7 +205,7 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
Future<Response> updateKeyDate(String keyId, String lockId, String endDate,
|
||||
String startDate, List weekDays, int keyType) =>
|
||||
String startDate, List weekDays, int keyType, int startTime, int endTime, int isOnlyManageSelf, int remoteEnable) =>
|
||||
post(
|
||||
updateKeyDateURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -212,7 +214,11 @@ class ApiProvider extends BaseProvider {
|
||||
'endDate': endDate,
|
||||
'startDate': startDate,
|
||||
'weekDays': weekDays,
|
||||
'keyType': keyType
|
||||
'keyType': keyType,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'isOnlyManageSelf': isOnlyManageSelf,
|
||||
'remoteEnable': remoteEnable,
|
||||
}));
|
||||
|
||||
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||
@ -508,8 +514,12 @@ class ApiProvider extends BaseProvider {
|
||||
Future<Response> setAppUnlockMustOnline(List lockIdList) => post(
|
||||
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
|
||||
|
||||
Future<Response> deleteElectronicKey(String keyId) =>
|
||||
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
|
||||
Future<Response> deleteElectronicKey(String keyId, int includeUnderlings) =>
|
||||
post(deleteElectronicKeyURL.toUrl,
|
||||
jsonEncode({
|
||||
'keyId': keyId,
|
||||
'includeUnderlings': includeUnderlings,
|
||||
}));
|
||||
|
||||
Future<Response> deleteAdministrator(String uid, String includeUnderlings) =>
|
||||
post(deleteElectronicKeyURL.toUrl,
|
||||
@ -527,6 +537,34 @@ class ApiProvider extends BaseProvider {
|
||||
'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(
|
||||
expireLockListURL.toUrl,
|
||||
|
||||
@ -159,7 +159,8 @@ class ApiRepository {
|
||||
required int startDate,
|
||||
required List weekDays,
|
||||
required int startTime,
|
||||
required int endTime}) async {
|
||||
required int endTime,
|
||||
required int isOnlyManageSelf}) async {
|
||||
final res = await apiProvider.sendElectronicKey(
|
||||
createUser,
|
||||
countryCode,
|
||||
@ -178,7 +179,8 @@ class ApiRepository {
|
||||
startDate,
|
||||
weekDays,
|
||||
startTime,
|
||||
endTime);
|
||||
endTime,
|
||||
isOnlyManageSelf);
|
||||
return AuthorizedAdminSendEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -332,10 +334,21 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//编辑电子钥匙有效期
|
||||
Future<KeyOperationRecordEntity> updateKeyDate(String keyId, String lockId,
|
||||
String endDate, String startDate, List weekDays, int keyType) async {
|
||||
Future<KeyOperationRecordEntity> updateKeyDate(
|
||||
{
|
||||
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(
|
||||
keyId, lockId, endDate, startDate, weekDays, keyType);
|
||||
keyId, lockId, endDate, startDate, weekDays, keyType, startTime, endTime, isOnlyManageSelf, remoteEnable);
|
||||
return KeyOperationRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -520,8 +533,12 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//删除电子钥匙
|
||||
Future<ElectronicKeyListEntity> deleteElectronicKey(String keyId) async {
|
||||
final res = await apiProvider.deleteElectronicKey(keyId);
|
||||
Future<ElectronicKeyListEntity> deleteElectronicKey(
|
||||
{
|
||||
required String keyId,
|
||||
required int includeUnderlings
|
||||
}) async {
|
||||
final res = await apiProvider.deleteElectronicKey(keyId, includeUnderlings);
|
||||
return ElectronicKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -544,6 +561,30 @@ class ApiRepository {
|
||||
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(String pageNo, String pageSize) async {
|
||||
final res = await apiProvider.expireLockList(pageNo, pageSize);
|
||||
@ -786,17 +827,19 @@ class ApiRepository {
|
||||
|
||||
//群发电子钥匙
|
||||
Future<KeyDetailEntity> batchSendKey(
|
||||
String endDate,
|
||||
List keyGroupIdList,
|
||||
List lockIdList,
|
||||
String createUser,
|
||||
String isRemoteUnlock,
|
||||
String keyNameForAdmin,
|
||||
String receiverUsername,
|
||||
String startDate,
|
||||
String countryCode,
|
||||
String usernameType,
|
||||
List weekDays) async {
|
||||
{
|
||||
required String endDate,
|
||||
required List keyGroupIdList,
|
||||
required List lockIdList,
|
||||
required String createUser,
|
||||
required String isRemoteUnlock,
|
||||
required String keyNameForAdmin,
|
||||
required String receiverUsername,
|
||||
required String startDate,
|
||||
required String countryCode,
|
||||
required String usernameType,
|
||||
required List weekDays
|
||||
}) async {
|
||||
final res = await apiProvider.batchSendKey(
|
||||
endDate,
|
||||
keyGroupIdList,
|
||||
|
||||
@ -10,6 +10,7 @@ class CommonItem extends StatelessWidget {
|
||||
bool? isHaveRightWidget;
|
||||
Widget? rightWidget;
|
||||
Function()? action;
|
||||
Function()? tipsImgAction;
|
||||
double? allHeight;
|
||||
bool? isTipsImg;
|
||||
|
||||
@ -23,7 +24,8 @@ class CommonItem extends StatelessWidget {
|
||||
this.isHaveRightWidget = false,
|
||||
this.rightWidget,
|
||||
this.isTipsImg,
|
||||
this.action})
|
||||
this.action,
|
||||
this.tipsImgAction})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@ -46,11 +48,19 @@ class CommonItem extends StatelessWidget {
|
||||
child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp))),
|
||||
SizedBox(width: 6.w),
|
||||
isTipsImg == true
|
||||
? Image.asset(
|
||||
'images/icon_tips_Q.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
)
|
||||
? GestureDetector(
|
||||
onTap: tipsImgAction,
|
||||
child: Container(
|
||||
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(),
|
||||
Expanded(child: SizedBox(width: 10.w)),
|
||||
Row(
|
||||
|
||||
@ -1,30 +1,31 @@
|
||||
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'pickers/time_picker/model/pduration.dart';
|
||||
|
||||
class DateTool {
|
||||
|
||||
/// 获取当前年月日时分秒
|
||||
String getNowDateYMDHM(){
|
||||
// 获取当前时间对象
|
||||
DateTime now = DateTime.now();
|
||||
//获取当前时间的年
|
||||
int year = now.year;
|
||||
//获取当前时间的月
|
||||
int month = now.month;
|
||||
//获取当前时间的日
|
||||
int day = now.day;
|
||||
//获取当前时间的时
|
||||
int hour = now.hour;
|
||||
//获取当前时间的分
|
||||
int minute = now.minute;
|
||||
//获取当前时间的秒
|
||||
int millisecond = now.millisecond;
|
||||
|
||||
// print("组合 $year-$month-$day $hour:$minute:$millisecond");
|
||||
return "$year.$month.$day $hour:$minute";
|
||||
}
|
||||
// String getNowDateYMDHM(){
|
||||
// // 获取当前时间对象
|
||||
// DateTime now = DateTime.now();
|
||||
// //获取当前时间的年
|
||||
// int year = now.year;
|
||||
// //获取当前时间的月
|
||||
// int month = now.month;
|
||||
// //获取当前时间的日
|
||||
// int day = now.day;
|
||||
// //获取当前时间的时
|
||||
// int hour = now.hour;
|
||||
// //获取当前时间的分
|
||||
// int minute = now.minute;
|
||||
// //获取当前时间的秒
|
||||
// int millisecond = now.millisecond;
|
||||
//
|
||||
// // print("组合 $year-$month-$day $hour:$minute:$millisecond");
|
||||
// return "$year-$month-$day $hour:$minute";
|
||||
// }
|
||||
|
||||
/// 将时间戳传化为年月日时分秒 (年.月.日 时:分)
|
||||
// String dateToYMDHNStringWithDot(String timestamp){
|
||||
@ -82,13 +83,14 @@ class DateTool {
|
||||
|
||||
/// 将时间戳传化为年月日 (年-月-日 时:分)
|
||||
String dateToYMDHNString(String timestamp){
|
||||
// Get.log('dateToYMDHNString timestamp: $timestamp');
|
||||
int time = int.parse(timestamp);
|
||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd,' ',HH,':',nn]);
|
||||
return appointmentDate;
|
||||
}
|
||||
|
||||
/// 将时间戳传化为年月日 (年.月.日)
|
||||
/// 将时间戳传化为年月日 (年-月-日)
|
||||
String dateToYMDString(String timestamp){
|
||||
int time = int.parse(timestamp);
|
||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||
@ -101,6 +103,7 @@ class DateTool {
|
||||
int time = int.parse(timestamp);
|
||||
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||
String appointmentDate = formatDate(nowDate, [HH,':',nn]);
|
||||
// Get.log('timestamp:$timestamp dateToHNString appointmentDate: $appointmentDate');
|
||||
return appointmentDate;
|
||||
}
|
||||
|
||||
|
||||
@ -115,8 +115,7 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
|
||||
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),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 7, childAspectRatio: 1.0),
|
||||
itemCount: 7,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
@ -9,4 +9,23 @@ class SeletKeyCyclicDateState{
|
||||
var endTime = "".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
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
return Container(
|
||||
height: 60.h,
|
||||
color: const Color(0x00FFFFFF),
|
||||
child: CupertinoAlertDialog(
|
||||
title: Text(title!),
|
||||
content: Column(
|
||||
children: <Widget>[
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
// const SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
Container(
|
||||
height: 50.h,
|
||||
height: 60.h,
|
||||
// color: Colors.white,
|
||||
// padding: EdgeInsets.only(left:20.w, right: 110.w),
|
||||
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();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user