From 57ae69b55be64796196fd9d209d4e85d46428cdf Mon Sep 17 00:00:00 2001 From: zyn Date: Mon, 16 Oct 2023 13:36:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=A4=96=E9=83=A8=E4=BC=9A=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CustomFormComponents/File.vue | 4 + .../CustomFormComponents/Textarea.vue | 8 +- .../meeting/components/advancedSearch.vue | 29 +++-- .../meeting/components/editDrawer.vue | 113 ++++++++++++++---- src/pages/policyRegulation/meeting/index.vue | 64 +++++++--- 5 files changed, 164 insertions(+), 54 deletions(-) diff --git a/src/components/CustomFormComponents/File.vue b/src/components/CustomFormComponents/File.vue index f0488b990..9b90b5434 100644 --- a/src/components/CustomFormComponents/File.vue +++ b/src/components/CustomFormComponents/File.vue @@ -4,6 +4,7 @@ + :before-close="beforeClose">
搜索 + @click="onSearch('search')">搜索 取消 + @click="onCancel('cancel')">取消
@@ -148,17 +148,30 @@ export default { default: () => ({}) }, }, + data () { + return { + type: 'cancel' + } + }, methods: { beforeClose (done) { - this.$emit('update:visible', false) - done() + switch (this.type) { + case "search": + this.onSearch() + break + case 'cancel': + this.onCancel() + break + } }, - onSearch () { + onSearch (type) { + this.type = type this.$emit('search') this.$emit('update:visible', false) }, - onClose () { - this.$emit('clearSearch', {}) + onCancel(type) { + this.type = type + this.$emit('resetAdvancedSearchForm') this.$emit('update:visible', false) } } diff --git a/src/pages/policyRegulation/meeting/components/editDrawer.vue b/src/pages/policyRegulation/meeting/components/editDrawer.vue index be573c570..d0c1017a0 100644 --- a/src/pages/policyRegulation/meeting/components/editDrawer.vue +++ b/src/pages/policyRegulation/meeting/components/editDrawer.vue @@ -117,30 +117,31 @@ - + - + > - + - + @@ -149,9 +150,10 @@ @@ -241,28 +243,44 @@ export default { {type: 'string', max: 500, message: '议题主要内容不能超过500个字符', trigger: 'change'} ], } - return { - rules, - isSubmit: false, - reloadForm: true - } - }, - computed: { - form () { - if (JSON.stringify(this.editForm) !== '{}') { - return { ...this.editForm } - } else { - const meetingTopicItem = { + const form = { + meetingName: '', + meetingOrganizer: '', + meetingTime: '', + meetingAddress: '', + participants: '', + meetingMinutes: '', + meetingContent: '', + firstMeetingType: '', + secondMeetingType: '', + meetingTopicList: [ + { agendaName: '', agendaMaterials: '', reporter: '', reportingUnit: '', agendaContent: '' } - const form = { - meetingTopicList: [ meetingTopicItem ] - } - return { ...form } + ] + } + return { + rules, + form, + isSubmit: false, + reloadForm: true, + api: { + add: 'lawss/insideOutsideMeeting/addMeetingInfo', + delete :'lawss/insideOutsideMeeting/deleteMeetingInfo', + update: 'lawss/insideOutsideMeeting/updateMeetingInfo' + } + } + }, + watch: { + editForm (val) { + if (this.title === '编辑') { + this.form = { ...this.editForm } + } else { + this.resetForm() } } }, @@ -286,12 +304,55 @@ export default { }) this.form.meetingTopicList = [ ...res ] }, + resetForm () { + this.form = { + meetingName: '', + meetingOrganizer: '', + meetingTime: '', + meetingAddress: '', + participants: '', + meetingMinutes: '', + meetingContent: '', + firstMeetingType: '', + secondMeetingType: '', + meetingTopicList: [ + { + agendaName: '', + agendaMaterials: '', + reporter: '', + reportingUnit: '', + agendaContent: '' + } + ] + } + }, onClose () { this.$emit('update:showDrawer', false) this.$refs['formRef'].resetFields() + this.resetForm() }, onSubmit () { - console.log(this.form) + this.$refs.formRef.validate(valid => { + if (valid) { + if (this.title === '新增') { + this.$http._postData(this.api.add, this.form).then(res => { + if (res.ok) { + this.$message.success('新增成功') + this.onClose() + this.$emit('load') + } + }) + } else { + this.$http._putData(this.api.update, this.form).then(res => { + if (res.ok) { + this.$message.success('修改成功') + this.onClose() + this.$emit('load') + } + }) + } + } + }) } } } diff --git a/src/pages/policyRegulation/meeting/index.vue b/src/pages/policyRegulation/meeting/index.vue index ea80eecfb..3a7be0c0e 100644 --- a/src/pages/policyRegulation/meeting/index.vue +++ b/src/pages/policyRegulation/meeting/index.vue @@ -3,14 +3,14 @@
- - + + - - + + - - + + 数据获取中...
- + - + @@ -155,6 +155,7 @@ export default { data(){ return { searchForm: {}, + advancedSearchForm: {}, data: [], total: 0, selectedList: [], @@ -167,7 +168,10 @@ export default { importExcelUrl: '', // 高级搜索 advancedSearchVisible: false, - editForm: void 0 + editForm: void 0, + api: { + delete :'lawss/insideOutsideMeeting/deleteMeetingInfo' + } } }, created() { @@ -177,21 +181,31 @@ export default { methods: { async getData () { this.searchForm.pageSize = this.searchForm.pageSize || this.$store.getters.userInfo.configContent - this.searchForm.page = this.searchForm.page || 0 - let params = { ...this.searchForm } - const res = await this.$http._getData('lawss/insideOutsideMeeting/page', params) - if (res.ok) { - this.data = res.data + this.searchForm.page = this.searchForm.page || 1 + let params = { ...this.searchForm, ...this.advancedSearchForm } + const res = await this.$http._getData('lawss/insideOutsideMeeting/page', params, {_this:this,loading: 'loading'}) + if (res.ok && res.data) { + if (res.data.list && res.data.list.length > 0) { + this.data = res.data.list + } + this.total = res.data.count } }, onSearch(){ - console.log(this.searchForm) + this.getData() }, onClear () { this.$set(this, 'searchForm', {}) + this.$set(this, 'advancedSearchForm', {}) + this.getData() + }, + resetAdvancedSearchForm () { + this.$set(this, 'advancedSearchForm', {}) + this.getData() }, // 高级搜索 advancedSearch () { + this.$set(this, 'advancedSearchForm', {}) this.advancedSearchVisible = true }, // 选择项勾选改变 @@ -254,7 +268,6 @@ export default { this.showDrawer = false switch (type) { case 'add': - this.$set(this, 'editForm', {}) this.titleDrawer = '新增' break case 'edit': @@ -262,10 +275,25 @@ export default { this.$set(this, 'editForm', row) break } - this.showDrawer = true + this.$nextTick(()=>{ + this.showDrawer = true + }) }, onDelete (id) { - alert('删除' + id) + this.$confirm('确认删除这些数据?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + confirmButtonClass: 'common-button-primary', + roundButton: true + }).then(() => { + this.$http._deleteData(this.api.delete, { meetingId: id }).then(res => { + if (res.ok) { + this.$message.success('删除成功') + this.getData() + } + }) + }) }, getDicTypeListCode () { // 查询各下拉框数据