diff --git a/src/api/ecss/ecss.js b/src/api/ecss/ecss.js index 1406e52..57b8773 100644 --- a/src/api/ecss/ecss.js +++ b/src/api/ecss/ecss.js @@ -101,6 +101,8 @@ export const saveEcssTemplateData = data => createAPI(`/ecss/coDel/saveEcssTempl export const deleteEcssTemplate= data => createAPI(`/ecss/coDel/deleteEcssTemplate`,'post',data) +export const copyEcssTemplate= data => createAPI(`/ecss/coDel/copyEcssTemplate`,'post',data) + // 装箱明细相关API export const updateBoxInfo = data => createAPI(`/ecss/coDel/updateBoxInfo`,'post',data) export const deleteBoxInfo = data => createAPI(`/ecss/coDel/deleteBoxInfo`,'post',data) diff --git a/src/views/modules/ecss/ecssTemplate.vue b/src/views/modules/ecss/ecssTemplate.vue index 3d5668c..4c8bc9a 100644 --- a/src/views/modules/ecss/ecssTemplate.vue +++ b/src/views/modules/ecss/ecssTemplate.vue @@ -45,11 +45,12 @@ @@ -266,6 +267,41 @@ 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + 确认复制 + 取消 + + + @@ -306,6 +342,7 @@ searchEcssTemplateData, saveEcssTemplateData, deleteEcssTemplate, + copyEcssTemplate, searchCustomList }from "@/api/ecss/ecss.js" import {getBuList}from '@/api/factory/site.js' @@ -562,6 +599,13 @@ customFlag:false, customData:{}, customList:[], + copyModelFlag: false, + copyModel: { + buNo: '', + name: '' + }, + copySourceInfo: '', + copySourceData: {}, } }, mounted() { @@ -806,6 +850,56 @@ }, changeBu(){ this.addModel.kgs=this.addModel.buNo==='03-RFID'?'4.5':this.addModel.buNo==='01-Label'?'2.5':'' + }, + // 打开复制模版对话框 + copyModelOpen(row) { + this.copySourceData = JSON.parse(JSON.stringify(row)); + this.copySourceInfo = `${row.buDesc} - ${row.name} (${row.type})`; + this.copyModel = { + buNo: '', + name: row.name + }; + this.copyModelFlag = true; + }, + // 保存复制的模版 + saveCopyTemplate() { + if (!this.copyModel.buNo) { + this.$alert('请选择目标BU!', '错误', { + confirmButtonText: '确定' + }); + return false; + } + if (!this.copyModel.name || this.copyModel.name.trim() === '') { + this.$alert('请输入新模版名称!', '错误', { + confirmButtonText: '确定' + }); + return false; + } + + // 构建复制请求数据 + const copyData = { + buNo: this.copyModel.buNo, // 目标BU + name: this.copyModel.name.trim(), // 新模版名称 + nameNative: this.copySourceData.name, // 原模版名称 + site: this.copySourceData.site // 原模版所在站点 + }; + + copyEcssTemplate(copyData).then(({data}) => { + if (data && data.code === 0) { + this.searchTable(); + this.copyModelFlag = false; + this.$message({ + message: '模版复制成功', + type: 'success', + duration: 1500, + onClose: () => {} + }); + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }); + } + }); } }, activated() {