<template>
|
<div
|
class="tbl-container dialog-table"
|
v-loading="loading"
|
element-loading-text="拼命加载中"
|
element-loading-spinner="el-icon-loading"
|
element-loading-background="rgba(0, 0, 0, 0.2)"
|
>
|
<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";
|
import ResLineContrast from "./resLineContrast";
|
import {
|
historyResData
|
} from '../js/history';
|
// TODO
|
|
export default {
|
components: { ResLineContrast },
|
props: {
|
batt: {
|
type: Object,
|
default() {
|
return {};
|
},
|
},
|
},
|
data() {
|
return {
|
loading: false,
|
acTabs: "tblData",
|
tblHeader: [
|
{
|
label: "测试日期",
|
prop: "time",
|
minWidth: 180,
|
},
|
],
|
tblData: [],
|
};
|
},
|
methods: {
|
historyResData(id) {
|
this.loading = true;
|
historyResData(id)
|
.then((res) => {
|
res = res.data;
|
this.loading = false;
|
let list = [];
|
if (res.data) {
|
let data = res.data.list;
|
let time = "";
|
for (let i = 0; i < data.length; i++) {
|
let item = data[i];
|
if (time == item.testStartTime) {
|
let tmp = list[list.length - 1];
|
tmp.time = time;
|
tmp["mon" + item.monNum] = item.monRes;
|
} else {
|
time = item.testStartTime;
|
let tmp = {};
|
tmp.time = time;
|
tmp["mon" + item.monNum] = item.monRes;
|
list.push(tmp);
|
}
|
}
|
} else {
|
this.$layer.msg(res.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>
|