45 lines
1.5 KiB
Dart
45 lines
1.5 KiB
Dart
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/tools/baseGetXController.dart';
|
|
|
|
import '../../../../network/api_repository.dart';
|
|
import '../../../../tools/eventBusEventManage.dart';
|
|
import '../../../../tools/toast.dart';
|
|
import 'checkInCreatCompany_state.dart';
|
|
|
|
class CheckInCreatCompanyLogic extends BaseGetXController{
|
|
CheckInCreatCompanyState state = CheckInCreatCompanyState();
|
|
|
|
// 设置考勤创建公司
|
|
void setCheckInCreateCompany() async{
|
|
var entity = await ApiRepository.to.setCheckInCreateCompanyData(
|
|
lockId: state.getKeyInfosData.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.setLockSetGeneralSettingData(
|
|
lockId: state.getKeyInfosData.value.lockId.toString(),
|
|
changeType:"1",
|
|
isOn:"1",
|
|
type:"1",
|
|
);
|
|
if(entity.errorCode!.codeIsSuccessful){
|
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
|
|
|
state.getKeyInfosData.value.isAttendance = 1;
|
|
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
|
|
Get.back();
|
|
Toast.show(msg: "设置成功");
|
|
}
|
|
}
|
|
} |