import 'package:get/get.dart'; import 'package:star_lock/login/login/entity/LoginEntity.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{ CheckingInSetWorkdaySetState state = CheckingInSetWorkdaySetState(); // 编辑考勤设置信息 Future editCheckInSetInfoData() async{ final LoginEntity entity = await ApiRepository.to.editCheckInSetInfoData( attendanceType: (state.isCustom.value == true) ? '0' : '1', companyId: state.checkingInSetInfo.value.companyId.toString(), type: (state.isCustom.value == true) ? '3' : '4', companyName: state.checkingInSetInfo.value.companyName ?? '', workEndTime: state.checkingInSetInfo.value.workEndTime.toString(), workStartTime: state.checkingInSetInfo.value.workStartTime.toString(), workDay:state.weekDays.value, ); if(entity.errorCode!.codeIsSuccessful){ showToast('修改成功', something: (){ eventBus.fire(RefreshCheckInSetDataEvent()); Get.back(result: { 'attendanceType':state.isCustom.value, 'weekDays':state.weekDays.value, }); }); } } @override void onReady() { super.onReady(); final Map map = Get.arguments; state.pushType.value = map['pushType']; if(state.pushType.value == '2'){ state.getKeyInfosData.value = map['getKeyInfosData']; state.companyId.value = map['companyId']; state.checkingInSetInfo.value = map['checkingInSetInfo']; state.weekDays.value = state.checkingInSetInfo.value.workDay!; state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0); if(state.isCustom.value == false){ if(state.checkingInSetInfo.value.workDay!.length == 5){ state.isSingledayWeekend.value = 1; }else if(state.checkingInSetInfo.value.workDay!.length == 6){ state.isSingledayWeekend.value = 0; } } } } @override void onInit() { super.onInit(); } @override void onClose() { // _teamEvent.cancel(); } }