<script setup name="powerGood">
|
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 {
|
getPwrCapperformance,
|
getVoltageLevel,
|
getPowerBrand,
|
getBattGroupBZ,
|
} 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 {
|
getPwr7Statistic,
|
} from "@/api/statistic.js";
|
|
const { $loading, $message, $confirm } = useElement();
|
|
const inuseYear = ref();
|
const pwrInuseYearList = [
|
{
|
value: -1,
|
label: '全部'
|
},
|
{
|
value: 3,
|
label: '3年内'
|
},
|
{
|
value: 5,
|
label: '5年内'
|
},
|
{
|
value: 1,
|
label: '5年以上'
|
},
|
]
|
|
|
const headers = [
|
{
|
prop: "stationName",
|
label: "站点名称",
|
width: "220",
|
},
|
{
|
prop: "powerName",
|
label: "电源名称",
|
width: "120",
|
},
|
{
|
prop: "company",
|
label: "品牌",
|
width: "100",
|
},
|
{
|
prop: "stationType",
|
label: "电压等级",
|
width: "100",
|
},
|
{
|
prop: "inuseTime",
|
label: "投运时间",
|
width: "140",
|
},
|
{
|
prop: "groupName",
|
label: "所属班组",
|
width: "100",
|
},
|
{
|
prop: "performanceName",
|
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 testStartDate = ref('');
|
const testEndDate = ref('');
|
const datas = reactive({
|
tableData: [],
|
rowData: {},
|
});
|
|
const performance = ref('');
|
const performanceList = ref([]);
|
|
function getPerformancList() {
|
getPwrCapperformance()
|
.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 company = ref('');
|
const companyList = ref([]);
|
async function getCompanyList() {
|
let res = await getPowerBrand();
|
let { code, data, data2 } = res;
|
let list = [];
|
if (code && data) {
|
list = data2;
|
}
|
companyList.value = list;
|
}
|
|
const stationType = ref('');
|
const stationTypeList = ref([]);
|
|
async function getStationTypeList() {
|
let res = await getVoltageLevel();
|
let { code, data, data2 } = res;
|
let list = [];
|
if (code && data) {
|
list = data2;
|
}
|
stationTypeList.value = list;
|
}
|
|
const groupName = ref('');
|
const groupNameList = ref([]);
|
|
async function getGroupList () {
|
let res = await getBattGroupBZ();
|
let { code, data, data2 } = res;
|
let list = [];
|
if (code && data) {
|
list = data2.map(v => ({ value: v.baojiGroupId, label: v.baojiGroupName }));
|
}
|
groupNameList.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,
|
|
inuseYear: inuseYear.value == -1 ? undefined : inuseYear.value,
|
performance: performance.value || undefined,
|
company: company.value || undefined,
|
stationType: stationType.value || undefined,
|
groupName: groupName.value || undefined,
|
};
|
|
getPwr7Statistic(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,
|
}));
|
_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();
|
});
|
}
|
|
// TODO 跳转到电源健康状态统计页面 后期修改
|
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 exportExcel() {
|
ExportFile(headers, datas.tableData, "优良电源数量统计");
|
}
|
|
onMounted(() => {
|
getPerformancList();
|
getCompanyList();
|
getStationTypeList();
|
getGroupList();
|
|
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': 10}">
|
<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="company"
|
filterable
|
clearable
|
size="small"
|
@change="filterChange"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item, idx) in companyList"
|
:key="'list4_' + idx"
|
:label="item"
|
:value="item"
|
/>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">电压等级</div>
|
<div class="value">
|
<el-select
|
v-model="stationType"
|
filterable
|
clearable
|
size="small"
|
@change="filterChange"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item, idx) in stationTypeList"
|
:key="'list8_' + idx"
|
:label="item"
|
:value="item"
|
/>
|
</el-select>
|
</div>
|
</div>
|
<div class="grid-item">
|
<div class="label">投运时间</div>
|
<div class="value">
|
<el-select
|
v-model="inuseYear"
|
clearable
|
size="small"
|
@change="filterChange"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item, idx) in pwrInuseYearList"
|
:key="'list9_' + 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="groupName"
|
filterable
|
clearable
|
size="small"
|
@change="filterChange"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item, idx) in groupNameList"
|
:key="'list6_' + 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="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>
|
</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>
|
</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>
|