<script setup name="battCompare1">
|
import { ref, reactive, onMounted, computed, nextTick } from "vue";
|
import { storeToRefs } from "pinia";
|
import { Search, Plus } from "@element-plus/icons-vue";
|
import ycCard from "@/components/ycCard/index.vue";
|
import addEdit from "../datas/addEdit.vue";
|
import { ElMessage } from "element-plus";
|
import useElement from "@/hooks/useElement.js";
|
import { useUserStore } from '@/store/user';
|
|
import useStation from "@/hooks/useStationList.js";
|
const { provice, city, country, stationName,
|
proviceList, cityList, countryList, stationList,
|
} = useStation();
|
|
import { useRouter } from "vue-router";
|
const router = useRouter();
|
|
import { ExportFile } from '@/utils/exportFile.js';
|
|
|
import powerTypes from '@/utils/const/const_powerType.js';
|
import hrTypes from '@/utils/const/const_hrTestType.js';
|
import {
|
getBattPerformance,
|
getMonCapByUid,
|
getBatteryBrand,
|
} from "@/api/station";
|
|
const userStore = useUserStore();
|
const { uid, uname } = storeToRefs(userStore);
|
import moment from 'moment';
|
|
import formatSeconds from '@/utils/formatSeconds';
|
import {
|
toFixed,
|
digits,
|
} from '@/utils/toFixed';
|
|
import {
|
getBattCompare16,
|
} from "@/api/statistic.js";
|
|
const { $loading, $message, $confirm } = useElement();
|
|
|
const headers = [
|
{
|
prop: "stationName",
|
label: "站点名称",
|
width: "160",
|
},
|
{
|
prop: "devName",
|
label: "设备名称",
|
width: "80",
|
},
|
{
|
prop: "battgroupName",
|
label: "电池组名称",
|
width: "80",
|
},
|
{
|
prop: "product",
|
label: "电池品牌",
|
width: "100",
|
},
|
{
|
prop: "inuseTime",
|
label: "投运时间",
|
width: "100",
|
},
|
{
|
prop: "moncapstd",
|
label: "标准容量",
|
width: "100",
|
},
|
{
|
prop: "monvolstd",
|
label: "标称电压",
|
width: "100",
|
},
|
{
|
prop: "realCap",
|
label: "预估实际容量",
|
width: "80",
|
},
|
{
|
prop: "stopReason",
|
label: "停止原因",
|
width: "160",
|
},
|
{
|
prop: "precentCapStr",
|
label: "容量百分比",
|
width: "80",
|
},
|
{
|
prop: "capperformance",
|
label: "评分结果",
|
width: "80",
|
},
|
{
|
prop: "capperformance",
|
label: "电池性能",
|
width: "80",
|
},
|
];
|
|
const testType = ref('');
|
const hrTypeList = computed(() => {
|
return Object.keys(hrTypes).map(v => {
|
return {
|
value: v,
|
label: hrTypes[v],
|
};
|
});
|
});
|
|
|
const background = ref(true);
|
const disabled = ref(false);
|
const pageCurr = ref(1);
|
const pageSize = ref(10);
|
const total = ref(0);
|
const addEditVisible = ref(false);
|
const dialogTitle = ref("");
|
const currentAreaId = ref();
|
const currentAreaIds = ref([]);
|
const inuseStartTime = ref('');
|
const inuseEndTime = ref('');
|
|
const datas = reactive({
|
tableData: [],
|
rowData: {},
|
});
|
|
|
// 计算属性生成 picker-options(更简洁)
|
const startDisabledDate = (time) => inuseEndTime.value ? moment(inuseEndTime.value).isBefore(time) || moment().isBefore(time) : moment().isBefore(time);
|
|
const endDisabledDate = (time) => inuseStartTime.value ? moment(time).isBefore(inuseStartTime.value) || moment().isBefore(time) : moment().isBefore(time);
|
|
const performance = ref('');
|
const performanceList = ref([]);
|
|
function getPerformancList() {
|
getBattPerformance()
|
.then((res) => {
|
let { code, data, data2 } = res;
|
let list = [];
|
if (code && data) {
|
// console.log(data);
|
list = Object.keys(data2).map((key) => ({ value: key, label: data2[key] }));
|
}
|
performanceList.value = list;
|
})
|
.catch((err) => {
|
console.log(err);
|
});
|
}
|
|
const product = ref('');
|
const productList = ref([]);
|
|
function getProductList() {
|
getBatteryBrand().then((res) => {
|
let { code, data, data2 } = res;
|
let list = [];
|
if (code && data) {
|
list = data2;
|
}
|
productList.value = list;
|
});
|
}
|
|
const moncapstd = ref('');
|
const monCapList = ref([]);
|
|
// 获取标称容量
|
function getMonCapList() {
|
getMonCapByUid().then((res) => {
|
let { code, data, data2 } = res;
|
let list = [];
|
if (code && data) {
|
list = data2;
|
}
|
monCapList.value = list;
|
});
|
}
|
|
|
|
function getList() {
|
let loading = $loading();
|
let params = {
|
provice: provice.value || undefined,
|
city: city.value || undefined,
|
country: country.value || undefined,
|
stationName: stationName.value || undefined,
|
pageNum: pageCurr.value,
|
pageSize: pageSize.value,
|
|
performance: performance.value || undefined,
|
product: product.value || undefined,
|
inuseStartTime: inuseStartTime.value ? inuseStartTime.value + ' 00:00:00' : undefined,
|
inuseEndTime: inuseEndTime.value ? inuseEndTime.value + ' 23:59:59' : undefined,
|
};
|
|
getBattCompare16(params)
|
.then((res) => {
|
let { code, data, data2 } = res;
|
let list = [];
|
let _total = 0;
|
if (code && data) {
|
// console.log(data);
|
list = data2.list.map(v => ({
|
...v,
|
precentCapStr: toFixed(v.precentCap, digits.PREC) + '%',
|
}));
|
_total = data2.total;
|
}
|
loading.close();
|
// tableData.length = 0;
|
// tableData.push(...list);
|
datas.tableData = list;
|
total.value = _total;
|
})
|
.catch((err) => {
|
console.log(err);
|
loading.close();
|
});
|
}
|
|
// 展示数据数量
|
function handleSizeChange(val) {
|
pageSize.value = val;
|
getList();
|
}
|
// 翻页
|
function handleCurrentChange(val) {
|
pageCurr.value = val;
|
getList();
|
}
|
|
function filterChange() {
|
nextTick(() => {
|
pageCurr.value = 1;
|
getList();
|
});
|
}
|
|
function goRt (row) {
|
router.push({
|
path: '/datas/realtime',
|
query: {
|
stationId: row.stationId || undefined,
|
powerId: row.powerId || undefined,
|
devId: row.devId || undefined,
|
battgroupId: row.battgroupId || undefined,
|
pageFlag: Math.random(),
|
}
|
});
|
}
|
|
function goHis (row) {
|
router.push({
|
path: '/datas/history',
|
query: {
|
stationId: row.stationId || undefined,
|
powerId: row.powerId || undefined,
|
devId: row.devId || undefined,
|
battgroupId: row.battgroupId || undefined,
|
pageTab: 'his-real',
|
pageFlag: Math.random(),
|
}
|
});
|
}
|
|
function exportExcel() {
|
ExportFile(headers, datas.tableData, "蓄电池组对比分析--同一品牌同一时间");
|
}
|
|
onMounted(() => {
|
getPerformancList();
|
getProductList();
|
getMonCapList();
|
getList();
|
});
|
</script>
|
|
<template>
|
<div class="page-wrapper">
|
<!-- <div class="page-header">
|
</div> -->
|
<div class="page-content">
|
<yc-card is-full>
|
<div class="page-content-wrapper">
|
<div class="page-content-tools page-filter">
|
<div class="grid-container" :style="{'--counter': 6}">
|
<div class="grid-item">
|
<div class="label">省</div>
|
<div class="value">
|
<el-select
|
v-model="provice"
|
size="small"
|
clearable
|
@change="filterChange"
|
placeholder="请选择省"
|
>
|
<el-option
|
v-for="item in proviceList"
|
:key="'l0_' + item"
|
:label="item"
|
:value="item"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">市</div>
|
<div class="value">
|
<el-select
|
v-model="city"
|
size="small"
|
clearable
|
@change="filterChange"
|
placeholder="请选择市"
|
>
|
<el-option
|
v-for="item in cityList"
|
:key="'l1_' + item"
|
:label="item"
|
:value="item"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">区县</div>
|
<div class="value">
|
<el-select
|
v-model="country"
|
clearable
|
@change="filterChange"
|
size="small"
|
placeholder="请选择区县"
|
>
|
<el-option
|
v-for="item in countryList"
|
:key="'l2_' + item"
|
:label="item"
|
:value="item"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">站点</div>
|
<div class="value">
|
<el-select
|
v-model="stationName"
|
clearable
|
@change="filterChange"
|
size="small"
|
placeholder="请选择站点"
|
>
|
<el-option
|
v-for="item in stationList"
|
:key="'l3_' + item.stationId"
|
:label="item.stationName"
|
:value="item.stationName"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">电池品牌</div>
|
<div class="value">
|
<el-select
|
v-model="performance"
|
filterable
|
clearable
|
size="small"
|
@change="filterChange"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item, idx) in performanceList"
|
:key="'list7_' + idx"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">标称容量</div>
|
<div class="value">
|
<el-select
|
v-model="moncapstd"
|
filterable
|
clearable
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item, idx) in monCapList"
|
:key="'list11_' + idx"
|
:label="item"
|
:value="item"
|
/>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">电池性能</div>
|
<div class="value">
|
<el-select
|
v-model="product"
|
filterable
|
clearable
|
size="small"
|
@change="filterChange"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item, idx) in productList"
|
:key="'list6_' + idx"
|
:label="item"
|
:value="item"
|
/>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">投运时间段</div>
|
<div class="value" style="grid-column: span 7;">
|
<el-date-picker
|
v-model="inuseStartTime"
|
type="date"
|
size="small"
|
placeholder="选择日期"
|
format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
:disabled-date="startDisabledDate"
|
/>
|
-
|
<el-date-picker
|
v-model="inuseEndTime"
|
size="small"
|
type="date"
|
placeholder="选择日期"
|
format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
:disabled-date="endDisabledDate"
|
/>
|
</div>
|
</div>
|
<div class="grid-item">
|
<el-button type="primary" size="small" >设置权重</el-button>
|
</div>
|
</div>
|
</div>
|
<div class="page-content-table">
|
<div class="pos-rel">
|
<div class="pos-abs">
|
<el-table class="yc-table" stripe height="100%" size="small" :data="datas.tableData" style="width: 100%">
|
<el-table-column type="index" fixed="left" label="序号" width="60"></el-table-column>
|
<el-table-column v-for="header in headers" :key="header.prop" :prop="header.prop" :label="header.label"
|
:min-width="header.width" align="center">
|
<template #default="scope">{{ scope.row[header.prop] }}</template>
|
</el-table-column>
|
<el-table-column label="操作" fixed="right" width="240" align="center">
|
<template #default="scope">
|
<el-button type="warning" size="small" @click="goRt(scope.row)">实时监测</el-button>
|
<el-button type="primary" size="small" @click="goHis(scope.row)">历史数据</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
</div>
|
<div class="page-content-page">
|
<div class="page-tool">
|
<el-button type="primary" round size="small" @click="getList" :icon="Search">查询</el-button>
|
</div>
|
<div class="el-page-container">
|
<el-pagination v-model:current-page="pageCurr" v-model:page-size="pageSize"
|
:page-sizes="[20, 40, 60, 80, 100, 200, 300, 400]" size="small" :disabled="disabled"
|
:background="background" layout="total, sizes, prev, pager, next, jumper" :total="total"
|
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
</div>
|
<div class="page-tool">
|
<el-button type="primary" round size="small" @click="exportExcel">导出</el-button>
|
</div>
|
</div>
|
</div>
|
</yc-card>
|
</div>
|
<div class="page-footer"></div>
|
</div>
|
</template>
|
|
<style scoped lang="less">
|
.page-wrapper {
|
display: flex;
|
flex-direction: row;
|
// padding: 8px;
|
height: 100%;
|
|
.page-content {
|
flex: 1;
|
}
|
}
|
|
.page-content-wrapper {
|
display: flex;
|
flex-direction: column;
|
height: 100%;
|
|
.page-content-tools {
|
padding-bottom: 8px;
|
}
|
|
.page-content-table {
|
// border-top: 1px solid var(--border-light-color);
|
box-sizing: border-box;
|
flex: 1;
|
margin-left: 26px;
|
margin-right: 26px;
|
}
|
|
.page-content-page {
|
padding: 8px 8px 0 8px;
|
text-align: center;
|
|
.el-page-container {
|
display: inline-block;
|
padding: 0 16px;
|
}
|
|
.page-tool {
|
display: inline-block;
|
}
|
}
|
}
|
|
.hdw-card-container {
|
width: 240px;
|
padding-right: 8px;
|
height: 100%;
|
}
|
|
.pos-rel {
|
position: relative;
|
width: 100%;
|
height: 100%;
|
|
.pos-abs {
|
position: absolute;
|
top: 0;
|
bottom: 0;
|
left: 0;
|
right: 0;
|
width: 100%;
|
height: 100%;
|
}
|
}
|
|
.tools-filter {
|
display: inline-block;
|
font-size: 14px;
|
|
.tools-filter-item {
|
display: inline-block;
|
margin-right: 8px;
|
|
.filter-label {
|
display: inline-block;
|
}
|
|
.filter-content {
|
display: inline-block;
|
}
|
}
|
}
|
.max-width {
|
max-width: 200px;
|
}
|
</style>
|