From 43c2f5b94d87263cf189f7ba51c8dc6c5e6144c8 Mon Sep 17 00:00:00 2001
From: zmc <zmc_li@foxmail.com>
Date: 星期四, 23 十一月 2023 08:52:22 +0800
Subject: [PATCH] 1.修改了雷达图传入的数据 2.数据指标排名一进来按日均值倒序排列 3.修改了一些局部的样式

---
 src/views/risk_assessment/DataRiskModel.vue |  166 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 116 insertions(+), 50 deletions(-)

diff --git a/src/views/risk_assessment/DataRiskModel.vue b/src/views/risk_assessment/DataRiskModel.vue
index e91ba3e..5f1d32c 100644
--- a/src/views/risk_assessment/DataRiskModel.vue
+++ b/src/views/risk_assessment/DataRiskModel.vue
@@ -13,6 +13,7 @@
 import riskApi from '@/api/risk/riskApi.js'
 import riskValue from '@/utils/risk_estimate_common_function/riskValue.js'
 import lineChart from '@/utils/chartFunction/lineChart.js'
+import siteInfo from '@/api/site/siteInfo.js'
 export default {
   components: {
     LineChart,
@@ -73,7 +74,23 @@
       // 椋庨櫓鍊�
       weight: '',
       // 鏃犳暟鎹厤缃椂闂存
-      areaColor: []
+      areaColor: [],
+      // 鏌愮珯鐐圭殑鍩烘湰淇℃伅
+      siteInfo: {},
+
+      // 寮傚父椋庨櫓鐨勫��
+      exceptionRisk: {
+        // 鍦ㄧ嚎鐜囬闄�
+        onlineRisk: '',
+        // 鏈夋晥鐜囬闄�
+        validRisk: '',
+        // 瓒呮爣椋庨櫓
+        exceedRisk: '',
+        // 寮傚父绫诲瀷鑱氶泦搴�
+        exceptionTypeAggregation: '',
+        // 鍏稿瀷寮傚父澶嶇幇鐜�
+        typicalExceptionRepetitionRate:''
+      }
     }
   },
   mounted() {
@@ -88,11 +105,14 @@
   },
 
   methods: {
+
+    
+
     // 鏌ヨ绔欑偣缁熻淇℃伅
-    querySiteStaticsInfo(row) {
+    async querySiteStaticsInfo(row) {
       this.form.name = row.siteName
       // 鏇存柊缁熻鏁版嵁
-      this.getAnalysisData()
+      await this.getAnalysisData()
       // 璁$畻椋庨櫓鍊�
       this.calRiskValue()
     },
@@ -114,6 +134,8 @@
     riskAssessment() {
       // 鏇存柊鎺掑悕娓呭崟
       this.getRiskRank()
+      // 鏇存柊璇ョ珯鐐圭殑鎵�灞炲満鏅拰杩愮淮鍟�
+      this.getSiteInfo(this.form.number)
       // 鏇存柊鍒嗘瀽鏁版嵁
       this.getAnalysisData()
       // 璁$畻椋庨櫓鍊�
@@ -125,7 +147,7 @@
       // 鏃ョ粺璁℃暟鎹�
       this.fetchDayAnalysisData()
       // 寮傚父鏁版嵁
-      this.fetchExceptionAnalysisData()
+      // this.fetchExceptionAnalysisData()
     },
 
     findObjectByPropertyValue(array, property, value) {
@@ -147,16 +169,33 @@
       this.form.number = arr[1]
       this.screenLoading = false
 
+      // 鏇存柊璇ョ珯鐐圭殑鎵�灞炲満鏅拰杩愮淮鍟�
+      this.getSiteInfo(this.form.number)
       // 鏇存柊鏃ョ粺璁℃暟鎹�
       this.getAnalysisData()
       // 璁$畻椋庨櫓鍊�
       this.calRiskValue()
+      
     },
 
-    // 璁$畻椋庨櫓鍊�
+
+    /**
+    * 寰楀埌鏁版嵁椋庨櫓鍊� 锛屽苟璁$畻椋庨櫓鍊�
+    * @param锛�
+    * @returns锛�
+    */
     calRiskValue() {
       riskApi.queryRiskValue(this.form.number, this.month, 'month').then((response) => {
-        this.weight = riskValue.calRiskValue(response.data.data[0]).toFixed(2)
+
+        
+        const riskValue = response.data.data[0]
+        this.exceptionRisk.onlineRisk = riskValue.onlineRisk
+        this.exceptionRisk.validRisk = riskValue.validRisk
+        this.exceptionRisk.exceedRisk = riskValue.exceedRisk
+        this.exceptionRisk.exceptionTypeAggregation = riskValue.exceptionTypeAggregation
+        this.exceptionRisk.typicalExceptionRepetitionRate = riskValue.typicalExceptionRepetitionRate
+
+        this.weight = riskValue.calRiskValue(riskValue).toFixed(2)
       })
     },
 
@@ -196,8 +235,9 @@
           let noDataTimeInteval = lineChart.backNoDataInteval(begin, end)
           // 鏃犳暟鎹厤缃椂闂存
           this.areaColor = lineChart.getMarkArea(noDataTimeInteval)
-          console.log('鍖哄煙', this.areaColor)
           this.setChart()
+
+
           //  鎶樼嚎鍥炬暟鎹�
           let temp = index.calBillData(this.chartData, begin, end)
           this.bill.min = temp['min']
@@ -283,6 +323,20 @@
       arr.sort((a, b) => b.riskValue - a.riskValue)
       // 鑾峰彇鍓峮um涓厓绱�
       return arr.slice(0, num)
+    },
+    /**
+     * 鏍规嵁璁惧缂栧彿鏌ヨ绔欑偣鍩烘湰淇℃伅
+     * @param锛� 璁惧缂栧彿
+     */
+    getSiteInfo(mnCode) {
+      siteInfo.querySiteInfoByMnCode(mnCode).then(response => {
+        this.siteInfo = response.data.data[0]
+      })
+    },
+
+    openDetail() {
+      const encodedSiteName = encodeURIComponent(this.form.name)
+      this.$router.push(`/exceptionDetail/${encodedSiteName}/${this.month}`)
     }
   }
 }
@@ -316,12 +370,23 @@
     </el-form-item>
   </el-form>
 
+
+
   <div v-loading="screenLoading" class="wait-name">
     <div class="chart-container" v-show="!isNoData && !screenLoading">
-      <div class="time-text">
-        <span>鏁版嵁缁熻鏃舵锛歿{ form.beginTime }} ~ {{ form.endTime }}</span>
-        <span class="site-name">{{ form.name }}</span>
-      </div>
+
+      <el-card class="time-text" >
+        <h4>{{form.name}}</h4> 
+        <br/>
+        <br/>
+         <span>鏁版嵁缁熻鏃舵锛歿{ form.beginTime }} ~ {{ form.endTime }}</span>
+         <el-tag class="mx-1" >鍦烘櫙</el-tag>{{siteInfo.typename}}
+     
+         <el-tag class="mx-1">杩愮淮鍟�</el-tag>{{siteInfo.dutyCompany}}
+         <el-button type="primary"  size="default" class="exception-button" @click="openDetail">
+           鏁版嵁寮傚父璇︽儏
+         </el-button>
+       </el-card>
 
       <el-row :gutter="10">
         <el-col :span="5">
@@ -333,7 +398,6 @@
               :default-sort="{ prop: 'riskValue', order: 'descending' }"
               height="540"
             >
-                <!-- :index="indexMethod" -->
 
               <el-table-column
                 type="index"
@@ -345,8 +409,9 @@
               />
               <el-table-column
                 prop="siteName"
-                label="绔欑偣鍚嶇О"
+                label="鐐逛綅鍚嶇О"
                 show-overflow-tooltip
+                width="97"
                 align="center"
               >
                 <template #default="{ row }">
@@ -355,7 +420,11 @@
                     text
                     class="table-button"
                     @click="querySiteStaticsInfo(row)"
-                    >{{ row.siteName }}</el-button
+                    >
+                  <span class="risk-rank-site">
+                    {{ row.siteName }}
+                  </span>
+                    </el-button
                   >
                 </template>
               </el-table-column>
@@ -380,13 +449,7 @@
                 '瓒呮爣寮傚父椋庨櫓',
                 '鏁版嵁鍦ㄧ嚎椋庨櫓'
               ]"
-              :yData="[
-                bill.valid,
-                bill.exceptionRecurrence,
-                bill.exceptionTypeAggregation,
-                bill.exceeding,
-                bill.online
-              ]"
+              :yData="exceptionRisk"
             ></DustRadarChart>
           </el-card>
         </el-col>
@@ -432,10 +495,11 @@
                 <div>浣庨闄�(锛�0.2)</div>
               </div>
             </div>
-
+            
             </div>
           </el-card>
         </el-col>
+
 
         <el-col :span="4">
           <el-card shadow="never" class="card-height">
@@ -477,20 +541,6 @@
         <el-col :span="12">
           <el-card shadow="never" class="card-value">
             <LineChart
-              title="鏃ュ湪绾跨巼"
-              :chartData="chartData2"
-              yName="%"
-              seriesName="鏃ュ湪绾跨巼"
-              :areaColor="areaColor"
-            >
-            </LineChart>
-          </el-card>
-        </el-col>
-      </el-row>
-      <el-row :gutter="20">
-        <el-col :span="12">
-          <el-card shadow="never" class="card-value">
-            <LineChart
               title="鏃ユ湁鏁堢巼"
               :chartData="chartData3"
               yName="%"
@@ -500,20 +550,10 @@
             </LineChart>
           </el-card>
         </el-col>
-
-        <el-col :span="12">
-          <el-card shadow="never" class="card-value">
-            <LineChart
-              title="鏃ヨ秴鏍囩巼"
-              :chartData="chartData4"
-              yName="%"
-              seriesName="鏃ヨ秴鏍囩巼"
-              :areaColor="areaColor"
-            >
-            </LineChart>
-          </el-card>
-        </el-col>
       </el-row>
+
+
+
     </div>
   </div>
   <el-empty description="鏆傛棤鏁版嵁" v-show="isNoData" :image-size="200" />
@@ -533,6 +573,7 @@
   font-size: 14px;
   color: #333333;
   letter-spacing: 1px;
+  
 }
 .el-card {
   margin-top: 15px;
@@ -621,7 +662,14 @@
 .table-button {
   letter-spacing: 1px;
   text-decoration: underline;
-  border-radius: 0px;
+  /* border-radius: 0px; */
+  
+}
+.risk-rank-site {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  width: 80px;
 }
 .site-name {
   margin-left: 20px;
@@ -643,4 +691,22 @@
   flex-direction: column;
   justify-content: space-around;
 }
+
+.el-tag{
+  margin-left: 25px;
+  font-size: 14px;
+  vertical-align: baseline;
+}
+.exception-button {
+  vertical-align: baseline;
+  margin-left: 150px; 
+}
+
+.site-info-detail{
+  display: flex;
+  justify-content: space-between;
+}
+.mx-1{
+  margin-left: 100px;
+}
 </style>

--
Gitblit v1.9.3