Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
# Conflicts: # star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart
This commit is contained in:
commit
62370f364a
@ -90,12 +90,14 @@ class KeyRecordDataItem {
|
||||
recordId = json['recordId'];
|
||||
lockId = json['lockId'];
|
||||
recordType = json['recordType'];
|
||||
recordTypeName = json['recordTypeName'];
|
||||
json['recordTypeName'] != null
|
||||
? recordTypeName = json['recordTypeName']
|
||||
: "";
|
||||
success = json['success'];
|
||||
username = json['username'];
|
||||
lockDate = json['lockDate'];
|
||||
json['username'] != null ? username = json['username'] : "";
|
||||
json['lockDate'] != null ? lockDate = json['lockDate'] : "";
|
||||
operateDate = json['operateDate'];
|
||||
keyboardPwd = json['keyboardPwd'];
|
||||
json['keyboardPwd'] != null ? keyboardPwd = json['keyboardPwd'] : "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -105,8 +107,12 @@ class KeyRecordDataItem {
|
||||
data['recordType'] = recordType;
|
||||
data['recordTypeName'] = recordTypeName;
|
||||
data['success'] = success;
|
||||
data['username'] = username;
|
||||
data['lockDate'] = lockDate;
|
||||
if (data['username'] != null) {
|
||||
data['username'] = username;
|
||||
}
|
||||
if (data['lockDate'] != null) {
|
||||
data['lockDate'] = lockDate;
|
||||
}
|
||||
data['operateDate'] = operateDate;
|
||||
data['keyboardPwd'] = keyboardPwd;
|
||||
return data;
|
||||
|
||||
@ -71,7 +71,7 @@ class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
|
||||
|
||||
Widget _buildMainUI(List<KeyRecordDataItem> itemDataList) {
|
||||
return ListView.separated(
|
||||
itemCount: 5,
|
||||
itemCount: itemDataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
KeyRecordDataItem dataItem = itemDataList[index];
|
||||
int? operateDate = dataItem.operateDate;
|
||||
|
||||
@ -32,7 +32,6 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
@ -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/tools/showTFView.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
@ -16,6 +17,8 @@ class AdminOpenLockPasswordPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
final TextEditingController _changePwdController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -28,10 +31,12 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||
rightTitle: "189934",
|
||||
rightTitle: "123456",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
showCupertinoAlertDialog(context);
|
||||
}),
|
||||
Container(
|
||||
margin: EdgeInsets.all(30.w),
|
||||
child: Column(
|
||||
@ -70,4 +75,29 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
void showCupertinoAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title:
|
||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
||||
tipTitle: "请输入",
|
||||
controller: _changePwdController,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (_changePwdController.text.isNotEmpty) {
|
||||
// modifyPwdRequest();
|
||||
}
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
|
||||
@ -17,6 +16,14 @@ class BasicInformationPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
late String _groupName = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_groupName = '未分组';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -71,12 +78,15 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
||||
rightTitle: "202307",
|
||||
rightTitle: _groupName,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.lockSeletGroupingPage);
|
||||
result as Map<String, dynamic>;
|
||||
_groupName = result['groupName'];
|
||||
setState(() {});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
class LockGroupListEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
LockGroupData? data;
|
||||
|
||||
LockGroupListEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
LockGroupListEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? LockGroupData.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 LockGroupData {
|
||||
List<LockGroupItem>? itemList;
|
||||
|
||||
LockGroupData({this.itemList});
|
||||
|
||||
LockGroupData.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
itemList = <LockGroupItem>[];
|
||||
json['list'].forEach((v) {
|
||||
itemList!.add(LockGroupItem.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (itemList != null) {
|
||||
data['list'] = itemList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LockGroupItem {
|
||||
int? lockNum;
|
||||
int? keyGroupId;
|
||||
String? keyGroupName;
|
||||
|
||||
LockGroupItem({this.lockNum, this.keyGroupId, this.keyGroupName});
|
||||
|
||||
LockGroupItem.fromJson(Map<String, dynamic> json) {
|
||||
lockNum = json['lockNum'];
|
||||
keyGroupId = json['keyGroupId'];
|
||||
keyGroupName = json['keyGroupName'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['lockNum'] = lockNum;
|
||||
data['keyGroupId'] = keyGroupId;
|
||||
data['keyGroupName'] = keyGroupName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/showTFView.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
@ -17,6 +21,9 @@ class LockSeletGroupingPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
||||
final TextEditingController _changeNameController = TextEditingController();
|
||||
final int _selectGroupIndex = -1;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -25,46 +32,124 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
|
||||
barTitle: TranslationLoader.lanKeys!.selectGroup!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(child: _buildMainUI()),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.createNewGroup!.tr,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(
|
||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
// Navigator.pushNamed(context, Routers.sendElectronicKeyManagePage);
|
||||
}),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: FutureBuilder<List<LockGroupItem>>(
|
||||
future: mockNetworkDataRequest(),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<LockGroupItem>> snapshot) {
|
||||
//请求结束
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
//请求失败
|
||||
return const Text('请求失败');
|
||||
} else {
|
||||
//请求成功
|
||||
final List<LockGroupItem> itemData = snapshot.data!;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(child: _buildMainUI(context, itemData)),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.createNewGroup!.tr,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(
|
||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
showCupertinoAlertDialog(context);
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//请求未结束 显示loading
|
||||
return Container();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
Widget _buildMainUI(BuildContext context, List itemList) {
|
||||
return ListView.builder(
|
||||
itemCount: 2,
|
||||
itemCount: itemList.length,
|
||||
itemBuilder: (c, index) {
|
||||
LockGroupItem itemData = itemList[index];
|
||||
return CommonItem(
|
||||
leftTitel: "202307",
|
||||
leftTitel: itemData.keyGroupName,
|
||||
rightTitle: "",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: Image(
|
||||
image: const AssetImage("images/icon_item_checked.png"),
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
rightWidget: _selectGroupIndex == index
|
||||
? Image(
|
||||
image: const AssetImage("images/icon_item_checked.png"),
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
fit: BoxFit.contain,
|
||||
)
|
||||
: Container(),
|
||||
action: () {
|
||||
// logic.changeLanguage(e);
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['groupName'] = itemData.keyGroupName;
|
||||
Navigator.pop(context, resultMap);
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//创建锁分组请求
|
||||
Future<void> addLockGroupRequest() async {
|
||||
LockGroupListEntity entity =
|
||||
await ApiRepository.to.addLockGroup(_changeNameController.text, '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: "创建成功");
|
||||
mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
//分组列表请求
|
||||
Future<List<LockGroupItem>> mockNetworkDataRequest() async {
|
||||
LockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList!;
|
||||
} else {
|
||||
List<LockGroupItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
void showCupertinoAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title:
|
||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
||||
tipTitle: "请输入",
|
||||
controller: _changeNameController,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (_changeNameController.text.isNotEmpty) {
|
||||
addLockGroupRequest();
|
||||
}
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,8 @@ import 'lockDetail_logic.dart';
|
||||
class LockDetailPage extends StatefulWidget {
|
||||
final LockMainEntity lockMainEntity;
|
||||
|
||||
const LockDetailPage({Key? key, required this.lockMainEntity}) : super(key: key);
|
||||
const LockDetailPage({Key? key, required this.lockMainEntity})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<LockDetailPage> createState() => _LockDetailPageState();
|
||||
@ -28,10 +29,7 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
||||
height: 1.sh,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
topWidget(),
|
||||
Expanded(child: bottomWidget())
|
||||
],
|
||||
children: [topWidget(), Expanded(child: bottomWidget())],
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -79,15 +77,15 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
||||
children: [
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: (){
|
||||
// logic.transferPermissionsAction();
|
||||
logic.openDoorAction();
|
||||
// logic.editLockUserAction();
|
||||
// logic.factoryDataResetAction();
|
||||
},
|
||||
child: Image.asset('images/main/icon_main_openLockBtn.png',
|
||||
width: 268.w, height: 268.w),
|
||||
)),
|
||||
onTap: () {
|
||||
// logic.transferPermissionsAction();
|
||||
logic.openDoorAction();
|
||||
// logic.editLockUserAction();
|
||||
// logic.factoryDataResetAction();
|
||||
},
|
||||
child: Image.asset('images/main/icon_main_openLockBtn.png',
|
||||
width: 268.w, height: 268.w),
|
||||
)),
|
||||
Align(
|
||||
alignment: const Alignment(0.6, 1),
|
||||
child: Image.asset(
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/jh_pop_menus.dart';
|
||||
@ -35,12 +38,10 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||
print('选中index: $index');
|
||||
print('选中text: $selText');
|
||||
|
||||
if (selText == '添加朋友') {
|
||||
// JhNavUtils.pushNamed(context, 'WxAddFriendPage');
|
||||
}
|
||||
if (selText == '扫一扫') {
|
||||
// _scan();
|
||||
if (index == 0) {
|
||||
mockNetworkDataRequest();
|
||||
} else if (index == 1) {
|
||||
clearOperationRecordRequest();
|
||||
}
|
||||
}, listData: [
|
||||
{'text': '读取记录'},
|
||||
@ -50,49 +51,78 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: const Text(
|
||||
"操作",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
onPressed: () {
|
||||
JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||
print('选中index: $index');
|
||||
print('选中text: $selText');
|
||||
|
||||
if (selText == '添加朋友') {
|
||||
// JhNavUtils.pushNamed(context, 'WxAddFriendPage');
|
||||
}
|
||||
if (selText == '扫一扫') {
|
||||
// _scan();
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
*/
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
padding: EdgeInsets.all(20.h),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
),
|
||||
_searchWidget(),
|
||||
Expanded(child: _buildMainUI()),
|
||||
],
|
||||
),
|
||||
body: FutureBuilder<List<KeyRecordDataItem>>(
|
||||
future: mockNetworkDataRequest(),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<KeyRecordDataItem>> snapshot) {
|
||||
//请求结束
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
//请求失败
|
||||
return const Text('请求失败');
|
||||
} else {
|
||||
//请求成功
|
||||
final List<KeyRecordDataItem> itemDataList = snapshot.data!;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.h),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
),
|
||||
_searchWidget(),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Expanded(child: _buildMainUI(itemDataList)),
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//请求未结束 显示loading
|
||||
return Container();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
//请求操作记录列表
|
||||
Future<List<KeyRecordDataItem>> mockNetworkDataRequest() async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
.lockRecordList('0', '63', '0', '28', '1', '1', '20', '0', '', '', '');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("操作记录列表成功:${entity.data?.itemList}");
|
||||
}
|
||||
final data = entity.data;
|
||||
if (data != null) {
|
||||
return data.itemList!;
|
||||
} else {
|
||||
List<KeyRecordDataItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
||||
//清空操作记录
|
||||
Future<List<KeyRecordDataItem>> clearOperationRecordRequest() async {
|
||||
KeyOperationRecordEntity entity =
|
||||
await ApiRepository.to.clearOperationRecord('28');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("操作记录列表成功:${entity.data?.itemList}");
|
||||
}
|
||||
final data = entity.data;
|
||||
if (data != null) {
|
||||
return data.itemList!;
|
||||
} else {
|
||||
List<KeyRecordDataItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
||||
Widget _searchWidget() {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
@ -128,19 +158,29 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return ListView.builder(
|
||||
itemCount: 20,
|
||||
itemBuilder: (c, index) {
|
||||
if (index % 2 == 0) {
|
||||
return _dateItem("2023-06-29");
|
||||
} else {
|
||||
return _operatingRecordItem('images/controls_user.png',
|
||||
"186823150237", "17:56:08用APP开锁", "", () {
|
||||
// Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
|
||||
});
|
||||
}
|
||||
});
|
||||
Widget _buildMainUI(List<KeyRecordDataItem> itemDataList) {
|
||||
return ListView.separated(
|
||||
itemCount: itemDataList.length,
|
||||
itemBuilder: (c, index) {
|
||||
KeyRecordDataItem dataItem = itemDataList[index];
|
||||
int? operateDate = dataItem.operateDate;
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
||||
String operateDateStr =
|
||||
'${dateStr.toLocal().toString().substring(0, 16)} ';
|
||||
|
||||
return _operatingRecordItem(
|
||||
'images/controls_user.png',
|
||||
dataItem.username ?? "未知",
|
||||
'$operateDateStr用${dataItem.recordTypeName}',
|
||||
() {});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _dateItem(String lockDate) {
|
||||
@ -159,8 +199,8 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _operatingRecordItem(String lockTypeIcon, String lockTypeTitle,
|
||||
String beginTime, String endTime, Function() action) {
|
||||
Widget _operatingRecordItem(String userAvatarStr, String userNameStr,
|
||||
String unlockDescStr, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
@ -173,7 +213,7 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
lockTypeIcon,
|
||||
userAvatarStr,
|
||||
width: 50.w,
|
||||
height: 50.w,
|
||||
),
|
||||
@ -187,25 +227,23 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
lockTypeTitle,
|
||||
userNameStr,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"17:56:08用APP开锁",
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
unlockDescStr,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_pickers/pickers.dart';
|
||||
import 'package:flutter_pickers/style/default_style.dart';
|
||||
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -27,11 +28,15 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
late bool _isSendSuccess;
|
||||
late bool _isPermanent;
|
||||
late String _getPwdStr;
|
||||
String _selectEffectiveDate = ''; //生效时间
|
||||
String _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
late String cyclicModeStr;
|
||||
late String effectiveHourStr;
|
||||
late String failureHourStr;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -43,13 +48,21 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
super.initState();
|
||||
|
||||
_isSendSuccess = false;
|
||||
_isPermanent = false;
|
||||
DateTime dateTime = DateTime.now();
|
||||
_effectiveDateTime = dateTime;
|
||||
_failureDateTime = dateTime;
|
||||
_selectEffectiveDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
_selectFailureDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
if (int.parse(widget.type) == 4) {
|
||||
cyclicModeStr = '周末';
|
||||
|
||||
_selectEffectiveDate = formatDate(dateTime, [HH, ':', nn]); //默认为当前时间
|
||||
_selectFailureDate = formatDate(dateTime, [HH, ':', nn]); //默认为当前时间
|
||||
} else {
|
||||
_selectEffectiveDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
_selectFailureDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
}
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
@ -103,6 +116,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
return Column(
|
||||
children: [
|
||||
keyIfPerpetualWidget(),
|
||||
_isPermanent == false ? keyTimeLimitWidget() : Container(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
@ -221,7 +235,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
||||
action: () {}),
|
||||
Container(height: 10.h),
|
||||
_isPermanent == true
|
||||
? Container(height: 10.h)
|
||||
: Container(height: 1.h),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -238,23 +254,68 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
rightTitle: "周末",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
List<String> pickerDataList = [
|
||||
'周末',
|
||||
'每日',
|
||||
'工作日',
|
||||
'星期一',
|
||||
'星期二',
|
||||
'星期三',
|
||||
'星期四',
|
||||
'星期五',
|
||||
'星期六',
|
||||
'星期日'
|
||||
];
|
||||
showPickerView(context, pickerDataList);
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: "10:00",
|
||||
rightTitle: _selectEffectiveDate,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_effectiveDateTime = DateTime.parse(
|
||||
'${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
||||
_selectEffectiveDate =
|
||||
formatDate(_effectiveDateTime, [HH, ':', nn]);
|
||||
});
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: "11:00",
|
||||
rightTitle: _selectFailureDate,
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_failureDateTime = DateTime.parse(
|
||||
'${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
||||
_selectFailureDate =
|
||||
formatDate(_effectiveDateTime, [HH, ':', nn]);
|
||||
});
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//底部选择pickerView
|
||||
showPickerView(BuildContext context, List dataList) {
|
||||
Pickers.showSinglePicker(context,
|
||||
data: dataList,
|
||||
pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) {
|
||||
setState(() {});
|
||||
}, onChanged: (p, position) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
Widget keyBottomWidget(String tipStr) {
|
||||
return Column(
|
||||
children: [
|
||||
@ -453,15 +514,14 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
}
|
||||
|
||||
CupertinoSwitch _switch() {
|
||||
bool _isOn = false;
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: _isOn,
|
||||
value: _isPermanent,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_isOn = value;
|
||||
_isPermanent = value;
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@ -29,4 +29,7 @@ abstract class Api {
|
||||
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
||||
|
||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
||||
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
||||
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
||||
}
|
||||
|
||||
@ -305,6 +305,16 @@ class ApiProvider extends BaseProvider {
|
||||
'startDate': startDate,
|
||||
'timezoneRawOffSet': timezoneRawOffSet
|
||||
}));
|
||||
|
||||
Future<Response> clearOperationRecord(String lockId) =>
|
||||
post(clearOperationRecordURL.toUrl, jsonEncode({'lockId': lockId}));
|
||||
|
||||
Future<Response> addLockGroup(String groupName, String operatorUid) => post(
|
||||
addlockGroupURL.toUrl,
|
||||
jsonEncode({'groupName': groupName, 'operatorUid': operatorUid}));
|
||||
|
||||
Future<Response> lockGroupList(String type) =>
|
||||
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
||||
}
|
||||
|
||||
extension ExtensionString on String {
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import '../../tools/toast.dart';
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:get/get.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/electronicKeyList/entity/ElectronicKeyListEntity.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/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||
@ -282,4 +283,23 @@ class ApiRepository {
|
||||
timezoneRawOffSet);
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//清空操作记录
|
||||
Future<KeyOperationRecordEntity> clearOperationRecord(String lockId) async {
|
||||
final res = await apiProvider.clearOperationRecord(lockId);
|
||||
return KeyOperationRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//创建锁分组
|
||||
Future<LockGroupListEntity> addLockGroup(
|
||||
String groupName, String operatorUid) async {
|
||||
final res = await apiProvider.addLockGroup(groupName, operatorUid);
|
||||
return LockGroupListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//锁分组列表
|
||||
Future<LockGroupListEntity> lockGroupList(String type) async {
|
||||
final res = await apiProvider.lockGroupList(type);
|
||||
return LockGroupListEntity.fromJson(res.body);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user