|
|
@ -304,17 +304,17 @@ export default { |
|
|
const o = allFieldsConfig[key]; |
|
|
const o = allFieldsConfig[key]; |
|
|
if (o.otherCode) {//
|
|
|
if (o.otherCode) {//
|
|
|
if (o.type === "select") { |
|
|
if (o.type === "select") { |
|
|
const isSelectedOther = this.isShowOther(formFields[key]); |
|
|
|
|
|
|
|
|
const isSelectedOther = this.isShowOther(formFields[key],o); |
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
formFields[o.otherCode] = ""; |
|
|
formFields[o.otherCode] = ""; |
|
|
} |
|
|
} |
|
|
} else if (o.subType === "select") { |
|
|
} else if (o.subType === "select") { |
|
|
const isSelectedOther = this.isShowOther(formFields[o.subKey]); |
|
|
|
|
|
|
|
|
const isSelectedOther = this.isShowOther(formFields[o.subKey],o); |
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
formFields[o.otherCode] = ""; |
|
|
formFields[o.otherCode] = ""; |
|
|
} |
|
|
} |
|
|
} else if (o.type === "radioAndOther") { |
|
|
} else if (o.type === "radioAndOther") { |
|
|
const isSelectedOther = this.isShowOtherByRadioAndOther(formFields[key]); |
|
|
|
|
|
|
|
|
const isSelectedOther = this.isShowOtherByRadioAndOther(formFields[key],o); |
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
if (!isSelectedOther) {//如果其他选项没有被选择,清空其他字段
|
|
|
formFields[o.otherCode] = ""; |
|
|
formFields[o.otherCode] = ""; |
|
|
} |
|
|
} |
|
|
@ -377,8 +377,6 @@ export default { |
|
|
//再筛选出需要显示其他输入框的选项
|
|
|
//再筛选出需要显示其他输入框的选项
|
|
|
const otherOptions = allCheckedOptions.filter((label)=>isShowOtherByCheckboxTree(label)) |
|
|
const otherOptions = allCheckedOptions.filter((label)=>isShowOtherByCheckboxTree(label)) |
|
|
const isHasOtherInfo = otherOptions.every(item => otherValues[item]); |
|
|
const isHasOtherInfo = otherOptions.every(item => otherValues[item]); |
|
|
console.log(otherOptions,allCheckedOptions,isHasOtherInfo,"otherOptions") |
|
|
|
|
|
console.log(o,checkedValues,otherValues,options,isChecked,"checkboxTreeValue") |
|
|
|
|
|
if (!isChecked || !isHasOtherInfo) { |
|
|
if (!isChecked || !isHasOtherInfo) { |
|
|
errors.push({ |
|
|
errors.push({ |
|
|
field: key, |
|
|
field: key, |
|
|
@ -388,15 +386,36 @@ export default { |
|
|
this.$set(this.errors, key, true); |
|
|
this.$set(this.errors, key, true); |
|
|
} |
|
|
} |
|
|
continue |
|
|
continue |
|
|
|
|
|
}else if(o.type === "radioAndOther"&&o.fillType === this.templateFillType){ |
|
|
|
|
|
const radioValue = formFields[key] || {}; |
|
|
|
|
|
const {otherCode} = o; |
|
|
|
|
|
const otherValue = formFields[otherCode] || ""; |
|
|
|
|
|
const isShow = this.isShowOtherByRadioAndOther(radioValue,o) |
|
|
|
|
|
console.log(o,radioValue,isShow,otherValue,"radioValue") |
|
|
|
|
|
if(isShow&&!otherValue){ |
|
|
|
|
|
errors.push({ |
|
|
|
|
|
field: key, |
|
|
|
|
|
label: o.label, |
|
|
|
|
|
error: "请输入信息" |
|
|
|
|
|
}); |
|
|
|
|
|
this.$set(this.errors, key, true); |
|
|
|
|
|
} |
|
|
|
|
|
// if (!radioValue) {
|
|
|
|
|
|
// errors.push({
|
|
|
|
|
|
// field: key,
|
|
|
|
|
|
// label: o.label,
|
|
|
|
|
|
// error: "请选择方法学验证"
|
|
|
|
|
|
// });
|
|
|
|
|
|
// this.$set(this.errors, key, true);
|
|
|
|
|
|
// }
|
|
|
|
|
|
continue |
|
|
} |
|
|
} |
|
|
if (isValueEmpty(formFields[key])) { |
|
|
if (isValueEmpty(formFields[key])) { |
|
|
// 其他字段需要判断是否显示再校验
|
|
|
// 其他字段需要判断是否显示再校验
|
|
|
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])) { |
|
|
|
|
|
|
|
|
if (o.label === "template.common.other" && !this.isShowOther(formFields[o.parentKey])) { |
|
|
continue |
|
|
continue |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//span的字段不校验
|
|
|
//span的字段不校验
|
|
|
if (o.type === "span" || o.type === "text" || o.type === "button") { |
|
|
if (o.type === "span" || o.type === "text" || o.type === "button") { |
|
|
continue |
|
|
continue |
|
|
@ -460,7 +479,9 @@ export default { |
|
|
onBlur(key, val) { |
|
|
onBlur(key, val) { |
|
|
// compareTo 功能:当fillType==="actFill"时,判断当前值是否与compareTo字段的值一样,如果不一样则将当前input框的背景色标记成橙色
|
|
|
// compareTo 功能:当fillType==="actFill"时,判断当前值是否与compareTo字段的值一样,如果不一样则将当前input框的背景色标记成橙色
|
|
|
this.onValueChangeCompareTo(key, val); |
|
|
this.onValueChangeCompareTo(key, val); |
|
|
|
|
|
|
|
|
|
|
|
if (this.errors[key]) { |
|
|
|
|
|
this.$set(this.errors, key, false); |
|
|
|
|
|
} |
|
|
this.$emit("blur", { key, value: val, ...this.formFields }); |
|
|
this.$emit("blur", { key, value: val, ...this.formFields }); |
|
|
}, |
|
|
}, |
|
|
onValueChangeCompareTo(key, val, compKey) { |
|
|
onValueChangeCompareTo(key, val, compKey) { |
|
|
|