longyvfengyun
2022-04-18 af84c3fff1cc841a2c879959c957cc14ebb0184a
内容提交
2个文件已修改
1个文件已添加
188 ■■■■■ 已修改文件
src/pages/dataTest/history.vue 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/pageSetting/components/historySetting.vue 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/pageSetting/realTime.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/history.vue
@@ -301,6 +301,7 @@
            return {
                HistoryData: [],
                show_num: 5,
                humpPotBottom: true,   // 驼峰锅底
                loading: false,
                isNew: true,
                showComparison: false,
@@ -769,7 +770,7 @@
                }));
                let markLine = {};
                this.groupVolQth.code = specialPoint.code;
                if (specialPoint.code && this.test_record.value[0] == "herongDischarge") {
                if (specialPoint.code && this.test_record.value[0] == "herongDischarge" && this.humpPotBottom) {
                    let batt = this.batt;
                    let qgth = getQgth(specialPoint, batt.MonVolStd * batt.MonCount);
                    this.groupVolTitle = qgth.title;
@@ -1959,6 +1960,28 @@
                }).catch(error => {
                    console.log(error);
                });
            },
            searchHistorySetting() {
              this.$apis.pageSetting.realTime.searchParam({
                categoryId: 11
              }).then(res=>{
                let rs = JSON.parse(res.data.result);
                if(rs.code == 1 && rs.data.length != 0) {
                  let data = rs.data[0];
                  // 驼峰锅底
                  this.humpPotBottom = data.status?true:false;
                  // 显示粒度
                  let data1 = rs.data[1];
                  this.show_num = data1.status;
                }else {
                  this.humpPotBottom = false;
                  this.show_num = 5;
                }
              }).catch(error=>{
                this.humpPotBottom = false;
                this.show_num = 5;
                console.log(error);
              });
            }
        },
        computed: {
@@ -1989,6 +2012,7 @@
            // 初始化图表
            this.initChart();
            this.searchAll_lowAction();
            this.searchHistorySetting();
            // 基于准备好的dom,初始化echarts实例
            allGraph = ECharts.init(this.$refs.allGraph, 'transparent');
            // 屏幕缩放时触发
src/pages/pageSetting/components/historySetting.vue
New file
@@ -0,0 +1,157 @@
<template>
  <div class="history-setting">
    <div class="history-setting-content">
      <flex-box title="历史数据功能配置" size="mini">
        <div class="input-wrapper">
          <div class="input-content">
            <span class="input-label">驼峰锅底功能</span>
            <el-select v-model="humpPotBottom.status" size="small">
              <el-option
                  v-for="(item, key) in humpPotBottoms" :key="'key'+key"
                  :label="item.label"
                  :value="item.value"></el-option>
            </el-select>
            <br>
            <br>
            <span class="input-label">历史数据粒度</span>
            <el-select v-model="granularity.status" size="small">
              <el-option
                  v-for="(item, key) in granularities" :key="'key'+key"
                  :label="item.label"
                  :value="item.value"></el-option>
            </el-select>
          </div>
        </div>
        <div class="flex-box-footer" slot="footer">
          <el-button type="primary" @click="updateAll">确认修改</el-button>
          <el-button type="warning" @click="search">恢复/刷新</el-button>
        </div>
      </flex-box>
    </div>
  </div>
</template>
<script>
import FlexBox from "@/components/FlexBox";
import checkVal from "@/assets/js/tools/checkVal";
export default {
  name: "historySetting",
  components: {
    FlexBox
  },
  data() {
    return {
      humpPotBottoms: [
        {
          label: "不启用",
          value: 0,
        },
        {
          label: "启用",
          value: 1
        }
      ],
      granularities: [],
      humpPotBottom: {
        id: 0,
        param: "历史数据的驼峰锅底功能开启",
        status: 1,
        categoryId: 11,
      },
      granularity: {
        id: 0,
        param: "历史数据的数据显示粒度",
        status: 5,
        categoryId: 11,
      }
    }
  },
  methods: {
    search() {
      this.$apis.pageSetting.realTime.searchParam({
        categoryId: 11
      }).then(res=>{
        let rs = JSON.parse(res.data.result);
        if(rs.code == 1 && rs.data.length != 0) {
          let data = rs.data[0];
          // 驼峰锅底是否开启
          this.humpPotBottom.id = data.id;
          this.humpPotBottom.param = data.param;
          this.humpPotBottom.status = data.status;
          // 显示粒度
          let data1 = rs.data[1];
          this.granularity.id = data1.id;
          this.granularity.param = data1.param;
          this.granularity.status = data1.status;
        }
      }).catch(error=>{
        console.log(error);
      });
    },
    updateAll() {
      this.$axios.all([
        this.update(this.humpPotBottom),
        this.update(this.granularity),
      ]).then(res=>{
        this.$layer.msg("修改成功");
        // 重新查询
        // this.search();
      }).catch(error=>{
        console.log(error);
        this.$layer.msg("修改失败");
      });
    },
    update(data) {
      // 请求后台
      this.$apis.pageSetting.realTime.updateStatus(data).then(res=>{
        let rs = JSON.parse(res.data.result);
      }).catch(error=>{});
    },
  },
  mounted() {
    this.search();
    // 设置显示粒度
    for(let i=1; i<11; i++) {
      this.granularities.push({
        label: "x"+i,
        value: i
      });
    }
  }
}
</script>
<style scoped>
.history-setting {
  display: flex;
  justify-content: center;
  height: 100%;
}
.history-setting-content {
  width: 450px;
  height: 260px;
  margin-top: 160px;
}
.flex-box-footer {
  padding: 16px;
  text-align: right;
}
.input-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}
.input-content {
  width: 80%;
}
.input-content .el-select {
  width: 100%;
}
.input-label {
  display: inline-block;
  padding: 4px 0;
  font-size: 14px;
}
</style>
src/pages/pageSetting/realTime.vue
@@ -58,6 +58,9 @@
            <el-tab-pane label="口令复杂度" v-if="isSystemAdmin">
              <password-complex></password-complex>
            </el-tab-pane>
            <el-tab-pane label="历史数据功能" v-if="isSystemAdmin">
              <history-setting></history-setting>
            </el-tab-pane>
        </el-tabs>
    </content-box>
</template>
@@ -74,9 +77,11 @@
import MenuApprove from "@/pages/pageSetting/components/menuApprove";
import AuditCapSetting from "@/pages/pageSetting/components/auditCapSetting";
import PasswordComplex from "@/pages/pageSetting/components/passwordComplex";
import HistorySetting from "@/pages/pageSetting/components/historySetting";
export default {
    components: {
      HistorySetting,
      PasswordComplex,
      AuditCapSetting,
      MenuApprove,