Browse Source

feat:[模板管理][暂存]

ouqian
luojie 1 month ago
parent
commit
5a1cac9ad7
1 changed files with 62 additions and 52 deletions
  1. +62
    -52
      src/components/Template/CustomTable.vue

+ 62
- 52
src/components/Template/CustomTable.vue View File

@ -110,16 +110,16 @@
</div>
</template>
<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"
:fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex + '_' + tagIndex"
:fieldItemLabel="fieldItemLabel" type="checkboxTag"
:value="tag"
:fieldItemLabel="fieldItemLabel" type="checkboxTag" :value="tag"
:item="getBodyItem(col, rowIndex)"
@change="onCheckboxTagChange(rowIndex, col,tagIndex, $event)"
@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)"/>
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
</div>
</template>
@ -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;
}
</style>

Loading…
Cancel
Save