Merge branch 'master' of gitee.com:starlock-cn/app-starlock
# Conflicts: # star_lock/lib/network/api_repository.dart
This commit is contained in:
commit
076cb07081
84
.idea/starLock.iml
generated
84
.idea/starLock.iml
generated
@ -252,6 +252,90 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/aliyun_push/example/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/aliyun_push/example/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/aliyun_push/example/build" />
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/aliyun_push/example/build" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/aliyun_push/example/.dart_tool" />
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/aliyun_push/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_session/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_session/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_session/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/google_maps_flutter_ios/example/ios14/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/google_maps_flutter_ios/example/ios14/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/google_maps_flutter_ios/example/ios14/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_pcm_sound/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_pcm_sound/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_pcm_sound/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_pcm_sound/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_pcm_sound/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_pcm_sound/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_blue_plus/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_blue_plus/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_blue_plus/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_service/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_service/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_service/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/system_settings/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/system_settings/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/system_settings/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/app_settings/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/app_settings/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/app_settings/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_voice_processor/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_voice_processor/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_voice_processor/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/connectivity_plus/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/connectivity_plus/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/connectivity_plus/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/just_audio/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/just_audio/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/just_audio/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audioplayers_darwin/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audioplayers_darwin/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audioplayers_darwin/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_blue_plus/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_blue_plus/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_blue_plus/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/system_settings/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/system_settings/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/system_settings/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/image_gallery_saver/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/image_gallery_saver/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/image_gallery_saver/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/just_audio/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/just_audio/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/just_audio/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/image_gallery_saver/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/image_gallery_saver/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/image_gallery_saver/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/jpush_flutter/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/jpush_flutter/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/jpush_flutter/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/jpush_flutter/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/jpush_flutter/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/jpush_flutter/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_service/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_service/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_service/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_local_notifications/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_local_notifications/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_local_notifications/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_local_notifications/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_local_notifications/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_local_notifications/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/connectivity_plus/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/connectivity_plus/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/connectivity_plus/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/app_settings/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/app_settings/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/app_settings/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_voice_processor/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_voice_processor/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/flutter_voice_processor/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/g711_flutter/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/g711_flutter/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/g711_flutter/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_session/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_session/example/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/audio_session/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/g711_flutter/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/g711_flutter/example/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/star_lock/ios/.symlinks/plugins/g711_flutter/example/.pub" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
|||||||
@ -107,6 +107,7 @@ import 'main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWi
|
|||||||
import 'main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
import 'main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
||||||
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||||
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
|
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
|
||||||
|
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart';
|
||||||
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
|
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
|
||||||
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControlManage/addRemoteControlManage_page.dart';
|
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControlManage/addRemoteControlManage_page.dart';
|
||||||
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
|
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
|
||||||
@ -130,7 +131,6 @@ import 'main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotificatio
|
|||||||
import 'main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart';
|
import 'main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart';
|
||||||
import 'main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart';
|
import 'main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart';
|
||||||
import 'main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart';
|
import 'main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart';
|
||||||
import 'main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart';
|
|
||||||
import 'main/lockMian/lockMain/lockMain_page.dart';
|
import 'main/lockMian/lockMain/lockMain_page.dart';
|
||||||
import 'mine/addLock/addLockSelectCountry/addLockSelectCountry_page.dart';
|
import 'mine/addLock/addLockSelectCountry/addLockSelectCountry_page.dart';
|
||||||
import 'mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart';
|
import 'mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart';
|
||||||
@ -161,7 +161,7 @@ import 'mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetwor
|
|||||||
import 'mine/mineSet/authorityManagement/authorityManagement_page.dart';
|
import 'mine/mineSet/authorityManagement/authorityManagement_page.dart';
|
||||||
import 'mine/mineSet/authorityManagement/getDeviceList_page.dart';
|
import 'mine/mineSet/authorityManagement/getDeviceList_page.dart';
|
||||||
import 'mine/mineSet/authorityManagement/getNameList_page.dart';
|
import 'mine/mineSet/authorityManagement/getNameList_page.dart';
|
||||||
import 'mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
import 'mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministratorManage/addAuthorizedAdministratorManage_page.dart';
|
||||||
import 'mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart';
|
import 'mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart';
|
||||||
import 'mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart';
|
import 'mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart';
|
||||||
import 'mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart';
|
import 'mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart';
|
||||||
@ -860,7 +860,7 @@ abstract class AppRouters {
|
|||||||
page: () => const MineBindPhoneOrEmailPage()),
|
page: () => const MineBindPhoneOrEmailPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addAuthorizedAdministratorPage,
|
name: Routers.addAuthorizedAdministratorPage,
|
||||||
page: () => const AddAuthorizedAdministratorPage()),
|
page: () => const AddAuthorizedAdministratorManagePage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.safetyVerificationPage,
|
name: Routers.safetyVerificationPage,
|
||||||
page: () => const SafetyVerificationPage(),
|
page: () => const SafetyVerificationPage(),
|
||||||
|
|||||||
@ -559,9 +559,11 @@ class BlueManage {
|
|||||||
// 断开连接
|
// 断开连接
|
||||||
Future<void> disconnect() async {
|
Future<void> disconnect() async {
|
||||||
try {
|
try {
|
||||||
connectDeviceMacAddress = "";
|
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
|
||||||
await bluetoothConnectDevice!.disconnect();
|
connectDeviceMacAddress = "";
|
||||||
Get.log("断开连接成功");
|
await bluetoothConnectDevice!.disconnect();
|
||||||
|
Get.log("断开连接成功");
|
||||||
|
// }
|
||||||
} on Exception catch (e, _) {
|
} on Exception catch (e, _) {
|
||||||
Get.log("Error disconnecting from a device: $e");
|
Get.log("Error disconnecting from a device: $e");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -186,7 +186,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.safetyVerificationPage,
|
context, Routers.safetyVerificationPage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"countryCode": "+86",
|
"countryCode": "86",
|
||||||
"account": state.phoneStr.value
|
"account": state.phoneStr.value
|
||||||
});
|
});
|
||||||
logic.state.xWidth.value =
|
logic.state.xWidth.value =
|
||||||
|
|||||||
@ -11,17 +11,14 @@ import '../authorizedAdmin_page.dart';
|
|||||||
class AuthorizedAdminManageTabbar extends StatefulWidget {
|
class AuthorizedAdminManageTabbar extends StatefulWidget {
|
||||||
var initialIndex = 1;
|
var initialIndex = 1;
|
||||||
|
|
||||||
AuthorizedAdminManageTabbar({Key? key, required this.initialIndex})
|
AuthorizedAdminManageTabbar({Key? key, required this.initialIndex}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AuthorizedAdminManageTabbar> createState() =>
|
State<AuthorizedAdminManageTabbar> createState() =>
|
||||||
_AuthorizedAdminManageTabbarState();
|
_AuthorizedAdminManageTabbarState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AuthorizedAdminManageTabbarState
|
class _AuthorizedAdminManageTabbarState extends State<AuthorizedAdminManageTabbar> with SingleTickerProviderStateMixin {
|
||||||
extends State<AuthorizedAdminManageTabbar>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
|
|
||||||
final List<ItemView> _itemTabs = <ItemView>[
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
|
|||||||
@ -298,6 +298,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
} else {
|
} else {
|
||||||
if (entity.errorCode == 425) {
|
if (entity.errorCode == 425) {
|
||||||
//用户未注册
|
//用户未注册
|
||||||
|
state.isCreateUser.value = true;
|
||||||
_showDialog('${entity.errorMsg}');
|
_showDialog('${entity.errorMsg}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,7 +321,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'),
|
title: const Text('接收者号码未注册,请重新发送'),
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
@ -329,18 +330,18 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.select!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
//选择国家代码
|
//选择国家代码
|
||||||
state.isCreateUser.value = true;
|
Get.back();
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
// var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
// if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
// result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
// state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
// state.countryName.value = result['countryName'];
|
||||||
}
|
// }
|
||||||
|
sendElectronicKeyRequest();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -175,7 +175,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isTipsImg: true,
|
isTipsImg: true,
|
||||||
tipsImgAction: () {
|
tipsImgAction: () {
|
||||||
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||||
},
|
},
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
||||||
|
|||||||
@ -126,7 +126,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context){
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||||
logic.deleteKeyRequest(indexEntity.keyId.toString(), isAllData ? 1 : 0);
|
logic.deleteKeyRequest(indexEntity.keyId.toString(), isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -333,16 +333,16 @@ class _VolumeAuthorizationLockPageState
|
|||||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||||
_isCreateUser ? "1" : "0",
|
createUser:_isCreateUser ? "1" : "0",
|
||||||
getFailureDateTime,
|
endDate:getFailureDateTime,
|
||||||
_isRemoteUnlock == true ? '1' : '2',
|
isRemoteUnlock:_isRemoteUnlock == true ? '1' : '2',
|
||||||
[],
|
keyGroupIdList:[],
|
||||||
_lockIdList,
|
lockIdList:_lockIdList,
|
||||||
_keyNameController.text,
|
name:_keyNameController.text,
|
||||||
getEffectiveDateTime,
|
startDate:getEffectiveDateTime,
|
||||||
_emailOrPhoneController.text,
|
userid:_emailOrPhoneController.text,
|
||||||
countryCode,
|
countryCode:countryCode,
|
||||||
'1',
|
usernameType:'1',
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
|
|||||||
@ -144,8 +144,8 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
cardId: state.keyId.value.toString(),
|
cardId: state.keyId.value.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: state.starDate.value,
|
startDate: state.starDate.value*1000,
|
||||||
endDate: state.endDate.value,
|
endDate: state.endDate.value*1000,
|
||||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||||
cardName: state.changeNameController.text,
|
cardName: state.changeNameController.text,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
@ -182,7 +182,7 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
}else if(state.keyType.value == 2){
|
}else if(state.keyType.value == 2){
|
||||||
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
} else if(state.keyType.value == 4){
|
} else if(state.keyType.value == 4){
|
||||||
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}";
|
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
}
|
}
|
||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -365,6 +365,21 @@ class CardListLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getKeyType(FingerprintItemData fingerprintItemData){
|
||||||
|
// fingerprintStatus 1:正常 2:失效
|
||||||
|
var keyTypeStr = "";//
|
||||||
|
// (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : ""
|
||||||
|
if(fingerprintItemData.cardStatus == 1){
|
||||||
|
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
||||||
|
keyTypeStr = "未生效";
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(fingerprintItemData.cardStatus == 2){
|
||||||
|
keyTypeStr = "已失效";
|
||||||
|
}
|
||||||
|
return keyTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
||||||
var keyDateTypeStr = "";// 永久:1;限时2,单次3,循环:4
|
var keyDateTypeStr = "";// 永久:1;限时2,单次3,循环:4
|
||||||
if(fingerprintItemData.cardType! == 1){
|
if(fingerprintItemData.cardType! == 1){
|
||||||
@ -372,7 +387,7 @@ class CardListLogic extends BaseGetXController {
|
|||||||
}else if(fingerprintItemData.cardType! == 2){
|
}else if(fingerprintItemData.cardType! == 2){
|
||||||
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
||||||
}else if(fingerprintItemData.cardType! == 4){
|
}else if(fingerprintItemData.cardType! == 4){
|
||||||
keyDateTypeStr = "循环";
|
keyDateTypeStr = "${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环";
|
||||||
}
|
}
|
||||||
return keyDateTypeStr;
|
return keyDateTypeStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,7 +144,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
child: _keyItem(
|
child: _keyItem(
|
||||||
'images/icon_card.png',
|
'images/icon_card.png',
|
||||||
fingerprintItemData.cardName!,
|
fingerprintItemData.cardName!,
|
||||||
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
logic.getKeyType(fingerprintItemData),
|
||||||
logic.getKeyDateType(fingerprintItemData), () async {
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.cardDetailPage, arguments: {
|
Routers.cardDetailPage, arguments: {
|
||||||
|
|||||||
@ -11,14 +11,14 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 修改指纹信息
|
// 修改指纹信息
|
||||||
void editFingerprintsData() async{
|
void editFingerprintsData() async{
|
||||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000;
|
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000;
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
|
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||||
showToast("生效时间需大于当前时间");
|
showToast("生效时间需大于当前时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -48,14 +48,14 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 编辑iC卡
|
// 编辑iC卡
|
||||||
void editICCardData() async{
|
void editICCardData() async{
|
||||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000;
|
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000;
|
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||||
showToast("失效时间需大于生效时间");
|
showToast("失效时间需大于生效时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
|
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||||
showToast("生效时间需大于当前时间");
|
showToast("生效时间需大于当前时间");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,9 +180,10 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
array[index],
|
array[index],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: index == 5 || index == 6
|
color:
|
||||||
? const Color(0xFFC4C8D0)
|
// index == 5 || index == 6
|
||||||
: const Color(0xFF3C3E43),
|
// ? const Color(0xFFC4C8D0) :
|
||||||
|
const Color(0xFF3C3E43),
|
||||||
fontSize: 26.sp),
|
fontSize: 26.sp),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
@ -212,14 +213,14 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
Color backColor = Colors.white;
|
Color backColor = Colors.white;
|
||||||
// Color textColor = const Color(0xFFFFFFFF);
|
// Color textColor = const Color(0xFFFFFFFF);
|
||||||
if(_datas[index].workType == "1"){
|
if(_datas[index].workType == "1"){
|
||||||
backColor = const Color(0xFFE83523);
|
// 迟到
|
||||||
// textColor = Colors.white;
|
backColor = const Color(0xFFE83523);
|
||||||
}else if( _datas[index].workType == "2"){
|
}else if( _datas[index].workType == "2"){
|
||||||
|
// 早退
|
||||||
backColor = const Color(0xFFEDB459);
|
backColor = const Color(0xFFEDB459);
|
||||||
// textColor = Colors.white;
|
|
||||||
}else if( _datas[index].workType == "3"){
|
}else if( _datas[index].workType == "3"){
|
||||||
|
// 未打卡
|
||||||
backColor = const Color(0xFF666666);
|
backColor = const Color(0xFF666666);
|
||||||
// textColor = Colors.white;
|
|
||||||
}
|
}
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -263,17 +264,13 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
? _datas[index].day.toString()
|
? _datas[index].day.toString()
|
||||||
: "",
|
: "",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
//设置选中字体颜色,以及周末和工作日颜色
|
//设置选中字体颜色 休息的颜色都是黑色 其余的都是白色因为有背景色
|
||||||
style: (int.parse(_datas[index].workType!) > 0)
|
style: (int.parse(_datas[index].workType!) > 0)
|
||||||
? TextStyle(
|
? TextStyle(
|
||||||
fontSize: 24.sp, color: const Color(0xFFFFFFFF))
|
fontSize: 24.sp, color: const Color(0xFFFFFFFF))
|
||||||
: (index % 7 == 5 || index % 7 == 6
|
: TextStyle(
|
||||||
? TextStyle(
|
fontSize: 24.sp,
|
||||||
fontSize: 24.sp,
|
color: Colors.black),
|
||||||
color: const Color(0xFFC4C8D0))
|
|
||||||
: TextStyle(
|
|
||||||
fontSize: 24.sp,
|
|
||||||
color: const Color(0xFF3C3E43))),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -336,7 +333,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 70.h,
|
// height: 70.h,
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.only(left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
EdgeInsets.only(left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'checkingInList_state.dart';
|
import 'checkingInList_state.dart';
|
||||||
|
|
||||||
@ -101,6 +104,13 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late StreamSubscription _teamEvent;
|
||||||
|
void _initLoadDataAction() {
|
||||||
|
_teamEvent = eventBus.on<RefreshCheckInListEvent>().listen((event) {
|
||||||
|
loadDataByType();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
@ -110,6 +120,8 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if(isDemoMode == false){
|
||||||
|
_initLoadDataAction();
|
||||||
|
|
||||||
openCheckingInData();
|
openCheckingInData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +137,9 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
_teamEvent.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
@ -71,12 +73,12 @@ class CheckingInSetLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
// void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
// _teamEvent = eventBus.on<RefreshCheckInStaffListDataEvent>().listen((event) {
|
_teamEvent = eventBus.on<RefreshCheckInSetDataEvent>().listen((event) {
|
||||||
// getStaffList();
|
getCheckInSetInfoData();
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
@ -84,7 +86,7 @@ class CheckingInSetLogic extends BaseGetXController{
|
|||||||
super.onReady();
|
super.onReady();
|
||||||
print("onReady()");
|
print("onReady()");
|
||||||
|
|
||||||
// _initLoadDataAction();
|
_initLoadDataAction();
|
||||||
openCheckingInData();
|
openCheckingInData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +100,6 @@ class CheckingInSetLogic extends BaseGetXController{
|
|||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
// _teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import 'checkingInSetWorkdaySet_state.dart';
|
import 'checkingInSetWorkdaySet_state.dart';
|
||||||
|
|
||||||
class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
||||||
@ -12,7 +13,7 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
|||||||
var entity = await ApiRepository.to.editCheckInSetInfoData(
|
var entity = await ApiRepository.to.editCheckInSetInfoData(
|
||||||
attendanceType: (state.isCustom.value == true) ? "0" : "1",
|
attendanceType: (state.isCustom.value == true) ? "0" : "1",
|
||||||
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
||||||
type: "2",
|
type: (state.isCustom.value == true) ? "3" : "4",
|
||||||
companyName: state.checkingInSetInfo.value.companyName ?? "",
|
companyName: state.checkingInSetInfo.value.companyName ?? "",
|
||||||
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
||||||
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
||||||
@ -20,6 +21,7 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功", something: (){
|
showToast("修改成功", something: (){
|
||||||
|
eventBus.fire(RefreshCheckInSetDataEvent());
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"attendanceType":state.isCustom.value,
|
"attendanceType":state.isCustom.value,
|
||||||
"weekDays":state.weekDays.value,
|
"weekDays":state.weekDays.value,
|
||||||
|
|||||||
@ -200,7 +200,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
dateStr = "";
|
dateStr = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return CommonItem(
|
return Obx(() => CommonItem(
|
||||||
leftTitel: dateStr,
|
leftTitel: dateStr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
allHeight: 60.h,
|
allHeight: 60.h,
|
||||||
@ -217,12 +217,12 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
state.weekDays.value.sort();
|
state.weekDays.value.sort();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
rightWidget: Obx(() => Row(
|
rightWidget: Row(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
||||||
],
|
],
|
||||||
))
|
)
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -12,6 +12,8 @@ class CheckingInSetWorkdaySetState{
|
|||||||
final checkingInSetInfo = CheckingInSetInfo().obs;
|
final checkingInSetInfo = CheckingInSetInfo().obs;
|
||||||
final companyId = "".obs;
|
final companyId = "".obs;
|
||||||
|
|
||||||
|
// var changeType = "3".obs;// 3修改workDay自定义 4修改workDay
|
||||||
|
|
||||||
var pushType = "".obs;// 2考勤设置信息 1考勤创建公司
|
var pushType = "".obs;// 2考勤设置信息 1考勤创建公司
|
||||||
|
|
||||||
CheckingInSetWorkdaySetState() {
|
CheckingInSetWorkdaySetState() {
|
||||||
@ -24,6 +26,7 @@ class CheckingInSetWorkdaySetState{
|
|||||||
|
|
||||||
weekDays.value = checkingInSetInfo.value.workDay!;
|
weekDays.value = checkingInSetInfo.value.workDay!;
|
||||||
isCustom.value = (checkingInSetInfo.value.attendanceType! == 0) ? true : false;
|
isCustom.value = (checkingInSetInfo.value.attendanceType! == 0) ? true : false;
|
||||||
|
Get.log("weekDays: $weekDays checkingInSetInfo.value.workDay!: ${checkingInSetInfo.value.workDay!} checkingInSetInfo.value.attendanceType!: ${checkingInSetInfo.value.attendanceType!}");
|
||||||
if(isCustom.value == false){
|
if(isCustom.value == false){
|
||||||
if(checkingInSetInfo.value.workDay!.length == 5){
|
if(checkingInSetInfo.value.workDay!.length == 5){
|
||||||
isSingledayWeekend.value = 1;
|
isSingledayWeekend.value = 1;
|
||||||
|
|||||||
@ -45,6 +45,8 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
|||||||
usernameType:usernameType,
|
usernameType:usernameType,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
eventBus.fire(RefreshCheckInSetDataEvent());
|
||||||
|
eventBus.fire(RefreshCheckInListEvent());
|
||||||
Get.back(result: "addScuess");
|
Get.back(result: "addScuess");
|
||||||
}else if(entity.errorCode! == 425){
|
}else if(entity.errorCode! == 425){
|
||||||
showToast(entity.errorMsg!);
|
showToast(entity.errorMsg!);
|
||||||
|
|||||||
@ -39,6 +39,7 @@ class CheckingInAddStaffListItemEntity {
|
|||||||
int? countryCode;
|
int? countryCode;
|
||||||
int? cardStatus;
|
int? cardStatus;
|
||||||
String? attendanceWay;
|
String? attendanceWay;
|
||||||
|
String? reason;
|
||||||
|
|
||||||
CheckingInAddStaffListItemEntity(
|
CheckingInAddStaffListItemEntity(
|
||||||
{this.headurl,
|
{this.headurl,
|
||||||
@ -47,7 +48,8 @@ class CheckingInAddStaffListItemEntity {
|
|||||||
this.attendanceType,
|
this.attendanceType,
|
||||||
this.countryCode,
|
this.countryCode,
|
||||||
this.cardStatus,
|
this.cardStatus,
|
||||||
this.attendanceWay});
|
this.attendanceWay,
|
||||||
|
this.reason});
|
||||||
|
|
||||||
CheckingInAddStaffListItemEntity.fromJson(Map<String, dynamic> json) {
|
CheckingInAddStaffListItemEntity.fromJson(Map<String, dynamic> json) {
|
||||||
headurl = json['headurl'];
|
headurl = json['headurl'];
|
||||||
@ -57,6 +59,7 @@ class CheckingInAddStaffListItemEntity {
|
|||||||
countryCode = json['countryCode'];
|
countryCode = json['countryCode'];
|
||||||
cardStatus = json['cardStatus'];
|
cardStatus = json['cardStatus'];
|
||||||
attendanceWay = json['attendanceWay'];
|
attendanceWay = json['attendanceWay'];
|
||||||
|
reason = json['reason'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -68,6 +71,7 @@ class CheckingInAddStaffListItemEntity {
|
|||||||
data['countryCode'] = countryCode;
|
data['countryCode'] = countryCode;
|
||||||
data['cardStatus'] = cardStatus;
|
data['cardStatus'] = cardStatus;
|
||||||
data['attendanceWay'] = attendanceWay;
|
data['attendanceWay'] = attendanceWay;
|
||||||
|
data['reason'] = reason;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,10 +21,11 @@ class CheckingInStaffManageLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除员工
|
// 删除员工
|
||||||
void deletStaff(int staffId) async{
|
void deletStaff(int staffId, int deleteKey) async{
|
||||||
var entity = await ApiRepository.to.deletStaffData(
|
var entity = await ApiRepository.to.deletStaffData(
|
||||||
lockId: state.getKeyInfosData.value.lockId!,
|
lockId: state.getKeyInfosData.value.lockId!,
|
||||||
staffId:staffId,
|
staffId:staffId,
|
||||||
|
deleteKey:deleteKey
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
getStaffList();
|
getStaffList();
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -71,7 +72,14 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context){
|
||||||
showIosTipViewDialog(staffListItem.staffId!, context);
|
// 1APP 2密码 3卡 4指纹 5人脸
|
||||||
|
if(staffListItem.attendanceType == 1){
|
||||||
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙', (isAllData) {
|
||||||
|
logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0));
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
showIosTipViewDialog(staffListItem.staffId!, context);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -130,9 +138,12 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
style: TextStyle(fontSize: 24.sp)
|
style: TextStyle(fontSize: 24.sp)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Visibility(visible: staffListItem.cardStatus == 0, child: SizedBox(height: 5.h,)),
|
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: staffListItem.cardStatus == 0,
|
visible: staffListItem.cardStatus == 1 ? true : false,
|
||||||
|
child: SizedBox(height: 5.h,)
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: staffListItem.cardStatus == 1 ? true : false,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -182,10 +193,10 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowIosTipView(
|
return ShowIosTipView(
|
||||||
title: "提示",
|
title: "提示",
|
||||||
tipTitle: "确定要删除吗?",
|
tipTitle: "确定要删除员工吗?",
|
||||||
sureClick: () async {
|
sureClick: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
logic.deletStaff(staffId);
|
logic.deletStaff(staffId, 0);
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
|
|||||||
@ -60,13 +60,13 @@ class _CheckingInStaffDetailPageState extends State<CheckingInStaffDetailPage> {
|
|||||||
// rightTitle: state.staffListItemData.value.attendanceWay,
|
// rightTitle: state.staffListItemData.value.attendanceWay,
|
||||||
// isHaveLine: true)),
|
// isHaveLine: true)),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.staffListItemData.value.cardStatus == 0,
|
visible: state.staffListItemData.value.cardStatus == 1 ? true : false,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
padding: EdgeInsets.only(left: 20.w),
|
padding: EdgeInsets.only(left: 20.w),
|
||||||
child: Text("钥匙已被删除,打卡方式无效", style: TextStyle(fontSize: 22.sp, color: AppColors.openPassageModeColor)))
|
child: Text("${state.staffListItemData.value.reason}," "打卡方式无效", style: TextStyle(fontSize: 22.sp, color: AppColors.openPassageModeColor)))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
@ -7,10 +9,15 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
|
|||||||
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 '../../../../../tools/custom_bottom_sheet.dart';
|
||||||
import '../../../../../tools/dateTool.dart';
|
import '../../../../../tools/dateTool.dart';
|
||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../../tools/jh_pop_menus.dart';
|
import '../../../../../tools/jh_pop_menus.dart';
|
||||||
|
import '../../../../../tools/showDeleteAdministratorIsHaveAllDataWidget.dart';
|
||||||
import '../../../../../tools/showTipView.dart';
|
import '../../../../../tools/showTipView.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
typedef BlockIsHaveAllDataCallback = void Function(bool isAllData);
|
||||||
|
|
||||||
class ElectronicKeyDetailLogic extends BaseGetXController {
|
class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||||
final ElectronicKeyDetailState state = ElectronicKeyDetailState();
|
final ElectronicKeyDetailState state = ElectronicKeyDetailState();
|
||||||
@ -35,13 +42,13 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//编辑电子钥匙有效期请求
|
//编辑电子钥匙有效期请求 updateType 1:仅管理自己创建的用户 2:远程开锁
|
||||||
Future<void> updateKeyDateRequest() async {
|
Future<void> updateKeyDateRequest(int updateType) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
lockId:state.itemData.value.lockId.toString(),
|
lockId:state.itemData.value.lockId.toString(),
|
||||||
endDate:state.starDate.value.toString(),
|
endDate:state.endDate.value.toString(),
|
||||||
startDate:state.endDate.value.toString(),
|
startDate:state.starDate.value.toString(),
|
||||||
weekDays:state.itemData.value.weekDays!,
|
weekDays:state.itemData.value.weekDays!,
|
||||||
keyType:state.itemData.value.keyType!,
|
keyType:state.itemData.value.keyType!,
|
||||||
startTime:int.parse(state.starTime.value),
|
startTime:int.parse(state.starTime.value),
|
||||||
@ -49,6 +56,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0,
|
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0,
|
||||||
remoteEnable: state.isRemoteUnlock.value ? 1 : 0);
|
remoteEnable: state.isRemoteUnlock.value ? 1 : 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// if(updateType == 1){
|
||||||
|
// state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value;
|
||||||
|
// }else if(updateType == 2){
|
||||||
|
// state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
|
// }
|
||||||
showToast("修改成功", something: () {
|
showToast("修改成功", something: () {
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
@ -101,9 +113,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//冻结
|
//冻结
|
||||||
Future<void> freezeKey() async {
|
Future<void> freezeKey(int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
includeUnderlings: includeUnderlings
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功", something: () {
|
showToast("设置成功", something: () {
|
||||||
@ -115,9 +128,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//取消冻结
|
//取消冻结
|
||||||
Future<void> cancelFreeze() async {
|
Future<void> cancelFreeze(int includeUnderlings) async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
||||||
keyId:state.itemData.value.keyId.toString(),
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
includeUnderlings: includeUnderlings
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("设置成功", something: () {
|
showToast("设置成功", something: () {
|
||||||
@ -142,49 +156,170 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
showPopMenus(){
|
Future openModalBottomSheet(BuildContext context) async {
|
||||||
var textList = [];
|
var textList = <String>[];
|
||||||
// keyType // 永久:1;限时2,单次3,循环:4
|
|
||||||
// itemData.keyRight == 1 // 1:管理员 2:普通用户
|
|
||||||
// indexEntity.keyStatus! 110405:已冻结 110412:已过期 110408:已删除 110410:已重置
|
|
||||||
if(state.keyType.value == 1 || state.keyType.value == 2){
|
if(state.keyType.value == 1 || state.keyType.value == 2){
|
||||||
textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}, {'text': state.itemData.value.keyRight == 1 ? '取消授权' : '授权'}];
|
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结", state.itemData.value.keyRight == 1 ? '取消授权' : '授权'];
|
||||||
} else if(state.keyType.value == 4){
|
} else if(state.keyType.value == 4){
|
||||||
textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}];
|
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"];
|
||||||
}
|
}
|
||||||
JhPopMenus.showLinePop(Get.context!, clickCallback: (index, selText) {
|
showModalBottomSheet(
|
||||||
print('选中index: $index');
|
context: context,
|
||||||
print('选中text: $selText');
|
shape: RoundedRectangleBorder(
|
||||||
if(index == 0){
|
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||||
if(state.itemData.value.keyStatus == 110405){
|
builder: (BuildContext context) {
|
||||||
// 取消冻结
|
return AlertBottomWidget(
|
||||||
cancelFreeze();
|
topTitle: '',
|
||||||
}else{
|
items: textList,
|
||||||
freezeKey();
|
chooseCallback: (value) {
|
||||||
}
|
int index = value;
|
||||||
}else{
|
if(index == 0){
|
||||||
// 取消/授权管理员
|
if(state.itemData.value.keyStatus == 110405){
|
||||||
if(state.itemData.value.keyRight == 1){
|
// 取消冻结
|
||||||
// 管理员
|
if(state.itemData.value.keyRight == 1){
|
||||||
cancelAdministrator();
|
// 管理员
|
||||||
}else{
|
print("管理员 调用取消冻结");
|
||||||
setAdministrator();
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||||
}
|
cancelFreeze(isAllData ? 1 : 0);
|
||||||
}
|
});
|
||||||
}, listData: textList);
|
}else{
|
||||||
|
print("普通用户 调用取消冻结");
|
||||||
|
ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效", (){
|
||||||
|
cancelFreeze(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(state.itemData.value.keyRight == 1){
|
||||||
|
// 管理员
|
||||||
|
print("管理员 调用冻结");
|
||||||
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||||
|
freezeKey(isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
print("普通用户 调用冻结");
|
||||||
|
ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效", (){
|
||||||
|
freezeKey(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 取消/授权管理员
|
||||||
|
if(state.itemData.value.keyRight == 1){
|
||||||
|
// 管理员
|
||||||
|
print("管理员 调用取消授权管理员接口");
|
||||||
|
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效", (){
|
||||||
|
cancelAdministrator();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
print("普通用户 调用授权管理员接口");
|
||||||
|
ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码", (){
|
||||||
|
setAdministrator();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// showPopMenus(BuildContext context){
|
||||||
|
// var textList = [];
|
||||||
|
// // keyType // 永久:1;限时2,单次3,循环:4
|
||||||
|
// // itemData.keyRight == 1 // 1:管理员 2:普通用户
|
||||||
|
// // indexEntity.keyStatus! 110405:已冻结 110412:已过期 110408:已删除 110410:已重置
|
||||||
|
// if(state.keyType.value == 1 || state.keyType.value == 2){
|
||||||
|
// textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}, {'text': state.itemData.value.keyRight == 1 ? '取消授权' : '授权'}];
|
||||||
|
// } else if(state.keyType.value == 4){
|
||||||
|
// textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}];
|
||||||
|
// }
|
||||||
|
// JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||||
|
// print('选中index: $index');
|
||||||
|
// print('选中text: $selText');
|
||||||
|
// Navigator.pop(context, true);
|
||||||
|
// Future.delayed(const Duration(seconds: 1));
|
||||||
|
//
|
||||||
|
// if(index == 0){
|
||||||
|
// if(state.itemData.value.keyStatus == 110405){
|
||||||
|
// // 取消冻结
|
||||||
|
// if(state.itemData.value.keyRight == 1){
|
||||||
|
// // 管理员
|
||||||
|
// print("管理员 调用取消冻结");
|
||||||
|
// ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||||
|
// cancelFreeze();
|
||||||
|
// });
|
||||||
|
// }else{
|
||||||
|
// print("普通用户 调用取消冻结");
|
||||||
|
// ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效", (){
|
||||||
|
// cancelFreeze();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// if(state.itemData.value.keyRight == 1){
|
||||||
|
// // 管理员
|
||||||
|
// print("管理员 调用冻结");
|
||||||
|
// // ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||||
|
// // freezeKey();
|
||||||
|
// // });
|
||||||
|
// // showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||||
|
// // freezeKey();
|
||||||
|
// // });
|
||||||
|
// showToast("fasdfasdfasdf");
|
||||||
|
// }else{
|
||||||
|
// print("普通用户 调用冻结");
|
||||||
|
// ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效", (){
|
||||||
|
// freezeKey();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// // 取消/授权管理员
|
||||||
|
// if(state.itemData.value.keyRight == 1){
|
||||||
|
// // 管理员
|
||||||
|
// print("管理员 调用取消授权管理员接口");
|
||||||
|
// ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效", (){
|
||||||
|
// cancelAdministrator();
|
||||||
|
// });
|
||||||
|
// }else{
|
||||||
|
// print("普通用户 调用授权管理员接口");
|
||||||
|
// ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码", (){
|
||||||
|
// setAdministrator();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }, listData: textList);
|
||||||
|
// }
|
||||||
|
|
||||||
deletKeyLogic(){
|
deletKeyLogic(){
|
||||||
if(state.itemData.value.keyRight == 1){
|
if(state.itemData.value.keyRight == 1){
|
||||||
// 授权管理员
|
// 授权管理员
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||||
deleteKeyRequest(isAllData ? 1 : 0);
|
deleteKeyRequest(isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
// 普通用户
|
// 普通用户
|
||||||
ShowTipView().showDeleteKeyDataDialogDialog((){
|
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效",(){
|
||||||
deleteKeyRequest(0);
|
deleteKeyRequest(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,9 +41,9 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
height: 30.h,
|
height: 30.h,
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
onPressed: state.keyType.value != 3 ? () {
|
onPressed: () {
|
||||||
logic.showPopMenus();
|
logic.openModalBottomSheet(context);
|
||||||
} : null,
|
},
|
||||||
),
|
),
|
||||||
]:null,
|
]:null,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
@ -384,7 +384,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
logic.updateKeyDateRequest();
|
logic.updateKeyDateRequest(2);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -399,7 +399,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value;
|
state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value;
|
||||||
logic.updateKeyDateRequest();
|
logic.updateKeyDateRequest(1);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -69,12 +69,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
|||||||
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
|
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
|
||||||
if(electronicKeyListItem.keyRight == 1){
|
if(electronicKeyListItem.keyRight == 1){
|
||||||
// 授权管理员
|
// 授权管理员
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||||
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
|
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
// 普通用户
|
// 普通用户
|
||||||
ShowTipView().showDeleteKeyDataDialogDialog((){
|
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效",(){
|
||||||
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
|
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import '../../../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import '../../../../../network/api_repository.dart';
|
import '../../../../../network/api_repository.dart';
|
||||||
import '../../../../../tools/dateTool.dart';
|
import '../../../../../tools/dateTool.dart';
|
||||||
import '../massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
import '../massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||||
@ -14,37 +15,117 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
|
|||||||
if (int.parse(state.type.value) != 1) {
|
if (int.parse(state.type.value) != 1) {
|
||||||
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.canSendKey(getFailureDateTime, state.lockIdList);
|
if(state.lockIdList.isEmpty){
|
||||||
|
showToast("请选择锁");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(state.receiverList.isEmpty){
|
||||||
|
showToast("请选择接收者");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.canSendKey(
|
||||||
|
getFailureDateTime,
|
||||||
|
state.lockIdList
|
||||||
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
for (int i = 0; i < state.receiverList.length; i++) {
|
for (int i = 0; i < state.receiverList.length; i++) {
|
||||||
LockUserData data = state.receiverList[i];
|
LockUserData data = state.receiverList[i];
|
||||||
batchSendElectronicKeyRequest(data.userid ?? '');
|
batchSendElectronicKeyRequest(data.userid ?? '', data.nickname ?? '');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showToast("检查失败");
|
showToast(entity.errorMsg!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//批处理群发钥匙
|
//批处理群发钥匙
|
||||||
Future<void> batchSendElectronicKeyRequest(String receiverUserID) async {
|
Future<void> batchSendElectronicKeyRequest(String receiverUserID, String receiverUserName) async {
|
||||||
String getFailureDateTime = '0';
|
//发送钥匙请求
|
||||||
String getEffectiveDateTime = '0';
|
var startDate = "0";
|
||||||
if (state.type.value == '0') {
|
var endDate = "0";
|
||||||
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
var startTime = "0";
|
||||||
getEffectiveDateTime = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
var endTime = "0";
|
||||||
|
int typeValue = int.parse(state.type.value);
|
||||||
|
switch (typeValue) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
typeValue = XSConstantMacro.keyTypeTime;
|
||||||
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
|
showToast("请选择开始时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (endDate.isEmpty) {
|
||||||
|
showToast("请选择结束时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(DateTime.now().millisecondsSinceEpoch > int.parse(state.beginTimeTimestamp.value)){
|
||||||
|
// Toast.show(msg: "生效时间要大于当前时间");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
|
showToast("失效时间要大于生效时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
typeValue = XSConstantMacro.keyTypeLong;
|
||||||
|
break;
|
||||||
|
// case 2:
|
||||||
|
// typeValue = XSConstantMacro.keyTypeOnce;
|
||||||
|
// break;
|
||||||
|
case 3:
|
||||||
|
typeValue = XSConstantMacro.keyTypeLoop;
|
||||||
|
if (state.beginTime.value.isEmpty) {
|
||||||
|
showToast("请选择有效期");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
typeValue = XSConstantMacro.keyTypeTime;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
// String getKeyType = typeValue.toString();
|
||||||
|
|
||||||
var entity = await ApiRepository.to.batchSendKey(
|
var entity = await ApiRepository.to.batchSendKey(
|
||||||
endDate:getFailureDateTime,
|
lockIds: state.lockIdList,
|
||||||
keyGroupIdList:[],
|
createUser: state.isCreateUser.value == true ? 1 : 0,
|
||||||
lockIdList:state.lockIdList,
|
countryCode: state.countryCode.value,
|
||||||
createUser:state.isCreateUser.value == true ? '1' : '0',
|
receiverUsername: receiverUserID,
|
||||||
isRemoteUnlock:state.isRemoteUnlock.value ? '1' : '2',
|
keyName: receiverUserName,
|
||||||
keyNameForAdmin:receiverUserID,
|
keyType: typeValue,
|
||||||
receiverUsername:receiverUserID,
|
weekDays: state.weekdaysList,
|
||||||
startDate:getEffectiveDateTime,
|
startDate: int.parse(startDate),
|
||||||
countryCode:state.countryCode.value,
|
endDate: int.parse(endDate),
|
||||||
usernameType:'1',
|
startTime: int.parse(startTime),
|
||||||
weekDays:state.weekdaysList);
|
endTime: int.parse(endTime),
|
||||||
|
remoteUnlockSwitch: state.isRemoteUnlock.value ? 1 : 2,
|
||||||
|
keyRight: 0
|
||||||
|
);
|
||||||
|
|
||||||
|
// var entity = await ApiRepository.to.batchSendKey(
|
||||||
|
// endDate:getFailureDateTime,
|
||||||
|
// keyGroupIdList:[],
|
||||||
|
// lockIdList:state.lockIdList,
|
||||||
|
// createUser:state.isCreateUser.value == true ? '1' : '0',
|
||||||
|
// isRemoteUnlock:state.isRemoteUnlock.value ? '1' : '2',
|
||||||
|
// keyNameForAdmin:receiverUserID,
|
||||||
|
// receiverUsername:receiverUserID,
|
||||||
|
// startDate:getEffectiveDateTime,
|
||||||
|
// countryCode:state.countryCode.value,
|
||||||
|
// usernameType:'1',
|
||||||
|
// weekDays:state.weekdaysList);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('群发电子钥匙成功');
|
print('群发电子钥匙成功');
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
@ -54,7 +135,7 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
|
|||||||
if (entity.errorCode == 425) {
|
if (entity.errorCode == 425) {
|
||||||
//用户未注册
|
//用户未注册
|
||||||
state.isCreateUser.value = true;
|
state.isCreateUser.value = true;
|
||||||
batchSendElectronicKeyRequest(receiverUserID);
|
batchSendElectronicKeyRequest(receiverUserID, receiverUserName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,6 +115,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
} else {
|
} else {
|
||||||
if (entity.errorCode == 425) {
|
if (entity.errorCode == 425) {
|
||||||
//用户未注册
|
//用户未注册
|
||||||
|
state.isCreateUser.value = true;
|
||||||
if (isPhoneNumber(state.emailOrPhoneController.text) == true) {
|
if (isPhoneNumber(state.emailOrPhoneController.text) == true) {
|
||||||
_showPhoneDialog(Get.context, '${entity.errorMsg}');
|
_showPhoneDialog(Get.context, '${entity.errorMsg}');
|
||||||
} else {
|
} else {
|
||||||
@ -143,7 +144,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
context: widgetContext,
|
context: widgetContext,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'),
|
title: const Text('接收者号码未注册,请重新发送'),
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -151,25 +152,25 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
style: TextStyle(color: AppColors.mainColor),
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Get.back();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.select!.tr,
|
TranslationLoader.lanKeys!.sure!.tr,
|
||||||
style: TextStyle(color: AppColors.mainColor),
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
//选择国家代码
|
//选择国家代码
|
||||||
state.isCreateUser.value = true;
|
Get.back();
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
// var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
// if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
// result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
// state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
// state.countryName.value = result['countryName'];
|
||||||
}
|
// }
|
||||||
|
sendElectronicKeyRequest();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -192,7 +193,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
style: TextStyle(color: AppColors.mainColor),
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Get.back();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
@ -201,8 +202,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
style: TextStyle(color: AppColors.mainColor),
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
state.isCreateUser.value = true;
|
Get.back();
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
sendElectronicKeyRequest();
|
sendElectronicKeyRequest();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -202,7 +202,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isTipsImg: true,
|
isTipsImg: true,
|
||||||
tipsImgAction: () {
|
tipsImgAction: () {
|
||||||
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP或小程序开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||||
},
|
},
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
|
|||||||
@ -82,6 +82,7 @@ class FingerprintItemData {
|
|||||||
String? cardNumber;
|
String? cardNumber;
|
||||||
int? cardType;
|
int? cardType;
|
||||||
int? cardId;
|
int? cardId;
|
||||||
|
int? cardStatus;
|
||||||
|
|
||||||
int? faceId;
|
int? faceId;
|
||||||
String? faceName;
|
String? faceName;
|
||||||
@ -121,7 +122,8 @@ class FingerprintItemData {
|
|||||||
this.faceType,
|
this.faceType,
|
||||||
this.cyclicConfig,
|
this.cyclicConfig,
|
||||||
this.featureData,
|
this.featureData,
|
||||||
this.faceRight});
|
this.faceRight,
|
||||||
|
this.cardStatus});
|
||||||
|
|
||||||
FingerprintItemData.fromJson(Map<String, dynamic> json) {
|
FingerprintItemData.fromJson(Map<String, dynamic> json) {
|
||||||
fingerprintStatus = json['fingerprintStatus'];
|
fingerprintStatus = json['fingerprintStatus'];
|
||||||
@ -152,6 +154,7 @@ class FingerprintItemData {
|
|||||||
cyclicConfig = json['cyclicConfig'];
|
cyclicConfig = json['cyclicConfig'];
|
||||||
featureData = json['featureData'];
|
featureData = json['featureData'];
|
||||||
faceRight = json['faceRight'];
|
faceRight = json['faceRight'];
|
||||||
|
cardStatus = json['cardStatus'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -184,7 +187,7 @@ class FingerprintItemData {
|
|||||||
data['cyclicConfig'] = cyclicConfig;
|
data['cyclicConfig'] = cyclicConfig;
|
||||||
data['featureData'] = featureData;
|
data['featureData'] = featureData;
|
||||||
data['faceRight'] = faceRight;
|
data['faceRight'] = faceRight;
|
||||||
|
data['cardStatus'] = cardStatus;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -398,6 +398,21 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getKeyType(FingerprintItemData fingerprintItemData){
|
||||||
|
// fingerprintStatus 1:正常 2:失效
|
||||||
|
var keyTypeStr = "";//
|
||||||
|
// (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : ""
|
||||||
|
if(fingerprintItemData.fingerprintStatus == 1){
|
||||||
|
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
||||||
|
keyTypeStr = "未生效";
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(fingerprintItemData.fingerprintStatus == 2){
|
||||||
|
keyTypeStr = "已失效";
|
||||||
|
}
|
||||||
|
return keyTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
||||||
var keyDateTypeStr = "";// 永久:1;限时2,单次3,循环:4
|
var keyDateTypeStr = "";// 永久:1;限时2,单次3,循环:4
|
||||||
if(fingerprintItemData.fingerprintType! == 1){
|
if(fingerprintItemData.fingerprintType! == 1){
|
||||||
@ -405,7 +420,7 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
}else if(fingerprintItemData.fingerprintType! == 2){
|
}else if(fingerprintItemData.fingerprintType! == 2){
|
||||||
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
||||||
}else if(fingerprintItemData.fingerprintType! == 4){
|
}else if(fingerprintItemData.fingerprintType! == 4){
|
||||||
keyDateTypeStr = "循环";
|
keyDateTypeStr = "${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环";
|
||||||
}
|
}
|
||||||
return keyDateTypeStr;
|
return keyDateTypeStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,12 +146,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
child: _keyItem(
|
child: _keyItem(
|
||||||
'images/icon_fingerprint.png',
|
'images/icon_fingerprint.png',
|
||||||
fingerprintItemData.fingerprintName!,
|
fingerprintItemData.fingerprintName!,
|
||||||
(fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
logic.getKeyType(fingerprintItemData),
|
||||||
logic.getKeyDateType(fingerprintItemData),
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
// fingerprintItemData.fingerprintType! == 1
|
|
||||||
// ? "永久"
|
|
||||||
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
|
|
||||||
() async {
|
|
||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.fingerprintDetailPage,
|
Routers.fingerprintDetailPage,
|
||||||
arguments: {
|
arguments: {
|
||||||
@ -197,8 +193,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _keyItem(String lockTypeIcon, String lockTypeTitle, String ifInvalidation, String showTime,
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle, String ifInvalidation, String showTime, Function() action) {
|
||||||
Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@ -117,7 +117,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderOpenLock(
|
IoSenderManage.senderOpenLock(
|
||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
openMode: 1,
|
openMode: state.openDoorModel,
|
||||||
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
onlineToken: state.lockNetToken,
|
onlineToken: state.lockNetToken,
|
||||||
token: tokenData,
|
token: tokenData,
|
||||||
@ -323,12 +323,12 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.lockUserNo = reply.data[47];
|
state.lockUserNo = reply.data[47];
|
||||||
_updateLockUserNo();
|
_updateLockUserNo();
|
||||||
|
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
// if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
openDoorAction(1);
|
// openDoorAction(1);
|
||||||
} else {
|
// } else {
|
||||||
getLockNetToken();
|
// getLockNetToken();
|
||||||
}
|
// }
|
||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
// eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
// clickPushBtnAction();
|
// clickPushBtnAction();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
@ -428,7 +428,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 点击开门事件
|
// 点击开门事件
|
||||||
Future<void> openDoorAction(int openMode) async {
|
Future<void> openDoorAction() async {
|
||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
state.openLockBtnState.value = 0;
|
state.openLockBtnState.value = 0;
|
||||||
BlueManage().stopScan();
|
BlueManage().stopScan();
|
||||||
@ -456,7 +456,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// privateKey: getPrivateKeyList,
|
// privateKey: getPrivateKeyList,
|
||||||
// );
|
// );
|
||||||
|
|
||||||
Get.log("openMode:$openMode");
|
Get.log("openMode:${state.openDoorModel}");
|
||||||
BlueManage()
|
BlueManage()
|
||||||
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
@ -464,7 +464,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderOpenLock(
|
IoSenderManage.senderOpenLock(
|
||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
openMode: openMode,
|
openMode: state.openDoorModel,
|
||||||
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
onlineToken: state.lockNetToken,
|
onlineToken: state.lockNetToken,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
@ -647,7 +647,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockNetToken = entity.data!.token!;
|
state.lockNetToken = entity.data!.token!;
|
||||||
Get.log("state.lockNetToken:${state.lockNetToken}");
|
Get.log("state.lockNetToken:${state.lockNetToken}");
|
||||||
openDoorAction(1);
|
openDoorAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,11 +657,15 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
keyId: state.keyInfos.value.keyId.toString(),
|
keyId: state.keyInfos.value.keyId.toString(),
|
||||||
lockUserNo: state.lockUserNo.toString());
|
lockUserNo: state.lockUserNo.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
// state.keyInfos.value.lockUserNo = state.lockUserNo;
|
||||||
state.bottomBtnisEable.value = true;
|
// state.bottomBtnisEable.value = true;
|
||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
// print("state.bottomBtnisEable.value:${state.bottomBtnisEable.value} state.keyInfos.value.lockUserNo:${state.keyInfos.value.lockUserNo}");
|
||||||
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
openDoorAction(1);
|
});
|
||||||
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
|
openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
getLockNetToken();
|
getLockNetToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,16 +71,12 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
|
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
|
||||||
void _initRefreshLockDetailInfoDataEventAction() {
|
void _initRefreshLockDetailInfoDataEventAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_lockRefreshLockDetailInfoDataEvent =
|
_lockRefreshLockDetailInfoDataEvent = eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
||||||
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadData() {
|
void loadData() {
|
||||||
// print("widget.lockListInfoItemEntity.lockUserNo:${widget.lockListInfoItemEntity.lockUserNo}");
|
|
||||||
// print("state.lockUserNo:${state.lockUserNo}");
|
|
||||||
|
|
||||||
state.keyInfos.value = widget.lockListInfoItemEntity;
|
state.keyInfos.value = widget.lockListInfoItemEntity;
|
||||||
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
||||||
if (state.lockUserNo == 0) {
|
if (state.lockUserNo == 0) {
|
||||||
@ -146,10 +142,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
visible:
|
visible:
|
||||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 0到30天
|
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 0到30天
|
||||||
(state.keyInfos.value.keyStatus ==
|
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
||||||
XSConstantMacro.keyStatusNormalUse ||
|
|
||||||
state.keyInfos.value.keyStatus ==
|
|
||||||
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
|
||||||
)
|
)
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
@ -188,7 +181,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
controller: state.pageController,
|
controller: state.pageController,
|
||||||
// child: Row(
|
// child: Row(
|
||||||
children: [
|
children: [
|
||||||
bottomWidget(),
|
Obx(() => bottomWidget()),
|
||||||
attachmentWidget(),
|
attachmentWidget(),
|
||||||
],
|
],
|
||||||
// ),
|
// ),
|
||||||
@ -272,16 +265,11 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(showElectricIcon(state.electricQuantity.value),
|
Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w),
|
||||||
width: 30.w, height: 24.w),
|
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("--%",
|
Text("--%", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.sp,
|
|
||||||
color: AppColors.darkGrayTextColor)),
|
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Icon(
|
Icon(Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
|
||||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||||
size: 25.w, // 设置图标大小为 30
|
size: 25.w, // 设置图标大小为 30
|
||||||
),
|
),
|
||||||
@ -578,8 +566,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_set.png',
|
'images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr,
|
TranslationLoader.lanKeys!.set!.tr,
|
||||||
state.openDoorBtnisUneable.value,
|
true,
|
||||||
state.bottomBtnisEable.value, () {
|
true, () {
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
"isOnlyOneData": state.isOnlyOneData
|
"isOnlyOneData": state.isOnlyOneData
|
||||||
@ -752,8 +740,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_main_set.png',
|
'images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr,
|
TranslationLoader.lanKeys!.set!.tr,
|
||||||
state.openDoorBtnisUneable.value,
|
true,
|
||||||
state.bottomBtnisEable.value, () {
|
true, () {
|
||||||
// logic.clickItemBtnAction(10);
|
// logic.clickItemBtnAction(10);
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
@ -766,8 +754,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable,
|
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, bool bottomBtnisEable, Function() onClick) {
|
||||||
bool bottomBtnisEable, Function() onClick) {
|
|
||||||
var width = 42.w;
|
var width = 42.w;
|
||||||
var height = 42.h;
|
var height = 42.h;
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@ -949,7 +936,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
// print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
logic.openDoorAction(1);
|
print("开锁开锁开锁开锁开锁开锁开锁开锁");
|
||||||
|
state.openDoorModel = 1;
|
||||||
|
logic.openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
// 需要联网
|
// 需要联网
|
||||||
logic.getLockNetToken();
|
logic.getLockNetToken();
|
||||||
@ -971,7 +960,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// 电子钥匙lockUserNo为0 要先添加用户
|
// 电子钥匙lockUserNo为0 要先添加用户
|
||||||
logic.addUserConnectBlue();
|
logic.addUserConnectBlue();
|
||||||
} else {
|
} else {
|
||||||
logic.openDoorAction(32);
|
print("闭锁闭锁闭锁闭锁闭锁闭锁闭锁闭锁");
|
||||||
|
state.openDoorModel = 32;
|
||||||
|
logic.openDoorAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class LockDetailState {
|
|||||||
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||||
|
|
||||||
String lockNetToken = "";
|
String lockNetToken = "";
|
||||||
var lockUserNo = 0;
|
int lockUserNo = 0;
|
||||||
var senderUserId = 0;
|
var senderUserId = 0;
|
||||||
var isOnlyOneData = false;
|
var isOnlyOneData = false;
|
||||||
|
|
||||||
@ -42,6 +42,8 @@ class LockDetailState {
|
|||||||
var bottomBtnisEable = true.obs; // 是否不可用 用于限制底部按钮是否可用
|
var bottomBtnisEable = true.obs; // 是否不可用 用于限制底部按钮是否可用
|
||||||
var openDoorBtnisUneable = true.obs; // 当钥匙状态不能使用的情况下开锁按钮禁止使用,默认可用
|
var openDoorBtnisUneable = true.obs; // 当钥匙状态不能使用的情况下开锁按钮禁止使用,默认可用
|
||||||
|
|
||||||
|
var openDoorModel = 0;
|
||||||
|
|
||||||
//过渡动画控制器
|
//过渡动画控制器
|
||||||
AnimationController? animationController;
|
AnimationController? animationController;
|
||||||
// var lockState = 0.obs;// 0未连接普通状态 1连接开锁中(展示动画) 2已连接开锁成功 3检测可用性 4连接失败 5连接失败重连中
|
// var lockState = 0.obs;// 0未连接普通状态 1连接开锁中(展示动画) 2已连接开锁成功 3检测可用性 4连接失败 5连接失败重连中
|
||||||
|
|||||||
@ -124,10 +124,10 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
|||||||
var pwdStr = utf8String(pwd);
|
var pwdStr = utf8String(pwd);
|
||||||
print("pwd:$pwd pwdStr:$pwdStr state.adminPwd.value:${state.adminPwd.value}");
|
print("pwd:$pwd pwdStr:$pwdStr state.adminPwd.value:${state.adminPwd.value}");
|
||||||
|
|
||||||
// if(pwdStr == state.adminPwd.value){
|
if(pwdStr == state.adminPwd.value){
|
||||||
// showToast("");
|
showToast("管理员密码相同,无需修改");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
state.adminPwd.value = pwdStr;
|
state.adminPwd.value = pwdStr;
|
||||||
addLockAdminPassword(false);
|
addLockAdminPassword(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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/tools/dateTool.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -71,7 +72,23 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
state.lockBasicInfo.value.endDate,
|
state.lockBasicInfo.value.endDate,
|
||||||
state.lockBasicInfo.value.keyType),
|
state.lockBasicInfo.value.keyType),
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
isHaveLine: false)),
|
isHaveLine: true)),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.lockBasicInfo.value.keyType == 4 ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日".tr,
|
||||||
|
rightTitle: state.lockBasicInfo.value!.weekDays!.join(",").toString(),
|
||||||
|
allHeight: 70.h,
|
||||||
|
isHaveLine: true),
|
||||||
|
)),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.lockBasicInfo.value.keyType == 4 ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle: "${DateTool().dateToHNString(state.lockBasicInfo.value.startDate.toString())}-${DateTool().dateToHNString(state.lockBasicInfo.value.endDate.toString())}",
|
||||||
|
allHeight: 70.h,
|
||||||
|
isHaveLine: true),
|
||||||
|
)),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
|
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
|
||||||
|
|||||||
@ -334,6 +334,7 @@ class LockBasicInfo {
|
|||||||
int? keyRight;
|
int? keyRight;
|
||||||
int? senderUserId;
|
int? senderUserId;
|
||||||
int? lockUserNo;
|
int? lockUserNo;
|
||||||
|
List? weekDays;
|
||||||
|
|
||||||
LockBasicInfo(
|
LockBasicInfo(
|
||||||
{this.lockId,
|
{this.lockId,
|
||||||
@ -355,7 +356,8 @@ class LockBasicInfo {
|
|||||||
this.mac,
|
this.mac,
|
||||||
this.keyRight,
|
this.keyRight,
|
||||||
this.senderUserId,
|
this.senderUserId,
|
||||||
this.lockUserNo});
|
this.lockUserNo,
|
||||||
|
this.weekDays});
|
||||||
|
|
||||||
LockBasicInfo.fromJson(Map<String, dynamic> json) {
|
LockBasicInfo.fromJson(Map<String, dynamic> json) {
|
||||||
lockId = json['lockId'];
|
lockId = json['lockId'];
|
||||||
@ -383,6 +385,7 @@ class LockBasicInfo {
|
|||||||
keyRight = json['keyRight'];
|
keyRight = json['keyRight'];
|
||||||
senderUserId = json['senderUserId'];
|
senderUserId = json['senderUserId'];
|
||||||
lockUserNo = json['lockUserNo'];
|
lockUserNo = json['lockUserNo'];
|
||||||
|
weekDays = json['weekDays'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -409,6 +412,7 @@ class LockBasicInfo {
|
|||||||
data['keyRight'] = keyRight;
|
data['keyRight'] = keyRight;
|
||||||
data['senderUserId'] = senderUserId;
|
data['senderUserId'] = senderUserId;
|
||||||
data['lockUserNo'] = lockUserNo;
|
data['lockUserNo'] = lockUserNo;
|
||||||
|
data['weekDays'] = weekDays;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 清空码';
|
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} 清空码';
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
|
|||||||
@ -184,8 +184,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) {
|
||||||
String lockTypeTitle, String useDateStr, Function()? action) {
|
|
||||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_tabbar.dart';
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class PasswordKeyManagePage extends StatefulWidget {
|
class PasswordKeyManagePage extends StatefulWidget {
|
||||||
const PasswordKeyManagePage({Key? key}) : super(key: key);
|
const PasswordKeyManagePage({Key? key}) : super(key: key);
|
||||||
@ -1,13 +1,12 @@
|
|||||||
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/tools/eventBusEventManage.dart';
|
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../passwordKey_perpetual_page.dart';
|
||||||
import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart';
|
|
||||||
|
|
||||||
class PasswordKeyManageTabbarPage extends StatefulWidget {
|
class PasswordKeyManageTabbarPage extends StatefulWidget {
|
||||||
var initialIndex = 1;
|
var initialIndex = 1;
|
||||||
@ -448,6 +448,11 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) {
|
||||||
|
logic.showToast("请输入6-9位数字密码");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logic.senderCustomPasswords();
|
logic.senderCustomPasswords();
|
||||||
} else {
|
} else {
|
||||||
if (state.nameController.text.isEmpty) {
|
if (state.nameController.text.isEmpty) {
|
||||||
|
|||||||
@ -99,14 +99,29 @@ class _LockListPageState extends State<LockListPage> {
|
|||||||
}
|
}
|
||||||
// print("lockItemList.length:${lockItemList.length} == ${index+1} $isLast");
|
// print("lockItemList.length:${lockItemList.length} == ${index+1} $isLast");
|
||||||
return lockInfoListItem(keyInfo, isLast, () {
|
return lockInfoListItem(keyInfo, isLast, () {
|
||||||
if(DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime){
|
// if(DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime){
|
||||||
logic.showToast("钥匙已过期");
|
// logic.showToast("钥匙已过期");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// var lockCount = 0;
|
// var lockCount = 0;
|
||||||
// for(GroupList itemData in groupDataList){
|
// for(GroupList itemData in groupDataList){
|
||||||
// lockCount+=itemData.lockList!.length;
|
// lockCount+=itemData.lockList!.length;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired
|
||||||
|
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)){
|
||||||
|
logic.showToast("您的钥匙未生效");
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)){
|
||||||
|
logic.showToast("您的钥匙已冻结");
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)){
|
||||||
|
logic.showToast("您的钥匙已过期");
|
||||||
|
// return;
|
||||||
|
}
|
||||||
Get.toNamed(Routers.lockDetailMainPage, arguments: {
|
Get.toNamed(Routers.lockDetailMainPage, arguments: {
|
||||||
// "lockMainEntity": widget.lockMainEntity,
|
// "lockMainEntity": widget.lockMainEntity,
|
||||||
"keyInfo": keyInfo,
|
"keyInfo": keyInfo,
|
||||||
@ -124,7 +139,9 @@ class _LockListPageState extends State<LockListPage> {
|
|||||||
// height: 122.h,
|
// height: 122.h,
|
||||||
margin: isLast ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
margin: isLast ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: (DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime) ? AppColors.greyBackgroundColor : Colors.white,
|
color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired))
|
||||||
|
? AppColors.greyBackgroundColor : Colors.white,
|
||||||
borderRadius: BorderRadius.circular(20.w),
|
borderRadius: BorderRadius.circular(20.w),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -194,7 +211,11 @@ class _LockListPageState extends State<LockListPage> {
|
|||||||
)),
|
)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) >= 0)) ? true : false,
|
visible: (
|
||||||
|
(keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired))
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
// visible: true,
|
// visible: true,
|
||||||
child:Row(
|
child:Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -47,6 +47,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
||||||
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -235,8 +236,10 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
|
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
|
print("监听刷新首页数据消息");
|
||||||
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
|
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
|
||||||
// getLockInfo();
|
// getLockInfo();
|
||||||
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
print("收到刷新首页数据消息");
|
print("收到刷新首页数据消息");
|
||||||
});
|
});
|
||||||
|
|||||||
@ -15,10 +15,17 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
void onReady() {
|
||||||
print("ready home");
|
print("ready home");
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onInit() async {
|
||||||
|
print("init home");
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
final data = await Storage.getString(saveUserLoginData);
|
final data = await Storage.getString(saveUserLoginData);
|
||||||
if (data != null && data.isNotEmpty) {
|
if (data != null && data.isNotEmpty) {
|
||||||
state.userNickName.value = (await Storage.getNickname())!;
|
state.userNickName.value = (await Storage.getNickname())!;
|
||||||
@ -27,12 +34,6 @@ class StarLockMineLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
print("init home");
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
print("close home");
|
print("close home");
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
Text(state.userNickName.value ?? "-",
|
Text(state.userNickName.value.isNotEmpty ? state.userNickName.value : (state.userMobile.value.isNotEmpty ? state.userMobile.value : state.userEmail.value),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
import 'addAuthorizedAdministratorManage_tabbar.dart';
|
||||||
|
|
||||||
|
class AddAuthorizedAdministratorManagePage extends StatefulWidget {
|
||||||
|
const AddAuthorizedAdministratorManagePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddAuthorizedAdministratorManagePage> createState() => _AddAuthorizedAdministratorManagePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddAuthorizedAdministratorManagePageState extends State<AddAuthorizedAdministratorManagePage> {
|
||||||
|
var index = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
AddAuthorizedAdministratorManageTabbar(
|
||||||
|
initialIndex: index,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/CustomUnderlineTabIndicator.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
import '../addAuthorizedAdministrator_page.dart';
|
||||||
|
|
||||||
|
class AddAuthorizedAdministratorManageTabbar extends StatefulWidget {
|
||||||
|
var initialIndex = 1;
|
||||||
|
|
||||||
|
AddAuthorizedAdministratorManageTabbar({Key? key, required this.initialIndex}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddAuthorizedAdministratorManageTabbar> createState() => _AddAuthorizedAdministratorManageTabbarState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddAuthorizedAdministratorManageTabbarState extends State<AddAuthorizedAdministratorManageTabbar> with SingleTickerProviderStateMixin {
|
||||||
|
late TabController _tabController;
|
||||||
|
|
||||||
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"),
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(
|
||||||
|
vsync: this,
|
||||||
|
length: _itemTabs.length,
|
||||||
|
initialIndex: widget.initialIndex);
|
||||||
|
|
||||||
|
_tabController.addListener(() {
|
||||||
|
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
||||||
|
if (_tabController.animation!.value==_tabController.index){
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_tabBar(),
|
||||||
|
_pageWidget(),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
TabBar _tabBar() {
|
||||||
|
return TabBar(
|
||||||
|
controller: _tabController,
|
||||||
|
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||||
|
onTap: (index){
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
},
|
||||||
|
isScrollable: true,
|
||||||
|
indicatorColor: Colors.red,
|
||||||
|
unselectedLabelColor: Colors.black,
|
||||||
|
unselectedLabelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
),
|
||||||
|
automaticIndicatorColorAdjustment: true,
|
||||||
|
labelColor: AppColors.mainColor,
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
indicator: CustomUnderlineTabIndicator(
|
||||||
|
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||||
|
strokeCap: StrokeCap.round,
|
||||||
|
width: 30.w),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tab _tab(ItemView item) {
|
||||||
|
return Tab(
|
||||||
|
// text: item.title,
|
||||||
|
child: Container(
|
||||||
|
width: 1.sw / 4,
|
||||||
|
margin: EdgeInsets.all(10.w),
|
||||||
|
// color: Colors.red,
|
||||||
|
child: Text(
|
||||||
|
item.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _pageWidget() {
|
||||||
|
return Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
children: _itemTabs
|
||||||
|
.map((ItemView item) => AddAuthorizedAdministratorPage(
|
||||||
|
type: item.type,
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemView {
|
||||||
|
const ItemView({required this.title, required this.type});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String type;
|
||||||
|
}
|
||||||
@ -5,6 +5,8 @@ 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/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import 'addAuthorizedAdministrator_state.dart';
|
import 'addAuthorizedAdministrator_state.dart';
|
||||||
|
|
||||||
class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
||||||
@ -12,107 +14,97 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//发送批量授权管理员
|
//发送批量授权管理员
|
||||||
Future<void> addAuthorizedAdminRequest() async {
|
Future<void> addAuthorizedAdminRequest() async {
|
||||||
String getFailureDateTime = '0';
|
if (state.emailOrPhoneController.text.isEmpty) {
|
||||||
String getEffectiveDateTime = '0';
|
showToast("请输入接收者账号");
|
||||||
if (state.tabController!.index == 1) {
|
return;
|
||||||
getFailureDateTime =
|
}
|
||||||
state.failureDate.value.millisecondsSinceEpoch.toString();
|
if (state.keyNameController.text.isEmpty) {
|
||||||
getEffectiveDateTime =
|
showToast("请输入接收者姓名");
|
||||||
state.effectiveDate.value.millisecondsSinceEpoch.toString();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(state.lockIdList.isEmpty){
|
||||||
|
showToast("请选择锁");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var startDate = "0";
|
||||||
|
var endDate = "0";
|
||||||
|
Get.log("state.type.value:${state.type.value}");
|
||||||
|
if (state.type.value == '0') {
|
||||||
|
startDate = DateTool().dateToTimestamp(state.beginDate.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endDate.value, 1).toString();
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
|
showToast("请选择开始时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (endDate.isEmpty) {
|
||||||
|
showToast("请选择结束时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
|
showToast("失效时间要大于生效时间");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||||
state.isCreateUser.value ? "1" : "0",
|
createUser: state.isCreateUser.value ? "1" : "0",
|
||||||
getFailureDateTime,
|
endDate: endDate,
|
||||||
state.isRemoteUnlock.value == true ? '1' : '2',
|
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||||
[],
|
keyGroupIdList: [],
|
||||||
state.lockIdList,
|
lockIdList: state.lockIdList,
|
||||||
state.keyNameController.text,
|
name: state.keyNameController.text,
|
||||||
getEffectiveDateTime,
|
startDate: startDate,
|
||||||
state.emailOrPhoneController.text,
|
userid: state.emailOrPhoneController.text,
|
||||||
state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
'1',
|
usernameType:'1',
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
|
state.isCreateUser.value = false;
|
||||||
|
// Toast.show(msg: "添加成功");
|
||||||
|
|
||||||
|
eventBus.fire(AuthorizedAdministratorListPageRefreshUI());
|
||||||
} else {
|
} else {
|
||||||
showToast("${entity.errorMsg}");
|
// showToast("${entity.errorMsg}");
|
||||||
if (entity.errorCode == 425) {
|
if (entity.errorCode == 425) {
|
||||||
//用户未注册
|
//用户未注册
|
||||||
state.isCreateUser.value = true;
|
state.isCreateUser.value = true;
|
||||||
addAuthorizedAdminRequest();
|
_showDialog("${entity.errorMsg}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //发送钥匙请求
|
|
||||||
// Future<void> sendElectronicKeyRequest(BuildContext widgetContext) async {
|
|
||||||
// String lockID = state.keyInfo.value.lockId.toString();
|
|
||||||
// String getKeyType = (int.parse(state.type.value) + 1).toString();
|
|
||||||
// if (state.type.value == '0') {
|
|
||||||
// // getFailureDateTime =
|
|
||||||
// // state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
|
||||||
// // getEffectiveDateTime =
|
|
||||||
// // state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var entity = await ApiRepository.to.sendElectronicKey(
|
|
||||||
// createUser: state.isCreateUser.value ? "1" : "0",
|
|
||||||
// countryCode: state.countryCode.value,
|
|
||||||
// usernameType: '1',
|
|
||||||
// endDate: state.failureDateTime.value.millisecondsSinceEpoch,
|
|
||||||
// faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
|
||||||
// isCameraEnable: '2',
|
|
||||||
// isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
|
||||||
// keyNameForAdmin: state.keyNameController.text,
|
|
||||||
// keyRight: '0',
|
|
||||||
// keyType: getKeyType,
|
|
||||||
// lockId: lockID,
|
|
||||||
// operatorUid: '',
|
|
||||||
// receiverUsername: state.emailOrPhoneController.text,
|
|
||||||
// remarks: '',
|
|
||||||
// startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
|
|
||||||
// weekDays: state.weekdaysList,
|
|
||||||
// startTime: state.st.value,
|
|
||||||
// endTime: state.endTime.value);
|
|
||||||
// if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
// print('发送电子钥匙成功');
|
|
||||||
// state.isSendSuccess.value = true;
|
|
||||||
// } else {
|
|
||||||
// if (entity.errorCode == 425) {
|
|
||||||
// //用户未注册
|
|
||||||
// _showDialog(widgetContext, '${entity.errorMsg}');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//用户未注册确认弹窗
|
//用户未注册确认弹窗
|
||||||
void _showDialog(widgetContext, String errMsg) {
|
void _showDialog(String errMsg) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: widgetContext,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'),
|
title: const Text('接收者号码未注册,请重新发送'),
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Get.back();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.select!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
//选择国家代码
|
//选择国家代码
|
||||||
state.isCreateUser.value = true;
|
Get.back();
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
// var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
// if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
// result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
// state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
// state.countryName.value = result['countryName'];
|
||||||
}
|
// }
|
||||||
|
addAuthorizedAdminRequest();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -7,16 +7,19 @@ import 'package:get/get.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/tools/commonItem.dart';
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/tools/dateUtils.dart';
|
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.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';
|
||||||
|
|
||||||
|
import '../../../../tools/NativeInteractionTool.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
import 'addAuthorizedAdministrator_logic.dart';
|
import 'addAuthorizedAdministrator_logic.dart';
|
||||||
|
|
||||||
class AddAuthorizedAdministratorPage extends StatefulWidget {
|
class AddAuthorizedAdministratorPage extends StatefulWidget {
|
||||||
const AddAuthorizedAdministratorPage({Key? key}) : super(key: key);
|
String type;
|
||||||
|
|
||||||
|
AddAuthorizedAdministratorPage({Key? key, required this.type}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
@ -28,71 +31,16 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
final logic = Get.put(AddAuthorizedAdministratorLogic());
|
final logic = Get.put(AddAuthorizedAdministratorLogic());
|
||||||
final state = Get.find<AddAuthorizedAdministratorLogic>().state;
|
final state = Get.find<AddAuthorizedAdministratorLogic>().state;
|
||||||
|
|
||||||
TabController? _tabController;
|
|
||||||
|
|
||||||
List tabs = [
|
|
||||||
TranslationLoader.lanKeys!.permanent!.tr,
|
|
||||||
TranslationLoader.lanKeys!.timeLimit!.tr
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_tabController = TabController(length: 2, vsync: this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultTabController(
|
state.type.value = widget.type;
|
||||||
length: 2,
|
return Obx(() => SingleChildScrollView(child: widget.type == '0' ? _timeLimitAdministrator() : _permanentAdministrator()));
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
backgroundColor: AppColors.mainColor,
|
|
||||||
title: Text(
|
|
||||||
TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 28.sp,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
leading: IconButton(
|
|
||||||
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
|
||||||
onPressed: () => Navigator.pop(context, true),
|
|
||||||
),
|
|
||||||
bottom: PreferredSize(
|
|
||||||
preferredSize: const Size.fromHeight(45),
|
|
||||||
child: Material(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Theme(
|
|
||||||
data: ThemeData(
|
|
||||||
///点击的背景高亮颜色,处理阴影
|
|
||||||
highlightColor: Colors.transparent,
|
|
||||||
|
|
||||||
///点击水波纹颜色
|
|
||||||
splashColor: Colors.transparent,
|
|
||||||
),
|
|
||||||
child: TabBar(
|
|
||||||
controller: _tabController,
|
|
||||||
indicatorSize: TabBarIndicatorSize.label,
|
|
||||||
indicatorColor: AppColors.mainColor,
|
|
||||||
unselectedLabelColor: AppColors.blackColor,
|
|
||||||
labelColor: AppColors.mainColor,
|
|
||||||
// isScrollable: true,
|
|
||||||
tabs: tabs.map((e) => Tab(text: e)).toList()),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: TabBarView(controller: _tabController, children: [
|
|
||||||
SingleChildScrollView(
|
|
||||||
child: _permanentAdministrator(),
|
|
||||||
),
|
|
||||||
SingleChildScrollView(
|
|
||||||
child: _timeLimitAdministrator(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//永久
|
//永久
|
||||||
@ -102,9 +50,6 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
} else {
|
} else {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
@ -147,17 +92,10 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
} else {
|
} else {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
keyInfoWidget(),
|
keyInfoWidget(),
|
||||||
SizedBox(
|
SizedBox(height: 10.h),
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
keyTimeWidget(),
|
keyTimeWidget(),
|
||||||
SizedBox(
|
SizedBox(height: 10.h),
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: state.lockIdList.value.isEmpty
|
rightTitle: state.lockIdList.value.isEmpty
|
||||||
@ -193,7 +131,6 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
Widget keyInfoWidget() {
|
Widget keyInfoWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(height: 10.h),
|
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
@ -234,7 +171,6 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
false,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
state.keyNameController)),
|
state.keyNameController)),
|
||||||
Container(height: 10.h),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -328,38 +264,28 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.selectEffectiveDate.value,
|
rightTitle: state.beginDate.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||||
onConfirm: (p) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDate.value = XSDateUtils.parseDateTime(
|
state.beginDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
|
||||||
'yyyy-MM-dd HH:mm');
|
|
||||||
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.effectiveDate.value, 'yyyy-MM-dd HH:mm');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.selectFailureDate.value,
|
rightTitle: state.endDate.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.failureDate.value = XSDateUtils.parseDateTime(
|
state.endDate.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
|
||||||
'yyyy-MM-dd HH:mm');
|
|
||||||
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
|
||||||
state.failureDate.value, 'yyyy-MM-dd HH:mm');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -412,6 +338,27 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CupertinoSwitch _switch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.isRemoteUnlock.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSureBtn() {
|
||||||
|
return SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
|
onClick: () {
|
||||||
|
logic.addAuthorizedAdminRequest();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
// 发送电子钥匙成功
|
||||||
Widget sendElectronicKeySucceed() {
|
Widget sendElectronicKeySucceed() {
|
||||||
return Column(
|
return Column(
|
||||||
@ -461,9 +408,17 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
OutLineBtn(
|
OutLineBtn(
|
||||||
btnName: '邮件通知',
|
btnName:
|
||||||
|
state.emailOrPhoneController.text.contains("@") ? '邮件通知' : "短信通知",
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
if (state.emailOrPhoneController.text.contains("@")) {
|
||||||
|
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||||
|
} else {
|
||||||
|
// _openModalBottomSheet();
|
||||||
|
NativeInteractionTool().loadNativeShare(
|
||||||
|
shareText: state.pwdShareStr);
|
||||||
|
}
|
||||||
|
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -471,37 +426,96 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
|||||||
),
|
),
|
||||||
OutLineBtn(
|
OutLineBtn(
|
||||||
btnName: '微信通知',
|
btnName: '微信通知',
|
||||||
onClick: () {},
|
onClick: () {
|
||||||
|
// _openModalBottomSheet();
|
||||||
|
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
OutLineBtn(
|
// OutLineBtn(
|
||||||
btnName: '标记为已入住',
|
// btnName: '标记为:已入住',
|
||||||
onClick: () {},
|
// onClick: () {
|
||||||
),
|
// logic.updateRoomCheckIn();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CupertinoSwitch _switch() {
|
List<Widget> initBottomSheetList() {
|
||||||
return CupertinoSwitch(
|
List<Widget> widgetList = [];
|
||||||
activeColor: CupertinoColors.activeBlue,
|
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
||||||
thumbColor: CupertinoColors.white,
|
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
||||||
value: state.isRemoteUnlock.value,
|
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
|
||||||
onChanged: (value) {
|
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
|
||||||
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
|
||||||
},
|
return widgetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
GestureDetector buildCenter3(
|
||||||
|
String imageName, String titleStr, int itemIndex) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
width: 120.w,
|
||||||
|
// height: 64.h,
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
imageName,
|
||||||
|
width: 50.w,
|
||||||
|
height: 50.h,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 16.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
titleStr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: ScreenUtil().setSp(20), color: Colors.black),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () => _jumpSmartDeviceRoute(itemIndex),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSureBtn() {
|
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
|
||||||
return SubmitBtn(
|
_jumpSmartDeviceRoute(int itemIndex) {
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
Get.back();
|
||||||
onClick: () {
|
switch (itemIndex) {
|
||||||
logic.addAuthorizedAdminRequest();
|
case 0:
|
||||||
},
|
//微信好友
|
||||||
);
|
{
|
||||||
|
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
//短信
|
||||||
|
{
|
||||||
|
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//邮件
|
||||||
|
{
|
||||||
|
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
//更多
|
||||||
|
{
|
||||||
|
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../../../main/lockMian/entity/lockListInfo_entity.dart';
|
import '../../../../main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
class AddAuthorizedAdministratorState {
|
class AddAuthorizedAdministratorState {
|
||||||
late TabController? tabController;
|
late TabController? tabController;
|
||||||
@ -17,16 +18,10 @@ class AddAuthorizedAdministratorState {
|
|||||||
var lockIdList = [].obs;
|
var lockIdList = [].obs;
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||||
var selectEffectiveDate =
|
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
var beginDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs; //默认为当前时间 开始时间
|
||||||
.obs; //默认为当前时间
|
var endDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
|
||||||
var selectFailureDate =
|
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
|
||||||
.obs; //默认为当前时间
|
|
||||||
final effectiveDate = DateTime.now().obs;
|
|
||||||
final failureDate = DateTime.now().obs;
|
|
||||||
var startTime = 0.obs;
|
|
||||||
var endTime = 0.obs;
|
|
||||||
var countryName = '中国'.obs;
|
var countryName = '中国'.obs;
|
||||||
var countryCode = '86'.obs;
|
var countryCode = '86'.obs;
|
||||||
var isSendSuccess = false.obs;
|
var isSendSuccess = false.obs;
|
||||||
@ -34,6 +29,7 @@ class AddAuthorizedAdministratorState {
|
|||||||
final isAuthentication = false.obs; //是否允许实名认证
|
final isAuthentication = false.obs; //是否允许实名认证
|
||||||
final keyInfo = LockListInfoItemEntity().obs;
|
final keyInfo = LockListInfoItemEntity().obs;
|
||||||
|
|
||||||
|
String pwdShareStr = '您好,您的授权管理员生成成功';
|
||||||
AddAuthorizedAdministratorState() {
|
AddAuthorizedAdministratorState() {
|
||||||
// Map map = Get.arguments;
|
// Map map = Get.arguments;
|
||||||
// if ((map["keyInfo"] != null)) {
|
// if ((map["keyInfo"] != null)) {
|
||||||
|
|||||||
@ -0,0 +1,188 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import '../../../../main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/custom_bottom_sheet.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
|
import '../../../../tools/jh_pop_menus.dart';
|
||||||
|
import '../../../../tools/showTipView.dart';
|
||||||
|
import '../authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
|
import 'administratorDetailEntity.dart';
|
||||||
|
import 'administratorDetails_state.dart';
|
||||||
|
|
||||||
|
class AdministratorDetailsLogic extends BaseGetXController{
|
||||||
|
AdministratorDetailsState state = AdministratorDetailsState();
|
||||||
|
|
||||||
|
|
||||||
|
//管理员详情请求
|
||||||
|
Future<void> administratorDetailRequest() async {
|
||||||
|
AdministratorDetailEntity entity = await ApiRepository.to.authorizedAdminDetail(state.itemData.value.uid ?? 0);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("管理员详情请求成功啦啦啦啦啦");
|
||||||
|
state.lockItemList.value = entity.data!.lockList!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新管理员信息请求
|
||||||
|
Future<void> updateAdministratorRequest(bool isRemote) async {
|
||||||
|
String isRemoteUnlock = state.isOnRemote.value == true ? '1' : '2';
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
||||||
|
state.itemData.value.uid.toString(),
|
||||||
|
state.changeNameController.text,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
isRemoteUnlock);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("修改管理员信息成功啦啦啦啦啦");
|
||||||
|
showToast("修改成功", something: (){
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
||||||
|
Future<void> deleteAdministratorRequest(int includeUnderlings) async {
|
||||||
|
AuthorizedAdminListEntity entity = await ApiRepository.to.deleteAuthorizedAdmin(
|
||||||
|
state.itemData.value.uid.toString(),
|
||||||
|
includeUnderlings.toString()
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("删除授权管理员成功");
|
||||||
|
showToast("删除成功", something: (){
|
||||||
|
// eventBus.fire(AuthorizedAdministratorListPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//冻结
|
||||||
|
Future<void> freezeKey(int includeUnderlings) async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
includeUnderlings: includeUnderlings
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("设置成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消冻结
|
||||||
|
Future<void> cancelFreeze(int includeUnderlings) async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
includeUnderlings: includeUnderlings
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("设置成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消授权管理员
|
||||||
|
Future<void> cancelAdministrator() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to.cancelAdministrator(
|
||||||
|
keyId:state.itemData.value.keyId.toString(),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("设置成功", something: () {
|
||||||
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future openModalBottomSheet() async {
|
||||||
|
var textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结", '取消授权'];
|
||||||
|
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: Get.context!,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertBottomWidget(
|
||||||
|
topTitle: '',
|
||||||
|
items: textList,
|
||||||
|
chooseCallback: (value) {
|
||||||
|
int index = value;
|
||||||
|
if(index == 0){
|
||||||
|
if(state.itemData.value.keyStatus == 110405){
|
||||||
|
// 取消冻结
|
||||||
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||||
|
cancelFreeze(isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||||
|
freezeKey(isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 取消/授权管理员
|
||||||
|
// 管理员
|
||||||
|
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效", (){
|
||||||
|
cancelAdministrator();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//使用期限
|
||||||
|
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||||
|
//限期
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||||
|
//永久
|
||||||
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
|
//单次
|
||||||
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||||
|
//循环
|
||||||
|
useDateStr = '循环';
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
administratorDetailRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,15 +1,8 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
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/common/XSConstantMacro/XSConstantMacro.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -18,6 +11,8 @@ import '../../../../../tools/showTFView.dart';
|
|||||||
import '../../../../../tools/submitBtn.dart';
|
import '../../../../../tools/submitBtn.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
import '../../../../tools/showTipView.dart';
|
||||||
|
import 'administratorDetails_logic.dart';
|
||||||
|
|
||||||
class AdministratorDetailsPage extends StatefulWidget {
|
class AdministratorDetailsPage extends StatefulWidget {
|
||||||
const AdministratorDetailsPage({Key? key}) : super(key: key);
|
const AdministratorDetailsPage({Key? key}) : super(key: key);
|
||||||
@ -28,11 +23,8 @@ class AdministratorDetailsPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||||
final TextEditingController _changeNameController = TextEditingController();
|
final logic = Get.put(AdministratorDetailsLogic());
|
||||||
AuthorizedAdminListItem itemData = AuthorizedAdminListItem();
|
final state = Get.find<AdministratorDetailsLogic>().state;
|
||||||
bool _isOnRemote = false;
|
|
||||||
List lockItemList = [];
|
|
||||||
bool _isFirst = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -41,15 +33,6 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_isFirst == true) {
|
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["itemData"] != null)) {
|
|
||||||
itemData = obj["itemData"];
|
|
||||||
}
|
|
||||||
administratorDetailRequest();
|
|
||||||
|
|
||||||
_isOnRemote = itemData.isRemoteUnlock == 1 ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
@ -65,25 +48,18 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
JhPopMenus.showLinePop(context,
|
logic.openModalBottomSheet();
|
||||||
clickCallback: (index, selText) {
|
|
||||||
print('选中index: $index');
|
|
||||||
print('选中text: $selText');
|
|
||||||
}, listData: [
|
|
||||||
{'text': '冻结'},
|
|
||||||
{'text': '取消授权'}
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Obx(()=>Column(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: _changeNameController.text.isNotEmpty
|
rightTitle: state.changeNameController.text.isNotEmpty
|
||||||
? _changeNameController.text
|
? state.changeNameController.text
|
||||||
: itemData.name,
|
: state.itemData.value.name,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -92,21 +68,21 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
allHeight: 90.h,
|
allHeight: 90.h,
|
||||||
rightTitle: getUseDateStr(itemData),
|
rightTitle: logic.getUseDateStr(state.itemData.value),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.adminDetailChangeDatePage,
|
Navigator.pushNamed(context, Routers.adminDetailChangeDatePage,
|
||||||
arguments: {"itemData": itemData});
|
arguments: {"itemData": state.itemData.value});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
leftTitel: TranslationLoader.lanKeys!.lock!.tr,
|
||||||
rightTitle: itemData.lockNum.toString(),
|
rightTitle: state.itemData.value.lockNum.toString(),
|
||||||
isHaveDirection: false,
|
isHaveDirection: false,
|
||||||
action: () {
|
action: () {
|
||||||
//锁列表页面
|
// //锁列表页面
|
||||||
// Navigator.pushNamed(context, Routers.lockItemListPage,
|
// Navigator.pushNamed(context, Routers.lockItemListPage,
|
||||||
// arguments: {'lockList': lockItemList});
|
// arguments: {'lockList': state.lockItemList});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -124,40 +100,15 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
deleteAdministratorRequest();
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||||
|
logic.deleteAdministratorRequest(isAllData ? 1 : 0);
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//使用期限
|
|
||||||
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
|
|
||||||
String useDateStr = '';
|
|
||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
|
||||||
//限期
|
|
||||||
DateTime startDateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
|
||||||
DateTime endDateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
|
||||||
useDateStr =
|
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
|
||||||
//永久
|
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
|
||||||
//单次
|
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
|
||||||
//循环
|
|
||||||
useDateStr = '循环';
|
|
||||||
}
|
|
||||||
|
|
||||||
return useDateStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget commonItem(String leftTitle, String rightTitle,
|
Widget commonItem(String leftTitle, String rightTitle,
|
||||||
{bool isHaveDirection = false,
|
{bool isHaveDirection = false,
|
||||||
bool isHaveLine = false,
|
bool isHaveLine = false,
|
||||||
@ -226,60 +177,16 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: _isOnRemote,
|
value: state.isOnRemote.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isOnRemote = !_isOnRemote;
|
state.isOnRemote.value = !state.isOnRemote.value;
|
||||||
updateAdministratorRequest(true);
|
logic.updateAdministratorRequest(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//管理员详情请求
|
|
||||||
Future<void> administratorDetailRequest() async {
|
|
||||||
_isFirst = false;
|
|
||||||
AdministratorDetailEntity entity =
|
|
||||||
await ApiRepository.to.authorizedAdminDetail(itemData.uid ?? 0);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("管理员详情请求成功啦啦啦啦啦");
|
|
||||||
lockItemList = entity.data!.lockList!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新管理员信息请求
|
|
||||||
Future<void> updateAdministratorRequest(bool isRemote) async {
|
|
||||||
String isRemoteUnlock = _isOnRemote == true ? '1' : '2';
|
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to.updateAdministrator(
|
|
||||||
itemData.uid.toString(),
|
|
||||||
_changeNameController.text,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
isRemoteUnlock);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("修改管理员信息成功啦啦啦啦啦");
|
|
||||||
EasyLoading.showToast("修改成功",duration: 2000.milliseconds);
|
|
||||||
setState(() {
|
|
||||||
if (isRemote) {
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
|
||||||
Future<void> deleteAdministratorRequest() async {
|
|
||||||
AuthorizedAdminListEntity entity = await ApiRepository.to
|
|
||||||
.deleteAuthorizedAdmin(itemData.uid.toString(), '0');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("删除电子钥匙成功");
|
|
||||||
EasyLoading.showToast("删除成功",duration: 2000.milliseconds);
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -288,11 +195,11 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
|||||||
title:
|
title:
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
tipTitle: "请输入",
|
tipTitle: "请输入",
|
||||||
controller: _changeNameController,
|
controller: state.changeNameController,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if (_changeNameController.text.isNotEmpty) {
|
if (state.changeNameController.text.isNotEmpty) {
|
||||||
updateAdministratorRequest(false);
|
logic.updateAdministratorRequest(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
|
import '../authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
|
|
||||||
|
class AdministratorDetailsState{
|
||||||
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
final itemData = AuthorizedAdminListItem().obs;
|
||||||
|
var isOnRemote = false.obs;
|
||||||
|
var lockItemList = <LockListItem>[].obs;
|
||||||
|
|
||||||
|
AdministratorDetailsState(){
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if (map != null && (map["itemData"] != null)) {
|
||||||
|
itemData.value = map["itemData"];
|
||||||
|
isOnRemote.value = itemData.value.isRemoteUnlock == 1 ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -76,6 +76,7 @@ class AuthorizedAdminListItem {
|
|||||||
int? keyType;
|
int? keyType;
|
||||||
int? date;
|
int? date;
|
||||||
int? isRemoteUnlock;
|
int? isRemoteUnlock;
|
||||||
|
int? keyId;
|
||||||
|
|
||||||
AuthorizedAdminListItem(
|
AuthorizedAdminListItem(
|
||||||
{this.uid,
|
{this.uid,
|
||||||
@ -88,7 +89,8 @@ class AuthorizedAdminListItem {
|
|||||||
this.userid,
|
this.userid,
|
||||||
this.keyType,
|
this.keyType,
|
||||||
this.date,
|
this.date,
|
||||||
this.isRemoteUnlock});
|
this.isRemoteUnlock,
|
||||||
|
this.keyId});
|
||||||
|
|
||||||
AuthorizedAdminListItem.fromJson(Map<String, dynamic> json) {
|
AuthorizedAdminListItem.fromJson(Map<String, dynamic> json) {
|
||||||
uid = json['uid'];
|
uid = json['uid'];
|
||||||
@ -102,6 +104,7 @@ class AuthorizedAdminListItem {
|
|||||||
keyType = json['keyType'];
|
keyType = json['keyType'];
|
||||||
date = json['date'];
|
date = json['date'];
|
||||||
isRemoteUnlock = json['isRemoteUnlock'];
|
isRemoteUnlock = json['isRemoteUnlock'];
|
||||||
|
keyId = json['keyId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -117,6 +120,7 @@ class AuthorizedAdminListItem {
|
|||||||
data['keyType'] = keyType;
|
data['keyType'] = keyType;
|
||||||
data['date'] = date;
|
data['date'] = date;
|
||||||
data['isRemoteUnlock'] = isRemoteUnlock;
|
data['isRemoteUnlock'] = isRemoteUnlock;
|
||||||
|
data['keyId'] = keyId;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
|
import 'authorizedAdminListEntity.dart';
|
||||||
|
import 'authorizedAdministratorList_state.dart';
|
||||||
|
|
||||||
|
class AuthorizedAdministratorListLogic extends BaseGetXController{
|
||||||
|
AuthorizedAdministratorListState state = AuthorizedAdministratorListState();
|
||||||
|
|
||||||
|
//请求授权管理员列表
|
||||||
|
Future<AuthorizedAdminListEntity> mockNetworkDataRequest() async {
|
||||||
|
AuthorizedAdminListEntity entity = await ApiRepository.to.authorizedAdminList(
|
||||||
|
pageNo.toString(),
|
||||||
|
pageSize.toString()
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if (pageNo == 1) {
|
||||||
|
state.itemDataList.value = entity.data!.itemList!;
|
||||||
|
pageNo++;
|
||||||
|
} else {
|
||||||
|
if (entity.data!.itemList!.isNotEmpty) {
|
||||||
|
state.itemDataList.value.addAll(entity.data!.itemList!);
|
||||||
|
print("state.itemDataList.value.length:${state.itemDataList.value.length}");
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
||||||
|
Future<void> deleteAdministratorRequest(String uid, int includeUnderlings) async {
|
||||||
|
AuthorizedAdminListEntity entity = await ApiRepository.to
|
||||||
|
.deleteAuthorizedAdmin(uid, includeUnderlings.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("删除成功", something: (){
|
||||||
|
pageNo = 1;
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//使用期限
|
||||||
|
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||||
|
//限期
|
||||||
|
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
} else {
|
||||||
|
useDateStr = '限期';
|
||||||
|
}
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||||
|
//永久
|
||||||
|
useDateStr = '永久';
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
|
//单次
|
||||||
|
useDateStr = '单次';
|
||||||
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||||
|
//循环
|
||||||
|
useDateStr = '循环';
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 刷新电子钥匙列表
|
||||||
|
StreamSubscription? _authorizedAdministratorListPageRefreshUIEvent;
|
||||||
|
void _authorizedAdministratorListPageRefreshUIAction() {
|
||||||
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
|
_authorizedAdministratorListPageRefreshUIEvent = eventBus.on<AuthorizedAdministratorListPageRefreshUI>().listen((event) {
|
||||||
|
pageNo = 1;
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
_authorizedAdministratorListPageRefreshUIAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
_authorizedAdministratorListPageRefreshUIEvent?.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,19 +1,19 @@
|
|||||||
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:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
import '../../../../tools/left_slide_actions.dart';
|
import '../../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../../tools/showTipView.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import 'authorizedAdministratorList_logic.dart';
|
||||||
|
|
||||||
class AuthorizedAdministratorListPage extends StatefulWidget {
|
class AuthorizedAdministratorListPage extends StatefulWidget {
|
||||||
const AuthorizedAdministratorListPage({Key? key}) : super(key: key);
|
const AuthorizedAdministratorListPage({Key? key}) : super(key: key);
|
||||||
@ -23,11 +23,24 @@ class AuthorizedAdministratorListPage extends StatefulWidget {
|
|||||||
_AuthorizedAdministratorListPageState();
|
_AuthorizedAdministratorListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AuthorizedAdministratorListPageState
|
class _AuthorizedAdministratorListPageState extends State<AuthorizedAdministratorListPage> {
|
||||||
extends State<AuthorizedAdministratorListPage> {
|
final logic = Get.put(AuthorizedAdministratorListLogic());
|
||||||
|
final state = Get.find<AuthorizedAdministratorListLogic>().state;
|
||||||
|
|
||||||
|
Future<void> getHttpData() async {
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
logic.mockNetworkDataRequest().then((AuthorizedAdminListEntity value){
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
getHttpData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -49,156 +62,130 @@ class _AuthorizedAdministratorListPageState
|
|||||||
// 处理操作按钮的点击事件
|
// 处理操作按钮的点击事件
|
||||||
Navigator.pushNamed(context, Routers.addAuthorizedAdministratorPage).then((value) {
|
Navigator.pushNamed(context, Routers.addAuthorizedAdministratorPage).then((value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
mockNetworkDataRequest();
|
logic.pageNo = 1;
|
||||||
|
getHttpData();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: FutureBuilder<List<AuthorizedAdminListItem>>(
|
body: EasyRefreshTool(
|
||||||
future: mockNetworkDataRequest(),
|
onRefresh: (){
|
||||||
builder: (BuildContext context,
|
logic.pageNo = 1;
|
||||||
AsyncSnapshot<List<AuthorizedAdminListItem>> snapshot) {
|
getHttpData();
|
||||||
//请求结束
|
},
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
onLoad: (){
|
||||||
if (snapshot.hasError) {
|
getHttpData();
|
||||||
//请求失败
|
},
|
||||||
return const Text('请求失败');
|
child: Column(
|
||||||
} else {
|
children: [
|
||||||
//请求成功
|
// _searchWidget(),
|
||||||
final List<AuthorizedAdminListItem> itemList = snapshot.data!;
|
Expanded(child: _buildMainUI()),
|
||||||
|
],
|
||||||
return Column(
|
)),
|
||||||
children: [
|
|
||||||
// _searchWidget(),
|
|
||||||
Expanded(child: _buildMainUI(itemList)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//请求未结束 显示loading
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求授权管理员列表
|
// Widget _searchWidget() {
|
||||||
Future<List<AuthorizedAdminListItem>> mockNetworkDataRequest() async {
|
// return Container(
|
||||||
AuthorizedAdminListEntity entity =
|
// height: 60.h,
|
||||||
await ApiRepository.to.authorizedAdminList('1', '20');
|
// margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
||||||
List<AuthorizedAdminListItem> dataList = [];
|
// decoration: BoxDecoration(
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
// color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||||
print("授权管理员列表成功:${entity.data?.itemList}");
|
// child: TextField(
|
||||||
if (entity.data != null) {
|
// //输入框一行
|
||||||
dataList = entity.data!.itemList!;
|
// maxLines: 1,
|
||||||
// setState(() {});
|
// // controller: _controller,
|
||||||
}
|
// autofocus: false,
|
||||||
}
|
//
|
||||||
return dataList;
|
// decoration: InputDecoration(
|
||||||
}
|
// //输入里面输入文字内边距设置
|
||||||
|
// contentPadding: const EdgeInsets.only(
|
||||||
|
// top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||||
|
// hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
// hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
||||||
|
// //不需要输入框下划线
|
||||||
|
// border: InputBorder.none,
|
||||||
|
// //左边图标设置
|
||||||
|
// icon: Padding(
|
||||||
|
// padding: EdgeInsets.only(
|
||||||
|
// top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
||||||
|
// child: Image.asset(
|
||||||
|
// 'images/main/icon_main_search.png',
|
||||||
|
// width: 40.w,
|
||||||
|
// height: 40.w,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
//删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否
|
Widget _buildMainUI() {
|
||||||
Future<void> deleteAdministratorRequest(String uid) async {
|
return Obx(() => state.itemDataList.value.isEmpty
|
||||||
AuthorizedAdminListEntity entity = await ApiRepository.to
|
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||||
.deleteAuthorizedAdmin(uid, '0');
|
: SlidableAutoCloseBehavior(
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
child: ListView.separated(
|
||||||
EasyLoading.showToast("删除成功",duration: 2000.milliseconds);
|
itemCount: state.itemDataList.value.length,
|
||||||
mockNetworkDataRequest();
|
itemBuilder: (c, index) {
|
||||||
}
|
AuthorizedAdminListItem authorizedAdminListItem = state.itemDataList.value[index];
|
||||||
}
|
|
||||||
|
|
||||||
Widget _searchWidget() {
|
return Slidable(
|
||||||
return Container(
|
key:ValueKey(authorizedAdminListItem.uid),
|
||||||
height: 60.h,
|
endActionPane: ActionPane(
|
||||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
extentRatio: 0.2,
|
||||||
decoration: BoxDecoration(
|
motion: const ScrollMotion(),
|
||||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
children: [
|
||||||
child: TextField(
|
SlidableAction(
|
||||||
//输入框一行
|
onPressed: (BuildContext context){
|
||||||
maxLines: 1,
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||||
// controller: _controller,
|
logic.deleteAdministratorRequest(authorizedAdminListItem.uid.toString(), isAllData ? 1 : 0);
|
||||||
autofocus: false,
|
});
|
||||||
|
},
|
||||||
decoration: InputDecoration(
|
backgroundColor: Colors.red,
|
||||||
//输入里面输入文字内边距设置
|
foregroundColor: Colors.white,
|
||||||
contentPadding: const EdgeInsets.only(
|
label: '删除',
|
||||||
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
),
|
||||||
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
],
|
||||||
//不需要输入框下划线
|
|
||||||
border: InputBorder.none,
|
|
||||||
//左边图标设置
|
|
||||||
icon: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
|
||||||
child: Image.asset(
|
|
||||||
'images/main/icon_main_search.png',
|
|
||||||
width: 40.w,
|
|
||||||
height: 40.w,
|
|
||||||
),
|
),
|
||||||
),
|
child: _electronicKeyItem(authorizedAdminListItem),
|
||||||
),
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMainUI(List itemList) {
|
|
||||||
return itemList.isEmpty
|
|
||||||
? NoData()
|
|
||||||
: ListView.builder(
|
|
||||||
itemCount: itemList.length,
|
|
||||||
itemBuilder: (c, index) {
|
|
||||||
AuthorizedAdminListItem itemData = itemList[index];
|
|
||||||
if (index < itemList.length) {
|
|
||||||
return LeftSlideActions(
|
|
||||||
key: Key(itemData.name!),
|
|
||||||
actionsWidth: 60,
|
|
||||||
actions: [
|
|
||||||
_buildDeleteBtn(itemData.uid.toString()),
|
|
||||||
],
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
|
||||||
),
|
|
||||||
child: _electronicKeyItem(itemData),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
return _electronicKeyItem(itemData);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(AuthorizedAdminListItem itemData) {
|
Widget _electronicKeyItem(AuthorizedAdminListItem itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(context, Routers.administratorDetailsPage,
|
Navigator.pushNamed(context, Routers.administratorDetailsPage, arguments: {'itemData': itemData}).then((value) {
|
||||||
arguments: {'itemData': itemData}).then((value) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
mockNetworkDataRequest();
|
logic.pageNo = 1;
|
||||||
|
getHttpData();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 100.h,
|
height: 100.h,
|
||||||
|
color: Colors.white,
|
||||||
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
decoration: BoxDecoration(
|
// decoration: const BoxDecoration(
|
||||||
color: Colors.white,
|
// color: Colors.white,
|
||||||
// borderRadius: BorderRadius.circular(10.w),
|
// borderRadius: BorderRadius.circular(10.w),
|
||||||
),
|
// ),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(width: 30.w,),
|
||||||
width: 30.w,
|
Image.asset('images/controls_user.png', width: 60.w, height: 60.w),
|
||||||
),
|
SizedBox(width: 20.w),
|
||||||
Image.asset(
|
|
||||||
'images/controls_user.png',
|
|
||||||
width: 60.w,
|
|
||||||
height: 60.w,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 20.w,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -227,6 +214,11 @@ class _AuthorizedAdministratorListPageState
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 10.w),
|
||||||
|
Text(
|
||||||
|
XSConstantMacro.getKeyStatusStr(itemData.keyStatus!),
|
||||||
|
style: TextStyle(fontSize: 18.sp, color: Colors.red),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
@ -234,7 +226,7 @@ class _AuthorizedAdministratorListPageState
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
getUseDateStr(itemData),
|
logic.getUseDateStr(itemData),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.placeholderTextColor),
|
color: AppColors.placeholderTextColor),
|
||||||
@ -252,74 +244,4 @@ class _AuthorizedAdministratorListPageState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//使用期限
|
|
||||||
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
|
|
||||||
String useDateStr = '';
|
|
||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
|
||||||
//限期
|
|
||||||
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
|
||||||
DateTime startDateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
|
||||||
DateTime endDateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
|
||||||
useDateStr =
|
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
|
||||||
} else {
|
|
||||||
useDateStr = '限期';
|
|
||||||
}
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
|
||||||
//永久
|
|
||||||
useDateStr = '永久';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
|
||||||
//单次
|
|
||||||
useDateStr = '单次';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
|
||||||
//循环
|
|
||||||
useDateStr = '循环';
|
|
||||||
}
|
|
||||||
|
|
||||||
return useDateStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void showIosTipViewDialog(BuildContext context, String keyId) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return ShowIosTipView(
|
|
||||||
title: "提示",
|
|
||||||
tipTitle: "确定要删除吗?",
|
|
||||||
sureClick: () {
|
|
||||||
Get.back();
|
|
||||||
deleteAdministratorRequest(keyId);
|
|
||||||
},
|
|
||||||
cancelClick: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildDeleteBtn(String keyId) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
// 省略: 弹出是否删除的确认对话框。
|
|
||||||
showIosTipViewDialog(context, keyId);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 60,
|
|
||||||
color: const Color(0xFFF20101),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: const Text(
|
|
||||||
'删除',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.white,
|
|
||||||
height: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import 'authorizedAdminListEntity.dart';
|
||||||
|
|
||||||
|
class AuthorizedAdministratorListState{
|
||||||
|
final itemDataList = <AuthorizedAdminListItem>[].obs;
|
||||||
|
// final TextEditingController searchController = TextEditingController();
|
||||||
|
}
|
||||||
@ -60,12 +60,12 @@ class ExpireLockListLogic extends BaseGetXController{
|
|||||||
deletKeyLogic(ExpireLockItem expireLockItem){
|
deletKeyLogic(ExpireLockItem expireLockItem){
|
||||||
if(expireLockItem.keyRight == 1){
|
if(expireLockItem.keyRight == 1){
|
||||||
// 授权管理员
|
// 授权管理员
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog((isAllData) {
|
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||||
deleteKeyRequest(isAllData ? 1 : 0, expireLockItem);
|
deleteKeyRequest(isAllData ? 1 : 0, expireLockItem);
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
// 普通用户
|
// 普通用户
|
||||||
ShowTipView().showDeleteKeyDataDialogDialog((){
|
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效", (){
|
||||||
deleteKeyRequest(0, expireLockItem);
|
deleteKeyRequest(0, expireLockItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,10 @@ class RecipientInformationLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
action(entity.data!);
|
action(entity.data!);
|
||||||
|
}else {
|
||||||
|
if(entity.errorCode! == 425){
|
||||||
|
showToast(entity.errorMsg!);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +36,7 @@ class RecipientInformationLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Get.back(result: "scuess");
|
Get.back(result: "scuess");
|
||||||
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -227,12 +227,13 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
showCupertinoAlertDialog(context, v);
|
showCupertinoAlertDialog(context, v);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Get.toNamed(Routers.selectBranchPage, arguments: {
|
logic.showToast("暂不支持跨平台转移,敬请期待");
|
||||||
"idList": state.idList.value,
|
// Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||||
"countryCode": state.countryCode.value,
|
// "idList": state.idList.value,
|
||||||
"number": state.numberController.text,
|
// "countryCode": state.countryCode.value,
|
||||||
"isFromType": state.isFromType.value,
|
// "number": state.numberController.text,
|
||||||
});
|
// "isFromType": state.isFromType.value,
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 转移网关
|
// 转移网关
|
||||||
@ -241,12 +242,14 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
showCupertinoAlertDialog(context, v);
|
showCupertinoAlertDialog(context, v);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Get.toNamed(Routers.selectBranchPage, arguments: {
|
logic.showToast("暂不支持跨平台转移,敬请期待");
|
||||||
"idList": state.idList.value,
|
|
||||||
"countryCode": state.countryCode.value,
|
// Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||||
"number": state.numberController.text,
|
// "idList": state.idList.value,
|
||||||
"isFromType": state.isFromType.value
|
// "countryCode": state.countryCode.value,
|
||||||
});
|
// "number": state.numberController.text,
|
||||||
|
// "isFromType": state.isFromType.value
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -566,17 +566,19 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 冻结
|
// 冻结
|
||||||
Future<Response> freezeKey(String keyId) => post(
|
Future<Response> freezeKey(String keyId, int includeUnderlings) => post(
|
||||||
freezeKeyURL.toUrl,
|
freezeKeyURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
|
'includeUnderlings': includeUnderlings,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 取消冻结
|
// 取消冻结
|
||||||
Future<Response> cancelFreeze(String keyId) => post(
|
Future<Response> cancelFreeze(String keyId, int includeUnderlings) => post(
|
||||||
cancelFreezeURL.toUrl,
|
cancelFreezeURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
|
'includeUnderlings': includeUnderlings,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> expireLockList(String pageNo, String pageSize) => post(
|
Future<Response> expireLockList(String pageNo, String pageSize) => post(
|
||||||
@ -848,11 +850,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
Future<Response> deletStaffData(int lockId, int staffId) => post(
|
Future<Response> deletStaffData(int lockId, int staffId, int deleteKey) => post(
|
||||||
deleteStaffURL.toUrl,
|
deleteStaffURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
'staffId': staffId,
|
'staffId': staffId,
|
||||||
|
'deleteKey': deleteKey,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 添加员工
|
// 添加员工
|
||||||
@ -1447,31 +1450,35 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({'endDate': endDate, 'lockIdList': lockIdList}));
|
jsonEncode({'endDate': endDate, 'lockIdList': lockIdList}));
|
||||||
|
|
||||||
Future<Response> batchSendKey(
|
Future<Response> batchSendKey(
|
||||||
String endDate,
|
List lockIds,
|
||||||
List keyGroupIdList,
|
int createUser,
|
||||||
List lockIdList,
|
String countryCode,
|
||||||
String createUser,
|
String receiverUsername,
|
||||||
String isRemoteUnlock,
|
String keyName,
|
||||||
String keyNameForAdmin,
|
int keyType,
|
||||||
String receiverUsername,
|
List weekDays,
|
||||||
String startDate,
|
int startDate,
|
||||||
String countryCode,
|
int endDate,
|
||||||
String usernameType,
|
int startTime,
|
||||||
List weekDays) =>
|
int endTime,
|
||||||
|
int remoteUnlockSwitch,
|
||||||
|
int keyRight) =>
|
||||||
post(
|
post(
|
||||||
batchSendKeyURL.toUrl,
|
batchSendKeyURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'endDate': endDate,
|
'lockIds': lockIds,
|
||||||
'keyGroupIdList': keyGroupIdList,
|
|
||||||
'lockIdList': lockIdList,
|
|
||||||
'createUser': createUser,
|
'createUser': createUser,
|
||||||
'isRemoteUnlock': isRemoteUnlock,
|
|
||||||
'keyNameForAdmin': keyNameForAdmin,
|
|
||||||
'receiverUsername': receiverUsername,
|
|
||||||
'startDate': startDate,
|
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
'usernameType': usernameType,
|
'receiverUsername': receiverUsername,
|
||||||
|
'keyName': keyName,
|
||||||
|
'keyType': keyType,
|
||||||
'weekDays': weekDays,
|
'weekDays': weekDays,
|
||||||
|
'startDate': startDate,
|
||||||
|
'endDate': endDate,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
|
'remoteUnlockSwitch': remoteUnlockSwitch,
|
||||||
|
'keyRight': keyRight,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> addAuthorizedAdmin(
|
Future<Response> addAuthorizedAdmin(
|
||||||
|
|||||||
@ -40,6 +40,7 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
query: query,
|
query: query,
|
||||||
decoder: decoder,
|
decoder: decoder,
|
||||||
uploadProgress: uploadProgress);
|
uploadProgress: uploadProgress);
|
||||||
|
// print('res.body======>${res.body}');
|
||||||
if (res.body == null) {
|
if (res.body == null) {
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
var rs = {
|
var rs = {
|
||||||
|
|||||||
@ -584,14 +584,18 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//冻结
|
//冻结
|
||||||
Future<ElectronicKeyListEntity> freezeKey({required String keyId}) async {
|
Future<ElectronicKeyListEntity> freezeKey(
|
||||||
final res = await apiProvider.freezeKey(keyId);
|
{required String keyId, required int includeUnderlings}) async {
|
||||||
|
final res = await apiProvider.freezeKey(keyId, includeUnderlings);
|
||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消冻结
|
//取消冻结
|
||||||
Future<ElectronicKeyListEntity> cancelFreeze({required String keyId}) async {
|
Future<ElectronicKeyListEntity> cancelFreeze({
|
||||||
final res = await apiProvider.cancelFreeze(keyId);
|
required String keyId,
|
||||||
|
required int includeUnderlings,
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.cancelFreeze(keyId, includeUnderlings);
|
||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,44 +863,48 @@ class ApiRepository {
|
|||||||
|
|
||||||
//群发电子钥匙
|
//群发电子钥匙
|
||||||
Future<KeyDetailEntity> batchSendKey(
|
Future<KeyDetailEntity> batchSendKey(
|
||||||
{required String endDate,
|
{required List lockIds,
|
||||||
required List keyGroupIdList,
|
required int createUser,
|
||||||
required List lockIdList,
|
|
||||||
required String createUser,
|
|
||||||
required String isRemoteUnlock,
|
|
||||||
required String keyNameForAdmin,
|
|
||||||
required String receiverUsername,
|
|
||||||
required String startDate,
|
|
||||||
required String countryCode,
|
required String countryCode,
|
||||||
required String usernameType,
|
required String receiverUsername,
|
||||||
required List weekDays}) async {
|
required String keyName,
|
||||||
|
required int keyType,
|
||||||
|
required List weekDays,
|
||||||
|
required int startDate,
|
||||||
|
required int endDate,
|
||||||
|
required int startTime,
|
||||||
|
required int endTime,
|
||||||
|
required int remoteUnlockSwitch,
|
||||||
|
required int keyRight}) async {
|
||||||
final res = await apiProvider.batchSendKey(
|
final res = await apiProvider.batchSendKey(
|
||||||
endDate,
|
lockIds,
|
||||||
keyGroupIdList,
|
|
||||||
lockIdList,
|
|
||||||
createUser,
|
createUser,
|
||||||
isRemoteUnlock,
|
|
||||||
keyNameForAdmin,
|
|
||||||
receiverUsername,
|
|
||||||
startDate,
|
|
||||||
countryCode,
|
countryCode,
|
||||||
usernameType,
|
receiverUsername,
|
||||||
weekDays);
|
keyName,
|
||||||
|
keyType,
|
||||||
|
weekDays,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
remoteUnlockSwitch,
|
||||||
|
keyRight);
|
||||||
return KeyDetailEntity.fromJson(res.body);
|
return KeyDetailEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
//增加授权管理员
|
//增加授权管理员
|
||||||
Future<KeyDetailEntity> addAuthorizedAdmin(
|
Future<KeyDetailEntity> addAuthorizedAdmin(
|
||||||
String createUser,
|
{required String createUser,
|
||||||
String endDate,
|
required String endDate,
|
||||||
String isRemoteUnlock,
|
required String isRemoteUnlock,
|
||||||
List keyGroupIdList,
|
required List keyGroupIdList,
|
||||||
List lockIdList,
|
required List lockIdList,
|
||||||
String name,
|
required String name,
|
||||||
String startDate,
|
required String startDate,
|
||||||
String userid,
|
required String userid,
|
||||||
String countryCode,
|
required String countryCode,
|
||||||
String usernameType) async {
|
required String usernameType}) async {
|
||||||
final res = await apiProvider.addAuthorizedAdmin(
|
final res = await apiProvider.addAuthorizedAdmin(
|
||||||
createUser,
|
createUser,
|
||||||
endDate,
|
endDate,
|
||||||
@ -1077,11 +1085,11 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除员工
|
// 删除员工
|
||||||
Future<LoginEntity> deletStaffData({
|
Future<LoginEntity> deletStaffData(
|
||||||
required int lockId,
|
{required int lockId,
|
||||||
required int staffId,
|
required int staffId,
|
||||||
}) async {
|
required int deleteKey}) async {
|
||||||
final res = await apiProvider.deletStaffData(lockId, staffId);
|
final res = await apiProvider.deletStaffData(lockId, staffId, deleteKey);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import 'package:url_launcher/url_launcher.dart';
|
|||||||
|
|
||||||
import '../common/XSConstantMacro/XSConstantMacro.dart';
|
import '../common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'NativeInteractionTool.dart';
|
import 'NativeInteractionTool.dart';
|
||||||
|
import 'dateTool.dart';
|
||||||
import 'manager/client_manager.dart';
|
import 'manager/client_manager.dart';
|
||||||
import 'showIosTipView.dart';
|
import 'showIosTipView.dart';
|
||||||
|
|
||||||
@ -169,10 +170,7 @@ class BaseGetXController extends GetxController {
|
|||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if (keyType == XSConstantMacro.keyTypeTime) {
|
if (keyType == XSConstantMacro.keyTypeTime) {
|
||||||
//限期
|
//限期
|
||||||
DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(startDate!);
|
useDateStr = "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())}";
|
||||||
DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(endDate!);
|
|
||||||
useDateStr =
|
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)}';
|
|
||||||
} else if (keyType == XSConstantMacro.keyTypeLong) {
|
} else if (keyType == XSConstantMacro.keyTypeLong) {
|
||||||
//永久
|
//永久
|
||||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
@ -185,7 +183,7 @@ class BaseGetXController extends GetxController {
|
|||||||
useDateStr = '单次';
|
useDateStr = '单次';
|
||||||
} else if (keyType == XSConstantMacro.keyTypeLoop) {
|
} else if (keyType == XSConstantMacro.keyTypeLoop) {
|
||||||
//循环
|
//循环
|
||||||
useDateStr = '循环';
|
useDateStr = "循环";
|
||||||
}
|
}
|
||||||
|
|
||||||
return useDateStr;
|
return useDateStr;
|
||||||
|
|||||||
@ -73,15 +73,16 @@ class AlertBottomWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
list.add(const Divider(
|
list.add(Container(
|
||||||
height: 1,
|
height: 1.h,
|
||||||
|
color: AppColors.greyBackgroundColor,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add(
|
list.add(
|
||||||
Container(
|
Container(
|
||||||
color: AppColors.greyBackgroundColor,
|
color: AppColors.greyBackgroundColor,
|
||||||
height: 8,
|
height: 5.h,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,16 @@ class RefreshCheckInStaffListDataEvent {
|
|||||||
RefreshCheckInStaffListDataEvent();
|
RefreshCheckInStaffListDataEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 刷新考勤设置
|
||||||
|
class RefreshCheckInSetDataEvent {
|
||||||
|
RefreshCheckInSetDataEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 刷新考勤列表
|
||||||
|
class RefreshCheckInListEvent {
|
||||||
|
RefreshCheckInListEvent();
|
||||||
|
}
|
||||||
|
|
||||||
/// 传递当前锁信息
|
/// 传递当前锁信息
|
||||||
class PassCurrentLockInformationEvent {
|
class PassCurrentLockInformationEvent {
|
||||||
LockSetInfoData lockSetInfoData;
|
LockSetInfoData lockSetInfoData;
|
||||||
@ -115,3 +125,8 @@ class DoorLockLogListRefreshUI {
|
|||||||
class LockUserManageListRefreshUI {
|
class LockUserManageListRefreshUI {
|
||||||
LockUserManageListRefreshUI();
|
LockUserManageListRefreshUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 刷新我的更多设置授权管理员列表
|
||||||
|
class AuthorizedAdministratorListPageRefreshUI {
|
||||||
|
AuthorizedAdministratorListPageRefreshUI();
|
||||||
|
}
|
||||||
@ -6,8 +6,9 @@ typedef BlockIsHaveAllDataCallback = void Function(bool isAllData);
|
|||||||
|
|
||||||
class ShowDeleteAdministratorIsHaveAllDataWidget extends StatefulWidget {
|
class ShowDeleteAdministratorIsHaveAllDataWidget extends StatefulWidget {
|
||||||
BlockIsHaveAllDataCallback? blockIsHaveAllDataCallback;
|
BlockIsHaveAllDataCallback? blockIsHaveAllDataCallback;
|
||||||
|
String? contentStr;
|
||||||
|
|
||||||
ShowDeleteAdministratorIsHaveAllDataWidget({Key? key, this.blockIsHaveAllDataCallback}) : super(key: key);
|
ShowDeleteAdministratorIsHaveAllDataWidget({Key? key, this.contentStr, this.blockIsHaveAllDataCallback}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ShowDeleteAdministratorIsHaveAllDataWidget> createState() => _ShowDeleteAdministratorIsHaveAllDataWidgetState();
|
State<ShowDeleteAdministratorIsHaveAllDataWidget> createState() => _ShowDeleteAdministratorIsHaveAllDataWidgetState();
|
||||||
@ -33,7 +34,7 @@ class _ShowDeleteAdministratorIsHaveAllDataWidgetState extends State<ShowDeleteA
|
|||||||
height: 30.w,
|
height: 30.w,
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 15.w,),
|
SizedBox(width: 15.w,),
|
||||||
Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复', maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
|
Expanded(child: Text(widget.contentStr!, maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class ShowTipView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 授权管理员调用删除数据
|
// 授权管理员调用删除数据
|
||||||
void showDeleteAdministratorIsHaveAllDataDialog(BlockIsHaveAllDataCallback blockIsHaveAllDataCallback) {
|
void showDeleteAdministratorIsHaveAllDataDialog(String contentStr, BlockIsHaveAllDataCallback blockIsHaveAllDataCallback) {
|
||||||
bool selet = false;
|
bool selet = false;
|
||||||
showDialog(
|
showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
@ -42,37 +42,12 @@ class ShowTipView {
|
|||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
// height: 100.h,
|
// height: 100.h,
|
||||||
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
||||||
|
contentStr: contentStr,
|
||||||
blockIsHaveAllDataCallback: (a){
|
blockIsHaveAllDataCallback: (a){
|
||||||
selet = a;
|
selet = a;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CupertinoDialogAction(
|
|
||||||
child: Text(TranslationLoader.lanKeys!.delete!.tr),
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
blockIsHaveAllDataCallback(selet);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void showDeleteKeyDataDialogDialog(Function sureClick) {
|
|
||||||
showCupertinoDialog(
|
|
||||||
context: Get.context!,
|
|
||||||
builder: (context) {
|
|
||||||
return CupertinoAlertDialog(
|
|
||||||
content: const Text("删除钥匙会在用户APP连网后生效"),
|
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
@ -84,7 +59,7 @@ class ShowTipView {
|
|||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
sureClick();
|
blockIsHaveAllDataCallback(selet);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -24,7 +24,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# 1.0.20+2024032102:修复Apple Store App Tracking Transparency权限问题
|
# 1.0.20+2024032102:修复Apple Store App Tracking Transparency权限问题
|
||||||
# 1.0.21+2024032801:同为斯凯环境也区分删减版和完整版,通过main_sky_lite.dart/main_sky_full.dart切换
|
# 1.0.21+2024032801:同为斯凯环境也区分删减版和完整版,通过main_sky_lite.dart/main_sky_full.dart切换
|
||||||
# 1.0.21+2024032802:1、打包斯凯、预发布环境给欧阳测试
|
# 1.0.21+2024032802:1、打包斯凯、预发布环境给欧阳测试
|
||||||
version: 1.0.21+2024032802
|
# 1.0.22+20240403:1、打包预发布环境给欧阳测试
|
||||||
|
version: 1.0.22+20240403
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user