From 5e2aafeede13d337380f736567caf74f49713be7 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:38:32 +0800
Subject: [PATCH] 代码优化
---
src/views/article/discussionManage.vue | 98 ++++++++++++++++++++++++++++++++++--------------
1 files changed, 69 insertions(+), 29 deletions(-)
diff --git a/src/views/article/discussionManage.vue b/src/views/article/discussionManage.vue
index 4010d28..f8616eb 100644
--- a/src/views/article/discussionManage.vue
+++ b/src/views/article/discussionManage.vue
@@ -19,8 +19,19 @@
编辑议题
</el-button>
- <el-button icon="el-icon-user" :size="size" :type="type" @click.stop="openUserPopup(row, 1)">
+ <el-button icon="el-icon-user" :size="size" v-if="row.articleType != 4" :type="type"
+ @click.stop="openUserPopup(row, 0)">
参与用户
+ </el-button>
+
+ <el-button icon="el-icon-user" v-if="row.articleType == 4" :size="size" :type="type"
+ @click.stop="handleExport(row)">
+ 导出投票
+ </el-button>
+
+ <el-button icon="el-icon-user" v-if="row.articleType == 4 && row.publish == '1'" :size="size" :type="type"
+ @click.stop="lookVotingStatistics(row,'业主大会统计')">
+ 查看投票
</el-button>
<el-button v-if="row.publish == '1'" icon="el-icon-close" :size="size" :type="type" @click.stop="updateFb(row)">
@@ -48,6 +59,8 @@
</deitDiscussion>
<discussionManageChild ref="discussionManageChild" />
+
+ <votingStatistics ref="votingStatistics" />
</basic-container>
</template>
@@ -79,11 +92,28 @@
} from "vuex"
import deitDiscussion from "./components/deitDiscussion"
import discussionManageChild from "./components/discussionManageChild"
+ import votingStatistics from "./components/votingStatistics"
+ import NProgress from 'nprogress'
+ import 'nprogress/nprogress.css'
+ import Qs from "qs"
+ import {
+ exportBlob
+ } from "@/api/common"
+ import {
+ getToken
+ } from '@/util/auth'
+ import {
+ downloadXls
+ } from "@/util/util"
+ import {
+ dateNow
+ } from "@/util/date"
export default {
components: {
deitDiscussion,
discussionManageChild,
+ votingStatistics
},
data() {
@@ -157,6 +187,7 @@
minRows: 2,
tags: true,
type: "tree",
+ dataType: "string",
multiple: true,
dicData: [],
rules: [{
@@ -168,13 +199,12 @@
label: "name",
value: 'id'
},
- hide: true,
+ // hide: true,
},
{
width: 110,
label: "封面",
prop: "url",
- // align:'center',
type: "upload",
listType: "picture-img",
action: "/api/blade-resource/oss/endpoint/put-file",
@@ -182,7 +212,6 @@
res: "data",
url: "link",
},
- // hide: true,
span: 24,
},
{
@@ -207,25 +236,6 @@
trigger: "blur",
}, ],
},
- // {
- // label: "发布时间",
- // prop: "dateTime",
- // type: "daterange",
- // format: "yyyy-MM-dd",
- // valueFormat: "yyyy-MM-dd",
- // searchSpan: 6,
- // searchRange: true,
- // hide: true,
- // addDisplay: false,
- // editDisplay: false,
- // viewDisplay: false,
- // search: true,
- // rules: [{
- // required: true,
- // message: "请选择发布时间",
- // trigger: "blur",
- // }, ],
- // },
{
width: 100,
label: "发布时间",
@@ -488,6 +498,36 @@
}
},
methods: {
+
+ lookVotingStatistics(row, name) {
+ this.$router.push({
+ path: `/myiframe/urlPath?name=preview-${name}&src=${this.website.reportUrl}/view/965861526961414144?articleId=${row.id}`
+ })
+ },
+
+ handleExport(row) {
+ this.$confirm("是否导出投票结果数据?", "提示", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ }).then(() => {
+ NProgress.start()
+ this.query = {}
+ this.query.articleId = row.id
+ this.query.districtId = row.articleRange
+ var data = {
+ ...this.query
+ }
+ data = Qs.stringify(data)
+ exportBlob(
+ `/api/blade-userTopics/userTopics/exportDataIndex?${this.website.tokenHeader}=${getToken()}&` + data)
+ .then(
+ res => {
+ downloadXls(res.data, `投票结果${dateNow()}.xlsx`)
+ NProgress.done()
+ })
+ })
+ },
iscommentInput(e, data) {
upcomment(data.id, e).then(() => {
this.$message({
@@ -513,8 +553,8 @@
})
},
- openUserPopup(row) {
- this.$refs.DeitDiscussion.openUser(row)
+ openUserPopup(row, type) {
+ this.$refs.DeitDiscussion.openUser(row, type)
},
openDilog(row, type) {
@@ -529,7 +569,7 @@
row.videoUrl = ""
}
row.userid = this.userInfo.user_id
- row.articleRange = JSON.stringify(row.articleList)
+ row.articleRange = row.articleList
if (row.url.length > 0) {
var urls = []
var split = row.url.split(",")
@@ -559,7 +599,7 @@
)
},
rowUpdate(row, index, done, loading) {
- row.articleRange = JSON.stringify(row.articleList)
+ row.articleRange = row.articleList
if (row.url.length > 0) {
var urls = []
var split = row.url.split(",")
@@ -657,7 +697,7 @@
// })
this.form = {
...data,
- articleList: JSON.parse(data.articleRange)
+ articleList: data.articleRange
}
})
}
@@ -697,7 +737,7 @@
this.page.total = data.total
this.data = data.records
this.data.forEach(item => {
- // item.articleRange = JSON.parse(item.articleRange)
+ item.articleList = item.articleRange
if (item.url.length > 0) {
var urls = []
var names = item.url.split(",")
--
Gitblit v1.9.3