From 73cb3ec2b1660610e3621d7614ad308f2c19331d Mon Sep 17 00:00:00 2001
From: zmc <zmc_li@foxmail.com>
Date: 星期四, 16 十一月 2023 17:19:38 +0800
Subject: [PATCH] 1.修改了综合风险模型表格数据的获取 2.修改了时间选择器

---
 src/views/risk_assessment/SiteComprehensiveRskRanking.vue |  172 +++++++++++++++++++++++----------------------------------
 1 files changed, 70 insertions(+), 102 deletions(-)

diff --git a/src/views/line_graph/SiteComprehensiveRskRanking.vue b/src/views/risk_assessment/SiteComprehensiveRskRanking.vue
similarity index 65%
rename from src/views/line_graph/SiteComprehensiveRskRanking.vue
rename to src/views/risk_assessment/SiteComprehensiveRskRanking.vue
index 2d361f6..8d11b84 100644
--- a/src/views/line_graph/SiteComprehensiveRskRanking.vue
+++ b/src/views/risk_assessment/SiteComprehensiveRskRanking.vue
@@ -1,25 +1,21 @@
 <script>
 import AreaAndmonitorType from '@/sfc/AreaAndmonitorType.vue'
-import exceptionApi from '@/api/exceptionApi.js'
 import { useCommonFunction } from '../../utils/common.js'
-import index from '@/utils/risk_estimate_common_function/index.js'
 import dayjs from 'dayjs'
 import ButtonExportExcel from '@/sfc/ButtonExportExcel.vue'
 import ButtonClick from '@/sfc/ButtonClick.vue'
 import { ElMessage } from 'element-plus'
-import MonthSelect from '@/sfc/MonthSelect.vue';
-import SiteDetail from '@/views/line_graph/components/SiteDetail.vue'
-import { useLoadingStore } from '@/stores/loadingStore';
-import { mapStores } from 'pinia';
-import riskApi from '@/api/risk/riskApi.js';
-import riskValue from '@/utils/risk_estimate_common_function/riskValue.js';
+import MonthSelect from '@/sfc/MonthSelect.vue'
+import { useLoadingStore } from '@/stores/loadingStore'
+import { mapStores } from 'pinia'
+import riskApi from '@/api/risk/riskApi.js'
+import riskValue from '@/utils/risk_estimate_common_function/riskValue.js'
 export default {
   components: {
     AreaAndmonitorType,
     ButtonExportExcel,
     ButtonClick,
     MonthSelect,
-    SiteDetail,
   },
   data() {
     return {
@@ -40,7 +36,7 @@
         endTime: '',
 
         // 閫夋嫨鐨勬湀浠�
-        month:''
+        month: ''
       },
       bill: {
         min: '',
@@ -60,7 +56,7 @@
       table: [],
       // 琛ㄦ牸楂樺害
       tableHeight: 600,
-      currentRow:[]
+      currentRow: []
     }
   },
   setup() {
@@ -68,41 +64,37 @@
     const { exportToExcel } = useCommonFunction()
     return { exportToExcel }
   },
-    computed: {
-    ...mapStores(useLoadingStore),
+  computed: {
+    ...mapStores(useLoadingStore)
   },
-  mounted(){
-    // 
+  mounted() {
+    //
     this.fetch()
     this.calTableHeight()
   },
   methods: {
-
     /**
      * 灏嗕腑鍥芥爣鍑嗘椂闂磋浆涓烘寚瀹氭牸寮�
      * @param锛�
      * @returns锛�
      */
-     giveMonth(val){
+    giveMonth(val) {
       //灏嗕腑鍥芥爣鍑嗘椂闂磋浆涓烘寚瀹氭牸寮�(璇ョ粍浠惰繑鍥炵殑鏍囧噯鏃堕棿鐨勬牸寮忥紝鎵�浠ュ繀椤荤殑鍔犺繖涓嚱鏁�)
-      this.form.month = dayjs(val).format('YYYY-MM-DD');
-      // 鍚屾椂鏇存柊寮�濮嬪拰缁撴潫鏃堕棿 
+      this.form.month = dayjs(val).format('YYYY-MM-DD')
+      // 鍚屾椂鏇存柊寮�濮嬪拰缁撴潫鏃堕棿
       this.form.beginTime = dayjs(this.form.month).startOf().format('YYYY-MM-DD HH:mm:ss')
       this.form.endTime = dayjs(this.form.month).endOf('month').format('YYYY-MM-DD HH:mm:ss')
-      console.log(this.form.beginTime,this.form.endTime);
+      console.log(this.form.beginTime, this.form.endTime)
+    },
 
-     },
-     
     // 鍔熻兘锛氭敼鍙樿〃鏍兼煇涓崟鍏冩牸鐨勯鑹�
     tableCellClassName({ row, columnIndex }) {
       // 骞冲潎鍊间笉婊¤冻鏍囧噯鏃�
       if (columnIndex == 4) {
         if (row.riskValue >= 0.8) {
-          return 'warning-row';
+          return 'warning-row'
         }
       }
-
-     
     },
     // 鍔熻兘锛氳〃鏍奸珮搴︽牴鎹唴瀹硅嚜閫傚簲
     calTableHeight() {
@@ -110,70 +102,28 @@
       // 鍏朵腑涓�涓�40鏄洅瀛愮殑鎬诲杈硅窛
       this.tableHeight = `calc(100vh - ${h1}px  - 40px - 40px - var(--el-main-padding) * 2`
     },
+
     // 鐐瑰嚮椋庨櫓鎺掑悕鎸夐挳
-    // fetchData() {
-    //   this.loading = true
-    //   this.queryButton = true
-    //   exceptionApi
-    //     .analysisdataByType(this.form.month, 'month')
-    //     .then((response) => {
-    //       this.chartData = response.data.data
-    //       this.queryButton = false
-    //       this.isNoData = false
-
-    //       if (response.data.data.length == 0) {
-    //         this.isNoData = true
-    //         return
-    //       }
-
-    //       exceptionApi
-    //         .exceptiondata1({
-    //           siteName: '',
-    //           beginTime: this.form.beginTime,
-    //           endTime: this.form.endTime
-    //         })
-    //         .then((res) => {
-    //           this.isNoData = false
- 
-    //           this.table = index.merge(
-    //             this.chartData,
-    //             res.data.data,
-    //             this.form.beginTime,
-    //             this.form.endTime
-    //           )
-    //           this.loading = false
-
-    //           this.$nextTick(()=>{
-    //           this.$refs.table.sort('riskValue','descending')
-              
-    //         })
-
-    //         })
-            
-    //     })
-    // },
-
-     // 鐐瑰嚮椋庨櫓鎺掑悕鎸夐挳
-     fetchData() {
+    fetchData() {
       this.loading = true
       this.queryButton = true
-      riskApi
-        .queryRiskValue('',this.form.month, 'month')
-        .then((response) => {
-          if (response.data.data.length == 0) {
-            this.isNoData = true
-            return
-          }
+      riskApi.queryRiskValue('', this.form.month, 'month').then((response) => {
+        if (response.data.data.length == 0) {
+          this.isNoData = true
+          return
+        }
 
-          this.table = riskValue.calMonthlyRiskValue(response.data.data)
-          this.queryButton = false
-          this.isNoData = false
-              this.$nextTick(()=>{
-              this.$refs.table.sort('riskValue','descending')
-              
+        this.table = riskValue.backComprehensiveRiskTableData(response.data.data)
+        console.log('琛�', this.table)
+        this.queryButton = false
+        this.isNoData = false
+        this.loading = false
+
+        this.$nextTick(() => {
+          this.$refs.table.sort('riskValue', 'descending')
         })
-    })
-  },
+      })
+    },
 
     /**
      * 鍒濆鍔犺浇鍑芥暟
@@ -183,6 +133,11 @@
       this.fetchData()
       // 寮傚父鏁版嵁
       // this.exceptiondataCount()
+    },
+
+    // 鍗曞厓鏍煎唴瀹规崲琛�
+    wrapIndex(index) {
+      return index.replace(/\n/g, '<br/>')
     },
 
     /**
@@ -218,11 +173,10 @@
         ElMessage('鏃犳暟鎹渶瑕佸鍑�')
       }
     },
-    openDetail(row){
-      const encodedSiteName = encodeURIComponent(row.siteName);
+    openDetail(row) {
+      const encodedSiteName = encodeURIComponent(row.siteName)
       this.$router.push(`/detail/${encodedSiteName}/${this.form.month}`)
 
-      // this.$router.push(`/detail/${row.siteName}/${this.form.month}`)
     }
   }
 }
@@ -237,7 +191,7 @@
         </el-form-item>
 
         <el-form-item>
-          <MonthSelect  @submit-value="giveMonth"></MonthSelect>
+          <MonthSelect @submit-value="giveMonth"></MonthSelect>
         </el-form-item>
 
         <el-form-item>
@@ -275,21 +229,26 @@
       type="index"
       prop="name"
       label="搴忓彿"
-      :index="indexMethod"
       fixed
       align="center"
       width="55"
       show-overflow-tooltip
     />
-    <el-table-column prop="siteName" label="绔欑偣鍚嶇О" align="center" show-overflow-tooltip >
+    <el-table-column prop="siteName" label="绔欑偣鍚嶇О" align="center" show-overflow-tooltip>
       <template #default="{ row }">
-        <el-button type="primary" text class="table-button" @click="openDetail(row)"
-          >{{row.siteName}}</el-button
-        >
+        <el-button type="primary" text class="table-button" @click="openDetail(row)">{{
+          row.siteName
+        }}</el-button>
       </template>
-      </el-table-column>
+    </el-table-column>
     <el-table-column prop="region" label="鍖哄煙" align="center" width="80" show-overflow-tooltip />
-    <el-table-column prop="monitorType" label="妫�娴嬬被鍨�" align="center" width="80" show-overflow-tooltip />
+    <el-table-column
+      prop="monitorType"
+      label="妫�娴嬬被鍨�"
+      align="center"
+      width="80"
+      show-overflow-tooltip
+    />
     <el-table-column
       prop="riskValue"
       label="椋庨櫓鍊�"
@@ -298,8 +257,18 @@
       width="100"
       show-overflow-tooltip
     />
-    <el-table-column prop="riskGrage" label="椋庨櫓绛夌骇" align="center" width="100" show-overflow-tooltip />
-    <el-table-column prop="riskAdvice" label="绠℃帶鎺柦" align="center" show-overflow-tooltip />
+    <el-table-column
+      prop="riskGrade"
+      label="椋庨櫓绛夌骇"
+      align="center"
+      width="100"
+      show-overflow-tooltip
+    />
+    <el-table-column prop="riskAdvice" label="绠℃帶鎺柦" show-overflow-tooltip>
+      <template #default="scope">
+        <div v-html="wrapIndex(scope.row.riskAdvice)"></div>
+      </template>
+    </el-table-column>
     <el-table-column
       prop="beginTime"
       label="寮�濮嬫棩鏈�"
@@ -318,9 +287,6 @@
     />
   </el-table>
   <el-empty v-show="isNoData" :image-size="200" />
-
-
-
 </template>
 
 <style scoped>
@@ -329,7 +295,7 @@
   margin: 10px 0px 0px 10px;
 }
 
-:deep(.el-table__row .warning-row){
+:deep(.el-table__row .warning-row) {
   background-color: red;
   /* color: rgb(241, 236, 236); */
 }
@@ -338,5 +304,7 @@
   text-decoration: underline;
   border-radius: 0px;
 }
-
+.el-table {
+  color: #333333;
+}
 </style>

--
Gitblit v1.9.3