1,授权管理员详情
2,删除授权管理员 3,更新授权管理员及相应逻辑处理
This commit is contained in:
parent
8385d6470b
commit
b83a5c4c01
@ -12,6 +12,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart';
|
||||
@ -313,6 +314,9 @@ abstract class Routers {
|
||||
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
||||
static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情
|
||||
static const expireLockListPage = '/expireLockListPage'; //即将到期
|
||||
static const adminDetailChangeDatePage =
|
||||
'/adminDetailChangeDatePage'; //管理员详情修改生效时间
|
||||
static const adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -774,9 +778,11 @@ abstract class AppRouters {
|
||||
GetPage(
|
||||
name: Routers.lockUserListPage, page: () => const LockUserListPage()),
|
||||
GetPage(
|
||||
name: Routers.checkInCreatCompanyPage, page: () => const CheckInCreatCompanyPage()),
|
||||
name: Routers.checkInCreatCompanyPage,
|
||||
page: () => const CheckInCreatCompanyPage()),
|
||||
GetPage(
|
||||
name: Routers.checkingInStaffDetailPage, page: () => const CheckingInStaffDetailPage()),
|
||||
name: Routers.checkingInStaffDetailPage,
|
||||
page: () => const CheckingInStaffDetailPage()),
|
||||
GetPage(
|
||||
name: Routers.administratorDetailsPage,
|
||||
page: () => const AdministratorDetailsPage()),
|
||||
@ -789,8 +795,9 @@ abstract class AppRouters {
|
||||
GetPage(
|
||||
name: Routers.otherTypeKeyChangeValidityDatePage,
|
||||
page: () => const OtherTypeKeyChangeValidityDatePage()),
|
||||
GetPage(name: Routers.addICCardPage, page: () => const AddICCardPage()),
|
||||
GetPage(
|
||||
name: Routers.addICCardPage,
|
||||
page: () => const AddICCardPage())
|
||||
name: Routers.adminDetailChangeDatePage,
|
||||
page: () => const AdminDetailChangeDatePage())
|
||||
];
|
||||
}
|
||||
|
||||
@ -62,49 +62,52 @@ class _StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
Obx(() => Center(
|
||||
child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.pushNamed(context, Routers.starLockLoginPage);
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoPage);
|
||||
},
|
||||
child: Container(
|
||||
width: 105.w,
|
||||
height: 105.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(52.5.w)),
|
||||
),
|
||||
child:
|
||||
// state.headUrl().isNotEmpty ?
|
||||
// Image(image: NetworkImage(state.loginData.value.data!.headUrl!)) :
|
||||
Image.asset(
|
||||
'images/mine/icon_mine_main_defaultAvatar.png',
|
||||
width: 60.w,
|
||||
height: 60.w)),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text(state.mobile(),
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: Colors.white,
|
||||
)),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text("${TranslationLoader.lanKeys!.accountNumber!.tr}:-",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.pushNamed(context, Routers.starLockLoginPage);
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoPage);
|
||||
},
|
||||
child: Container(
|
||||
width: 105.w,
|
||||
height: 105.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(52.5.w)),
|
||||
),
|
||||
child:
|
||||
// state.headUrl().isNotEmpty ?
|
||||
// Image(image: NetworkImage(state.loginData.value.data!.headUrl!)) :
|
||||
Image.asset('images/mine/icon_mine_main_defaultAvatar.png', width: 60.w, height: 60.w)
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text(state.mobile(),
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: Colors.white,
|
||||
)),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.accountNumber!.tr}:-",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -78,7 +78,7 @@ class _AddAuthorizedAdministratorPageState
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
),
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(45),
|
||||
|
||||
@ -0,0 +1,159 @@
|
||||
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/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
class AdminDetailChangeDatePage extends StatefulWidget {
|
||||
const AdminDetailChangeDatePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AdminDetailChangeDatePage> createState() =>
|
||||
_AdminDetailChangeDatePage();
|
||||
}
|
||||
|
||||
class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
|
||||
AuthorizedAdminListItem itemData = AuthorizedAdminListItem();
|
||||
|
||||
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: () {
|
||||
updateAdministratorRequest();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
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> updateAdministratorRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
||||
itemData.uid.toString(),
|
||||
'',
|
||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||
'');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("修改管理员信息成功啦啦啦啦啦");
|
||||
Toast.show(msg: "修改成功");
|
||||
setState(() {
|
||||
Navigator.pop(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//修改钥匙名称请求
|
||||
Future<void> updateKeyDateRequest() async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||
itemData.keyId.toString(),
|
||||
itemData.lockId.toString(),
|
||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||
endDay,
|
||||
'',
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||
startDay,
|
||||
weekDays);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("修改要是名称成功啦啦啦啦啦");
|
||||
Toast.show(msg: "修改成功");
|
||||
setState(() {
|
||||
Navigator.pop(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//更新密码请求
|
||||
Future<void> updatePwdRequest() async {
|
||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||
lockId,
|
||||
pwdId,
|
||||
'',
|
||||
'',
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||
'');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: "修改成功");
|
||||
setState(() {
|
||||
Navigator.pop(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
String intToStr(int v) {
|
||||
return (v < 10) ? "0$v" : "$v";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,197 @@
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
|
||||
class AdministratorDetailEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
AdministratorDetailEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
AdministratorDetailEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['errorCode'] = errorCode;
|
||||
data['description'] = description;
|
||||
data['errorMsg'] = errorMsg;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
int? uid;
|
||||
int? keyStatus;
|
||||
int? lockNum;
|
||||
int? endDate;
|
||||
int? startDate;
|
||||
int? isRemoteUnlock;
|
||||
String? name;
|
||||
String? userid;
|
||||
List<LockListItem>? lockList;
|
||||
|
||||
Data(
|
||||
{this.uid,
|
||||
this.keyStatus,
|
||||
this.lockNum,
|
||||
this.endDate,
|
||||
this.startDate,
|
||||
this.isRemoteUnlock,
|
||||
this.name,
|
||||
this.userid,
|
||||
this.lockList});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
uid = json['uid'];
|
||||
keyStatus = json['keyStatus'];
|
||||
lockNum = json['lockNum'];
|
||||
endDate = json['endDate'];
|
||||
startDate = json['startDate'];
|
||||
isRemoteUnlock = json['isRemoteUnlock'];
|
||||
name = json['name'];
|
||||
userid = json['userid'];
|
||||
if (json['lockList'] != null) {
|
||||
lockList = <LockListItem>[];
|
||||
json['lockList'].forEach((v) {
|
||||
lockList!.add(LockListItem.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['uid'] = uid;
|
||||
data['keyStatus'] = keyStatus;
|
||||
data['lockNum'] = lockNum;
|
||||
data['endDate'] = endDate;
|
||||
data['startDate'] = startDate;
|
||||
data['isRemoteUnlock'] = isRemoteUnlock;
|
||||
data['name'] = name;
|
||||
data['userid'] = userid;
|
||||
if (lockList != null) {
|
||||
data['lockList'] = lockList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LockItem {
|
||||
int? id;
|
||||
String? clientId;
|
||||
int? lockOwnerId;
|
||||
int? apiUserId;
|
||||
int? lockId;
|
||||
int? senderUserId;
|
||||
String? keyName;
|
||||
int? keyType;
|
||||
int? startDate;
|
||||
int? endDate;
|
||||
List? weekDays;
|
||||
String? remarks;
|
||||
int? remoteEnable;
|
||||
int? isCameraEnable;
|
||||
int? faceAuthentication;
|
||||
int? keyRight;
|
||||
int? userType;
|
||||
int? keyStatus;
|
||||
int? groupId;
|
||||
int? lockUserNo;
|
||||
int? date;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
|
||||
LockItem(
|
||||
{this.id,
|
||||
this.clientId,
|
||||
this.lockOwnerId,
|
||||
this.apiUserId,
|
||||
this.lockId,
|
||||
this.senderUserId,
|
||||
this.keyName,
|
||||
this.keyType,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.weekDays,
|
||||
this.remarks,
|
||||
this.remoteEnable,
|
||||
this.isCameraEnable,
|
||||
this.faceAuthentication,
|
||||
this.keyRight,
|
||||
this.userType,
|
||||
this.keyStatus,
|
||||
this.groupId,
|
||||
this.lockUserNo,
|
||||
this.date,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
|
||||
LockItem.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
clientId = json['clientId'];
|
||||
lockOwnerId = json['lockOwnerId'];
|
||||
apiUserId = json['apiUserId'];
|
||||
lockId = json['lockId'];
|
||||
senderUserId = json['senderUserId'];
|
||||
keyName = json['keyName'];
|
||||
keyType = json['keyType'];
|
||||
startDate = json['startDate'];
|
||||
endDate = json['endDate'];
|
||||
if (json['weekDays'] != null) {
|
||||
weekDays = [];
|
||||
json['weekDays'].forEach((v) {
|
||||
weekDays!.add(v);
|
||||
});
|
||||
}
|
||||
remarks = json['remarks'];
|
||||
remoteEnable = json['remoteEnable'];
|
||||
isCameraEnable = json['isCameraEnable'];
|
||||
faceAuthentication = json['faceAuthentication'];
|
||||
keyRight = json['keyRight'];
|
||||
userType = json['userType'];
|
||||
keyStatus = json['keyStatus'];
|
||||
groupId = json['groupId'];
|
||||
lockUserNo = json['lockUserNo'];
|
||||
date = json['date'];
|
||||
createdAt = json['created_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['clientId'] = clientId;
|
||||
data['lockOwnerId'] = lockOwnerId;
|
||||
data['apiUserId'] = apiUserId;
|
||||
data['lockId'] = lockId;
|
||||
data['senderUserId'] = senderUserId;
|
||||
data['keyName'] = keyName;
|
||||
data['keyType'] = keyType;
|
||||
data['startDate'] = startDate;
|
||||
data['endDate'] = endDate;
|
||||
if (weekDays != null) {
|
||||
data['weekDays'] = weekDays!.map((v) => v).toList();
|
||||
}
|
||||
data['remarks'] = remarks;
|
||||
data['remoteEnable'] = remoteEnable;
|
||||
data['isCameraEnable'] = isCameraEnable;
|
||||
data['faceAuthentication'] = faceAuthentication;
|
||||
data['keyRight'] = keyRight;
|
||||
data['userType'] = userType;
|
||||
data['keyStatus'] = keyStatus;
|
||||
data['groupId'] = groupId;
|
||||
data['lockUserNo'] = lockUserNo;
|
||||
data['date'] = date;
|
||||
data['created_at'] = createdAt;
|
||||
data['updated_at'] = updatedAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||
@ -28,12 +29,25 @@ class AdministratorDetailsPage extends StatefulWidget {
|
||||
class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
final TextEditingController _changeNameController = TextEditingController();
|
||||
AuthorizedAdminListItem itemData = AuthorizedAdminListItem();
|
||||
bool _isOnRemote = false;
|
||||
List lockItemList = [];
|
||||
bool _isFirst = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["itemData"] != null)) {
|
||||
itemData = obj["itemData"];
|
||||
if (_isFirst == true) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["itemData"] != null)) {
|
||||
itemData = obj["itemData"];
|
||||
}
|
||||
administratorDetailRequest();
|
||||
|
||||
_isOnRemote = itemData.isRemoteUnlock == 1 ? true : false;
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
@ -80,8 +94,7 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
rightTitle: getUseDateStr(itemData),
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyDetailChangeDate,
|
||||
Navigator.pushNamed(context, Routers.adminDetailChangeDatePage,
|
||||
arguments: {"itemData": itemData});
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
@ -90,16 +103,16 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
rightTitle: itemData.lockNum.toString(),
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
//锁列表
|
||||
//锁列表页面
|
||||
Navigator.pushNamed(context, Routers.lockItemListPage,
|
||||
arguments: {'lockList': lockItemList});
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
child: _switch(itemData.isRemoteUnlock == 1 ? true : false)),
|
||||
rightWidget: SizedBox(width: 60.w, child: _switch()),
|
||||
action: () {}),
|
||||
Container(height: 40.h),
|
||||
SubmitBtn(
|
||||
@ -207,24 +220,41 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
);
|
||||
}
|
||||
|
||||
CupertinoSwitch _switch(isOn) {
|
||||
CupertinoSwitch _switch() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: isOn,
|
||||
value: _isOnRemote,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
isOn = value;
|
||||
_isOnRemote = !_isOnRemote;
|
||||
updateAdministratorRequest();
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//管理员详情请求
|
||||
Future<void> administratorDetailRequest() async {
|
||||
_isFirst = false;
|
||||
AdministratorDetailEntity entity =
|
||||
await ApiRepository.to.authorizedAdminDetail(itemData.uid ?? 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("管理员详情请求成功啦啦啦啦啦");
|
||||
lockItemList = entity.data!.lockList!;
|
||||
}
|
||||
}
|
||||
|
||||
//更新管理员信息请求
|
||||
Future<void> updateAdministratorRequest() async {
|
||||
String isRemoteUnlock = _isOnRemote == true ? '1' : '2';
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
||||
itemData.uid.toString(), _changeNameController.text, '', '', '');
|
||||
itemData.uid.toString(),
|
||||
_changeNameController.text,
|
||||
'',
|
||||
'',
|
||||
isRemoteUnlock);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("修改管理员信息成功啦啦啦啦啦");
|
||||
Toast.show(msg: "修改成功");
|
||||
@ -234,15 +264,15 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
}
|
||||
}
|
||||
|
||||
//删除授权管理员请求
|
||||
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
||||
Future<void> deleteAdministratorRequest() async {
|
||||
ElectronicKeyListEntity entity =
|
||||
await ApiRepository.to.deleteAdministrator(itemData.uid.toString(), '');
|
||||
AuthorizedAdminListEntity entity = await ApiRepository.to
|
||||
.deleteAuthorizedAdmin(itemData.uid.toString(), '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("删除电子钥匙成功");
|
||||
Toast.show(msg: "删除成功");
|
||||
setState(() {
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,8 +23,6 @@ class _AuthorizedAdministratorListPageState
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
mockNetworkDataRequest();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -45,7 +43,12 @@ class _AuthorizedAdministratorListPageState
|
||||
onPressed: () {
|
||||
// 处理操作按钮的点击事件
|
||||
Navigator.pushNamed(
|
||||
context, Routers.addAuthorizedAdministratorPage);
|
||||
context, Routers.addAuthorizedAdministratorPage)
|
||||
.then((value) {
|
||||
setState(() {
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -82,15 +85,14 @@ class _AuthorizedAdministratorListPageState
|
||||
Future<List<AuthorizedAdminListItem>> mockNetworkDataRequest() async {
|
||||
AuthorizedAdminListEntity entity =
|
||||
await ApiRepository.to.authorizedAdminList('1', '20');
|
||||
List<AuthorizedAdminListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("授权管理员列表成功:${entity.data?.itemList}");
|
||||
if (entity.data != null) {
|
||||
dataList = entity.data!.itemList!;
|
||||
}
|
||||
}
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList!;
|
||||
} else {
|
||||
List<AuthorizedAdminListItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
Widget _searchWidget() {
|
||||
@ -141,7 +143,11 @@ class _AuthorizedAdministratorListPageState
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.administratorDetailsPage,
|
||||
arguments: {'itemData': itemData});
|
||||
arguments: {'itemData': itemData}).then((value) {
|
||||
setState(() {
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 100.h,
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/submitBtn.dart';
|
||||
@ -17,8 +21,30 @@ class HideInvalidUnlockPermissionsPage extends StatefulWidget {
|
||||
|
||||
class _HideInvalidUnlockPermissionsPageState
|
||||
extends State<HideInvalidUnlockPermissionsPage> {
|
||||
bool _isOn = true;
|
||||
bool _isFirst = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_isFirst = true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_isFirst) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["isOn"] != null)) {
|
||||
int getValue = obj["isOn"];
|
||||
if (getValue == 1) {
|
||||
_isOn = true;
|
||||
} else {
|
||||
_isOn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
@ -50,7 +76,7 @@ class _HideInvalidUnlockPermissionsPageState
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${TranslationLoader.lanKeys!.currentMode!.tr} : ${TranslationLoader.lanKeys!.opened!.tr}",
|
||||
"${TranslationLoader.lanKeys!.currentMode!.tr} : ${_isOn == true ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr}",
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.w600, fontSize: 22.sp),
|
||||
)),
|
||||
@ -60,14 +86,31 @@ class _HideInvalidUnlockPermissionsPageState
|
||||
height: 40.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.closed!.tr,
|
||||
btnName: _isOn == true
|
||||
? TranslationLoader.lanKeys!.close!.tr
|
||||
: TranslationLoader.lanKeys!.open!.tr,
|
||||
borderRadius: 20.w,
|
||||
fontSize: 32.sp,
|
||||
// margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w),
|
||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||
onClick: () {}),
|
||||
onClick: () {
|
||||
_isFirst = false;
|
||||
setState(() {
|
||||
_isOn = !_isOn;
|
||||
});
|
||||
changeSettingsRequest();
|
||||
}),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
//锁屏/隐藏无效开锁权限 1:锁屏 2:隐藏无效开锁权限
|
||||
Future<void> changeSettingsRequest() async {
|
||||
ExpireLockListEntity entity =
|
||||
await ApiRepository.to.changeSettings(_isOn == true ? '1' : '2', '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: '操作成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,6 +47,14 @@ class _LockScreenPageState extends State<LockScreenPage> {
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.lockScreen!.tr,
|
||||
// backAction: () {
|
||||
// Navigator.pop(context, true);
|
||||
// },
|
||||
// haveOtherLeftWidget: true,
|
||||
// leftWidget: IconButton(
|
||||
// icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||
// onPressed: () => Navigator.of(context).pop(true),
|
||||
// ),
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Container(
|
||||
@ -83,8 +91,8 @@ class _LockScreenPageState extends State<LockScreenPage> {
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: _isOn == true
|
||||
? TranslationLoader.lanKeys!.open!.tr
|
||||
: TranslationLoader.lanKeys!.closed!.tr,
|
||||
? TranslationLoader.lanKeys!.close!.tr
|
||||
: TranslationLoader.lanKeys!.open!.tr,
|
||||
onClick: () {
|
||||
_isFirst = false;
|
||||
setState(() {
|
||||
|
||||
@ -63,7 +63,10 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.massSendElectronicKeyManagePage);
|
||||
context, Routers.massSendElectronicKeyManagePage)
|
||||
.then((value) {
|
||||
lockUserListRequest();
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.sendGroupKey!.tr,
|
||||
|
||||
@ -142,7 +142,11 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockScreen!.tr,
|
||||
rightTitle: TranslationLoader.lanKeys!.opened!.tr,
|
||||
rightTitle: _userInfoData.userSettings != null
|
||||
? (_userInfoData.userSettings!.lockScreen == 1
|
||||
? TranslationLoader.lanKeys!.opened!.tr
|
||||
: TranslationLoader.lanKeys!.closed!.tr)
|
||||
: TranslationLoader.lanKeys!.closed!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -156,12 +160,24 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader
|
||||
.lanKeys!.hideInvalidUnlockPermissions!.tr,
|
||||
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||
rightTitle: _userInfoData.userSettings != null
|
||||
? (_userInfoData
|
||||
.userSettings!.hideExpiredAccessFlag ==
|
||||
1
|
||||
? TranslationLoader.lanKeys!.opened!.tr
|
||||
: TranslationLoader.lanKeys!.closed!.tr)
|
||||
: TranslationLoader.lanKeys!.closed!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.hideInvalidUnlockPermissionsPage);
|
||||
context, Routers.hideInvalidUnlockPermissionsPage,
|
||||
arguments: {
|
||||
'isOn': _userInfoData
|
||||
.userSettings!.hideExpiredAccessFlag
|
||||
}).then((value) {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!
|
||||
|
||||
@ -96,6 +96,7 @@ abstract class Api {
|
||||
final String addAuthorizedAdminURL = '/authorizedAdmin/add'; //增加授权管理员
|
||||
final String keyListByUserURL = '/keyUser/listByUse'; //用户拥有的锁
|
||||
final String authorizedAdminListURL = '/authorizedAdmin/list'; //授权管理员列表
|
||||
final String authorizedAdminDetailURL = '/authorizedAdmin/detail'; //授权管理员详情
|
||||
final String deleteAdministratorURL = '/authorizedAdmin/delete'; //删除授权管理员
|
||||
final String updateAdministratorURL =
|
||||
'/authorizedAdmin/update'; //管理员姓名/有效期/远程开锁修改
|
||||
|
||||
@ -409,16 +409,16 @@ class ApiProvider extends BaseProvider {
|
||||
post(deleteElectronicKeyURL.toUrl,
|
||||
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
|
||||
|
||||
Future<Response> updateAdministrator(String uid, String name, String endDate,
|
||||
String startDate, String isRemoteUnlock) =>
|
||||
Future<Response> updateAdministrator(String uid, String keyName,
|
||||
String endDate, String startDate, String remoteEnable) =>
|
||||
post(
|
||||
deleteElectronicKeyURL.toUrl,
|
||||
updateAdministratorURL.toUrl,
|
||||
jsonEncode({
|
||||
'uid': uid,
|
||||
'name': name,
|
||||
'keyName': keyName,
|
||||
'endDate': endDate,
|
||||
'startDate': startDate,
|
||||
'isRemoteUnlock': isRemoteUnlock
|
||||
'remoteEnable': remoteEnable
|
||||
}));
|
||||
|
||||
Future<Response> expireLockList(
|
||||
@ -928,17 +928,11 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 更新ICCard序号
|
||||
Future<Response> updateIdCardUserNoLoadData(
|
||||
String cardId,
|
||||
String lockId,
|
||||
String cardUserNo) =>
|
||||
String cardId, String lockId, String cardUserNo) =>
|
||||
post(
|
||||
updateICCardUserNoURL.toUrl,
|
||||
jsonEncode({
|
||||
'cardId': cardId,
|
||||
'lockId': lockId,
|
||||
'cardUserNo': cardUserNo
|
||||
})
|
||||
);
|
||||
jsonEncode(
|
||||
{'cardId': cardId, 'lockId': lockId, 'cardUserNo': cardUserNo}));
|
||||
|
||||
Future<Response> listLockByGroup(String type, String keyGroupId) => post(
|
||||
listLockByGroupURL.toUrl,
|
||||
@ -965,6 +959,26 @@ class ApiProvider extends BaseProvider {
|
||||
authorizedAdminListURL.toUrl,
|
||||
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}));
|
||||
|
||||
Future<Response> authorizedAdminDetail(int uid) =>
|
||||
post(authorizedAdminDetailURL.toUrl, jsonEncode({'uid': uid}));
|
||||
|
||||
Future<Response> deleteAuthorizedAdmin(
|
||||
String uid, String includeUnderlings) =>
|
||||
post(deleteAdministratorURL.toUrl,
|
||||
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
|
||||
|
||||
Future<Response> updateAuthorizedAdmin(String uid, String name,
|
||||
String endDate, String startDate, String isRemoteUnlock) =>
|
||||
post(
|
||||
updateAdministratorURL.toUrl,
|
||||
jsonEncode({
|
||||
'uid': uid,
|
||||
'name': name,
|
||||
'endDate': endDate,
|
||||
'startDate': startDate,
|
||||
'isRemoteUnlock': isRemoteUnlock
|
||||
}));
|
||||
|
||||
Future<Response> setAlertMode(String alertMode, String isOn) => post(
|
||||
setAlertModeURL.toUrl,
|
||||
jsonEncode({'alertMode': alertMode, 'isOn': isOn}));
|
||||
|
||||
@ -61,8 +61,8 @@ class BaseProvider extends GetConnect with Api {
|
||||
return res;
|
||||
}
|
||||
|
||||
getDataResult(T){
|
||||
switch(T["errorCode"]){
|
||||
getDataResult(T) {
|
||||
switch (T["errorCode"]) {
|
||||
case 403:
|
||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||
break;
|
||||
|
||||
@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformat
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
@ -401,10 +402,14 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//更新授权管理员
|
||||
Future<ElectronicKeyListEntity> updateAdministrator(String uid, String name,
|
||||
String endDate, String startDate, String isRemoteUnlock) async {
|
||||
Future<ElectronicKeyListEntity> updateAdministrator(
|
||||
String uid,
|
||||
String keyName,
|
||||
String endDate,
|
||||
String startDate,
|
||||
String remoteEnable) async {
|
||||
final res = await apiProvider.updateAdministrator(
|
||||
uid, name, endDate, startDate, isRemoteUnlock);
|
||||
uid, keyName, endDate, startDate, remoteEnable);
|
||||
return ElectronicKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -650,6 +655,31 @@ class ApiRepository {
|
||||
return AuthorizedAdminListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//授权管理员详情
|
||||
Future<AdministratorDetailEntity> authorizedAdminDetail(int uid) async {
|
||||
final res = await apiProvider.authorizedAdminDetail(uid);
|
||||
return AdministratorDetailEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//删除授权管理员
|
||||
Future<AuthorizedAdminListEntity> deleteAuthorizedAdmin(
|
||||
String uid, String includeUnderlings) async {
|
||||
final res = await apiProvider.deleteAuthorizedAdmin(uid, includeUnderlings);
|
||||
return AuthorizedAdminListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//更新授权管理员
|
||||
Future<AuthorizedAdminListEntity> updateAuthorizedAdmin(
|
||||
String uid,
|
||||
String name,
|
||||
String endDate,
|
||||
String startDate,
|
||||
String isRemoteUnlock) async {
|
||||
final res = await apiProvider.updateAuthorizedAdmin(
|
||||
uid, name, endDate, startDate, isRemoteUnlock);
|
||||
return AuthorizedAdminListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//提示音
|
||||
Future<ExpireLockListEntity> setAlertMode(
|
||||
String alertMode, String isOn) async {
|
||||
@ -995,14 +1025,11 @@ class ApiRepository {
|
||||
|
||||
// 更新ICCard用户序号
|
||||
Future<LoginEntity> updateIdCardUserNoLoadData(
|
||||
{
|
||||
required String lockId,
|
||||
required String cardId,
|
||||
required String cardUserNo
|
||||
}) async {
|
||||
final res =
|
||||
await apiProvider.updateIdCardUserNoLoadData(lockId, cardId, cardUserNo);
|
||||
{required String lockId,
|
||||
required String cardId,
|
||||
required String cardUserNo}) async {
|
||||
final res = await apiProvider.updateIdCardUserNoLoadData(
|
||||
lockId, cardId, cardUserNo);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user