From 9a65dc5dc60a2fef6b21a1710d4e201b3abc4898 Mon Sep 17 00:00:00 2001 From: yangk Date: Fri, 15 May 2026 17:54:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(timesheetReport):=20=E5=B0=86=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=8C=83=E5=9B=B4=E9=80=89=E6=8B=A9=E5=99=A8=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=9C=88=E4=BB=BD=E8=8C=83=E5=9B=B4=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将项目工时报表中的日期范围选择器替换为月份范围选择器 - 更新数据绑定从 dateRange 到 monthRange - 修改时间格式从 YYYY-MM-DD 到 YYYYMM - 移除日期禁用逻辑和周一/周日限制功能 - 更新表单重置方法使用 Element Plus 的 resetFields - 在项目人员报表中同步实现月份范围选择器变更 - 移除已废弃的日期验证函数和监听器代码 --- .../timesheetReport/projectManHour/index.vue | 59 +++++++------------ .../projectPersonnel/index.vue | 57 ++++++++---------- 2 files changed, 43 insertions(+), 73 deletions(-) diff --git a/src/views/oa/erp/timesheetReport/projectManHour/index.vue b/src/views/oa/erp/timesheetReport/projectManHour/index.vue index f669aca..fa98e0d 100644 --- a/src/views/oa/erp/timesheetReport/projectManHour/index.vue +++ b/src/views/oa/erp/timesheetReport/projectManHour/index.vue @@ -17,24 +17,10 @@ - - + + - - + 搜索 @@ -82,6 +68,7 @@ import { } from '@/api/oa/erp/timesheetReport'; import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo'; import { allListDept, listDept } from '@/api/system/dept'; +import { FormInstance } from 'element-plus'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { project_category } = toRefs(proxy?.useDict('project_category')); @@ -92,11 +79,12 @@ const showSearch = ref(true); const ids = ref>([]); const single = ref(true); const multiple = ref(true); -const dateRange = ref<[string, string]>(['', '']); +const monthRange = ref<[string, string]>(['', '']); const projectOptions = ref([]); const deptOptions = ref([]); const projectLoading = ref(false); +const queryRef = ref(); const queryParams = ref({ pageNum: 1, @@ -108,19 +96,22 @@ const queryParams = ref({ }); const totalHoursLabel = computed(() => { - if (dateRange.value && dateRange.value[0] && dateRange.value[1]) { - return `当月工时 (${dateRange.value[0]} 至 ${dateRange.value[1]})`; + if (monthRange.value && monthRange.value[0] && monthRange.value[1]) { + const start = monthRange.value[0]; + const end = monthRange.value[1]; + const fmt = (m: string) => m.substring(0, 4) + '年' + m.substring(4) + '月'; + return `工时 (${fmt(start)} 至 ${fmt(end)})`; } - return '当月工时'; + return '工时'; }); /** 查询列表 */ const getList = async () => { loading.value = true; const params = { ...queryParams.value }; - if (dateRange.value) { - params.startTime = dateRange.value[0]; - params.endTime = dateRange.value[1]; + if (monthRange.value && monthRange.value[0] && monthRange.value[1]) { + params.startTime = monthRange.value[0]; + params.endTime = monthRange.value[1]; } const res = await listProjectManHourReport(params); reportList.value = res.data; @@ -146,17 +137,17 @@ const handleSelectionChange = (selection: ProjectManHourReportVO[]) => { /** 重置按钮操作 */ const resetQuery = () => { - dateRange.value = ['', '']; - (proxy as any)?.resetForm('queryRef'); + monthRange.value = ['', '']; + queryRef.value?.resetFields(); handleQuery(); }; /** 导出按钮操作 */ const handleExport = () => { const params = { ...queryParams.value }; - if (dateRange.value) { - params.startTime = dateRange.value[0]; - params.endTime = dateRange.value[1]; + if (monthRange.value && monthRange.value[0] && monthRange.value[1]) { + params.startTime = monthRange.value[0]; + params.endTime = monthRange.value[1]; } proxy?.download('/oa/erp/timesheetReport/exportProjectManHour', params, `项目工时统计报表_${new Date().getTime()}.xlsx`); }; @@ -213,16 +204,6 @@ const getDeptList = async () => { deptOptions.value = res.data || res.rows || []; }; -/** 禁用非周一的日期 */ -const disabledDateStart = (date: Date) => { - // getDay() 返回 0=周日, 1=周一 - return date.getDay() !== 1; -}; - -const disabledDateEnd = (date: Date) => { - return date.getDay() !== 0; -}; - const spanArr = ref([]); const pos = ref(0); diff --git a/src/views/oa/erp/timesheetReport/projectPersonnel/index.vue b/src/views/oa/erp/timesheetReport/projectPersonnel/index.vue index 79c5a00..b4d9bba 100644 --- a/src/views/oa/erp/timesheetReport/projectPersonnel/index.vue +++ b/src/views/oa/erp/timesheetReport/projectPersonnel/index.vue @@ -6,22 +6,20 @@ - + - @@ -74,15 +72,18 @@