2 Commits

Author SHA1 Message Date
FLL
33f2e117f6 Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2025-07-21 11:50:52 +08:00
FLL
b74cde4531 考勤-班次管理 2025-07-21 11:50:09 +08:00
3 changed files with 31 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
import type { PageQuery, BaseEntity } from '#/api/common'; import type { PageQuery, BaseEntity } from '#/api/common';
import {isArray} from "lodash-es";
export interface ShiftVO { export interface ShiftVO {
/** /**
@@ -40,6 +41,9 @@ export interface ShiftVO {
* 休息结束时间 * 休息结束时间
*/ */
restEndTime: string; restEndTime: string;
attendanceTimeRange: [any,any];
restTimeRange: [any,any];
} }
export interface ShiftForm extends BaseEntity { export interface ShiftForm extends BaseEntity {

View File

@@ -33,6 +33,7 @@ export const columns: VxeGridProps['columns'] = [
title: '班次名称', title: '班次名称',
field: 'name', field: 'name',
}, },
{ {
title: '考勤开始时间', title: '考勤开始时间',
field: 'startTime', field: 'startTime',
@@ -69,6 +70,7 @@ export const modalSchema: FormSchemaGetter = () => [
label: '班次名称', label: '班次名称',
fieldName: 'name', fieldName: 'name',
component: 'Input', component: 'Input',
rules: 'required',
}, },
{ {
label: '考勤时间', label: '考勤时间',
@@ -85,8 +87,8 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'RadioGroup', component: 'RadioGroup',
componentProps: { componentProps: {
options: [ options: [
{ label: '不休息', value: '0' }, { label: '不休息', value: 0 },
{ label: '休息', value: '1' }, { label: '休息', value: 1 },
], ],
}, },
rules: 'required', rules: 'required',
@@ -104,13 +106,13 @@ export const modalSchema: FormSchemaGetter = () => [
triggerFields: ['isRest'], triggerFields: ['isRest'],
}, },
}, },
{ // {
label: '状态', // label: '状态',
fieldName: 'status', // fieldName: 'status',
component: 'Select', // component: 'Select',
componentProps: { // componentProps: {
options: getDictOptions('wy_state'), // options: getDictOptions('wy_state'),
}, // },
rules: 'required', // rules: 'required',
}, // },
]; ];

View File

@@ -52,6 +52,16 @@ const [BasicModal, modalApi] = useVbenModal({
isUpdate.value = !!id; isUpdate.value = !!id;
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await shiftInfo(id); const record = await shiftInfo(id);
record.attendanceTimeRange = [
dayjs(record.startTime, 'HH:mm:ss'),
dayjs(record.endTime, 'HH:mm:ss')
];
record.restTimeRange = [
dayjs(record.restStartTime, 'HH:mm:ss'),
dayjs(record.restEndTime, 'HH:mm:ss')
];
record.status = record.status?.toString();
console.log(record);
await formApi.setValues(record); await formApi.setValues(record);
} }
await markInitialized(); await markInitialized();
@@ -69,8 +79,10 @@ async function handleConfirm() {
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
data.startTime = dayjs(data.attendanceTimeRange[0]).format('HH:mm:ss'); data.startTime = dayjs(data.attendanceTimeRange[0]).format('HH:mm:ss');
data.endTime = dayjs(data.attendanceTimeRange[1]).format('HH:mm:ss'); data.endTime = dayjs(data.attendanceTimeRange[1]).format('HH:mm:ss');
if(data.restTimeRange){
data.restStartTime = dayjs(data.restTimeRange[0]).format('HH:mm:ss'); data.restStartTime = dayjs(data.restTimeRange[0]).format('HH:mm:ss');
data.restEndTime = dayjs(data.restTimeRange[1]).format('HH:mm:ss'); data.restEndTime = dayjs(data.restTimeRange[1]).format('HH:mm:ss');
}
delete data.attendanceTimeRange; delete data.attendanceTimeRange;
delete data.restTimeRange; delete data.restTimeRange;
await (isUpdate.value ? shiftUpdate(data) : shiftAdd(data)); await (isUpdate.value ? shiftUpdate(data) : shiftAdd(data));