Browse Source

feat:[模板管理][update]

lkf
luojie 3 months ago
parent
commit
7223acb687
1 changed files with 26 additions and 18 deletions
  1. +26
    -18
      src/components/Template/CustomTable.vue

+ 26
- 18
src/components/Template/CustomTable.vue View File

@ -63,17 +63,7 @@
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
<div v-show="isShowOther(row[col.prop])" class="flex flex1">
<div class="other-title">{{ col.otherLabel ? $t(col.otherLabel) : $t("template.common.other") }}
</div>
<div class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + col.otherCode"
@blur="onBlur(rowIndex, col.prop, $event)" :item="getOtherItem(col)" v-model="row[col.otherCode]"
:error="hasError(rowIndex, colIndex, col.otherCode)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.otherCode, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.otherCode)" />
</div>
</div>
</div>
</template>
@ -89,8 +79,20 @@
<template v-else>
{{ row[col.prop] }}
</template>
</div>
<div v-show="isShowOther(row[col.prop])" class="flex flex1">
<div class="other-title">{{ col.otherLabel ? $t(col.otherLabel) : $t("template.common.other") }}
</div>
<div class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + col.otherCode"
@blur="onBlur(rowIndex, col.prop, $event)" :item="getOtherItem(col)" v-model="row[col.otherCode]"
:error="hasError(rowIndex, colIndex, col.otherCode)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.otherCode, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.otherCode)" />
</div>
</div>
<div class="m-l-5 flex1" v-if="isShowBodySub(col,row)">
<div class="m-l-5 flex1" v-if="isShowBodySub(col, row)">
<template v-if="col.bodySubType === 'inputNumber'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="inputNumber"
@ -111,7 +113,7 @@
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
</template>
<template v-else-if = "col.bodySubType === 'span'">
<template v-else-if="col.bodySubType === 'span'">
{{ row[col.bodySubKey] }}
</template>
</div>
@ -228,7 +230,7 @@ export default {
fillType: sItem.bodyFillType,
maxlength: sItem.otherMaxlength || 50,
parentLabel: sItem.label,
type:"input"
type: "input"
}
},
//
@ -238,10 +240,10 @@ export default {
//value
return arr.some(item => item < 0);
},
isShowBodySub(col,row) {
isShowBodySub(col, row) {
if (col.hasOwnProperty("disabled")) {
return col.showBodySub
}else if(col.bodySubType === 'span'&&!row[col.bodySubKey]){//span
} else if (col.bodySubType === 'span' && !row[col.bodySubKey]) {//span
return false;
}
return col.bodySubType && col.bodySubKey;
@ -369,10 +371,15 @@ export default {
this.formErrors.push(errorItem);
}
}
console.log(col.otherCode, "col.otherCode")
//
if (col.otherCode && col.bodySubType !== 'span') {
if (col.otherCode) {
const isSelectedOther = this.isShowOther(mainValue);
if (!isSelectedOther) {
return;
}
const otherValue = row[col.otherCode];
if (this.isValueEmpty(otherValue)) {
const errorItem = {
rowIndex,
@ -736,5 +743,6 @@ export default {
font-size: 14px;
font-weight: normal;
color: #606266;
width: auto;
}
</style>

Loading…
Cancel
Save