From 6416b40cf242340eaa163c498bd49d8103e73610 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 29 Jul 2024 17:01:52 +0800
Subject: [PATCH] 代码优化
---
src/views/article/components/votingStatistics.vue | 199 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 199 insertions(+), 0 deletions(-)
diff --git a/src/views/article/components/votingStatistics.vue b/src/views/article/components/votingStatistics.vue
new file mode 100644
index 0000000..8819614
--- /dev/null
+++ b/src/views/article/components/votingStatistics.vue
@@ -0,0 +1,199 @@
+<template>
+ <el-dialog class="dept-user-table-dialog" width="70%" title="投票结果" modal-append-to-body="false" append-to-body="true"
+ :close-on-click-model="true" :visible.sync="showDialog" @close="showDialog = false">
+ <div class="right">
+ <avue-crud :option="option" :search.sync="search" :table-loading="loading" :data="data" ref="crud" v-model="form"
+ :page.sync="page" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
+ @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"></avue-crud>
+ </div>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="showDialog = false">取 消</el-button>
+ <el-button type="primary" @click="submit">确 定</el-button>
+ </div>
+ </el-dialog>
+
+
+</template>
+
+<script>
+ import {
+ mapGetters
+ } from "vuex";
+ import {
+ getPublicDiscussTotal
+ } from "@/api/discuss/publicDiscuss"
+
+ export default {
+ name: "DeptUserTable",
+ data() {
+ return {
+ showDialog: false,
+ form: {},
+ search: {},
+ selectionList: [],
+ query: {},
+ loading: true,
+ platformLoading: false,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
+ },
+ treeDeptId: '',
+ treeData: [],
+ treeOption: {
+ nodeKey: 'id',
+ lazy: true,
+ treeLoad: function(node, resolve) {
+ const parentId = (node.level === 0) ? 0 : node.data.id
+ getDeptLazyTree(parentId).then(res => {
+ resolve(res.data.data.map(item => {
+ return {
+ ...item,
+ leaf: !item.hasChildren
+ }
+ }))
+ })
+ },
+ addBtn: false,
+ menu: false,
+ size: 'small',
+ props: {
+ labelText: '标题',
+ label: 'title',
+ value: 'value',
+ children: 'children'
+ }
+ },
+ option: {
+ height: 'auto',
+ calcHeight: 120,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ selection: true,
+ viewBtn: true,
+ dialogType: 'drawer',
+ dialogClickModal: false,
+ menu: false,
+ addBtn: false,
+ rowKey: "id",
+ reserveSelection: true,
+ column: [{
+ label: "用户姓名",
+ prop: "name",
+ search: true,
+ searchSpan: 4,
+ display: false
+ },
+ {
+ label: "电话",
+ prop: "phoneNumber",
+ slot: true,
+ searchSpan: 4,
+ search: true,
+ display: false
+ },
+ {
+ label: "地址",
+ width: 560,
+ prop: "address",
+ slot: true,
+ display: false
+ },
+ {
+ label: "楼栋",
+ prop: "building",
+ slot: true,
+ searchSpan: 4,
+ search: true,
+ display: false
+ },
+ {
+ label: "单元",
+ prop: "unit",
+ searchSpan: 4,
+ slot: true,
+ search: true,
+ display: false
+ },
+
+ ],
+ },
+ data: [],
+ articleRange: '',
+ }
+ },
+ computed: {
+ ...mapGetters(["userInfo", "permission"]),
+ ids() {
+ let ids = []
+ this.selectionList.forEach(ele => {
+ console.log(ele, "---------")
+ ids.push(ele.id)
+ })
+ return ids.join(",")
+ },
+ idsList() {
+ let ids = []
+ this.selectionList.forEach(ele => {
+ ids.push({
+ id: ele.id,
+ name: ele.name
+ })
+ })
+ return ids
+ }
+ },
+ methods: {
+
+ onLoad(page, params = {}) {
+ this.loading = true
+ getPublicDiscussTotal(Object.assign(params, this.query), this.treeDeptId)
+ .then(res => {
+ const data = res.data.data
+ this.page.total = data.total
+ this.data = data.records
+ this.loading = false
+ })
+ },
+ }
+ }
+</script>
+
+<style lang="scss">
+ .dept-user-table-dialog {
+ margin: 0 !important;
+
+ .el-dialog {
+ display: flex;
+ flex-direction: column;
+ margin: auto !important;
+ position: absolute;
+ top: 0 !important;
+ left: 0 !important;
+ right: 0 !important;
+ bottom: 0 !important;
+ //width: 1000px !important;
+ height: 800px !important;
+
+ .el-dialog__body {
+ height: 0 !important;
+ flex: 1;
+ display: flex;
+
+ .left {
+ width: 0;
+ flex: 2;
+ }
+
+ .right {
+ margin-left: 10px;
+ flex: 9;
+ }
+ }
+ }
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.3