1,新增我的-授权管理员更改有效期逻辑及数据处理
This commit is contained in:
parent
c971b4ad49
commit
3ef9390351
@ -42,7 +42,7 @@ import 'package:star_lock/mine/about/webviewShow_page.dart';
|
|||||||
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart';
|
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart';
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart';
|
||||||
@ -373,7 +373,8 @@ abstract class Routers {
|
|||||||
static const getDeviceListPage = '/getDeviceListPage'; //设备列表
|
static const getDeviceListPage = '/getDeviceListPage'; //设备列表
|
||||||
static const getNameListPage = '/getNameListPage'; //姓名列表
|
static const getNameListPage = '/getNameListPage'; //姓名列表
|
||||||
static const authorityManagementPage = '/authorityManagementPage'; //批量授权
|
static const authorityManagementPage = '/authorityManagementPage'; //批量授权
|
||||||
static const massSendLockGroupListPage = '/massSendLockGroupListPage'; //群发锁分组列表
|
static const massSendLockGroupListPage =
|
||||||
|
'/massSendLockGroupListPage'; //群发锁分组列表
|
||||||
static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人
|
static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人
|
||||||
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
||||||
static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情
|
static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'package:date_format/date_format.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_state.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/dateTool.dart';
|
||||||
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
|
class AdminDetailChangeDateLogic extends BaseGetXController {
|
||||||
|
AdminDetailChangeDateState state = AdminDetailChangeDateState();
|
||||||
|
|
||||||
|
//更新管理员信息请求
|
||||||
|
Future<void> updateAdministratorRequest() async {
|
||||||
|
final int beginTimeTimestamp =
|
||||||
|
DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||||
|
final int endTimeTimestamp =
|
||||||
|
DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||||
|
if (beginTimeTimestamp > endTimeTimestamp ||
|
||||||
|
beginTimeTimestamp == endTimeTimestamp) {
|
||||||
|
showToast('失效时间需大于生效时间'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||||
|
showToast('生效时间需大于当前时间'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final AdministratorDetailEntity entity = await ApiRepository.to
|
||||||
|
.updateAdministrator(
|
||||||
|
uid: state.itemData.value.uid.toString(),
|
||||||
|
endDate: endTimeTimestamp.toString(),
|
||||||
|
startDate: beginTimeTimestamp.toString(),
|
||||||
|
keyName: '',
|
||||||
|
isOnlyManageSelf:
|
||||||
|
state.itemData.value.onlyManageYouCreatesUser == true ? 1 : 2);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
EasyLoading.showToast('修改成功', duration: 2000.milliseconds);
|
||||||
|
eventBus.fire(MineAuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back(result: <String, int>{
|
||||||
|
'beginTimeTimestamp': beginTimeTimestamp,
|
||||||
|
'endTimeTimestamp': endTimeTimestamp,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_logic.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_state.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../../tools/dateTool.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() =>
|
||||||
|
_AdminDetailChangeDatePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AdminDetailChangeDatePageState extends State<AdminDetailChangeDatePage> {
|
||||||
|
final AdminDetailChangeDateLogic logic =
|
||||||
|
Get.put(AdminDetailChangeDateLogic());
|
||||||
|
final AdminDetailChangeDateState state =
|
||||||
|
Get.find<AdminDetailChangeDateLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
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: logic.updateAdministratorRequest,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: buildMainUI(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildMainUI() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
rightTitle: state.beginTime.value,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
final PDuration selectDate =
|
||||||
|
PDuration.parse(DateTime.tryParse(state.beginTime.value));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
|
rightTitle: state.endTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
final PDuration selectDate =
|
||||||
|
PDuration.parse(DateTime.tryParse(state.endTime.value));
|
||||||
|
Pickers.showDatePicker(context,
|
||||||
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
|
class AdminDetailChangeDateState {
|
||||||
|
AdminDetailChangeDateState() {
|
||||||
|
final Map map = Get.arguments;
|
||||||
|
if (map['itemData'] != null) {
|
||||||
|
itemData.value = map['itemData'];
|
||||||
|
|
||||||
|
keyId.value = itemData.value.keyId!;
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rx<AuthorizedAdminListItem> itemData = AuthorizedAdminListItem().obs;
|
||||||
|
|
||||||
|
var beginTime = ''.obs; // 开始时间
|
||||||
|
var endTime = ''.obs; // 结束时间
|
||||||
|
|
||||||
|
var keyId = 0.obs;
|
||||||
|
var lockId = 0.obs;
|
||||||
|
var isOnlyManageSelf = 0.obs;
|
||||||
|
}
|
||||||
@ -1,123 +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/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.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 'package:star_lock/tools/pickers/time_picker/model/pduration.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: () {
|
|
||||||
PDuration selectDate = PDuration.parse(_effectiveDateTime);
|
|
||||||
Pickers.showDatePicker(context,
|
|
||||||
selectDate: selectDate, 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: () {
|
|
||||||
PDuration selectDate = PDuration.parse(_failureDateTime);
|
|
||||||
Pickers.showDatePicker(context,
|
|
||||||
selectDate: selectDate, 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 {
|
|
||||||
final ElectronicKeyListEntity entity = await ApiRepository.to
|
|
||||||
.updateAdministrator(
|
|
||||||
uid: itemData.uid.toString(),
|
|
||||||
endDate: _failureDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
startDate: _effectiveDateTime.millisecondsSinceEpoch.toString(),
|
|
||||||
keyName: '',
|
|
||||||
isOnlyManageSelf:
|
|
||||||
itemData.onlyManageYouCreatesUser == true ? 1 : 2);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
EasyLoading.showToast('修改成功', duration: 2000.milliseconds);
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String intToStr(int v) {
|
|
||||||
return (v < 10) ? '0$v' : '$v';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -31,7 +31,7 @@ class AdministratorDetailsLogic extends BaseGetXController {
|
|||||||
if (!isChangeName) {
|
if (!isChangeName) {
|
||||||
isManageCreateUser = state.onlyManageYouCreatesUser.value == true ? 2 : 1;
|
isManageCreateUser = state.onlyManageYouCreatesUser.value == true ? 2 : 1;
|
||||||
}
|
}
|
||||||
final ElectronicKeyListEntity entity = await ApiRepository.to
|
final AdministratorDetailEntity entity = await ApiRepository.to
|
||||||
.updateAdministrator(
|
.updateAdministrator(
|
||||||
uid: state.itemData.value.uid.toString(),
|
uid: state.itemData.value.uid.toString(),
|
||||||
keyName: isChangeName
|
keyName: isChangeName
|
||||||
@ -147,29 +147,29 @@ class AdministratorDetailsLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
|
String getUseDateStr() {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
if (state.itemData.value.keyType == XSConstantMacro.keyTypeTime) {
|
||||||
//限期
|
//限期
|
||||||
final DateTime startDateStr =
|
final DateTime startDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||||
final DateTime endDateStr =
|
final DateTime endDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
} else if (state.itemData.value.keyType == XSConstantMacro.keyTypeLong) {
|
||||||
//永久
|
//永久
|
||||||
final DateTime dateStr =
|
final DateTime dateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.date!);
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'${dateStr.toLocal().toString().substring(0, 16)}\n${"永久".tr}';
|
'${dateStr.toLocal().toString().substring(0, 16)}\n${"永久".tr}';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
} else if (state.itemData.value.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
//单次
|
//单次
|
||||||
final DateTime dateStr =
|
final DateTime dateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.date!);
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'${dateStr.toLocal().toString().substring(0, 16)} \n${"单次".tr}';
|
'${dateStr.toLocal().toString().substring(0, 16)} \n${"单次".tr}';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
} else if (state.itemData.value.keyType == XSConstantMacro.keyTypeLoop) {
|
||||||
//循环
|
//循环
|
||||||
useDateStr = '循环'.tr;
|
useDateStr = '循环'.tr;
|
||||||
}
|
}
|
||||||
@ -178,21 +178,8 @@ class AdministratorDetailsLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
administratorDetailRequest();
|
administratorDetailRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,14 +67,22 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
allHeight: 90.h,
|
allHeight: 90.h,
|
||||||
rightTitle: logic.getUseDateStr(state.itemData.value),
|
rightTitle: logic.getUseDateStr(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () async {
|
||||||
Navigator.pushNamed(
|
final data = await Get.toNamed(
|
||||||
context, Routers.adminDetailChangeDatePage,
|
Routers.adminDetailChangeDatePage,
|
||||||
arguments: <String, AuthorizedAdminListItem>{
|
arguments: <String, AuthorizedAdminListItem>{
|
||||||
'itemData': state.itemData.value
|
'itemData': state.itemData.value,
|
||||||
});
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.itemData.value.startDate =
|
||||||
|
data['beginTimeTimestamp'];
|
||||||
|
state.itemData.value.endDate = data['endTimeTimestamp'];
|
||||||
|
state.itemData.value.keyType = 2;
|
||||||
|
});
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
|
|||||||
@ -71,12 +71,13 @@ class AuthorizedAdministratorListLogic extends BaseGetXController {
|
|||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 刷新电子钥匙列表
|
/// 刷新我的设置-授权管理员列表
|
||||||
StreamSubscription? _authorizedAdministratorListPageRefreshUIEvent;
|
late StreamSubscription _getMineAuthorizedAdminPageRefreshUIEvent;
|
||||||
void _authorizedAdministratorListPageRefreshUIAction() {
|
void _getMineAuthorizedAdminPageRefreshUIEventAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_authorizedAdministratorListPageRefreshUIEvent =
|
_getMineAuthorizedAdminPageRefreshUIEvent = eventBus
|
||||||
eventBus.on<AuthorizedAdministratorListPageRefreshUI>().listen((event) {
|
.on<MineAuthorizedAdminPageRefreshUI>()
|
||||||
|
.listen((MineAuthorizedAdminPageRefreshUI event) {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
});
|
});
|
||||||
@ -84,21 +85,13 @@ class AuthorizedAdministratorListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
_authorizedAdministratorListPageRefreshUIAction();
|
_getMineAuthorizedAdminPageRefreshUIEventAction();
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
_authorizedAdministratorListPageRefreshUIEvent?.cancel();
|
_getMineAuthorizedAdminPageRefreshUIEvent?.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -421,8 +421,11 @@ class ApiRepository {
|
|||||||
|
|
||||||
// 获取锁信息列表
|
// 获取锁信息列表
|
||||||
Future<LockListInfoEntity> getStarLockListInfo(
|
Future<LockListInfoEntity> getStarLockListInfo(
|
||||||
{required int pageNo, required int pageSize,required bool isUnShowLoading}) async {
|
{required int pageNo,
|
||||||
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize,isUnShowLoading:isUnShowLoading);
|
required int pageSize,
|
||||||
|
required bool isUnShowLoading}) async {
|
||||||
|
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize,
|
||||||
|
isUnShowLoading: isUnShowLoading);
|
||||||
return LockListInfoEntity.fromJson(res.body);
|
return LockListInfoEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +620,7 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//更新授权管理员
|
//更新授权管理员
|
||||||
Future<ElectronicKeyListEntity> updateAdministrator(
|
Future<AdministratorDetailEntity> updateAdministrator(
|
||||||
{required String uid,
|
{required String uid,
|
||||||
required String keyName,
|
required String keyName,
|
||||||
required String endDate,
|
required String endDate,
|
||||||
@ -625,7 +628,7 @@ class ApiRepository {
|
|||||||
required int isOnlyManageSelf}) async {
|
required int isOnlyManageSelf}) async {
|
||||||
final res = await apiProvider.updateAdministrator(
|
final res = await apiProvider.updateAdministrator(
|
||||||
uid, keyName, endDate, startDate, isOnlyManageSelf);
|
uid, keyName, endDate, startDate, isOnlyManageSelf);
|
||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return AdministratorDetailEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置授权管理员
|
//设置授权管理员
|
||||||
|
|||||||
@ -137,6 +137,11 @@ class AuthorizedAdminPageRefreshUI {
|
|||||||
AuthorizedAdminPageRefreshUI();
|
AuthorizedAdminPageRefreshUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 刷新我的设置-授权管理员列表
|
||||||
|
class MineAuthorizedAdminPageRefreshUI {
|
||||||
|
MineAuthorizedAdminPageRefreshUI();
|
||||||
|
}
|
||||||
|
|
||||||
/// 刷新门锁日志列表
|
/// 刷新门锁日志列表
|
||||||
class DoorLockLogListRefreshUI {
|
class DoorLockLogListRefreshUI {
|
||||||
DateTime getDoorLockLogTime;
|
DateTime getDoorLockLogTime;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user