2023-09-15 16:04:11 +08:00
|
|
|
import 'package:get/get.dart';
|
2024-06-07 10:53:24 +08:00
|
|
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
2023-09-09 18:33:37 +08:00
|
|
|
import 'package:star_lock/tools/baseGetXController.dart';
|
|
|
|
|
|
2023-09-15 16:04:11 +08:00
|
|
|
import '../../../../network/api_repository.dart';
|
2024-04-02 17:30:44 +08:00
|
|
|
import '../../../../tools/eventBusEventManage.dart';
|
2023-09-09 18:33:37 +08:00
|
|
|
import 'checkingInSetWorkdaySet_state.dart';
|
|
|
|
|
|
|
|
|
|
class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
|
|
|
|
CheckingInSetWorkdaySetState state = CheckingInSetWorkdaySetState();
|
|
|
|
|
|
2023-09-15 16:04:11 +08:00
|
|
|
// 编辑考勤设置信息
|
2024-06-07 10:53:24 +08:00
|
|
|
Future<void> editCheckInSetInfoData() async{
|
|
|
|
|
final LoginEntity entity = await ApiRepository.to.editCheckInSetInfoData(
|
|
|
|
|
attendanceType: (state.isCustom.value == true) ? '0' : '1',
|
2023-09-15 16:04:11 +08:00
|
|
|
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
2024-06-07 10:53:24 +08:00
|
|
|
type: (state.isCustom.value == true) ? '3' : '4',
|
|
|
|
|
companyName: state.checkingInSetInfo.value.companyName ?? '',
|
2023-09-15 16:04:11 +08:00
|
|
|
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
|
|
|
|
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
|
|
|
|
workDay:state.weekDays.value,
|
|
|
|
|
);
|
|
|
|
|
if(entity.errorCode!.codeIsSuccessful){
|
2024-06-07 10:53:24 +08:00
|
|
|
showToast('修改成功', something: (){
|
2024-04-02 17:30:44 +08:00
|
|
|
eventBus.fire(RefreshCheckInSetDataEvent());
|
2024-06-07 10:53:24 +08:00
|
|
|
Get.back(result: <String, Object>{
|
|
|
|
|
'attendanceType':state.isCustom.value,
|
|
|
|
|
'weekDays':state.weekDays.value,
|
2024-03-28 13:46:35 +08:00
|
|
|
});
|
|
|
|
|
});
|
2023-09-15 16:04:11 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-09-09 18:33:37 +08:00
|
|
|
|
2023-09-15 16:04:11 +08:00
|
|
|
@override
|
|
|
|
|
void onReady() {
|
|
|
|
|
super.onReady();
|
|
|
|
|
|
2024-06-07 10:53:24 +08:00
|
|
|
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'];
|
2023-09-15 16:04:11 +08:00
|
|
|
|
|
|
|
|
state.weekDays.value = state.checkingInSetInfo.value.workDay!;
|
2024-06-07 10:53:24 +08:00
|
|
|
state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0);
|
2023-09-15 16:04:11 +08:00
|
|
|
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();
|
|
|
|
|
}
|
2023-09-09 18:33:37 +08:00
|
|
|
}
|