Merge branch 'projects/mesxc-test' into projects/mesxc-lb
This commit is contained in:
		@@ -1,10 +1,3 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2024-01-29 17:05:25
 | 
			
		||||
 * @LastEditTime: 2024-01-29 17:05:25
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * 发起websocket请求函数
 | 
			
		||||
 * @param {string} url ws连接地址
 | 
			
		||||
@@ -49,7 +42,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
 | 
			
		||||
      this.lockReconnect = true;
 | 
			
		||||
      this.wsCreateHandler && clearTimeout(this.wsCreateHandler);
 | 
			
		||||
      // 关闭心跳检查
 | 
			
		||||
      // heartCheck.stop();
 | 
			
		||||
      heartCheck.stop();
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  const initWsEventHandle = () => {
 | 
			
		||||
@@ -57,13 +50,13 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
 | 
			
		||||
      // 连接成功
 | 
			
		||||
      this.wsObj.onopen = (event) => {
 | 
			
		||||
        onWsOpen(event);
 | 
			
		||||
        // heartCheck.start();
 | 
			
		||||
        heartCheck.start();
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      // 监听服务器端返回的信息
 | 
			
		||||
      this.wsObj.onmessage = (event) => {
 | 
			
		||||
        onWsMessage(event);
 | 
			
		||||
        // heartCheck.start();
 | 
			
		||||
        heartCheck.start();
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      this.wsObj.onclose = (event) => {
 | 
			
		||||
@@ -130,7 +123,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
 | 
			
		||||
    if (this.lockReconnect) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    writeToScreen("3秒后重连");
 | 
			
		||||
    writeToScreen("5秒后重连");
 | 
			
		||||
    this.lockReconnect = true;
 | 
			
		||||
    // 没连接上会一直重连,设置延迟避免请求过多
 | 
			
		||||
    this.wsCreateHandler && clearTimeout(this.wsCreateHandler);
 | 
			
		||||
@@ -139,10 +132,40 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
 | 
			
		||||
      this.createWebSoket();
 | 
			
		||||
      this.lockReconnect = false;
 | 
			
		||||
      writeToScreen("重连完成");
 | 
			
		||||
    }, 3000);
 | 
			
		||||
    }, 5000);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  // 心跳检查(看看websocket是否还在正常连接中)
 | 
			
		||||
  // 心跳检查(看看websocket是否还在正常连接中,不需要服务端返回,单向的)
 | 
			
		||||
  let _this = this
 | 
			
		||||
  let heartCheck = {
 | 
			
		||||
    timeout: 55000,
 | 
			
		||||
    timeoutObj: null,
 | 
			
		||||
    // 重启
 | 
			
		||||
    reset() {
 | 
			
		||||
      clearTimeout(this.timeoutObj);
 | 
			
		||||
      this.start();
 | 
			
		||||
    },
 | 
			
		||||
    // 停止
 | 
			
		||||
    stop() {
 | 
			
		||||
      clearTimeout(this.timeoutObj);
 | 
			
		||||
    },
 | 
			
		||||
    // 开启定时器
 | 
			
		||||
    start() {
 | 
			
		||||
      this.timeoutObj && clearTimeout(this.timeoutObj);
 | 
			
		||||
      this.timeoutObj = setTimeout(() => {
 | 
			
		||||
        writeToScreen("心跳检查,发送ping到后台");
 | 
			
		||||
        try {
 | 
			
		||||
          const datas = { ping: true };
 | 
			
		||||
          _this.wsObj.send(JSON.stringify(datas));
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
          writeToScreen("发送ping异常");
 | 
			
		||||
        }
 | 
			
		||||
      }, this.timeout);
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // 心跳检查(看看websocket是否还在正常连接中,和服务端通信,双向的)
 | 
			
		||||
  // let heartCheck = {
 | 
			
		||||
  //   timeout: 15000,
 | 
			
		||||
  //   timeoutObj: null,
 | 
			
		||||
@@ -167,7 +190,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
 | 
			
		||||
  //       writeToScreen("心跳检查,发送ping到后台");
 | 
			
		||||
  //       try {
 | 
			
		||||
  //         const datas = { ping: true };
 | 
			
		||||
  //         this.wsObj.send(JSON.stringify(datas));
 | 
			
		||||
  //         _this.wsObj.send(JSON.stringify(datas));
 | 
			
		||||
  //       } catch (err) {
 | 
			
		||||
  //         writeToScreen("发送ping异常");
 | 
			
		||||
  //       }
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,8 @@ const tableProps = [
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码'
 | 
			
		||||
    label: '对象编码',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'plcTableName',
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,8 @@ const tableProps = [
 | 
			
		||||
    prop: 'tableName',
 | 
			
		||||
    label: '能源表名',
 | 
			
		||||
    filter: publicFormatter('table_name'),
 | 
			
		||||
    minWidth: 110
 | 
			
		||||
    minWidth: 110,
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'recordTime',
 | 
			
		||||
 
 | 
			
		||||
@@ -20,15 +20,18 @@ import * as XLSX from 'xlsx/xlsx.mjs'
 | 
			
		||||
const tableProps = [
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objName',
 | 
			
		||||
    label: '统计对象'
 | 
			
		||||
    label: '统计对象',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'objCode',
 | 
			
		||||
    label: '对象编码'
 | 
			
		||||
    label: '对象编码',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'energyTypeName',
 | 
			
		||||
    label: '能源类型'
 | 
			
		||||
    label: '能源类型',
 | 
			
		||||
    showOverflowtooltip: true
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    prop: 'startValue',
 | 
			
		||||
 
 | 
			
		||||
@@ -2,46 +2,23 @@
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <search-bar
 | 
			
		||||
      :formConfigs="formConfig"
 | 
			
		||||
      ref="searchBarForm"
 | 
			
		||||
      @headBtnClick="buttonClick"
 | 
			
		||||
    />
 | 
			
		||||
    <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
    <base-table
 | 
			
		||||
      :page="queryParams.pageNo"
 | 
			
		||||
      :limit="queryParams.pageSize"
 | 
			
		||||
      :table-props="tableProps"
 | 
			
		||||
      :table-data="list"
 | 
			
		||||
      :max-height="tableH"
 | 
			
		||||
    >
 | 
			
		||||
      <method-btn
 | 
			
		||||
        v-if="tableBtn.length"
 | 
			
		||||
        slot="handleBtn"
 | 
			
		||||
        :width="160"
 | 
			
		||||
        label="操作"
 | 
			
		||||
        :method-list="tableBtn"
 | 
			
		||||
        @clickBtn="handleClick"
 | 
			
		||||
      />
 | 
			
		||||
    <base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
 | 
			
		||||
      :max-height="tableH">
 | 
			
		||||
      <method-btn v-if="tableBtn.length" slot="handleBtn" :width="160" label="操作" :method-list="tableBtn"
 | 
			
		||||
        @clickBtn="handleClick" />
 | 
			
		||||
    </base-table>
 | 
			
		||||
    <pagination
 | 
			
		||||
      :page.sync="queryParams.pageNo"
 | 
			
		||||
      :limit.sync="queryParams.pageSize"
 | 
			
		||||
      :total="total"
 | 
			
		||||
      @pagination="getList"
 | 
			
		||||
    />
 | 
			
		||||
    <pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
 | 
			
		||||
      @pagination="getList" />
 | 
			
		||||
    <!-- 新增 -->
 | 
			
		||||
    <base-dialog
 | 
			
		||||
      :dialogTitle="addOrEditTitle"
 | 
			
		||||
      :dialogVisible="centervisible"
 | 
			
		||||
      @cancel="handleCancel"
 | 
			
		||||
      @confirm="handleConfirm"
 | 
			
		||||
      :before-close="handleCancel"
 | 
			
		||||
    >
 | 
			
		||||
    <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel"
 | 
			
		||||
      @confirm="handleConfirm" :before-close="handleCancel">
 | 
			
		||||
      <energy-statistics-add ref="energyStatistics" @successSubmit="successSubmit" />
 | 
			
		||||
    </base-dialog>
 | 
			
		||||
    <!-- 参数绑定/查看 -->
 | 
			
		||||
    <energy-statistics-det ref="plcParam" @closeDrawer="closeDrawer" :energyTypeList="energyTypeList"></energy-statistics-det>
 | 
			
		||||
    <energy-statistics-det ref="plcParam" @closeDrawer="closeDrawer"
 | 
			
		||||
      :energyTypeList="energyTypeList"></energy-statistics-det>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -81,7 +58,7 @@ const tableProps = [
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
export default {
 | 
			
		||||
  name: "energyStatistics",
 | 
			
		||||
  name: "EnergyStatistics",
 | 
			
		||||
  components: { EnergyStatisticsAdd, EnergyStatisticsDet },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2024-01-24 15:15:24
 | 
			
		||||
 * @LastEditTime: 2024-03-26 17:56:11
 | 
			
		||||
 * @LastEditTime: 2024-03-27 09:27:23
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
@@ -16,9 +16,9 @@
 | 
			
		||||
          </el-date-picker>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-month:query')" type="primary" size="small"
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small"
 | 
			
		||||
            @click="getDataList">查询</el-button>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-month:export')" type="primary" size="small" plain
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-day:export')" type="primary" size="small" plain
 | 
			
		||||
            @click="handleExport">导出</el-button>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-form>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: Do not edit
 | 
			
		||||
 * @Date: 2023-12-13 14:10:04
 | 
			
		||||
 * @LastEditTime: 2024-03-22 09:45:23
 | 
			
		||||
 * @LastEditTime: 2024-03-27 09:22:51
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
@@ -206,12 +206,10 @@ const cols = [
 | 
			
		||||
    },
 | 
			
		||||
  methods: {
 | 
			
		||||
    handleReturn() {
 | 
			
		||||
      // this.disabled = true
 | 
			
		||||
      this.edit = false
 | 
			
		||||
      console.log(this.$parent.getDataList());
 | 
			
		||||
    },
 | 
			
		||||
    handleChange(e) {
 | 
			
		||||
      // console.log(q)
 | 
			
		||||
      console.log(e);
 | 
			
		||||
    },
 | 
			
		||||
      updateData() {
 | 
			
		||||
        let obj = {}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
          </el-date-picker>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-month:query')" type="primary" size="small"
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small"
 | 
			
		||||
            @click="getDataList">查询</el-button>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-month:export')" type="primary" size="small" plain
 | 
			
		||||
            @click="handleExport">导出</el-button>
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
          </el-date-picker>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-weekly:query')" type="primary" size="small"
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small"
 | 
			
		||||
            @click="getDataList">查询</el-button>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-weekly:export')" type="primary" size="small" plain
 | 
			
		||||
            @click="handleExport">导出</el-button>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
          </el-date-picker>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-year:query')" type="primary" size="small"
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small"
 | 
			
		||||
            @click="getDataList">查询</el-button>
 | 
			
		||||
          <el-button v-if="this.$auth.hasPermi('report:glass-year:export')" type="primary" size="small" plain
 | 
			
		||||
            @click="handleExport">导出</el-button>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2023-12-12 13:45:25
 | 
			
		||||
 * @LastEditTime: 2024-03-26 09:41:07
 | 
			
		||||
 * @LastEditTime: 2024-03-27 09:21:00
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
@@ -456,6 +456,8 @@ export default {
 | 
			
		||||
    handleReturn() {
 | 
			
		||||
      this.disabled = true
 | 
			
		||||
      this.isSave = false
 | 
			
		||||
      this.getDataList()
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
    format(shijianchuo) {
 | 
			
		||||
      //shijianchuo是整数,否则要parseInt转换
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user