[update] 新增表单组件增加可隐藏字段

This commit is contained in:
lideqin
2023-09-21 17:42:05 +08:00
parent f0d3844028
commit 7360dcff84
2 changed files with 29 additions and 9 deletions
+9 -1
View File
@@ -155,7 +155,7 @@
</div>
</a-col>
<!-- 9, 文本框 -->
<a-col :span="12" v-else-if="item.fieldShowType === FieldType.TEXT_BOX.value">
<a-col :span="12" v-else-if="item.fieldShowType === FieldType.TEXT_BOX.value && !hiddenFieldList.includes(item.dbFieldName)">
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
@@ -343,6 +343,14 @@ export default {
default: () => {
return []
}
},
// 需要隐藏的字段
hiddenFieldList: {
type: Array,
required: false,
default: () => {
return []
}
}
},
data () {
@@ -14,7 +14,8 @@
<add-form ref="addForm"
flag="3"
:defaultValue="{year_number: new Date().getFullYear() + ''}"
:disabledFieldList="['replaced_standard_num', 'referenced_standard']"
:disabledFieldList="['standard_number', 'replaced_standard_num', 'referenced_standard']"
:hiddenFieldList="hiddenFieldList"
:get-form-func="getFormFunc"
:get-document-info-func="getDocumentInfoFunc"
@submitFormData="submitFormData" />
@@ -22,7 +23,7 @@
<p class="header-text">稽查内容</p>
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
</div>
<div>
<div class="check-content-table">
<a-table
:scroll="{x: 500}"
:columns="columns"
@@ -45,12 +46,12 @@
</a-table>
</div>
</a-spin>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;">
{{ $t('preservation') }}
</a-button>
<a-button @click="handleCancel" style="margin-bottom: 0;">{{ $t('close') }}</a-button>
</div>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;">
{{ $t('preservation') }}
</a-button>
<a-button @click="handleCancel" style="margin-bottom: 0;">{{ $t('close') }}</a-button>
</div>
<check-content-modal ref="checkContentModal" @ok="checkContentOk"></check-content-modal>
</a-drawer>
@@ -66,6 +67,11 @@ import CheckContentModal from './CheckContentModal'
export default {
name: 'EnterpriseStandardModal',
components: { CheckContentModal, AddForm },
computed: {
hiddenFieldList () {
return this.type === 'add' ? ['standard_number'] : []
}
},
data () {
return {
visible: false,
@@ -99,6 +105,7 @@ export default {
}
],
dataSource: [],
type: '', // 是新增还是编辑
url: {
add: '/laws/standard/enterprise/commonAdd',
edit: '/laws/standard/enterprise/commonEdit'
@@ -108,12 +115,14 @@ export default {
methods: {
add () {
this.visible = true
this.type = 'add'
this.$nextTick(() => {
this.$refs.addForm.add()
})
},
edit (record) {
this.visible = true
this.type = 'edit'
this.$nextTick(() => {
this.$refs.addForm.edit(record)
})
@@ -189,4 +198,7 @@ export default {
margin-bottom: 0;
}
}
.check-content-table {
padding-bottom: 40px;
}
</style>