2023-11-01 17:28:59 +08:00
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
2024-06-21 09:32:47 +08:00
|
|
|
import '../../../../../login/login/entity/LoginEntity.dart';
|
2023-11-01 17:28:59 +08:00
|
|
|
import '../../../../../network/api_repository.dart';
|
|
|
|
|
import '../../../../../tools/baseGetXController.dart';
|
2024-01-18 11:25:56 +08:00
|
|
|
import '../../../../../tools/eventBusEventManage.dart';
|
2024-05-14 09:32:06 +08:00
|
|
|
import '../../../lockOperatingRecord/keyOperationRecord_entity.dart';
|
2023-11-01 17:28:59 +08:00
|
|
|
import 'editLockName_state.dart';
|
|
|
|
|
|
2024-02-28 15:27:10 +08:00
|
|
|
class EditLockNameLogic extends BaseGetXController {
|
2023-11-01 17:28:59 +08:00
|
|
|
final EditLockNameState state = EditLockNameState();
|
|
|
|
|
|
|
|
|
|
//修改锁名称请求
|
|
|
|
|
Future<void> modifyKeyNameRequest() async {
|
2024-06-21 09:32:47 +08:00
|
|
|
final LoginEntity entity = await ApiRepository.to.updateLockName(
|
2023-11-01 17:28:59 +08:00
|
|
|
lockId: state.lockSetInfoData.value.lockId.toString(),
|
2024-02-28 15:27:10 +08:00
|
|
|
lockName: state.changeLockNameController.text);
|
2023-11-01 17:28:59 +08:00
|
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
2024-01-29 17:23:45 +08:00
|
|
|
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
|
2024-06-05 09:30:04 +08:00
|
|
|
showToast('修改成功'.tr, something: () {
|
2024-04-11 17:06:06 +08:00
|
|
|
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!));
|
2024-01-23 18:37:03 +08:00
|
|
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
2024-06-05 09:30:04 +08:00
|
|
|
Get.back(result: {'lockBasicInfo': state.lockBasicInfo.value});
|
2024-01-23 18:37:03 +08:00
|
|
|
});
|
2023-11-01 17:28:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|