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