fix:修复 开锁页-考勤-设置-员工 开锁页-考勤-员工-编辑问题
This commit is contained in:
parent
af2ef694df
commit
626c9eea45
@ -1,7 +1,9 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSet/checkingInSet_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
|
||||
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
@ -9,96 +11,94 @@ import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import 'checkingInSet_state.dart';
|
||||
|
||||
class CheckingInSetLogic extends BaseGetXController{
|
||||
class CheckingInSetLogic extends BaseGetXController {
|
||||
CheckingInSetState state = CheckingInSetState();
|
||||
|
||||
// 开启考勤获取是否有公司
|
||||
void openCheckingInData() async{
|
||||
var entity = await ApiRepository.to.openCheckingInData(
|
||||
lockId:state.getKeyInfosData.value.lockId.toString(),
|
||||
Future<void> openCheckingInData() async {
|
||||
final CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData(
|
||||
lockId: state.getKeyInfosData.value.lockId.toString(),
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.companyId.value = entity.data!.companyId.toString();
|
||||
getCheckInSetInfoData();
|
||||
}
|
||||
}
|
||||
|
||||
// 获取获取考勤设置信息
|
||||
void getCheckInSetInfoData() async{
|
||||
var entity = await ApiRepository.to.getCheckInSetInfoData(
|
||||
Future<void> getCheckInSetInfoData() async {
|
||||
final CheckingInSetEntity entity = await ApiRepository.to.getCheckInSetInfoData(
|
||||
companyId: state.companyId.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.checkingInSetInfo.value = entity.data!;
|
||||
|
||||
state.beginTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workStartTime.toString());
|
||||
state.endTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workEndTime.toString());
|
||||
state.beginTimeTimestamp.value = state.checkingInSetInfo.value.workStartTime.toString();
|
||||
state.endTimeTimestamp.value = state.checkingInSetInfo.value.workEndTime.toString();
|
||||
state.beginTime.value = DateTool().dateToHNString(
|
||||
state.checkingInSetInfo.value.workStartTime.toString());
|
||||
state.endTime.value = DateTool()
|
||||
.dateToHNString(state.checkingInSetInfo.value.workEndTime.toString());
|
||||
state.beginTimeTimestamp.value =
|
||||
state.checkingInSetInfo.value.workStartTime.toString();
|
||||
state.endTimeTimestamp.value =
|
||||
state.checkingInSetInfo.value.workEndTime.toString();
|
||||
|
||||
state.weekDays.value = state.checkingInSetInfo.value.workDay!;
|
||||
state.weekDaysStr.value = state.weekDays.value.join(",");
|
||||
state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0) ? true : false;
|
||||
state.weekDaysStr.value = state.weekDays.join(',');
|
||||
state.isCustom.value = state.checkingInSetInfo.value.attendanceType! == 0;
|
||||
|
||||
state.staffNumber.value = state.checkingInSetInfo.value.staffNum!.toString();
|
||||
state.staffNumber.value =
|
||||
state.checkingInSetInfo.value.staffNum!.toString();
|
||||
state.companyName.value = state.checkingInSetInfo.value.companyName!;
|
||||
state.changeNameController.text = state.companyName.value;
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑考勤设置信息
|
||||
void editCheckInSetInfoData() async{
|
||||
var entity = await ApiRepository.to.editCheckInSetInfoData(
|
||||
Future<void> editCheckInSetInfoData() async {
|
||||
final LoginEntity entity = await ApiRepository.to.editCheckInSetInfoData(
|
||||
attendanceType: state.checkingInSetInfo.value.attendanceType.toString(),
|
||||
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
||||
type: "1",
|
||||
type: '1',
|
||||
companyName: state.changeNameController.text,
|
||||
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
||||
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
||||
workDay:state.checkingInSetInfo.value.workDay!,
|
||||
workDay: state.checkingInSetInfo.value.workDay!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.companyName.value = state.changeNameController.text;
|
||||
showToast("修改成功");
|
||||
showToast('修改成功');
|
||||
}
|
||||
}
|
||||
|
||||
// 删除公司
|
||||
void deletCompanyData() async{
|
||||
var entity = await ApiRepository.to.deletCompanyData(
|
||||
companyId:state.checkingInSetInfo.value.companyId!,
|
||||
Future<void> deletCompanyData() async {
|
||||
final CheckingInInfoDataEntity entity = await ApiRepository.to.deletCompanyData(
|
||||
companyId: state.checkingInSetInfo.value.companyId!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "0"));
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, '0'));
|
||||
Get.close(2);
|
||||
}
|
||||
}
|
||||
|
||||
late StreamSubscription _teamEvent;
|
||||
|
||||
void _initLoadDataAction() {
|
||||
_teamEvent = eventBus.on<RefreshCheckInSetDataEvent>().listen((event) {
|
||||
_teamEvent = eventBus.on<RefreshCheckInSetDataEvent>().listen((RefreshCheckInSetDataEvent event) {
|
||||
getCheckInSetInfoData();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
_initLoadDataAction();
|
||||
openCheckingInData();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
_teamEvent.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,13 +73,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
'checkingInSetInfo': state.checkingInSetInfo.value,
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
// state.beginTime.value = data["beginTime"];
|
||||
// state.endTime.value = data["endTime"];
|
||||
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
||||
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
||||
logic.getCheckInSetInfoData();
|
||||
});
|
||||
setState(logic.getCheckInSetInfoData);
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -98,7 +92,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
if(data != null) {
|
||||
state.isCustom.value = data['attendanceType'];
|
||||
state.weekDays.value = data['weekDays'];
|
||||
state.weekDaysStr.value = state.weekDays.value.join(',');
|
||||
state.weekDaysStr.value = state.weekDays.join(',');
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
@ -125,9 +119,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||
onClick: () {
|
||||
ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, () {
|
||||
logic.deletCompanyData();
|
||||
});
|
||||
ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, logic.deletCompanyData);
|
||||
// showDeletCompanyAlertDialog(context);
|
||||
}),
|
||||
),
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -72,7 +70,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.keyEntity.value = entity.data!;
|
||||
kyClickCallback(state.keyEntity.value);
|
||||
kyClickCallback(state.keyEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +80,11 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
|
||||
usernameType = '2';
|
||||
}
|
||||
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
|
||||
if (state.appUnHaveAccount.value &&
|
||||
state.selectPrintingMethodType.value == '1') {
|
||||
state.attendanceWayNumber.value = state.staffAccountController.text;
|
||||
}
|
||||
|
||||
final LoginEntity entity = await ApiRepository.to.editStaffData(
|
||||
attendanceType: state.selectPrintingMethodType.value,
|
||||
@ -151,25 +154,15 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
_initLoadDataAction();
|
||||
|
||||
changeInput(state.staffNameController);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
_getNumberEvent!.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,15 +214,18 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
child: Container(
|
||||
height: 40.h,
|
||||
padding: EdgeInsets.only(
|
||||
left: 25.w, right: 25.w, top: 2.h),
|
||||
left: 25.w,
|
||||
right: 25.w,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius: BorderRadius.circular(20.h),
|
||||
),
|
||||
child: Text(addStaffSelectKeyType(),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 22.sp)),
|
||||
child: Center(
|
||||
child: Text(addStaffSelectKeyType(),
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 22.sp)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user