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