whychdw
2021-08-27 ab3007bb6bf75e11107c02ce5ca1c29dee7c8f70
历史内阻导出
2个文件已添加
5个文件已修改
173 ■■■■■ 已修改文件
public/theme/science-black.css 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/theme/science-blue.css 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/theme/science-green.css 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/apis/dateTest/history.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/tools/exportFile.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/components/historyRes.vue 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/realTime.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/theme/science-black.css
@@ -979,3 +979,8 @@
.page-history-aio .el-table thead th {
  background: #031a46;
}
.dialog-table {
  background: url("./img/science-black/dw_bg.jpg") no-repeat;
  background-size: 100% 100%;
}
public/theme/science-blue.css
@@ -925,3 +925,8 @@
.page-history-aio .el-table thead th {
    background: #0c3688;
}
.dialog-table {
  background: url("./img/science-blue/dw_bg.jpg") no-repeat;
  background-size: 100% 100%;
}
public/theme/science-green.css
@@ -1131,3 +1131,8 @@
    margin-left: 8px;
    margin-right: 8px;
}
.dialog-table {
  background: url("./img/science-green/dw_bg.jpg") no-repeat;
  background-size: 100% 100%;
}
src/assets/js/apis/dateTest/history.js
@@ -79,4 +79,21 @@
            data: "json="+JSON.stringify(data)
        });
    },
    /**
     * 历史内阻数据查询
     *
     * @param   {[Number]}  id  参数
     *
     * @return  {[Promise]}        返回结果
     */
    historyResData(id) {
        return axios({
            method: "post",
            url: 'BattresdataAction!getResInfoByBattGroupId',
            data: "json=" + JSON.stringify({
                BattGroupId: id
            })
        });
}
};
src/assets/js/tools/exportFile.js
New file
@@ -0,0 +1,19 @@
import { export_json_to_excel } from "@/assets/js/excel/Export2Excel";
function ExportFile(headers, list, name) {
    let tHeader = [];
    let filterVal = [];
    headers.map((item, index) => {
        tHeader.push(item.label);
        filterVal.push(item.prop);
    });
    let excelData = formatJson(filterVal, list);
    export_json_to_excel(tHeader, excelData, name);
}
function formatJson(filterVal, jsonData) {
    return jsonData.map(v => filterVal.map(j => v[j]));
}
export default ExportFile;
src/pages/dataTest/components/historyRes.vue
New file
@@ -0,0 +1,114 @@
<template>
    <div class="tbl-container dialog-table" v-loading="loading">
        <flex-layout no-bg>
            <el-table :data="tblData" height="100%">
                <el-table-column
                v-for="item in tblHeader" :key="item.prop"
                :label="item.label" :prop="item.prop"
                align="center" :min-width="item.minWidth"></el-table-column>
            </el-table>
            <div class="flex-page-footer" slot="footer">
                <div class="el-pagination-btns">
                    <el-button type="primary" round size="mini" icon="el-icon-search" @click="searchData">查询</el-button>
                    <el-button type="primary" round size="mini" icon="el-icon-wallet" @click="ExportFile">导出</el-button>
                </div>
            </div>
        </flex-layout>
    </div>
</template>
<script>
import exportFile from '@/assets/js/tools/exportFile';
export default {
    props: {
        batt: {
            type: Object,
            default() {
                return {}
            }
        },
    },
    data() {
        return {
            loading: false,
            tblHeader: [
                {
                    label: '测试日期',
                    prop: 'time',
                    minWidth: 180
                }
            ],
            tblData: []
        }
    },
    methods: {
        historyResData(id) {
            this.loading = true;
            this.$apis.dataTest.history.historyResData(id).then(res=>{
                let rs = JSON.parse(res.data.result);
                this.loading = false;
                let list = [];
                if(rs.code == 1) {
                    let data = rs.data;
                    let time = "";
                    for(let i=0; i<data.length; i++) {
                        let item = data[i];
                        if(time == item.test_starttime) {
                            let tmp = list[list.length-1];
                            tmp.time = time;
                            tmp['mon'+item.mon_num] = item.mon_res;
                        }else {
                            time = item.test_starttime;
                            let tmp = {};
                            tmp.time = time;
                            tmp['mon'+item.mon_num] = item.mon_res;
                            list.push(tmp);
                        }
                    }
                }else {
                    this.$layer.msg(rs.msg);
                }
                this.tblData = list;
            }).catch(error=>{
                this.loading = false;
                console.log(error);
            });
        },
        searchData() {
            let batt = this.batt;
            this.historyResData(batt.BattGroupId);
        },
        ExportFile() {
            let batt = this.batt;
            let text = batt.StationName+"-"+batt.BattGroupName+"-内阻信息";
            exportFile(this.tblHeader, this.tblData, text);
        }
    },
    computed: {
    },
    mounted() {
        let batt = this.batt;
        let monCount = batt.MonCount?batt.MonCount:0;
        for(let i=0; i<monCount; i++) {
            let temp = {
                label: '#'+(i+1),
                prop: 'mon'+(i+1)+"1",
                minWidth: 80
            };
            this.tblHeader.push(temp);
        }
        // 查询历史数据
        //this.historyResData(batt.BattGroupId);
        this.searchData();
    }
}
</script>
<style scoped>
.tbl-container {
    height: 560px;
}
</style>
src/pages/dataTest/realTime.vue
@@ -311,10 +311,15 @@
                   top="0" class="dialog-center" :modal-append-to-body="false">
            <ez-video v-if="esVideoDialog" :sn="esVideoSn"></ez-video>
        </el-dialog>
        <el-dialog title="历史内阻数据" width="1200px" :visible.sync="hisResDialog" :close-on-click-modal="false"
                   top="0" class="dialog-center" :modal-append-to-body="false">
            <history-res v-if="hisResDialog" :batt="batt"></history-res>
        </el-dialog>
        <right-menu :visible.sync="rightMenu.show" :x="rightMenu.x" :y="rightMenu.y">
            <div class="right-menu-list">
                <ul>
                    <li><a href="javascript:;" @click="payAttentionMon">添加关注单体</a></li>
                    <li><a href="javascript:;" @click="hisResDialog=true">导出历史内阻数据</a></li>
                </ul>
            </div>
        </right-menu>
@@ -371,6 +376,7 @@
    import HdwLight from '../dataMager/components/HdwLight.vue';
    import EzVideo from "@/components/ezVideo";
    import getDevType from "@/assets/js/tools/getDevType";
    import historyRes from '@/pages/dataTest/components/historyRes'
    /* import moment from "moment"; */
    let vol, resChart, temp, conduct, currChart, leakVol;
    let tblData = [];
@@ -395,6 +401,7 @@
            NiBianInfoTab,
            JggdInfoTab,
            HdwLight,
            historyRes,
            // NiBianInfo,
        },
        watch: {
@@ -420,6 +427,7 @@
            let stateList = const_61850.stateList;
            let historyStateList = const_61850.historyStateList;
            return {
                hisResDialog: false,
                esVideoDialog: false,
                esVideoSn: "",
                maskShow: false,