From 0a77934d8b6c410c9e47e11ab40fc3c5019f27fa Mon Sep 17 00:00:00 2001 From: fyy <2717885210@qq.com> Date: Mon, 11 Aug 2025 11:05:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=92=E7=8F=AD=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendanceManagement/arrangement/index.ts | 14 +++++++ .../arrangement/model.d.ts | 9 +++-- .../workforceManagement/calendarView.vue | 14 ++----- .../workforceManagement/data.ts | 39 +++++++++++++------ .../workforceManagement/scheduleView.vue | 32 +++++++++------ 5 files changed, 71 insertions(+), 37 deletions(-) diff --git a/apps/web-antd/src/api/property/attendanceManagement/arrangement/index.ts b/apps/web-antd/src/api/property/attendanceManagement/arrangement/index.ts index fdd93873..3da89d0b 100644 --- a/apps/web-antd/src/api/property/attendanceManagement/arrangement/index.ts +++ b/apps/web-antd/src/api/property/attendanceManagement/arrangement/index.ts @@ -78,3 +78,17 @@ export function arrangmentList(params?: arrangmentListQuery) { { params }, ); } + +/** + * 查询某天排班人员详情列表(班表视图) + * @param params + * @returns 排班列表 + */ + +export function queryScheduleView(params?: arrangmentListQuery) { + return requestClient.get>( + '/property/AttendanceUserGroup/queryScheduleView', + { params }, + ); +} + diff --git a/apps/web-antd/src/api/property/attendanceManagement/arrangement/model.d.ts b/apps/web-antd/src/api/property/attendanceManagement/arrangement/model.d.ts index e0ecbb4a..89b0748c 100644 --- a/apps/web-antd/src/api/property/attendanceManagement/arrangement/model.d.ts +++ b/apps/web-antd/src/api/property/attendanceManagement/arrangement/model.d.ts @@ -40,9 +40,9 @@ export interface ArrangementVO { * 状态:0-未生效,1-已生效 */ status?: number; - userGroupList?:any[]; - attendanceGroup?:any; - dateType?:number + userGroupList?: any[]; + attendanceGroup?: any; + dateType?: number; } export interface ArrangementForm extends BaseEntity { @@ -138,5 +138,6 @@ export interface ArrangementQuery extends PageQuery { month?: string; } export interface arrangmentListQuery extends PageQuery { - currentDate:string//某天的日期 + currentDate: string; //某天的日期 } +export interface AttendanceUserGroup {} diff --git a/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/calendarView.vue b/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/calendarView.vue index 3898bd20..87f5d535 100644 --- a/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/calendarView.vue +++ b/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/calendarView.vue @@ -15,7 +15,7 @@ import { import { Modal } from 'ant-design-vue'; const emit = defineEmits<{ - (e: 'changeView', value: boolean): void; + (e: 'changeView', value: 'calender' | 'schedule'): void; }>(); const props = defineProps<{ viewMode: 'calender' | 'schedule'; @@ -24,20 +24,15 @@ const selectedDate = ref(); const calendarData = reactive([]); const loading = ref(false); // 查询日历数据 -const fetchCalendarData = async (month?: string) => { +const fetchCalendarData = async () => { try { loading.value = true; const params = { - month: - month || - selectedDate.value?.format('YYYY-MM') || - dayjs().format('YYYY-MM'), + month: selectedDate.value?.format('YYYY-MM') || dayjs().format('YYYY-MM'), }; const res = await arrangementCalender(params); const currentMonth = - month || - selectedDate.value?.format('YYYY-MM') || - dayjs().format('YYYY-MM'); //当前月份的开始日期 + selectedDate.value?.format('YYYY-MM') || dayjs().format('YYYY-MM'); //当前月份的开始日期 // 清空之前的数据 calendarData.length = 0; @@ -171,7 +166,6 @@ const scheduleData: { ]; // 切换视图模式 function handleViewModeChange(e: RadioChangeEvent): void { - // 将父组件的isCalenderView变为true emit('changeView', e.target.value); } diff --git a/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/data.ts b/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/data.ts index d8918d73..b8f8f270 100644 --- a/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/data.ts +++ b/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/data.ts @@ -82,34 +82,51 @@ export const columns: VxeGridProps['columns'] = [ }, { title: '人员', - field: 'scheduleName', + field: 'employeeName', width: 120, // width: 'auto', }, { title: '单位', - field: 'scheduleName', + field: 'deptName', width: 'auto', }, - { - title: '排班名称', - field: 'scheduleName', - minWidth: 120, - }, + // { + // title: '排班名称', + // field: 'attendanceArrangement.scheduleName', + // minWidth: 120, + // }, { title: '考勤组', - field: 'groupId', + field: 'attendanceGroup.groupName', minWidth: 120, }, { title: '考勤类型', - field: 'scheduleType', + field: 'attendanceGroup.attendanceType', + slots: { + default: ({ row }) => { + return renderDict(String(row.attendanceGroup.attendanceType),'wy_kqlx') + }, + }, width: 'auto', }, { title: '考勤时间', - field: 'dateType', + field: 'attendanceShift', minWidth: 200, + slots: { + default: ({ row }) => { + if (row.attendanceShift.startTime && row.attendanceShift.endTime) { + if(row.attendanceShift.restEndTime&&row.attendanceShift.restStartTime){ + return `${row.attendanceShift.startTime}~${row.attendanceShift.endTime} ${row.shift.restStartTime}~${row.shift.restEndTime}`; + }else{ + return `${row.attendanceShift.startTime}~${row.attendanceShift.endTime}`; + } + } + return '/'; + }, + }, }, { field: 'action', @@ -289,7 +306,7 @@ export const workforceDayDetailColumns:VxeGridProps['columns'] =[ default: ({ row }) => { if (row.shift.startTime && row.shift.endTime) { if(row.shift.restEndTime&&row.shift.restStartTime){ - return `${row.shift.restStartTime}~${row.shift.restEndTime} ${row.shift.startTime}~${row.shift.endTime}`; + return `${row.shift.startTime}~${row.shift.endTime} ${row.shift.restStartTime}~${row.shift.restEndTime}`; }else{ return `${row.shift.startTime}~${row.shift.endTime}`; } diff --git a/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/scheduleView.vue b/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/scheduleView.vue index b1bb8858..c2d101a0 100644 --- a/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/scheduleView.vue +++ b/apps/web-antd/src/views/property/attendanceManagement/workforceManagement/scheduleView.vue @@ -7,24 +7,28 @@ import { columns } from './data'; import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { getVxePopupContainer } from '@vben/utils'; import { - arrangementList, + queryScheduleView, arrangementRemove, } from '#/api/property/attendanceManagement/arrangement'; import arrangementModal from './arrangement-modal.vue'; import type { ArrangementForm } from '#/api/property/attendanceManagement/arrangement/model'; import { Page, useVbenModal } from '@vben/common-ui'; import { Popconfirm, Space } from 'ant-design-vue'; -const emit = defineEmits<{ (e: 'changeView', value: boolean): void }>(); +import dayjs from 'dayjs'; +const emit = defineEmits<{ + (e: 'changeView', value: 'calender' | 'schedule'): void; +}>(); const props = defineProps<{ viewMode: 'calender' | 'schedule'; }>(); const value = ref(); -const onPanelChange = (value: Dayjs, mode: string) => { - console.log(value, mode); +const onSelect = (value: Dayjs) => { + currentDate.value = dayjs(value).format('YYYY-MM-DD'); + tableApi.query(); }; +let currentDate = ref(dayjs().format('YYYY-MM-DD')); // 切换视图模式 function handleViewModeChange(e: RadioChangeEvent): void { - // 将父组件的isCalenderView变为false emit('changeView', e.target.value); } @@ -45,11 +49,11 @@ const gridOptions: VxeGridProps = { pagerConfig: {}, proxyConfig: { ajax: { - query: async ({ page }, formValues = {}) => { - return await arrangementList({ + query: async ({ page }) => { + return await queryScheduleView({ pageNum: page.currentPage, pageSize: page.pageSize, - ...formValues, + currentDate: currentDate.value, }); }, }, @@ -115,7 +119,7 @@ async function handleDelete(row: Required) { v-model:value="value" :fullscreen="false" :mode="'month'" - @panelChange="onPanelChange" + @select="onSelect" /> @@ -133,7 +137,7 @@ async function handleDelete(row: Required) { ) { v-access:code="['property:arrangement:remove']" @click.stop="" > - {{ $t('pages.common.delete') }} + 移除 @@ -153,4 +157,8 @@ async function handleDelete(row: Required) { - +