Bläddra i källkod

数据质量报告

yangjunjing 5 år sedan
förälder
incheckning
5ca9ad343f

+ 8 - 2
src/api/scan/request.js

@@ -875,6 +875,12 @@ export function createPart(param, success) {
     http.postJson(url, param, success)
 }
 
+// 查询部件总数
+export function queryPart(param, success) {
+    let url = `${baseUrl}/datacenter/component/count`;
+    http.postJson(url, param, success)
+}
+
 //设备清单 - 删除部件
 export function deleteParts(param, success) {
     let url = `${baseUrl}/datacenter/component/delete?projectId=${param.projectId}`;
@@ -922,10 +928,10 @@ export function queryLinkSys(param, success) {
 //查询系统信息 - 建筑楼层 - 系统一对多
 export function querySysLinkBuild(param, success) {
     let url = `${baseUrl}/datacenter/general—system/query-new`;
-    if(param.buildingId){
+    if (param.buildingId) {
         url += `?buildingId=${param.buildingId}`
     }
-    if(param.floorId){
+    if (param.floorId) {
         url += `&floorId=${param.floorId}`
     }
     http.postJson(url, param.data, success)

+ 123 - 0
src/components/echarts/reportDoughnut.vue

@@ -0,0 +1,123 @@
+<template>
+  <div style="width:100%;height:100%;textAlign:center;" :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 []
+      }
+    },
+    text: {
+      type: String,
+      default: function () {
+        return []
+      }
+    },
+    type: {},
+    name: "",
+    sum: ""
+  },
+  created(){
+  },
+  data() {
+    return {
+      myCharts: null
+    }
+  },
+  created() { },
+  mounted() {
+    this.drawDoughnut()
+  },
+  methods: {
+    drawDoughnut() {
+      let options = {
+        tooltip: {
+          trigger: 'item',
+          formatter: "{b}: ({d}%)"
+        },
+        legend: {
+          show: false,
+          orient: 'vertical',
+          right: 10,
+          top: 30,
+          bottom: 20,
+          data: this.renderData.map(item => {
+            return item.name
+          })
+        },
+        series: [{
+          name: '',
+          type: 'pie',
+          radius: ['40%', '60%'],
+          itemStyle: {
+            normal: {
+              label: {
+                show: this.type != 'left' ? false : true,
+                textStyle: {
+                  color: '#3c4858',
+                  fontSize: "12"
+                },
+                formatter: function (val) { //让series 中的文字进行换行
+                  return val.name.split("-")[0];
+                }
+              },
+              title: {
+                text: 'aaaa'
+              },
+              labelLine: {
+                show: this.type != 'left' ? false : true,
+                lineStyle: {
+                }
+              }
+            },
+            emphasis: {
+              shadowBlur: 5,
+              shadowOffsetX: 0,
+              shadowColor: 'rgba(0, 0, 0, 0.5)',
+              textColor: '#000'
+            }
+          },
+          data: this.renderData
+        }],
+        color: ['#67C23A', 'rgb(225, 243, 216)', 'rgb(244, 244, 245)']
+      }
+      options.graphic = {
+        type: 'text',
+        left: 'center',
+        top: 'center',
+        style: {
+          text: `${this.text|| ''}`,
+          textAlign: 'center',
+          fill: '#000',
+          width: 30,
+          height: 30
+        }
+      }
+      this.myCharts = echarts.init(document.getElementById(this.id))
+      this.myCharts.setOption(options)
+    }
+  },
+  watch: {
+    renderData: {
+      deep: true,
+      handler: function () {
+        this.drawDoughnut()
+      }
+    }
+  }
+}
+</script>
+<style>
+</style>

+ 37 - 27
src/components/ledger/report/dataorigin.vue

@@ -2,12 +2,13 @@
   <div class="saga-fill">
     <div class="mess-view">
       <el-tooltip class="item" effect="dark" content="Bottom Left 提示文字" placement="bottom-start">
-        <i class="el-icon-info"><span>{{renderData.Name}}</span></i>
+        <i class="el-icon-info"><span>{{renderData.title}}</span></i>
       </el-tooltip>
     </div>
     <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>
+      <report-doughnut v-if="renderData.needCountO && renderData.needCountT" type="type" width="200" height="200"
+        :sum="renderData.sum" :name="renderData.title" :renderData="echartsData" :id="id" :text="renderData.text">
+      </report-doughnut>
       <div v-else class="center">
         <i class="icon-wushuju iconfont"></i>
         暂无数据
@@ -18,51 +19,60 @@
 </template>
 
 <script>
-import doughnut from "@/components/echarts/doughnut"
+import reportDoughnut from "@/components/echarts/reportDoughnut"
 export default {
+  name: "dataOrgin",
+  components: {
+    reportDoughnut
+  },
+  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 {
+
+        }
+      }
+    }
+  },
   data() {
     return {
       echartsData: []
     }
   },
   created() {
-    this.changeData();
-  },
-  components: {
-    doughnut
+    this.changeData()
   },
+  mounted() { },
   methods: {
     changeData() {
       this.echartsData = [
         {
-          name: "已关联:" + this.renderData.Related,
-          value: this.renderData.Related
-        },
-        {
-          name: "未关联:" + this.renderData.Notrelated,
-          value: this.renderData.Notrelated
+          name: this.renderData.contentValueO + this.renderData.needCountO,
+          value: this.renderData.needCountO
         },
         {
-          name: "未使用:" + this.renderData.Notused,
-          value: this.renderData.Notused
+          name: this.renderData.contentValueT + this.renderData.needCountT,
+          value: this.renderData.needCountT
         },
       ]
     }
   },
-  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);
-      }
-    },
+  watch: {
     renderData: {
-      type: Object,
-      default: function () {
-        return {}
+      deep: true,
+      handler: function () {
+        console.log(3)
+        this.changeData()
       }
     }
-  },
+  }
 }
 </script>
 

+ 183 - 25
src/views/ledger/report/index.vue

@@ -32,22 +32,35 @@
         </li>
       </ul>
     </div>
-    <div class="progress" v-loading="loading">
+    <div class="progress">
       <p class="basic-statistics">基本统计</p>
       <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">
+        <span class="contain-title">设备<i>{{equipCount}}</i></span>
+        <div class="data-show" v-loading="isLoading" v-if="equipment.length">
+          <div class="show-content" v-for="(item,index) in equipment" :key="index">
             <data-origin :id="'origin' + index" :renderData="item"></data-origin>
           </div>
+          <div v-if="!equipment.length" class="center" style="margin-top: 260px;">
+            <i class="icon-wushuju iconfont"></i>
+            暂无数据
+          </div>
         </div>
       </div>
       <div class="data assets">
-        <span class="contain-title">资产{{}}</span>
+        <span class="contain-title">资产<i>{{assetsCount}}</i></span>
+        <div class="data-show" v-loading="isLoading" v-if="assets.length">
+          <div class="show-content" v-for="(item,index) in assets" :key="index">
+            <data-origin :id="'origin' + index" :renderData="item"></data-origin>
+          </div>
+          <div v-if="!assets.length" class="center" style="margin-top: 260px;">
+            <i class="icon-wushuju iconfont"></i>
+            暂无数据
+          </div>
+        </div>
       </div>
       <div class="data parts">
-        <span class="contain-title">部件{{}}</span>
+        <span class="contain-title">部件<i>{{partsCount}}</i></span>
       </div>
       <div class="data business-space">
         <span class="contain-title">业务空间{{}}</span>
@@ -72,23 +85,21 @@
 </template>
 
 <script>
-import dataOrigin from "@/components/ledger/report/dataorigin"
-import datafan from "@/components/ledger/report/datafan"
-import { queryDataSourceCount, synchronizeProj } from "@/fetch/point_http"
+import { mapGetters } from "vuex";
+import { countEquip, countProperty, queryPart } from "@/api/scan/request";
+import dataOrigin from "@/components/ledger/report/dataorigin";
+import datafan from "@/components/ledger/report/datafan";
+import { queryDataSourceCount, synchronizeProj } from "@/fetch/point_http";
+
 export default {
   data() {
     return {
       list: [],
-      equipment: [
-        { title: '未关联资产', tips: '' },
-        { title: '现场验证状态占比', tips: '' },
-        { title: '与模型对应占比', tips: '' }
-      ],
-      assets: [
-        { title: '未关联资产', tips: '' },
-        { title: '现场验证状态占比', tips: '' },
-        { title: '有无坐标占比', tips: '' }
-      ],
+      equipCount: '',
+      equipment: [],
+      assetsCount: '',
+      assets: [],
+      partsCount: '',
       business: [
         { title: '各分区占比', tips: '' },
         { title: '默认分区功能类型占比', tips: '' }
@@ -100,7 +111,7 @@ export default {
         { title: '按功能类型占比', tips: '' },
         { title: '关联业务空间完成度', tips: '' }
       ],
-      loading: false
+      isLoading: false
     }
   },
   components: {
@@ -109,15 +120,159 @@ export default {
   },
   mounted() { },
   created() {
-    this.getList()
+    this.getEquipCount();
+    this.getAssetsCount();
+    this.getPartsCount();
+  },
+  computed: {
+    ...mapGetters('layout', ['userInfo', 'projectId', 'projects', 'userId'])
   },
   methods: {
-    getList() {
-      queryDataSourceCount({}, res => {
-        this.list = res.Content
+    getEquipCount() {
+      this.isLoading = true;
+      let params = {
+        ProjectId: this.projectId
+      }
+      // 获取设备总数
+      countEquip(params, res => {
+        this.equipCount = res.Count;
+        this.getEquipOtherCount();
       })
     },
-  }
+    getEquipOtherCount() {
+      // 获取设备数据
+      let param = {
+        ProjectId: this.projectId,
+        Filters: "PropertyId isNull"
+      }
+      countEquip(param, res => {
+        this.equipment.push({
+          title: '未关联资产',
+          tips: '',
+          contentValueO: '未关联',
+          contentValueT: '已关联',
+          text: '',
+          needCountO: res.Count,
+          needCountT: this.equipCount - res.Count,
+          text: `总数${this.equipCount}`
+        })
+      })
+
+      let par = {
+        ProjectId: this.projectId,
+        Filters: "taskState = 0 or taskState = 1"
+      }
+      countEquip(par, res => {
+        this.equipment.push({
+          title: '与模型对应占比',
+          tips: '',
+          contentValueO: '未验证',
+          contentValueT: '已验证',
+          text: '',
+          needCountO: res.Count,
+          needCountT: this.equipCount - res.Count,
+          text: `${res.Count}/${this.equipCount}`
+        })
+      })
+
+      let pa = {
+        ProjectId: this.projectId,
+        Filters: "not BimID isNull"
+      }
+      countEquip(pa, res => {
+        this.equipment.push({
+          title: '现场验证状态占比',
+          tips: '',
+          contentValueO: '已验证',
+          contentValueT: '未验证',
+          text: '',
+          needCountO: res.Count,
+          needCountT: this.equipCount - res.Count,
+          text: `${res.Count}/${this.equipCount}`
+        })
+        this.isLoading = false;
+      })
+    },
+    getAssetsCount() {
+      // 获取资产数据
+      let params = {
+        ProjectId: this.projectId
+      }
+      countProperty(params, res => {
+        // 获取资产总数
+        this.assetsCount = res.Count;
+      })
+
+      let param = {
+        ProjectId: this.projectId,
+        Filters: " EquipmentId isnull"
+      }
+      countProperty(param, res => {
+        this.assets.push({
+          title: '未关联资产',
+          tips: '',
+          contentValueO: '未关联',
+          contentValueT: '已关联',
+          text: `总数${this.assetsCount}`,
+          needCountO: res.Count,
+          needCountT: this.assetsCount - res.Count
+        })
+      })
+
+      let par = {
+        ProjectId: this.projectId,
+        Filters: " taskState = 0 or taskState = 1"
+      }
+      countProperty(par, res => {
+        let text = res.Count / this.assetsCount;
+        text = this.toPercent(text);
+        this.assets.push({
+          title: '现场验证状态占比',
+          tips: '',
+          contentValueO: '已验证',
+          contentValueT: '未验证',
+          text: `已验证${text}`,
+          needCountO: res.Count,
+          needCountT: this.assetsCount - res.Count
+        })
+      })
+
+      let pa = {
+        ProjectId: this.projectId,
+        Filters: " not BIMLocation isnull"
+      }
+      countProperty(pa, res => {
+        let text = res.Count / this.assetsCount;
+        text = this.toPercent(text);
+        this.assets.push({
+          title: '有无坐标占比',
+          tips: '',
+          contentValueO: '有坐标',
+          contentValueT: '无坐标',
+          text: `有坐标${text}`,
+          needCountO: res.Count,
+          needCountT: this.assetsCount - res.Count
+        })
+      })
+    },
+    getPartsCount() {
+      let params = {
+        ProjectId: this.projectId
+      }
+      queryPart(params, res => {
+        this.partsCount = res.Count;
+      })
+    },
+    toPercent(point) {
+      // 小数转换成百分比
+      if (point == 0) {
+        return 0;
+      }
+      var str = Number(point * 100).toFixed(2);
+      str += "%";
+      return str;
+    }
+  },
 }
 </script>
 
@@ -166,6 +321,9 @@ export default {
       font-weight: 600;
       padding-left: 8px;
       cursor: default;
+      i {
+        margin-left: 12px;
+      }
     }
   }
 }