<template>
|
<flex-layout
|
direction="row"
|
class="page-history-aio"
|
:no-bg="true"
|
:loading="loading"
|
>
|
<home-list-aio
|
slot="header"
|
@toggleChange="toggleChange"
|
@leaf-click="leafClick"
|
></home-list-aio>
|
<content-box
|
class="main-container"
|
style="margin-left: 4px; margin-right: 4px"
|
:title="battFullName + testInfo"
|
>
|
<div slot="box-tools" class="box-tools">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="实时数据"
|
placement="bottom"
|
>
|
<i class="iconfont el-icon-jinru" @click="syncPage"></i>
|
</el-tooltip>
|
</div>
|
<div slot="box-tools" class="box-tools" style="right: 36px">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="数据导出"
|
placement="bottom"
|
>
|
<i
|
class="iconfont el-icon-daochu"
|
@click="exportExcel"
|
style="font-size: 24px"
|
></i>
|
</el-tooltip>
|
</div>
|
<div slot="box-tools" class="box-tools" style="right: 65px">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="数据导入"
|
placement="bottom"
|
>
|
<i
|
class="iconfont el-icon-daochu import"
|
@click="importDialogShow"
|
style="font-size: 24px"
|
></i>
|
</el-tooltip>
|
</div>
|
<div slot="box-tools" class="box-tools" style="right: 95px">
|
<el-tooltip
|
class="item"
|
v-show="removeable"
|
effect="dark"
|
content="数据表格"
|
placement="bottom"
|
>
|
<i
|
class="iconfont el-icon-xinxi import"
|
@click="table.show = true"
|
style="font-size: 24px"
|
></i>
|
</el-tooltip>
|
</div>
|
<!-- <div slot="box-tools" class="box-tools" style="right: 125px;">
|
<el-tooltip class="item" effect="dark" content="数据对比" placement="bottom">
|
<i class="iconfont el-icon-jiankong" @click="toShowComparison"></i>
|
</el-tooltip>
|
</div> -->
|
<flex-layout :no-bg="true">
|
<div class="content-header" slot="header">
|
<el-form class="form-header" ref="form" label-width="80px">
|
<el-row :gutter="layout.gutter">
|
<el-col :span="layout.span">
|
<el-form-item label="总电压">
|
<el-input
|
v-model="top.group"
|
placeholder=""
|
size="small"
|
:disabled="true"
|
style="min-width: 12rem"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="layout.span">
|
<el-form-item label="电池电流">
|
<el-input
|
v-model="top.curr"
|
placeholder=""
|
size="small"
|
:disabled="true"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="layout.span">
|
<el-form-item label="电池状态">
|
<el-input
|
v-model="formateBattState"
|
placeholder=""
|
size="small"
|
:disabled="true"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="layout.span">
|
<el-form-item label="测试时长">
|
<el-input
|
v-model="top.test_long"
|
placeholder=""
|
size="small"
|
:disabled="true"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="layout.span">
|
<el-form-item label="测试日期">
|
<el-cascader
|
v-model="test_record.value"
|
:options="test_record.list"
|
size="small"
|
placeholder="请选择测试日期"
|
style="width: 100%; min-width: 14rem"
|
@change="testRecordChange"
|
>
|
<template slot-scope="{ node, data }">
|
<span>{{ data.label }}</span>
|
<span v-if="!node.isLeaf">
|
({{ data.children.length }})
|
</span>
|
</template>
|
</el-cascader>
|
</el-form-item>
|
</el-col>
|
<el-col :span="layout.span">
|
<el-form-item label="测试容量">
|
<el-input
|
v-model="top.testCap"
|
placeholder=""
|
size="small"
|
:disabled="true"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="layout.span">
|
<el-form-item label="剩余容量">
|
<el-input
|
v-model="top.re_cap"
|
placeholder=""
|
size="small"
|
:disabled="true"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="layout.span">
|
<div class="text-right" v-if="removeable">
|
<el-button type="primary" size="small" @click="removeTestData"
|
>删除记录</el-button
|
>
|
</div>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<div class="page-content">
|
<div class="flex-box-list">
|
<div class="flex-box" style="margin-bottom: 8px">
|
<chart-wrapper :title="groupVolTitle">
|
<line-chart ref="groupVol" id="groupVol" unit="V"></line-chart>
|
</chart-wrapper>
|
</div>
|
<div class="flex-box" style="margin-bottom: 8px">
|
<chart-wrapper :title="monBarTitle">
|
<bar-chart
|
ref="monBar"
|
id="monBar"
|
:show-label="false"
|
></bar-chart>
|
</chart-wrapper>
|
</div>
|
</div>
|
<div class="flex-box-list">
|
<div class="flex-box" style="margin-top: 8px">
|
<chart-wrapper title="电池电流折线图(A)">
|
<line-chart
|
ref="groupCurr"
|
id="groupCurr"
|
unit="A"
|
start-zero
|
></line-chart>
|
</chart-wrapper>
|
</div>
|
<div class="flex-box" style="margin-top: 8px">
|
<chart-wrapper :title="monInfo.title">
|
<line-chart
|
ref="monInfo"
|
id="monInfo"
|
:unit="monInfo.unit"
|
></line-chart>
|
</chart-wrapper>
|
</div>
|
</div>
|
</div>
|
<div class="content-footer" slot="footer">
|
<div class="slider-container">
|
<el-slider
|
v-model="slider"
|
size="small"
|
:format-tooltip="formatTooltip"
|
@input="sliderInput"
|
>
|
</el-slider>
|
</div>
|
</div>
|
</flex-layout>
|
</content-box>
|
<!-- 导入 -->
|
<el-dialog
|
title="一体机数据导入"
|
class="dialog-import"
|
:visible.sync="importData.show"
|
width="800"
|
>
|
<div class="posR inProgress">
|
<div class="title">
|
<el-tag type="warning" effect="dark">当前处理中的记录</el-tag>
|
</div>
|
<el-row
|
v-if="importData.inProgress.length"
|
:gutter="layout.importGutter"
|
>
|
<el-col
|
:span="layout.importSpan"
|
v-for="(item, idx) in importData.inProgress"
|
:key="'import_' + idx"
|
>
|
<div
|
class="tag"
|
:class="{ success: item.state == 2, error: item.state == -1 }"
|
:style="{ '--percent': item.percent }"
|
>
|
{{ item.fileName }}: {{ item.stateTxt }}
|
<div
|
:class="[
|
'progress-bar',
|
{
|
'progress__bar--yellow': item.percent < 30,
|
'progress__bar--blue':
|
item.percent >= 30 && item.percent < 60,
|
'progress__bar--green':
|
item.percent >= 60 && item.percent < 100,
|
'progress--complete':
|
item.percent >= 100 || item.state != 1,
|
},
|
]"
|
:type="item.type"
|
>
|
<span>{{ item.percent }}%</span>
|
</div>
|
</div>
|
</el-col>
|
</el-row>
|
<div class="empty" v-else></div>
|
</div>
|
<div class="clearfix" v-if="importData.done">
|
<div class="title files">
|
<el-tag type="" effect="dark">一体机文件列表</el-tag>
|
<el-pagination
|
size="mini"
|
:current-page="page.pageCurr"
|
:page-size="page.pageSize"
|
layout="total, prev, pager, next, jumper"
|
:total="page.pageAll"
|
@current-change="currentChange"
|
></el-pagination>
|
<div class="btn-grp">
|
<el-button type="primary" @click="getFileList" size="small"
|
>读取</el-button
|
>
|
<el-button
|
:disabled="importData.checked.length == 0"
|
type="success"
|
@click="importCmd"
|
size="small"
|
>导入</el-button
|
>
|
</div>
|
</div>
|
<el-table
|
:data="importData.getFileList"
|
@selection-change="selectChanged"
|
style="width: 100%"
|
>
|
<el-table-column type="selection" :selectable="selectInit" width="50">
|
</el-table-column>
|
<el-table-column
|
v-for="(item, idx) in importData.header"
|
:key="'header_' + idx"
|
:prop="item.prop"
|
:label="item.label"
|
:min-width="item.minWidth"
|
>
|
</el-table-column>
|
</el-table>
|
</div>
|
<template v-else>
|
<div class="info">
|
请等以上任务处理结束再操作...,
|
也可以点击终止按钮,手动终止当前文件列表的导入
|
</div>
|
<el-button type="primary" size="small" @click="stopImport"
|
>终止</el-button
|
>
|
</template>
|
<div slot="footer">
|
<el-button @click="importData.show = false">关闭</el-button>
|
</div>
|
</el-dialog>
|
<!-- 表格数据 -->
|
<el-dialog
|
title="一体机数据表格"
|
class="dialog-table"
|
:visible.sync="table.show"
|
width="800"
|
>
|
<el-table :data="table.data" stripe height="540" style="width: 100%">
|
<el-table-column
|
v-for="(item, idx) in table.header"
|
:key="'header_' + idx"
|
:prop="item.prop"
|
:label="item.label"
|
:min-width="item.minWidth"
|
>
|
</el-table-column>
|
</el-table>
|
</el-dialog>
|
<div id="allGraph">
|
<div class="chart-contain">
|
<div class="chart" ref="allGraph"></div>
|
</div>
|
</div>
|
<form
|
:action="exportInfo.action"
|
method="post"
|
ref="all_picture"
|
enctype="multipart/form-data"
|
>
|
<input type="hidden" id="exPageName" name="pageName" value="A059" />
|
<input type="hidden" id="stateFlag" ref="stateFlag" name="stateFlag" value="" />
|
<input type="hidden" name="ltop_echart" ref="ltop_echart" value="" />
|
<input type="hidden" name="rtop_echart" ref="rtop_echart" value="" />
|
<input
|
type="hidden"
|
name="lbottom_echart"
|
ref="lbottom_echart"
|
value=""
|
/>
|
<input
|
type="hidden"
|
name="rbottom_echart"
|
ref="rbottom_echart"
|
value=""
|
/>
|
<input
|
type="hidden"
|
name="battGroupId"
|
ref="battGroupId"
|
value=""
|
/>
|
<input
|
type="hidden"
|
name="testRecordCount"
|
ref="testRecordCount"
|
value=""
|
/>
|
</form>
|
</flex-layout>
|
</template>
|
|
<script>
|
import HomeListAio from "./components/HomeListAio";
|
|
import echarts from "echarts";
|
import ContentBox from "@/components/ContentBox";
|
import BarChart from "@/components/chart/BarChart";
|
import LineChart from "@/components/chart/LineChart";
|
import ChartWrapper from "@/components/ChartWrapper";
|
import comparison from "./components/comparison.vue";
|
import getSpecialPointIndex from "@/assets/js/tools/getSpecialPointIndex";
|
import { searchAll_lowAction } from "./js/history";
|
|
import {
|
formatSeconds,
|
GetMonomerCap,
|
GetHourRate,
|
getBarNum,
|
Title,
|
sethoubeiTime,
|
} from "@/assets/js/tools";
|
|
let Titleobj = new Title();
|
import ECharts from "echarts/lib/echarts";
|
//引入折线图
|
import "echarts/lib/chart/bar";
|
import "echarts/lib/chart/line";
|
//引入提示框
|
import "echarts/lib/component/tooltip";
|
//引入标题
|
import "echarts/lib/component/title";
|
//引入图例标志
|
import "echarts/lib/component/legend";
|
//区域缩放
|
import "echarts/lib/component/dataZoom";
|
|
//markeline
|
import "echarts/lib/component/markLine";
|
|
// 引入自定义主题
|
import "@/components/chart/theme/transparent";
|
|
import {
|
getTestList,
|
getDownloadInfo,
|
getFileList,
|
getTestData,
|
importData,
|
delTestData,
|
stopImport,
|
} from "./js/historyAio";
|
|
import Timeout from "@/assets/js/tools/Timeout";
|
import CONFIG from "@/assets/js/const/const_aio";
|
import getExportExcelUrl from "@/assets/js/tools/getExportExcelUrl";
|
let stopReason = CONFIG.stopreasons;
|
// 端信息
|
let allData = {
|
groupVol: [],
|
onlineVol: [],
|
testCurr: [],
|
testTimelong: [],
|
monNumList: [],
|
recordTime: [],
|
testCap: [],
|
dataList: [],
|
endData: {},
|
tableData: [],
|
};
|
// 单体折线信息
|
let monLineData = {
|
vol: [], // 单体电压
|
temp: [], // 单体温度
|
realCap: [], // 单体实际容量
|
resCap: [], // 单体剩余容量
|
preCap: [], // 单体容量百分比
|
};
|
// 单体柱状信息
|
let monBarData = {
|
vol: [], // 单体电压
|
temp: [], // 单体温度
|
realCap: [], // 单体实际容量
|
resCap: [], // 单体剩余容量
|
preCap: [], // 单体容量百分比
|
jh_curr: [], // 单体均衡电流
|
res: [], // 单体内阻
|
};
|
// 4个图表
|
let groupVolLineChart, currLineChart, monLineChart, monBarChart;
|
let allGraph;
|
// 导入处理的状态
|
const STATE = {
|
0: "不下载",
|
1: "正在下载",
|
2: "下载完成",
|
"-1": "下载失败",
|
};
|
const TYPE = {
|
1: "",
|
2: "success",
|
"-1": "danger",
|
};
|
// 测试类型
|
const TESTTYPE = {
|
2: "充电",
|
3: "放电",
|
4: "活化",
|
};
|
|
export default {
|
name: "historyAio",
|
data() {
|
let baseURL = this.$axios.defaults.baseURL;
|
baseURL = baseURL ? baseURL : "";
|
return {
|
// 测试是当天内的第几次 按类型分
|
testIdx: 0,
|
// 测试类型
|
testType1: '未知',
|
// 测试日期
|
testStartDate: '0000-00-00',
|
HistoryData: [],
|
loading: false,
|
isNew: true,
|
batt: {},
|
layout: {
|
gutter: 16,
|
span: 6,
|
importGutter: 30,
|
importSpan: 8,
|
},
|
groupVolTitle: "总电压折线图(V)",
|
groupVolQth: {
|
code: 0,
|
low: 0,
|
lowTime: "00:00:00",
|
high: 0,
|
highTime: "00:00:00",
|
qt: 0,
|
qg: 0,
|
qh: 0,
|
title: "正常",
|
},
|
top: {
|
state: "", // 电池状态
|
group: "", // 端电压
|
curr: "", // 电池电流
|
test_long: "", // 测试时长
|
testCap: "", // 测试容量
|
re_cap: "", // 剩余容量
|
xuhang: "", // 续航时长
|
},
|
battState: {
|
testType: -100,
|
stopReason: "",
|
},
|
slider: 100,
|
testTimelong: [],
|
test_record: {
|
value: [],
|
list: [
|
{
|
value: "discharge",
|
label: "放电",
|
children: [],
|
},
|
{
|
value: "charge",
|
label: "充电",
|
children: [],
|
},
|
{
|
value: "activate",
|
label: "活化",
|
children: [],
|
},
|
],
|
},
|
monBarTitle: "最大值=0V;最小值=0V;平均值=0V",
|
chartType: "vol",
|
chartTypes: [
|
{
|
label: "单体电压",
|
value: "vol",
|
unit: "V",
|
fixed: 3,
|
},
|
],
|
exportInfo: {
|
action: getExportExcelUrl(baseURL, "EchartPictureDowload/exportExcel"),
|
ltop_echart: "", // 组端电压折线图
|
rtop_echart: "", // 单体电压柱状图
|
lbottom_echart: "", // 测试电流
|
rbottom_echart: "", // 单体电压折线图
|
},
|
low_list: [],
|
monInfo: {
|
title: "单体电压(V)",
|
unit: "V",
|
},
|
timer: new Timeout(),
|
// 导入
|
importData: {
|
show: false,
|
header: [
|
{
|
prop: "fileName",
|
label: "文件名",
|
minWidth: 200,
|
},
|
{
|
prop: "testType",
|
label: "测试类型",
|
minWidth: 200,
|
},
|
{
|
prop: "testTimelongStr",
|
label: "测试时长",
|
minWidth: 100,
|
},
|
{
|
prop: "invalid",
|
label: "有效性",
|
minWidth: 200,
|
},
|
],
|
// fileLen: 0,
|
getFileList: [],
|
checked: [],
|
done: true,
|
inProgress: [],
|
},
|
removeable: false,
|
table: {
|
show: false,
|
header: [],
|
headerBase: [
|
{
|
label: "测试时长",
|
prop: "testTimelong",
|
minWidth: 100,
|
},
|
{
|
label: "总电压",
|
prop: "sumVol",
|
minWidth: 100,
|
},
|
{
|
label: "测试电流",
|
prop: "testCurr",
|
minWidth: 100,
|
},
|
{
|
label: "测试容量",
|
prop: "testCap",
|
minWidth: 100,
|
},
|
],
|
data: [],
|
},
|
page: {
|
pageCurr: 1,
|
pageSize: 8,
|
pageAll: 0,
|
},
|
// 当前测试类型
|
testType: 0,
|
};
|
},
|
components: {
|
HomeListAio,
|
ContentBox,
|
BarChart,
|
LineChart,
|
ChartWrapper,
|
comparison,
|
},
|
computed: {
|
testInfo () {
|
let str = '';
|
if (this.testType1 != '未知') {
|
str = `--${this.testStartDate}-第${this.testIdx}次${this.testType1}`;
|
}
|
return str;
|
},
|
battFullName() {
|
let batt = this.batt;
|
if (batt.stationName && batt.battGroupName) {
|
return batt.stationName + "-" + batt.battGroupName;
|
}
|
return "电池组全称";
|
},
|
formateBattState() {
|
let battState = this.battState;
|
|
let str = "(终止原因:" + battState.stopReason + ")";
|
let res = "";
|
switch (battState.testType) {
|
case 2:
|
res = "充电" + str;
|
break;
|
case 3:
|
res = "放电" + str;
|
break;
|
case 4:
|
res = "活化" + str;
|
break;
|
}
|
return res;
|
},
|
},
|
watch: {
|
batt(n) {
|
this.timer.stop();
|
this.timer.restart();
|
this.testType1 = '未知';
|
},
|
"importData.inProgress"(n) {
|
// console.log('done', n, o);
|
this.importData.done = !n.some((v) => {
|
return v.state == 1;
|
});
|
|
// console.log(n, this.importData.done, '===done');
|
|
// 刷新测试记录列表
|
this.searchBattTestData();
|
},
|
},
|
methods: {
|
changeShow() {
|
// 端信息
|
allData = {
|
groupVol: [],
|
onlineVol: [],
|
testCurr: [],
|
testTimelong: [],
|
monNumList: [],
|
recordTime: [],
|
testCap: [],
|
dataList: [],
|
endData: {},
|
tableData: [],
|
};
|
// 单体折线信息
|
monLineData = {
|
vol: [], // 单体电压
|
temp: [], // 单体温度
|
realCap: [], // 单体实际容量
|
resCap: [], // 单体剩余容量
|
preCap: [], // 单体容量百分比
|
};
|
// 单体柱状信息
|
monBarData = {
|
vol: [], // 单体电压
|
temp: [], // 单体温度
|
realCap: [], // 单体实际容量
|
resCap: [], // 单体剩余容量
|
preCap: [], // 单体容量百分比
|
jh_curr: [], // 单体均衡电流
|
res: [], // 单体内阻
|
};
|
this.formateHisData(this.HistoryData);
|
},
|
toggleChange() {
|
this.resize();
|
},
|
leafClick(data) {
|
this.batt = data;
|
// 重置页面内容
|
this.init();
|
// 获取充放电记录
|
this.searchBattTestData();
|
this.isNew = false;
|
},
|
init() {
|
// 初始化充放电记录
|
this.test_record.value = [];
|
this.test_record.list[0].children = [];
|
this.test_record.list[1].children = [];
|
this.test_record.list[2].children = [];
|
// 初始化顶部文本框内容
|
this.top = {
|
state: "", // 电池状态
|
group: "", // 端电压
|
curr: "", // 电池电流
|
test_long: "", // 测试时长
|
testCap: "", // 测试容量
|
re_cap: "", // 剩余容量
|
xuhang: "---", // 续航时长
|
};
|
|
// 初始化电池状态
|
this.battState.testType = -100;
|
|
// 初始化图表
|
// TODO
|
this.initChart();
|
},
|
// 初始化图表和图表数据
|
initChart() {
|
let batt = this.batt;
|
// 拖动条默认值100
|
this.slider = 100;
|
this.testTimelong = [];
|
|
// 端信息
|
allData = {
|
groupVol: [],
|
onlineVol: [],
|
testCurr: [],
|
testTimelong: [],
|
recordTime: [],
|
testCap: [],
|
monNumList: [],
|
dataList: [],
|
tableData: [],
|
};
|
for (let i = 1; i <= batt.monCount; i++) {
|
allData.monNumList[i - 1] = "#" + i;
|
}
|
// 单体折线信息
|
monLineData = {
|
vol: [], // 单体电压
|
temp: [], // 单体温度
|
realCap: [], // 单体实际容量
|
resCap: [], // 单体剩余容量
|
preCap: [], // 单体容量百分比
|
};
|
// 单体柱状信息
|
monBarData = {
|
vol: [], // 单体电压
|
temp: [], // 单体温度
|
realCap: [], // 单体实际容量
|
resCap: [], // 单体剩余容量
|
preCap: [], // 单体容量百分比
|
jh_curr: [], // 单体均衡电流
|
res: [], // 单体内阻
|
};
|
|
// 初始化图表的配置项
|
this.initChartOptions();
|
|
// 设置折线图
|
this.setLineChart();
|
|
// 设置柱状图
|
this.setBarChart();
|
},
|
initChartOptions() {
|
// 端电压折线图
|
groupVolLineChart = {
|
color: ["#0081ff", "#df9d02"],
|
title: {
|
show: false,
|
text: "总电压折线图(V)",
|
x: "left",
|
textStyle: {
|
fontSize: "14",
|
},
|
},
|
legend: {
|
show: false,
|
data: ["在线电压", "总电压"],
|
right: 0,
|
orient: "vertical",
|
},
|
series: [
|
{
|
name: "在线电压",
|
data: [],
|
},
|
{
|
name: "总电压",
|
data: [],
|
},
|
],
|
};
|
|
// 电池电流折线图
|
currLineChart = {
|
title: {
|
show: false,
|
text: "电池电流折线图(A)",
|
x: "center",
|
textStyle: {
|
fontSize: "14",
|
},
|
},
|
series: [
|
{
|
name: "电池电流",
|
areaStyle: {
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
{
|
offset: 0,
|
color: "#00feff",
|
},
|
{
|
offset: 1,
|
color: "transparent",
|
},
|
]),
|
},
|
data: [],
|
},
|
],
|
};
|
|
// 单体信息折线图
|
monLineChart = {
|
title: {
|
show: false,
|
text: "单体电压(V)",
|
x: "center",
|
textStyle: {
|
fontSize: "14",
|
},
|
},
|
series: [],
|
};
|
|
// 图表类型
|
let chartInfo = this.getChartInfo();
|
let unit = chartInfo.unit;
|
let label = chartInfo.label;
|
// 单体信息柱状图
|
this.monBarTitle =
|
"最大值=0" + unit + ";最小值=0" + unit + ";平均值=0" + unit;
|
monBarChart = {
|
title: {
|
show: false,
|
text: "最大值=0" + unit + ";最小值=0" + unit + ";平均值=0" + unit,
|
x: "center",
|
textStyle: {
|
fontSize: "14",
|
},
|
},
|
series: [
|
{
|
name: "初始值",
|
hColor: "#0B388B",
|
data: [],
|
},
|
{
|
name: label,
|
barGap: "-100%",
|
data: [],
|
},
|
],
|
};
|
},
|
// 设置折线图
|
setLineChart() {
|
// 设置端电压折线图
|
this.setGroupVolLineChart();
|
// 设置电池电流折线图
|
this.setCurrLineChart();
|
// 设置单体折线图
|
this.setMonLineChart();
|
// 建立联动
|
this.$G.chartManage.connect(["groupVol", "groupCurr", "monInfo"]);
|
},
|
// 设置端电压折线图
|
setGroupVolLineChart() {
|
// 根据allData.groupVol数据设置groupVolLineChart的值
|
groupVolLineChart.series[0].data = allData.onlineVol;
|
groupVolLineChart.series[1].data = allData.groupVol;
|
let specialPoint = getSpecialPointIndex(
|
allData.groupVol.map((item) => {
|
return item[1];
|
})
|
);
|
let markLine = {};
|
this.groupVolQth.code = specialPoint.code;
|
// console.log(this.test_record.value);
|
|
this.groupVolTitle = "总电压折线图(V)";
|
groupVolLineChart.series[1].markLine = markLine;
|
// 更新图表
|
this.$refs.groupVol.setOption(groupVolLineChart);
|
},
|
// 设置电池电流折线图
|
setCurrLineChart() {
|
// 根据allData.testCurr数据设置currLineChart的值
|
currLineChart.series[0].data = allData.testCurr;
|
// 更新图表
|
this.$refs.groupCurr.setOption(currLineChart);
|
},
|
// 设置单体折线图
|
setMonLineChart() {
|
let chartInfo = this.getChartInfo();
|
// 根据monLineData的值设置monLineChart
|
let dataList = monLineData.vol;
|
let title = chartInfo.label + "(" + chartInfo.unit + ")";
|
let unit = chartInfo.unit;
|
let isUpdate = true;
|
switch (chartInfo.value) {
|
case "vol":
|
dataList = monLineData.vol;
|
break;
|
case "temp":
|
dataList = monLineData.temp;
|
break;
|
case "resCap":
|
dataList = monLineData.resCap;
|
break;
|
default:
|
isUpdate = false;
|
break;
|
}
|
// 检测是否更新
|
if (!isUpdate) {
|
return;
|
}
|
this.monInfo.title = title;
|
this.monInfo.unit = unit;
|
monLineChart.title.show = false;
|
monLineChart.series = dataList.map((item, index) => {
|
let monNum = "#" + (index + 1);
|
return {
|
name: monNum,
|
data: item,
|
};
|
});
|
|
this.$nextTick(() => {
|
// 更新图表
|
this.$refs.monInfo.setOption(monLineChart);
|
});
|
},
|
// 设置柱状图
|
setBarChart() {
|
let chartInfo = this.getChartInfo();
|
let unit = chartInfo.unit;
|
let fixed = chartInfo.fixed;
|
// 根据monBarData的值设置monBarChart
|
let dataList = this.getBarDataList();
|
let index = this.getDataIndex(dataList.length, this.slider);
|
if (index != -1) {
|
let data = dataList[index];
|
let batNum = getBarNum(data);
|
monBarChart.title.show = false;
|
monBarChart.title.text =
|
"最大值=" +
|
batNum.max +
|
unit +
|
";最小值=" +
|
batNum.min +
|
unit +
|
";平均值=" +
|
batNum.avg.toFixed(fixed) +
|
unit;
|
this.monBarTitle = monBarChart.title.text;
|
monBarChart.series[1].name = chartInfo.label;
|
monBarChart.series[1].data = data;
|
monBarChart.series[0].data = dataList[0];
|
} else {
|
console.log("未获取到值");
|
}
|
// 设置柱状图
|
this.$refs.monBar.setOption(monBarChart);
|
},
|
getBarDataList() {
|
let chartInfo = this.getChartInfo();
|
// 根据monBarData的值设置monBarChart
|
let dataList = monBarData.vol;
|
switch (chartInfo.value) {
|
case "vol":
|
dataList = monBarData.vol;
|
break;
|
case "temp":
|
dataList = monBarData.temp;
|
break;
|
case "realCap":
|
dataList = monBarData.realCap;
|
break;
|
case "resCap":
|
dataList = monBarData.resCap;
|
break;
|
case "preCap":
|
dataList = monBarData.preCap;
|
break;
|
default:
|
dataList = monBarData.vol;
|
break;
|
}
|
|
return dataList;
|
},
|
resize() {
|
this.$G.chartManage.resize("groupVol");
|
this.$G.chartManage.resize("monBar");
|
this.$G.chartManage.resize("groupCurr");
|
this.$G.chartManage.resize("monInfo");
|
},
|
// 查询测试信息
|
searchBattTestData() {
|
// console.trace('testlist');
|
let batt = this.batt;
|
// 开启等待框
|
// let loading = this.$layer.loading(1);
|
getTestList({
|
battGroupId: batt.battGroupId,
|
})
|
.then((res) => {
|
// 关闭等待框
|
// this.$layer.close(loading);
|
// 解析数据
|
res = res.data;
|
let charge = []; // 充电
|
let discharge = []; // 放电
|
let activate = []; // 活化
|
if (res.code) {
|
res.data.forEach((item) => {
|
// item.value = item.testStartTime;
|
// item.label = item.testStartTime;
|
// 测试类型
|
switch (item.testType) {
|
case 2:
|
//充电
|
item.testType1 = '充电';
|
charge.push(item);
|
break;
|
case 3:
|
//放电
|
item.testType1 = '放电';
|
discharge.push(item);
|
break;
|
case 4:
|
//活化
|
item.testType1 = '活化';
|
activate.push(item);
|
break;
|
}
|
});
|
}
|
// 充放电记录
|
this.test_record.list[1].children = this.sortTestData(charge);
|
this.test_record.list[0].children = this.sortTestData(discharge);
|
this.test_record.list[2].children = this.sortTestData(activate);
|
})
|
.catch((error) => {
|
// this.$layer.close(loading);
|
console.log(error);
|
});
|
},
|
// 给测试记录编号 按测试开始时间 同一天的要排第几次
|
sortTestData(arr) {
|
arr.sort((a, b) => {
|
return new Date(a.testStartTime).getTime() - new Date(b.testStartTime).getTime();
|
});
|
let idx = 1;
|
let lastDate = '';
|
return arr.map((v) => {
|
let testStartDate = v.testStartTime.split(' ')[0];
|
if (lastDate == testStartDate) {
|
idx++;
|
} else {
|
idx = 1;
|
lastDate = testStartDate;
|
}
|
let str = v.testStartTime + '--' + idx;
|
return {
|
...v,
|
testIdx: idx,
|
testStartDate,
|
value: str,
|
label: str
|
}
|
}).reverse();
|
},
|
// 切换测试信息
|
testRecordChange() {
|
let testRecord = this.getTestRecord();
|
if (testRecord == -1) {
|
return false;
|
}
|
this.testType1 = testRecord.testType1;
|
this.testIdx = testRecord.testIdx;
|
this.testStartDate = testRecord.testStartDate;
|
// console.log(testRecord, '009');
|
// 当前选中的数据的测试类型
|
this.testType = testRecord.testType;
|
let monCount = testRecord.monCount || 0;
|
let list = [];
|
if (monCount > 0) {
|
for (let i = 0; i < monCount; i++) {
|
let idx = i + 1;
|
list.push({
|
label: "#" + idx,
|
prop: "monVol" + idx,
|
minWidth: 100,
|
});
|
}
|
}
|
this.table.header = [...this.table.headerBase, ...list];
|
// 初始化图表
|
this.initChart();
|
|
this.$refs.testRecordCount.value = testRecord.testRecordCount;
|
this.$refs.battGroupId.value = testRecord.battGroupId;
|
// 查询历史数据
|
this.searchHistory(testRecord.battGroupId, testRecord.testRecordCount);
|
},
|
|
// 查询历史信息
|
searchHistory(battGroupId, count) {
|
this.loading = true;
|
this.$nextTick(() => {
|
getTestData({
|
battGroupId: battGroupId,
|
testRecordCount: count,
|
})
|
.then((res) => {
|
this.loading = false;
|
res = res.data;
|
let data = [];
|
// 数据
|
if (res.code) {
|
data = res.data;
|
// console.log(data, 'hisData');
|
}
|
this.HistoryData = data;
|
// console.log(data, 'his==');
|
// 格式化数据
|
this.formateHisData(data);
|
})
|
.catch((error) => {
|
this.loading = false;
|
console.log(error);
|
});
|
});
|
},
|
// 格式化历史信息数据
|
formateHisData(filterData) {
|
// console.log(filterData, 'formate');
|
let recordTime = -1; // 记录时间
|
let recordNum = -100; // 记录笔数
|
allData.endData = filterData[filterData.length - 1];
|
// 测试类型
|
if (allData.endData) {
|
allData.endData.testType = this.testType;
|
}
|
filterData.forEach((item) => {
|
let monNum = item.monNum;
|
let testTimelong = formatSeconds(item.testTimeLong);
|
// 获取组端电压,在线电压,组端电流的信息和开辟一个单体柱状图
|
if (recordNum != item.recordNum) {
|
recordTime = item.recordTime;
|
recordNum = item.recordNum;
|
allData.groupVol.push([testTimelong, item.sumVol]);
|
allData.onlineVol.push([testTimelong, item.onlineVol]);
|
allData.testCurr.push([testTimelong, item.testCurr]);
|
allData.recordTime.push(testTimelong);
|
allData.testTimelong.push(item.testTimeLong);
|
allData.testCap.push(item.testCap);
|
item.groupVol = item.sumVol;
|
allData.dataList.push(item);
|
this.testTimelong.push(item.testTimeLong);
|
|
// 开辟空间
|
monBarData.vol.push([]);
|
monBarData.temp.push([]);
|
monBarData.realCap.push([]);
|
monBarData.resCap.push([]);
|
monBarData.preCap.push([]);
|
allData.tableData.push({
|
testTimelong: formatSeconds(item.testTimeLong),
|
sumVol: item.sumVol,
|
testCurr: item.testCurr,
|
testCap: item.testCap,
|
});
|
}
|
// 单体电压柱状图设置
|
let monNum_text = "#" + monNum;
|
let monBarVol = monBarData.vol[monBarData.vol.length - 1];
|
monBarVol.push([monNum_text, item.monVol]);
|
|
// 单体温度柱状图
|
// let monBarTemp = monBarData.temp[monBarData.temp.length - 1];
|
// monBarTemp.push([monNum_text, item.mon_tmp]);
|
|
// 设置单体折线图信息
|
if (typeof monLineData.vol[monNum - 1] != "object") {
|
let index = monNum - 1;
|
// 开辟空间
|
monLineData.vol[index] = [];
|
monLineData.temp[index] = [];
|
monLineData.resCap[index] = [];
|
}
|
// 获取到需要使用的空间
|
let monLineVol = monLineData.vol[monNum - 1];
|
monLineVol.push([testTimelong, item.monVol]);
|
|
// let monLineTemp = monLineData.temp[monNum - 1];
|
// monLineTemp.push([testTimelong, item.mon_tmp]);
|
|
allData.tableData[allData.tableData.length - 1]["monVol" + monNum] =
|
item.monVol;
|
});
|
// console.log(allData.tableData, 'allData');
|
this.table.data = allData.tableData;
|
|
// 初始化图表的配置项
|
this.initChartOptions();
|
|
// 设置容量
|
this.setCapList();
|
// 设置折线图表
|
this.setLineChart();
|
// 执行滑动事件
|
this.sliderInput();
|
},
|
setCapList() {
|
let batt = this.batt;
|
let batt_test_data = monBarData.vol;
|
let batt_test_evary_record = allData.dataList;
|
for (let i = 0; i < batt_test_data.length; i++) {
|
let vol_list = batt_test_data[i].map((item) => {
|
return item[1];
|
});
|
let max_vol = Math.max.apply(null, vol_list);
|
for (let j = 0; j < vol_list.length; j++) {
|
let avg_curr =
|
batt_test_evary_record[i].testTimelong > 0
|
? (batt_test_evary_record[i].testCap * 3600) /
|
batt_test_evary_record[i].testTimelong
|
: batt_test_evary_record[i].testCurr;
|
let actionvalue = GetMonomerCap(
|
batt.monCapStd,
|
GetHourRate(batt.monCapStd, avg_curr),
|
batt_test_evary_record[i].testCap,
|
max_vol,
|
vol_list[j],
|
batt.monVolStd,
|
1
|
);
|
let restvalue = GetMonomerCap(
|
batt.monCapStd,
|
GetHourRate(batt.monCapStd, avg_curr),
|
batt_test_evary_record[i].testCap,
|
max_vol,
|
vol_list[j],
|
batt.monVolStd,
|
0
|
);
|
let batt_num_text = "#" + (j + 1);
|
monBarData.realCap[i].push([batt_num_text, actionvalue.toFixed(0)]);
|
monBarData.resCap[i].push([batt_num_text, restvalue.toFixed(0)]);
|
monBarData.preCap[i].push([
|
batt_num_text,
|
((actionvalue * 100) / batt.monCapStd).toFixed(0),
|
]);
|
}
|
}
|
|
// 容量
|
monLineData.vol.forEach((item, key) => {
|
item.forEach((volItem, volItemKey) => {
|
let resCapItem = monBarData.resCap[volItemKey];
|
monLineData.resCap[key].push([volItem[0], resCapItem[key][1]]);
|
});
|
});
|
},
|
// 获取测试的信息
|
getTestRecord() {
|
let value = this.test_record.value;
|
// 没有选择充放电记录,返回-1
|
if (value.length == 0) {
|
return -1;
|
}
|
let type = value[0];
|
let time = value[1];
|
let list = this.test_record.list;
|
let result = 0;
|
// 遍历list
|
for (let i in list) {
|
let item = list[i];
|
if (item.value == type) {
|
for (let j in item.children) {
|
let child = item.children[j];
|
if (child.value == time) {
|
result = child;
|
break;
|
}
|
}
|
break;
|
}
|
}
|
// 设置电池状态
|
this.battState.testType = result.testType;
|
// console.log(result, 'info00');
|
this.battState.stopReason = stopReason[result.stopType];
|
this.removeable = true;
|
// 返回结果集
|
return result;
|
},
|
// 格式化滑块显示的内容
|
formatTooltip(value) {
|
// console.log(value, 'time_long');
|
let testTimelong = this.testTimelong;
|
let index = this.getDataIndex(testTimelong.length, value);
|
let test_long = formatSeconds(0);
|
if (index != -1) {
|
test_long = formatSeconds(testTimelong[index]);
|
}
|
this.top.test_long = test_long;
|
return test_long;
|
},
|
// 拖动滑块时触发
|
sliderInput() {
|
// 设置头部信息
|
this.setTopData();
|
|
// 设置柱状图
|
this.setBarChart();
|
},
|
// 设置顶部文本框的数据
|
setTopData() {
|
let batt = this.batt;
|
// 组端电压和在线电压
|
let groupVol = allData.groupVol;
|
let onlineVol = allData.onlineVol;
|
let testCurr = allData.testCurr;
|
let testCap = allData.testCap;
|
let monVols = monBarData.vol;
|
let dataList = allData.dataList;
|
let index = this.getDataIndex(groupVol.length, this.slider);
|
if (index != -1) {
|
this.top.group =
|
"在线:" +
|
onlineVol[index][1].toFixed(2) +
|
"V;总电压:" +
|
groupVol[index][1].toFixed(2) +
|
"V";
|
this.top.curr = testCurr[index][1].toFixed(1) + "A";
|
this.top.testCap = testCap[index].toFixed(1) + "AH";
|
// 剩余容量
|
let monVol = monVols[index];
|
let list = dataList[index];
|
let avg_curr =
|
list.testTimelong > 0
|
? (list.testCap * 3600) / list.testTimelong
|
: list.testCurr;
|
let batNum = getBarNum(monVol);
|
let over_cap = GetMonomerCap(
|
batt.monCapStd,
|
GetHourRate(batt.monCapStd, avg_curr),
|
list.testCap,
|
batNum.max,
|
batNum.min,
|
batt.monVolStd,
|
0
|
);
|
this.top.re_cap = over_cap.toFixed(1) + "AH";
|
}
|
// 设置续航时长
|
let lastIndex = this.getDataIndex(groupVol.length, 100);
|
if (lastIndex != -1) {
|
// 实际容量
|
let monVol = monVols[lastIndex];
|
let list = dataList[lastIndex];
|
let avg_curr =
|
list.testTimelong > 0
|
? (list.testCap * 3600) / list.testTimelong
|
: list.testCurr;
|
let batNum = getBarNum(monVol);
|
let real_cap = GetMonomerCap(
|
batt.monCapStd,
|
GetHourRate(batt.monCapStd, avg_curr),
|
list.testCap,
|
batNum.max,
|
batNum.min,
|
batt.monVolStd,
|
1
|
);
|
let xuhang = batt.loadCurr ? real_cap / batt.loadCurr : 0;
|
this.top.xuhang = xuhang ? sethoubeiTime(xuhang) : "---";
|
}
|
},
|
// 根据百分比获取显示的数据的笔数
|
getDataIndex(num, percent) {
|
if (percent <= 0) {
|
return 0;
|
}
|
return Math.floor((num * percent) / 100) - 1;
|
},
|
// 向父级发送同步页面的指令
|
syncPage() {
|
let batt = this.batt;
|
let search =
|
"?province=" +
|
batt.stationName1 +
|
"&city=" +
|
batt.stationName2 +
|
"&county=" +
|
batt.stationName5 +
|
"&home=" +
|
batt.stationName3 +
|
"&batt=" +
|
batt.battGroupId +
|
// list组件重载
|
"&listReload=1";
|
this.$router.push("/dataTest/movingRingSystem" + search);
|
},
|
toShowComparison() {
|
this.showComparison = true;
|
},
|
getChartInfo() {
|
let chartType = this.chartType;
|
let chartTypes = this.chartTypes;
|
let chartTypeInfo = chartTypes[0];
|
for (let i = 0; i < chartTypes.length; i++) {
|
if (chartType == chartTypes[i].value) {
|
chartTypeInfo = chartTypes[i];
|
break;
|
}
|
}
|
return chartTypeInfo;
|
},
|
changeChartType() {
|
if (allData.groupVol.length == 0) {
|
this.initChart();
|
} else {
|
let loading = this.$layer.loading();
|
setTimeout(() => {
|
this.setBarChart();
|
this.setMonLineChart();
|
this.$layer.close(loading);
|
}, 100);
|
}
|
},
|
// 导出报表
|
exportExcel() {
|
if (allData.groupVol.length == 0) {
|
this.$layer.msg("暂无数据导出,请先选择充放电数据!");
|
return false;
|
}
|
|
//组端电压折线图
|
let groupVolLineChartOption =
|
this.$refs.groupVol.getOption(groupVolLineChart);
|
groupVolLineChartOption.title.show = true;
|
groupVolLineChartOption.title.textStyle.color = '#000';
|
groupVolLineChartOption.title.x = "center";
|
groupVolLineChartOption.legend.show = false;
|
this.createGraphByOpt(groupVolLineChartOption);
|
let oltop = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: "#fff",
|
});
|
//组端电压折线图
|
let monBarChartOption =
|
this.$refs.monBar.getOption(monBarChart);
|
monBarChartOption.title.show = true;
|
monBarChartOption.title.textStyle.color = '#000';
|
monBarChartOption.title.x = "center";
|
// monBarChartOption.legend.show = false;
|
this.createGraphByOpt(monBarChartOption);
|
let ortop = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: "#fff",
|
});
|
|
// 电池电流折线图
|
let currLineChartOption = this.$refs.groupVol.getOption(currLineChart);
|
currLineChartOption.title.show = true;
|
currLineChartOption.title.textStyle.color = '#000';
|
currLineChartOption.title.x = "center";
|
currLineChartOption.legend.show = false;
|
this.createGraphByOpt(currLineChartOption);
|
let olbottom = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: "#fff",
|
});
|
|
// 单体电压折线图
|
let monLineChartOption = this.$refs.monInfo.getOption(monLineChart);
|
monLineChartOption.title.show = true;
|
monLineChartOption.title.textStyle.color = '#000';
|
monLineChartOption.title.x = "center";
|
monLineChartOption.legend.show = false;
|
this.createGraphByOpt(monLineChartOption);
|
let orbottom = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: "#fff",
|
});
|
|
this.$refs.ltop_echart.value = oltop; // 组端电压折线图
|
this.$refs.rtop_echart.value = ortop; // 单体电压柱状图
|
this.$refs.lbottom_echart.value = olbottom; // 电池电流折线图
|
this.$refs.rbottom_echart.value = orbottom; //单体电压折线图
|
this.$refs.stateFlag.value = this.testInfo.slice(2);
|
|
this.$refs.all_picture.submit();
|
},
|
createGraphByOpt(opt) {
|
allGraph.clear();
|
let lineStyle = {
|
color: "#000",
|
};
|
|
// 设置x轴的颜色
|
if (opt.xAxis[0].axisLine) {
|
opt.xAxis[0].axisLine.lineStyle = lineStyle;
|
} else {
|
opt.xAxis[0].axisLine = {
|
lineStyle,
|
};
|
}
|
|
// 设置x轴刻度的值
|
if (opt.xAxis[0].axisLabel) {
|
opt.xAxis[0].axisLabel.color = "#000";
|
} else {
|
opt.xAxis[0].axisLabel = {
|
color: "#000",
|
};
|
}
|
|
// 设置y轴的颜色
|
if (opt.yAxis[0].axisLine) {
|
opt.yAxis[0].axisLine.lineStyle = lineStyle;
|
} else {
|
opt.yAxis[0].axisLine = {
|
lineStyle,
|
};
|
}
|
|
// 设置y轴刻度的值
|
if (opt.yAxis[0].axisLabel) {
|
opt.yAxis[0].axisLabel.color = "#000";
|
} else {
|
opt.yAxis[0].axisLabel = {
|
color: "#000",
|
};
|
}
|
// console.log(opt);
|
opt.animation = false;
|
allGraph.setOption(opt);
|
},
|
getTitle(array, units) {
|
let getLow = this.getLow;
|
var title = "";
|
//a=new Title();
|
//alert(Titleobj);
|
Titleobj = new Title();
|
var sum = 0;
|
if (array != undefined && array.length > 0) {
|
Titleobj.setMax(Math.max.apply(null, array));
|
Titleobj.setMin(Math.min.apply(null, array));
|
for (var i = 0; i < array.length; i++) {
|
sum += parseFloat(array[i]);
|
}
|
var batt = this.batt;
|
//console.info(batt);
|
if ("Resistance" == units) {
|
Titleobj.setAvg((sum / array.length).toFixed(3));
|
var low = getLow(3, 2);
|
if (low.low_method == 0) {
|
//根据标称值计算
|
Titleobj.setAlow(((2 - low.low_value) * batt.monResStd).toFixed(3));
|
low = getLow(3, 3);
|
Titleobj.setClow(((2 - low.low_value) * batt.monResStd).toFixed(3));
|
} else {
|
//根据平均值计算
|
Titleobj.setAlow(
|
((2 - low.low_value) * Titleobj.getAvg()).toFixed(3)
|
);
|
low = getLow(3, 3);
|
Titleobj.setClow(
|
((2 - low.low_value) * Titleobj.getAvg()).toFixed(3)
|
);
|
}
|
var count = 0;
|
for (var i = 0; i < array.length; i++) {
|
if (parseFloat(Titleobj.getAlow()) < parseFloat(array[i])) {
|
//console.info(title.getAlow()+"<"+array[i]);
|
count++;
|
}
|
}
|
Titleobj.setLc(count);
|
Titleobj.setLp(((count * 100) / array.length).toFixed(1));
|
//console.info(title);
|
} else {
|
if ("Voltage" == units) {
|
Titleobj.setAvg((sum / array.length).toFixed(3));
|
var low = getLow(1, 1);
|
if (low.low_method == 0) {
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value * batt.monVolStd).toFixed(3));
|
low = getLow(1, 0);
|
Titleobj.setClow((low.low_value * batt.monVolStd).toFixed(3));
|
} else {
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value * Titleobj.getAvg()).toFixed(3));
|
low = getLow(1, 0);
|
Titleobj.setClow((low.low_value * Titleobj.getAvg()).toFixed(3));
|
}
|
} else if ("Temperature" == units) {
|
Titleobj.setAvg((sum / array.length).toFixed(1));
|
var low = getLow(1, 1);
|
if (low.low_method == 0) {
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value * batt.monTmpStd).toFixed(1));
|
low = getLow(1, 0);
|
Titleobj.setClow((low.low_value * batt.monTmpStd).toFixed(1));
|
} else {
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value * Titleobj.getAvg()).toFixed(1));
|
low = getLow(1, 0);
|
Titleobj.setClow((low.low_value * Titleobj.getAvg()).toFixed(1));
|
}
|
} else if ("Conductance" == units) {
|
Titleobj.setAvg((sum / array.length).toFixed(0));
|
var low = getLow(3, 2);
|
if (low.low_method == 0) {
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value * batt.monSerStd).toFixed(0));
|
low = getLow(3, 3);
|
Titleobj.setClow((low.low_value * batt.monSerStd).toFixed(0));
|
} else {
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
low = getLow(3, 3);
|
Titleobj.setClow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
}
|
} else if ("Actual_capacity" == units) {
|
Titleobj.setAvg((sum / array.length).toFixed(0));
|
var low = getLow(2, 2);
|
if (low.low_method == 0) {
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value * batt.monCapStd).toFixed(0));
|
//console.info(batt);
|
low = getLow(2, 3);
|
Titleobj.setClow((low.low_value * batt.monCapStd).toFixed(0));
|
} else {
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
low = getLow(2, 3);
|
Titleobj.setClow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
}
|
} else if ("Residual_capacity" == units) {
|
Titleobj.setAvg((sum / array.length).toFixed(0));
|
var low = getLow(1, 1);
|
if (low.low_method == 0) {
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
//console.info(batt);
|
low = getLow(1, 0);
|
Titleobj.setClow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
} else {
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
//console.info(batt);
|
low = getLow(1, 0);
|
Titleobj.setClow((low.low_value * Titleobj.getAvg()).toFixed(0));
|
}
|
} else if ("Percent_total_capacity" == units) {
|
Titleobj.setAvg((sum / array.length).toFixed(2));
|
var low = getLow(2, 2);
|
if (low.low_method == 0) {
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value * batt.monCapStd).toFixed(2));
|
//console.info(batt);
|
low = getLow(2, 3);
|
Titleobj.setClow((low.low_value * batt.monCapStd).toFixed(2));
|
} else {
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value * Titleobj.getAvg()).toFixed(2));
|
low = getLow(2, 3);
|
Titleobj.setClow((low.low_value * Titleobj.getAvg()).toFixed(2));
|
}
|
} else if ("MonJHCurr" == units) {
|
//单体均衡
|
Titleobj.setAvg((sum / array.length).toFixed(2));
|
}
|
var count = 0;
|
for (var i = 0; i < array.length; i++) {
|
if (parseFloat(Titleobj.getAlow()) > parseFloat(array[i])) {
|
count++;
|
}
|
}
|
Titleobj.setLc(count);
|
Titleobj.setLp(((count * 100) / array.length).toFixed(1));
|
}
|
|
//console.info(Title);
|
title = Titleobj.getAllTile(units);
|
}
|
return title;
|
},
|
searchAll_lowAction() {
|
searchAll_lowAction()
|
.then((res) => {
|
res = res.data;
|
if (res.code) {
|
this.low_list = res.data.list;
|
}
|
})
|
.catch((error) => {
|
console.log(error);
|
});
|
},
|
getLow(lowtype, lownametype) {
|
let low_list = this.low_list;
|
if (
|
lowtype != undefined &&
|
low_list != undefined &&
|
lownametype != undefined
|
) {
|
for (var i = 0; i < low_list.length; i++) {
|
if (
|
lowtype == low_list[i].low_type &&
|
lownametype == low_list[i].low_nametype
|
) {
|
return low_list[i];
|
}
|
}
|
}
|
},
|
// 查询设备文件下载情况
|
getDownloadInfo() {
|
getDownloadInfo(this.batt.fbsdeviceId)
|
.then((res) => {
|
res = res.data;
|
// console.log(res, 'info');
|
let list = [];
|
if (res.code) {
|
let data = res.data[0];
|
// console.log(data, 'download_info_data');
|
// 总文件数
|
this.page.pageAll = data.fileTotal;
|
for (let i = 0, j = 8; i < j; i++) {
|
let idx = i + 1;
|
let fileName = data["fileName" + idx];
|
let flag = data["downloadFlag" + idx];
|
let state = data["downloadState" + idx];
|
// 进度
|
let now_block = data["nowDataBlock" + idx];
|
let total_block = data["totalDataBlock" + idx];
|
// 进度占比 下载占60 写数据库占40 根据当前状态来算
|
let percent = 0;
|
// 1; //下载文件
|
// 2; //生成文件
|
// 3; //导出数据
|
// 用户终止的状态为6(导数据库时停止), 7(下载文件时停止)
|
if (state <= 1 || 7 == state) {
|
// percent = now_block == 0 ? 0 : (now_block / total_block * 60).toHold(2);
|
percent = now_block == 0 ? 0 : (now_block / total_block) * 60;
|
} else {
|
// percent = (now_block == 0 ? 0 : (now_block / total_block * 40).toHold(2)) + 60;
|
percent =
|
(now_block == 0 ? 0 : (now_block / total_block) * 40) + 60;
|
}
|
if (fileName && flag != 0) {
|
list.push({
|
fileName: fileName,
|
state: flag,
|
type: TYPE[flag],
|
stateTxt: STATE[flag],
|
percent: flag == 2 ? 100 : percent.toFixed(2),
|
});
|
}
|
}
|
}
|
this.importData.inProgress = list;
|
})
|
.catch((err) => {
|
console.error(err);
|
});
|
},
|
// 一体机数据导入
|
importDialogShow() {
|
// console.log('import');
|
this.getDownloadInfo();
|
this.importData.show = true;
|
},
|
// 给设备发指令开始导入
|
importCmd() {
|
this.importData.done = false;
|
let batt = this.batt;
|
// console.log(batt, '99');
|
let params = {
|
devId: batt.fbsdeviceId,
|
battGroupId: batt.battGroupId,
|
};
|
for (let i = 0; i < 8; i++) {
|
let idx = i + 1;
|
params["downloadFlag" + idx] =
|
this.importData.checked.indexOf(idx) != -1 ? 1 : 0;
|
}
|
// console.log(params, 'params');
|
importData(params)
|
.then((res) => {
|
res = res.data;
|
if (res.code && res.data) {
|
this.importData.done = false;
|
this.importData.checked = [];
|
} else {
|
this.importData.done = true;
|
}
|
this.importData.getFileList = [];
|
// console.log(res, 'import');
|
})
|
.catch((err) => {
|
console.error(err);
|
});
|
},
|
selectInit(row) {
|
return row.testTimelong > 0;
|
},
|
selectChanged(list) {
|
let arr = list.map((v) => {
|
return v.idx;
|
});
|
// console.log(arr, 'arr');
|
this.importData.checked = arr;
|
},
|
getFileList() {
|
let params = {
|
deviceId: this.batt.fbsdeviceId,
|
fileIndex: this.page.pageCurr - 1,
|
};
|
getFileList(params)
|
.then((res) => {
|
res = res.data;
|
// console.log(res, 'fileList');
|
let list = [];
|
if (res.code && res.data) {
|
let data = res.data2;
|
let len = data.fileCount;
|
// 当前页文件数
|
// this.importData.fileLen = len;
|
for (let i = 0; i < len; i++) {
|
let idx = i + 1;
|
let fileName = data["fileName" + idx];
|
let testTimelong = data["testTimelong" + idx];
|
let type = data["dataType" + idx];
|
// let state = data['downloadState' + idx];
|
list.push({
|
fileName: fileName,
|
testType: TESTTYPE[type] || "未知",
|
invalid: testTimelong == 0 ? "无效" : "有效",
|
testTimelongStr: formatSeconds(testTimelong),
|
testTimelong: testTimelong,
|
idx,
|
});
|
}
|
} else {
|
this.$message({
|
type: "warning",
|
message: res.msg,
|
});
|
}
|
this.importData.getFileList = list;
|
})
|
.catch((err) => {
|
console.error(err);
|
});
|
},
|
currentChange(value) {
|
this.page.pageCurr = value;
|
this.getFileList();
|
},
|
removeTestData() {
|
let batt = this.batt;
|
let testRecord = this.getTestRecord();
|
let params = {
|
battGroupId: batt.battGroupId,
|
testRecordCount: testRecord.testRecordCount,
|
};
|
delTestData(params)
|
.then((res) => {
|
res = res.data;
|
if (res.code && res.data) {
|
this.init();
|
this.table.data = [];
|
this.removeable = false;
|
// 获取充放电记录
|
this.searchBattTestData();
|
}
|
// console.log(res, 'remove');
|
})
|
.catch((err) => {
|
console.error(err);
|
});
|
},
|
// 停止导入
|
stopImport() {
|
stopImport({ deviceId: this.batt.fbsdeviceId })
|
.then((res) => {
|
res = res.data;
|
})
|
.catch((err) => {
|
console.error(err);
|
});
|
},
|
activeFN () {
|
this.resize();
|
}
|
},
|
|
mounted() {
|
this.timer.init(() => {
|
this.getDownloadInfo();
|
this.timer.open();
|
}, 1000);
|
// 初始化图表
|
this.initChart();
|
this.searchAll_lowAction();
|
// 基于准备好的dom,初始化echarts实例
|
allGraph = ECharts.init(this.$refs.allGraph, "transparent");
|
// 屏幕缩放时触发
|
window.addEventListener("resize", this.resize);
|
},
|
beforeDestroy() {
|
window.removeEventListener("resize", this.resize);
|
},
|
};
|
</script>
|
|
<style scoped>
|
.main-container >>> .content-box-title {
|
padding-right: 6rem;
|
}
|
.el-form-item {
|
margin-bottom: 0;
|
}
|
.form-header {
|
padding: 8px;
|
}
|
.page-history-aio {
|
color: #fff;
|
}
|
.page-content {
|
position: relative;
|
padding-top: 8px;
|
padding-bottom: 2px;
|
box-sizing: border-box;
|
height: 100%;
|
}
|
.page-content .flex-box {
|
flex: 1;
|
overflow-x: hidden;
|
}
|
.flex-box-list {
|
display: flex;
|
flex-direction: row;
|
height: 50%;
|
box-sizing: border-box;
|
}
|
.page-content .flex-box {
|
flex: 1;
|
overflow-x: hidden;
|
}
|
|
.slider-container {
|
padding-left: 16px;
|
padding-right: 16px;
|
overflow: hidden;
|
}
|
.box-tools {
|
line-height: 32px;
|
}
|
|
.box-tools .iconfont {
|
font-size: 20px;
|
}
|
|
.box-tools .iconfont:hover {
|
cursor: pointer;
|
color: #cfcfcf;
|
}
|
|
.box-tools .iconfont:active {
|
color: #ff0000;
|
}
|
|
.chart-wrapper {
|
position: relative;
|
box-sizing: border-box;
|
margin: 0 16px;
|
height: 100%;
|
padding: 12px;
|
background-image: radial-gradient(#151f4140, #3667ec40);
|
}
|
|
.chart-wrapper:before,
|
.chart-wrapper:after,
|
.chart-wrapper-corner {
|
position: absolute;
|
display: inline-block;
|
content: " ";
|
width: 18px;
|
height: 18px;
|
}
|
|
.chart-wrapper:before {
|
left: 0;
|
top: 0;
|
border-top: 2px solid #00feff;
|
border-left: 2px solid #00feff;
|
}
|
|
.chart-wrapper:after {
|
left: 0;
|
bottom: 0;
|
border-bottom: 2px solid #00feff;
|
border-left: 2px solid #00feff;
|
}
|
|
.chart-wrapper-corner.top-right {
|
top: 0;
|
right: 0;
|
border-top: 2px solid #00feff;
|
border-right: 2px solid #00feff;
|
}
|
|
.chart-wrapper-corner.bottom-right {
|
bottom: 0;
|
right: 0;
|
border-bottom: 2px solid #00feff;
|
border-right: 2px solid #00feff;
|
}
|
|
.chart-tools-wrapper {
|
position: absolute;
|
top: 12px;
|
right: 12px;
|
z-index: 99;
|
}
|
#allGraph {
|
position: absolute;
|
top: -1000px;
|
left: 0;
|
width: 600px;
|
height: 400px;
|
}
|
|
.chart-contain {
|
width: 100%;
|
height: 100%;
|
background-color: #ffffff;
|
}
|
|
.chart {
|
width: 100%;
|
height: 100%;
|
}
|
i.import {
|
-webkit-transform: scaleX(-1);
|
transform: scaleX(-1);
|
}
|
.dialog-import >>> .el-dialog {
|
background: #fff;
|
}
|
.dialog-import >>> .el-dialog__body {
|
padding: 6px 20px 0;
|
}
|
.dialog-table {
|
background: rgba(0, 0, 0, 0.2);
|
}
|
.dialog-table >>> .el-dialog__body {
|
background: #79b4f0;
|
}
|
.posR {
|
position: relative;
|
}
|
/* .inProgress {
|
height: 100px;
|
} */
|
.inProgress >>> .el-row .el-tag {
|
width: 100%;
|
}
|
.inProgress .el-col {
|
margin-bottom: 6px;
|
margin-top: 20px;
|
}
|
.empty {
|
height: 100%;
|
color: #999;
|
}
|
.empty::before {
|
content: "暂无数据";
|
position: absolute;
|
left: 50%;
|
top: 50%;
|
transform: translate(-50%, -50%);
|
}
|
.title {
|
margin-bottom: 10px;
|
}
|
.title.files {
|
margin-top: 10px;
|
display: flex;
|
justify-content: space-between;
|
}
|
.clearfix::before,
|
.clearfix:before,
|
.clearfix::after,
|
.clearfix:after {
|
content: "";
|
display: block;
|
visibility: hidden;
|
height: 0;
|
font-size: 0;
|
clear: both;
|
}
|
.clearfix {
|
clear: both;
|
}
|
>>> .el-pager li.number {
|
color: #999;
|
}
|
>>> .el-pager li.number.active {
|
color: #409eff;
|
}
|
>>> .el-pagination__total,
|
>>> .el-pagination__jump {
|
color: #333;
|
}
|
.dialog-import >>> .el-table th:first-child .cell {
|
padding-left: 14px;
|
}
|
.dialog-import >>> .el-table td {
|
padding: 6px 0;
|
}
|
.info {
|
color: #990;
|
margin-bottom: 10px;
|
}
|
>>> .el-form-item label {
|
color: #ffe329;
|
}
|
.text-right {
|
text-align: right;
|
}
|
.tag {
|
position: relative;
|
z-index: 1;
|
color: #fff;
|
height: 22px;
|
line-height: 20px;
|
border: 1px #ccc solid;
|
border-radius: 4px;
|
background: #999;
|
}
|
.tag.success {
|
/* color: #59acff; */
|
box-shadow: 0 0 10px -2px #0e0;
|
}
|
.tag.error {
|
/* color: #f00; */
|
box-shadow: 0 0 2px 1px #ff0000;
|
}
|
/* 进度 */
|
.progress-bar > span {
|
position: absolute;
|
bottom: 110%;
|
left: 100%;
|
/* display: inline-block; */
|
white-space: nowrap;
|
/* margin-left: -100%; */
|
-webkit-transform: translate(calc(var(--percent) * -1%), 0);
|
transform: translate(calc(var(--percent) * -1%), 0);
|
background-color: inherit;
|
/* background: var(--color); */
|
border-radius: 10px;
|
padding: 1px 4px;
|
font-size: 12px;
|
}
|
.progress-bar {
|
color: #fff;
|
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
|
position: absolute;
|
top: 0;
|
left: 0;
|
/* width: 0%; */
|
width: calc(var(--percent) * 1%);
|
height: 100%;
|
/* opacity: 0; */
|
/* border: 1px solid; */
|
border-radius: 4px;
|
background-size: 50px 30px, contain, contain;
|
background-position: -20% center, right center, left center;
|
background-repeat: no-repeat, no-repeat, no-repeat;
|
-webkit-transition: opacity 0.2s ease, width 0.8s ease-out,
|
background-color 1s ease, border-color 0.3s ease, box-shadow 1s ease;
|
transition: opacity 0.2s ease, width 0.8s ease-out, background-color 1s ease,
|
border-color 0.3s ease, box-shadow 1s ease;
|
-webkit-animation: pulse 2s linear infinite;
|
animation: pulse 2s linear infinite;
|
background-color: rgba(85, 182, 101, 0.95);
|
background-image: -webkit-linear-gradient(0deg, 10%, 30%, 70%, 80%, 90%),
|
-webkit-linear-gradient(left, rgba(251, 31, 49, 0) 0%, #1ffb56 100%),
|
-webkit-linear-gradient(right, rgba(251, 31, 49, 0) 0%, #1ffb94 100%);
|
background-image: linear-gradient(0deg, 10%, 30%, 70%, 80%, 90%),
|
linear-gradient(left, rgba(251, 31, 49, 0) 0%, #1ffb56 100%),
|
linear-gradient(right, rgba(251, 31, 49, 0) 0%, #1ffb94 100%);
|
border-color: #26a100;
|
box-shadow: 0 0 2px #06fa4f inset, 0 0 1px #04e217 inset;
|
z-index: -1;
|
}
|
.progress--complete.progress-bar {
|
background-size: 0 0, contain, contain;
|
-webkit-animation: none;
|
animation: none;
|
border-radius: 2px;
|
}
|
.progress--complete.progress-bar:after,
|
.progress--complete.progress-bar:before {
|
opacity: 0;
|
}
|
.progress__bar--yellow {
|
background-size: 0 0, contain, contain;
|
background-color: rgba(180, 123, 0, 0.95);
|
background-image: -webkit-linear-gradient(90deg, transparent 60%, #fff 100%),
|
-webkit-linear-gradient(0, transparent 70%, #ffbf36 100%),
|
-webkit-linear-gradient(180deg, transparent 70%, #ffbf36 100%);
|
background-image: linear-gradient(90deg, transparent 60%, #fff 100%),
|
linear-gradient(0, transparent 70%, #ffbf36 100%),
|
linear-gradient(180deg, transparent 70%, #ffbf36 100%);
|
border-color: #ffc74f;
|
box-shadow: 0 0 0.6em #ffb71c inset, 0 0 0.4em #ffae02 inset,
|
0 0 0.5em rgba(232, 158, 0, 0.5), 0 0 0.1em rgba(255, 248, 232, 0.5);
|
}
|
.progress__bar--green {
|
background-color: rgba(1, 190, 26, 0.95);
|
background-image: -webkit-linear-gradient(90deg, transparent 60%, #fff 100%),
|
-webkit-linear-gradient(0, transparent 70%, #00fe21 100%),
|
-webkit-linear-gradient(180deg, transparent 70%, #00fe21 100%);
|
background-image: linear-gradient(90deg, transparent 60%, #fff 100%),
|
linear-gradient(0, transparent 70%, #00fe21 100%),
|
linear-gradient(180deg, transparent 70%, #00fe21 100%);
|
border-color: #19ff37;
|
box-shadow: 0 0 0.6em #00e51e inset, 0 0 0.4em #00cb1a inset,
|
0 0 0.5em rgba(0, 178, 23, 0.5), 0 0 0.1em rgba(178, 255, 188, 0.5);
|
}
|
.progress__bar--blue {
|
background-color: rgb(0, 131, 207);
|
background-image: -webkit-linear-gradient(90deg, transparent 60%, #fff 100%),
|
-webkit-linear-gradient(0, transparent 70%, #3dacee 100%),
|
-webkit-linear-gradient(180deg, transparent 70%, #3dacee 100%);
|
background-image: linear-gradient(90deg, transparent 60%, #fff 100%),
|
linear-gradient(0, transparent 70%, #3dacee 100%),
|
linear-gradient(180deg, transparent 70%, #3dacee 100%);
|
border-color: #6abff0;
|
box-shadow: 0 0 0.6em #25a2ec inset, 0 0 0.4em #1497e3 inset,
|
0 0 0.5em rgba(18, 135, 204, 0.5), 0 0 0.1em rgba(225, 242, 252, 0.5);
|
}
|
@-webkit-keyframes pulse {
|
0% {
|
background-position: -50% center, right center, left center;
|
}
|
100% {
|
background-position: 150% center, right center, left center;
|
}
|
}
|
|
@keyframes pulse {
|
0% {
|
background-position: -50% center, right center, left center;
|
}
|
100% {
|
background-position: 150% center, right center, left center;
|
}
|
}
|
</style>
|