Browse Source

质量报告

yangjunjing 5 years ago
parent
commit
8370cc0077

+ 112 - 0
src/components/echarts/fanChart.vue

@@ -0,0 +1,112 @@
+<template>
+  <!-- 饼图 -->
+  <div style="width:100%;height:100%;" :id="id">
+  </div>
+</template>
+<script>
+import echarts from "echarts"
+export default {
+  name: "doughnut",
+  props: {
+    id: {
+      type: String,
+      default: function createRandomId() {
+        return (Math.random() * 10000000).toString(16).substr(0, 4) + '-' + (new Date()).getTime() + '-' + Math.random().toString().substr(2, 5);
+      }
+    },
+    renderData: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    },
+    type: {},
+    name: "",
+    sum: ""
+  },
+  data() {
+    return {
+      myCharts: null
+    }
+  },
+  created() { },
+  mounted() {
+    this.drawDoughnut()
+  },
+  methods: {
+    drawDoughnut() {
+      console.log(this.renderData, "renderData")
+      let options = {
+        tooltip: {
+          trigger: 'item',
+          formatter: "{a} <br/>{b} : {c} ({d}%)"
+        },
+        series: [
+          {
+            name: '访问来源',
+            type: 'pie',
+            radius: '55%',
+            center: ['50%', '60%'],
+            data: [
+              { value: 335, name: '直接访问' },
+              { value: 310, name: '邮件营销' },
+              { value: 234, name: '联盟广告' },
+              { value: 135, name: '视频广告' },
+              { value: 1548, name: '搜索引擎' }
+            ],
+            label: {
+              normal: {
+                show: false
+              },
+              emphasis: {
+                show: false
+              }
+            },
+            labelLine: {
+              normal: {
+                show: false
+              },
+              emphasis: {
+                show: false
+              }
+            }
+          }
+        ]
+      }
+      // if(this.type == 'type'){
+      // options.graphic = {
+      //   type: 'text',
+      //   left: 'center',
+      //   top: 'center',
+      //   style: {
+      //     text: `总数${this.sum || ''}`,
+      //     textAlign: 'center',
+      //     fill: '#000',
+      //     width: 30,
+      //     height: 30
+      //   }
+      // }
+      // }
+      this.myCharts = echarts.init(document.getElementById(this.id))
+      this.myCharts.setOption(options)
+    },
+    delName(val) {
+      if (!!val && val.length > 3) {
+        return val.substring(0, 3) + '...'
+      } else {
+        return ''
+      }
+    }
+  },
+  watch: {
+    renderData: {
+      deep: true,
+      handler: function () {
+        this.drawDoughnut()
+      }
+    }
+  }
+}
+</script>
+<style>
+</style>

+ 69 - 0
src/components/ledger/report/dataorigin.vue

@@ -0,0 +1,69 @@
+<template>
+  <div class="doughnut-view">
+    <doughnut v-if="renderData.Sum" type="type" width="200" height="200" :sum="renderData.Sum" :name="renderData.Name" :renderData="echartsData"
+      :id="id"></doughnut>
+    <div v-else class="center">
+      <i class="icon-wushuju iconfont"></i>
+      暂无数据
+    </div>
+  </div>
+</template>
+
+<script>
+import doughnut from "@/components/echarts/doughnut"
+export default {
+  data() {
+    return {
+      echartsData: []
+    }
+  },
+  created() {
+    this.changeData();
+  },
+  components: {
+    doughnut
+  },
+  methods: {
+    changeData() {
+      this.echartsData = [
+        {
+          name: "已关联:" + this.renderData.Related,
+          value: this.renderData.Related
+        },
+        {
+          name: "未关联:" + this.renderData.Notrelated,
+          value: this.renderData.Notrelated
+        },
+        {
+          name: "未使用:" + this.renderData.Notused,
+          value: this.renderData.Notused
+        },
+      ]
+    }
+  },
+  props: {
+    id: {
+      type: String,
+      default: function createRandomId() {
+        return (Math.random() * 10000000).toString(16).substr(0, 4) + '-' + (new Date()).getTime() + '-' + Math.random().toString().substr(2, 5);
+      }
+    },
+    renderData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+}
+</script>
+
+<style lang="less">
+.doughnut-view {
+  background: white;
+  height: 165px;
+  width: 200px;
+  padding: 0 5px;
+  box-sizing: border-box;
+}
+</style>

+ 70 - 130
src/views/ledger/report/index.vue

@@ -37,9 +37,21 @@
       <div class="data equipment">
         <!-- 设备:本期只做前三个 -->
         <span class="contain-title">设备{{}}</span>
+        <div class="data-show">
+          <div v-for="(item,index) in list" :key="index" class="show-content">
+            <el-tooltip class="item" effect="dark" content="Bottom Center 提示文字" placement="bottom">
+              <i class="el-icon-info"></i>
+              <span>未关联资产</span>
+            </el-tooltip>
+            <data-origin :id="'origin' + index" :renderData="item"></data-origin>
+          </div>
+        </div>
       </div>
       <div class="data assets">
         <span class="contain-title">资产{{}}</span>
+        <div>
+          <fan-chart></fan-chart>
+        </div>
       </div>
       <div class="data parts">
         <span class="contain-title">部件{{}}</span>
@@ -62,141 +74,50 @@
 </template>
 
 <script>
+import dataOrigin from "@/components/ledger/report/dataorigin"
+import { queryDataSourceCount, synchronizeProj } from "@/fetch/point_http"
+import fanChart from "@/components/echarts/fanChart"
 export default {
   data() {
-    return {}
+    return {
+      list: [],
+      equipment: [
+        { title: '未关联资产', tips: '' },
+        { title: '现场验证状态占比', tips: '' },
+        { title: '与模型对应占比', tips: '' }
+      ],
+      assets: [
+        { title: '未关联资产', tips: '' },
+        { title: '现场验证状态占比', tips: '' },
+        { title: '有无坐标占比', tips: '' }
+      ],
+      business: [
+        { title: '各分区占比', tips: '' },
+        { title: '默认分区功能类型占比', tips: '' }
+      ],
+      tenant: [
+        { title: '关联业务空间完成度', tips: '' }
+      ],
+      shaft: [
+        { title: '按功能类型占比', tips: '' },
+        { title: '关联业务空间完成度', tips: '' }
+      ],
+    }
+  },
+  components: {
+    dataOrigin,
+    fanChart
+  },
+  mounted() { },
+  created() {
+    this.getList()
   },
   methods: {
-    handleClickDownload() {
-      this.loading = true
-      this.dataList = []
-      if (this.value == 'header1') {
-        this.getheader1Data()
-      } else if (this.value == 'header2') {
-        this.getheader2Data()
-      } else if (this.value == 'header3') {
-        this.getheader3Data()
-      }
-    },
-    getheader1Data(pageNum) {
-      pageNum = pageNum ? pageNum : 1
-      let params = {
-        Cascade: [
-          {
-            Name: "equipCategory",
-            Projection: ["EquipCode", "EquipName"]
-          },
-          {
-            Name: "property",
-            Cascade: [
-              {
-                Name: "equipFamilyList",
-                Projection: ["Family", "FamilyName"]
-              }
-            ],
-            Projection: ["Family", "EquipLocalName", "EquipLocalID", "EquipID", "CodeType", "CreateTime"]
-          },
-          {
-            Name: "building",
-            Projection: ["BuildLocalName", "BuildName", "BuildID"]
-          },
-          {
-            Name: "floor",
-            Projection: ["FloorLocalName", "FloorName", "FloorID"]
-          }
-        ],
-        Filters: " not propertyId isnull ",
-        Orders: "CreateTime desc, EquipID asc",
-        PageNumber: pageNum,
-        PageSize: 1000,
-        Projection: ["CreateTime", "BuildingId", "FloorId", "Category", "EquipLocalName", "EquipLocalID", "EquipID", "BIMID"]
-      }
-      queryEquip(params, res => {
-        this.dataList = this.dataList.concat(res.Content.map((item) => {
-          item.Property.CodeType = State[item.Property.CodeType]
-          // item.Property.Family = Family[item.Property.Family]
-          return item
-        }))
-        if (res.Total / (res.PageSize * res.PageNumber) > 1) {
-          this.getheader1Data(res.PageNumber + 1)
-        } else {
-          let time = +new Date()
-          this.loading = false
-          jsontoExcel.downloadExl(this.header1, this.dataList, `已建立关联的资产设备-${time}`)
-        }
-      })
-    },
-    getheader2Data(pageNum) {
-      pageNum = pageNum ? pageNum : 1
-      let params = {
-        Cascade: [
-          {
-            Name: "equipCategory",
-            Projection: ["EquipCode", "EquipName"]
-          },
-          {
-            Name: "building",
-            Projection: ["BuildLocalName", "BuildName", "BuildID"]
-          },
-          {
-            Name: "floor",
-            Projection: ["FloorLocalName", "FloorName", "FloorID"]
-          }
-        ],
-        Filters: " propertyId isnull ",
-        Orders: "CreateTime desc, EquipID asc",
-        PageNumber: pageNum,
-        PageSize: 1000,
-        Projection: ["CreateTime", "BuildingId", "FloorId", "Category", "EquipLocalName", "EquipLocalID", "EquipID", "BIMID"]
-      }
-      queryEquip(params, res => {
-        this.dataList = this.dataList.concat(res.Content)
-        if (res.Total / (res.PageSize * res.PageNumber) > 1) {
-          this.getheader2Data(res.PageNumber + 1)
-        } else {
-          let time = +new Date()
-          this.loading = false
-          jsontoExcel.downloadExl(this.header2, this.dataList, `未关联资产的设备-${time}`)
-        }
+    getList() {
+      queryDataSourceCount({}, res => {
+        this.list = res.Content
       })
     },
-    getheader3Data(pageNum) {
-      pageNum = pageNum ? pageNum : 1
-      let params = {
-        Cascade: [
-          {
-            Name: "equipFamilyList",
-            Projection: ["Family", "FamilyName"]
-          },
-          {
-            Name: "building",
-            Projection: ["BuildLocalName", "BuildName", "BuildID"]
-          },
-          {
-            Name: "floor",
-            Projection: ["FloorLocalName", "FloorName", "FloorID"]
-          }
-        ],
-        Filters: " EquipmentId isnull ",
-        Orders: "CreateTime desc, EquipID asc",
-        PageNumber: pageNum,
-        PageSize: 1000,
-        Projection: ["BuildingId", "FloorId", "Family", "EquipLocalName", "EquipLocalID", "EquipID", "CreateTime", "CodeType"]
-      }
-      queryProperty(params, res => {
-        this.dataList = this.dataList.concat(res.Content.map((item) => {
-          item.CodeType = State[item.CodeType]
-          return item
-        }))
-        if (res.Total / (res.PageSize * res.PageNumber) > 1) {
-          this.getheader3Data(res.PageNumber + 1)
-        } else {
-          let time = +new Date()
-          this.loading = false
-          jsontoExcel.downloadExl(this.header3, this.dataList, `未关联设备的资产-${time}`)
-        }
-      })
-    }
   }
 }
 </script>
@@ -237,16 +158,35 @@ export default {
     margin-bottom: 10px;
   }
   .data {
+    overflow: hidden;
     .contain-title {
+      display: block;
+      float: left;
       height: 30px;
+      width: 100%;
       line-height: 30px;
       border-left: 8px solid black;
-      display: inline-block;
       margin: 8px 8px;
       font-weight: 600;
       padding-left: 8px;
       cursor: default;
     }
+    .data-show {
+      width: 100%;
+      display: flex;
+      padding: 10px;
+      box-sizing: border-box;
+      flex-wrap: wrap;
+      margin: 0 10px 10px 0;
+      .show-content {
+        width: 20%;
+        background: white;
+        border: 1px solid  #c9c9c9;
+        padding: 10px;
+        box-sizing: border-box;
+        margin: 0 10px 10px 0;
+      }
+    }
   }
 }
 </style>