From 0a2d8b06f8c94e36e602cdc28e3df581d90c9d56 Mon Sep 17 00:00:00 2001 From: Teo <2642673902@qq.com> Date: Wed, 28 May 2025 19:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=AE=A1=E5=88=92=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=AE=A1=E5=88=92,=E6=B7=BB=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 + src/api/progress/plan/index.ts | 57 +- src/api/progress/plan/types.ts | 77 ++- .../progress/plan/component/createDaily.vue | 85 ++- .../plan/component/createDailyRate.vue | 550 ++++++++++++++++++ .../progress/plan/component/createPlan.vue | 109 ++-- src/views/progress/plan/index.vue | 43 +- 7 files changed, 790 insertions(+), 133 deletions(-) create mode 100644 src/views/progress/plan/component/createDailyRate.vue diff --git a/src/App.vue b/src/App.vue index efc2c67..1419fbe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -31,8 +31,10 @@ onMounted(() => { input { -webkit-user-select: auto; /*webkit浏览器*/ + user-select: auto; } textarea { + user-select: auto; -webkit-user-select: auto; /*webkit浏览器*/ } diff --git a/src/api/progress/plan/index.ts b/src/api/progress/plan/index.ts index eea83c8..6b37039 100644 --- a/src/api/progress/plan/index.ts +++ b/src/api/progress/plan/index.ts @@ -1,6 +1,6 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; -import { ProgressCategoryVO, ProgressCategoryForm, ProgressCategoryQuery } from '@/api/progress/plan/types'; +import { ProgressCategoryVO, ProgressCategoryForm, ProgressCategoryQuery, ProgressPlanForm, lastTimeVo, workScheduleListVO, workScheduleListQuery, progressPlanDetailForm } from '@/api/progress/plan/types'; /** * 查询进度类别列表 @@ -74,8 +74,55 @@ export const getProjectSquare = (projectId: string) => { }); }; -export const lastTime=()=>{} -export const workScheduleAddPlan=()=>{} -export const workScheduleList=()=>{} +/** + * 获取进度类别最后一次进度信息 + * @param id + */ +export const lastTime = (id: string | number ):AxiosPromise => { + return request({ + url: '/progress/progressCategory/lastTime/' + id, + method: 'get' + }); +}; + +/** + * 新增进度计划 + * @param data + */ +export const workScheduleAddPlan = (data: ProgressPlanForm) => { + return request({ + url: '/progress/progressPlan', + method: 'post', + data: data + }); +}; + +/** + * 获取进度计划详细信息 + * @param data + */ +export const workScheduleList = (query: workScheduleListQuery):AxiosPromise => { + return request({ + url: '/progress/progressPlan/list', + method: 'get', + params: query + }); +}; + +/** + * 新增进度计划详情(百分比设施) + * @param data + */ +export const workScheduleSubmit = (data: progressPlanDetailForm) => { + return request({ + url: '/progress/progressPlanDetail/insert/percentage', + method: 'post', + data: data + }); +}; export const workScheduleDel=()=>{} -export const workScheduleSubmit=()=>{} \ No newline at end of file + +export const pvModuleList=()=>{} +export const addDaily=()=>{} +export const getDailyBook=()=>{} +export const deleteDaily=()=>{} \ No newline at end of file diff --git a/src/api/progress/plan/types.ts b/src/api/progress/plan/types.ts index d2a2bf3..41495d8 100644 --- a/src/api/progress/plan/types.ts +++ b/src/api/progress/plan/types.ts @@ -23,11 +23,11 @@ export interface ProgressCategoryVO { * 项目id(0表示共用) */ projectId: string | number; - - /** - * 子对象 - */ - children: ProgressCategoryVO[]; + matrixId?: string | number; + /** + * 子对象 + */ + children: ProgressCategoryVO[]; } export interface ProgressCategoryForm extends BaseEntity { @@ -55,13 +55,57 @@ export interface ProgressCategoryForm extends BaseEntity { * 项目id(0表示共用) */ projectId?: string | number; - matrixId?: string | number; + matrixId?: string | number; +} +export interface ProgressPlanForm { + projectId?: string | number; + matrixId?: string | number; + progressCategoryId?: string | number; + startDate?: string; + endDate?: string; + planNumber?: number; + detailList: { + date: string; + planNumber: number; + }[]; +} +export interface workScheduleListVO { + id: string | number; + progressCategoryId: string | number; + progressCategoryName: string; + startDate: string; + endDate: string; + planNumber: number; + finishedNumber: number; + detailList: { + id: string | number; + date: string; + planNumber: number; + finishedNumber: number; + aiFill: boolean; + }[]; +} + +export interface progressPlanDetailForm { + id: string | number; + finishedNumber: number; + submitTime?: string; +} + +export interface workScheduleListQuery { + progressCategoryId?: string | number; + pageSize?: number; + pageNum?: number; +} + +export interface lastTimeVo { + endDate: string; + leftNum: number; } export interface ProgressCategoryQuery { - /** * 父类别id */ @@ -82,15 +126,12 @@ export interface ProgressCategoryQuery { */ projectId?: string | number; - /** - * 日期范围参数 - */ - params?: any; - /** - * 方阵id - */ - matrixId?: string | number; + /** + * 日期范围参数 + */ + params?: any; + /** + * 方阵id + */ + matrixId?: string | number; } - - - diff --git a/src/views/progress/plan/component/createDaily.vue b/src/views/progress/plan/component/createDaily.vue index eb995f1..97ed8fb 100644 --- a/src/views/progress/plan/component/createDaily.vue +++ b/src/views/progress/plan/component/createDaily.vue @@ -22,19 +22,23 @@
- - - - + + + + + + @@ -42,11 +46,11 @@
- - + + @@ -62,10 +66,10 @@
{{ dayDetail.date }} - + - @@ -85,15 +89,15 @@ + + diff --git a/src/views/progress/plan/component/createPlan.vue b/src/views/progress/plan/component/createPlan.vue index a50df39..bc0e535 100644 --- a/src/views/progress/plan/component/createPlan.vue +++ b/src/views/progress/plan/component/createPlan.vue @@ -19,7 +19,7 @@ value-format="YYYY-MM-DD" size="large" :disabled-date="pickerOptionsStart" - :disabled="remainingNumAt.remainingNum === 0" + :disabled="remainingNumAt.leftNum === 0" /> @@ -31,26 +31,26 @@ value-format="YYYY-MM-DD" size="large" :disabled-date="pickerOptionsEnd" - :disabled="remainingNumAt.remainingNum === 0" + :disabled="remainingNumAt.leftNum === 0" /> - + - 均值 @@ -70,9 +70,16 @@ > - + @@ -103,6 +110,7 @@ import { ref, reactive, watch, computed } from 'vue'; import { ElMessage, FormInstance } from 'element-plus'; import { workScheduleAddPlan, lastTime } from '@/api/progress/plan'; +import { lastTimeVo, ProgressCategoryVO, ProgressPlanForm } from '@/api/progress/plan/types'; // Form refs const formRef = ref(null); @@ -115,27 +123,40 @@ const pageSize = 10; const formData = reactive({ start_at: '', end_at: '', - planNum: 0 + planNumber: 0 }); const rules = { start_at: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }], end_at: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }], - planNum: [{ required: true, message: '计划数量不能为空', trigger: 'blur' }] + planNumber: [ + { + trigger: 'input', // 用户输入时触发校验 + validator: (_rule: any, value: string, callback: any) => { + const numberValue = Number(value); + console.log(numberValue); + + if (value === '') { + callback(new Error('请输入值')); + } else if (numberValue > remainingNumAt.leftNum) { + callback(new Error(`数字不能大于 ${remainingNumAt.leftNum}`)); + } else { + callback(); + } + } + }, + { required: true, message: '计划数量不能为空', trigger: 'blur' } + ] }; -const infoDetail = reactive({ - name: '', - work_id: '', - is_delay: 0 +const infoDetail = reactive({} as ProgressCategoryVO); + +const remainingNumAt = reactive({ + endDate: '', + leftNum: 100 }); -const remainingNumAt = reactive({ - endAt: '', - remainingNum: 100 -}); - -const tableData = ref<{ date: string; planNum: number; max: number }[]>([]); +const tableData = ref<{ date: string; planNumber: number; max: number }[]>([]); // Computed paginated data const paginatedData = computed(() => { @@ -151,8 +172,8 @@ watch( const dates = generateDateRange(start, end); tableData.value = dates.map((date) => ({ date, - planNum: 0, - max: remainingNumAt.remainingNum + planNumber: 0, + max: remainingNumAt.leftNum })); } else { tableData.value = []; @@ -175,38 +196,38 @@ const generateDateRange = (start: string, end: string): string[] => { // Picker rules const pickerOptionsStart = (date: Date) => { if (formData.end_at) return date.getTime() > new Date(formData.end_at).getTime(); - if (remainingNumAt.endAt) return date.getTime() < new Date(remainingNumAt.endAt).getTime(); + if (remainingNumAt.endDate) return date.getTime() < new Date(remainingNumAt.endDate).getTime(); return false; }; const pickerOptionsEnd = (date: Date) => { if (formData.start_at) return date.getTime() < new Date(formData.start_at).getTime(); - if (remainingNumAt.endAt) return date.getTime() < new Date(remainingNumAt.endAt).getTime(); + if (remainingNumAt.endDate) return date.getTime() < new Date(remainingNumAt.endDate).getTime(); return false; }; // Average calculation const onAverage = () => { - const total = formData.planNum; + const total = formData.planNumber; const len = tableData.value.length; const avg = Math.floor(total / len); let remainder = total % len; tableData.value.forEach((row) => { - row.planNum = avg + (remainder > 0 ? 1 : 0); + row.planNumber = avg + (remainder > 0 ? 1 : 0); remainder--; }); }; // Total sum validation const onChangeSum = () => { - let total = tableData.value.reduce((sum, item) => sum + item.planNum, 0); - if (total > remainingNumAt.remainingNum) { + let total = tableData.value.reduce((sum, item) => sum + item.planNumber, 0); + if (total > remainingNumAt.leftNum) { tableData.value.forEach((item) => { - item.max = item.planNum; + item.max = item.planNumber; }); } - formData.planNum = total; + formData.planNumber = total; }; // Index method @@ -219,16 +240,18 @@ const onSubmit = () => { if (!formRef.value) return; formRef.value.validate((valid) => { if (!valid) return; - - const payload = { - workId: infoDetail.work_id, - planNum: formData.planNum, - scheduledTime: tableData.value, - is_delay: infoDetail.is_delay === 1 ? 1 : undefined + const payload: ProgressPlanForm = { + projectId: infoDetail.projectId, + planNumber: formData.planNumber, + detailList: tableData.value, + startDate: formData.start_at, + endDate: formData.end_at, + progressCategoryId: infoDetail.id, + matrixId: infoDetail.matrixId }; workScheduleAddPlan(payload).then((res: any) => { - if (res.code === 0) { + if (res.code === 200) { ElMessage.success('添加成功'); closeDialog(); } else { @@ -253,13 +276,15 @@ const closeDialog = () => { const resetForm = () => { formData.start_at = ''; formData.end_at = ''; - formData.planNum = 0; + formData.planNumber = 0; tableData.value = []; }; const fetchLastTime = (row: typeof infoDetail) => { - lastTime({ workId: row.work_id, is_delay: row.is_delay }).then((res: any) => { - if (res.code === 0) { + console.log(row); + + lastTime(row.id).then((res: any) => { + if (res.code === 200) { Object.assign(remainingNumAt, res.data); } }); diff --git a/src/views/progress/plan/index.vue b/src/views/progress/plan/index.vue index 3dcb54d..5e9f300 100644 --- a/src/views/progress/plan/index.vue +++ b/src/views/progress/plan/index.vue @@ -6,13 +6,16 @@ - + /> --> + + + 导出周报 @@ -117,7 +120,7 @@ icon="Plus" link size="small" - @click="dailyRef.openDialog(scope.row)" + @click="handleDayAdd(scope.row)" v-hasPermi="['progress:progressCategory:add']" > 日报 @@ -162,8 +165,9 @@ - - + + +
@@ -183,6 +187,7 @@ const { progress_unit_type, progress_status } = toRefs(proxy?.useDict('prog import { useUserStoreHook } from '@/store/modules/user'; import CreatePlan from './component/createPlan.vue'; import CreateDaily from './component/createDaily.vue'; +import CreateDailyRate from './component/createDailyRate.vue'; type ProgressCategoryOption = { id: number; name: string; @@ -201,16 +206,11 @@ const isExpandAll = ref(true); const loading = ref(false); const planRef = ref>(); const dailyRef = ref>(); +const dailyRateRef = ref>(); const queryFormRef = ref(); const progressCategoryFormRef = ref(); const progressCategoryTableRef = ref(); -const matrixOptions = ref([ - { - id: currentProject.value.id, - matrixName: currentProject.value.name, - children: [] - } -]); +const matrixOptions = ref([]); const dialog = reactive({ dailyStatus: false, planStatus: false, @@ -219,7 +219,7 @@ const dialog = reactive({ title: '', file: '' }); - +const matrixValue = ref(matrixOptions.value.length > 0 ? matrixOptions.value[0].id : undefined); const initFormData: ProgressCategoryForm = { id: undefined, pid: undefined, @@ -254,9 +254,8 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { if (!queryParams.value.matrixId) { const res = await getProjectSquare(currentProject.value.id); - console.log('🚀 ~ getList ~ res:', res); - - matrixOptions.value[0].children = res.rows; + if (!matrixValue.value) matrixValue.value = res.rows[0].id; + matrixOptions.value = res.rows; queryParams.value.matrixId = res.rows[0].id; } loading.value = true; @@ -295,12 +294,20 @@ const handleQuery = () => { }; /** 级联选择器改变事件 */ -const handleChange = (value: number[]) => { - queryParams.value.matrixId = value[1]; +const handleChange = (value: number) => { + queryParams.value.matrixId = value; getList(); }; +const handleDayAdd = (row: ProgressCategoryVO) => { + if (row.unitType === '2') { + dailyRef.value.openDialog(row); + } else { + dailyRateRef.value.openDialog(row); + } +}; + /** 导入按钮操作 */ const openDialog = (row: ProgressCategoryVO, status: string, title: string) => { reset();