# Conflicts: # star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart # star_lock/lib/network/api.dart
55 lines
1.9 KiB
Dart
55 lines
1.9 KiB
Dart
|
|
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(
|
|
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());
|
|
|
|
state.lockSetInfoData.value.lockSettingInfo!.attendance = 1;
|
|
print("333state.lockSetInfoData.value.lockSettingInfo!.attendance:${state.lockSetInfoData.value.lockSettingInfo!.attendance}");
|
|
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
|
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "1"));
|
|
Get.back();
|
|
showToast("设置成功");
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
} |