1,电子钥匙部分逻辑优化
2,授权管理员部分逻辑完善
This commit is contained in:
parent
6222675100
commit
ca84357e3c
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:date_format/date_format.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
@ -5,8 +6,10 @@ import 'package:flutter_pickers/pickers.dart';
|
|||||||
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -25,22 +28,30 @@ class AuthorizedAdminPage extends StatefulWidget {
|
|||||||
class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||||
late Contact _contact;
|
late Contact _contact;
|
||||||
|
late KeyInfos keyInfo;
|
||||||
// bool _isRemoteUnlock = false; //是否允许远程开锁
|
late LockMainEntity lockMainEntity;
|
||||||
bool _isAuthentication = false; //是否可以实名认证
|
bool _isAuthentication = false; //是否可以实名认证
|
||||||
var _selectEffectiveDate = ''; //生效时间
|
var _selectEffectiveDate = ''; //生效时间
|
||||||
var _selectFailureDate = ''; //失效时间
|
var _selectFailureDate = ''; //失效时间
|
||||||
|
late DateTime _effectiveDateTime;
|
||||||
|
late DateTime _failureDateTime;
|
||||||
final TextEditingController _emailOrPhoneController =
|
final TextEditingController _emailOrPhoneController =
|
||||||
TextEditingController(); //邮箱/手机号输入框
|
TextEditingController(); //邮箱/手机号输入框
|
||||||
final TextEditingController _keyNameController =
|
final TextEditingController _keyNameController =
|
||||||
TextEditingController(); //钥匙名输入框
|
TextEditingController(); //钥匙名输入框
|
||||||
late bool _isSendSuccess;
|
late bool _isSendSuccess;
|
||||||
|
String countryName = '中国';
|
||||||
|
String countryCode = '86';
|
||||||
|
List weekdaysList = [];
|
||||||
|
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
DateTime dateTime = DateTime.now();
|
DateTime dateTime = DateTime.now();
|
||||||
|
_effectiveDateTime = dateTime;
|
||||||
|
_failureDateTime = dateTime;
|
||||||
_selectEffectiveDate =
|
_selectEffectiveDate =
|
||||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||||
_selectFailureDate =
|
_selectFailureDate =
|
||||||
@ -50,33 +61,47 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return indexChangeWidget();
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||||
|
lockMainEntity = obj["lockMainEntity"];
|
||||||
|
}
|
||||||
|
if (obj != null && (obj["keyInfo"] != null)) {
|
||||||
|
keyInfo = obj["keyInfo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: indexChangeWidget(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
switch (int.parse(widget.type)) {
|
if (_isSendSuccess) {
|
||||||
case 0:
|
return sendElectronicKeySucceed();
|
||||||
{
|
} else {
|
||||||
// 限时
|
switch (int.parse(widget.type)) {
|
||||||
// return sendElectronicKeySucceed();
|
case 0:
|
||||||
|
{
|
||||||
|
// 限时
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
keyInfoWidget(),
|
||||||
|
keyTimeWidget(),
|
||||||
|
keyRealNameWidget(),
|
||||||
|
keyBottomWidget(
|
||||||
|
TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// 永久
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
keyTimeWidget(),
|
|
||||||
keyRealNameWidget(),
|
keyRealNameWidget(),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
// 永久
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
keyInfoWidget(),
|
|
||||||
keyRealNameWidget(),
|
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,12 +117,33 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(true,
|
rightWidget: getTFWidget(true,
|
||||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, 1)),
|
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, 1)),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
rightWidget: Text(
|
||||||
|
'$countryName +$countryCode',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
),
|
||||||
|
action: () async {
|
||||||
|
var result = await Navigator.pushNamed(
|
||||||
|
context, Routers.seletCountryRegionPage);
|
||||||
|
result as Map<String, dynamic>;
|
||||||
|
countryCode = result['code'];
|
||||||
|
countryName = result['countryName'];
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
false, TranslationLoader.lanKeys!.pleaseEnter!.tr, 2)),
|
false, TranslationLoader.lanKeys!.enterYourName!.tr, 2)),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -117,7 +163,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectEffectiveDate =
|
_selectEffectiveDate =
|
||||||
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
|
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -130,7 +177,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectFailureDate =
|
_selectFailureDate =
|
||||||
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
|
_failureDateTime = DateTime.parse(_selectFailureDate);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -222,8 +270,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_send_success.png',
|
'images/icon_send_success.png',
|
||||||
width: 150.w,
|
width: 100.w,
|
||||||
height: 150.w,
|
height: 100.w,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
@ -234,7 +282,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
Text(
|
Text(
|
||||||
"发送成功",
|
"发送成功",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 32.sp,
|
fontSize: 26.sp,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
@ -248,38 +296,51 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
),
|
),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '完成',
|
btnName: '完成',
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: '邮件通知',
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
_isSendSuccess = false;
|
||||||
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
SubmitBtn(
|
SizedBox(
|
||||||
btnName: '微信通知',
|
height: 10.h,
|
||||||
fontSize: 28.sp,
|
),
|
||||||
borderRadius: 20.w,
|
OutLineBtn(
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
btnName: '邮件通知',
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
onClick: () {
|
||||||
onClick: () {}),
|
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||||
SubmitBtn(
|
},
|
||||||
btnName: '标记为已入住',
|
),
|
||||||
fontSize: 28.sp,
|
SizedBox(
|
||||||
borderRadius: 20.w,
|
height: 10.h,
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
),
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
OutLineBtn(
|
||||||
onClick: () {}),
|
btnName: '微信通知',
|
||||||
|
onClick: () {},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
OutLineBtn(
|
||||||
|
btnName: '标记为已入住',
|
||||||
|
onClick: () {
|
||||||
|
updateRoomCheckIn();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||||
|
Future<void> updateRoomCheckIn() async {
|
||||||
|
var entity = await ApiRepository.to.updateSetting('0', '1', '13');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("标记为已入住成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "标记成功");
|
||||||
|
setState(() {});
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '操作失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 接受者信息输入框
|
// 接受者信息输入框
|
||||||
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
|
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
@ -336,22 +397,20 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送钥匙请求
|
//发送授权管理员列表请求
|
||||||
Future<void> sendElectronicKeyRequest() async {
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
String getFailureDateTime = '0';
|
String getFailureDateTime = '0';
|
||||||
String getEffectiveDateTime = '0';
|
String getEffectiveDateTime = '0';
|
||||||
String deviceID = '28';
|
String lockID = keyInfo.lockId.toString();
|
||||||
String getKeyType = (int.parse(widget.type) + 1).toString();
|
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||||
if (widget.type == '0') {
|
if (widget.type == '0') {
|
||||||
getFailureDateTime =
|
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
||||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
getEffectiveDateTime =
|
||||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
'0',
|
_isCreateUser ? "1" : "0",
|
||||||
'0',
|
countryCode,
|
||||||
'1',
|
'1',
|
||||||
getFailureDateTime,
|
getFailureDateTime,
|
||||||
_isAuthentication == true ? '1' : '2',
|
_isAuthentication == true ? '1' : '2',
|
||||||
@ -360,15 +419,22 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
_keyNameController.text,
|
_keyNameController.text,
|
||||||
'1',
|
'1',
|
||||||
getKeyType,
|
getKeyType,
|
||||||
deviceID,
|
lockID,
|
||||||
'小吴副号',
|
'',
|
||||||
_emailOrPhoneController.text,
|
_emailOrPhoneController.text,
|
||||||
'0',
|
'',
|
||||||
getEffectiveDateTime, []);
|
getEffectiveDateTime,
|
||||||
|
weekdaysList);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
_isSendSuccess = true;
|
_isSendSuccess = true;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '${entity.errorMsg}');
|
||||||
|
if (entity.errorCode == 425) {
|
||||||
|
//用户未注册
|
||||||
|
_isCreateUser = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,4 +452,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String intToStr(int v) {
|
||||||
|
return (v < 10) ? "0$v" : "$v";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
@ -20,8 +21,19 @@ class AuthorizedAdminListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||||
|
late KeyInfos keyInfo;
|
||||||
|
late LockMainEntity lockMainEntity;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||||
|
lockMainEntity = obj["lockMainEntity"];
|
||||||
|
}
|
||||||
|
if (obj != null && (obj["keyInfo"] != null)) {
|
||||||
|
keyInfo = obj["keyInfo"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -53,7 +65,11 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.authorizedAdminManagePage);
|
context, Routers.authorizedAdminManagePage,
|
||||||
|
arguments: {
|
||||||
|
"lockMainEntity": lockMainEntity,
|
||||||
|
"keyInfo": keyInfo
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -72,8 +88,16 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
|
|
||||||
//请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员
|
//请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员
|
||||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '1');
|
'0',
|
||||||
|
keyInfo.keyId.toString(),
|
||||||
|
'',
|
||||||
|
keyInfo.lockId.toString(),
|
||||||
|
'',
|
||||||
|
'1',
|
||||||
|
'20',
|
||||||
|
'0',
|
||||||
|
'1');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,7 +182,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
'1',
|
'1',
|
||||||
'20',
|
'20',
|
||||||
'0',
|
'0',
|
||||||
keyInfo.keyRight.toString());
|
'0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -201,10 +201,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_effectiveDateTime = DateTime.parse(
|
_selectEffectiveDate =
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
_selectEffectiveDate = formatDate(_effectiveDateTime,
|
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
||||||
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -216,10 +215,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_failureDateTime = DateTime.parse(
|
_selectFailureDate =
|
||||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
_selectFailureDate = formatDate(_failureDateTime,
|
_failureDateTime = DateTime.parse(_selectFailureDate);
|
||||||
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -337,11 +335,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
String lockID = keyInfo.lockId.toString();
|
String lockID = keyInfo.lockId.toString();
|
||||||
String getKeyType = (int.parse(widget.type) + 1).toString();
|
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||||
if (widget.type == '0') {
|
if (widget.type == '0') {
|
||||||
getFailureDateTime =
|
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
||||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
getEffectiveDateTime =
|
||||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
_isCreateUser ? "1" : "0",
|
_isCreateUser ? "1" : "0",
|
||||||
@ -352,7 +348,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
'2',
|
'2',
|
||||||
_isRemoteUnlock == true ? '1' : '2',
|
_isRemoteUnlock == true ? '1' : '2',
|
||||||
keyNameController.text,
|
keyNameController.text,
|
||||||
keyInfo.keyRight.toString(),
|
'0',
|
||||||
getKeyType,
|
getKeyType,
|
||||||
lockID,
|
lockID,
|
||||||
'',
|
'',
|
||||||
|
|||||||
@ -210,7 +210,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
}),
|
}),
|
||||||
bottomItem('images/main/icon_main_authorizedAdmin.png',
|
bottomItem('images/main/icon_main_authorizedAdmin.png',
|
||||||
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
|
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
|
||||||
Navigator.pushNamed(context, Routers.authorizedAdminListPage);
|
Navigator.pushNamed(context, Routers.authorizedAdminListPage,
|
||||||
|
arguments: {
|
||||||
|
"lockMainEntity": widget.lockMainEntity,
|
||||||
|
"keyInfo": widget.keyInfo
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
bottomItem('images/main/icon_main_operatingRecord.png',
|
bottomItem('images/main/icon_main_operatingRecord.png',
|
||||||
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
||||||
@ -218,7 +222,8 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
}),
|
}),
|
||||||
bottomItem('images/main/icon_main_set.png',
|
bottomItem('images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr, () {
|
TranslationLoader.lanKeys!.set!.tr, () {
|
||||||
Navigator.pushNamed(context, Routers.lockSetPage, arguments: widget.keyInfo);
|
Navigator.pushNamed(context, Routers.lockSetPage,
|
||||||
|
arguments: widget.keyInfo);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user