1,更换图片
2,完善调试群发钥匙逻辑及接口
This commit is contained in:
parent
a7f5300f50
commit
7112fcfdf3
Binary file not shown.
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 122 KiB |
@ -24,6 +24,7 @@ class _VolumeAuthorizationLockPageState
|
||||
extends State<VolumeAuthorizationLockPage> {
|
||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||
late Contact _contact;
|
||||
late List _lockIdList;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,8 +33,9 @@ class _VolumeAuthorizationLockPageState
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
_lockIdList = [];
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
@ -74,7 +76,7 @@ class _VolumeAuthorizationLockPageState
|
||||
children: [
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.number!.tr,
|
||||
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
@ -114,9 +116,22 @@ class _VolumeAuthorizationLockPageState
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr,
|
||||
rightTitle: _lockIdList.isEmpty
|
||||
? TranslationLoader.lanKeys!.pleaseSelet!.tr
|
||||
: _lockIdList.length.toString(),
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
||||
.then((value) {
|
||||
//得到选中的锁ID列表
|
||||
if (value != null) {
|
||||
value as Map<String, dynamic>;
|
||||
_lockIdList = value['selectLockIdList'];
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||
|
||||
@ -4,6 +4,11 @@ import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
@ -30,7 +35,12 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
late DateTime _failureDateTime;
|
||||
late bool _isSendSuccess;
|
||||
late bool _isRemote; //是否远程开锁
|
||||
List _receiverList = [];
|
||||
List _receiverList = []; //接受者列表
|
||||
List _lockIdList = []; //选中的锁ID列表
|
||||
String countryName = '中国';
|
||||
String countryCode = '86';
|
||||
List weekdaysList = [];
|
||||
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -94,6 +104,58 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
}
|
||||
}
|
||||
|
||||
//群发钥匙检查
|
||||
Future<void> MassKeyChecksRequest() async {
|
||||
String getFailureDateTime = '0';
|
||||
if (int.parse(widget.type) != 1) {
|
||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
||||
}
|
||||
var entity =
|
||||
await ApiRepository.to.canSendKey(getFailureDateTime, [], _lockIdList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
for (int i = 0; i < _receiverList.length; i++) {
|
||||
LockUserData data = _receiverList[i];
|
||||
batchSendElectronicKeyRequest(data.userid ?? '');
|
||||
}
|
||||
} else {
|
||||
Toast.show(msg: '检查失败');
|
||||
}
|
||||
}
|
||||
|
||||
//批处理群发钥匙
|
||||
Future<void> batchSendElectronicKeyRequest(String receiverUserID) async {
|
||||
String getFailureDateTime = '0';
|
||||
String getEffectiveDateTime = '0';
|
||||
if (widget.type == '0') {
|
||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime =
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
||||
}
|
||||
var entity = await ApiRepository.to.batchSendKey(
|
||||
getFailureDateTime,
|
||||
[],
|
||||
_lockIdList,
|
||||
'1',
|
||||
_isRemote ? '1' : '2',
|
||||
receiverUserID,
|
||||
receiverUserID,
|
||||
getEffectiveDateTime,
|
||||
countryCode,
|
||||
'1',
|
||||
weekdaysList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('群发电子钥匙成功');
|
||||
_isSendSuccess = true;
|
||||
setState(() {});
|
||||
} else {
|
||||
Toast.show(msg: '${entity.errorMsg}');
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
_isCreateUser = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 顶部钥匙信息widget
|
||||
Widget keyInfoWidget() {
|
||||
return Column(
|
||||
@ -117,12 +179,44 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
}
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'$countryName +$countryCode',
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.seletCountryRegionPage);
|
||||
result as Map<String, dynamic>;
|
||||
countryCode = result['code'];
|
||||
countryName = result['countryName'];
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||
rightTitle: TranslationLoader.lanKeys!.pleaseSelet!.tr,
|
||||
rightTitle: _lockIdList.isEmpty
|
||||
? TranslationLoader.lanKeys!.pleaseSelet!.tr
|
||||
: _lockIdList.length.toString(),
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.massSendLockGroupPage);
|
||||
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
|
||||
.then((value) {
|
||||
//得到选中的锁ID列表
|
||||
if (value != null) {
|
||||
value as Map<String, dynamic>;
|
||||
_lockIdList = value['selectLockIdList'];
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
@ -205,7 +299,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () {
|
||||
// Navigator.pushNamed(context, Routers.nearbyLockPage);
|
||||
MassKeyChecksRequest();
|
||||
}),
|
||||
],
|
||||
);
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
|
||||
typedef _CallBack = void Function(int selectIndex, String selectLockId);
|
||||
|
||||
class massSendLockGroupCell extends StatelessWidget {
|
||||
final int currentIndex;
|
||||
// LockListItem itemData;
|
||||
List lockListByGroup;
|
||||
final VoidCallback selectLockAction;
|
||||
final _CallBack selectLockAction;
|
||||
|
||||
massSendLockGroupCell(int index,
|
||||
{Key? key,
|
||||
required this.currentIndex,
|
||||
required this.lockListByGroup,
|
||||
// required this.itemData,
|
||||
required this.selectLockAction})
|
||||
: super(key: key);
|
||||
|
||||
@ -26,7 +25,7 @@ class massSendLockGroupCell extends StatelessWidget {
|
||||
itemCount: lockListByGroup.length,
|
||||
itemBuilder: (_, itemIndex) {
|
||||
LockListItem itemData = lockListByGroup[itemIndex];
|
||||
return _itemBuilder(itemData);
|
||||
return _itemBuilder(itemData, itemIndex);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
@ -37,7 +36,7 @@ class massSendLockGroupCell extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _itemBuilder(LockListItem itemData) {
|
||||
Widget _itemBuilder(LockListItem itemData, int itemIndex) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
height: 60.h,
|
||||
@ -66,7 +65,7 @@ class massSendLockGroupCell extends StatelessWidget {
|
||||
width: 20.w,
|
||||
)),
|
||||
Image.asset(
|
||||
itemData.isCheck!
|
||||
itemData.isChecked
|
||||
? "images/icon_round_selet.png"
|
||||
: "images/icon_round_unSelet.png",
|
||||
width: 30.w,
|
||||
@ -79,13 +78,7 @@ class massSendLockGroupCell extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
selectLockAction();
|
||||
// selectNameIndex = index;
|
||||
// setState(() {
|
||||
// if (selectNameIndex == index) {
|
||||
// isNameSelect = !isNameSelect;
|
||||
// }
|
||||
// });
|
||||
selectLockAction(itemIndex, itemData.lockId.toString());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ class MassSendLockGroupListEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
LockListData? data;
|
||||
GroupListData? data;
|
||||
|
||||
MassSendLockGroupListEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
@ -11,7 +11,7 @@ class MassSendLockGroupListEntity {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? LockListData.fromJson(json['data']) : null;
|
||||
data = json['data'] != null ? GroupListData.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -26,15 +26,49 @@ class MassSendLockGroupListEntity {
|
||||
}
|
||||
}
|
||||
|
||||
class LockListData {
|
||||
List<LockListItem>? lockList;
|
||||
class GroupListData {
|
||||
List<GroupListItem>? groupList;
|
||||
|
||||
LockListData({this.lockList});
|
||||
GroupListData({this.groupList});
|
||||
|
||||
LockListData.fromJson(Map<String, dynamic> json) {
|
||||
GroupListData.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
lockList = <LockListItem>[];
|
||||
groupList = <GroupListItem>[];
|
||||
json['list'].forEach((v) {
|
||||
groupList!.add(GroupListItem.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (groupList != null) {
|
||||
data['list'] = groupList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupListItem {
|
||||
int? lockNum;
|
||||
int? keyGroupId;
|
||||
String? keyGroupName;
|
||||
List<LockListItem>? lockList;
|
||||
bool _isChecked = false;
|
||||
bool get isChecked => _isChecked ?? false;
|
||||
|
||||
set isChecked(bool value) => _isChecked = value;
|
||||
|
||||
GroupListItem(
|
||||
{this.lockNum, this.keyGroupId, this.keyGroupName, this.lockList});
|
||||
|
||||
GroupListItem.fromJson(Map<String, dynamic> json) {
|
||||
lockNum = json['lockNum'];
|
||||
keyGroupId = json['keyGroupId'];
|
||||
keyGroupName = json['keyGroupName'];
|
||||
if (json['lockList'] != null) {
|
||||
lockList = <LockListItem>[];
|
||||
json['lockList'].forEach((v) {
|
||||
lockList!.add(LockListItem.fromJson(v));
|
||||
});
|
||||
}
|
||||
@ -42,8 +76,11 @@ class LockListData {
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['lockNum'] = lockNum;
|
||||
data['keyGroupId'] = keyGroupId;
|
||||
data['keyGroupName'] = keyGroupName;
|
||||
if (lockList != null) {
|
||||
data['list'] = lockList!.map((v) => v.toJson()).toList();
|
||||
data['lockList'] = lockList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -52,10 +89,12 @@ class LockListData {
|
||||
class LockListItem {
|
||||
int? lockId;
|
||||
String? lockAlias;
|
||||
bool? isCheck = false;
|
||||
bool? isRefresh = false;
|
||||
bool _isChecked = false;
|
||||
bool get isChecked => _isChecked ?? false;
|
||||
|
||||
LockListItem({this.lockId, this.lockAlias, this.isRefresh, this.isCheck});
|
||||
set isChecked(bool value) => _isChecked = value;
|
||||
|
||||
LockListItem({this.lockId, this.lockAlias});
|
||||
|
||||
LockListItem.fromJson(Map<String, dynamic> json) {
|
||||
lockId = json['lockId'];
|
||||
|
||||
@ -4,7 +4,6 @@ import 'package:get/utils.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupCell.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/baseGetXController.dart';
|
||||
@ -21,9 +20,9 @@ class MassSendLockGroupListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
List lockListByGroup = [];
|
||||
List lockGroupList = [];
|
||||
List clickIndexList = [];
|
||||
List selectGroupIdList = [];
|
||||
List selectLockIdList = [];
|
||||
int clickIndex = -1;
|
||||
|
||||
@override
|
||||
@ -72,7 +71,10 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
SubmitBtn(
|
||||
btnName: '确定',
|
||||
onClick: () {
|
||||
Navigator.pop(context);
|
||||
print('得到lockid为$selectLockIdList ');
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['selectLockIdList'] = selectLockIdList;
|
||||
Navigator.pop(context, resultMap);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@ -83,12 +85,13 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
}
|
||||
|
||||
//分组列表请求
|
||||
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
||||
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||
List<LockGroupItem> dataList = [];
|
||||
Future<List<GroupListItem>> mockNetworkDataRequest() async {
|
||||
MassSendLockGroupListEntity entity =
|
||||
await ApiRepository.to.lockGroupList('1');
|
||||
List<GroupListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
dataList = entity.data!.itemList!;
|
||||
dataList = entity.data!.groupList!;
|
||||
}
|
||||
}
|
||||
lockGroupList = dataList;
|
||||
@ -96,28 +99,11 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
//分组列表请求
|
||||
Future<List<LockListItem>> listLockByGroup(String groupId) async {
|
||||
MassSendLockGroupListEntity entity =
|
||||
await ApiRepository.to.listLockByGroup('3', groupId);
|
||||
List<LockListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
dataList = entity.data!.lockList!;
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
lockListByGroup = dataList;
|
||||
});
|
||||
return dataList;
|
||||
}
|
||||
|
||||
Widget _buildListView(BuildContext context, List itemList) {
|
||||
return ListView.separated(
|
||||
itemCount: itemList.length,
|
||||
itemBuilder: (context, index) {
|
||||
LockGroupItem itemData = itemList[index];
|
||||
GroupListItem itemData = itemList[index];
|
||||
return _buildLockExpandedList(context, index, itemData);
|
||||
},
|
||||
shrinkWrap: true,
|
||||
@ -130,20 +116,26 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
}
|
||||
|
||||
//设备多层级列表
|
||||
Widget _buildLockExpandedList(context, index, LockGroupItem itemData) {
|
||||
Widget _buildLockExpandedList(context, index, GroupListItem itemData) {
|
||||
List lockItemList = itemData.lockList ?? [];
|
||||
return ExpandedListTile(
|
||||
onTap: () {
|
||||
listLockByGroup(itemData.keyGroupId.toString());
|
||||
clickIndexList.add(index);
|
||||
selectGroupIdList.add(index);
|
||||
clickIndex = index;
|
||||
},
|
||||
title: itemData.keyGroupName!,
|
||||
imgName: '',
|
||||
typeImgList: const [],
|
||||
groupItem: itemData,
|
||||
child: massSendLockGroupCell(index,
|
||||
currentIndex: index,
|
||||
lockListByGroup: lockListByGroup,
|
||||
selectLockAction: () {}),
|
||||
currentIndex: index, lockListByGroup: lockItemList,
|
||||
selectLockAction: (selectIndex, selectLockId) {
|
||||
LockListItem lockItem = lockItemList[selectIndex];
|
||||
setState(() {
|
||||
lockItem.isChecked = !lockItem.isChecked;
|
||||
if (lockItem.isChecked) {
|
||||
selectLockIdList.add(lockItem.lockId);
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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/network/api_repository.dart';
|
||||
@ -38,10 +39,10 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
||||
barTitle: TranslationLoader.lanKeys!.selectGroup!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: FutureBuilder<List<LockGroupItem>>(
|
||||
body: FutureBuilder<List<GroupListItem>>(
|
||||
future: mockNetworkDataRequest(),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<LockGroupItem>> snapshot) {
|
||||
AsyncSnapshot<List<GroupListItem>> snapshot) {
|
||||
//请求结束
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
@ -49,7 +50,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
||||
return const Text('请求失败');
|
||||
} else {
|
||||
//请求成功
|
||||
final List<LockGroupItem> itemData = snapshot.data!;
|
||||
final List<GroupListItem> itemData = snapshot.data!;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
@ -127,13 +128,14 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
||||
}
|
||||
|
||||
//分组列表请求
|
||||
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
||||
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||
Future<List<GroupListItem>> mockNetworkDataRequest() async {
|
||||
MassSendLockGroupListEntity entity =
|
||||
await ApiRepository.to.lockGroupList('1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList!;
|
||||
return entity.data!.groupList!;
|
||||
} else {
|
||||
List<LockGroupItem> dataList = [];
|
||||
List<GroupListItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get_utils/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/massSendLockGroupListEntity.dart';
|
||||
import 'package:star_lock/tools/ExpandedListView.dart';
|
||||
import 'package:star_lock/tools/submitBtn.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
@ -167,9 +168,10 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
|
||||
Widget _buildDeviceExpandedList(context, index, deviceName) {
|
||||
return ExpandedListTile(
|
||||
onTap: () => print("onTap."),
|
||||
title: deviceName,
|
||||
imgName: 'images/icon_lock.png',
|
||||
// title: deviceName,
|
||||
// imgName: 'images/icon_lock.png',
|
||||
typeImgList: const [],
|
||||
groupItem: GroupListItem(),
|
||||
child: ListView.separated(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
@ -205,9 +207,10 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
|
||||
Widget _buildNameExpandedList(context, index, deviceName) {
|
||||
return ExpandedListTile(
|
||||
onTap: () => print("onTap."),
|
||||
title: deviceName,
|
||||
imgName: 'images/controls_user.png',
|
||||
// title: deviceName,
|
||||
// imgName: 'images/controls_user.png',
|
||||
typeImgList: const ['images/icon_password.png', 'images/icon_card.png'],
|
||||
groupItem: GroupListItem(),
|
||||
child: ListView.separated(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
|
||||
@ -619,7 +619,7 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
Future<Response> canSendKey(
|
||||
String endDate, String keyGroupIdList, String lockIdList) =>
|
||||
String endDate, List keyGroupIdList, List lockIdList) =>
|
||||
post(
|
||||
canSendKeyURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -630,21 +630,30 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
Future<Response> batchSendKey(
|
||||
String endDate,
|
||||
String keyGroupIdList,
|
||||
String lockIdList,
|
||||
List keyGroupIdList,
|
||||
List lockIdList,
|
||||
String createUser,
|
||||
String isRemoteUnlock,
|
||||
String keyNameForAdmin,
|
||||
String receiverUsername,
|
||||
String startDate,
|
||||
String countryCode,
|
||||
String usernameType) =>
|
||||
String usernameType,
|
||||
List weekDays) =>
|
||||
post(
|
||||
batchSendKeyURL.toUrl,
|
||||
jsonEncode({
|
||||
'endDate': endDate,
|
||||
'keyGroupIdList': keyGroupIdList,
|
||||
'lockIdList': lockIdList
|
||||
'lockIdList': lockIdList,
|
||||
'createUser': createUser,
|
||||
'isRemoteUnlock': isRemoteUnlock,
|
||||
'keyNameForAdmin': keyNameForAdmin,
|
||||
'receiverUsername': receiverUsername,
|
||||
'startDate': startDate,
|
||||
'countryCode': countryCode,
|
||||
'usernameType': usernameType,
|
||||
'weekDays': weekDays,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@ -370,9 +370,9 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//锁分组列表
|
||||
Future<LockGroupListEntity> lockGroupList(String type) async {
|
||||
Future<MassSendLockGroupListEntity> lockGroupList(String type) async {
|
||||
final res = await apiProvider.lockGroupList(type);
|
||||
return LockGroupListEntity.fromJson(res.body);
|
||||
return MassSendLockGroupListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//删除电子钥匙
|
||||
@ -542,7 +542,7 @@ class ApiRepository {
|
||||
|
||||
//群发钥匙检查
|
||||
Future<KeyDetailEntity> canSendKey(
|
||||
String endDate, String keyGroupIdList, String lockIdList) async {
|
||||
String endDate, List keyGroupIdList, List lockIdList) async {
|
||||
final res =
|
||||
await apiProvider.canSendKey(endDate, keyGroupIdList, lockIdList);
|
||||
return KeyDetailEntity.fromJson(res.body);
|
||||
@ -551,15 +551,16 @@ class ApiRepository {
|
||||
//群发钥匙检查
|
||||
Future<KeyDetailEntity> batchSendKey(
|
||||
String endDate,
|
||||
String keyGroupIdList,
|
||||
String lockIdList,
|
||||
List keyGroupIdList,
|
||||
List lockIdList,
|
||||
String createUser,
|
||||
String isRemoteUnlock,
|
||||
String keyNameForAdmin,
|
||||
String receiverUsername,
|
||||
String startDate,
|
||||
String countryCode,
|
||||
String usernameType) async {
|
||||
String usernameType,
|
||||
List weekDays) async {
|
||||
final res = await apiProvider.batchSendKey(
|
||||
endDate,
|
||||
keyGroupIdList,
|
||||
@ -570,7 +571,8 @@ class ApiRepository {
|
||||
receiverUsername,
|
||||
startDate,
|
||||
countryCode,
|
||||
usernameType);
|
||||
usernameType,
|
||||
weekDays);
|
||||
return KeyDetailEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
@ -1,22 +1,23 @@
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
|
||||
class ExpandedListTile extends StatefulWidget {
|
||||
const ExpandedListTile(
|
||||
{Key? key,
|
||||
required this.title,
|
||||
this.child,
|
||||
this.onTap,
|
||||
required this.typeImgList,
|
||||
required this.imgName})
|
||||
required this.groupItem,
|
||||
required this.typeImgList})
|
||||
: super(key: key);
|
||||
|
||||
final String title;
|
||||
final String imgName;
|
||||
final Widget? child;
|
||||
final List typeImgList;
|
||||
final Function()? onTap;
|
||||
final GroupListItem groupItem;
|
||||
|
||||
@override
|
||||
_ExpandedListTileState createState() => _ExpandedListTileState();
|
||||
@ -78,7 +79,9 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
||||
//点击左侧是否勾选按钮
|
||||
setState(() {
|
||||
_isCheck = !_isCheck;
|
||||
widget.groupItem.isChecked = _isCheck;
|
||||
});
|
||||
widget.onTap?.call();
|
||||
},
|
||||
));
|
||||
widgetList.add(GestureDetector(
|
||||
@ -96,7 +99,7 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
widget.title,
|
||||
widget.groupItem.keyGroupName ?? '',
|
||||
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
|
||||
),
|
||||
Expanded(
|
||||
@ -119,7 +122,6 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
||||
setState(() {
|
||||
_isExpanded = !_isExpanded;
|
||||
});
|
||||
widget.onTap?.call();
|
||||
},
|
||||
));
|
||||
return widgetList;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user