Merge branches 'master' and 'master' of https://gitee.com/weishaoyang/star_lock
# Conflicts: # star_lock/lib/appRouters.dart # star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart # star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart # star_lock/lib/network/api.dart # star_lock/lib/network/api_provider.dart # star_lock/lib/network/api_repository.dart
This commit is contained in:
commit
2b7dd44856
BIN
star_lock/images/icon_massSend_delete.png
Normal file
BIN
star_lock/images/icon_massSend_delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@ -1,7 +1,11 @@
|
|||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||||
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
import 'package:star_lock/login/register/starLock_register_binding.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/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserList_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
||||||
@ -153,10 +157,8 @@ abstract class Routers {
|
|||||||
static const otherTypeKeyManagePage =
|
static const otherTypeKeyManagePage =
|
||||||
'/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加
|
'/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加
|
||||||
|
|
||||||
static const addFingerprintTipPage =
|
static const addFingerprintTipPage = '/AddFingerprintTipPage'; // 添加指纹提示
|
||||||
'/AddFingerprintTipPage'; // 添加指纹提示
|
static const addFingerprintPage = '/AddFingerprintPage'; // 添加指纹
|
||||||
static const addFingerprintPage =
|
|
||||||
'/AddFingerprintPage'; // 添加指纹
|
|
||||||
|
|
||||||
static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表
|
static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表
|
||||||
static const authorizedAdminDetailPage =
|
static const authorizedAdminDetailPage =
|
||||||
@ -293,6 +295,9 @@ 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 massSendLockGroupPage = '/massSendLockGroupPage'; //群发锁分组列表
|
||||||
|
static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人
|
||||||
|
static const lockUserListPage = '/lockUserListPage'; //锁用户列表
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AppRouters {
|
abstract class AppRouters {
|
||||||
@ -732,12 +737,23 @@ abstract class AppRouters {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.authorityManagementPage,
|
name: Routers.authorityManagementPage,
|
||||||
page: () => const AuthorityManagementPage()),
|
page: () => const AuthorityManagementPage()),
|
||||||
GetPage(name: Routers.addFingerprintTipPage, page: () => const AddFingerprintTipPage()),
|
GetPage(
|
||||||
|
name: Routers.addFingerprintTipPage,
|
||||||
|
page: () => const AddFingerprintTipPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addFingerprintPage,
|
name: Routers.addFingerprintPage,
|
||||||
page: () => const AddFingerprintPage()),
|
page: () => const AddFingerprintPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.configuringWifiPage,
|
name: Routers.configuringWifiPage,
|
||||||
page: () => const ConfiguringWifiPage()),
|
page: () => const ConfiguringWifiPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.massSendLockGroupPage,
|
||||||
|
page: () => const MassSendLockGroupListPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.massSendReceiverPage,
|
||||||
|
page: () => const MassSendReceiverPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.lockUserListPage, page: () => const LockUserListPage())
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -276,9 +276,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
BuildContext context,
|
|
||||||
) {
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.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/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -33,6 +34,8 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
late String endDay = '';
|
late String endDay = '';
|
||||||
late String startDay = '';
|
late String startDay = '';
|
||||||
late List weekDays = [];
|
late List weekDays = [];
|
||||||
|
late String pwdId = '';
|
||||||
|
late String lockId = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -40,6 +43,12 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
if (obj != null && (obj["itemData"] != null)) {
|
if (obj != null && (obj["itemData"] != null)) {
|
||||||
itemData = obj["itemData"];
|
itemData = obj["itemData"];
|
||||||
}
|
}
|
||||||
|
if (obj != null && (obj["pwdId"] != null)) {
|
||||||
|
pwdId = obj["pwdId"];
|
||||||
|
}
|
||||||
|
if (obj != null && (obj["lockId"] != null)) {
|
||||||
|
lockId = obj["lockId"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
@ -55,7 +64,11 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
updateKeyDateRequest();
|
if (lockId.isNotEmpty && pwdId.isNotEmpty) {
|
||||||
|
updatePwdRequest();
|
||||||
|
} else {
|
||||||
|
updateKeyDateRequest();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -120,6 +133,24 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新密码请求
|
||||||
|
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) {
|
String intToStr(int v) {
|
||||||
return (v < 10) ? "0$v" : "$v";
|
return (v < 10) ? "0$v" : "$v";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
|
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
@ -87,12 +85,16 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
|||||||
rightTitle: TranslationLoader.lanKeys!.pleaseAdd!.tr,
|
rightTitle: TranslationLoader.lanKeys!.pleaseAdd!.tr,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {}),
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.massSendReceiverPage);
|
||||||
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr,
|
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {}),
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.massSendLockGroupPage);
|
||||||
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -0,0 +1,70 @@
|
|||||||
|
class MassSendLockGroupListEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
LockListData? data;
|
||||||
|
|
||||||
|
MassSendLockGroupListEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
MassSendLockGroupListEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? LockListData.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 LockListData {
|
||||||
|
List<LockListItem>? lockList;
|
||||||
|
|
||||||
|
LockListData({this.lockList});
|
||||||
|
|
||||||
|
LockListData.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['list'] != null) {
|
||||||
|
lockList = <LockListItem>[];
|
||||||
|
json['list'].forEach((v) {
|
||||||
|
lockList!.add(LockListItem.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (lockList != null) {
|
||||||
|
data['list'] = lockList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockListItem {
|
||||||
|
int? lockId;
|
||||||
|
String? lockAlias;
|
||||||
|
bool? isRefresh = false;
|
||||||
|
|
||||||
|
LockListItem({this.lockId, this.lockAlias, this.isRefresh});
|
||||||
|
|
||||||
|
LockListItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
lockId = json['lockId'];
|
||||||
|
lockAlias = json['lockAlias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['lockId'] = lockId;
|
||||||
|
data['lockAlias'] = lockAlias;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/utils.dart';
|
import 'package:get/utils.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/ExpandedListView.dart';
|
import 'package:star_lock/tools/ExpandedListView.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
class MassSendLockGroupListPage extends StatefulWidget {
|
class MassSendLockGroupListPage extends StatefulWidget {
|
||||||
@ -15,9 +19,15 @@ class MassSendLockGroupListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||||
|
List lockListByGroup = [];
|
||||||
|
List lockGroupList = [];
|
||||||
|
List clickIndexList = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -26,7 +36,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
title: Text(
|
title: Text(
|
||||||
TranslationLoader.lanKeys!.authorityManagement!.tr,
|
TranslationLoader.lanKeys!.lock!.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 28.sp,
|
fontSize: 28.sp,
|
||||||
@ -39,75 +49,94 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
SizedBox(
|
||||||
'请选择要发送的锁',
|
height: 10.h,
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
|
||||||
),
|
),
|
||||||
_keyGroupList()
|
Container(
|
||||||
|
width: ScreenUtil().screenWidth,
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
child: Text('请选择要发送的锁',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
Expanded(child: _buildListView(context, lockGroupList)),
|
||||||
|
SizedBox(
|
||||||
|
height: 40.h,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备列表
|
//分组列表请求
|
||||||
Widget _keyGroupList() {
|
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
||||||
return Column(
|
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||||
children: [
|
List<LockGroupItem> dataList = [];
|
||||||
SizedBox(
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
height: 10.h,
|
if (entity.data != null) {
|
||||||
),
|
dataList = entity.data!.itemList!;
|
||||||
Expanded(
|
}
|
||||||
child: ListView.separated(
|
}
|
||||||
itemBuilder: (context, index) {
|
lockGroupList = dataList;
|
||||||
if (index == 0) {
|
setState(() {});
|
||||||
return _buildLockExpandedList(context, index, "大门锁");
|
return dataList;
|
||||||
} else if (index == 1) {
|
}
|
||||||
return _buildLockExpandedList(context, index, "办公室锁");
|
|
||||||
} else if (index == 2) {
|
//分组列表请求
|
||||||
return _buildLockExpandedList(context, index, "会议室锁");
|
Future<List<LockListItem>> listLockByGroup(String groupId) async {
|
||||||
} else {
|
MassSendLockGroupListEntity entity =
|
||||||
return _buildLockExpandedList(context, index, "宴会厅锁");
|
await ApiRepository.to.listLockByGroup('3', groupId);
|
||||||
}
|
List<LockListItem> dataList = [];
|
||||||
},
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
separatorBuilder: (context, index) {
|
if (entity.data != null) {
|
||||||
return const Divider(
|
dataList = entity.data!.lockList!;
|
||||||
height: 1,
|
}
|
||||||
color: AppColors.greyLineColor,
|
}
|
||||||
);
|
lockListByGroup = dataList;
|
||||||
},
|
|
||||||
itemCount: 5)),
|
setState(() {});
|
||||||
],
|
return dataList;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
Widget _buildListView(BuildContext context, List itemList) {
|
||||||
|
return ListView.separated(
|
||||||
|
itemCount: itemList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
LockGroupItem itemData = itemList[index];
|
||||||
|
return _buildLockExpandedList(context, index, itemData);
|
||||||
|
},
|
||||||
|
shrinkWrap: true,
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备多层级列表
|
//设备多层级列表
|
||||||
Widget _buildLockExpandedList(context, index, deviceName) {
|
Widget _buildLockExpandedList(context, index, LockGroupItem itemData) {
|
||||||
return ExpandedListTile(
|
return ExpandedListTile(
|
||||||
onTap: () => print("onTap."),
|
onTap: () {
|
||||||
title: deviceName,
|
listLockByGroup(itemData.keyGroupId.toString());
|
||||||
imgName: 'images/icon_lock.png',
|
clickIndexList.add(index);
|
||||||
|
},
|
||||||
|
title: itemData.keyGroupName!,
|
||||||
|
imgName: '',
|
||||||
typeImgList: const [],
|
typeImgList: const [],
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: 10,
|
itemCount: lockListByGroup.length,
|
||||||
itemBuilder: (_, index) {
|
itemBuilder: (_, itemIndex) {
|
||||||
if (index == 0) {
|
LockListItem itemData = lockListByGroup[itemIndex];
|
||||||
return _buildNameWidget(
|
return _buildNameWidget(context, itemIndex,
|
||||||
context, index, 'images/icon_password.png', '张三');
|
'images/icon_password.png', itemData.lockAlias);
|
||||||
} else if (index == 1) {
|
|
||||||
return _buildNameWidget(
|
|
||||||
context, index, 'images/icon_card.png', '李四');
|
|
||||||
} else if (index == 2) {
|
|
||||||
return _buildNameWidget(
|
|
||||||
context, index, 'images/icon_fingerprint.png', '王二');
|
|
||||||
} else if (index == 3) {
|
|
||||||
return _buildNameWidget(
|
|
||||||
context, index, 'images/icon_card.png', '麻子');
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return const Divider(
|
return const Divider(
|
||||||
@ -132,7 +161,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
width: 30.w,
|
width: 30.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/controls_user.png',
|
'images/mine/icon_mine_gatewaySignal_prompt.png',
|
||||||
width: 36.w,
|
width: 36.w,
|
||||||
height: 36.w,
|
height: 36.w,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -0,0 +1,59 @@
|
|||||||
|
class LockUserListEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
List<LockUserData>? data;
|
||||||
|
|
||||||
|
LockUserListEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
LockUserListEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
if (json['data'] != null) {
|
||||||
|
data = <LockUserData>[];
|
||||||
|
json['data'].forEach((v) {
|
||||||
|
data!.add(LockUserData.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockUserData {
|
||||||
|
int? uid;
|
||||||
|
String? nickname;
|
||||||
|
String? headUrl;
|
||||||
|
String? userid;
|
||||||
|
bool? isCheck = false;
|
||||||
|
|
||||||
|
LockUserData(
|
||||||
|
{this.uid, this.nickname, this.headUrl, this.userid, this.isCheck});
|
||||||
|
|
||||||
|
LockUserData.fromJson(Map<String, dynamic> json) {
|
||||||
|
uid = json['uid'];
|
||||||
|
nickname = json['nickname'];
|
||||||
|
headUrl = json['headUrl'];
|
||||||
|
userid = json['userid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['uid'] = uid;
|
||||||
|
data['nickname'] = nickname;
|
||||||
|
data['headUrl'] = headUrl;
|
||||||
|
data['userid'] = userid;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,224 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/utils.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class LockUserListPage extends StatefulWidget {
|
||||||
|
const LockUserListPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _LockUserListPageState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LockUserListPageState extends State<LockUserListPage> {
|
||||||
|
List<LockUserData> dataList = [];
|
||||||
|
List selectUserIdList = [];
|
||||||
|
List<LockUserData> selectDataList = [];
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
lockUserListRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
title: Text(
|
||||||
|
'选择用户',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
_searchWidget(),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
LockUserData indexEntity = dataList[index];
|
||||||
|
return _electronicKeyItem(indexEntity);
|
||||||
|
},
|
||||||
|
itemCount: dataList.length,
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const Divider(height: 1, color: AppColors.greyLineColor);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
Container(
|
||||||
|
height: 120.h,
|
||||||
|
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 0.h),
|
||||||
|
margin: const EdgeInsets.only(left: 0, right: 0, bottom: 0),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'已选中:${selectUserIdList.length}',
|
||||||
|
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
width: 120.w,
|
||||||
|
height: 60.h,
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: '确定',
|
||||||
|
onClick: () {
|
||||||
|
Map<String, dynamic> resultMap = {};
|
||||||
|
resultMap['lockUserList'] = selectDataList;
|
||||||
|
Navigator.pop(context, resultMap);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _searchWidget() {
|
||||||
|
return Container(
|
||||||
|
height: 60.h,
|
||||||
|
margin: EdgeInsets.only(left: 20.w, right: 10.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||||
|
child: TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
// controller: _controller,
|
||||||
|
autofocus: false,
|
||||||
|
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
contentPadding: const EdgeInsets.only(
|
||||||
|
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||||
|
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
||||||
|
//不需要输入框下划线
|
||||||
|
border: InputBorder.none,
|
||||||
|
//左边图标设置
|
||||||
|
icon: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
||||||
|
child: Image.asset(
|
||||||
|
'images/main/icon_main_search.png',
|
||||||
|
width: 40.w,
|
||||||
|
height: 40.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _electronicKeyItem(LockUserData itemData) {
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: 90.h,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 30.w,
|
||||||
|
),
|
||||||
|
Image.asset(
|
||||||
|
'images/controls_user.png',
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
itemData.nickname!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp, color: AppColors.blackColor),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
itemData.userid!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
color: AppColors.placeholderTextColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(width: 20.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
itemData.isCheck = !itemData.isCheck!;
|
||||||
|
if (itemData.isCheck == true) {
|
||||||
|
selectUserIdList.add(itemData.userid);
|
||||||
|
selectDataList.add(itemData);
|
||||||
|
} else {
|
||||||
|
selectUserIdList.remove(itemData.userid);
|
||||||
|
selectDataList.remove(itemData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
itemData.isCheck!
|
||||||
|
? 'images/icon_round_selet.png'
|
||||||
|
: 'images/icon_round_unSelet.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
)),
|
||||||
|
SizedBox(width: 20.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//请求锁用户列表
|
||||||
|
Future<List<LockUserData>> lockUserListRequest() async {
|
||||||
|
LockUserListEntity entity =
|
||||||
|
await ApiRepository.to.lockUserList('1', '20', '');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
setState(() {
|
||||||
|
dataList = entity.data!;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,258 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/utils.dart';
|
||||||
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserListEntity.dart';
|
||||||
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MassSendReceiverPage extends StatefulWidget {
|
||||||
|
const MassSendReceiverPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _MassSendReceiverPageState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
|
||||||
|
late List<LockUserData> _lockUserList = [];
|
||||||
|
TextEditingController emailOrPhoneController = TextEditingController();
|
||||||
|
TextEditingController keyNameController = TextEditingController();
|
||||||
|
|
||||||
|
String countryCode = '86';
|
||||||
|
String countryName = '中国';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
LockUserData data = LockUserData();
|
||||||
|
_lockUserList.add(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
title: Text(
|
||||||
|
'接收者',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
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(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [controlViewTitle(0), controlViewTitle(1)],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 2.h,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
LockUserData data = _lockUserList[index];
|
||||||
|
return _itemBuilder(index, data);
|
||||||
|
},
|
||||||
|
itemCount: _lockUserList.length,
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return Divider(
|
||||||
|
height: 20.h,
|
||||||
|
color: AppColors.greyBackgroundColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget controlViewTitle(int btnIndex) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
width: (ScreenUtil().screenWidth - 60.w) / 2,
|
||||||
|
height: 90.h,
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_btn_add.png',
|
||||||
|
width: 28.w,
|
||||||
|
height: 28.w,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 6.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
btnIndex == 0 ? '已有' : '新增',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
if (btnIndex == 0) {
|
||||||
|
//已有
|
||||||
|
Navigator.pushNamed(context, Routers.lockUserListPage).then((val) {
|
||||||
|
if (val != null) {
|
||||||
|
val as Map<String, dynamic>;
|
||||||
|
_lockUserList = val['lockUserList'];
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (btnIndex == 1) {
|
||||||
|
//新增
|
||||||
|
_lockUserList.add(LockUserData());
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _itemBuilder(int index, LockUserData userData) {
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 40.w,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_massSend_delete.png',
|
||||||
|
width: 26.w,
|
||||||
|
height: 26.w,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
_lockUserList.removeAt(index - 1);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
|
rightTitle: userData.userid ?? ' ',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: getTFWidget(
|
||||||
|
true,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
|
1)),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
rightTitle: userData.nickname ?? ' ',
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: getTFWidget(
|
||||||
|
false, TranslationLoader.lanKeys!.enterYourName!.tr, 2)),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接受者信息输入框
|
||||||
|
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 50.h,
|
||||||
|
width: 320.w,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller:
|
||||||
|
lineIndex == 1 ? emailOrPhoneController : keyNameController,
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
// controller: _controller,
|
||||||
|
autofocus: false,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
|
hintText: tfStr,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
//不需要输入框下划线
|
||||||
|
border: InputBorder.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
isHaveBtn
|
||||||
|
? Container(
|
||||||
|
width: 32.w,
|
||||||
|
height: 32.w,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('images/icon_addressBook.png'),
|
||||||
|
fit: BoxFit.fill),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
// Contact? currentContact =
|
||||||
|
// await _contactPicker.selectContact();
|
||||||
|
// setState(() {
|
||||||
|
// _contact = currentContact!;
|
||||||
|
// // print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,149 @@
|
|||||||
|
class KeyDetailEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
LockData? data;
|
||||||
|
|
||||||
|
KeyDetailEntity({this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
KeyDetailEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? LockData.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 LockData {
|
||||||
|
int? keyId;
|
||||||
|
int? lockId;
|
||||||
|
String? lockName;
|
||||||
|
String? lockAlias;
|
||||||
|
int? userType;
|
||||||
|
int? keyStatus;
|
||||||
|
int? startDate;
|
||||||
|
int? endDate;
|
||||||
|
int? keyRight;
|
||||||
|
int? keyType;
|
||||||
|
String? remarks;
|
||||||
|
int? remoteEnable;
|
||||||
|
int? appUnlockMustOnline;
|
||||||
|
int? lockUserNo;
|
||||||
|
LockItem? lockData;
|
||||||
|
String? lockMac;
|
||||||
|
int? noKeyPwd;
|
||||||
|
int? electricQuantity;
|
||||||
|
String? featureValue;
|
||||||
|
int? groupId;
|
||||||
|
String? groupName;
|
||||||
|
|
||||||
|
LockData(
|
||||||
|
{this.keyId,
|
||||||
|
this.lockId,
|
||||||
|
this.lockName,
|
||||||
|
this.lockAlias,
|
||||||
|
this.userType,
|
||||||
|
this.keyStatus,
|
||||||
|
this.startDate,
|
||||||
|
this.endDate,
|
||||||
|
this.keyRight,
|
||||||
|
this.keyType,
|
||||||
|
this.remarks,
|
||||||
|
this.remoteEnable,
|
||||||
|
this.appUnlockMustOnline,
|
||||||
|
this.lockUserNo,
|
||||||
|
this.lockData,
|
||||||
|
this.lockMac,
|
||||||
|
this.noKeyPwd,
|
||||||
|
this.electricQuantity,
|
||||||
|
this.featureValue,
|
||||||
|
this.groupId,
|
||||||
|
this.groupName});
|
||||||
|
|
||||||
|
LockData.fromJson(Map<String, dynamic> json) {
|
||||||
|
keyId = json['keyId'];
|
||||||
|
lockId = json['lockId'];
|
||||||
|
lockName = json['lockName'];
|
||||||
|
lockAlias = json['lockAlias'];
|
||||||
|
userType = json['userType'];
|
||||||
|
keyStatus = json['keyStatus'];
|
||||||
|
json['startDate'] != null ? startDate = json['startDate'] : 0;
|
||||||
|
json['endDate'] != null ? endDate = json['endDate'] : 0;
|
||||||
|
keyRight = json['keyRight'];
|
||||||
|
keyType = json['keyType'];
|
||||||
|
json['remarks'] != null ? remarks = json['remarks'] : "";
|
||||||
|
json['remoteEnable'] != null ? remoteEnable = json['remoteEnable'] : 0;
|
||||||
|
json['appUnlockMustOnline'] != null
|
||||||
|
? appUnlockMustOnline = json['appUnlockMustOnline']
|
||||||
|
: 0;
|
||||||
|
json['lockUserNo'] != null ? lockUserNo = json['lockUserNo'] : 0;
|
||||||
|
lockData =
|
||||||
|
json['lockData'] != null ? LockItem.fromJson(json['lockData']) : null;
|
||||||
|
lockMac = json['lockMac'];
|
||||||
|
json['noKeyPwd'] != null ? noKeyPwd = json['noKeyPwd'] : 0;
|
||||||
|
json['electricQuantity'] != null
|
||||||
|
? electricQuantity = json['electricQuantity']
|
||||||
|
: 0;
|
||||||
|
json['featureValue'] != null ? featureValue = json['featureValue'] : "";
|
||||||
|
json['groupId'] != null ? groupId = json['groupId'] : 0;
|
||||||
|
groupName = json['groupName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['keyId'] = keyId;
|
||||||
|
data['lockId'] = lockId;
|
||||||
|
data['lockName'] = lockName;
|
||||||
|
data['lockAlias'] = lockAlias;
|
||||||
|
data['userType'] = userType;
|
||||||
|
data['keyStatus'] = keyStatus;
|
||||||
|
data['startDate'] = startDate;
|
||||||
|
data['endDate'] = endDate;
|
||||||
|
data['keyRight'] = keyRight;
|
||||||
|
data['keyType'] = keyType;
|
||||||
|
data['remarks'] = remarks;
|
||||||
|
data['remoteEnable'] = remoteEnable;
|
||||||
|
data['appUnlockMustOnline'] = appUnlockMustOnline;
|
||||||
|
data['lockUserNo'] = lockUserNo;
|
||||||
|
if (lockData != null) {
|
||||||
|
data['lockData'] = lockData!.toJson();
|
||||||
|
}
|
||||||
|
data['lockMac'] = lockMac;
|
||||||
|
data['noKeyPwd'] = noKeyPwd;
|
||||||
|
data['electricQuantity'] = electricQuantity;
|
||||||
|
data['featureValue'] = featureValue;
|
||||||
|
data['groupId'] = groupId;
|
||||||
|
data['groupName'] = groupName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LockItem {
|
||||||
|
String? lockName;
|
||||||
|
String? lockMac;
|
||||||
|
|
||||||
|
LockItem({this.lockName, this.lockMac});
|
||||||
|
|
||||||
|
LockItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
lockName = json['lockName'];
|
||||||
|
lockMac = json['lockMac'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['lockName'] = lockName;
|
||||||
|
data['lockMac'] = lockMac;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.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';
|
||||||
|
|
||||||
@ -19,6 +21,9 @@ class BasicInformationPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _BasicInformationPageState extends State<BasicInformationPage> {
|
class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||||
late String _groupName = "";
|
late String _groupName = "";
|
||||||
|
late KeyInfos keyInfo;
|
||||||
|
late LockMainEntity lockMainEntity;
|
||||||
|
late LockData _lockData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -28,115 +33,174 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["keyInfo"] != null)) {
|
||||||
|
keyInfo = obj["keyInfo"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.basicInformation!.tr,
|
barTitle: TranslationLoader.lanKeys!.basicInformation!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: FutureBuilder<LockData>(
|
||||||
children: [
|
future: mockNetworkDataRequest(),
|
||||||
Expanded(
|
builder: (BuildContext context, AsyncSnapshot<LockData> snapshot) {
|
||||||
child: ListView(
|
//请求结束
|
||||||
children: [
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
CommonItem(
|
if (snapshot.hasError) {
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockNumber!.tr,
|
//请求失败
|
||||||
rightTitle: "MCBN0c_8f3106",
|
return const Text('请求失败');
|
||||||
allHeight: 70.h,
|
} else {
|
||||||
isHaveLine: true),
|
//请求成功
|
||||||
CommonItem(
|
final LockData itemData = snapshot.data!;
|
||||||
leftTitel: "MAC/ID",
|
|
||||||
rightTitle: "53:66:9F:06:31:8F/9418481",
|
return Column(
|
||||||
allHeight: 70.h,
|
children: [
|
||||||
isHaveLine: false),
|
Expanded(
|
||||||
SizedBox(
|
child: ListView(
|
||||||
height: 10.h,
|
children: [
|
||||||
),
|
CommonItem(
|
||||||
CommonItem(
|
leftTitel:
|
||||||
leftTitel:
|
TranslationLoader.lanKeys!.lockNumber!.tr,
|
||||||
TranslationLoader.lanKeys!.electricQuantity!.tr,
|
rightTitle: itemData.lockAlias,
|
||||||
rightTitle: "100%",
|
allHeight: 70.h,
|
||||||
isHaveLine: true,
|
isHaveLine: true),
|
||||||
isHaveDirection: true,
|
CommonItem(
|
||||||
action: () {
|
leftTitel: "MAC/ID",
|
||||||
Navigator.pushNamed(
|
rightTitle: itemData.lockMac,
|
||||||
context, Routers.uploadElectricQuantityPage);
|
allHeight: 70.h,
|
||||||
}),
|
isHaveLine: false),
|
||||||
CommonItem(
|
SizedBox(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
height: 10.h,
|
||||||
rightTitle: "永久",
|
),
|
||||||
allHeight: 70.h,
|
CommonItem(
|
||||||
isHaveLine: false),
|
leftTitel: TranslationLoader
|
||||||
SizedBox(
|
.lanKeys!.electricQuantity!.tr,
|
||||||
height: 10.h,
|
rightTitle: "${itemData.electricQuantity}%",
|
||||||
),
|
isHaveLine: true,
|
||||||
CommonItem(
|
isHaveDirection: true,
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
|
action: () {
|
||||||
rightTitle: "MCBN0c_8f3106",
|
Navigator.pushNamed(context,
|
||||||
isHaveLine: true,
|
Routers.uploadElectricQuantityPage);
|
||||||
isHaveDirection: true,
|
}),
|
||||||
action: () {
|
CommonItem(
|
||||||
Navigator.pushNamed(context, Routers.editLockNamePage);
|
leftTitel: TranslationLoader
|
||||||
}),
|
.lanKeys!.periodValidity!.tr,
|
||||||
CommonItem(
|
rightTitle: getUseDateStr(itemData),
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
allHeight: 70.h,
|
||||||
rightTitle: _groupName,
|
isHaveLine: false),
|
||||||
isHaveLine: true,
|
SizedBox(
|
||||||
isHaveDirection: true,
|
height: 10.h,
|
||||||
action: () async {
|
),
|
||||||
var result = await Navigator.pushNamed(
|
CommonItem(
|
||||||
context, Routers.lockSeletGroupingPage);
|
leftTitel:
|
||||||
result as Map<String, dynamic>;
|
TranslationLoader.lanKeys!.lockName!.tr,
|
||||||
_groupName = result['groupName'];
|
rightTitle: itemData.lockName,
|
||||||
setState(() {});
|
isHaveLine: true,
|
||||||
}),
|
isHaveDirection: true,
|
||||||
CommonItem(
|
action: () {
|
||||||
leftTitel:
|
Navigator.pushNamed(
|
||||||
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
context, Routers.editLockNamePage);
|
||||||
rightTitle: "",
|
}),
|
||||||
isHaveLine: false,
|
CommonItem(
|
||||||
isHaveDirection: true,
|
leftTitel:
|
||||||
action: () {
|
TranslationLoader.lanKeys!.lockGrouping!.tr,
|
||||||
Navigator.pushNamed(
|
rightTitle: itemData.groupName == ""
|
||||||
context, Routers.adminOpenLockPasswordPage);
|
? _groupName
|
||||||
}),
|
: itemData.groupName,
|
||||||
],
|
isHaveLine: true,
|
||||||
),
|
isHaveDirection: true,
|
||||||
),
|
action: () async {
|
||||||
],
|
Navigator.pushNamed(
|
||||||
));
|
context, Routers.lockSeletGroupingPage,
|
||||||
|
arguments: {
|
||||||
|
'LockData': _lockData
|
||||||
|
}).then((val) {
|
||||||
|
if (val != null) {
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader
|
||||||
|
.lanKeys!.adminOpenLockPassword!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(context,
|
||||||
|
Routers.adminOpenLockPasswordPage);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//请求未结束 显示loading
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
//使用期限
|
||||||
void getLockInfo() async {
|
String getUseDateStr(LockData indexEntity) {
|
||||||
var entity = await ApiRepository.to.getLockInfo(
|
String useDateStr = '';
|
||||||
lastUpdateDate: DateTime.now().millisecondsSinceEpoch.toString(),
|
if (indexEntity.keyType == 1) {
|
||||||
pageNo: '1',
|
//限期
|
||||||
);
|
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
DateTime startDateStr =
|
||||||
// if (page == 0) {
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
// refreshController.refreshCompleted();
|
DateTime endDateStr =
|
||||||
// } else {
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
// if (entity.data!.keyInfos!.isEmpty) {
|
useDateStr =
|
||||||
// refreshController.loadNoData();
|
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
// } else {
|
|
||||||
// refreshController.loadComplete();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// page++;
|
|
||||||
|
|
||||||
if (entity.data!.keyInfos!.isEmpty) {
|
|
||||||
state.dataLength.value = 0;
|
|
||||||
} else if (entity.data!.keyInfos!.length == 1) {
|
|
||||||
state.dataLength.value = 1;
|
|
||||||
} else {
|
} else {
|
||||||
state.dataLength.value = 2;
|
useDateStr = '限期';
|
||||||
}
|
}
|
||||||
state.lockMainEntity.value = entity;
|
} else if (indexEntity.keyType == 2) {
|
||||||
} else {
|
//永久
|
||||||
// refreshController.loadFailed();
|
useDateStr = '永久';
|
||||||
|
} else if (indexEntity.keyType == 3) {
|
||||||
|
//单次
|
||||||
|
useDateStr = '单次';
|
||||||
|
} else if (indexEntity.keyType == 4) {
|
||||||
|
//循环
|
||||||
|
useDateStr = '循环';
|
||||||
}
|
}
|
||||||
// refreshController.refreshCompleted();
|
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//1:限期 2:永久 3:单次 4:循环
|
||||||
|
String getKeyTypeStr(int keyType) {
|
||||||
|
String keyTypeStr = "";
|
||||||
|
if (keyType == 1) {
|
||||||
|
keyTypeStr = "限期";
|
||||||
|
} else if (keyType == 2) {
|
||||||
|
keyTypeStr = '永久';
|
||||||
|
} else if (keyType == 3) {
|
||||||
|
keyTypeStr = '单次';
|
||||||
|
} else if (keyType == 4) {
|
||||||
|
keyTypeStr = '循环';
|
||||||
|
}
|
||||||
|
return keyTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//请求电子钥匙列表
|
||||||
|
Future<LockData> mockNetworkDataRequest() async {
|
||||||
|
KeyDetailEntity entity =
|
||||||
|
await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
|
_lockData = entity.data!;
|
||||||
|
return entity.data!;
|
||||||
|
}
|
||||||
|
LockData data = LockData();
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.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';
|
||||||
@ -22,10 +23,15 @@ class LockSeletGroupingPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
||||||
final TextEditingController _changeNameController = TextEditingController();
|
final TextEditingController _changeNameController = TextEditingController();
|
||||||
final int _selectGroupIndex = -1;
|
late LockData _lockData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["LockData"] != null)) {
|
||||||
|
_lockData = obj["LockData"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -56,7 +62,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context);
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
@ -84,7 +90,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: false,
|
isHaveDirection: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: _selectGroupIndex == index
|
rightWidget: _lockData.groupId == itemData.keyGroupId
|
||||||
? Image(
|
? Image(
|
||||||
image: const AssetImage("images/icon_item_checked.png"),
|
image: const AssetImage("images/icon_item_checked.png"),
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
@ -93,11 +99,8 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
action: () {
|
action: () {
|
||||||
Map<String, dynamic> resultMap = {};
|
Navigator.pop(context, true);
|
||||||
resultMap['groupName'] = itemData.keyGroupName;
|
setLockGroupRequest(itemData);
|
||||||
Navigator.pop(context, resultMap);
|
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -113,6 +116,16 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置锁分组请求
|
||||||
|
Future<void> setLockGroupRequest(LockGroupItem itemData) async {
|
||||||
|
LockGroupListEntity entity = await ApiRepository.to.setLockGroup(
|
||||||
|
_lockData.lockId.toString(), itemData.keyGroupId.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: "设置锁分组成功");
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//分组列表请求
|
//分组列表请求
|
||||||
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
||||||
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||||
@ -128,21 +141,22 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
BuildContext context,
|
|
||||||
) {
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title:
|
title:
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.lockGroup!.tr}",
|
||||||
tipTitle: "请输入",
|
tipTitle: "请输入",
|
||||||
controller: _changeNameController,
|
controller: _changeNameController,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if (_changeNameController.text.isNotEmpty) {
|
if (_changeNameController.text.isNotEmpty) {
|
||||||
addLockGroupRequest();
|
addLockGroupRequest();
|
||||||
|
Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '请输入分组名称');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -57,7 +57,9 @@ class _LockSetPageState extends State<LockSetPage> {
|
|||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.basicInformationPage);
|
Get.toNamed(Routers.basicInformationPage, arguments: {
|
||||||
|
'keyInfo': state.getKeyInfosData.value
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
|
|||||||
@ -2,11 +2,11 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.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/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/showTFView.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
@ -25,6 +25,16 @@ class PasswordKeyDetailPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||||
PasswordKeyListItem itemData = PasswordKeyListItem();
|
PasswordKeyListItem itemData = PasswordKeyListItem();
|
||||||
|
late TextEditingController _inputPwdController;
|
||||||
|
late TextEditingController _inputNameController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
_inputPwdController = TextEditingController();
|
||||||
|
_inputNameController = TextEditingController();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -64,19 +74,23 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||||
rightTitle: itemData.keyboardPwd,
|
rightTitle: _inputPwdController.text.isNotEmpty
|
||||||
|
? _inputPwdController.text
|
||||||
|
: itemData.keyboardPwd,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context, _inputPwdController);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: itemData.keyboardPwdName,
|
rightTitle: _inputNameController.text.isNotEmpty
|
||||||
|
? _inputNameController.text
|
||||||
|
: itemData.keyboardPwdName,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context, _inputNameController);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
@ -84,7 +98,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.electronicKeyDetailChangeDate);
|
context, Routers.electronicKeyDetailChangeDate,
|
||||||
|
arguments: {
|
||||||
|
'lockId': itemData.lockId.toString(),
|
||||||
|
'pwdId': itemData.keyboardPwdId.toString()
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -272,7 +290,51 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
//更新密码请求
|
||||||
|
Future<void> updatePwdRequest() async {
|
||||||
|
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||||
|
itemData.lockId.toString(),
|
||||||
|
itemData.keyboardPwdId.toString(),
|
||||||
|
_inputNameController.text,
|
||||||
|
_inputPwdController.text,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
setState(() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showCupertinoAlertDialog(
|
||||||
|
BuildContext context, TextEditingController inputController) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowTFView(
|
||||||
|
title:
|
||||||
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
|
tipTitle: "请输入",
|
||||||
|
controller: inputController,
|
||||||
|
sureClick: () {
|
||||||
|
//发送编辑钥匙名称请求
|
||||||
|
if (inputController.text.isNotEmpty) {
|
||||||
|
updatePwdRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void showCupertinoAlertDialog(
|
||||||
|
BuildContext context, TextEditingController inputController) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -291,6 +353,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
margin: EdgeInsets.all(10.w),
|
margin: EdgeInsets.all(10.w),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
controller: inputController,
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
// controller: _controller,
|
// controller: _controller,
|
||||||
@ -330,14 +393,13 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
// print("取消");
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
updatePwdRequest();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
// print("确定");
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -345,4 +407,5 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -353,8 +353,36 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
// logic.senderCustomPasswords();
|
// logic.senderCustomPasswords();
|
||||||
|
|
||||||
|
/*
|
||||||
|
int getWidgetNumber = int.parse(widget.type);
|
||||||
|
|
||||||
|
if (_nameController.text.isEmpty) {
|
||||||
|
Toast.show(msg: '请输入密码姓名');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (getWidgetNumber != 0 ||
|
||||||
|
getWidgetNumber != 2 ||
|
||||||
|
getWidgetNumber != 5) {
|
||||||
|
if (getWidgetNumber == 3 && _pwdController.text.isEmpty) {
|
||||||
|
Toast.show(msg: '请输入密码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_failureDateTime.compareTo(_effectiveDateTime) != 1) {
|
||||||
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
logic.getStartDate(_effectiveDateTime);
|
logic.getStartDate(_effectiveDateTime);
|
||||||
getKeyboardPwdRequest();
|
int passwordType = int.parse(widget.type);
|
||||||
|
if (passwordType == 3) {
|
||||||
|
//自定义密码
|
||||||
|
addKeyboardPwdRequest();
|
||||||
|
} else {
|
||||||
|
getKeyboardPwdRequest();
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -401,7 +429,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
//清空码
|
//清空码
|
||||||
getKeyType = '4';
|
getKeyType = '4';
|
||||||
}
|
}
|
||||||
if (widget.type != '0' || widget.type != '2' || widget.type == '5') {
|
if (widget.type != '0' || widget.type != '2' || widget.type != '5') {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
@ -430,6 +458,43 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//自定义密码请求
|
||||||
|
Future<void> addKeyboardPwdRequest() async {
|
||||||
|
String getFailureDateTime = '0';
|
||||||
|
String getEffectiveDateTime = '0';
|
||||||
|
String lockId = widget.getKeyInfo.lockId.toString();
|
||||||
|
String getKeyType = '3';
|
||||||
|
//是否为永久
|
||||||
|
if (_isPermanent == false) {
|
||||||
|
getKeyType = '3';
|
||||||
|
getFailureDateTime =
|
||||||
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
|
.millisecondsSinceEpoch
|
||||||
|
.toString();
|
||||||
|
} else {
|
||||||
|
getKeyType = '2';
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.addPasswordKey(
|
||||||
|
lockId,
|
||||||
|
_nameController.text,
|
||||||
|
_pwdController.text,
|
||||||
|
getKeyType,
|
||||||
|
getEffectiveDateTime,
|
||||||
|
getFailureDateTime,
|
||||||
|
'0');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print('获取密码成功');
|
||||||
|
_isSendSuccess = true;
|
||||||
|
if (entity.data != null) {
|
||||||
|
_getPwdStr = entity.data!.keyboardPwd!;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '${entity.errorMsg}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
// 发送电子钥匙成功
|
||||||
Widget sendElectronicKeySucceed() {
|
Widget sendElectronicKeySucceed() {
|
||||||
return Column(
|
return Column(
|
||||||
|
|||||||
@ -32,13 +32,17 @@ abstract class Api {
|
|||||||
final String deletLockURL = '/lock/delete'; // 删除锁
|
final String deletLockURL = '/lock/delete'; // 删除锁
|
||||||
|
|
||||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||||
|
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
||||||
|
final String updatePasswordKeyURL = '/keyboardPwd/update'; //修改密码详情
|
||||||
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
||||||
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
||||||
|
final String setlockGroupURL = '/keyGroup/setGroup'; //设置锁分组
|
||||||
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
||||||
|
final String listLockByGroupURL =
|
||||||
|
'/authorizedAdmin/listLockByGroup'; //获取分组下的锁列表
|
||||||
final String updateSettingURL = '/room/updateSetting'; //标记房态
|
final String updateSettingURL = '/room/updateSetting'; //标记房态
|
||||||
final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
||||||
final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
||||||
|
|
||||||
final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // 获取Wifi锁服务器
|
final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // 获取Wifi锁服务器
|
||||||
final String updateSpecialValueUrl = '/room/updateSpecialValue'; // 开启/关闭 远程开锁
|
final String updateSpecialValueUrl = '/room/updateSpecialValue'; // 开启/关闭 远程开锁
|
||||||
final String setAutoLockTimeUrl = '/room/setAutoLockTime'; // 自动闭锁
|
final String setAutoLockTimeUrl = '/room/setAutoLockTime'; // 自动闭锁
|
||||||
@ -48,4 +52,9 @@ abstract class Api {
|
|||||||
final String roomQueryDateUrl = '/room/queryDate'; // 获取网关时间
|
final String roomQueryDateUrl = '/room/queryDate'; // 获取网关时间
|
||||||
final String getServerDatetimeUrl = '/check/getServerDatetime'; // 获取服务器当前时间
|
final String getServerDatetimeUrl = '/check/getServerDatetime'; // 获取服务器当前时间
|
||||||
final String getLockVersionInfoUrl = '/room/update'; // 获取锁当前版本信息
|
final String getLockVersionInfoUrl = '/room/update'; // 获取锁当前版本信息
|
||||||
|
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
||||||
|
final String lockUserListURL = '/keyUser/listKeyUser'; //锁用户列表
|
||||||
|
final String canSendKeyURL = '/keyUser/canSendKey'; //群发钥匙检查
|
||||||
|
final String batchSendKeyURL = '/key/batchSend'; //批处理群发钥匙
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -348,6 +348,48 @@ class ApiProvider extends BaseProvider {
|
|||||||
'timezoneRawOffSet': timezoneRawOffSet
|
'timezoneRawOffSet': timezoneRawOffSet
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Future<Response> addKeyboardPwd(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String keyboardPwd,
|
||||||
|
String keyboardPwdType,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String addType,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
passwordKeyAddURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'keyboardPwdName': keyboardPwdName,
|
||||||
|
'keyboardPwd': keyboardPwd,
|
||||||
|
'keyboardPwdType': keyboardPwdType,
|
||||||
|
'startDate': startDate,
|
||||||
|
'endDate': endDate,
|
||||||
|
'addType': addType,
|
||||||
|
}));
|
||||||
|
|
||||||
|
Future<Response> updateKeyboardPwd(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String newKeyboardPwd,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String changeType,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
updatePasswordKeyURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'keyboardPwdId': keyboardPwdId,
|
||||||
|
'keyboardPwdName': keyboardPwdName,
|
||||||
|
'newKeyboardPwd': newKeyboardPwd,
|
||||||
|
'startDate': startDate,
|
||||||
|
'endDate': endDate,
|
||||||
|
'changeType': changeType,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> clearOperationRecord(String lockId) =>
|
Future<Response> clearOperationRecord(String lockId) =>
|
||||||
post(clearOperationRecordURL.toUrl, jsonEncode({'lockId': lockId}));
|
post(clearOperationRecordURL.toUrl, jsonEncode({'lockId': lockId}));
|
||||||
|
|
||||||
@ -355,6 +397,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
addlockGroupURL.toUrl,
|
addlockGroupURL.toUrl,
|
||||||
jsonEncode({'groupName': groupName, 'operatorUid': operatorUid}));
|
jsonEncode({'groupName': groupName, 'operatorUid': operatorUid}));
|
||||||
|
|
||||||
|
Future<Response> setLockGroup(String lockId, String groupId) => post(
|
||||||
|
setlockGroupURL.toUrl,
|
||||||
|
jsonEncode({'lockId': lockId, 'groupId': groupId}));
|
||||||
|
|
||||||
Future<Response> lockGroupList(String type) =>
|
Future<Response> lockGroupList(String type) =>
|
||||||
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
||||||
|
|
||||||
@ -382,6 +428,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
lockListByGroupURL.toUrl,
|
lockListByGroupURL.toUrl,
|
||||||
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||||
|
|
||||||
|
|
||||||
/// 锁设置模块
|
/// 锁设置模块
|
||||||
// 远程开锁
|
// 远程开锁
|
||||||
Future<Response> remoteUnlockingOpenOrCloseLoadData(String lockId, String featureValue) =>
|
Future<Response> remoteUnlockingOpenOrCloseLoadData(String lockId, String featureValue) =>
|
||||||
@ -457,7 +504,33 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(
|
post(
|
||||||
getLockVersionInfoUrl.toUrl,
|
getLockVersionInfoUrl.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'lockId': lockId,
|
'lockId': lockId,}));
|
||||||
|
|
||||||
|
Future<Response> listLockByGroup(String type, String keyGroupId) => post(
|
||||||
|
listLockByGroupURL.toUrl,
|
||||||
|
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||||
|
|
||||||
|
Future<Response> getKeyDetail(String lockId) =>
|
||||||
|
post(getKeyDetailURL.toUrl, jsonEncode({'lockId': lockId}));
|
||||||
|
|
||||||
|
Future<Response> lockUserList(
|
||||||
|
String pageNo, String pageSize, String searchStr) =>
|
||||||
|
post(
|
||||||
|
lockUserListURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'pageNo': pageNo,
|
||||||
|
'pageSize': pageSize,
|
||||||
|
'searchStr': searchStr
|
||||||
|
}));
|
||||||
|
|
||||||
|
Future<Response> canSendKey(
|
||||||
|
String endDate, String keyGroupIdList, String lockIdList) =>
|
||||||
|
post(
|
||||||
|
canSendKeyURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'endDate': endDate,
|
||||||
|
'keyGroupIdList': keyGroupIdList,
|
||||||
|
'lockIdList': lockIdList
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/login/seletCountryRegion/common/countryRegionEntity.dart';
|
import 'package:star_lock/login/seletCountryRegion/common/countryRegionEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.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/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/lockUserListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
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/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
@ -315,6 +318,36 @@ class ApiRepository {
|
|||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//自定义密码
|
||||||
|
Future<PasswordKeyEntity> addPasswordKey(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String keyboardPwd,
|
||||||
|
String keyboardPwdType,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String addType,
|
||||||
|
) async {
|
||||||
|
final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName,
|
||||||
|
keyboardPwd, keyboardPwdType, startDate, endDate, addType);
|
||||||
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改密码
|
||||||
|
Future<PasswordKeyEntity> updatePasswordKey(
|
||||||
|
String lockId,
|
||||||
|
String keyboardPwdId,
|
||||||
|
String keyboardPwdName,
|
||||||
|
String newKeyboardPwd,
|
||||||
|
String startDate,
|
||||||
|
String endDate,
|
||||||
|
String changeType,
|
||||||
|
) async {
|
||||||
|
final res = await apiProvider.updateKeyboardPwd(lockId, keyboardPwdId,
|
||||||
|
keyboardPwdName, newKeyboardPwd, startDate, endDate, changeType);
|
||||||
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//清空操作记录
|
//清空操作记录
|
||||||
Future<KeyOperationRecordEntity> clearOperationRecord(String lockId) async {
|
Future<KeyOperationRecordEntity> clearOperationRecord(String lockId) async {
|
||||||
final res = await apiProvider.clearOperationRecord(lockId);
|
final res = await apiProvider.clearOperationRecord(lockId);
|
||||||
@ -328,6 +361,13 @@ class ApiRepository {
|
|||||||
return LockGroupListEntity.fromJson(res.body);
|
return LockGroupListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置锁分组
|
||||||
|
Future<LockGroupListEntity> setLockGroup(
|
||||||
|
String lockId, String groupId) async {
|
||||||
|
final res = await apiProvider.setLockGroup(lockId, groupId);
|
||||||
|
return LockGroupListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//锁分组列表
|
//锁分组列表
|
||||||
Future<LockGroupListEntity> lockGroupList(String type) async {
|
Future<LockGroupListEntity> lockGroupList(String type) async {
|
||||||
final res = await apiProvider.lockGroupList(type);
|
final res = await apiProvider.lockGroupList(type);
|
||||||
@ -368,6 +408,7 @@ class ApiRepository {
|
|||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 获取Wifi锁服务器
|
// 获取Wifi锁服务器
|
||||||
Future<ConfiguringWifiEntity> getWifiLockServiceIpAndPort() async {
|
Future<ConfiguringWifiEntity> getWifiLockServiceIpAndPort() async {
|
||||||
final res = await apiProvider.getWifiLockServiceIpAndPort();
|
final res = await apiProvider.getWifiLockServiceIpAndPort();
|
||||||
@ -465,6 +506,33 @@ class ApiRepository {
|
|||||||
}) async {
|
}) async {
|
||||||
final res =
|
final res =
|
||||||
await apiProvider.getLockVersionInfoLoadData(lockId);
|
await apiProvider.getLockVersionInfoLoadData(lockId);
|
||||||
return GetServerDatetimeEntity.fromJson(res.body);
|
return GetServerDatetimeEntity.fromJson(res.body);}
|
||||||
|
|
||||||
|
//分组下的锁列表
|
||||||
|
Future<MassSendLockGroupListEntity> listLockByGroup(
|
||||||
|
String type, String keyGroupId) async {
|
||||||
|
final res = await apiProvider.listLockByGroup(type, keyGroupId);
|
||||||
|
return MassSendLockGroupListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取单把钥匙详情信息
|
||||||
|
Future<KeyDetailEntity> getKeyDetail(String lockId) async {
|
||||||
|
final res = await apiProvider.getKeyDetail(lockId);
|
||||||
|
return KeyDetailEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//锁用户列表
|
||||||
|
Future<LockUserListEntity> lockUserList(
|
||||||
|
String pageNo, String pageSize, String searchStr) async {
|
||||||
|
final res = await apiProvider.lockUserList(pageNo, pageSize, searchStr);
|
||||||
|
return LockUserListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//群发钥匙检查
|
||||||
|
Future<KeyDetailEntity> canSendKey(
|
||||||
|
String endDate, String keyGroupIdList, String lockIdList) async {
|
||||||
|
final res =
|
||||||
|
await apiProvider.canSendKey(endDate, keyGroupIdList, lockIdList);
|
||||||
|
return KeyDetailEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,11 +87,11 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
// Image.asset(
|
||||||
widget.imgName,
|
// widget.imgName,
|
||||||
width: 36.w,
|
// width: 36.w,
|
||||||
height: 36.w,
|
// height: 36.w,
|
||||||
),
|
// ),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -61,6 +61,8 @@ class CommonItem extends StatelessWidget {
|
|||||||
: Text(
|
: Text(
|
||||||
rightTitle!,
|
rightTitle!,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
color: AppColors.darkGrayTextColor),
|
color: AppColors.darkGrayTextColor),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user