From c47249278b1af9dc26536174a5a703acaaa49e5d Mon Sep 17 00:00:00 2001 From: yinq Date: Tue, 15 Jul 2025 13:25:51 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=88=90=E5=9E=8B=E5=B7=A5=E8=89=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A4=8D=E5=88=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mes/technologyInfo/index.ts | 21 +++++++++----- src/api/mes/technologyInfo/types.ts | 12 +++++--- src/views/mes/technologyInfo/formingIndex.vue | 29 +++++++++++++++++-- src/views/mes/technologyInfo/index.vue | 26 +++++++++++++++-- 4 files changed, 72 insertions(+), 16 deletions(-) diff --git a/src/api/mes/technologyInfo/index.ts b/src/api/mes/technologyInfo/index.ts index 51b9e3c..91b5d34 100644 --- a/src/api/mes/technologyInfo/index.ts +++ b/src/api/mes/technologyInfo/index.ts @@ -62,16 +62,23 @@ export const delTechnologyInfo = (technologyId: string | number | Array { + return request({ + url: '/mes/technologyInfo/copyTechnologyInfo', + method: 'post', + data: data + }); }; diff --git a/src/api/mes/technologyInfo/types.ts b/src/api/mes/technologyInfo/types.ts index 64bb13c..43598d9 100644 --- a/src/api/mes/technologyInfo/types.ts +++ b/src/api/mes/technologyInfo/types.ts @@ -44,6 +44,8 @@ export interface TechnologyInfoVO { */ remark: string; + prodTechnologyStepInfoList?: []; + } export interface TechnologyInfoForm extends BaseEntity { @@ -139,10 +141,12 @@ export interface TechnologyInfoQuery extends PageQuery { */ activeFlag?: string; - /** - * 日期范围参数 - */ - params?: any; + /** + * 日期范围参数 + */ + params?: any; + + prodTechnologyStepInfoList?: []; } diff --git a/src/views/mes/technologyInfo/formingIndex.vue b/src/views/mes/technologyInfo/formingIndex.vue index dc753d3..3f389db 100644 --- a/src/views/mes/technologyInfo/formingIndex.vue +++ b/src/views/mes/technologyInfo/formingIndex.vue @@ -85,6 +85,11 @@ v-hasPermi="['mes:technologyInfo:edit']">工艺参数 + + 复制 + + @@ -254,7 +259,7 @@ - + @@ -335,7 +340,7 @@ import { getTechnologyInfo, delTechnologyInfo, addTechnologyInfo, - updateTechnologyInfo + updateTechnologyInfo, copyTechnologyInfo } from '@/api/mes/technologyInfo'; import { TechnologyInfoVO, TechnologyInfoQuery, TechnologyInfoForm } from '@/api/mes/technologyInfo/types'; import { getProcessInfoList } from '@/api/mes/baseProcessInfo'; @@ -377,6 +382,9 @@ const stepOpen = ref(false); const prodTechnologyStepInfoList = ref([]); const chekedProdLineList = ref([]); +// 复制相关 +const isCopy = ref(false); + /** 查询工位下拉树结构 */ const getProcessInfoListSelect = async () => { let res = await getProcessInfoList(null); @@ -457,6 +465,7 @@ const getList = async () => { const cancel = () => { reset(); dialog.visible = false; + isCopy.value = false; }; /** 表单重置 */ const reset = () => { @@ -506,6 +515,16 @@ const handleUpdate = async (row?: TechnologyInfoVO) => { dialog.title = '修改成型工艺信息'; }; +const handleCopy = (row: TechnologyInfoVO) => { + reset(); + // 深拷贝当前行数据 + Object.assign(form.value, JSON.parse(JSON.stringify(row))); + // form.value.technologyId = undefined; + dialog.visible = true; + dialog.title = '复制成型工艺信息'; + isCopy.value = true; +}; + /** 工艺参数信息维护按钮操作 */ const handleStepUpdate = async (row?: TechnologyInfoVO) => { reset(); @@ -526,7 +545,10 @@ const submitForm = () => { if (valid) { buttonLoading.value = true; convertToSeconds(); - if (form.value.technologyId) { + if (isCopy.value) { + form.value.prodTechnologyStepInfoList = prodTechnologyStepInfoList; + await copyTechnologyInfo(form.value).finally(() => buttonLoading.value = false); + } else if (form.value.technologyId) { form.value.prodTechnologyStepInfoList = prodTechnologyStepInfoList; await updateTechnologyInfo(form.value).finally(() => buttonLoading.value = false); } else { @@ -536,6 +558,7 @@ const submitForm = () => { dialog.visible = false; stepOpen.value = false; form.value.prodTechnologyStepInfoList = []; + isCopy.value = false; await getList(); } }); diff --git a/src/views/mes/technologyInfo/index.vue b/src/views/mes/technologyInfo/index.vue index 30a9eb3..34622bc 100644 --- a/src/views/mes/technologyInfo/index.vue +++ b/src/views/mes/technologyInfo/index.vue @@ -109,6 +109,11 @@ v-hasPermi="['mes:technologyInfo:edit']">工艺步序 + + 复制 + + @@ -326,7 +331,7 @@ import { getTechnologyInfo, delTechnologyInfo, addTechnologyInfo, - updateTechnologyInfo + updateTechnologyInfo, copyTechnologyInfo } from '@/api/mes/technologyInfo'; import { TechnologyInfoVO, TechnologyInfoQuery, TechnologyInfoForm } from '@/api/mes/technologyInfo/types'; import { getProcessInfoList } from '@/api/mes/baseProcessInfo'; @@ -363,6 +368,9 @@ const materialSelectRef = ref(); const stepOpen = ref(false); +// 复制相关 +const isCopy = ref(false); + const prodTechnologyStepInfoList = ref([]); const chekedProdLineList = ref([]); @@ -446,6 +454,7 @@ const getList = async () => { const cancel = () => { reset(); dialog.visible = false; + isCopy.value = false; }; /** 表单重置 */ const reset = () => { @@ -515,7 +524,10 @@ const submitForm = () => { if (valid) { buttonLoading.value = true; convertToSeconds(); - if (form.value.technologyId) { + if (isCopy.value) { + form.value.prodTechnologyStepInfoList = prodTechnologyStepInfoList; + await copyTechnologyInfo(form.value).finally(() => buttonLoading.value = false); + } else if (form.value.technologyId) { form.value.prodTechnologyStepInfoList = prodTechnologyStepInfoList; await updateTechnologyInfo(form.value).finally(() => buttonLoading.value = false); } else { @@ -525,6 +537,7 @@ const submitForm = () => { dialog.visible = false; stepOpen.value = false; form.value.prodTechnologyStepInfoList = []; + isCopy.value = false; await getList(); } }); @@ -588,6 +601,15 @@ const handleAddStep = () => { }); }; +const handleCopy = (row: TechnologyInfoVO) => { + reset(); + // 深拷贝当前行数据 + Object.assign(form.value, JSON.parse(JSON.stringify(row))); + // form.value.technologyId = undefined; + dialog.visible = true; + dialog.title = '复制成型工艺信息'; + isCopy.value = true; +}; const rowProdBaseProcessProdlineIndex = ({ row, rowIndex }: { row: any; rowIndex: number }): string => { // 根据行数据和行索引返回一个类名字符串 if (row.someCondition) {