魏少阳 f00022b770 1、卡跟指纹循环、胁迫、限时协议的删除逻辑的修改。
2、添加部分模块国际化
3、修改锁详情获取位置权限请求逻辑
2024-04-16 17:44:38 +08:00

66 lines
2.1 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{
if(state.companyNameController.text.length > 50){
showToast("公司名称不能超过30个字符".tr);
return;
}
if(state.companyNameController.text.length < 6){
showToast("公司名称不能小于6个字符".tr);
return;
}
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){
showToast("创建成功".tr, something: (){
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;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "1"));
Get.back();
showToast("设置成功".tr);
}
}
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;
}
}
}