|
|
@ -111,15 +111,13 @@ |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="col.bodyType === 'checkboxTag'"> |
|
|
<template v-else-if="col.bodyType === 'checkboxTag'"> |
|
|
<div class="flex flex-wrap" |
|
|
<div class="flex flex-wrap" |
|
|
:class="{ 'error-border': hasError(rowIndex, colIndex, col.prop) }"> |
|
|
|
|
|
|
|
|
:class="{ 'row-error-border': hasError(rowIndex, colIndex, col.prop) }"> |
|
|
<HandleFormItem v-for="(tag, tagIndex) in row[col.prop]" :key="tagIndex" |
|
|
<HandleFormItem v-for="(tag, tagIndex) in row[col.prop]" :key="tagIndex" |
|
|
:fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex + '_' + tagIndex" |
|
|
:fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex + '_' + tagIndex" |
|
|
:fieldItemLabel="fieldItemLabel" type="checkboxTag" :value="tag" |
|
|
:fieldItemLabel="fieldItemLabel" type="checkboxTag" :value="tag" |
|
|
:item="getBodyItem(col, rowIndex)" |
|
|
:item="getBodyItem(col, rowIndex)" |
|
|
@change="onCheckboxTagChange(rowIndex, col, tagIndex, $event)" |
|
|
|
|
|
@deleteTag="onDeleteCheckboxTag(rowIndex, col, tagIndex)" |
|
|
|
|
|
:error="hasError(rowIndex, colIndex, col.prop)" |
|
|
|
|
|
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" /> |
|
|
|
|
|
|
|
|
@change="onCheckboxTagChange(rowIndex, colIndex,col, tagIndex, $event)" |
|
|
|
|
|
@deleteTag="onDeleteCheckboxTag(rowIndex, col, tagIndex)" /> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</template> |
|
|
</template> |
|
|
@ -324,15 +322,11 @@ export default { |
|
|
onDeleteCheckboxTag(rowIndex, col, tagIndex) { |
|
|
onDeleteCheckboxTag(rowIndex, col, tagIndex) { |
|
|
this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); |
|
|
this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); |
|
|
this.$emit("onDeleteTag", rowIndex, col, tagIndex); |
|
|
this.$emit("onDeleteTag", rowIndex, col, tagIndex); |
|
|
const params = { |
|
|
|
|
|
type: "fieldChanged", |
|
|
|
|
|
newRecord: null, |
|
|
|
|
|
resourceList: null, |
|
|
|
|
|
} |
|
|
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
|
|
|
|
|
this.justUpdateFilledFormData(); |
|
|
}, |
|
|
}, |
|
|
onCheckboxTagChange(rowIndex, col, tagIndex, value) { |
|
|
|
|
|
|
|
|
onCheckboxTagChange(rowIndex, colIndex, col, tagIndex, value) { |
|
|
this.localDataSource[rowIndex][col.prop][tagIndex] = value; |
|
|
this.localDataSource[rowIndex][col.prop][tagIndex] = value; |
|
|
|
|
|
this.onErrorUpdate(rowIndex, colIndex, col.prop, value?false:true); |
|
|
this.$emit("onCheckboxTagChange", rowIndex, col, tagIndex, value) |
|
|
this.$emit("onCheckboxTagChange", rowIndex, col, tagIndex, value) |
|
|
}, |
|
|
}, |
|
|
handleClickButton(e, data, key, rowIndex, colIndex) { |
|
|
handleClickButton(e, data, key, rowIndex, colIndex) { |
|
|
@ -487,10 +481,35 @@ export default { |
|
|
// 检查主字段 |
|
|
// 检查主字段 |
|
|
const mainValue = row[col.prop]; |
|
|
const mainValue = row[col.prop]; |
|
|
if (col.bodyType === "checkboxTag") { |
|
|
if (col.bodyType === "checkboxTag") { |
|
|
if(this.templateFillType === "actFill"){ |
|
|
|
|
|
|
|
|
|
|
|
}else if(this.templateFillType === "preFill"){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// checkboxTag类型的校验逻辑 |
|
|
|
|
|
if (this.templateFillType === "actFill") { |
|
|
|
|
|
// actFill时,检查是否有checked为true的项 |
|
|
|
|
|
const hasChecked = mainValue && mainValue.some(tag => tag.checked === true); |
|
|
|
|
|
if (!hasChecked && !col.bodyDisabled) { |
|
|
|
|
|
const errorItem = { |
|
|
|
|
|
rowIndex, |
|
|
|
|
|
colIndex, |
|
|
|
|
|
field: col.prop, |
|
|
|
|
|
label: this.$t(col.label), |
|
|
|
|
|
error: `请勾选${this.$t(col.label)}` |
|
|
|
|
|
}; |
|
|
|
|
|
errors.push(errorItem); |
|
|
|
|
|
this.formErrors.push(errorItem); |
|
|
|
|
|
} |
|
|
|
|
|
} else if (this.templateFillType === "preFill") { |
|
|
|
|
|
// preFill时,检查所有tagValue是否不为空 |
|
|
|
|
|
const allTagValuesFilled = mainValue && mainValue.every(tag => tag.tagValue && tag.tagValue.trim() !== ''); |
|
|
|
|
|
if (!allTagValuesFilled && !col.bodyDisabled) { |
|
|
|
|
|
const errorItem = { |
|
|
|
|
|
rowIndex, |
|
|
|
|
|
colIndex, |
|
|
|
|
|
field: col.prop, |
|
|
|
|
|
label: this.$t(col.label), |
|
|
|
|
|
error: `请填写${this.$t(col.label)}` |
|
|
|
|
|
}; |
|
|
|
|
|
errors.push(errorItem); |
|
|
|
|
|
this.formErrors.push(errorItem); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') { |
|
|
if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') { |
|
|
@ -761,6 +780,15 @@ export default { |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 只是更新已填写的表单数据,不触发校验 |
|
|
|
|
|
justUpdateFilledFormData(){ |
|
|
|
|
|
const params = { |
|
|
|
|
|
type: "fieldChanged", |
|
|
|
|
|
newRecord: null, |
|
|
|
|
|
resourceList: null, |
|
|
|
|
|
} |
|
|
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
|
|
}, |
|
|
onAddRow() { |
|
|
onAddRow() { |
|
|
if (this.$listeners && this.$listeners['onAddRow']) { |
|
|
if (this.$listeners && this.$listeners['onAddRow']) { |
|
|
this.$emit('onAddRow'); |
|
|
this.$emit('onAddRow'); |
|
|
@ -772,6 +800,7 @@ export default { |
|
|
targetDiluentVolumePrecision: 3,//小数点精度默认为3 |
|
|
targetDiluentVolumePrecision: 3,//小数点精度默认为3 |
|
|
targetStartSolutionVolumePrecision: 3,//小数点精度默认为3 |
|
|
targetStartSolutionVolumePrecision: 3,//小数点精度默认为3 |
|
|
}); |
|
|
}); |
|
|
|
|
|
this.justUpdateFilledFormData() |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 添加行 |
|
|
// 添加行 |
|
|
@ -1055,13 +1084,13 @@ export default { |
|
|
|
|
|
|
|
|
.flex-wrap { |
|
|
.flex-wrap { |
|
|
flex-wrap: wrap; |
|
|
flex-wrap: wrap; |
|
|
|
|
|
gap:10px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.error-border { |
|
|
|
|
|
border-color: #ff5d5d; |
|
|
|
|
|
|
|
|
.row-error-border { |
|
|
box-shadow: 0 0 6px #ffc3c3; |
|
|
box-shadow: 0 0 6px #ffc3c3; |
|
|
padding: 8px; |
|
|
padding: 8px; |
|
|
border-radius: 4px; |
|
|
border-radius: 4px; |
|
|
border: 1px solid; |
|
|
|
|
|
|
|
|
border: 1px solid #ff5d5d; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |