|
|
@ -110,16 +110,16 @@ |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="col.bodyType === 'checkboxTag'"> |
|
|
<template v-else-if="col.bodyType === 'checkboxTag'"> |
|
|
<div class="flex flex-wrap" :class="{'error-border':hasError(rowIndex, colIndex, col.prop)}"> |
|
|
|
|
|
|
|
|
<div class="flex flex-wrap" |
|
|
|
|
|
:class="{ '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)" |
|
|
|
|
|
|
|
|
@change="onCheckboxTagChange(rowIndex, col, tagIndex, $event)" |
|
|
@deleteTag="onDeleteCheckboxTag(rowIndex, col, tagIndex)" |
|
|
@deleteTag="onDeleteCheckboxTag(rowIndex, col, tagIndex)" |
|
|
:error="hasError(rowIndex, colIndex, col.prop)" |
|
|
:error="hasError(rowIndex, colIndex, col.prop)" |
|
|
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"/> |
|
|
|
|
|
|
|
|
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" /> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</template> |
|
|
</template> |
|
|
@ -319,26 +319,26 @@ export default { |
|
|
unmounted() { |
|
|
unmounted() { |
|
|
this.oldLocalDataSource = []; |
|
|
this.oldLocalDataSource = []; |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
|
|
|
// 删除checkboxTag |
|
|
|
|
|
onDeleteCheckboxTag(rowIndex, col, tagIndex) { |
|
|
|
|
|
this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); |
|
|
|
|
|
this.$emit("onDeleteTag", rowIndex, col,tagIndex); |
|
|
|
|
|
const params = { |
|
|
|
|
|
type: "fieldChanged", |
|
|
|
|
|
newRecord:null, |
|
|
|
|
|
resourceList: null, |
|
|
|
|
|
} |
|
|
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
|
|
}, |
|
|
|
|
|
onCheckboxTagChange(rowIndex, col,tagIndex, value) { |
|
|
|
|
|
this.localDataSource[rowIndex][col.prop][tagIndex] = value; |
|
|
|
|
|
this.$emit("onCheckboxTagChange", rowIndex, col,tagIndex, value) |
|
|
|
|
|
}, |
|
|
|
|
|
handleClickButton(e, data, key, rowIndex, colIndex) { |
|
|
|
|
|
this.$emit("clickButton", key, rowIndex, colIndex, e, data,) |
|
|
|
|
|
}, |
|
|
|
|
|
beforeSaveRecord(data, callback, rowIndex, col, row) { |
|
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
// 删除checkboxTag |
|
|
|
|
|
onDeleteCheckboxTag(rowIndex, col, tagIndex) { |
|
|
|
|
|
this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); |
|
|
|
|
|
this.$emit("onDeleteTag", rowIndex, col, tagIndex); |
|
|
|
|
|
const params = { |
|
|
|
|
|
type: "fieldChanged", |
|
|
|
|
|
newRecord: null, |
|
|
|
|
|
resourceList: null, |
|
|
|
|
|
} |
|
|
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
|
|
}, |
|
|
|
|
|
onCheckboxTagChange(rowIndex, col, tagIndex, value) { |
|
|
|
|
|
this.localDataSource[rowIndex][col.prop][tagIndex] = value; |
|
|
|
|
|
this.$emit("onCheckboxTagChange", rowIndex, col, tagIndex, value) |
|
|
|
|
|
}, |
|
|
|
|
|
handleClickButton(e, data, key, rowIndex, colIndex) { |
|
|
|
|
|
this.$emit("clickButton", key, rowIndex, colIndex, e, data,) |
|
|
|
|
|
}, |
|
|
|
|
|
beforeSaveRecord(data, callback, rowIndex, col, row) { |
|
|
this.$emit("beforeSaveRecord", { inputData: data, callback, rowIndex, key: col.prop, rowData: row, dataSource: this.localDataSource }) |
|
|
this.$emit("beforeSaveRecord", { inputData: data, callback, rowIndex, key: col.prop, rowData: row, dataSource: this.localDataSource }) |
|
|
}, |
|
|
}, |
|
|
getCellWidth(col) { |
|
|
getCellWidth(col) { |
|
|
@ -486,35 +486,43 @@ export default { |
|
|
if (col.bodyFillType === this.templateFillType || col.bodySubFillType === this.templateFillType) { |
|
|
if (col.bodyFillType === this.templateFillType || col.bodySubFillType === this.templateFillType) { |
|
|
// 检查主字段 |
|
|
// 检查主字段 |
|
|
const mainValue = row[col.prop]; |
|
|
const mainValue = row[col.prop]; |
|
|
console.log(mainValue,"mainValue") |
|
|
|
|
|
if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span'&& col.bodyType !== 'button') { |
|
|
|
|
|
const errorItem = { |
|
|
|
|
|
rowIndex, |
|
|
|
|
|
colIndex, |
|
|
|
|
|
field: col.prop, |
|
|
|
|
|
label: this.$t(col.label), |
|
|
|
|
|
error: `请填写${this.$t(col.label)}` |
|
|
|
|
|
}; |
|
|
|
|
|
errors.push(errorItem); |
|
|
|
|
|
this.formErrors.push(errorItem); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (col.bodyType === "checkboxTag") { |
|
|
|
|
|
if(this.templateFillType === "actFill"){ |
|
|
|
|
|
|
|
|
// 检查子字段(如果有) |
|
|
|
|
|
if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span'&&col.bodySubType!=="button") { |
|
|
|
|
|
const subValue = row[col.bodySubKey]; |
|
|
|
|
|
console.log(col, subValue, "subValue") |
|
|
|
|
|
if (this.isValueEmpty(subValue)) { |
|
|
|
|
|
|
|
|
}else if(this.templateFillType === "preFill"){ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') { |
|
|
const errorItem = { |
|
|
const errorItem = { |
|
|
rowIndex, |
|
|
rowIndex, |
|
|
colIndex, |
|
|
colIndex, |
|
|
field: col.bodySubKey, |
|
|
|
|
|
label: `${this.$t(col.label)}单位`, |
|
|
|
|
|
error: `请填写${this.$t(col.label)}单位` |
|
|
|
|
|
|
|
|
field: col.prop, |
|
|
|
|
|
label: this.$t(col.label), |
|
|
|
|
|
error: `请填写${this.$t(col.label)}` |
|
|
}; |
|
|
}; |
|
|
errors.push(errorItem); |
|
|
errors.push(errorItem); |
|
|
this.formErrors.push(errorItem); |
|
|
this.formErrors.push(errorItem); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 检查子字段(如果有) |
|
|
|
|
|
if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span' && col.bodySubType !== "button") { |
|
|
|
|
|
const subValue = row[col.bodySubKey]; |
|
|
|
|
|
console.log(col, subValue, "subValue") |
|
|
|
|
|
if (this.isValueEmpty(subValue)) { |
|
|
|
|
|
const errorItem = { |
|
|
|
|
|
rowIndex, |
|
|
|
|
|
colIndex, |
|
|
|
|
|
field: col.bodySubKey, |
|
|
|
|
|
label: `${this.$t(col.label)}单位`, |
|
|
|
|
|
error: `请填写${this.$t(col.label)}单位` |
|
|
|
|
|
}; |
|
|
|
|
|
errors.push(errorItem); |
|
|
|
|
|
this.formErrors.push(errorItem); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.log(col.otherCode, "col.otherCode") |
|
|
console.log(col.otherCode, "col.otherCode") |
|
|
|
|
|
|
|
|
// 检查其他输入框 |
|
|
// 检查其他输入框 |
|
|
@ -1044,14 +1052,16 @@ export default { |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
width: 100px; |
|
|
width: 100px; |
|
|
} |
|
|
} |
|
|
.flex-wrap{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.flex-wrap { |
|
|
flex-wrap: wrap; |
|
|
flex-wrap: wrap; |
|
|
} |
|
|
} |
|
|
.error-border{ |
|
|
|
|
|
border-color: #ff5d5d ; |
|
|
|
|
|
box-shadow: 0 0 6px #ffc3c3 ; |
|
|
|
|
|
padding: 8px; |
|
|
|
|
|
border-radius: 4px; |
|
|
|
|
|
border: 1px solid; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.error-border { |
|
|
|
|
|
border-color: #ff5d5d; |
|
|
|
|
|
box-shadow: 0 0 6px #ffc3c3; |
|
|
|
|
|
padding: 8px; |
|
|
|
|
|
border-radius: 4px; |
|
|
|
|
|
border: 1px solid; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |