ali
2024-09-03 0ae83a895e80a4b9777a27f613d721a7e5e2ac18
energy_management_ui/src/views/history/query/historyIndex.vue
@@ -1,11 +1,16 @@
<template>
  <div class="app-container" style="padding:0">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>{{currentNode?currentNode.label:''}}--节点设置</span>
        <span>{{ currentNode ? currentNode.label : "" }}--节点设置</span>
      </div>
      <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" class="query-form">
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        label-width="68px"
        class="query-form"
      >
        <el-form-item label="起止时间">
          <el-date-picker
            v-model="dateRange"
@@ -13,14 +18,20 @@
            value-format="yyyy-MM-dd HH:mm:ss"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
            end-placeholder="结束日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
            >查询</el-button
          >
          <!--<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
        </el-form-item>
      </el-form>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
@@ -35,16 +46,29 @@
        </el-col>
      </el-row>
      <el-form>
        <el-table :data="JkHistoryAlarmList" v-loading="loading" border @selection-change="" @cell-click="openDialog"  >
        <el-table
          :data="JkHistoryAlarmList"
          v-loading="loading"
          border
          @selection-change=""
          @cell-click="openDialog"
        >
          <el-table-column label="序号" type="index"  align="center"/>
          <el-table-column label="单位名称" align="center" prop="modelName"/>
          <el-table-column label="指标编码" align="center" prop="code"/>
          <el-table-column label="指标名称" align="center" prop="indexName">
            <template slot-scope="scope">
              <div style="color:blue;text-decoration:underline ;cursor:pointer">{{scope.row.indexName}}</div>
              <div style="color:blue;text-decoration:underline ;cursor:pointer">
                {{ scope.row.indexName }}
              </div>
            </template>
          </el-table-column>
          <el-table-column label="指标单位" align="center" prop="unitId" :formatter="unitIdFormat" />
          <el-table-column
            label="指标单位"
            align="center"
            prop="unitId"
            :formatter="unitIdFormat"
          />
        <!--  <el-table-column label="报警级别" align="center" prop="alarmLevel" :formatter="alarmLevelFormat"/>
          <el-table-column label="限值类型" align="center" prop="limitType"  :formatter="limitTypeFormat"/>
          <el-table-column label="限值"     align="center" prop="limitingValue"/>
@@ -62,14 +86,31 @@
        @pagination="getList"
      />
      <!--弹框-->
      <el-dialog :title="title" :visible.sync="open" width="1500px" :close-on-click-modal="false">
        <el-row style="background:#fff;margin-bottom:32px;">
      <el-dialog
        :title="title"
        :visible.sync="open"
        width="1500px"
        :close-on-click-modal="false"
      >
        <el-row style="margin-bottom:32px;">
          <el-tabs v-model="activeName" @tab-click="handleClick" >
            <el-tab-pane label="历史数据曲线图" name="second">
              <history-alarm-view ref="historyAlarmView" :code="code" :activeName="activeName" :limitVal="limitVal"></history-alarm-view>
              <history-alarm-view
                ref="historyAlarmView"
                :code="code"
                :activeName="activeName"
                :limitVal="limitVal"
              ></history-alarm-view>
            </el-tab-pane>
            <el-tab-pane label="历史数据查询" name="third">
              <history-alarm-table ref="historyAlarmTable" :code="code" :indexName="indexName" :activeName="activeName" :indexUnit="indexUnit" :limitVal="limitVal"></history-alarm-table>
              <history-alarm-table
                ref="historyAlarmTable"
                :code="code"
                :indexName="indexName"
                :activeName="activeName"
                :indexUnit="indexUnit"
                :limitVal="limitVal"
              ></history-alarm-table>
            </el-tab-pane>
          </el-tabs>
        </el-row>
@@ -82,15 +123,18 @@
</template>
<script>
  import {listHistoryAlarm,exportHistoricalAlarm , getHistoricalAlarm} from  "@/api/basicsetting/historyAlarm";
  import {listLimitType} from "@/api/basicsetting/limitType"
  import historyAlarmView from "../../energyAlarm/realTimeAlarm/historyAlarmView"
  import historyAlarmTable from "../../energyAlarm/realTimeAlarm/historyAlarmTable"
import {
  listHistoryAlarm,
  exportHistoricalAlarm,
  getHistoricalAlarm
} from "@/api/basicsetting/historyAlarm";
import { listLimitType } from "@/api/basicsetting/limitType";
import historyAlarmView from "../../energyAlarm/realTimeAlarm/historyAlarmView";
import historyAlarmTable from "../../energyAlarm/realTimeAlarm/historyAlarmTable";
  export default {
    components: {historyAlarmView,historyAlarmTable},
    name: 'historyAlarm',
  name: "historyAlarm",
    data() {
      return {
@@ -100,15 +144,15 @@
          /*  value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],*/
        },
        code:undefined,
        value:'',
      value: "",
        options:undefined,
        // handleClick:'simple',
        radio: 'B',
        activeName: 'second',
      radio: "B",
      activeName: "second",
        indexId:undefined,
        indexName:undefined,
        indexUnit:undefined,
        currentNode: '',
      currentNode: "",
        limitVal:undefined,
        hiddenTableHeader:false,
       /* lineChartData: lineChartData.newVisitis,*/
@@ -146,13 +190,13 @@
        unitIdOptions: [],
        // 查询参数
        lineChartData:{
          newVisitis:null,
        newVisitis: null
        },
        queryParams: {
           pageNum: 1,
           pageSize: 10,
          eierarchyFlag:'B',
          indexType:'COLLECT',
        eierarchyFlag: "B",
        indexType: "COLLECT",
          code: undefined,
          indexName:undefined,
          /* unitId: undefined,*/
@@ -162,8 +206,7 @@
          /* limitingValue:undefined,*/
          nodeId:undefined,
          beginTime: undefined,
          endTime:undefined,
        endTime: undefined
        },
        // 表单参数
        form: {},
@@ -183,13 +226,13 @@
      listLimitType(this.queryParams).then(response => {
        this.limitTypeOptions = response.rows;
      });
    },
    methods: {
      getList() {
        this.loading = true;
        listHistoryAlarm(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
      listHistoryAlarm(
        this.addDateRange(this.queryParams, this.dateRange)
      ).then(response => {
          this.JkHistoryAlarmList = response.rows;
          this.total = response.total;
          this.loading = false;
@@ -235,7 +278,8 @@
        this.queryParams.nodeId = modelNode.id;
        this.settingDeviceList = [];
        this.settingIndexList = [];
        this.disabledSetting = modelNode === undefined || modelNode === '' || modelNode === null;
      this.disabledSetting =
        modelNode === undefined || modelNode === "" || modelNode === null;
        if (modelNode) {
          this.currentNode = modelNode;
          this.deviceLoading = true;
@@ -249,18 +293,17 @@
        let date = new Date(value);
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        MM = MM < 10 ? ('0' + MM) : MM;
      MM = MM < 10 ? "0" + MM : MM;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
      d = d < 10 ? "0" + d : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
      h = h < 10 ? "0" + h : h;
        let m = date.getMinutes();
        m = m < 10 ? ('0' + m) : m;
      m = m < 10 ? "0" + m : m;
        let s = date.getSeconds();
        s = s < 10 ? ('0' + s) : s;
        return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
      s = s < 10 ? "0" + s : s;
      return y + "-" + MM + "-" + d + " " + h + ":" + m + ":" + s;
      },
      /** 搜索按钮操作 */
      handleQuery() {
@@ -272,8 +315,7 @@
        this.resetForm("queryForm");
      },
      handleSelectionChange() {
      },
    handleSelectionChange() {},
      openDialog(row,column,event,cell){
        if("indexName"==column.property){
          this.open = true;
@@ -288,30 +330,32 @@
      /** 导出按钮操作 */
      handleExport() {
        const queryParams = this.queryParams;
        this.$confirm('是否确认导出所有报警数据项?', "警告", {
      this.$confirm("是否确认导出所有报警数据项?", "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
      })
        .then(function() {
          return exportHistoricalAlarm(queryParams);
        }).then(response => {
        })
        .then(response => {
          this.download(response.msg);
        }).catch(function() {});
        })
        .catch(function() {});
      },
      //限制类型翻译
      limitTypeFormat(row,column){
        var actions = [];
        Object.keys(this.limitTypeOptions).map((key) => {
          if (this.limitTypeOptions[key].limitCode == ('' + row.limitType)) {
      Object.keys(this.limitTypeOptions).map(key => {
        if (this.limitTypeOptions[key].limitCode == "" + row.limitType) {
            actions.push(this.limitTypeOptions[key].limitName);
          }
        });
        return actions.join('');
      return actions.join("");
      },
      handleClick(tab, event){
        this.activeName = tab.name;
      },
    }
    }
  };
</script>