Browse Source

feat:[模板管理][update]

ouqian
luojie 1 month ago
parent
commit
fde1811b68
3 changed files with 53 additions and 17 deletions
  1. +11
    -4
      src/components/Template/CustomTable.vue
  2. +5
    -2
      src/components/Template/HandleFormItem.vue
  3. +37
    -11
      src/views/business/comps/template/comps/bl/BL001.vue

+ 11
- 4
src/components/Template/CustomTable.vue View File

@ -108,11 +108,11 @@
</template>
<div v-else-if = "col.bodyType === 'checkboxTree'">
<HandleFormItem
:field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + col.prop"
:type="sItem.type" :item="sItem" :value="row[col.prop]"
:field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + col.prop+ rowIndex"
type="checkboxTree" :item="getBodyItem(col, rowIndex)" :value="row[col.prop]"
@change="(e) => onBodyValueChange(rowIndex, colIndex, e, row, col.bodyType)"
:error="errors[col.prop]" @update:error="errors[col.prop] = false"
:orange-bg="orangeBgFields[col.prop]" />
:error="hasError(rowIndex, colIndex, col.prop)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
</div>
<div v-else-if="col.bodyType === 'operableInput'" class="flex flex1">
<div class="flex1 grid-container">
@ -939,6 +939,13 @@ export default {
item.disabled = false;
}
}
if(col.noBorder){
item.noBorder = true;
}
if(col.bodyLayout){
item.layout = col.bodyLayout;
}
return item
},
getBodyButtonItem(col,) {

+ 5
- 2
src/components/Template/HandleFormItem.vue View File

@ -37,7 +37,7 @@
</el-radio>
</el-radio-group>
<div v-else-if="type === 'checkboxTree'" class="flex1 checkbox-list-container"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '') + (error ? ' form-error-border' : '')">
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '') + (error ? ' form-error-border' : '') + (item.noBorder ? ' no-border' : '') + (item.layout === 'horizontal' ? ' flex' : '')">
<div v-for="group in item.options" :key="group.value" class="checkbox-tree-group"
:class="{ 'item-center': isShowOtherByCheckboxTree(group.value) }">
<el-checkbox :label="group.value" :disabled="getDisabled()"
@ -2023,7 +2023,7 @@ export default {
}
.checkbox-tree-group {
padding: 5px 0;
padding: 5px 10px 5px 0;
}
.form-error-border {
@ -2032,4 +2032,7 @@ export default {
border-radius: 4px;
border: 1px solid #ff5d5d;
}
.no-border {
border: none;
}
</style>

+ 37
- 11
src/views/business/comps/template/comps/bl/BL001.vue View File

@ -235,23 +235,26 @@ export default {
label: 'template.dj.dj003.cyd',
prop: "cyd",
bodyType: 'input',
bodyFillType: 'actFill'
bodyFillType: 'actFill',
width: 180,
},
{
label: 'template.dj.dj003.dwbh',
prop: "dwbh",
bodyType: 'input',
bodyFillType: 'actFill'
bodyFillType: 'actFill',
width: 180,
},
{
label: 'template.dj.dj003.ypmc',
prop: "ypmcTa",
bodyType: 'checkboxTree',
bodyFillType: 'actFill',
bodyOptions: [
{value:1,label:'正常'},
{value:0,label:'偏离'},
],
width: 280,
bodyLayout: 'horizontal',//
optionCode:"ypmcTaOptions",
noBorder: true,
bodyOptions: this.ypmcTaOptions,
},
{
label: 'template.dj.dj003.cysj',
@ -268,13 +271,15 @@ export default {
{value:1,label:'正常'},
{value:0,label:'偏离'},
],
bodyFillType: 'actFill'
bodyFillType: 'actFill',
width: 180,
},
{
label: 'template.dj.dj003.yps',
prop: "yps",
bodyType: 'inputNumber',
bodyFillType: 'actFill'
bodyFillType: 'actFill',
width: 180,
},
]
@ -308,7 +313,14 @@ export default {
data() {
return {
formData: {},
refConf
refConf,
ypmcTaOptions: [],
}
},
mounted() {
if(this.fillType === "actFill"){
console.log(this.formData, "this.formData")
this.ypmcTaOptions = this.formData.ypmcTaOptions || []
}
},
methods: {
@ -319,11 +331,25 @@ export default {
//
getFilledFormData() {
return this.getFilledFormDataByRefs(refNames)
const filledData = this.getFilledFormDataByRefs(refNames);
if(this.formData.ypmcTaOptions){
filledData.ypmcTaOptions = this.formData.ypmcTaOptions
}
return filledData
},
//
async getFormData() {
return await this.validFormFields(refNames)
const formData = await this.validFields();
if(this.fillType === "preFill" && !!formData){
const filledData = this.getFilledFormData();
const {stepTableFormData_1 = []} = filledData;
const options = stepTableFormData_1.map(item => ({
value: item.ypmc,
label: item.ypmc,
}))
formData.ypmcTaOptions = options
}
return formData
},
//
async validFields() {

Loading…
Cancel
Save