app-starlock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_logic.dart
2024-05-15 10:06:18 +08:00

69 lines
2.2 KiB
Dart

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{
CheckingInSetWorkdaySetState state = CheckingInSetWorkdaySetState();
// 编辑考勤设置信息
void editCheckInSetInfoData() async{
var 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() {
// TODO: implement onReady
super.onReady();
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) ? true : false;
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() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
// _teamEvent.cancel();
}
}