<script setup name="nodisYear">
|
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 chartView from "./chartView.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 {
|
getMonCapByUid,
|
} 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 {
|
getDischr6Statistic,
|
} from "@/api/statistic.js";
|
|
const { $loading, $message, $confirm } = useElement();
|
|
|
const headers = [
|
{
|
prop: "stationName",
|
label: "站点名称",
|
width: "160",
|
},
|
{
|
prop: "battgroupName",
|
label: "电池组名称",
|
width: "80",
|
},
|
{
|
prop: "monvolstd",
|
label: "标准单体电压",
|
width: "100",
|
},
|
{
|
prop: "moncount",
|
label: "单体数目",
|
width: "100",
|
},
|
{
|
prop: "moncapstd",
|
label: "标称容量",
|
width: "100",
|
},
|
{
|
prop: "product",
|
label: "电池品牌",
|
width: "160",
|
},
|
{
|
prop: "errorNum",
|
label: "异常停止次数",
|
width: "160",
|
},
|
{
|
prop: "stopListStr",
|
label: "异常停止原因",
|
width: "180",
|
},
|
// {
|
// prop: "stopReason",
|
// label: "上一次放电数据",
|
// width: "100",
|
// },
|
];
|
|
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 testStartTime = ref('');
|
|
const testEndTime = ref('');
|
const chartVisible = ref(false);
|
|
const datas = reactive({
|
tableData: [],
|
rowData: {},
|
});
|
|
|
// 计算属性生成 picker-options(更简洁)
|
const startDisabledDate = (time) => testEndTime.value ? moment(testEndTime.value).isBefore(time) || moment().isBefore(time) : moment().isBefore(time);
|
|
const endDisabledDate = (time) => testStartTime.value ? moment(time).isBefore(testStartTime.value) || moment().isBefore(time) : moment().isBefore(time);
|
|
|
|
|
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;
|
});
|
}
|
|
const teamData = ref(null);
|
|
async 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,
|
|
testStartTime: testStartTime.value ? testStartTime.value + ' 00:00:00' : undefined,
|
testEndTime: testEndTime.value ? testEndTime.value + ' 23:59:59' : undefined,
|
};
|
|
let res = await getDischr6Statistic(params);
|
let { code, data, data2, data3 } = res;
|
let list = [];
|
let _total = 0;
|
let tData;
|
if (code && data) {
|
// console.log(data);
|
list = data2.list.map(v => ({
|
...v,
|
stopListStr: v.stopList.join('/') || '--',
|
}));
|
_total = data2.total;
|
tData = Object.keys(data3).map((key) => ({name: key, value: data3[key].nochargeNum}));
|
}
|
loading.close();
|
// tableData.length = 0;
|
// tableData.push(...list);
|
datas.tableData = list;
|
total.value = _total;
|
teamData.value = tData;
|
}
|
|
// 展示数据数量
|
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(async () => {
|
// getMonCapList();
|
await getList();
|
chartVisible.value = true;
|
});
|
</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="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" style="grid-column: span 7;">
|
<el-date-picker
|
v-model="testStartTime"
|
type="date"
|
size="small"
|
placeholder="选择日期"
|
format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
@change="filterChange"
|
:disabled-date="startDisabledDate"
|
/>
|
-
|
<el-date-picker
|
v-model="testEndTime"
|
size="small"
|
type="date"
|
placeholder="选择日期"
|
format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
@change="filterChange"
|
:disabled-date="endDisabledDate"
|
/>
|
</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="220" align="center">
|
<template #default="scope">
|
<el-button type="warning" size="small" @click="goRt(scope.row)">实时监控</el-button>
|
<el-button type="primary" size="small" v-if="scope.row.errorNum > 0" @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>
|
<el-button type="primary" round size="small" @click="chartVisible = true">查看统计图</el-button>
|
</div>
|
</div>
|
</div>
|
</yc-card>
|
</div>
|
<div class="page-footer">
|
</div>
|
<el-dialog v-model="chartVisible" title="统计图" width="500">
|
<chart-view :teamData="teamData"></chart-view>
|
</el-dialog>
|
</div>
|
</template>
|
|
<style scoped lang="less">
|
.page-wrapper {
|
display: flex;
|
flex-direction: row;
|
// padding: 8px;
|
height: 100%;
|
|
.page-content {
|
flex: 1;
|
}
|
.page-footer {
|
// margin-left: 10px;
|
// width: 380px;
|
}
|
}
|
|
.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>
|