<template>
|
<div class="contain">
|
<div class="row-filter">
|
<el-form ref="form" size="mini" label-width="80px">
|
<el-form-item :label="$t('Date')">
|
<el-col :span="11">
|
<el-date-picker
|
type="date"
|
:placeholder="$t('Selectthestartdate')"
|
v-model="startDate"
|
value-format="yyyy-MM-dd"
|
style="width: 100%"
|
></el-date-picker>
|
</el-col>
|
<el-col class="line" :span="2">-</el-col>
|
<el-col :span="11">
|
<el-date-picker
|
type="date"
|
:placeholder="$t('Selecttheexpirydate')"
|
v-model="endDate"
|
value-format="yyyy-MM-dd"
|
style="width: 100%"
|
></el-date-picker>
|
</el-col>
|
</el-form-item>
|
<el-form-item :label="$t('BatteryType')">
|
<el-select v-model="battType">
|
<el-option :label="$t('All')" :value="0"></el-option>
|
<el-option label="1.2V" :value="1.2"></el-option>
|
<el-option label="2V" :value="2"></el-option>
|
<el-option label="6V" :value="6"></el-option>
|
<el-option label="12V" :value="12"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item :label="$t('Properties')">
|
<el-select v-model="propType">
|
<el-option :label="$t('Resistance')" value="res"></el-option>
|
<el-option :label="$t('Voltage')" value="vol"></el-option>
|
<el-option :label="$t('Conductance')" value="cond"></el-option>
|
<el-option :label="$t('ConnectionBar')" value="chain"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item :label="$t('Evaluation')">
|
<el-select v-model="estimate">
|
<el-option :label="$t('All')" :value="0"></el-option>
|
<el-option :label="$t('excellent')" :value="3"></el-option>
|
<el-option :label="$t('Good')" :value="2"></el-option>
|
<el-option :label="$t('bad')" :value="1"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
<div class="btn-grp">
|
<el-button size="mini" type="primary" class="btn" @click="getDatas"
|
>{{ $t('operate.search') }}</el-button
|
>
|
<el-popconfirm
|
class="btn"
|
:title="$t('importmessage')"
|
@confirm="dbImport"
|
>
|
<el-button slot="reference" size="mini" type="primary"
|
>{{ $t('import') }}</el-button
|
>
|
</el-popconfirm>
|
<el-button size="mini" class="btn" type="primary" @click="dbExport"
|
>{{ $t('export') }}</el-button
|
>
|
</div>
|
</div>
|
<div class="table-wrap">
|
<div class="inner">
|
<el-table
|
ref="table"
|
:data="tableData"
|
style="width: 100%"
|
stripe
|
size="small"
|
height="100%"
|
class="tableCent"
|
tooltip-effect="light"
|
>
|
<el-table-column
|
v-for="header in headers"
|
:key="header.prop"
|
:prop="header.prop"
|
:label="header.label"
|
:width="header.width"
|
:fixed="header.fixed"
|
:min-width="header.minWidth"
|
show-overflow-tooltip
|
align="center"
|
></el-table-column>
|
<el-table-column
|
align="center"
|
width="100"
|
fixed="right"
|
:label="$t('operate.operation')"
|
>
|
<template slot-scope="scope">
|
<el-popconfirm
|
:title="$t('deleteMessage')"
|
@confirm="handleDelete(scope.row)"
|
>
|
<el-button slot="reference" size="mini" type="danger"
|
>{{ $t('operate.delete') }}</el-button
|
>
|
</el-popconfirm>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="pageCurr"
|
:page-sizes="[10, 20, 30, 50, 100]"
|
:page-size="pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total"
|
>
|
</el-pagination>
|
</div>
|
</template>
|
|
<script>
|
import { getDatas, deleteData } from "@/apis";
|
import i18n from './i18n/data';
|
import { createI18nOption } from '@/assets/js/tools/i18n';
|
|
const i18nMixin = createI18nOption(i18n);
|
|
export default {
|
name: "",
|
mixins: [i18nMixin],
|
data() {
|
const header0 = [
|
{
|
prop: "battStation",
|
label: this.$t('TestSite'),
|
minWidth: 180,
|
fixed: "left",
|
},
|
{
|
prop: "battGroupName",
|
label: this.$t('System'),
|
minWidth: 180,
|
},
|
{
|
prop: "testTime",
|
label: this.$t('TestTime'),
|
minWidth: 180,
|
},
|
{
|
prop: "battVol",
|
label: this.$t('BatteryType'),
|
minWidth: 80,
|
},
|
{
|
prop: "battCount",
|
label: this.$t('CellQty'),
|
minWidth: 80,
|
},
|
{
|
prop: "brJudge",
|
label: this.$t('Evaluation'),
|
minWidth: 80,
|
},
|
];
|
return {
|
// 当前页面最大单体数
|
maxCount: 0,
|
propType: 'res',
|
tableData: [],
|
header0,
|
pageCurr: 1,
|
pageSize: 10,
|
total: 0,
|
startDate: "",
|
endDate: "",
|
battType: 0,
|
estimate: 0,
|
};
|
},
|
components: {},
|
watch: {
|
// estimate() {
|
// this.$nextTick(() => {
|
// this.$refs.table.doLayout();
|
// });
|
// },
|
},
|
computed: {
|
headers() {
|
const arr = [];
|
for (let i = 0, j = this.maxCount; i < j; i++) {
|
let idx = i + 1;
|
switch (this.propType) {
|
case "res":
|
arr.push({
|
prop: "res" + idx,
|
label: `#${idx}` + this.$t('Resistance'),
|
minWidth: 100,
|
});
|
break;
|
case "vol":
|
arr.push({
|
prop: "vol" + idx,
|
label: `#${idx}` + this.$t('Voltage'),
|
minWidth: 100,
|
});
|
break;
|
case "cond":
|
arr.push({
|
prop: "cond" + idx,
|
label: `#${idx}` + this.$t('Conductance'),
|
minWidth: 100,
|
});
|
break;
|
case "chain":
|
arr.push({
|
prop: "chain" + idx,
|
label: `#${idx}` + this.$t('ConnectionBar'),
|
minWidth: 100,
|
});
|
break;
|
}
|
}
|
return [
|
...this.header0,
|
...arr
|
];
|
},
|
},
|
methods: {
|
getDatas() {
|
const {
|
battType: battVol,
|
pageCurr,
|
pageSize,
|
startDate,
|
endDate,
|
estimate,
|
} = this;
|
let params = {
|
battVol,
|
startTime: !startDate ? "" : startDate + " 00:00:00",
|
endTime: !endDate ? "" : endDate + " 23:59:59",
|
flag: estimate,
|
pageCurr,
|
pageSize,
|
};
|
getDatas(params).then((res) => {
|
let { code, data, data2 } = res.data;
|
let list = [];
|
let total = 0;
|
let maxCount = 0;
|
if (code && data) {
|
// console.log(data2);
|
data2.list.forEach((v) => {
|
let battInfo = v.battInfoList[0];
|
maxCount = v.battCount > maxCount ? v.battCount : maxCount;
|
v["brJudge"] = battInfo.brJudge;
|
// v["sdBasebr"] = Math.round(battInfo.sdBasebr * 10000) / 100 + "%";
|
// v["sdBasebs"] = Math.round(battInfo.sdBasebs * 10000) / 100 + "%";
|
// v["sdBasebv"] = Math.round(battInfo.sdBasebv * 10000) / 100 + "%";
|
// v["sdBasecr"] = Math.round(battInfo.sdBasecr * 10000) / 100 + "%";
|
v["stationId"] = battInfo.stationId;
|
battInfo.battDataList.forEach((val, i) => {
|
let idx = i + 1;
|
v["res" + idx] = val.br;
|
v["vol" + idx] = val.bv;
|
v["cond" + idx] = val.bs;
|
v["chain" + idx] = val.cr;
|
});
|
});
|
total = data2.total;
|
list = data2.list;
|
}
|
this.maxCount = maxCount;
|
this.tableData = list;
|
this.total = total;
|
this.$nextTick(() => {
|
this.$refs.table.doLayout();
|
});
|
});
|
},
|
handleSizeChange(val) {
|
this.pageSize = val;
|
this.pageCurr = 1;
|
this.getDatas();
|
},
|
handleCurrentChange(val) {
|
this.pageCurr = val;
|
this.getDatas();
|
},
|
handleDelete(data) {
|
// console.log("delete", data);
|
const { fileId, stationId } = data;
|
let params = {
|
fileId,
|
stationId,
|
};
|
deleteData(params).then((res) => {
|
let { code } = res.data;
|
if (code) {
|
this.$message.success(this.$t('OperationSuccessfully'));
|
this.getDatas();
|
this.$bus.$emit("stationReload");
|
} else {
|
this.$message.error(this.$t('OperationFailed'));
|
}
|
});
|
},
|
// 数据库导入
|
dbImport() {
|
this.$bus.$emit("loading", this.$t('closeMessage'));
|
window.api.send("db-import");
|
},
|
// 数据库导出
|
dbExport() {
|
window.api.send("db-export");
|
},
|
},
|
|
mounted() {
|
this.getDatas();
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.contain {
|
height: 100%;
|
display: flex;
|
flex-direction: column;
|
.table-wrap {
|
flex: 1;
|
position: relative;
|
.inner {
|
position: absolute;
|
left: 0;
|
top: 0;
|
right: 0;
|
bottom: 0;
|
}
|
}
|
.row-filter {
|
padding: 4px 4px 0 0;
|
display: flex;
|
.btn-grp {
|
margin-left: 0.4em;
|
.btn {
|
display: inline-block;
|
& + .btn {
|
margin-left: 4px;
|
}
|
}
|
}
|
:deep(.el-form) {
|
flex: 1;
|
display: flex;
|
.el-form-item {
|
margin-bottom: 4px;
|
.line,
|
.el-form-item__label {
|
color: #fff;
|
}
|
}
|
}
|
}
|
:deep(.el-pagination__total),
|
:deep(.el-pagination__jump) {
|
color: #fff;
|
}
|
}
|
</style>
|