zmc
2023-12-07 d1ccf7e1835b3c583da16d90a286e749d5e27c84
src/views/risk_assessment/components/CompDataRiskModel.vue
@@ -3,17 +3,13 @@
import InputSearch from '@/sfc/InputSearch.vue'
import AreaAndmonitorType from '@/sfc/AreaAndmonitorType.vue'
import exceptionApi from '@/api/exceptionApi.js'
import DustRadarChart from '@/views/risk_assessment/components/DustRadarChart.vue'
import FYLineChart from '@/components/chart/FYLineChart.vue'
import time from '@/utils/time.js'
import index from '@/utils/risk_estimate_common_function/index.js'
import ButtonClick from '@/sfc/ButtonClick.vue'
import dayjs from 'dayjs'
import MonthSelect from '@/sfc/MonthSelect.vue'
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'
import CompDailyStatistic from '@/views/risk_assessment/riskModel/components/CompDailyStatistic.vue'
export default {
@@ -35,7 +31,6 @@
    }
  },
  components: {
    FYLineChart,
    InputSearch,
    AreaAndmonitorType,
    DustRadarChart,
@@ -59,9 +54,9 @@
      form: {
        // 站点名称
        name: '',
        siteName: '',
        // 设备编号
        number: '3234',
        mnCode: '3234',
        // 开始时间
        beginTime: '',
        // 结束时间
@@ -119,29 +114,20 @@
    }
  },
  watch: {
    // showAll() {
    //     console.log('1111')
    //   // 页面加载时showAll才会变化一次
    //   // 为true表示的风险模型页面
    //   if (this.showAll) {
    //     // 加载风险值最高的站点数据
    //     this.ShowDefaultData()
    //   }
    // },
    siteName() {
      if (this.siteName != '') {
        // 更新站点名字和时间
        this.form.name = this.siteName
        this.form.siteName = this.siteName
        this.screenLoading = true
        siteInfo.queryMnCode(this.siteName).then((response) => {
          this.form.number = response.data.data[0].mnCode
          this.form.mnCode = response.data.data[0].mnCode
          this.month = this.time
          // 同时更新月起始时间
          this.form.beginTime = dayjs(this.month).startOf().format('YYYY-MM-DD HH:mm:ss')
          this.form.endTime = dayjs(this.month).endOf('month').format('YYYY-MM-DD HH:mm:ss')
          // 更新该站点的所属场景和运维商
          this.getSiteInfo(this.form.number)
          this.getSiteInfo(this.form.mnCode)
          // 更新统计数据
          this.getAnalysisData()
          // 计算风险值
@@ -167,7 +153,7 @@
  methods: {
    // 查询站点统计信息
    async querySiteStaticsInfo(row) {
      this.form.name = row.siteName
      this.form.siteName = row.siteName
      // 更新统计数据
      await this.getAnalysisData()
      // 计算风险值
@@ -192,7 +178,7 @@
      // 更新排名清单
      this.getRiskRank()
      // 更新该站点的所属场景和运维商
      this.getSiteInfo(this.form.number)
      this.getSiteInfo(this.form.mnCode)
      // 更新分析数据
      this.getAnalysisData()
      // 计算风险值
@@ -222,12 +208,12 @@
      this.screenLoading = true
      // 更新排名清单,并得到风险值最高站点
      let arr = await this.getRiskRank()
      this.form.name = arr[0]
      this.form.number = arr[1]
      this.form.siteName = arr[0]
      this.form.mnCode = arr[1]
      this.screenLoading = false
      // 更新该站点的所属场景和运维商
      this.getSiteInfo(this.form.number)
      this.getSiteInfo(this.form.mnCode)
      // 更新日统计数据
      this.getAnalysisData()
      // 计算风险值
@@ -240,7 +226,7 @@
     * @returns:
     */
    calRiskValue() {
      riskApi.queryRiskValue(this.form.number, this.month, 'month').then((response) => {
      riskApi.queryRiskValue(this.form.mnCode, this.month, 'month').then((response) => {
        const rValue = response.data.data[0]
        this.exceptionRisk.onlineRisk = rValue.onlineRisk
        this.exceptionRisk.validRisk = rValue.validRisk
@@ -254,29 +240,18 @@
    //  根据目前站点,月份,查折线图日统计数据
    fetchDayAnalysisData() {
      let params = {}
      if (this.form.name) {
        params['siteName'] = this.form.name
      }
      if (this.form.beginTime) {
        params['beginTime'] = this.form.beginTime
      }
      if (this.form.endTime) {
        params['endTime'] = this.form.endTime
      }
      this.loading = true
      this.queryButton = true
      exceptionApi
        .analysisdata(this.form.name, this.form.beginTime, this.form.endTime, 'day')
        .analysisdata(this.form.siteName, this.form.beginTime, this.form.endTime, 'day')
        .then((response) => {
          this.chartData = response.data.data
          this.chartData = response
          this.loading = false
          this.queryButton = false
          if (response.data.data.length == 0) {
          if (response.length == 0) {
            this.isNoData = true
            return
          }
          this.chartData.sort(time.compareByScore)
          // 分析数据中的最早时间
          let begin = this.chartData[0].lst
          // 分析数据中的最晚时间
@@ -300,7 +275,7 @@
    fetchExceptionAnalysisData() {
      exceptionApi
        .exceptiondata1({
          siteName: this.form.name,
          siteName: this.form.siteName,
          beginTime: this.form.beginTime,
          endTime: this.form.endTime
        })
@@ -357,7 +332,7 @@
    },
    openDetail() {
      const encodedSiteName = encodeURIComponent(this.form.name)
      const encodedSiteName = encodeURIComponent(this.form.siteName)
      const timeType = '1'
      const jumpPage = '2'
      this.$router.push(`/exceptionDetail/${encodedSiteName}/${this.month}/${timeType}/${jumpPage}`)
@@ -374,10 +349,10 @@
    <el-form-item class="form-item">
      <InputSearch
        :site-name="form.name"
        :site-name="form.siteName"
        isNeedDefaultSite="0"
        @submit-value="(n) => (form.name = n)"
        @submit-mncode="(n) => (form.number = n)"
        @submit-value="(n) => (form.siteName = n)"
        @submit-mncode="(n) => (form.mnCode = n)"
      ></InputSearch>
    </el-form-item>
@@ -398,7 +373,7 @@
  <div v-loading="screenLoading" class="wait-name">
    <div class="chart-container" v-show="!isNoData && !screenLoading">
      <el-card class="time-text">
        <h4>{{ form.name }}</h4>
        <h4>{{ form.siteName }}</h4>
        <br />
        <br />