From a2eb1dbcf1eebb9447b3537a17b1b697b6ba07a0 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Thu, 30 Sep 2021 15:07:28 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 5 +-- src/views/form/publish/index.vue | 51 +++++++++++++++++++----------- src/views/form/statistics/item.vue | 2 +- src/views/form/statistics/list.vue | 14 ++++++++ 4 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index baaf02a..5280db0 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -69,6 +69,7 @@ api.interceptors.response.use( */ let errCodes = [500, 405, 403] const res = response.data + if (res.code === 0) { return Promise.resolve(res) } else if (errCodes.includes(res.code)) { @@ -112,7 +113,7 @@ api.interceptors.response.use( result = await api.request(response.config) }) return Promise.resolve(result) - }else { + } else if (res.code ===8000||res.code>8000) { Message({ message: res.msg || 'Error', type: 'error', @@ -120,7 +121,7 @@ api.interceptors.response.use( }) return Promise.reject(res) } - // return Promise.resolve(res) + return Promise.resolve(res) }, error => { Message({ diff --git a/src/views/form/publish/index.vue b/src/views/form/publish/index.vue index d6631dc..a5b0328 100644 --- a/src/views/form/publish/index.vue +++ b/src/views/form/publish/index.vue @@ -21,7 +21,7 @@ :default-checked-keys="publishAgency" style="background-color:#f7f7f7" :props="props" - :data="data" + :data="treeData" show-checkbox :default-expand-all="false" /> @@ -34,12 +34,7 @@ @click="publishProject"> 发布 - +
+ :default-expand-all="false" /> @@ -147,7 +141,9 @@ export default { children: 'subOrgList' }, count: 1, - data: [], + treeData: [], + + selTreeData: [],//回显选中的组织 selAgencyList: [], agencyArrayCopy: [], @@ -160,7 +156,7 @@ export default { let url = window.location.protocol + '//' + window.location.host this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}` await this.loadAgencyList() - this.getProjectStatus() + }, @@ -177,9 +173,14 @@ export default { agencyId: customerId } this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => { - this.data = res.data || [] + this.treeData = res.data || [] + this.selTreeData = JSON.parse(JSON.stringify(this.treeData)) + + this.getProjectStatus() + }) }, + //获取问卷发布范围 getPublishAgency () { let params = { @@ -200,17 +201,32 @@ export default { } this.publishAgency = res.data.orgList || [] - this.$refs.tree.setCheckedNodes(this.publishAgency) + + + // this.processSelTreeData(this.selTreeData) + // this.$refs.selTree.setCheckedNodes(this.publishAgency) + + }) }, + processSelTreeData (array) { + + array.forEach(element => { + element.disabled = true + if (element.subOrgList && element.subOrgList.length > 0) { + this.processSelTreeData(element.subOrgList) + } + }); + }, + //解析树选择的数据 resolveAgency () { let selAll = this.$refs.tree.getCheckedNodes(false, false) // console.log(selAll) this.selAgencyList = [] - this.agencyArrayCopy = JSON.parse(JSON.stringify(this.data)) + this.agencyArrayCopy = JSON.parse(JSON.stringify(this.treeData)) selAll.forEach(element => { // debugger @@ -218,7 +234,6 @@ export default { this.resursionTree(this.agencyArrayCopy, orgId) }); - console.log(this.selAgencyList) }, //递归树 @@ -256,7 +271,7 @@ export default { }, publishProject () { this.resolveAgency() - if (this.data.length > 0 && this.selAgencyList.length === 0) { + if (this.treeData.length > 0 && this.selAgencyList.length === 0) { this.$message( { message: "请选择发布范围", diff --git a/src/views/form/statistics/item.vue b/src/views/form/statistics/item.vue index f1d2c5a..a853130 100644 --- a/src/views/form/statistics/item.vue +++ b/src/views/form/statistics/item.vue @@ -94,7 +94,7 @@ export default { return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('至') : '' } if (this.projectItemData.type === 'SWITCH') { - return this.processData[`field${this.fieldItemId}`] ? 'true' : 'false' + return this.processData[`field${this.fieldItemId}`] ? '开' : '关' } return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`] : '' diff --git a/src/views/form/statistics/list.vue b/src/views/form/statistics/list.vue index 5b73d57..f07316f 100644 --- a/src/views/form/statistics/list.vue +++ b/src/views/form/statistics/list.vue @@ -323,10 +323,24 @@ export default { this.$message.error('无表单有效反馈结果,无法导出') return } + + // ajax.exportFilePost( + // url, + // this.tableParams, + // (data, rspMsg) => { + + // this.download(data, title + '.xls') + // }, + // (rspMsg, data) => { + // this.$message.error(rspMsg); + // } + // ); + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/export`, { params: this.queryConditions, responseType: 'blob' }).then(res => { + let blob = res let downloadElement = document.createElement('a') let href = window.URL.createObjectURL(blob) // 创建下载的链接