From 116e70309334ec5e5ec32dffbd248697d7025aa7 Mon Sep 17 00:00:00 2001 From: YuanFeng <770153798@qq.com> Date: Fri, 29 Nov 2024 22:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=A8=A1=E6=9D=BF=E6=97=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/oms/productinfo/ProductInfoForm.vue | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/hangtag-ui/hangtag-ui-admin/src/views/oms/productinfo/ProductInfoForm.vue b/hangtag-ui/hangtag-ui-admin/src/views/oms/productinfo/ProductInfoForm.vue index 3919560..fb8d2c8 100644 --- a/hangtag-ui/hangtag-ui-admin/src/views/oms/productinfo/ProductInfoForm.vue +++ b/hangtag-ui/hangtag-ui-admin/src/views/oms/productinfo/ProductInfoForm.vue @@ -302,11 +302,7 @@ const formData = ref({ const that = reactive({ brandId: undefined, - draftDesignList: [{ - remark: '', - label: '默认', - id: '' - }], + draftDesignList: [], updateProcess: false, processInfoList: [{ key: Math.random().toString(36).substring(2, 6), @@ -439,30 +435,40 @@ const submitForm = async () => { // 校验关联设计稿 let countInfo = {}; let ids = []; + if(`${formData.value.templateType}` !== '1'){ + data.draftDesignList = [] + } // 有模板才校验稿件 if (`${formData.value.templateType}` === '1') { - for (let i = 0; i < that.draftDesignList.length; i++) { - const id = that.draftDesignList[i].id - const l = that.draftDesignList[i].label - if (!id) { - message.error(`第${i + 1}行设计稿不能为空`) - return; + if(that.draftDesignList.length == 0){ + // 没有数据时候设置未无模板 + formData.value.templateType = '2' + }else { + for (let i = 0; i < that.draftDesignList.length; i++) { + const id = that.draftDesignList[i].id + const l = that.draftDesignList[i].label + if (!id) { + message.error(`第${i + 1}行设计稿不能为空`) + return; + } + if (!l) { + message.error(`第${i + 1}行风格名称不能为空`) + return; + } + const key = `${id}_${l}` + if (countInfo[key]) { + message.error(`${l} 行重复`) + return; + } + countInfo[key] = 1; + ids.push(id); } - if (!l) { - message.error(`第${i + 1}行风格名称不能为空`) - return; - } - const key = `${id}_${l}` - if (countInfo[key]) { - message.error(`${l} 行重复`) - return; - } - countInfo[key] = 1; - ids.push(id); } + } + const data = formData.value; if (that.updateProcess) { // 校验工艺流程 @@ -536,7 +542,7 @@ const resetForm = () => { brandId: that.brandId || '', productTypeId: '', draftDesignDataId: undefined, - draftDesignList: '', + draftDesignList: [], enabled: true, remark: undefined, details: undefined,