瀏覽代碼

add 机构信息统计

wangJJ 5 年之前
父節點
當前提交
bf0f539c44
共有 2 個文件被更改,包括 47 次插入128 次删除
  1. 11 10
      src/components/commons/Header2.0.vue
  2. 36 118
      src/pages/Statistics/StatisticsReport.vue

+ 11 - 10
src/components/commons/Header2.0.vue

@@ -56,11 +56,11 @@
 
             <span v-if="isLogin&&rolesPermissions.isSystemAdministrator">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>
 
-<!--            <li v-if="isLogin&&rolesPermissions.isSystemAdministrator">-->
-<!--              <router-link v-if="isLogin" to="/statistics">-->
-<!--                <span>统计报表</span>-->
-<!--              </router-link>-->
-<!--            </li>-->
+            <li v-if="isLogin&&rolesPermissions.isSystemAdministrator">
+              <router-link v-if="isLogin" to="/statistics">
+                <span>机构统计</span>
+              </router-link>
+            </li>
 
             <!--            <span v-if="isLogin">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>-->
 <!--            <li>-->
@@ -171,9 +171,9 @@
                 getCurrentUser().then((res) => {
                     storageSave('user', res)
                     this.setUser(res);
-                    this.user = res
-                    this.rolesPermissions = getRolesPermissions(res.roleList)
+                    this.user = res;
                     storageSave('rolesPermissions', getRolesPermissions(res.roleList))
+                    this.rolesPermissions = storageGet('rolesPermissions')
                     console.log('用户信息加载成功')
                     this.isLogin = true
                     // this.fullScreenLoading = false
@@ -184,7 +184,8 @@
                     this.hideLoading();
                 })
             } else {
-                this.user = storageGet('user')
+                this.user = storageGet('user');
+                this.rolesPermissions = storageGet('rolesPermissions')
                 // this.fullScreenLoading = false
                 this.isLogin = true
             }
@@ -193,8 +194,8 @@
         getCurrentUserSuccess (res) {
             storageSave('user', res)
             this.user = res
-            this.rolesPermissions = getRolesPermissions(res.roleList)
             storageSave('rolesPermissions', getRolesPermissions(res.roleList))
+            this.rolesPermissions = storageGet('rolesPermissions')
             console.log('用户信息加载成功')
 
             this.isLogin = true
@@ -387,7 +388,7 @@
     },
     beforeMount () {
       this.getAddress();
-        this.setUserInfo()
+        this.setUserInfo();
         // if (storageGet('user' != null)){
         //   this.isLogin = true
         // }

+ 36 - 118
src/pages/Statistics/StatisticsReport.vue

@@ -1,143 +1,61 @@
 <template>
   <div class="statistics-container container">
-    <el-row :gutter="20">
-      <el-col :span="12">
-        <div id="fieldType" style="width: 100%;height: 500px"></div>
-      </el-col>
-      <el-col :span="12">
-        <div id="appType"></div>
-      </el-col>
-    </el-row>
-    <el-row :gutter="20">
-      <el-col :span="12">
-        <div id="testType"></div>
-      </el-col>
-      <el-col :span="12">
-<!--        <div id="appType"></div>-->
-      </el-col>
-    </el-row>
+    <el-card shadow="hover" class="project-statistics-card" v-for="item in agencyList">
+      <div class="project-statistics-card-title">{{Object.keys(item)[0]}}</div>
+      <div class="project-statistics-card-number">{{item[Object.keys(item)[0]]}}</div>
+    </el-card>
   </div>
 </template>
 
 <script>
   import {notify} from "../../constants";
   import Http from '@/js/http.js';
-  import {storageGet} from '@/js/index.js'
-  import Apis from '@/js/api'
 
   export default {
     name: "StatisticsReport",
     data() {
       return {
-        user: {},
-        typeChartData:{}
+        agencyList:{}
       }
     },
     methods: {
-      setUserInfo() {
-        this.user = storageGet('user') && storageGet('user').userVO;
-      },
-      getTypeChartData(){
-        Http.get('/api/common/statistics/count').then(res=>{
-          this.typeChartData = res;
+      getAgencyList(){
+        Http.get('/api/common/agency/project/count').then(res=>{
+          this.agencyList = res.data;
+        }).catch((err)=>{
+          notify('error',err)
         })
       },
-      //画领域类型的柱状图
-      drawFieldTypeChart() {
-        // 基于准备好的dom,初始化echarts实例
-        let myChart = this.$echarts.init(document.getElementById("fieldType"));
-        // 指定图表的配置项和数据
-        let option = {
-          title: {
-            text: "领域类型项目数量"
-          },
-          tooltip: {},
-          legend: {
-            data: ["数量"]
-          },
-          xAxis: {
-            data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
-          },
-          yAxis: {},
-          series: [
-            {
-              name: "销量",
-              type: "bar",
-              data: [5, 20, 36, 10, 10, 20]
-            }
-          ]
-        };
-        // 使用刚指定的配置项和数据显示图表。
-        myChart.setOption(option);
-      },
-      //画应用类型的柱状图
-      drawAPPTypeChart() {
-        // 基于准备好的dom,初始化echarts实例
-        let myChart = this.$echarts.init(document.getElementById("appType"));
-        // 指定图表的配置项和数据
-        let option = {
-          title: {
-            text: "应用类型项目数量"
-          },
-          tooltip: {},
-          legend: {
-            data: ["数量"]
-          },
-          xAxis: {
-            data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
-          },
-          yAxis: {},
-          series: [
-            {
-              name: "销量",
-              type: "bar",
-              data: [5, 20, 36, 10, 10, 20]
-            }
-          ]
-        };
-        // 使用刚指定的配置项和数据显示图表。
-        myChart.setOption(option);
-      },
-      //画测试类型的柱状图
-      drawTestTypeChart() {
-        // 基于准备好的dom,初始化echarts实例
-        let myChart = this.$echarts.init(document.getElementById("testType"));
-        // 指定图表的配置项和数据
-        let option = {
-          title: {
-            text: "测试类型项目数量"
-          },
-          tooltip: {},
-          legend: {
-            data: ["数量"]
-          },
-          xAxis: {
-            data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
-          },
-          yAxis: {},
-          series: [
-            {
-              name: "销量",
-              type: "bar",
-              data: [5, 20, 36, 10, 10, 20]
-            }
-          ]
-        };
-        // 使用刚指定的配置项和数据显示图表。
-        myChart.setOption(option);
-      },
     },
     mounted() {
-      this.setUserInfo();
-      this.getProjectCount();
-      // this.getTypeChartData();
-      // this.drawFieldTypeChart();
-      // this.drawAPPTypeChart();
-      // this.drawTestTypeChart();
+      this.getAgencyList();
     }
   }
 </script>
 
-<style scoped>
-
+<style scoped lang="less">
+.statistics-container{
+  margin-top: 20px;
+  display: flex;
+  flex-wrap:wrap;
+  .project-statistics-card{
+    justify-content: space-between;
+    flex: 0 0 32%;
+    margin-right: 10px;
+    margin-bottom: 10px;
+    .project-statistics-card-title {
+      text-align: center;
+      font-size: 16px;
+    }
+    .project-statistics-card-number {
+      margin: 10px auto;
+      text-align: center;
+      font-weight: bolder;
+      font-size: 28px;
+    }
+  }
+  .project-statistics-card:last-child{
+    margin-right: 0;
+  }
+}
 </style>