Browse Source

增加表决结果,增加投票细节

wuqing3 2 years ago
parent
commit
50b55d6024

+ 1 - 1
src/api/index.js

@@ -175,7 +175,7 @@ export default {
         return fetch('/suggestion/s',params,'get')
     },
     choices(params){
-        return fetch('/vote/options/s/choice/s',params,'get')
+        return fetch('/vote/option/s/choice/s',params,'get')
     }
 
 

+ 1 - 1
src/components/RxTable.vue

@@ -201,7 +201,7 @@ export default {
 <style scoped lang="less">
 .containers {
   width: 98%;
-  margin-left: 20px;
+  margin-left: 15px;
   height: 34px;
   background-color: #f6f8fa;
   position: relative;

+ 6 - 1
src/router/index.js

@@ -75,7 +75,12 @@ const routes = [
                 path: '/voteResult',
                 name:'voteResult',
                 component:() => import('@/views/vote/voteResult')
-            },
+           },
+           {
+                path: '/suggestions',
+                name:'suggestions',
+                component:() => import('@/views/suggestions/index')
+           },
 
 
 

+ 9 - 3
src/views/main/modules/leftMenu.vue

@@ -22,6 +22,7 @@
             <span style="font-size: 1em;">{{ item.title }}</span>
           </template>
           <el-menu-item :index="tar.name" v-for="(tar,inde) in item.children" :key="inde">
+            <i :class="tar.icon" style="width:1em;height: 1.2em;color: #333333"></i>
             {{ tar.title }}
           </el-menu-item>
         </el-submenu>
@@ -63,19 +64,24 @@ export default {
             children:[
               {
                 name:'voteActivity',
-                icon:"",
+                icon:"el-icon-message",
                 title:'投票活动'
               },
               {
                 name:'notice',
-                icon:"",
+                icon:"el-icon-message-solid",
                 title:'公告通知'
               },
               {
                 name:'verify',
-                icon:"",
+                icon:"el-icon-office-building",
                 title:'房产审核'
               },
+              {
+                name:'suggestions',
+                icon:"el-icon-s-comment",
+                title:'意见反馈'
+              },
             ]
         },
 

+ 126 - 0
src/views/suggestions/index.vue

@@ -0,0 +1,126 @@
+<template>
+    <div class="suggestions container">
+        <div class="card">
+            <voteChart ref="voteChart"></voteChart>
+
+            <RxTable
+                    ref="rxTable"
+
+
+                    :data="listData.list"
+                    :blank-col="true"
+                    :loading="loading"
+                    :page-count="listData.pageQuantity"
+                    :currentPage="pageInfo.page"
+            >
+
+
+                <el-table-column type="expand">
+                    <template slot-scope="props">
+                        <el-form label-position="top" class="demo-table-expand">
+                            <el-form-item  label="意见详情:"  style="margin-left: 10px;">
+                                <div style="width: calc(100% - 30px); margin: 0 auto; word-break:break-all" >{{ props.row .suggestion}}</div>
+                            </el-form-item>
+
+                        </el-form>
+                    </template>
+                </el-table-column>
+
+                <el-table-column
+                        :align="item.align || 'left'"
+                        :prop="item.prop"
+
+                        :label="item.label"
+                        :key="item.id"
+                        v-for="(item) in tableHeader"
+                        :show-overflow-tooltip="true"
+                        :width="item.width"
+                        :min-width="item.minWidth"
+                >
+                    <template slot-scope="scope">
+                        <div v-if="item.prop == 'flag'" style="height: 36px;">
+                            <el-image fit="fill" :src="scope.row[item.prop]" style="height: 36px;width: 80px;"  :preview-src-list="[scope.row[item.prop]]"></el-image>
+                        </div>
+
+                        <div v-else-if="item.prop == 'tvCounts'">
+                            <el-tag size="small" style="width: 50px;text-align: center;" @click="goTvList(scope.row)">{{scope.row[item.prop]}}</el-tag>
+                        </div>
+                        <span v-else>{{ scope.row[item.prop] || scope.row[item.prop] == 0 ? scope.row[item.prop] : '-' }} </span>
+                    </template>
+                </el-table-column>
+                <!--          <el-table-column label="操作" fixed="right" align="left" width="200">-->
+                <!--            <template slot-scope="scope">-->
+                <!--              <el-button type="text" icon="el-icon-search" @click="handleChart(scope.row)">查看结果</el-button>-->
+                <!--              <el-button type="text" class="btn_text_edit" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑-->
+                <!--              </el-button>-->
+
+                <!--            </template>-->
+                <!--          </el-table-column>-->
+            </RxTable>
+        </div>
+    </div>
+</template>
+
+<script>
+    import RxTable from "../../components/RxTable";
+    export default {
+        name: "index",
+        data(){
+            return {
+                loading:false,
+                pageInfo: {
+                    page: 1,
+                    pageCapacity: 10,
+                },
+                listData:{
+                    list:[]
+                },
+                tableHeader: [
+                    {
+                        prop: "passportName",
+                        label: "意见人",
+                        width: "120"
+                    },
+
+                    {
+                        prop: "suggestion",
+                        label: "意见",
+
+                    },
+
+                ],
+            }
+        },
+        components:{
+          RxTable
+        },
+        methods:{
+            init(){
+                this.suggestion()
+            },
+            suggestion(){
+                this.loading = true;
+                this.$api.suggestion({
+                    ...this.pageInfo
+                }).then(res => {
+                    console.log(res)
+                    this.loading = false;
+                    this.listData.list = res.content.suggestions
+                    this.listData.pageQuantity = parseInt(res.content.pageQuantity)
+                })
+            },
+            changePage(page) {
+
+                this.pageInfo.page = page
+                // this.init()
+            },
+        },
+        mounted() {
+            this.init()
+        }
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/vote/index.vue

@@ -143,7 +143,7 @@ export default {
         name:"voteActivityInfo",
         title:"活动详情",
         canClose:true,
-        params:{
+        query:{
             ...row
         }
       })

+ 41 - 9
src/views/vote/module/voteChart.vue

@@ -3,10 +3,23 @@
         <div class="echartColumn" ref="echartColumn">
         </div>
         <div class="result">
-            <div class="item" v-for="item in chartData.items">
-              <div class="label">{{item.value}}</div>
-              <div class="value">{{item.quantity}}票</div>
+            <div class="item" v-for="item in chartData.options">
+                <div class="line1">
+                    <div class="label">{{item.value}}</div>
+                    <div class="value">{{item.number}}票  <span style="color: #1890ff;margin-left: 10px; cursor: pointer" @click="showVoter(item)" v-if="item.number != 0">投票者</span></div>
+                </div>
+                <div class="choices" style="min-height: 20px;margin-bottom: 10px;display: flex;justify-content: space-between;" v-if="item.flag">
+                    <div  style="width: 60px;">投票人:</div>
+                    <div class="nameList">
+                        <span v-for="tar in item.choices" style="margin-right: 10px;color: #1890ff;">
+                            {{tar.passportName}}
+                        </span>
+                    </div>
+
+                </div>
+
             </div>
+
         </div>
     </div>
 </template>
@@ -18,15 +31,18 @@ export default {
   data(){
     return {
       chartColumn:null,
-      chartData:{}
+      chartData:{},
+      testData:[],
+
+
     }
   },
   watch:{
     chartData(v){
       console.log(v)
-        let arr =v.items.map(tar => {
+        let arr =v.options.map(tar => {
           return {
-            value:tar.quantity,
+            value:tar.number,
             name:tar.value
           }
         })
@@ -62,6 +78,13 @@ export default {
       })
     }
   },
+  methods:{
+      showVoter(item){
+
+
+          item.flag = !item.flag;
+      }
+  },
   mounted(){
       this.chartColumn = echarts.init(this.$refs.echartColumn);
   }
@@ -69,6 +92,15 @@ export default {
 </script>
 
 <style lang="less" scoped>
+    .nameList{
+        width: calc(100% - 100px);
+        /*overflow:hidden;*/
+        height: 100%;
+        display: flex;
+        flex-wrap: wrap;
+        margin-bottom: 5px;
+    }
+
     .echartColumn {
         width: calc(100% - 50px);
       margin: 0 auto;
@@ -76,17 +108,17 @@ export default {
 
     }
     .result {
-      .item {
+      .line1 {
         display: flex;
         border-bottom: 1px solid #eeeeee;
         display: flex;
         justify-content: space-between;
         align-items: center;
-        margin-bottom: 15px;
+        margin-bottom: 5px;
       }
 
       width: calc(100% - 100px);
       margin: 0px auto;
 
     }
-</style>
+</style>

+ 13 - 0
src/views/vote/module/voteStatDialog.vue

@@ -0,0 +1,13 @@
+<template>
+    $END$
+</template>
+
+<script>
+    export default {
+        name: "voteStatDialog"
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 22
src/views/vote/vote.vue

@@ -53,28 +53,7 @@
         </el-table-column>
       </RxTable>
     </div>
-    <!--    <el-dialog-->
-    <!--        title="添加用户"-->
-    <!--        :visible.sync="dialogVisible"-->
-    <!--        width="600px"-->
-    <!--        :lock-scroll="false">-->
-    <!--      <userForm ref="userForm"></userForm>-->
-    <!--      <span slot="footer" class="dialog-footer">-->
-    <!--                <el-button @click="dialogVisible = false">取 消</el-button>-->
-    <!--                <el-button type="primary" @click="onSubmit">确 定</el-button>-->
-    <!--            </span>-->
-    <!--    </el-dialog>-->
-    <!--    <el-dialog-->
-    <!--        title="编辑角色"-->
-    <!--        :visible.sync="dialogVisibleUpdate"-->
-    <!--        width="600px"-->
-    <!--        :lock-scroll="false">-->
-    <!--      <userForm ref="userFormu"></userForm>-->
-    <!--      <span slot="footer" class="dialog-footer">-->
-    <!--                <el-button @click="dialogVisibleUpdate = false">取 消</el-button>-->
-    <!--                <el-button type="primary" @click="onSubmit">确 定</el-button>-->
-    <!--            </span>-->
-    <!--    </el-dialog>-->
+
   </div>
 </template>
 

+ 2 - 2
src/views/vote/voteActivityInfo.vue

@@ -245,8 +245,8 @@ export default {
   },
   mounted() {
 
-     this.form = this.$route.params;
-    this.activityId= this.$route.params.id.toString();
+     this.form = this.$route.query;
+    this.activityId= this.$route.query.id.toString();
     this.handleSearch()
 
 

+ 6 - 63
src/views/vote/voteResult.vue

@@ -3,60 +3,7 @@
       <div class="card">
         <voteChart ref="voteChart"></voteChart>
 
-        <RxTable
-            ref="rxTable"
 
-
-            :data="listData.list"
-            :blank-col="true"
-            :loading="loading"
-            :page-count="listData.pageQuantity"
-            :currentPage="pageInfo.page"
-        >
-
-
-          <el-table-column type="expand">
-            <template slot-scope="props">
-              <el-form label-position="left" class="demo-table-expand">
-                <el-form-item style="margin-left: 10px;" label="意见详情:" >
-                  <span >{{ props.row .suggestion}}</span>
-                </el-form-item>
-
-              </el-form>
-            </template>
-          </el-table-column>
-
-          <el-table-column
-              :align="item.align || 'left'"
-              :prop="item.prop"
-
-              :label="item.label"
-              :key="item.id"
-              v-for="(item) in tableHeader"
-              :show-overflow-tooltip="true"
-              :width="item.width"
-              :min-width="item.minWidth"
-          >
-            <template slot-scope="scope">
-              <div v-if="item.prop == 'flag'" style="height: 36px;">
-                <el-image fit="fill" :src="scope.row[item.prop]" style="height: 36px;width: 80px;"  :preview-src-list="[scope.row[item.prop]]"></el-image>
-              </div>
-
-              <div v-else-if="item.prop == 'tvCounts'">
-                <el-tag size="small" style="width: 50px;text-align: center;" @click="goTvList(scope.row)">{{scope.row[item.prop]}}</el-tag>
-              </div>
-              <span v-else>{{ scope.row[item.prop] || scope.row[item.prop] == 0 ? scope.row[item.prop] : '-' }} </span>
-            </template>
-          </el-table-column>
-<!--          <el-table-column label="操作" fixed="right" align="left" width="200">-->
-<!--            <template slot-scope="scope">-->
-<!--              <el-button type="text" icon="el-icon-search" @click="handleChart(scope.row)">查看结果</el-button>-->
-<!--              <el-button type="text" class="btn_text_edit" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑-->
-<!--              </el-button>-->
-
-<!--            </template>-->
-          </el-table-column>
-        </RxTable>
       </div>
 
     </div>
@@ -99,23 +46,19 @@ export default {
   methods:{
     init(){
       let voteId = this.$route.query.voteId
-      this.$api.voteStatis({
+      this.$api.choices({
         voteId
       }).then(res => {
         console.log(res)
+        res.content.options.forEach(tar => {
+            tar.flag = false;
+        })
         this.$refs.voteChart.chartData = {
           ...res.content,
         }
       })
 
-      this.$api.suggestion({
-        voteId,
-        ...this.pageInfo
-      }).then(res => {
-        console.log(res)
-        this.listData.list = res.content.suggestions
-        this.listData.pageQuantity = res.content.pageQuantity
-      })
+
     },
     changePage(page) {
 
@@ -131,4 +74,4 @@ export default {
 
 <style scoped>
 
-</style>
+</style>