55 lines
1.9 KiB
Dart
Raw Normal View History

import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/eventBusEventManage.dart';
import 'checkInCreatCompany_state.dart';
class CheckInCreatCompanyLogic extends BaseGetXController{
CheckInCreatCompanyState state = CheckInCreatCompanyState();
// 设置考勤创建公司
void setCheckInCreateCompany() async{
var entity = await ApiRepository.to.setCheckInCreateCompanyData(
2023-11-01 17:28:59 +08:00
lockId: state.lockSetInfoData.value.lockId.toString(),
attendanceType: state.isCustom.value ? "0" :"1",
companyName: state.companyNameController.text,
workDay: state.weekDays.value,
workEndTime: state.endTimeTimestamp.value,
workStartTime: state.beginTimeTimestamp.value,
);
if(entity.errorCode!.codeIsSuccessful){
setLockSetGeneralSetting();
}
}
// 设置考勤
void setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setCheckInData(
lockId: state.lockSetInfoData.value.lockId!,
attendance:1,
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
2023-11-01 17:28:59 +08:00
state.lockSetInfoData.value.lockSettingInfo!.attendance = 1;
2024-01-09 18:48:08 +08:00
print("333state.lockSetInfoData.value.lockSettingInfo!.attendance:${state.lockSetInfoData.value.lockSettingInfo!.attendance}");
2023-11-01 17:28:59 +08:00
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "1"));
Get.back();
2024-01-16 16:52:05 +08:00
showToast("设置成功");
}
}
2024-01-23 18:37:03 +08:00
void ifCanNext() {
if(state.companyNameController.text.isNotEmpty &&
state.weekDays.value.isNotEmpty &&
state.beginTimeTimestamp.value.isNotEmpty &&
state.endTimeTimestamp.value.isNotEmpty) {
state.canNext.value = true;
}else{
state.canNext.value = false;
}
}
}