|
|
@ -14,30 +14,34 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div v-for="(col, colIndex) in columns" :key="colIndex" class="custom-table-cell header-cell" |
|
|
<div v-for="(col, colIndex) in columns" :key="colIndex" class="custom-table-cell header-cell" |
|
|
:style="getCellWidth(col)"> |
|
|
:style="getCellWidth(col)"> |
|
|
<div class="header-cell-content" v-if = "col.headerColumns && col.headerColumns.length > 0"> |
|
|
|
|
|
<div class="header-columns-grid" :style="{ 'grid-template-columns': `repeat(${col.span || 2}, 1fr)` }"> |
|
|
|
|
|
<div v-for="(headerCol, headerIndex) in col.headerColumns" :key="headerIndex" class="header-column-item"> |
|
|
|
|
|
|
|
|
<div class="header-cell-content" v-if="col.headerColumns && col.headerColumns.length > 0"> |
|
|
|
|
|
<div class="header-columns-grid" |
|
|
|
|
|
:style="{ 'grid-template-columns': `repeat(${col.span || 2}, 1fr)` }"> |
|
|
|
|
|
<div v-for="(headerCol, headerIndex) in col.headerColumns" :key="headerIndex" |
|
|
|
|
|
class="header-column-item"> |
|
|
<template v-if="headerCol.type === 'span'"> |
|
|
<template v-if="headerCol.type === 'span'"> |
|
|
<div class="span-content">{{ $t(headerCol.label) }}</div> |
|
|
<div class="span-content">{{ $t(headerCol.label) }}</div> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="headerCol.type === 'sj'"> |
|
|
<template v-else-if="headerCol.type === 'sj'"> |
|
|
<HandleFormItem :fieldKey="prefixKey+colIndex + '_' + headerCol.key + '_' + headerIndex" |
|
|
|
|
|
:fieldItemLabel="fieldItemLabel" :type="headerCol.type" class="body-clickable" |
|
|
|
|
|
sourceFrom="customTable" :item="getHeaderColumnItem(headerCol)" |
|
|
|
|
|
:value="headerFields[`${colIndex}_${headerIndex}`]" |
|
|
|
|
|
@onRegentSubmit="(data, inputValue) => onHeaderRegentSubmit(data, inputValue, colIndex, headerIndex)" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<HandleFormItem |
|
|
|
|
|
:fieldKey="prefixKey + colIndex + '_' + headerCol.key + '_' + headerIndex" |
|
|
|
|
|
:fieldItemLabel="fieldItemLabel" :type="headerCol.type" |
|
|
|
|
|
class="body-clickable" sourceFrom="customTable" |
|
|
|
|
|
:item="getHeaderColumnItem(headerCol)" |
|
|
|
|
|
:value="headerFields[`${colIndex}_${headerIndex}`]" |
|
|
|
|
|
:error="hasHeaderError(colIndex, headerIndex, headerCol.key)" |
|
|
|
|
|
@update:error="onHeaderColumnErrorUpdate(colIndex, headerIndex, headerCol.key, $event)" |
|
|
|
|
|
@onRegentSubmit="(data, inputValue) => onHeaderRegentSubmit(data, inputValue, colIndex, headerIndex)" /> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="headerCol.type === 'input' || headerCol.type === 'select'"> |
|
|
<template v-else-if="headerCol.type === 'input' || headerCol.type === 'select'"> |
|
|
<HandleFormItem |
|
|
|
|
|
|
|
|
<HandleFormItem |
|
|
:fieldKey="prefixKey + '_header_' + colIndex + '_' + headerIndex" |
|
|
:fieldKey="prefixKey + '_header_' + colIndex + '_' + headerIndex" |
|
|
:fieldItemLabel="fieldItemLabel" |
|
|
|
|
|
:type="headerCol.type" |
|
|
|
|
|
|
|
|
:fieldItemLabel="fieldItemLabel" :type="headerCol.type" |
|
|
:item="getHeaderColumnItem(headerCol)" |
|
|
:item="getHeaderColumnItem(headerCol)" |
|
|
v-model="headerFields[`${colIndex}_${headerIndex}`]" |
|
|
v-model="headerFields[`${colIndex}_${headerIndex}`]" |
|
|
@change="onHeaderColumnChange(colIndex, headerIndex, headerCol, $event)" |
|
|
@change="onHeaderColumnChange(colIndex, headerIndex, headerCol, $event)" |
|
|
:error="hasHeaderError(colIndex, headerIndex, `${colIndex}_${headerIndex}`)" |
|
|
|
|
|
@update:error="onHeaderColumnErrorUpdate(colIndex, headerIndex, `${colIndex}_${headerIndex}`, $event)" /> |
|
|
|
|
|
|
|
|
:error="hasHeaderError(colIndex, headerIndex, headerCol.key)" |
|
|
|
|
|
@update:error="onHeaderColumnErrorUpdate(colIndex, headerIndex, headerCol.key, $event)" /> |
|
|
</template> |
|
|
</template> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -231,7 +235,7 @@ import HandleFormItem from "./HandleFormItem.vue"; |
|
|
import { isEqual } from "@/utils/index.js"; |
|
|
import { isEqual } from "@/utils/index.js"; |
|
|
import { isShowOther } from "@/utils/formPackageCommon.js"; |
|
|
import { isShowOther } from "@/utils/formPackageCommon.js"; |
|
|
import { EventBus } from "@/utils/eventBus"; |
|
|
import { EventBus } from "@/utils/eventBus"; |
|
|
import { getuuid,justUpdateFilledFormData } from "@/utils/index.js"; |
|
|
|
|
|
|
|
|
import { getuuid, justUpdateFilledFormData } from "@/utils/index.js"; |
|
|
import { isRegent } from "@/utils/index.js"; |
|
|
import { isRegent } from "@/utils/index.js"; |
|
|
import { isValueEmpty } from '@/utils/index.js'; |
|
|
import { isValueEmpty } from '@/utils/index.js'; |
|
|
|
|
|
|
|
|
@ -355,24 +359,25 @@ export default { |
|
|
options: headerCol.options, |
|
|
options: headerCol.options, |
|
|
maxlength: headerCol.maxlength, |
|
|
maxlength: headerCol.maxlength, |
|
|
checkType: headerCol.checkType, |
|
|
checkType: headerCol.checkType, |
|
|
regentFillType: headerCol.regentFillType, |
|
|
|
|
|
type:headerCol.type, |
|
|
|
|
|
|
|
|
regentFillType: headerCol.regentFillType, |
|
|
|
|
|
type: headerCol.type, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onHeaderColumnChange(colIndex, headerIndex, headerCol, value) { |
|
|
onHeaderColumnChange(colIndex, headerIndex, headerCol, value) { |
|
|
const fieldKey = `${colIndex}_${headerIndex}`; |
|
|
const fieldKey = `${colIndex}_${headerIndex}`; |
|
|
this.headerFields[fieldKey] = value; |
|
|
this.headerFields[fieldKey] = value; |
|
|
this.$emit('headerColumnChange', { |
|
|
|
|
|
|
|
|
this.$emit('headerColumnChange', { |
|
|
colIndex, |
|
|
colIndex, |
|
|
headerIndex, |
|
|
headerIndex, |
|
|
key: fieldKey, |
|
|
|
|
|
value, |
|
|
|
|
|
headerFields: this.headerFields |
|
|
|
|
|
|
|
|
key: fieldKey, |
|
|
|
|
|
value, |
|
|
|
|
|
headerFields: this.headerFields |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
hasHeaderError(colIndex, headerIndex, key) { |
|
|
hasHeaderError(colIndex, headerIndex, key) { |
|
|
|
|
|
console.log(colIndex, headerIndex, key,this.formErrors,"headerError") |
|
|
return this.formErrors.some(error => |
|
|
return this.formErrors.some(error => |
|
|
error.rowIndex === -1 && |
|
|
error.rowIndex === -1 && |
|
|
error.colIndex === colIndex && |
|
|
error.colIndex === colIndex && |
|
|
@ -484,7 +489,9 @@ export default { |
|
|
}, |
|
|
}, |
|
|
onHeaderRegentSubmit(data, inputValue, colIndex, headerIndex) { |
|
|
onHeaderRegentSubmit(data, inputValue, colIndex, headerIndex) { |
|
|
this.headerFields[`${colIndex}_${headerIndex}`] = inputValue; |
|
|
this.headerFields[`${colIndex}_${headerIndex}`] = inputValue; |
|
|
this.$emit("onHeaderRegentSubmit", { selectInfo: data, key: col.prop, col, rowIndex, colIndex, rowData: row }) |
|
|
|
|
|
|
|
|
console.log("onHeaderRegentSubmit", data, inputValue, colIndex, headerIndex,this.headerFields) |
|
|
|
|
|
|
|
|
|
|
|
this.$emit("onHeaderRegentSubmit", { selectInfo: data, headerIndex, colIndex, headerFields: this.headerFields }) |
|
|
}, |
|
|
}, |
|
|
onRegentSubmit(data, inputValue, col, rowIndex, colIndex, row) { |
|
|
onRegentSubmit(data, inputValue, col, rowIndex, colIndex, row) { |
|
|
// if (this.templateFillType !== 'actFill') { |
|
|
// if (this.templateFillType !== 'actFill') { |
|
|
@ -558,6 +565,7 @@ export default { |
|
|
|
|
|
|
|
|
// 校验表头的 HandleFormItem |
|
|
// 校验表头的 HandleFormItem |
|
|
this.columns.forEach((col, colIndex) => { |
|
|
this.columns.forEach((col, colIndex) => { |
|
|
|
|
|
console.log(col.headerColumns, col, "ttt") |
|
|
if (col.headerSelectKey && col.headerOptions && col.fillType === this.templateFillType) { |
|
|
if (col.headerSelectKey && col.headerOptions && col.fillType === this.templateFillType) { |
|
|
const headerValue = this.headerSelectFields[col.headerSelectKey]; |
|
|
const headerValue = this.headerSelectFields[col.headerSelectKey]; |
|
|
if (isValueEmpty(headerValue)) { |
|
|
if (isValueEmpty(headerValue)) { |
|
|
@ -571,6 +579,26 @@ export default { |
|
|
errors.push(errorItem); |
|
|
errors.push(errorItem); |
|
|
this.formErrors.push(errorItem); |
|
|
this.formErrors.push(errorItem); |
|
|
} |
|
|
} |
|
|
|
|
|
} else if (col.headerColumns && col.headerColumns.length > 0) { |
|
|
|
|
|
col.headerColumns.forEach((headerCol, headerColIndex) => { |
|
|
|
|
|
const headerValue = this.headerFields[`${colIndex}_${headerColIndex}`]; |
|
|
|
|
|
if (headerCol.fillType === this.templateFillType) { |
|
|
|
|
|
if (isValueEmpty(headerValue) && headerCol.type !== "span") { |
|
|
|
|
|
const errorItem = { |
|
|
|
|
|
rowIndex: -1, // 表头特殊标记 |
|
|
|
|
|
colIndex, |
|
|
|
|
|
field: headerCol.key, |
|
|
|
|
|
label: this.$t(headerCol.label), |
|
|
|
|
|
headerIndex: headerColIndex, |
|
|
|
|
|
error: `请选择${this.$t(headerCol.label)}` |
|
|
|
|
|
}; |
|
|
|
|
|
errors.push(errorItem); |
|
|
|
|
|
this.formErrors.push(errorItem); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -1293,6 +1321,7 @@ export default { |
|
|
.c-cell { |
|
|
.c-cell { |
|
|
width: 50px; |
|
|
width: 50px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.span-content { |
|
|
.span-content { |
|
|
width: -webkit-fill-available; |
|
|
width: -webkit-fill-available; |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
|