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