diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index d51aa3d..31b77e6 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -110,16 +110,16 @@ @@ -319,26 +319,26 @@ export default { unmounted() { 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 }) }, getCellWidth(col) { @@ -486,35 +486,43 @@ export default { if (col.bodyFillType === this.templateFillType || col.bodySubFillType === this.templateFillType) { // 检查主字段 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 = { rowIndex, 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); 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") // 检查其他输入框 @@ -1044,14 +1052,16 @@ export default { text-align: center; width: 100px; } -.flex-wrap{ + +.flex-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; } \ No newline at end of file