Browse Source

数据质量报告

yangjunjing 5 years ago
parent
commit
38b41d4a1e

+ 65 - 0
src/api/scan/request.js

@@ -704,6 +704,12 @@ export function EqToAssets(param, success) {
     http.postJson(url, data, success)
 }
 
+//台账中待删除的对象
+export function queryLederDelObject(param, success) {
+    let url = `${baseUrl}/datacenter/statistics/object-delete-count`
+    http.postJson(url, param, success)
+}
+
 //获取设定参数和动态参数
 export function BeatchQueryParam(param, success) {
     let url = `${physics}/parameter/batch_query_param?projectId=${param.ProjId}&secret=${param.secret}`
@@ -723,6 +729,24 @@ export function delBatchList(param, success) {
     http.postJson(url, data, success)
 }
 
+//根据条件查询统计数量
+export function queryCenoteCount(param, success) {
+    let url = `${baseUrl}/datacenter/shaft/count`
+    http.postJson(url, param, success)
+}
+
+//竖井-按功能类型占比
+export function queryShaftFunctionType(param, success) {
+    let url = `${baseUrl}/datacenter/statistics/shaft-functype-count`
+    http.postJson(url, param, success)
+}
+
+//竖井-关联业务空间完成度
+export function ShaftRelationBusinessSpace(param, success) {
+    let url = `${baseUrl}/datacenter/statistics/shaft2sp-count`
+    http.postJson(url, param, success)
+}
+
 //获取竖井类型
 export function getCenoteType(param, success) {
     let url = `${baseUrl}/datacenter/shaft/query-shaft-functype`
@@ -771,6 +795,17 @@ export function getRentTableData(param, success) {
     http.postJson(url, param, success)
 }
 
+//根据条件查询统计数量
+export function queryRentCount(param, success) {
+    let url = `${baseUrl}/datacenter/tenant/count`
+    http.postJson(url, param, success)
+}
+
+export function queryTenantCompletion(param, success) {
+    let url = `${baseUrl}/datacenter/statistics/tenant2sp-count`
+    http.postJson(url, param, success)
+}
+
 //创建租户信息
 export function createRentTableData(param, success) {
     let url = `${baseUrl}/datacenter/tenant/create`
@@ -795,6 +830,24 @@ export function saveRentRelateSpace(param, success) {
     http.postJson(url, param, success)
 }
 
+//根据条件查询分区数量
+export function queryZoneCount(param, success) {
+    let url = `${baseUrl}/datacenter/zonespacebase/count`
+    http.postJson(url, param, success)
+}
+
+//查询各分区占比
+export function queryPartitionRatio(param, success) {
+    let url = `${baseUrl}/datacenter/statistics/sp-objecttype-count`
+    http.postJson(url, param, success)
+}
+
+//业务空间-默认分区功能类型占比
+export function queryDefaultFunTypes(param, success) {
+    let url = `${baseUrl}/datacenter/statistics/general-sp-functype-count`
+    http.postJson(url, param, success)
+}
+
 //扫楼创建资产
 export function createFmList(param, success) {
     let url = `${api}/service/fm/create`
@@ -1556,4 +1609,16 @@ export function addTabFunNum(param, success) {
 export function tableFuncRelatedOverview(param, success) {
     let url = `/pointconfig/report/meter-related`
     http.postJson(url, param, success)
+}
+
+// 不能同步到物理世界的关系数据
+export function notSyncRelationData(param, success) {
+    let url = `${baseUrl}/datacenter/statistics/unsyn-relation-count`
+    http.postJson(url, param, success)
+}
+
+// 岗位和关联的资产信息点值不一致
+export function postRelationInforAtpism(param, success) {
+    let url = `${baseUrl}/datacenter//statistics/eq2pe-count`
+    http.postJson(url, param, success)
 }

+ 2 - 9
src/components/echarts/fanChart.vue

@@ -35,7 +35,6 @@ export default {
   },
   methods: {
     drawDoughnut() {
-      console.log(this.renderData, "renderData")
       let options = {
         tooltip: {
           trigger: 'item',
@@ -43,17 +42,11 @@ export default {
         },
         series: [
           {
-            name: '访问来源',
+            name: '占比',
             type: 'pie',
             radius: '55%',
             center: ['50%', '60%'],
-            data: [
-              { value: 335, name: '直接访问' },
-              { value: 310, name: '邮件营销' },
-              { value: 234, name: '联盟广告' },
-              { value: 135, name: '视频广告' },
-              { value: 1548, name: '搜索引擎' }
-            ],
+            data: this.renderData,
             label: {
               normal: {
                 show: false

+ 6 - 21
src/components/ledger/report/datafan.vue

@@ -2,11 +2,11 @@
   <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">
-      <fan-chart v-if="renderData.Sum"></fan-chart>
+      <fan-chart v-if="renderData.needCountO" type="type" width="200" height="200" :name="renderData.title" :renderData="echartsData" :id="id"></fan-chart>
       <div v-else class="center">
         <i class="icon-wushuju iconfont"></i>
         暂无数据
@@ -25,28 +25,12 @@ export default {
     }
   },
   created() {
-    this.changeData();
+    this.echartsData = this.renderData.needCountO;
   },
   components: {
     fanChart
   },
   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: {
@@ -65,7 +49,7 @@ export default {
 }
 </script>
 
-<style lang="less">
+<style lang="less" scoped>
 .mess-view {
   box-sizing: border-box;
   border-bottom: 1px solid #ddd;
@@ -83,7 +67,8 @@ export default {
   }
 }
 .saga-fill {
-  width: 100%;
+  width: 345px;
+  height: 220px;
   .doughnut-view {
     height: 165px;
     width: 100%;

+ 5 - 4
src/components/ledger/report/dataorigin.vue

@@ -6,8 +6,8 @@
       </el-tooltip>
     </div>
     <div class="doughnut-view">
-      <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 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>
@@ -76,7 +76,7 @@ export default {
 }
 </script>
 
-<style lang="less">
+<style lang="less" scoped>
 .mess-view {
   box-sizing: border-box;
   border-bottom: 1px solid #ddd;
@@ -94,7 +94,8 @@ export default {
   }
 }
 .saga-fill {
-  width: 100%;
+  width: 345px;
+  height: 220px;
   .doughnut-view {
     height: 165px;
     width: 100%;

+ 317 - 53
src/views/ledger/report/index.vue

@@ -5,7 +5,7 @@
         <li>
           <p class="list-num">
             <i class='el-icon-s-order'></i>
-            {{324}}
+            {{lederDelObjectCount}}
           </p>
           <p class="list-text">台账中待删除的对象</p>
         </li>
@@ -19,14 +19,14 @@
         <li>
           <p class="list-num">
             <i class="el-icon-s-marketing"></i>
-            {{33}}
+            {{notSyncDataCount}}
           </p>
           <p class="list-text">不能同步到物理世界的关系数据</p>
         </li>
         <li>
           <p class="list-num">
             <i class="el-icon-s-release"></i>
-            {{134}}
+            {{postRelationInforCount}}
           </p>
           <p class="list-text">岗位和关联的资产信息点值不一致</p>
         </li>
@@ -36,49 +36,82 @@
       <p class="basic-statistics">基本统计</p>
       <div class="data equipment">
         <!-- 设备:本期只做前三个 -->
-        <span class="contain-title">设备<i>{{equipCount}}</i></span>
+        <span class="contain-title">设备<i>{{`(${equipCount?equipCount:"0"})`}}</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 v-if="!equipment.length" class="center" style="height: 60%;transform: translateY(30%);">
+          <i class="icon-wushuju iconfont"></i>
+          暂无数据
         </div>
       </div>
       <div class="data assets">
-        <span class="contain-title">资产<i>{{assetsCount}}</i></span>
+        <span class="contain-title">资产<i>{{`(${assetsCount?assetsCount:"0"})`}}</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 v-if="!assets.length" class="center" style="height: 60%;transform: translateY(30%);">
+          <i class="icon-wushuju iconfont"></i>
+          暂无数据
         </div>
       </div>
       <div class="data parts">
-        <span class="contain-title">部件<i>{{partsCount}}</i></span>
+        <span class="contain-title">部件<i>{{`(${partsCount?partsCount:'0'})`}}</i></span>
+        <div v-if="!parts.length" class="center" style="height: 60%;transform: translateY(30%);">
+          <i class="icon-wushuju iconfont"></i>
+          暂无数据
+        </div>
       </div>
       <div class="data business-space">
-        <span class="contain-title">业务空间{{}}</span>
-        <div class="data-show">
-          <div v-for="(item,index) in list" :key="index" class="show-content">
-            <datafan :id="'origin' + index" :renderData="item"></datafan>
+        <span class="contain-title">业务空间<i>{{`(${zoneSpaceCount?zoneSpaceCount:'0'})`}}</i></span>
+        <div class="data-show" v-if="business.length">
+          <div v-for="(item,index) in business" :key="index" class="show-content">
+            <datafan :id="'datafan' + index" :renderData="item"></datafan>
           </div>
         </div>
+        <div v-if="!business.length" class="center" style="height: 60%;transform: translateY(30%);">
+          <i class="icon-wushuju iconfont"></i>
+          暂无数据
+        </div>
       </div>
       <div class="data system">
         <!-- 系统:本期只查询总数 -->
-        <span class="contain-title">系统{{}}</span>
+        <span class="contain-title">系统<i>{{`(${systemCount?systemCount:'0'})`}}</i></span>
+        <div v-if="!system.length" class="center" style="height: 60%;transform: translateY(30%);">
+          <i class="icon-wushuju iconfont"></i>
+          暂无数据
+        </div>
       </div>
       <div class="data tenant">
-        <span class="contain-title">租户{{}}</span>
+        <span class="contain-title">租户<i>{{`(${rentantCount?rentantCount:'0'})`}}</i></span>
+        <div class="data-show" v-loading="isLoading" v-if="tenant.length">
+          <div class="show-content" v-for="(item,index) in tenant" :key="index">
+            <data-origin :id="'origin' + item + index" :renderData="item"></data-origin>
+          </div>
+        </div>
+        <div v-if="!tenant.length" class="center" style="height: 60%;transform: translateY(30%);">
+          <i class="icon-wushuju iconfont"></i>
+          暂无数据
+        </div>
       </div>
       <div class="data shaft">
-        <span class="contain-title">竖井{{}}</span>
+        <span class="contain-title">竖井<i>{{`(${shaftCount?shaftCount:'0'})`}}</i></span>
+        <div class="data-show" v-loading="isLoading" v-if="shaft.length">
+          <div class="show-content">
+            <datafan :id="'origin' + shaft" :renderData="shaft[0]"></datafan>
+          </div>
+          <div class="show-content">
+            <data-origin :id="'origin' + shaft" :renderData="shaft[1]"></data-origin>
+          </div>
+        </div>
+        <div v-if="!shaft.length" class="center" style="height: 60%;transform: translateY(30%);">
+          <i class="icon-wushuju iconfont"></i>
+          暂无数据
+        </div>
       </div>
     </div>
   </div>
@@ -86,7 +119,24 @@
 
 <script>
 import { mapGetters } from "vuex";
-import { countEquip, countProperty, queryPart } from "@/api/scan/request";
+import {
+  queryLederDelObject,
+  notSyncRelationData,
+  postRelationInforAtpism,
+  countEquip,
+  countProperty,
+  queryPart,
+  queryZoneCount,
+  queryPartitionRatio,
+  queryDefaultFunTypes,
+  countGeneralSys,
+  queryRentCount,
+  queryTenantCompletion,
+  queryCenoteCount,
+  queryShaftFunctionType,
+  ShaftRelationBusinessSpace,
+  getDataDictionary
+} 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";
@@ -94,23 +144,90 @@ import { queryDataSourceCount, synchronizeProj } from "@/fetch/point_http";
 export default {
   data() {
     return {
-      list: [],
-      equipCount: '',
+      lederDelObjectCount: null,
+      notSyncDataCount: null,
+      postRelationInforCount: null,
+      equipCount: null,
       equipment: [],
-      assetsCount: '',
+      assetsCount: null,
       assets: [],
-      partsCount: '',
-      business: [
-        { title: '各分区占比', tips: '' },
-        { title: '默认分区功能类型占比', tips: '' }
-      ],
-      tenant: [
-        { title: '关联业务空间完成度', tips: '' }
-      ],
-      shaft: [
-        { title: '按功能类型占比', tips: '' },
-        { title: '关联业务空间完成度', tips: '' }
+      parts: [],
+      partsCount: null,
+      zoneSpaceCount: null,
+      zoneType: [
+        {
+          "Code": "GeneralZone",
+          "Name": "默认分区",
+          "Rel_type": "99"
+        },
+        {
+          "Name": "供电分区",
+          "Rel_type": "1",
+          "Code": "PowerSupplyZone"
+        },
+        {
+          "Name": "照明分区",
+          "Rel_type": "2",
+          "Code": "LightingZone"
+        },
+        {
+          "Name": "网络分区",
+          "Rel_type": "3",
+          "Code": "NetworkZone"
+        },
+        {
+          "Code": "AirConditioningZone",
+          "Name": "空调分区",
+          "Rel_type": "4"
+        },
+        {
+          "Name": "采暖分区",
+          "Rel_type": "5",
+          "Code": "HeatingZone"
+        },
+        {
+          "Name": "洁净分区",
+          "Rel_type": "6",
+          "Code": "CleanZone"
+        },
+        {
+          "Name": "生活给水分区",
+          "Rel_type": "7",
+          "Code": "DomesticWaterSupplyZone"
+        },
+        {
+          "Code": "FireZone",
+          "Name": "防火分区",
+          "Rel_type": "8"
+        },
+        {
+          "Name": "安防分区",
+          "Rel_type": "9",
+          "Code": "SecurityZone"
+        },
+        {
+          "Name": "租户分区",
+          "Rel_type": "10",
+          "Code": "TenantZone"
+        },
+        {
+          "Name": '功能分区',
+          'Rel_type': '11',
+          "Code": 'FunctionZone'
+        }
       ],
+      partProtion: [],
+      defaultPart: [],
+      funtionType: [],
+      business: [],
+      systemCount: null,
+      system: [],
+      rentantCount: null,
+      shaftCount: null,
+      tenant: [],
+      shaft: [],
+      shaftPartProtion: [],
+      params: null,
       isLoading: false
     }
   },
@@ -120,27 +237,48 @@ export default {
   },
   mounted() { },
   created() {
+    this.params = {
+      ProjectId: this.projectId
+    }
+    this.getFunctionType();
+    this.getStatisticsCount();
     this.getEquipCount();
     this.getAssetsCount();
     this.getPartsCount();
+    this.getSystemCount();
+    this.getTenantCount();
+    this.getShaftCount();
   },
   computed: {
-    ...mapGetters('layout', ['userInfo', 'projectId', 'projects', 'userId'])
+    ...mapGetters('layout', ['projectId'])
   },
   methods: {
-    getEquipCount() {
-      this.isLoading = true;
+    getStatisticsCount() {
+      // 获取顶部四个统计的数据
       let params = {
-        ProjectId: this.projectId
+        ProjectId: this.projectId,
+        Filters: "taskState = -1"
       }
+      queryLederDelObject(params, res => {
+        this.lederDelObjectCount = res.Count;
+      })
+
+      notSyncRelationData(this.params, res => {
+        this.notSyncDataCount = res.Count;
+      })
+
+      postRelationInforAtpism(this.params, res => {
+        this.postRelationInforCount = res.Count;
+      })
+    },
+    getEquipCount() {
       // 获取设备总数
-      countEquip(params, res => {
+      countEquip(this.params, res => {
         this.equipCount = res.Count;
         this.getEquipOtherCount();
       })
     },
     getEquipOtherCount() {
-      // 获取设备数据
       let param = {
         ProjectId: this.projectId,
         Filters: "PropertyId isNull"
@@ -195,10 +333,7 @@ export default {
     },
     getAssetsCount() {
       // 获取资产数据
-      let params = {
-        ProjectId: this.projectId
-      }
-      countProperty(params, res => {
+      countProperty(this.params, res => {
         // 获取资产总数
         this.assetsCount = res.Count;
       })
@@ -231,7 +366,7 @@ export default {
           tips: '',
           contentValueO: '已验证',
           contentValueT: '未验证',
-          text: `已验证${text}`,
+          text: text,
           needCountO: res.Count,
           needCountT: this.assetsCount - res.Count
         })
@@ -249,18 +384,142 @@ export default {
           tips: '',
           contentValueO: '有坐标',
           contentValueT: '无坐标',
-          text: `有坐标${text}`,
+          text: text,
           needCountO: res.Count,
           needCountT: this.assetsCount - res.Count
         })
       })
     },
     getPartsCount() {
+      queryPart(this.params, res => {
+        this.partsCount = res.Count;
+      })
+    },
+    PartsTypeConversion(item) {
+      this.zoneType.map(it => {
+        if (item.Name === it.Code) {
+          item.Name = it.Name;
+        }
+      })
+    },
+    getFunctionType() {
+      // 获取默认功能分区类型
       let params = {
-        ProjectId: this.projectId
+        ProjectId: this.projectId,
+        type: "GeneralZone",
+        data: {
+          Filters: "InfoPointCode='RoomFuncType'",
+          Projection: ["DataSource", "InfoPointCode"]
+        }
       }
-      queryPart(params, res => {
-        this.partsCount = res.Count;
+      getDataDictionary(params, res => {
+        this.functionType = JSON.parse(res.Content[0].DataSource)
+        this.getZoneSpaceCount();
+      })
+    },
+    getZoneSpaceCount() {
+      queryZoneCount(this.params, res => {
+        this.zoneSpaceCount = res.Count;
+      })
+
+      queryPartitionRatio(this.params, res => {
+        res.Content.map(item => {
+          this.PartsTypeConversion(item);
+          this.partProtion.push({
+            name: item.Name,
+            value: item.Count
+          })
+        })
+        this.business.push({
+          title: '各分区占比',
+          tips: '',
+          needCountO: this.partProtion,
+        })
+      })
+
+      queryDefaultFunTypes(this.params, res => {
+        res.Content.map(item => {
+          this.functionTypeTranstion(item, this.functionType);
+        })
+        this.business.push({
+          title: '默认分区功能类型占比',
+          tips: '',
+          needCountO: this.funtionType,
+        })
+      })
+    },
+    functionTypeTranstion(item, type) {
+      type.map(it => {
+        if (item.Name === it.Code) {
+          item.Name = it.Name;
+          this.defaultPart.push({
+            name: item.Name,
+            value: item.Count
+          });
+        }
+        if (it.Content) {
+          this.functionTypeTranstion(item, it.Content)
+        }
+      })
+    },
+    getSystemCount() {
+      countGeneralSys(this.params, res => {
+        this.systemCount = res.Count;
+      })
+    },
+    getTenantCount() {
+      queryRentCount(this.params, res => {
+        this.rentantCount = res.Count;
+      })
+
+      // 租户-关联业务空间完成度
+      queryTenantCompletion(this.params, res => {
+        let text = res.Count / this.rentantCount;
+        text = this.toPercent(text);
+        this.tenant.push({
+          title: '关联业务空间完成度',
+          tips: '',
+          contentValueO: '已关联',
+          contentValueT: '未关联',
+          text: '',
+          needCountO: res.Count,
+          needCountT: this.rentantCount - res.Count,
+          text: text
+        })
+      })
+    },
+    getShaftCount() {
+      queryCenoteCount(this.params, res => {
+        this.shaftCount = res.Count;
+      })
+
+      queryShaftFunctionType(this.params, res => {
+        res.Content.map(item => {
+          this.PartsTypeConversion(item);
+          this.shaftPartProtion.push({
+            name: item.Name,
+            value: item.Count
+          })
+        })
+        this.shaft.push({
+          title: '按功能类型占比',
+          tips: '',
+          needCountO: this.shaftPartProtion,
+        })
+      })
+
+      ShaftRelationBusinessSpace(this.params, res => {
+        let text = this.toPercent(res.Count / this.shaftCount);
+        this.shaft.push({
+          title: '关联业务空间完成度',
+          tips: '',
+          contentValueO: '已关联',
+          contentValueT: '未关联',
+          text: '',
+          needCountO: res.Count,
+          needCountT: this.shaftCount - res.Count,
+          text: text
+        })
       })
     },
     toPercent(point) {
@@ -312,6 +571,9 @@ export default {
     margin-bottom: 10px;
   }
   .data {
+    // background: white;
+    margin-bottom: 20px;
+    height: 280px;
     .contain-title {
       height: 30px;
       line-height: 30px;
@@ -322,7 +584,8 @@ export default {
       padding-left: 8px;
       cursor: default;
       i {
-        margin-left: 12px;
+        margin-left: 6px;
+        font-weight: normal;
       }
     }
   }
@@ -333,10 +596,11 @@ export default {
   flex-wrap: wrap;
   .show-content {
     background: white;
-    width: 15%;
+    overflow: hidden;
     margin-right: 10px;
     margin-bottom: 10px;
     border: 1px solid #c9c9c9;
+    border-radius: 5px;
   }
 }
 </style>