wuqing3 vor 2 Jahren
Ursprung
Commit
ce4e18f3ba

+ 1 - 1
package.json

@@ -13,7 +13,7 @@
     "@wangeditor/editor-for-vue": "^1.0.2",
     "axios": "^0.21.1",
     "core-js": "^3.6.5",
-    "echarts": "^5.3.2",
+    "echarts": "^5.4.2",
     "element-ui": "^2.15.6",
     "jquery": "^3.6.0",
     "moment": "^2.29.1",

BIN
src.zip


+ 11 - 1
src/api/index.js

@@ -78,7 +78,7 @@ function fetch(ourl, params = {}, methods = 'post') {
             url = ourl + '?' + qs.stringify(params);
         }
         instance[methods](url, params).then(res => {
-            if (res.code == 200 || res.code == 1) {
+            if (res.code == 1) {
                 resolve(res)
             } else if (res.code == 401 || res.code == 201) {
                 router.push({name:'login'})
@@ -167,9 +167,19 @@ export default {
     },
     verifyHouseRelation(params){
         return fetch('/houseRelation/verify',params,'put')
+    },
+    voteStatis(params){
+        return fetch('/vote/result',params,'get')
+    },
+    suggestion(params){
+        return fetch('/suggestion/s',params,'get')
+    },
+    choices(params){
+        return fetch('/vote/options/s/choice/s',params,'get')
     }
 
 
 
+
 }
 

+ 0 - 4
src/main.js

@@ -13,10 +13,6 @@ import util from '@/util/index.js'
 import moment from 'moment'
 
 
-
-
-
-
 Vue.prototype.$api = api;
 
 Vue.prototype.$util = util;

+ 6 - 0
src/router/index.js

@@ -71,6 +71,12 @@ const routes = [
                 component:() => import('@/views/verify/verify')
             },
 
+           {
+                path: '/voteResult',
+                name:'voteResult',
+                component:() => import('@/views/vote/voteResult')
+            },
+
 
 
         ]

+ 3 - 3
src/views/verify/index.vue

@@ -14,7 +14,7 @@
                     @pageChange="changePage"
 
                     :currentPage="pageInfo.page"
-                    :pageSize="pageInfo.pageSize"
+
                     :page-count="listData.pageQuantity"
                     :data="listData.list"
                     :blank-col="true"
@@ -33,7 +33,7 @@
                 >
                     <template slot-scope="scope">
                         <div v-if="item.prop == 'certificateUrl'">
-                            <el-image fit="fill" :src="scope.row[item.prop]" style="height: 36px;width: 80px;"></el-image>
+                            <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 == 'state'">
                               <span  style="color:red" v-if="scope.row.state == 2">审核 </span>
@@ -223,7 +223,7 @@
                 this.getHouseRelations()
             },
 
-            //国家list
+
             getHouseRelations() {
                 let state = this.$refs.searchForm.form.state;
 

+ 92 - 0
src/views/vote/module/voteChart.vue

@@ -0,0 +1,92 @@
+<template>
+    <div class="voteChart">
+        <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>
+        </div>
+    </div>
+</template>
+
+<script>
+import * as echarts from 'echarts'
+export default {
+  name: "voteChart",
+  data(){
+    return {
+      chartColumn:null,
+      chartData:{}
+    }
+  },
+  watch:{
+    chartData(v){
+      console.log(v)
+        let arr =v.items.map(tar => {
+          return {
+            value:tar.quantity,
+            name:tar.value
+          }
+        })
+
+      this.chartColumn.setOption({
+        title: {
+          text: v.title,
+          subtext: v.content,
+          left: 'center'
+        },
+        tooltip: {
+          trigger: 'item'
+        },
+        legend: {
+          orient: 'vertical',
+          left: 'left'
+        },
+        series: [
+          {
+            name: 'Access From',
+            type: 'pie',
+            radius: '50%',
+            data: arr,
+            emphasis: {
+              itemStyle: {
+                shadowBlur: 10,
+                shadowOffsetX: 0,
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
+              }
+            }
+          }
+        ]
+      })
+    }
+  },
+  mounted(){
+      this.chartColumn = echarts.init(this.$refs.echartColumn);
+  }
+}
+</script>
+
+<style lang="less" scoped>
+    .echartColumn {
+        width: calc(100% - 50px);
+      margin: 0 auto;
+      height: 300px;
+
+    }
+    .result {
+      .item {
+        display: flex;
+        border-bottom: 1px solid #eeeeee;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        margin-bottom: 15px;
+      }
+
+      width: calc(100% - 100px);
+      margin: 0px auto;
+
+    }
+</style>

+ 39 - 3
src/views/vote/voteActivityInfo.vue

@@ -55,7 +55,7 @@
           >
             <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;"></el-image>
+                <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'">
@@ -66,7 +66,7 @@
           </el-table-column>
           <el-table-column label="操作" fixed="right" align="left" width="200">
             <template slot-scope="scope">
-              <!--            <el-button type="text" icon="el-icon-edit" @click="handleEdit(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-edit" @click="handleEdit(scope.row)">绑定微信-->
@@ -101,16 +101,28 @@
                     <el-button type="primary" @click="onSubmit('edit')">确 定</el-button>
                 </span>
       </el-dialog>
+      <el-dialog
+              title="投票结果"
+              :visible.sync="dialogVisibleChart"
+              width="600px"
+              :lock-scroll="false">
+        <voteChart ref="voteChart"></voteChart>
+        <span slot="footer" class="dialog-footer">
+
+                </span>
+      </el-dialog>
+
     </div>
 </template>
 
 <script>
 import RxTable from "@/components/RxTable";
 import voteForm from "./module/voteForm";
+import voteChart from "./module/voteChart";
 export default {
   name: "voteActivityInfo",
   components:{
-    RxTable,voteForm
+    RxTable,voteForm,voteChart
   },
   data(){
     return {
@@ -119,6 +131,7 @@ export default {
       loading: false,
       dialogVisible: false,
       dialogVisibleUpdate:false,
+      dialogVisibleChart:false,
       tableHeader: [
         {
           prop:"sequence",
@@ -161,6 +174,29 @@ export default {
           this.$refs.voteForm.form = JSON.parse(JSON.stringify(row));
       })
     },
+    handleChart(row){
+
+      let voteId = row.id;
+      console.log(row)
+      this.$router_({
+        name:"voteResult",
+        title:"表决结果",
+        canClose:true,
+        query:{
+          voteId
+        }
+      })
+      // let title = row.title
+      // let content = row.content
+      // this.$api.voteStatis({
+      //   voteId
+      // }).then(res => {
+      //    this.$refs.voteChart.chartData = {
+      //      ...res.content,
+      //      title,content
+      //    }
+      // })
+    },
     addVote(){
         this.dialogVisible = true;
 

+ 134 - 0
src/views/vote/voteResult.vue

@@ -0,0 +1,134 @@
+<template>
+    <div class="voteResult 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="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>
+</template>
+
+<script>
+import voteChart from "@/views/vote/module/voteChart";
+import RxTable from "@/components/RxTable";
+export default {
+  name: "voteResult",
+  components:{
+    voteChart,RxTable
+  },
+  data(){
+    return {
+      // voteId
+      pageInfo: {
+        page: 1,
+        pageCapacity: 10,
+      },
+      listData:{
+        list:[]
+      },
+      tableHeader: [
+        {
+          prop: "passportName",
+          label: "意见人",
+          width: "120"
+        },
+
+        {
+          prop: "suggestion",
+          label: "意见",
+          width: "120"
+        },
+
+      ],
+    }
+  },
+  methods:{
+    init(){
+      let voteId = this.$route.query.voteId
+      this.$api.voteStatis({
+        voteId
+      }).then(res => {
+        console.log(res)
+        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) {
+
+      this.pageInfo.page = page
+      this.voteList()
+    },
+  },
+  mounted() {
+    this.init()
+  }
+}
+</script>
+
+<style scoped>
+
+</style>