考勤-班次管理
This commit is contained in:
parent
5d8ba35a66
commit
b74cde4531
@ -1,4 +1,5 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
import {isArray} from "lodash-es";
|
||||
|
||||
export interface ShiftVO {
|
||||
/**
|
||||
@ -40,6 +41,9 @@ export interface ShiftVO {
|
||||
* 休息结束时间
|
||||
*/
|
||||
restEndTime: string;
|
||||
|
||||
attendanceTimeRange: [any,any];
|
||||
restTimeRange: [any,any];
|
||||
}
|
||||
|
||||
export interface ShiftForm extends BaseEntity {
|
||||
|
@ -33,6 +33,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '班次名称',
|
||||
field: 'name',
|
||||
},
|
||||
|
||||
{
|
||||
title: '考勤开始时间',
|
||||
field: 'startTime',
|
||||
@ -69,6 +70,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
label: '班次名称',
|
||||
fieldName: 'name',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '考勤时间',
|
||||
@ -85,8 +87,8 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '不休息', value: '0' },
|
||||
{ label: '休息', value: '1' },
|
||||
{ label: '不休息', value: 0 },
|
||||
{ label: '休息', value: 1 },
|
||||
],
|
||||
},
|
||||
rules: 'required',
|
||||
@ -104,13 +106,13 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
triggerFields: ['isRest'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
fieldName: 'status',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_state'),
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
// {
|
||||
// label: '状态',
|
||||
// fieldName: 'status',
|
||||
// component: 'Select',
|
||||
// componentProps: {
|
||||
// options: getDictOptions('wy_state'),
|
||||
// },
|
||||
// rules: 'required',
|
||||
// },
|
||||
];
|
||||
|
@ -52,6 +52,16 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
isUpdate.value = !!id;
|
||||
if (isUpdate.value && 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 markInitialized();
|
||||
@ -69,8 +79,10 @@ async function handleConfirm() {
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
data.startTime = dayjs(data.attendanceTimeRange[0]).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.restEndTime = dayjs(data.restTimeRange[1]).format('HH:mm:ss');
|
||||
}
|
||||
delete data.attendanceTimeRange;
|
||||
delete data.restTimeRange;
|
||||
await (isUpdate.value ? shiftUpdate(data) : shiftAdd(data));
|
||||
|
Loading…
Reference in New Issue
Block a user