|
|
@ -68,6 +68,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
getRegentItem(item,fieldCode="type"){ |
|
|
getRegentItem(item,fieldCode="type"){ |
|
|
const type = item[fieldCode] ; |
|
|
const type = item[fieldCode] ; |
|
|
|
|
|
console.log(item,"type") |
|
|
return { |
|
|
return { |
|
|
label: "", |
|
|
label: "", |
|
|
type, |
|
|
type, |
|
|
@ -153,6 +154,14 @@ export default { |
|
|
parentLabel: sItem.label, |
|
|
parentLabel: sItem.label, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
getRadioOtherItem(sItem) { |
|
|
|
|
|
return { |
|
|
|
|
|
// label: sItem.otherLabel ? this.$t(sItem.otherLabel) : this.$t("template.common.other"),
|
|
|
|
|
|
fillType: sItem.fillType, |
|
|
|
|
|
maxlength: sItem.otherMaxlength || 50, |
|
|
|
|
|
parentLabel: sItem.label, |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
getClickableItem(sItem) { |
|
|
getClickableItem(sItem) { |
|
|
return { |
|
|
return { |
|
|
label: "", |
|
|
label: "", |
|
|
@ -206,14 +215,14 @@ export default { |
|
|
|
|
|
|
|
|
// 处理特殊字段 - "其他"字段
|
|
|
// 处理特殊字段 - "其他"字段
|
|
|
if (currentConfig.otherCode) { |
|
|
if (currentConfig.otherCode) { |
|
|
const { otherCode } = currentConfig; |
|
|
|
|
|
|
|
|
const { otherCode,type } = currentConfig; |
|
|
//如果是更新的话,优先使用formFields中的值
|
|
|
//如果是更新的话,优先使用formFields中的值
|
|
|
if (update) { |
|
|
if (update) { |
|
|
result[otherCode] = formFields[otherCode] || formData[otherCode] || ''; |
|
|
result[otherCode] = formFields[otherCode] || formData[otherCode] || ''; |
|
|
} else { |
|
|
} else { |
|
|
result[otherCode] = formData[otherCode] || formFields[otherCode] || ''; |
|
|
result[otherCode] = formData[otherCode] || formFields[otherCode] || ''; |
|
|
} |
|
|
} |
|
|
config[otherCode] = { label: "template.common.other", parentKey: key, type: "input", fillType: currentConfig.fillType } |
|
|
|
|
|
|
|
|
config[otherCode] = { label: "template.common.other",parentType:type, parentKey: key, type: "input", fillType: currentConfig.fillType } |
|
|
} |
|
|
} |
|
|
if (currentConfig.subKey) { |
|
|
if (currentConfig.subKey) { |
|
|
const { subKey } = currentConfig; |
|
|
const { subKey } = currentConfig; |
|
|
@ -252,6 +261,7 @@ export default { |
|
|
selectInfoKeys.forEach(key => { |
|
|
selectInfoKeys.forEach(key => { |
|
|
result[key] = formData[key]; |
|
|
result[key] = formData[key]; |
|
|
}) |
|
|
}) |
|
|
|
|
|
console.log(config,"allConfig") |
|
|
// 更新表单字段
|
|
|
// 更新表单字段
|
|
|
this.formFields = result; |
|
|
this.formFields = result; |
|
|
this.allFieldsConfig = config; |
|
|
this.allFieldsConfig = config; |
|
|
@ -302,6 +312,11 @@ export default { |
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
formFields[o.otherCode] = ""; |
|
|
formFields[o.otherCode] = ""; |
|
|
} |
|
|
} |
|
|
|
|
|
}else if(o.type === "radioAndOther"){ |
|
|
|
|
|
const isSelectedOther = this.isShowOtherByRadioAndOther(formFields[key]); |
|
|
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
|
|
|
formFields[o.otherCode] = ""; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -318,7 +333,10 @@ export default { |
|
|
} |
|
|
} |
|
|
if (this.isValueEmpty(formFields[key])) { |
|
|
if (this.isValueEmpty(formFields[key])) { |
|
|
// 其他字段需要判断是否显示再校验
|
|
|
// 其他字段需要判断是否显示再校验
|
|
|
if (o.label === "template.common.other" && !this.isShowOther(formFields[o.parentKey])) { |
|
|
|
|
|
|
|
|
if (o.label === "template.common.other" && !this.isShowOther(formFields[o.parentKey]) && o.parentType !== "radioAndOther") { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
if (o.type === "radioAndOther" &&o.label === "template.common.other" && !this.isShowOtherByRadioAndOther(formFields[o.parentKey])) { |
|
|
continue |
|
|
continue |
|
|
} |
|
|
} |
|
|
//span的字段不校验
|
|
|
//span的字段不校验
|
|
|
|