update AddForm、Search组件修改

This commit is contained in:
赵霄
2023-08-29 16:44:45 +08:00
parent f560c8a64c
commit fecd8c01cc
10 changed files with 577 additions and 93 deletions
@@ -11,7 +11,10 @@
>
<a-spin :spinning="confirmLoading" style="width: 100%;height:100%">
<div class="drawer-container">
<add-form ref="addForm"
:get-form-func="getFormFunc"
:get-document-info-func="getDocumentInfoFunc"
@submitFormData="submitFormData" />
</div>
<div class="drawer-footer">
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;">
@@ -24,8 +27,13 @@
</template>
<script>
import AddForm from '../../../../components/customField/AddForm.vue'
import { postAction } from '@api/manage'
import { getDomesticStandardDocumentInfo, getDomesticStandardFormModal } from '../../../../api/standardRegulationLibraryApi'
export default {
name: 'DomesticStandardModal',
components: { AddForm },
data () {
return {
visible: false,
@@ -33,16 +41,57 @@ export default {
width: 800,
// 存储表单的数据
form: {},
confirmLoading: false
confirmLoading: false,
getFormFunc: getDomesticStandardFormModal,
getDocumentInfoFunc: getDomesticStandardDocumentInfo,
url: {
getAddForm: '/laws/standard/domestic/getFormModel',
getDocumentInfo: '/laws/standard/domestic/getByIdAndModule',
add: '/laws/standard/domestic/commonAdd',
edit: '/laws/standard/domestic/commonEdit'
}
}
},
methods: {
add () {
this.edit({})
this.visible = true
this.$nextTick(() => {
this.$refs.addForm.add()
})
},
edit (record) {
this.visible = true
},
handleOk () {
this.confirmLoading = true
this.$refs.addForm.submit()
},
// 表单提交的回调,获取表单数据
submitFormData (formInline) {
let url = ''
if (formInline.id) {
url = this.url.edit
} else {
url = this.url.add
}
postAction(url, formInline).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
if (this.formInline.id) {
this.$emit('ok')
} else {
this.$emit('ok')
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
},
handleCancel () {
this.close()
},
close () {
this.visible = false
}