11.16 三个统计图提交

master
zz 1 week ago
parent 2269ec7fbd
commit 3d0c56f73c

@ -149,6 +149,18 @@ export const getTotalrevenue = (data) => {
data
})
}
export const getOutTotalrevenue = (data) => {
return request.post<any>({
url: '/cloud/statistics/outChargeTotal/revenue',
data
})
}
export const getOutChargeCountElectric = (data) => {
return request.post<any>({
url: '/cloud/statistics/total/outChargeCountElectric',
data
})
}
export const getTotalchargeCount = (data) => {
return request.post<any>({
@ -156,6 +168,12 @@ export const getTotalchargeCount = (data) => {
data
})
}
export const getTotalOutchargeCount = (data) => {
return request.post<any>({
url: '/cloud/statistics/total/outChargeCount',
data
})
}
export const getTotalchargeJfpgElec = (data) => {
return request.post<any>({

@ -107,7 +107,6 @@ export const StationInfoApi = {
getStationInfoList: async () => {
return await request.get({ url: `/cloud/station-info/list` })
},
// 查询电价模型
getBillingModelList: async (params: any) => {
return await request.get({ url: `/cloud/billing-model/list`,params })

@ -74,6 +74,10 @@ export interface ChargeUploadVO {
// 充电机数据上报 API
export const ChargeUploadApi = {
// 下发模型
deliveryModelUpload: async (data: ChargeUploadVO) => {
return await request.post({ url: `/cloud/electricity-price/sendToChargeElectricityPriceMode`, data })
},
// 查询充电机数据上报分页
getChargeUploadPage: async (params: any) => {
return await request.get({ url: `/cloud/charge-upload/page`, params })

@ -28,5 +28,9 @@ export const chargeCountApi = {
chargeCountInfo: async (data: chargeCountVO) => {
return await request.post({ url: `/cloud/home/chargeCount`, data })
},
// 站外充电次数信息
outChargeCountInfo: async (data: chargeCountVO) => {
return await request.post({ url: `/cloud/home/outChargeCount`, data })
},
}

@ -25,5 +25,12 @@ export const swapRevenueCountApi = {
swapRevenueCountInfo: async (data: swapRevenueCountVO) => {
return await request.post({ url: `/cloud/home/swapRevenueCount`, data })
},
//
outChargeCountInfo: async (data: swapRevenueCountVO) => {
return await request.post({ url: `/cloud/home/outChargeCount`, data })
},
outChargeRevenueCountInfo: async (data: swapRevenueCountVO) => {
return await request.post({ url: `/cloud/home/outChargeRevenueCount`, data })
},
}

@ -76,8 +76,11 @@
</template>
</el-table-column>
<el-table-column label="充电枪数量" align="center" prop="chargeGunCount" />
<el-table-column label="操作" align="center" width="160" fixed="right">
<el-table-column label="操作" align="center" width="250" fixed="right">
<template #default="scope">
<el-button link type="primary" @click="openModal(scope.row)">
下发模型
</el-button>
<el-button link type="primary" @click="openForm('update', scope.row.id)">
编辑
</el-button>
@ -100,7 +103,73 @@
<energyMeterForm ref="formRef" @success="getList" :stationinfoList="stationinfoList" />
<!-- 详情 -->
<energyMeterDetails ref="detailRef" />
<!-- 下发模型 -->
<el-dialog v-model="dialogVisible_binding" title="下发模型" width="800">
<div style="display: flex; flex-direction: column; justify-content: space-between">
<el-form
class="-mb-15px"
:model="bind_queryParams"
ref="bind_queryFormRef"
:inline="true"
label-width="100px"
>
<el-form-item label="电价模型名称" prop="name">
<el-input
v-model="bind_queryParams.name"
placeholder="请输入"
clearable
@keyup.enter="get_team_list"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="get_team_list"
><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button
>
<el-button @click="bind_resetQuery"
><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button
>
</el-form-item>
</el-form>
<!-- -->
<el-table
:data="binding_tableData"
border
highlight-current-row
style="width: 100%; margin-top: 15px"
max-height="500"
@current-change="selectionChange"
>
<el-table-column type="index" width="50" />
<!-- <el-table-column label="id" align="center" prop="id" /> -->
<el-table-column label="电价模型名称" align="center" prop="name" />
<!-- <el-table-column label="车队编码" align="center" prop="teamCode" />
<el-table-column label="车队名称" align="center" prop="teamName" />
<el-table-column label="负责人" align="center" prop="principal" />
<el-table-column label="联系方式" align="center" prop="contactWay" />
<el-table-column label="舍入模式" align="center" prop="roundingMode">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ROUNDINGMODE" :value="scope.row.roundingMode" />
</template>
</el-table-column> -->
</el-table>
<div>
<Pagination
:total="bind_total"
v-model:page="bind_queryParams.pageNo"
v-model:limit="bind_queryParams.pageSize"
@pagination="get_team_list"
/>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible_binding = false">取消</el-button>
<el-button type="primary" @click="submit_bind"> </el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
@ -109,7 +178,10 @@ import download from '@/utils/download'
import { ChargeUploadApi, ChargeUploadVO } from '@/api/system/equipmentManagement/chargerManagement'
import energyMeterForm from './energyMeterForm.vue'
import energyMeterDetails from './energyMeterDetails.vue'
import {
ElectricityPriceApi,
ElectricityPriceVO
} from '@/api/operationsManagement/electricityPriceModel'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
//
import { StationInfoApi, StationInfoVO } from '@/api/share/stationinfo'
@ -128,6 +200,26 @@ const { t } = useI18n() // 国际化
const detailRef = ref()
const loading = ref(true) //
const list = ref<ChargeUploadVO[]>([]) //
const dialogVisible_binding = ref(false) //
const binding_tableData = ref([]) //
const bind_total = ref(0)//
const bind_queryParams = reactive({//
pageNo: 1,
pageSize: 10,
operatorId: undefined,
name: undefined,
// teamCode: undefined,
// teamName: undefined,
// principal: undefined,
// contactWay: undefined,
// roundingMode: undefined,
// limit: undefined,
// createTime: [],
// openFlag: undefined,
})
const bind_queryFormRef = ref() //
//
const total = ref(0)
const queryParams = reactive({
@ -173,7 +265,7 @@ const queryParams = reactive({
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
const selectRow=ref({})
/** 查询列表 */
const getList = async () => {
loading.value = true
@ -186,6 +278,59 @@ const getList = async () => {
loading.value = false
}
}
//
const get_team_list = async () => {
try {
const data = await ElectricityPriceApi.getElectricityPricePage(bind_queryParams)
// let array = []
// data.list.map((item) => {
// if (item.teamId == null) {
// array.push(item)
// }
// })
// console.log(array, 'array')
// console.log(data, '')
binding_tableData.value = data.list
bind_total.value = data.total
} finally {
}
}
// /** */
const openModal=(row)=>{
selectRow.value=row
dialogVisible_binding.value=true
}
//
const currentRow_id = ref([])
const selectionChange = (rows ) => {
currentRow_id.value = rows
}
const submit_bind = async () => {
let params = {
id: currentRow_id.value.id,
epm:selectRow.value.epm,
stationNo:selectRow.value.stationNo
}
try {
const data = await ChargeUploadApi.deliveryModelUpload(params)
message.success('下发成功')
dialogVisible_binding.value = false
// getList()
get_team_list()
} finally {
}
}
//
const bind_resetQuery = () => {
bind_queryFormRef.value.resetFields()
get_team_list()
}
//
const stationinfoList = ref([])
const getStationList = async () => {
@ -257,5 +402,6 @@ const openDetail = (item:any) => {
onMounted(() => {
getList()
getStationList()
get_team_list()
})
</script>

@ -0,0 +1,268 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="100px"
>
<el-form-item label="统计时间" prop="btyCoresProduceDate">
<el-date-picker
v-model="btyCoresProduceDate"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="站点" prop="btyNo">
<el-select v-model="queryParams.stationNos" placeholder="请选择" multiple clearable>
<el-option
v-for="(item, index) in stationinfoList"
:key="index"
:label="item.stationName"
:value="item.stationNo"
/>
</el-select>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择时间类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.STATISTICAL_TIME_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getList"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- echarts -->
<ContentWrap>
<!-- <div id="powerChangingTimesStatistics" :style="{ width: '100%', height: '400px' }"></div> -->
<!-- 折线图 -->
<Echart :height="400" :options="eChartOptions" />
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading="loading"
:data="list2"
:stripe="true"
:show-overflow-tooltip="true"
:header-cell-style="{
backgroundColor: '#eff4fa'
}"
>
<el-table-column label="序号" type="index" align="center" width="80" />
<el-table-column label="换电站编码" align="center" prop="stationNo" />
<el-table-column label="换电站名称" align="center" prop="stationName" />
<el-table-column label="时间" align="center" prop="time" />
<!-- <el-table-column label="统计" align="center" prop="count" /> -->
<el-table-column label="换电营收(分)" align="center" prop="swapRevenue" />
<!-- <el-table-column label="充电营收" align="center" prop="chargeRevenue" /> -->
<!-- <el-table-column label="失败统计" align="center" prop="loseCount" /> -->
</el-table>
<!-- <Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/> -->
</ContentWrap>
</template>
<script setup lang="ts">
import { EChartsOption } from 'echarts'
import { StationInfoApi, StationInfoVO } from '@/api/share/stationinfo'
import { swapRevenueCountApi, swapRevenueCountVO } from '@/api/system/statisticsManagement/stationRevenueStatistics'
import * as TradeStatisticsApi from '@/api/mall/statistics/member'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
/** 电池基础信息 列表 */
defineOptions({ name: 'BatteryInfo' })
/** 详情操作 */
const loading = ref(false) //
const list2 = ref([])
//
const total = ref(0)
const queryParams = reactive({
type: 3,
stationNos: [],
startTime: null,
endTime: null
})
const queryFormRef = ref() //
const btyCoresProduceDate = ref([])
//
const getlist2 = async () => {
loading.value = true
try {
let params={...queryParams}
params.stationNo=queryParams.stationNos
const data = await swapRevenueCountApi.outChargeCountInfo(params)
list2.value = data
// console.log(list2.value,"zzzzzzzzzz")
} finally {
loading.value = false
}
}
//
const stationinfoList = ref([])
const getStationList = async () => {
try {
const data = await StationInfoApi.getStationInfoList()
// console.log(data, 'data')
stationinfoList.value = data
let array = []
for (let item of data) {
array.push(item.stationNo)
}
queryParams.stationNos = array
getList()
queryParams.stationNos = []
} finally {
}
}
const convertToTimestamp = (timeString) => {
// Date
const date = new Date(timeString)
//
if (isNaN(date.getTime())) {
throw new Error('无效的时间字符串')
}
//
return date.getTime()
}
const getList = async () => {
if (btyCoresProduceDate.value.length > 0) {
queryParams.startTime = convertToTimestamp(btyCoresProduceDate.value[0])
queryParams.endTime = convertToTimestamp(btyCoresProduceDate.value[1])
}
loading.value = true
try {
getlist2()
const data = await TradeStatisticsApi.getOutChargeCountElectric(queryParams)
// console.log(data, 'data')
eChartOptions.series = []
eChartOptions.legend.data = []
let x_data = []
let legend_data = []
let finall_array_success = new Array(queryParams.stationNos.length).fill([])
for (var i = 0; i < data.length; i++) {
x_data.push(data[i].xname)
let itme_array_success = []
for (var j = 0; j < data[i].list.length; j++) {
if (i == 0) {
legend_data.push(data[i].list[j].stationName)
}
itme_array_success.push(data[i].list[j].electricQuantityCount)
}
finall_array_success[i] = itme_array_success
}
finall_array_success = splitArrayBySubarrayLength(finall_array_success)
eChartOptions.legend.data = legend_data
eChartOptions.xAxis.data = x_data
for (let item in finall_array_success) {
eChartOptions.series.push({
name: legend_data[item],
type: 'bar',
smooth: true,
data: finall_array_success[item]
})
}
loading.value = false
} finally {
}
}
const splitArrayBySubarrayLength = (arr) => {
//
if (arr.some((subArr) => subArr.length !== arr[0].length)) {
throw new Error('Subarrays must have the same length.')
}
const length = arr[0].length
const result = Array.from({ length }, () => [])
arr.forEach((subArr) => {
subArr.forEach((item, index) => {
result[index].push(item)
})
})
return result
}
// ==========================
onMounted(() => {
getStationList()
})
const eChartOptions = reactive<EChartsOption>({
title: {
text: '站营收统计'
},
xAxis: {
type: 'category',
data: []
},
yAxis: {
type: 'value'
},
legend: {
data: [],
left: 'center'
},
series: [
// {
// data: data1,
// type: 'line',
// smooth: true,
// name: ''
// },
]
}) as EChartsOption
// ==========================
/** 重置按钮操作 */
const resetQuery = () => {
// queryFormRef.value.resetFields()
queryParams.type= 3
queryParams.stationNos=[]
btyCoresProduceDate.value=[]
queryParams.startTime=null
queryParams.endTime=null
getList()
}
</script>

@ -0,0 +1,269 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="100px"
>
<el-form-item label="统计时间" prop="btyCoresProduceDate">
<el-date-picker
v-model="btyCoresProduceDate"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="站点" prop="btyNo">
<el-select v-model="queryParams.stationNos" placeholder="请选择" multiple clearable>
<el-option
v-for="(item, index) in stationinfoList"
:key="index"
:label="item.stationName"
:value="item.stationNo"
/>
</el-select>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择时间类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.STATISTICAL_TIME_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getList"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- echarts -->
<ContentWrap>
<!-- <div id="powerChangingTimesStatistics" :style="{ width: '100%', height: '400px' }"></div> -->
<!-- 折线图 -->
<Echart :height="400" :options="eChartOptions" />
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading="loading"
:data="list2"
:stripe="true"
:show-overflow-tooltip="true"
:header-cell-style="{
backgroundColor: '#eff4fa'
}"
>
<el-table-column label="序号" type="index" align="center" width="80" />
<el-table-column label="换电站编码" align="center" prop="stationNo" />
<el-table-column label="换电站名称" align="center" prop="stationName" />
<el-table-column label="时间" align="center" prop="time" />
<!-- <el-table-column label="统计" align="center" prop="count" /> -->
<el-table-column label="换电营收(分)" align="center" prop="swapRevenue" />
<!-- <el-table-column label="充电营收" align="center" prop="chargeRevenue" /> -->
<!-- <el-table-column label="失败统计" align="center" prop="loseCount" /> -->
</el-table>
<!-- <Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/> -->
</ContentWrap>
</template>
<script setup lang="ts">
import { EChartsOption } from 'echarts'
import { StationInfoApi, StationInfoVO } from '@/api/share/stationinfo'
import { swapRevenueCountApi, swapRevenueCountVO } from '@/api/system/statisticsManagement/stationRevenueStatistics'
import * as TradeStatisticsApi from '@/api/mall/statistics/member'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
/** 电池基础信息 列表 */
defineOptions({ name: 'BatteryInfo' })
/** 详情操作 */
const loading = ref(false) //
const list2 = ref([])
//
const total = ref(0)
const queryParams = reactive({
type: 3,
stationNos: [],
startTime: null,
endTime: null
})
const queryFormRef = ref() //
const btyCoresProduceDate = ref([])
//
const getlist2 = async () => {
loading.value = true
try {
let params={...queryParams}
params.stationNo=queryParams.stationNos
const data = await swapRevenueCountApi.outChargeRevenueCountInfo(params)
list2.value = data
// console.log(list2.value,"zzzzzzzzzz")
} finally {
loading.value = false
}
}
//
const stationinfoList = ref([])
const getStationList = async () => {
try {
const data = await StationInfoApi.getStationInfoList()
// console.log(data, 'data')
stationinfoList.value = data
let array = []
for (let item of data) {
array.push(item.stationNo)
}
queryParams.stationNos = array
getList()
queryParams.stationNos = []
} finally {
}
}
const convertToTimestamp = (timeString) => {
// Date
const date = new Date(timeString)
//
if (isNaN(date.getTime())) {
throw new Error('无效的时间字符串')
}
//
return date.getTime()
}
const getList = async () => {
if (btyCoresProduceDate.value.length > 0) {
queryParams.startTime = convertToTimestamp(btyCoresProduceDate.value[0])
queryParams.endTime = convertToTimestamp(btyCoresProduceDate.value[1])
}
loading.value = true
try {
getlist2()
const data = await TradeStatisticsApi.getOutTotalrevenue(queryParams)
// console.log(data, 'data')
eChartOptions.series = []
eChartOptions.legend.data = []
let x_data = []
let legend_data = []
let finall_array_success = new Array(queryParams.stationNos.length).fill([])
for (var i = 0; i < data.length; i++) {
x_data.push(data[i].xname)
let itme_array_success = []
for (var j = 0; j < data[i].list.length; j++) {
if (i == 0) {
legend_data.push(data[i].list[j].stationName)
}
itme_array_success.push(data[i].list[j].swapRevenue)
}
finall_array_success[i] = itme_array_success
}
finall_array_success = splitArrayBySubarrayLength(finall_array_success)
eChartOptions.legend.data = legend_data
eChartOptions.xAxis.data = x_data
for (let item in finall_array_success) {
eChartOptions.series.push({
name: legend_data[item],
type: 'line',
smooth: true,
data: finall_array_success[item]
})
}
loading.value = false
} finally {
}
}
const splitArrayBySubarrayLength = (arr) => {
//
if (arr.some((subArr) => subArr.length !== arr[0].length)) {
throw new Error('Subarrays must have the same length.')
}
const length = arr[0].length
const result = Array.from({ length }, () => [])
arr.forEach((subArr) => {
subArr.forEach((item, index) => {
result[index].push(item)
})
})
return result
}
// ==========================
onMounted(() => {
getStationList()
})
const eChartOptions = reactive<EChartsOption>({
title: {
text: '站营收统计'
},
xAxis: {
type: 'category',
data: []
},
yAxis: {
type: 'value'
},
legend: {
data: [],
left: 'center'
},
series: [
// {
// data: data1,
// type: 'line',
// smooth: true,
// name: ''
// },
]
}) as EChartsOption
// ==========================
/** 重置按钮操作 */
const resetQuery = () => {
// queryFormRef.value.resetFields()
queryParams.type= 3
queryParams.stationNos=[]
btyCoresProduceDate.value=[]
queryParams.startTime=null
queryParams.endTime=null
getList()
}
</script>

@ -0,0 +1,274 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="100px"
>
<el-form-item label="统计时间" prop="btyCoresProduceDate">
<el-date-picker
v-model="btyCoresProduceDate"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="站点" prop="btyNo">
<el-select v-model="queryParams.stationNos" placeholder="请选择" multiple clearable>
<el-option
v-for="(item, index) in stationinfoList"
:key="index"
:label="item.stationName"
:value="item.stationNo"
/>
</el-select>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择时间类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.STATISTICAL_TIME_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getList"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- echarts -->
<ContentWrap>
<!-- <div id="powerChangingTimesStatistics" :style="{ width: '100%', height: '400px' }"></div> -->
<!-- 折线图 -->
<Echart :height="400" :options="eChartOptions" />
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading="loading"
:data="list2"
:stripe="true"
:show-overflow-tooltip="true"
:header-cell-style="{
backgroundColor: '#eff4fa'
}"
>
<el-table-column label="序号" type="index" align="center" width="80" />
<el-table-column label="换电站编码" align="center" prop="stationNo" />
<el-table-column label="换电站名称" align="center" prop="stationName" />
<el-table-column label="时间" align="center" prop="time" />
<!-- <el-table-column label="统计" align="center" prop="count" />
<el-table-column label="换电营收" align="center" prop="swapRevenue" />
<el-table-column label="充电营收" align="center" prop="chargeRevenue" />
<el-table-column label="失败统计" align="center" prop="loseCount" /> -->
<el-table-column label="充电次数" align="center" prop="chargeQuantity" />
<el-table-column label="充电时长(min)" align="center" prop="chargeTime" />
</el-table>
<!-- <Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/> -->
</ContentWrap>
</template>
<script setup lang="ts">
import { EChartsOption } from 'echarts'
import { StationInfoApi, StationInfoVO } from '@/api/share/stationinfo'
import { chargeCountApi, chargeCountVO } from '@/api/system/statisticsManagement/stationChargingTimesStatistics'
import * as TradeStatisticsApi from '@/api/mall/statistics/member'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
/** 电池基础信息 列表 */
defineOptions({ name: 'BatteryInfo' })
/** 详情操作 */
const loading = ref(false) //
//
const total = ref(0)
const list2 = ref([])
const queryParams = reactive({
type: 3,
stationNos: [],
startTime: null,
endTime: null
})
const queryFormRef = ref() //
const btyCoresProduceDate = ref([])
const convertToTimestamp = (timeString) => {
// Date
const date = new Date(timeString)
//
if (isNaN(date.getTime())) {
throw new Error('无效的时间字符串')
}
//
return date.getTime()
}
//
const getlist2 = async () => {
loading.value = true
try {
let params={...queryParams}
params.stationNo=queryParams.stationNos
const data = await chargeCountApi.outChargeCountInfo(params)
list2.value = data
// console.log(list2.value,"zzzzzzzzzz")
} finally {
loading.value = false
}
}
const getList = async () => {
if (btyCoresProduceDate.value.length > 0) {
queryParams.startTime = convertToTimestamp(btyCoresProduceDate.value[0])
queryParams.endTime = convertToTimestamp(btyCoresProduceDate.value[1])
}
loading.value = true
try {
getlist2()
const data = await TradeStatisticsApi.getTotalOutchargeCount(queryParams)
// console.log(data, 'data')
eChartOptions.series = []
eChartOptions.legend.data = []
let x_data = []
let legend_data = []
let finall_array_success = new Array(queryParams.stationNos.length).fill([])
for (var i = 0; i < data.length; i++) {
x_data.push(data[i].xname)
let itme_array_success = []
for (var j = 0; j < data[i].list.length; j++) {
if (i == 0) {
legend_data.push(data[i].list[j].stationName)
}
itme_array_success.push(data[i].list[j].outChargeCount)
}
finall_array_success[i] = itme_array_success
}
finall_array_success = splitArrayBySubarrayLength(finall_array_success)
eChartOptions.legend.data = legend_data
eChartOptions.xAxis.data = x_data
for (let item in finall_array_success) {
eChartOptions.series.push({
name: legend_data[item],
type: 'line',
smooth: true,
data: finall_array_success[item]
})
}
loading.value = false
} finally {
}
}
// ==========================
const splitArrayBySubarrayLength = (arr) => {
//
if (arr.some((subArr) => subArr.length !== arr[0].length)) {
throw new Error('Subarrays must have the same length.')
}
const length = arr[0].length
const result = Array.from({ length }, () => [])
arr.forEach((subArr) => {
subArr.forEach((item, index) => {
result[index].push(item)
})
})
return result
}
const stationinfoList = ref([])
const getStationList = async () => {
try {
const data = await StationInfoApi.getStationInfoList()
// console.log(data, 'data')
stationinfoList.value = data
let array = []
for (let item of data) {
array.push(item.stationNo)
}
queryParams.stationNos = array
getList()
queryParams.stationNos = []
} finally {
}
}
onMounted(() => {
getStationList()
})
const eChartOptions = reactive<EChartsOption>({
title: {
text: '站外充电次数统计'
},
xAxis: {
type: 'category',
data: []
},
yAxis: {
type: 'value'
},
legend: {
data: [],
left: 'center'
},
series: [
// {
// data: data1,
// type: 'line',
// smooth: true,
// name: ''
// }
]
}) as EChartsOption
// ==========================
/** 重置按钮操作 */
const resetQuery = () => {
// queryFormRef.value.resetFields()
}
queryParams.type= 3
queryParams.stationNos=[]
btyCoresProduceDate.value=[]
queryParams.startTime=null
queryParams.endTime=null
getList()
</script>
Loading…
Cancel
Save