Browse Source

feat:[模板管理][update]

ouqian
luojie 1 month ago
parent
commit
ab2429ca59
3 changed files with 53 additions and 25 deletions
  1. +51
    -22
      src/components/Template/CustomTable.vue
  2. +1
    -1
      src/components/Template/HandleFormItem.vue
  3. +1
    -2
      src/views/business/comps/template/comps/dl/DL006.vue

+ 51
- 22
src/components/Template/CustomTable.vue View File

@ -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;

+ 1
- 1
src/components/Template/HandleFormItem.vue View File

@ -1802,7 +1802,7 @@ export default {
font-weight: normal; font-weight: normal;
color: #606266; color: #606266;
flex: 1; flex: 1;
background-color: #fff;
&.disabled { &.disabled {
cursor: not-allowed; cursor: not-allowed;
color: #c0c4cc; color: #c0c4cc;

+ 1
- 2
src/views/business/comps/template/comps/dl/DL006.vue View File

@ -91,7 +91,6 @@ import moment from 'moment'
const refConf = { const refConf = {
base: 'baseInfoRef', base: 'baseInfoRef',
czInfo: 'czInfoRef', czInfo: 'czInfoRef',
gyzj: 'gyzjTableRef',
remark: 'remarkRef', remark: 'remarkRef',
jzjz: 'jlzpzxxTableRef', jzjz: 'jlzpzxxTableRef',
bz: 'stepRef', bz: 'stepRef',
@ -139,7 +138,7 @@ export default {
{ {
type:"sj", type:"sj",
fillType: 'preFill', fillType: 'preFill',
key:"bh"
key:"bh",
}, },
{ {
type: 'input', type: 'input',

Loading…
Cancel
Save