1,电子钥匙列表数据替换
2,发送钥匙数据替换
This commit is contained in:
parent
a487a22580
commit
6222675100
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -23,36 +23,19 @@ class ElectronicKeyListPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||||
final logic = Get.put(ElectronicKeyListLogic());
|
final logic = Get.put(ElectronicKeyListLogic());
|
||||||
|
late KeyInfos keyInfo;
|
||||||
//请求电子钥匙列表
|
late LockMainEntity lockMainEntity;
|
||||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
|
||||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '0');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
|
||||||
}
|
|
||||||
if (entity.data != null) {
|
|
||||||
return entity.data!.itemList;
|
|
||||||
} else {
|
|
||||||
List<ElectronicKeyListItem> dataList = [];
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//电子钥匙重置请求
|
|
||||||
Future<void> resetElectronicKeyListRequest() async {
|
|
||||||
ElectronicKeyListEntity entity =
|
|
||||||
await ApiRepository.to.resetElectronicKey('28', '0');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("重置电子钥匙成功啦啦啦啦啦");
|
|
||||||
Toast.show(msg: "重置成功");
|
|
||||||
mockNetworkDataRequest();
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||||
|
lockMainEntity = obj["lockMainEntity"];
|
||||||
|
}
|
||||||
|
if (obj != null && (obj["keyInfo"] != null)) {
|
||||||
|
keyInfo = obj["keyInfo"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -95,7 +78,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.sendElectronicKeyManagePage);
|
context, Routers.sendElectronicKeyManagePage,
|
||||||
|
arguments: {
|
||||||
|
"lockMainEntity": lockMainEntity,
|
||||||
|
"keyInfo": keyInfo
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -184,6 +171,41 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//请求电子钥匙列表
|
||||||
|
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||||
|
'0',
|
||||||
|
keyInfo.keyId.toString(),
|
||||||
|
'',
|
||||||
|
keyInfo.lockId.toString(),
|
||||||
|
'',
|
||||||
|
'1',
|
||||||
|
'20',
|
||||||
|
'0',
|
||||||
|
keyInfo.keyRight.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
|
}
|
||||||
|
if (entity.data != null) {
|
||||||
|
return entity.data!.itemList;
|
||||||
|
} else {
|
||||||
|
List<ElectronicKeyListItem> dataList = [];
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//电子钥匙重置请求
|
||||||
|
Future<void> resetElectronicKeyListRequest() async {
|
||||||
|
ElectronicKeyListEntity entity =
|
||||||
|
await ApiRepository.to.resetElectronicKey('28', '0');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "重置成功");
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -28,6 +29,8 @@ class SendElectronicKeyPage extends StatefulWidget {
|
|||||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||||
late Contact _contact;
|
late Contact _contact;
|
||||||
|
late KeyInfos keyInfo;
|
||||||
|
late LockMainEntity lockMainEntity;
|
||||||
|
|
||||||
// final logic = Get.put(SendElectronicKeyLogic());
|
// final logic = Get.put(SendElectronicKeyLogic());
|
||||||
// final state = Get.find<SendElectronicKeyLogic>().state;
|
// final state = Get.find<SendElectronicKeyLogic>().state;
|
||||||
@ -63,6 +66,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||||
|
lockMainEntity = obj["lockMainEntity"];
|
||||||
|
}
|
||||||
|
if (obj != null && (obj["keyInfo"] != null)) {
|
||||||
|
keyInfo = obj["keyInfo"];
|
||||||
|
}
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: indexChangeWidget(),
|
child: indexChangeWidget(),
|
||||||
);
|
);
|
||||||
@ -323,7 +334,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
Future<void> sendElectronicKeyRequest() async {
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
String getFailureDateTime = '0';
|
String getFailureDateTime = '0';
|
||||||
String getEffectiveDateTime = '0';
|
String getEffectiveDateTime = '0';
|
||||||
String deviceID = '28';
|
String lockID = keyInfo.lockId.toString();
|
||||||
String getKeyType = (int.parse(widget.type) + 1).toString();
|
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||||
if (widget.type == '0') {
|
if (widget.type == '0') {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
@ -341,12 +352,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
'2',
|
'2',
|
||||||
_isRemoteUnlock == true ? '1' : '2',
|
_isRemoteUnlock == true ? '1' : '2',
|
||||||
keyNameController.text,
|
keyNameController.text,
|
||||||
'1',
|
keyInfo.keyRight.toString(),
|
||||||
getKeyType,
|
getKeyType,
|
||||||
deviceID,
|
lockID,
|
||||||
'小吴副号',
|
'',
|
||||||
emailOrPhoneController.text,
|
emailOrPhoneController.text,
|
||||||
'0',
|
'',
|
||||||
getEffectiveDateTime,
|
getEffectiveDateTime,
|
||||||
weekdaysList);
|
weekdaysList);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
|||||||
@ -174,7 +174,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
}),
|
}),
|
||||||
bottomItem('images/main/icon_main_electronicKey.png',
|
bottomItem('images/main/icon_main_electronicKey.png',
|
||||||
TranslationLoader.lanKeys!.electronicKey!.tr, () {
|
TranslationLoader.lanKeys!.electronicKey!.tr, () {
|
||||||
Navigator.pushNamed(context, Routers.electronicKeyListPage);
|
Navigator.pushNamed(context, Routers.electronicKeyListPage,
|
||||||
|
arguments: {
|
||||||
|
"lockMainEntity": widget.lockMainEntity,
|
||||||
|
"keyInfo": widget.keyInfo
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
bottomItem('images/main/icon_main_password.png',
|
bottomItem('images/main/icon_main_password.png',
|
||||||
TranslationLoader.lanKeys!.password!.tr, () {
|
TranslationLoader.lanKeys!.password!.tr, () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user