From 9b78cfb661637a6d07f915487cff6ca08ccca068 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Wed, 8 Mar 2023 14:32:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E9=85=8D=E7=BD=AE/=E5=85=9A?= =?UTF-8?q?=E5=BB=BA=E5=AE=A3=E4=BC=A0=E4=B8=8B=E6=8B=89=E6=A1=86=E5=8A=A0?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=E4=B8=94=E4=B8=8D=E5=85=81=E8=AE=B8=E8=BE=93?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/communityParty/article/drafts.vue | 8 +- .../modules/communityParty/article/index.vue | 8 +- src/views/modules/workSys/articleTag/edit.vue | 82 ++++++++----------- 3 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/views/modules/communityParty/article/drafts.vue b/src/views/modules/communityParty/article/drafts.vue index a3b63a7ff..59906c237 100644 --- a/src/views/modules/communityParty/article/drafts.vue +++ b/src/views/modules/communityParty/article/drafts.vue @@ -275,7 +275,6 @@ export default { keyName: "tagNameList", type: "select", multiple: true, - filterable: true, allowCreate: true, optionUrl: "/gov/voice/tag/taglist", optionUrlParams: {}, @@ -286,6 +285,13 @@ export default { value: item.tagName, })); }, + rules: [ + { + required: true, + message: "文章标签不能为空", + trigger: "blur", + }, + ], }, { field: "内容", diff --git a/src/views/modules/communityParty/article/index.vue b/src/views/modules/communityParty/article/index.vue index 5d2d6b034..ea064e288 100644 --- a/src/views/modules/communityParty/article/index.vue +++ b/src/views/modules/communityParty/article/index.vue @@ -471,7 +471,6 @@ export default { keyName: "tagNameList", type: "select", multiple: true, - filterable: true, allowCreate: true, optionUrl: "/gov/voice/tag/taglist", optionUrlParams: {}, @@ -482,6 +481,13 @@ export default { value: item.tagName, })); }, + rules: [ + { + required: true, + message: "文章标签不能为空", + trigger: "blur", + }, + ], }, { field: "内容", diff --git a/src/views/modules/workSys/articleTag/edit.vue b/src/views/modules/workSys/articleTag/edit.vue index a5efaaeed..e4f63815f 100644 --- a/src/views/modules/workSys/articleTag/edit.vue +++ b/src/views/modules/workSys/articleTag/edit.vue @@ -14,7 +14,6 @@ label-width="150px" style="display: block"> @@ -64,10 +63,7 @@ export default { formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 btnDisable: false, orgOptions:[], - roleId: '', - sbid:'', - menuList: [], - menuListShuju: [], + tagId:'', formData: { tagName: '', agencyId:'', @@ -82,8 +78,6 @@ export default { { required: true, message: '应用范围不能为空', trigger: 'blur' } ] }, - - defaultRole: '', } }, components: {}, @@ -93,15 +87,25 @@ export default { methods: { - async initForm (type, row, defaultRole) { + async initForm (type, row) { this.startLoading() this.formType = type - this.formData = {...row} + console.log(row); + if(type!='add'){ + this.formData.tagName = row.tagName + this.tagId = row.id + if(row.agencyList.length>1){ + this.formData.agencyId = row.agencyList[0].orgIdPath.split(':')[1] + this.formData.orgIdPath = row.agencyList[0].orgIdPath.split(':')[0] +':'+ row.agencyList[0].orgIdPath.split(':')[1] + }else{ + this.formData.agencyId = row.agencyList[0].agencyId + this.formData.orgIdPath = row.agencyList[0].orgIdPath + } + } this.endLoading() }, async getOrgTreeList() { - const { user } = this.$store.state this.dataListLoading = true this.$http .post('/gov/org/customeragency/staffinagencylist') @@ -111,8 +115,6 @@ export default { } else { console.log('获取查询详情成功', res.data) let { agencyList, subAgencyList } = res.data - // this.optionsA = res.data - // console.log(this.optionsA); const _arr = [{ ...agencyList, subAgencyList: [...subAgencyList] }] this.orgOptions = this.deepTree(_arr) } @@ -135,19 +137,17 @@ export default { }, cascaderClick () { let obj = this.$refs["cascaderUnit"].getCheckedNodes()[0].data - var arr = [] + this.formDatam = [] if (obj) { - if (obj.level === "street" && obj.subAgencyList!= null) { + if (obj.level === "street") { for(let i in obj.subAgencyList){ - this.formDatam.push({'agencyId':obj.subAgencyList[i].agencyId,'orgIdPath':obj.orgIdPath}) + this.formData.push({'agencyId':obj.subAgencyList[i].agencyId,'orgIdPath':obj.subAgencyList[i].orgIdPath}) } - console.log( this.formDatam); } else { - this.$set(this.formData,'agencyId',obj.agencyId) - this.$set(this.formData,'orgIdPath',obj.orgIdPath) + this.formDatam.push({'agencyId':obj.agencyId,'orgIdPath':obj.orgIdPath}) } } else { - this.formData.agencyId = '' + this.formDatam = [] } }, @@ -171,27 +171,26 @@ export default { let url = '' if (this.formType === 'add') { url = '/gov/voice/tag/save' - } else { url = '/gov/voice/tag/update' - } - console.log(this.formData); - const { tagName,orgIdPath,agencyId} = this.formData + const { tagName} = this.formData let params = {} - if(agencyId &&this.formDatam.length==0){ - params = { - tagName, - agencyList:{ - orgIdPath, - agencyId, - }, - } + + if(this.formType != 'add'){ + if(this.formDatam.length == 0){ + this.formDatam.push({'agencyId':this.formData.agencyId,'orgIdPath':this.formData.orgIdPath}) + } + params = { + tagName, + agencyList:this.formDatam, + id:this.tagId + } }else{ - params = { - tagName, - agencyList:this.formDatam - } + params = { + tagName, + agencyList:this.formDatam, + } } const { data, code, msg } = await requestPost(url,params) if (code === 0) { @@ -207,7 +206,6 @@ export default { this.btnDisable = false this.$message.error(msg) } - this.formDatam = [] }, handleCancle () { @@ -217,9 +215,6 @@ export default { }, resetData () { - - this.roleId = '' - this.formData = { tagName: '', } @@ -242,17 +237,8 @@ export default { } }, computed: { - dataRule () { - return { - - - } - }, - }, props: { - - } }