wuqing3 2 anni fa
parent
commit
60c91d1e62

+ 1 - 0
package.json

@@ -18,6 +18,7 @@
     "vue": "^2.6.14",
     "vue-amap": "^0.5.10",
     "vue-echarts": "^6.0.2",
+    "vue-json-excel": "^0.3.0",
     "vue-router": "^3.5.1",
     "vue-template-compiler": "^2.6.14",
     "vuex": "^3.6.2"

+ 4 - 0
src/api/index.js

@@ -176,6 +176,10 @@ export default {
     },
     choices(params){
         return fetch('/vote/option/s/choice/s',params,'get')
+    },
+
+    houseState(params){
+        return fetch('/vote/house/s/state',params,'get')
     }
 
 

+ 5 - 0
src/components/RxTable.vue

@@ -176,6 +176,10 @@ export default {
     },
     getHlTableListHeight() {
       const $HLtableList = $("#HLtableList");
+      // alert($HLtableList)
+      if($HLtableList.offset() == undefined){
+        return  0;
+      }
 
       return window.innerHeight - $HLtableList.offset().top - 70;
     },
@@ -217,4 +221,5 @@ export default {
 .hltable /deep/ .el-table .is-center .cell {
   padding-left: 0;
 }
+
 </style>

+ 2 - 0
src/main.js

@@ -12,6 +12,8 @@ import api from '@/api/index.js'
 import util from '@/util/index.js'
 import moment from 'moment'
 
+import JsonExcel from 'vue-json-excel'
+Vue.component('downloadExcel', JsonExcel)
 
 Vue.prototype.$api = api;
 

+ 5 - 10
src/views/suggestions/index.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="suggestions container">
         <div class="card">
-            <voteChart ref="voteChart"></voteChart>
+<!--            <voteChart ref="voteChart"></voteChart>-->
 
             <RxTable
                     ref="rxTable"
@@ -48,14 +48,7 @@
                         <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>
@@ -63,6 +56,7 @@
 
 <script>
     import RxTable from "../../components/RxTable";
+    import voteChart from "../vote/module/voteChart";
     export default {
         name: "index",
         data(){
@@ -92,7 +86,7 @@
             }
         },
         components:{
-          RxTable
+          RxTable,voteChart
         },
         methods:{
             init(){
@@ -113,6 +107,7 @@
 
                 this.pageInfo.page = page
                 // this.init()
+
             },
         },
         mounted() {

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

@@ -3,7 +3,7 @@
         <div class="echartColumn" ref="echartColumn">
         </div>
         <div class="result">
-            <div class="item" v-for="item in chartData.options">
+            <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>
@@ -92,6 +92,12 @@ export default {
 </script>
 
 <style lang="less" scoped>
+    ::-webkit-scrollbar {
+        display: none; /* Chrome Safari */
+    }
+    .voteChart{
+        display: flex;
+    }
     .nameList{
         width: calc(100% - 100px);
         /*overflow:hidden;*/
@@ -104,10 +110,11 @@ export default {
     .echartColumn {
         width: calc(100% - 50px);
       margin: 0 auto;
-      height: 300px;
+      height: 240px;
 
     }
     .result {
+        overflow-y: scroll;
       .line1 {
         display: flex;
         border-bottom: 1px solid #eeeeee;

+ 14 - 17
src/views/vote/voteActivityInfo.vue

@@ -64,15 +64,12 @@
               <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">
+          <el-table-column label="操作" fixed="right" align="left" width="240">
             <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>
-              <!--            <el-button type="text" class="btn_text_edit" icon="el-icon-edit" @click="handleEdit(scope.row)">绑定微信-->
-              <!--            </el-button>-->
-<!--              <el-button class="btn_text_danger" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除-->
-<!--              </el-button>-->
+              <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>
+<!--              <el-button type="text" class="btn_text_edit" icon="el-icon-search" @click="handleOther(scope.row)">其他信息</el-button>-->
+
             </template>
           </el-table-column>
         </RxTable>
@@ -186,15 +183,15 @@ export default {
           voteId
         }
       })
-      // let title = row.title
-      // let content = row.content
-      // this.$api.voteStatis({
-      //   voteId
-      // }).then(res => {
-      //    this.$refs.voteChart.chartData = {
-      //      ...res.content,
-      //      title,content
-      //    }
+    },
+    handleOther(row){
+      // this.$router_({
+      //   name:"voteResult",
+      //   title:"表决结果",
+      //   canClose:true,
+      //   query:{
+      //     voteId
+      //   }
       // })
     },
     addVote(){

+ 115 - 5
src/views/vote/voteResult.vue

@@ -2,7 +2,64 @@
     <div class="voteResult container">
       <div class="card">
         <voteChart ref="voteChart"></voteChart>
+          <div class="rxtable">
+             <div class="operator" style="justify-content: space-between;width: 100%;display: flex;box-sizing: border-box;padding:0px 15px;align-items: center">
+                 <el-switch
+                         active-text="已投票"
+                         inactive-text=未投票
 
+                         v-model="state"
+                         @change="changeState"
+                         active-color="#13ce66"
+                         inactive-color="#ff4949"
+                         :active-value="1"
+                         :inactive-value="2">
+                 </el-switch>
+
+                 <download-excel
+                         :data="listData.list"
+                         :fields="json_fields"
+                         name = "用户统计列表.xls">
+                     <el-button type="success" icon="el-icon-s-order" size="mini" >导出</el-button>
+                 </download-excel>
+
+
+             </div>
+
+              <RxTable
+                      ref="rxTable"
+
+
+                      :data="listData.list"
+                      :blank-col="true"
+                      :loading="loading"
+                      :page-count="listData.pageQuantity"
+                      :currentPage="pageInfo.page"
+              >
+
+
+                  <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 == 'state'">
+                              <el-tag size="small" style="width: 50px;text-align: center;" type="success" v-if="scope.row[item.prop] == 1">已投票</el-tag>
+                              <el-tag size="small" style="width: 50px;text-align: center;" v-else type="danger">未投票</el-tag>
+                          </div>
+                          <span v-else>{{ scope.row[item.prop] || scope.row[item.prop] == 0 ? scope.row[item.prop] : '-' }} </span>
+                      </template>
+                  </el-table-column>
+
+              </RxTable>
+          </div>
 
       </div>
 
@@ -29,18 +86,40 @@ export default {
       },
       tableHeader: [
         {
-          prop: "passportName",
-          label: "意见人",
-          width: "120"
+          prop: "houseName",
+          label: "房屋",
+          width: "200"
         },
 
         {
-          prop: "suggestion",
-          label: "意见",
+          prop: "activityTitle",
+          label: "活动名称",
+          width: "120"
+        },
+          {
+          prop: "voteTitle",
+          label: "投票主题",
+          width: "120"
+        },
+          {
+          prop: "state",
+          label: "投票状态",
           width: "120"
         },
 
       ],
+      state:1,
+      pageInfo:{
+          page:1,
+          pageCapacity:10
+      },
+        json_fields:{
+            "序号":"index",
+            "房屋":"houseName",
+            "活动名称":"activityTitle",
+            "投票主题":"voteTitle",
+            "投票状态":"state_",
+        }
     }
   },
   methods:{
@@ -57,9 +136,40 @@ export default {
           ...res.content,
         }
       })
+      this.houseState()
 
 
     },
+      exportExcel(){
+
+      },
+      houseState(){
+          let voteId = this.$route.query.voteId
+          this.$api.houseState({
+              voteId,
+              ...this.pageInfo,
+              state:this.state
+          }).then(res => {
+              console.log(res);
+              let voteTitle = res.content.voteTitle;
+              let activityTitle = res.content.activityTitle;
+              this.listData.list = res.content.houseNames.map(item => {
+                  return {
+                      houseName:item,
+                      voteTitle,
+                      activityTitle,
+                      state:this.state,
+                      state_: this.state == '1'?"已投票":"未投票"
+                  }
+              })
+              this.listData.pageQuantity = res.content.pageQuantity;
+
+          })
+      },
+      changeState(v){
+        this.state = v;
+        this.houseState()
+      },
     changePage(page) {
 
       this.pageInfo.page = page

+ 1 - 1
vue.config.js

@@ -3,7 +3,7 @@ module.exports = {
         proxy: {
             '/api': {
                 // target: 'http://wuqing3.tpddns.cn:8084/apiXZTVEtYzDDHEKOP6Zx',//生产
-                target: 'http://121.5.58.50:8080/',//生产
+                target: 'http://matrix34.tpddns.cn:60002/api',//生产
                 changeOrigin: true,
                 ws: true,
                 pathRewrite: {