|
@@ -15,32 +15,20 @@ const treeHeight = ref(window.innerHeight - 260 + 'px') //tree高度
|
|
|
const excelHeight = ref(window.innerHeight - 260 + 'px') //excel高度
|
|
|
/**excel 开始 */
|
|
|
const excelList = ref([])
|
|
|
+const excelCheckIds = ref([])
|
|
|
const funExcelChange = async (obj) => { //点击excel项时
|
|
|
- activeTab.value = '1'
|
|
|
- tableShowId.value = obj.id
|
|
|
- tableName.value = obj.name
|
|
|
- tableLoading.value = true
|
|
|
- const res = await request.get('/power/prepare/show', { params: { id: obj.id } })
|
|
|
- if(res.code === 200){
|
|
|
- tableColumn.value = res.data.title.map(o => {
|
|
|
- return {
|
|
|
- prop: o.key,
|
|
|
- label: o.des,
|
|
|
- width: o.des==='时间'? 100: 80,
|
|
|
- }
|
|
|
- })
|
|
|
- tableData.value = res.data.data
|
|
|
- tableLoading.value = false
|
|
|
- }else{
|
|
|
- tableLoading.value = false
|
|
|
- }
|
|
|
+ return false
|
|
|
+}
|
|
|
+const funExcelCheckChange = ({ checkArr, data }) => { //bug
|
|
|
+ excelCheckIds.value = checkArr
|
|
|
+ funSubmit() // check 后进行操作
|
|
|
}
|
|
|
/**tree 开始 */
|
|
|
const treeData = ref([])
|
|
|
const funRepeatMap = (arr) => {
|
|
|
return arr.map(o => {
|
|
|
if (o.children) {
|
|
|
- const findIndex = o.children.findIndex(p => !!p.type)
|
|
|
+ const findIndex = o.children.findIndex(p => !!p.path)
|
|
|
if (findIndex !== -1) {
|
|
|
o.childs = o.children
|
|
|
o.children = []
|
|
@@ -53,7 +41,7 @@ const funRepeatMap = (arr) => {
|
|
|
})
|
|
|
}
|
|
|
const funGetTree = async () => {
|
|
|
- const res = await request.get("/power/prepare/tree")
|
|
|
+ const res = await request.get("/allfilelist")
|
|
|
treeData.value = funRepeatMap(res.data)
|
|
|
excelList.value = []
|
|
|
}
|
|
@@ -61,15 +49,14 @@ const funCurrentChange = ({ current, currentNode }) => {
|
|
|
if (current.childs) {
|
|
|
excelList.value = current.childs.map(o => {
|
|
|
return {
|
|
|
- id: o.id,
|
|
|
+ id: o.path,
|
|
|
interval: o.interval,
|
|
|
path: o.path,
|
|
|
- prepareid: o.prepareid,
|
|
|
station: o.station,
|
|
|
time: o.time,
|
|
|
type: o.type,
|
|
|
windturbine: o.windturbine,
|
|
|
- name: o.path.substring(o.path.indexOf(o.station + '_') + (o.station + '_').length)
|
|
|
+ name: o.path
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -99,120 +86,106 @@ const funChartSelect = async (batch) => {
|
|
|
return false
|
|
|
}
|
|
|
/**submit */
|
|
|
-const funSubmit = async (params) => {
|
|
|
- activeTab.value = '2'
|
|
|
- tableShowId.value = 1
|
|
|
- tableName.value = ''
|
|
|
- tableData.value = []
|
|
|
- xAxisData.value = []
|
|
|
- seriesData.value = []
|
|
|
+const funSubmit = async () => {
|
|
|
+ activeTab.value = '1'
|
|
|
+ if (!excelCheckIds.value.length) {
|
|
|
+ ElMessage.error('请勾选要执行的项')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const params = {
|
|
|
+ filelist: excelCheckIds.value.join(',')
|
|
|
+ }
|
|
|
+ tableShowId.value = '1'
|
|
|
+ tableName.value = params.filelist
|
|
|
tableLoading.value = true
|
|
|
- const res = await request.get('/analysis/powertime', { params: {
|
|
|
- station: params.station,
|
|
|
- inverters: params.wtIds,
|
|
|
- startdate: params.st,
|
|
|
- enddate: params.et
|
|
|
- } })
|
|
|
- if(res.code === 200){
|
|
|
- tableColumn.value = res.data.title.map(o => {
|
|
|
+ const res = await request.get('/analysis/powertimefile', { params })
|
|
|
+ if(res.code !== 200){
|
|
|
+ tableLoading.value = false
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ tableColumn.value = res.data.title.map(o => {
|
|
|
return {
|
|
|
prop: o.key,
|
|
|
label: o.des,
|
|
|
width: o.des==='时间'? 100: 80,
|
|
|
}
|
|
|
})
|
|
|
- if(res.data.info?.length){
|
|
|
- tableData.value = res.data.info
|
|
|
+ const wtIds = excelCheckIds.value
|
|
|
+ const xAxis = []
|
|
|
+ const series = []
|
|
|
+ if(!res.data.data || !wtIds.length){ tableLoading.value = false; return false}
|
|
|
+ for(const index in wtIds){
|
|
|
const llgl = []
|
|
|
const sjgl = []
|
|
|
- res.data.info.forEach(o => {
|
|
|
- xAxisData.value.push(o.datetime)
|
|
|
+ for(const o of res.data.data[wtIds[index]]){
|
|
|
+ if(index === '0'){
|
|
|
+ xAxis.push(o.datetime)
|
|
|
+ }
|
|
|
+ tableData.value.push(o)
|
|
|
llgl.push(o.ideaP)
|
|
|
sjgl.push(o.actualP)
|
|
|
- })
|
|
|
- seriesData.value = [
|
|
|
+ }
|
|
|
+ series.push(
|
|
|
{
|
|
|
- name: "实际功率",
|
|
|
+ name: wtIds[index] + "\n实际功率",
|
|
|
type: "line",
|
|
|
symbol: "line", //设定为实心点
|
|
|
symbolSize: 0, //设定实心点的大小
|
|
|
smooth: false, //这个是把线变成曲线
|
|
|
data: sjgl,
|
|
|
xAxisIndex: 0,
|
|
|
- },
|
|
|
+ }
|
|
|
+ )
|
|
|
+ series.push(
|
|
|
{
|
|
|
- name: "理论功率",
|
|
|
+ name: wtIds[index] + "\n理论功率",
|
|
|
type: "line",
|
|
|
symbol: "line", //设定为实心点
|
|
|
symbolSize: 0, //设定实心点的大小
|
|
|
smooth: false, //这个是把线变成曲线
|
|
|
data: llgl,
|
|
|
xAxisIndex: 0,
|
|
|
- },
|
|
|
- ]
|
|
|
- }else{
|
|
|
- tableData.value = []
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
+ xAxisData.value = xAxis
|
|
|
+ seriesData.value = series
|
|
|
tableLoading.value = false
|
|
|
-
|
|
|
- }else{
|
|
|
- tableLoading.value = false
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // if (res.code === 200) {
|
|
|
- // if(res.data.sjgl?.length){
|
|
|
- // for(const wtObj of res.data.sjgl){
|
|
|
- // seriesData.value.push(
|
|
|
- // {
|
|
|
- // name: wtObj.obj.windturbine + "\n实际功率",
|
|
|
- // type: "line",
|
|
|
- // symbol: "line", //设定为实心点
|
|
|
- // symbolSize: 0, //设定实心点的大小
|
|
|
- // smooth: true, //这个是把线变成曲线
|
|
|
- // data: wtObj.sjgl || [],
|
|
|
- // xAxisIndex: 0,
|
|
|
- // },
|
|
|
- // )
|
|
|
- // wtData.value.push(wtObj.obj)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
}
|
|
|
/**created */
|
|
|
// funGetTree()
|
|
|
/**mounted */
|
|
|
onMounted(() => {
|
|
|
- tableHeight.value = window.innerHeight - 314 + 'px'
|
|
|
- excelHeight.value = window.innerHeight - 260 + 'px'
|
|
|
- treeHeight.value = window.innerHeight - 260 + 'px'
|
|
|
+ tableHeight.value = window.innerHeight - 214 + 'px'
|
|
|
+ excelHeight.value = window.innerHeight - 160 + 'px'
|
|
|
+ treeHeight.value = window.innerHeight - 160 + 'px'
|
|
|
window.addEventListener('resize', () => {
|
|
|
- tableHeight.value = window.innerHeight - 314 + 'px'
|
|
|
- excelHeight.value = window.innerHeight - 260 + 'px'
|
|
|
- treeHeight.value = window.innerHeight - 260 + 'px'
|
|
|
+ tableHeight.value = window.innerHeight - 214 + 'px'
|
|
|
+ excelHeight.value = window.innerHeight - 160 + 'px'
|
|
|
+ treeHeight.value = window.innerHeight - 160 + 'px'
|
|
|
})
|
|
|
})
|
|
|
/**activated */
|
|
|
onActivated(() => {
|
|
|
- // funGetTree()
|
|
|
+ funGetTree()
|
|
|
// funSubmit()
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
<div class="bg-white py-[10px] px-[10px] relative">
|
|
|
- <search-cop class="mb-[20px] shadow rounded-[6px] shadow-blue-500" @submit="funSubmit">
|
|
|
- </search-cop>
|
|
|
+ <!-- <search-cop class="mb-[20px] shadow rounded-[6px] shadow-blue-500" @submit="funSubmit">
|
|
|
+ </search-cop> -->
|
|
|
<div class="relative shadow rounded-[6px] shadow-blue-500 px-[10px] pt-[20px] pb-[10px]">
|
|
|
<div class="text-[14px] absolute top-[-7px] text-[#838383] left-[20px]">数据展示</div>
|
|
|
<el-row :gutter="10">
|
|
|
- <!-- <el-col :span="5">
|
|
|
+ <el-col :span="4">
|
|
|
<tree-cop :data="treeData" :height="treeHeight" @currentChange="funCurrentChange" @refresh="funGetTree">
|
|
|
</tree-cop>
|
|
|
</el-col>
|
|
|
- <el-col :span="3">
|
|
|
- <excel-cop :data="excelList" :height="excelHeight" @excelChange="funExcelChange"></excel-cop>
|
|
|
- </el-col> -->
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="4">
|
|
|
+ <excel-cop :data="excelList" :height="excelHeight" showCheckbox @excelChange="funExcelChange" @checkChange="funExcelCheckChange"></excel-cop>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="16">
|
|
|
<div class="px-[10px] shadow rounded-[6px] shadow-blue-500 ">
|
|
|
<el-tabs v-model="activeTab">
|
|
|
<el-tab-pane label="表格数据" name="1">
|
|
@@ -225,7 +198,7 @@ onActivated(() => {
|
|
|
:style="{ height: typeof tableHeight === 'string' ? tableHeight : tableHeight + 'px' }"
|
|
|
class="p-[10px]">
|
|
|
<CurrentScatterChart ref="chartRef" width="100%" :height="`calc( ${tableHeight} - 20px )`" :chartTitle="''"
|
|
|
- :xAxisData="xAxisData" :yAxisData="{ splitLine: { show: false } }" :seriesData="seriesData"
|
|
|
+ :xAxisData="xAxisData" :seriesData="seriesData"
|
|
|
:showLegend="true" :brushSelected="false" :dataSet="dataSet" @getSelected="funChartSelect" />
|
|
|
</div>
|
|
|
</el-tabs>
|