[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> </div>
</a-col> </a-col>
<!-- 9, 文本框 --> <!-- 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="box-title-text">
<div class="title-text"> <div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span> <span class="required" v-if="item.fieldMustInput === '1'">*</span>
@@ -343,6 +343,14 @@ export default {
default: () => { default: () => {
return [] return []
} }
},
// 需要隐藏的字段
hiddenFieldList: {
type: Array,
required: false,
default: () => {
return []
}
} }
}, },
data () { data () {
@@ -14,7 +14,8 @@
<add-form ref="addForm" <add-form ref="addForm"
flag="3" flag="3"
:defaultValue="{year_number: new Date().getFullYear() + ''}" :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-form-func="getFormFunc"
:get-document-info-func="getDocumentInfoFunc" :get-document-info-func="getDocumentInfoFunc"
@submitFormData="submitFormData" /> @submitFormData="submitFormData" />
@@ -22,7 +23,7 @@
<p class="header-text">稽查内容</p> <p class="header-text">稽查内容</p>
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button> <a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
</div> </div>
<div> <div class="check-content-table">
<a-table <a-table
:scroll="{x: 500}" :scroll="{x: 500}"
:columns="columns" :columns="columns"
@@ -45,12 +46,12 @@
</a-table> </a-table>
</div> </div>
</a-spin> </a-spin>
<div class="custom-drawer-style-bottom-btn"> </div>
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;"> <div class="custom-drawer-style-bottom-btn">
{{ $t('preservation') }} <a-button @click="handleOk" type="primary" style="margin-bottom: 0;">
</a-button> {{ $t('preservation') }}
<a-button @click="handleCancel" style="margin-bottom: 0;">{{ $t('close') }}</a-button> </a-button>
</div> <a-button @click="handleCancel" style="margin-bottom: 0;">{{ $t('close') }}</a-button>
</div> </div>
<check-content-modal ref="checkContentModal" @ok="checkContentOk"></check-content-modal> <check-content-modal ref="checkContentModal" @ok="checkContentOk"></check-content-modal>
</a-drawer> </a-drawer>
@@ -66,6 +67,11 @@ import CheckContentModal from './CheckContentModal'
export default { export default {
name: 'EnterpriseStandardModal', name: 'EnterpriseStandardModal',
components: { CheckContentModal, AddForm }, components: { CheckContentModal, AddForm },
computed: {
hiddenFieldList () {
return this.type === 'add' ? ['standard_number'] : []
}
},
data () { data () {
return { return {
visible: false, visible: false,
@@ -99,6 +105,7 @@ export default {
} }
], ],
dataSource: [], dataSource: [],
type: '', // 是新增还是编辑
url: { url: {
add: '/laws/standard/enterprise/commonAdd', add: '/laws/standard/enterprise/commonAdd',
edit: '/laws/standard/enterprise/commonEdit' edit: '/laws/standard/enterprise/commonEdit'
@@ -108,12 +115,14 @@ export default {
methods: { methods: {
add () { add () {
this.visible = true this.visible = true
this.type = 'add'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addForm.add() this.$refs.addForm.add()
}) })
}, },
edit (record) { edit (record) {
this.visible = true this.visible = true
this.type = 'edit'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addForm.edit(record) this.$refs.addForm.edit(record)
}) })
@@ -189,4 +198,7 @@ export default {
margin-bottom: 0; margin-bottom: 0;
} }
} }
.check-content-table {
padding-bottom: 40px;
}
</style> </style>