src/views/exception/SiteAuditAssistance.vue
@@ -13,6 +13,13 @@
import ButtonClick from '@/sfc/ButtonClick.vue'
import index from '@/utils/exception_common_function/index.js'
import DaySelect from '@/sfc/DaySelect.vue';
// import {useLoginUserStore} from '@/stores/user.js'
import { useLoginUserStore } from '@/stores/user'
import historyApi from '@/api/historyApi.js'
import time from '@/utils/time.js'
import lineChart from '@/utils/chartFunction/lineChart.js'
import exceptionOption from '@/utils/chartFunction/exceptionOption.js'
export default {
  components: {
    ExceptionType,
@@ -114,8 +121,10 @@
  },
  setup() {
    const { isExceedOneMonth } = useCommonFunction()
    const userName = useLoginUserStore()
    return {
      isExceedOneMonth
      isExceedOneMonth,userName
    }
  },
  // 监听  判断按钮是否可点击
@@ -190,15 +199,64 @@
  mounted() {
    this.backExceptionDataAWeekAgo()
    this.calTableHeight()
  },
  methods: {
        /**
     * 有效率异常 设置折线图配置项
     * @param:
     * @returns:
     */
    validProcess() {
      // x轴数据
      let xList = time.ascTime(
        this.tableCurrentRowData.beginTime,
        this.tableCurrentRowData.endTime,
        15
      )
      // y轴数据
      let yList = []
      xList.forEach((item) => {
        // 查找该时间的数据
        let r = lineChart.findDate(this.dialog.historyData, item)
        if (r) {
          yList.push(r.dustValue)
        } else {
          yList.push(null)
        }
      })
      // 颜色背景区间
      // 得到无数据的时间点或flag不等于N的时间点
      let noDataTime = time.invalidTime(this.dialog.historyData, xList)
      let rangeTime = time.seriesTime(noDataTime, 15)
      // let rangeTime_1 = time.splitTime(rangeTime)
      // 得到背景区间的配置
      let areaObj = lineChart.getMarkArea(rangeTime, '异常')
      // 传入参数
      this.dialog.option = exceptionOption.setExceptionChartOption(
        xList,
        yList,
        '',
        '',
        '',
        '',
        this.tableCurrentRowData.exception,
        areaObj,
        '',
        this.tableCurrentRowData.exceptionType
      )
    },
    giveDay(val){
      // 将中国标准时间转为指定格式(该组件返回的标准时间的格式,所以必须的加这个函数)
        this.beginTime = dayjs(val).format('YYYY-MM-DD 00:00:00');
        this.endTime = dayjs(val).format('YYYY-MM-DD 23:59:59');
    },
    /**
     * 审计内容保存为草稿
     * @param:
@@ -220,6 +278,7 @@
        this.auditData = res.data.data
      })
    },
    /**
     * 多选列(已审核的行不会加入其中)
     * @param
@@ -359,6 +418,10 @@
    submitAudit() {
      // 同时填写了审核人员和企业的备注
      this.loading.submitAudit = true
      // 把登陆的用户姓名给审核人
      if(this.userName.getUserName != '-1'){
        this.auditDialog.checker = this.userName.getUserName
      }
      if (this.auditDialog.checkerNotes && this.auditDialog.enterpriseNotes) {
        this.sendAudit(
          this.auditDialog.checker,
@@ -429,11 +492,21 @@
    openAuditDiag(row) {
      this.auditDialog.visible = true
      this.tableCurrentRowData = row
      // 进入审核页时,将表格当前行的审核信息给输入框
      this.auditDialog.checkerNotes = this.tableCurrentRowData.checkerContent
      this.auditDialog.enterpriseNotes = this.tableCurrentRowData.enterpriseContent
      // // 未审核  就把当前登陆名给审核人
      // if(this.tableCurrentRowData.uiRealName == null){
      //   this.auditDialog.checker = this.userName.getUserName
      // }
      // // 已审核
      // else{
      //   this.auditDialog.checker = this.tableCurrentRowData.uiRealName
      // }
    },
    /**
     * description:点击异常站点名字时 返回的数据
@@ -1044,20 +1117,42 @@
        // 得到上一行的数据
        this.tableCurrentRowData = this.displayData[this.selectedRowIndex]
        let params = index.requestGetParms(
          this.tableCurrentRowData.name,
          this.tableCurrentRowData.beginTime,
          this.tableCurrentRowData.endTime
        )
        this.loading.preButton = true
        this.$http.get('/dust/history', { params: params }).then((response) => {
        historyApi.queryHistoryData({
          siteName:this.tableCurrentRowData.name,
          beginTime:this.tableCurrentRowData.beginTime,
          endTime:this.tableCurrentRowData.endTime
        }).then(response => {
          // 保存返回的超标数据
          this.dialog.historyData = response.data.data
          this.dialog.exceptionTotal = response.data.data.length
          // 逻辑处理
          this.timeAndDataProcessed()
          if (this.tableCurrentRowData.exceptionType != '8') {
            this.timeAndDataProcessed()
          } else {
            this.loading.lineChart = true
            this.validProcess()
            this.loading.lineChart = false
            this.flag.banTouch = 0
          }
          this.loading.preButton = false
        })
        // let params = index.requestGetParms(
        //   this.tableCurrentRowData.name,
        //   this.tableCurrentRowData.beginTime,
        //   this.tableCurrentRowData.endTime
        // )
        // this.$http.get('/dust/history', { params: params }).then((response) => {
        //   // 保存返回的超标数据
        //   this.dialog.historyData = response.data.data
        //   this.dialog.exceptionTotal = response.data.data.length
        //   // 逻辑处理
        //   this.timeAndDataProcessed()
        //   this.loading.preButton = false
        // })
      }
    },
    /**
@@ -1075,21 +1170,44 @@
        // 得到上一行的数据
        this.tableCurrentRowData = this.displayData[this.selectedRowIndex]
        let params = index.requestGetParms(
          this.tableCurrentRowData.name,
          this.tableCurrentRowData.beginTime,
          this.tableCurrentRowData.endTime
        )
        this.loading.afterButton = true
        this.$http.get('/dust/history', { params: params }).then((response) => {
        historyApi.queryHistoryData({
          siteName:this.tableCurrentRowData.name,
          beginTime:this.tableCurrentRowData.beginTime,
          endTime:this.tableCurrentRowData.endTime
        }).then(response => {
          // 保存返回的超标数据
          this.dialog.historyData = response.data.data
          this.dialog.exceptionTotal = response.data.data.length
          // 逻辑处理
          this.timeAndDataProcessed()
          if (this.tableCurrentRowData.exceptionType != '8') {
            this.timeAndDataProcessed()
          } else {
            this.loading.lineChart = true
            this.validProcess()
            this.loading.lineChart = false
            this.flag.banTouch = 0
          }
          this.loading.afterButton = false
        })
        // let params = index.requestGetParms(
        //   this.tableCurrentRowData.name,
        //   this.tableCurrentRowData.beginTime,
        //   this.tableCurrentRowData.endTime
        // )
        // this.$http.get('/dust/history', { params: params }).then((response) => {
        //   // 保存返回的超标数据
        //   this.dialog.historyData = response.data.data
        //   this.dialog.exceptionTotal = response.data.data.length
        //   // 逻辑处理
        //   this.timeAndDataProcessed()
        //   this.loading.afterButton = false
        // })
      }
    },
@@ -1112,24 +1230,44 @@
      // 对请求到的数据进行首尾拼接
      // 得到前后完整数据进行绘制图形
      let params = {}
      if (row.name) {
        params['siteName'] = row.name
      }
      if (row.beginTime) {
        params['beginTime'] = row.beginTime
      }
      if (row.endTime) {
        params['endTime'] = row.endTime
      }
      historyApi.queryHistoryData({
          siteName:row.name,
          beginTime:row.beginTime,
          endTime:row.endTime
        }).then(response => {
          // 保存返回的超标数据
          this.dialog.historyData = response.data.data
          this.dialog.exceptionTotal = response.data.data.length
          // 逻辑处理
      this.$http.get('/dust/history', { params: params }).then((response) => {
        // 保存返回的超标数据
        this.dialog.historyData = response.data.data
        this.dialog.exceptionTotal = response.data.data.length
        // 逻辑处理
        this.timeAndDataProcessed()
      })
          if (this.tableCurrentRowData.exceptionType != '8') {
            this.timeAndDataProcessed()
          } else {
            this.loading.lineChart = true
            this.validProcess()
            this.loading.lineChart = false
            this.flag.banTouch = 0
          }
        })
      // let params = {}
      // if (row.name) {
      //   params['siteName'] = row.name
      // }
      // if (row.beginTime) {
      //   params['beginTime'] = row.beginTime
      // }
      // if (row.endTime) {
      //   params['endTime'] = row.endTime
      // }
      // this.$http.get('/dust/history', { params: params }).then((response) => {
      //   // 保存返回的超标数据
      //   this.dialog.historyData = response.data.data
      //   this.dialog.exceptionTotal = response.data.data.length
      //   // 逻辑处理
      //   this.timeAndDataProcessed()
      // })
    },
    /**
@@ -1141,12 +1279,12 @@
        alert('时间跨度不能超过一个月')
        return
      }
      this.flag.originClick = 0
      let params = {}
      params['page'] = this.currentPage
      params['pageSize'] = this.pageSize
      if (this.form.name) {
        params['siteName'] = this.form.name
      }
@@ -1157,6 +1295,9 @@
      params['endTime'] = this.endTime
      this.loading.tableLoading = true
      this.loading.queryButton = true
      console.log('站点:',params['siteName']);
      console.log('类型',params['exceptionType']);
      this.$http.get('/dust/exceptiondata', { params: params }).then((response) => {
        // 保存返回的
        // this.tableData = response.data.data.rows;
@@ -1186,6 +1327,8 @@
      if (this.form.name) {
        params['siteName'] = this.form.name
      }
      if (this.form.exceptionName) {
        params['exceptionType'] = this.form.exceptionName
      }
@@ -1224,7 +1367,7 @@
      const h2 = this.$refs.h2.$el.offsetHeight
      const h4 = this.$refs.h4.$el.offsetHeight
      // 其中一个40是盒子的总外边距
      this.tableHeight = `calc(100vh - ${h1}px - ${h2}px  - ${h4}px - 20px - 100px - var(--el-main-padding) * 2)`
      this.tableHeight = `calc(100vh - ${h1}px - ${h2}px  - ${h4}px - 20px - 10px - var(--el-main-padding) * 2)`
      // this.tableHeight = `calc(100vh - ${h1}px  - ${h4}px - 100px - var(--el-main-padding) * 2)`;
    },
@@ -1300,8 +1443,7 @@
            </el-form-item>
            <el-form-item>
              <!-- <el-button type="warning" :loading="loading.queryButton" @click="handleSubmit"><el-icon
                style="margin-right: 6px;font-size: 1.2em;"><i-ep-Search /></el-icon>查询</el-button> -->
              <ButtonClick
                content="搜索"
                type="warning"
@@ -1369,10 +1511,10 @@
          fixed
          :index="indexMethod1"
        />
        <el-table-column prop="name" label="站点名称" show-overflow-tooltip />
        <el-table-column prop="mnCode" label="设备编号" align="center" show-overflow-tooltip />
        <el-table-column prop="name" label="点位名称" show-overflow-tooltip />
        <el-table-column prop="mnCode" label="设备编码" align="center" show-overflow-tooltip />
        <el-table-column prop="exception" label="异常类型" align="center" show-overflow-tooltip />
        <el-table-column prop="region" label="区域" align="center" show-overflow-tooltip />
        <el-table-column prop="region" label="区县" align="center" show-overflow-tooltip />
        <el-table-column prop="beginTime" label="开始时间" align="center" show-overflow-tooltip />
        <el-table-column prop="endTime" label="结束时间" align="center" show-overflow-tooltip />
        <el-table-column prop="typename" label="场景" align="center" width="82" show-overflow-tooltip />
@@ -1453,7 +1595,7 @@
    <el-form label-position="top">
      <el-form-item label="审核人">
        <el-input v-model="auditDialog.checker"></el-input>
        <el-input v-model="userName.getUserName"></el-input>
      </el-form-item>
      <el-form-item label="审核情况">
        <el-input
@@ -1511,7 +1653,7 @@
    <template #header>
      <div class="diag-head">
        <div class="diag-head-text">
          <div><span class="diag-head-text1">站点名称:</span>{{ tableCurrentRowData.name }}</div>
          <div><span class="diag-head-text1">点位名称:</span>{{ tableCurrentRowData.name }}</div>
          <div><span class="diag-head-text1">设备编号:</span>{{ tableCurrentRowData.mnCode }}</div>
          <div><span class="diag-head-text1">运维商:</span>{{ tableCurrentRowData.dutyCompany }}</div>
 
@@ -1564,29 +1706,38 @@
        <el-table-column prop="lst" label="采集时间" align="center" show-overflow-tooltip />
        <el-table-column
          prop="dustValue"
          label="颗粒物浓度(mg/m³)"
          label="TSP(mg/m³)"
          align="center"
          show-overflow-tooltip
        />
        <el-table-column prop="flag" label="数据标识" align="center" show-overflow-tooltip />
      </el-table>
    </div>
    <template #footer>
      <el-tag type="success" class="mx-1" effect="dark" round
        ><span class="table-line-lable" v-show="tableCurrentRowData.exceptionType == '0'"
          >缺失数据:
        </span>
        <span
          v-show="
            tableCurrentRowData.exceptionType == '1' ||
            tableCurrentRowData.exceptionType == '2' ||
            tableCurrentRowData.exceptionType == '3' ||
            tableCurrentRowData.exceptionType == '4'
          "
          >异常数据:</span
        >
        <span class="table-line-num">{{ dialog.exceptionTotal }}条</span>
        <span v-show="tableCurrentRowData.exceptionType === '0'"> (逻辑计算)</span>
      </el-tag>
      <div class="dialog-footer">
        <el-tag type="success" class="mx-1" effect="dark" round
          ><span class="table-line-lable" v-show="tableCurrentRowData.exceptionType == '0'"
            >缺失数据:
          </span>
          <span
            v-show="
              tableCurrentRowData.exceptionType == '1' ||
              tableCurrentRowData.exceptionType == '2' ||
              tableCurrentRowData.exceptionType == '3' ||
              tableCurrentRowData.exceptionType == '4' ||
              tableCurrentRowData.exceptionType == '5' ||
              tableCurrentRowData.exceptionType == '6' ||
              tableCurrentRowData.exceptionType == '7' ||
              tableCurrentRowData.exceptionType == '8'
            "
            >异常数据:</span
          >
          <span class="table-line-num">{{ dialog.exceptionTotal }}条</span>
          <span v-show="tableCurrentRowData.exceptionType == '0'"> (逻辑计算)</span>
        </el-tag>
        <el-text v-show="tableCurrentRowData.exceptionType == '8'" type="warning" class="dialog-footer-text">数据标识A为数据长期缺失,系统自动补全</el-text>
        <!-- <el-text class="mx-1" type="warning">Warning</el-text> -->
      </div>
    </template>
  </el-dialog>
</template>
@@ -1624,6 +1775,7 @@
}
.el-tag {
  font-size: 14px;
  vertical-align: baseline;
}
.checknum-rate {
@@ -1700,6 +1852,15 @@
  left: 10px;
  bottom: 10px;
}
.dialog-footer{
  display: flex;
}
.dialog-footer-text {
  justify-content: flex-end;
  margin-left: auto;
  font-size: 14px;
  /* color: #333333; */
}
/* 查看详情对话框模块结束 */
</style>