|
|
|
@ -260,7 +260,7 @@ export default { |
|
|
|
} |
|
|
|
config[subKey] = { label: currentConfig.label, subKey, type: currentConfig.subType, fillType: currentConfig.subFillType || currentConfig.fillType, selectTo: currentConfig.selectTo } |
|
|
|
} |
|
|
|
if(currentConfig.thirdKey){ |
|
|
|
if (currentConfig.thirdKey) { |
|
|
|
const { thirdKey } = currentConfig; |
|
|
|
if (update) { |
|
|
|
result[thirdKey] = formFields[thirdKey] || formData[thirdKey] || ''; |
|
|
|
@ -269,7 +269,7 @@ export default { |
|
|
|
} |
|
|
|
config[thirdKey] = { label: currentConfig.label, thirdKey, type: currentConfig.thirdType, fillType: currentConfig.thirdFillType, selectTo: currentConfig.selectTo } |
|
|
|
} |
|
|
|
if(currentConfig.fourthKey){ |
|
|
|
if (currentConfig.fourthKey) { |
|
|
|
const { fourthKey } = currentConfig; |
|
|
|
if (update) { |
|
|
|
result[fourthKey] = formFields[fourthKey] || formData[fourthKey] || ''; |
|
|
|
@ -293,6 +293,12 @@ export default { |
|
|
|
this.compareFieldsIsEqual(currentValue, compareToValue, currentConfig.subKey) |
|
|
|
|
|
|
|
} |
|
|
|
if (currentConfig.otherCodeCompareTo && formData[currentConfig.otherCodeCompareTo] && result[currentConfig.otherCode]) { |
|
|
|
const compareToValue = formData[currentConfig.otherCodeCompareTo]; |
|
|
|
const currentValue = result[currentConfig.otherCode]; |
|
|
|
this.compareFieldsIsEqual(currentValue, compareToValue, currentConfig.otherCode) |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// 处理可能存在的直接otherCode字段
|
|
|
|
@ -350,24 +356,24 @@ export default { |
|
|
|
const o = allFieldsConfig[key]; |
|
|
|
if (o.otherCode) {//
|
|
|
|
if (o.type === "select") { |
|
|
|
const isSelectedOther = this.isShowOther(formFields[key],o); |
|
|
|
const isSelectedOther = this.isShowOther(formFields[key], o); |
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
|
formFields[o.otherCode] = ""; |
|
|
|
} |
|
|
|
} else if (o.subType === "select") { |
|
|
|
const isSelectedOther = this.isShowOther(formFields[o.subKey],o); |
|
|
|
const isSelectedOther = this.isShowOther(formFields[o.subKey], o); |
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
|
formFields[o.otherCode] = ""; |
|
|
|
} |
|
|
|
} else if (o.type === "radioAndOther") { |
|
|
|
const isSelectedOther = this.isShowOtherByRadioAndOther(formFields[key],o); |
|
|
|
const isSelectedOther = this.isShowOtherByRadioAndOther(formFields[key], o); |
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
|
formFields[o.otherCode] = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (o.type === "attachment"&&o.fillType === this.templateFillType) { |
|
|
|
if (o.type === "attachment" && o.fillType === this.templateFillType) { |
|
|
|
const attValue = formFields[key]; |
|
|
|
if (!attValue || attValue == "[]") { |
|
|
|
errors.push({ |
|
|
|
@ -377,9 +383,9 @@ export default { |
|
|
|
}); |
|
|
|
this.$set(this.errors, key, true); |
|
|
|
} |
|
|
|
} else if (o.type === "fqyq" &&o.fillType === this.templateFillType) { |
|
|
|
} else if (o.type === "fqyq" && o.fillType === this.templateFillType) { |
|
|
|
const fqyqValue = formFields[key] || {}; |
|
|
|
const {mainRadio, subRadio,inputValue} = fqyqValue; |
|
|
|
const { mainRadio, subRadio, inputValue } = fqyqValue; |
|
|
|
if (!mainRadio) { |
|
|
|
errors.push({ |
|
|
|
field: key, |
|
|
|
@ -388,7 +394,7 @@ export default { |
|
|
|
}); |
|
|
|
this.$set(this.errors, key, true); |
|
|
|
} else { |
|
|
|
if (mainRadio==="是") { |
|
|
|
if (mainRadio === "是") { |
|
|
|
if (!subRadio) { |
|
|
|
errors.push({ |
|
|
|
field: key, |
|
|
|
@ -396,7 +402,7 @@ export default { |
|
|
|
error: "请选择是否在规定时间完成" |
|
|
|
}); |
|
|
|
this.$set(this.errors, key, true); |
|
|
|
}else if(!inputValue){ |
|
|
|
} else if (!inputValue) { |
|
|
|
errors.push({ |
|
|
|
field: key, |
|
|
|
label: o.label, |
|
|
|
@ -408,10 +414,10 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
continue |
|
|
|
}else if(o.type === "checkboxTree"&&o.fillType === this.templateFillType){ |
|
|
|
} else if (o.type === "checkboxTree" && o.fillType === this.templateFillType) { |
|
|
|
const checkboxTreeValue = formFields[key] || {}; |
|
|
|
const {checkedValues=[],otherValues = {}} = checkboxTreeValue;; |
|
|
|
const {options = []} = o; |
|
|
|
const { checkedValues = [], otherValues = {} } = checkboxTreeValue;; |
|
|
|
const { options = [] } = o; |
|
|
|
//需要校验第一层是否有选中项
|
|
|
|
const parentOptions = options.map(item => item.label); |
|
|
|
const isChecked = checkedValues.some(option => { |
|
|
|
@ -420,9 +426,9 @@ export default { |
|
|
|
//获取所有选中的选项
|
|
|
|
const allCheckedOptions = checkedValues.filter(item => item.checked).map(item => item.label); |
|
|
|
//再筛选出需要显示其他输入框的选项
|
|
|
|
const otherOptions = allCheckedOptions.filter((label)=>isShowOtherByCheckboxTree(label)) |
|
|
|
const otherOptions = allCheckedOptions.filter((label) => isShowOtherByCheckboxTree(label)) |
|
|
|
const isHasOtherInfo = otherOptions.every(item => otherValues[item]); |
|
|
|
console.log(isChecked,isHasOtherInfo,"isChecked") |
|
|
|
console.log(isChecked, isHasOtherInfo, "isChecked") |
|
|
|
if (!isChecked || !isHasOtherInfo) { |
|
|
|
errors.push({ |
|
|
|
field: key, |
|
|
|
@ -432,12 +438,12 @@ export default { |
|
|
|
this.$set(this.errors, key, true); |
|
|
|
} |
|
|
|
continue |
|
|
|
}else if(o.type === "radioAndOther"&&o.fillType === this.templateFillType){ |
|
|
|
} else if (o.type === "radioAndOther" && o.fillType === this.templateFillType) { |
|
|
|
const radioValue = formFields[key] || {}; |
|
|
|
const {otherCode} = o; |
|
|
|
const { otherCode } = o; |
|
|
|
const otherValue = formFields[otherCode] || ""; |
|
|
|
const isShow = this.isShowOtherByRadioAndOther(radioValue,o) |
|
|
|
if(isShow&&!otherValue){ |
|
|
|
const isShow = this.isShowOtherByRadioAndOther(radioValue, o) |
|
|
|
if (isShow && !otherValue) { |
|
|
|
errors.push({ |
|
|
|
field: key, |
|
|
|
label: o.label, |
|
|
|
@ -460,7 +466,7 @@ export default { |
|
|
|
if (o.label === "template.common.other" && !this.isShowOther(formFields[o.parentKey])) { |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//span的字段不校验
|
|
|
|
if (o.type === "span" || o.type === "text" || o.type === "button") { |
|
|
|
continue |
|
|
|
@ -532,10 +538,23 @@ export default { |
|
|
|
onValueChangeCompareTo(key, val, compKey) { |
|
|
|
// compareTo 功能:当fillType==="actFill"时,判断当前值是否与compareTo字段的值一样,如果不一样则将当前input框的背景色标记成橙色
|
|
|
|
const currentFieldConfig = this.allFieldsConfig[key]; |
|
|
|
if (currentFieldConfig && currentFieldConfig.fillType === "actFill" && (currentFieldConfig.compareTo || compKey)) { |
|
|
|
const compareToKey = compKey || currentFieldConfig.compareTo; |
|
|
|
const compareToValue = this.formFields[compareToKey]; |
|
|
|
this.compareFieldsIsEqual(val, compareToValue, key); |
|
|
|
if (currentFieldConfig && currentFieldConfig.fillType === "actFill") { |
|
|
|
if ((currentFieldConfig.compareTo || compKey)) { |
|
|
|
const compareToKey = compKey || currentFieldConfig.compareTo; |
|
|
|
const compareToValue = this.formFields[compareToKey]; |
|
|
|
this.compareFieldsIsEqual(val, compareToValue, key); |
|
|
|
} |
|
|
|
if (currentFieldConfig.otherCodeCompareTo && this.formFields[currentFieldConfig.otherCodeCompareTo] && this.formFields[currentFieldConfig.otherCode]) { |
|
|
|
const compareToValue = this.formFields[currentFieldConfig.otherCodeCompareTo]; |
|
|
|
const currentValue = this.formFields[currentFieldConfig.otherCode]; |
|
|
|
this.compareFieldsIsEqual(currentValue, compareToValue, currentFieldConfig.otherCode) |
|
|
|
} |
|
|
|
if(currentFieldConfig.subCompareTo && this.formFields[currentFieldConfig.subCompareTo] && this.formFields[currentFieldConfig.subKey]){ |
|
|
|
const compareToValue = this.formFields[currentFieldConfig.subCompareTo]; |
|
|
|
const currentValue = this.formFields[currentFieldConfig.subKey]; |
|
|
|
this.compareFieldsIsEqual(currentValue, compareToValue, currentFieldConfig.subKey) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
onAttachmentChange(key, val) { |
|
|
|
|