优化 没有选择模板时设置默认类型

This commit is contained in:
YuanFeng 2024-11-29 22:13:23 +08:00
parent e91dcc5788
commit 116e703093
1 changed files with 29 additions and 23 deletions

View File

@ -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,