whychdw
2021-10-10 2b72c2614c2c17f14ad0d2d1b98bbd0d0e557622
提交内容
4个文件已修改
303 ■■■■■ 已修改文件
src/assets/js/apis/dataMager/produceTotal.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/alarmMager/batterypaSetting.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataMager/produceTotal.vue 273 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/apis/dataMager/produceTotal.js
@@ -48,5 +48,27 @@
                num: num
            }),
        });
    }
    },
    /**
     * 查询续航统计
     * @returns {AxiosPromise}
     */
    searchXuHang() {
        return axios({
            method: 'post',
            url: 'BattEnduranceAction!getEndurance',
            data: null,
        });
    },
    /**
     * 启动续航统计
     * @returns {AxiosPromise}
     */
    startXuHang() {
        return axios({
            method: 'post',
            url: 'ThreadUtilAction!enableEndurance',
            data: null,
        });
    },
}
src/assets/js/config.js
@@ -3,7 +3,7 @@
        label: '平台logo',
        des: '显示平台logo状态',
        fileName: 'gjdw',       // gjdw, nfdw, gjdx, qwh
        value: false,
        value: true,
    },
    uKey: {
        label: 'uKey',
@@ -44,6 +44,6 @@
    bigScreen: {
        label: '大屏数据展示',
        des: '首页显示大屏展示',
        value: true,
        value: false,
    },
};
src/pages/alarmMager/batterypaSetting.vue
@@ -30,7 +30,7 @@
        <!-- 修改 -->
        <el-dialog title="提示" width="35%" :visible.sync="dialogVisible">
            <el-form size="mini" :model="form" label-position="top" class="params-dialog">
            <el-form size="mini" :model="form" label-position="top" class="params-dialog bg-white">
                <div class="table-layout">
                    <div class="table-row">
                        <div class="table-cell ar16 a22">
src/pages/dataMager/produceTotal.vue
@@ -1,14 +1,82 @@
<template>
    <flex-layout direction="row">
        <div class="page-container">
            <el-table stripe size="small" :data="tbl.data" height="100%" class="tableCent">
            <flex-layout>
              <div slot="header">
                <div class="table-layout filter-box-table">
                  <div class="table-row">
                    <div class="table-cell text-right" v-if="isProduce">
                      电池品牌:{{ params.BattProducer }}
                    </div>
                    <div class="table-cell text-right" v-if="isUseYear">
                      使用年限:{{ params.BattProducer }}
                    </div>
                    <div class="table-cell text-right" v-if="isXuHang">
                      续航时长:{{ params.BattProducer }}
                    </div>
                    <div class="table-cell text-right" v-if="!isProduce">电池品牌:</div>
                    <div class="table-cell" v-if="!isProduce">
                      <el-select
                          v-model="produce"
                          placeholder="请选择电池品牌"
                          size="small"
                          class="weihu">
                        <el-option label="全部" :value="0"></el-option>
                        <el-option
                            v-for="item in produces"
                            :key="item.label"
                            :label="item.label"
                            :value="item.value">
                        </el-option>
                      </el-select>
                    </div>
                    <div class="table-cell text-right" v-if="!isUseYear">使用年限:</div>
                    <div class="table-cell" v-if="!isUseYear">
                      <el-select
                          v-model="useYear"
                          placeholder="请选择使用年限"
                          size="small"
                          class="weihu">
                        <el-option label="全部" :value="0"></el-option>
                        <el-option
                            v-for="item in useYears"
                            :key="item.label"
                            :label="item.label"
                            :value="item.value">
                        </el-option>
                      </el-select>
                    </div>
                    <div class="table-cell text-right" v-if="!isXuHang">续航时长:</div>
                    <div class="table-cell" v-if="!isXuHang">
                      <el-select
                          v-model="xuHang"
                          placeholder="请选择续航时长"
                          size="small"
                          class="weihu">
                        <el-option label="全部" :value="0"></el-option>
                        <el-option
                            v-for="item in xuHangs"
                            :key="item.label"
                            :label="item.label"
                            :value="item.value">
                        </el-option>
                      </el-select>
                    </div>
                    <div class="table-cell text-right">
                      <el-button size="mini" type="primary" @click="startXuHang">启动续航统计</el-button>
                    </div>
                  </div>
                </div>
              </div>
              <el-table stripe size="small" :data="tbl.data" height="100%" class="tableCent">
                <el-table-column
                    v-for="header in tbl.headers" :key="header.prop"
                    :prop="header.prop"
                    :label="header.label"
                    :width="header.width" :min-width="header.minWidth"
                    align="center"></el-table-column>
            </el-table>
              </el-table>
            </flex-layout>
        </div>
        <div class="page-footer" slot="footer">
            <div class="flex-layout">
@@ -22,8 +90,12 @@
                        <bar-chart ref="useTimeChart" id="useTimeChart"></bar-chart>
                    </chart-wrapper>
                </div>
              <div class="flex-content">
                <chart-wrapper title="机房续航时长统计">
                  <bar-chart ref="endurance" id="endurance"></bar-chart>
                </chart-wrapper>
              </div>
            </div>
        </div>
    </flex-layout>
</template>
@@ -58,6 +130,20 @@
        data: [['3年内', 0], ['3-5年', 0], ['5-7年', 0], ['7年以上', 0]]
    }]
};
let enduranceOption = {
  series: [{
    name: '机房数量',
    hColor: new echarts.graphic.LinearGradient(
        0, 0, 0, 1,
        [
          {offset: 0, color: '#14c8d4'},
          {offset: 1, color: '#14c8d409'}
        ]
    ),
    data: [['1小时内', 0], ['1-2小时', 0], ['2-3小时内', 0], ['3小时以上', 0]]
  }]
};
export default {
    name: "produceTotal",
    components: {
@@ -65,8 +151,10 @@
        ChartWrapper,
        BarChart
    },
    tblData: [],
    data() {
        return {
            dataType: "",
            tbl: {
                headers: [
                    {
@@ -88,13 +176,74 @@
                        prop: "BattInUseDate",
                        label: "投入使用日期",
                        minWidth: 160
                    }
                    },
                    {
                      prop: "groupcount",
                      label: "电池组数",
                      minWidth: 80
                    },
                    {
                        prop: "batts_moncapstd",
                        label: "标称容量(AH)",
                        minWidth: 160
                    },
                    {
                      prop: "battRealCap",
                      label: "实际容量(AH)",
                      minWidth: 160
                    },
                    {
                      prop: "endurance_actual_timelong",
                      label: "续航时长(min)",
                      minWidth: 160
                    },
                ],
                data: []
            },
            params: {
                BattProducer: "",
            },
            produce: 0,
            produces: [],
            useYear: 0,
            useYears: [
              {
                label: "3年内",
                value: 1,
              },
              {
                label: "3-5年",
                value: 2,
              },
              {
                label: "5-7年",
                value: 3,
              },
              {
                label: "7年以上",
                value: 4,
              },
            ],
            xuHang: 0,
            xuHangs: [
              {
                label: "1小时内",
                value: 1,
              },
              {
                label: "1-2小时",
                value: 2,
              },
              {
                label: "2-3小时",
                value: 3,
              },
              {
                label: "3小时以上",
                value: 4,
              },
            ]
        }
    },
    methods:{
@@ -123,7 +272,10 @@
                if(rs.code == 1) {
                    data = rs.data;
                }
                this.tbl.data = data;
                // 设置表格数据
                this.$options.tblData = data;
                this.formatData();
            }).catch(error=>{
               console.log(error);
            });
@@ -151,10 +303,33 @@
                if(rs.code == 1) {
                    data = rs.data;
                }
                this.tbl.data = data;
                // 设置表格数据
                this.$options.tblData = data;
                this.formatData();
            }).catch(error=>{
                console.log(error);
            });
        },
        // 查询续航统计
        searchEndurance() {
          this.$apis.dataMager.produceTotal.searchXuHang().then(res=>{
            let rs = JSON.parse(res.data.result);
            let data = [['1小时内', 0], ['1-2小时', 0], ['2-3小时', 0], ['3小时以上', 0]];
            if(rs.code == 1) {
              data[0][1] = rs.data['续航1小时内'];
              data[1][1] = rs.data['续航1小时到2小时'];
              data[2][1] = rs.data['续航2小时到3小时'];
              data[3][1] = rs.data['续航3小时以上'];
            }
            enduranceOption.series[0].data = data;
            this.$refs.endurance.setOption(enduranceOption);
          }).catch(error=>{
            console.log(error);
          });
        },
        setOption() {
            this.$refs.produceChart.setOption(produceOption);
@@ -162,15 +337,83 @@
        resize() {
            this.$refs.produceChart.resize();
            this.$refs.useTimeChart.resize();
            this.$refs.endurance.resize();
        },
        startXuHang() {
          let loading = this.$layer.loading();
          this.$apis.dataMager.produceTotal.startXuHang().then(res=>{
            let rs = JSON.parse(res.data.result);
            this.$layer.msg(rs.msg);
            // 关闭等待框
            this.$layer.close(loading);
          }).catch(error=>{
            // 关闭等待框
            this.$layer.close(loading);
          })
        },
        formatData() {
          let data = this.$options.tblData;
          // 根据电池品牌过滤
          if(this.produce != 0 ) {
            data = data.filter(item=>{
              return false;
            });
          }
          console.log(this.$options.tblData);
          // 格式化数据
          this.tbl.data = data.map(item=>{
            let inf = item.battInf;
            let endurance = item.battEndurance;
            let noXuHang = endurance.deviceId == 0;
            let battRealCap = "-";
            if(!noXuHang) {
              let groupCount = endurance.groupcount;
              for(let i=1; i<=groupCount; i++) {
                if(i==1) {
                  battRealCap = endurance['real_cap_group'+i].toFixed(0);
                }else {
                  battRealCap = battRealCap+"/"+ endurance['real_cap_group'+i].toFixed(0);
                }
              }
            }
            let tmp = {
              StationName: inf.StationName,
              BattProducer: inf.BattProducer,
              BattModel: inf.BattModel,
              BattInUseDate: inf.BattInUseDate,
              batts_moncapstd: noXuHang?"-":endurance.batts_moncapstd,
              groupcount: noXuHang?"-":endurance.groupcount,
              battRealCap: battRealCap,
              endurance_actual_timelong: noXuHang?"-":endurance.endurance_actual_timelong
            };
            return tmp;
          })
        }
    },
    computed: {
        isXuHang() {
          return this.dataType == "xuHang";
        },
        isUseYear() {
          return this.dataType == "useYear";
        },
        isProduce() {
          return this.dataType == "produce";
        },
    },
    mounted() {
        // 设置初始配置
        this.searchProduceTotalData();
        this.searchUseYear();
        this.searchEndurance();
        this.$refs.useTimeChart.setOption(useTimeOption);
        // 电池品牌统计饼状图事件监听
        this.$G.chartManage.get('produceChart').on('click', (params)=>{
            // 重置筛选条件
            this.dataType = "produce";
            this.produce = 0;
            this.params.BattProducer = params.name;
            // 查询机房信息
            this.searchHomeByProduce(this.params);
@@ -178,9 +421,27 @@
        // 电池组使用年限点击事件监听
        this.$G.chartManage.get('useTimeChart').on('click', (params)=>{
            // 重置筛选条件
            this.dataType = "useYear";
            this.useYear = 0;
            let num = params.dataIndex+1;
            this.params.BattProducer = params.name;
            this.searchHomeByYear(num);
        });
        // 续航时长
        this.$G.chartManage.get('endurance').on('click', (params)=>{
          // 重置筛选条件
          this.dataType = "xuHang";
          this.xuHang = 0;
          let num = params.dataIndex+1;
          this.params.BattProducer = params.name;
        });
        // 重置大小
        window.addEventListener('resize', ()=>{
           this.resize();