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,