|
@@ -1,23 +1,27 @@
|
|
|
-<script lang="ts" setup name="prepare">
|
|
|
+<script setup name="prepare">
|
|
|
import searchCop from './components/search.vue'
|
|
|
import excelCop from '@/components/excel.vue'
|
|
|
import treeCop from '@/components/tree.vue'
|
|
|
import tableCop from './components/table.vue'
|
|
|
-import { ref, nextTick, onActivated } from 'vue'
|
|
|
+import SubmitBtn from '@/components/SubmitBtn.vue'
|
|
|
+import { ref, nextTick, onActivated, onMounted, reactive } from 'vue'
|
|
|
import request from '@/api/axios.js'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import util from "@tools/util";
|
|
|
import CurrentScatterChart from './components/current-scatter-chart.vue'
|
|
|
+// import dotRes from '@/data/dot.json'
|
|
|
+// import tableRes from '@/data/table.json'
|
|
|
+// import areaDataRes from '@/data/areaData.json'
|
|
|
/**配置参数 */
|
|
|
-const treeHeight = '40vh' //tree高度
|
|
|
-const excelHeight = '40vh' //excel高度
|
|
|
-const tableHeight = '75vh'
|
|
|
+const treeHeight = ref('40vh') //tree高度
|
|
|
+const excelHeight = ref('40vh') //excel高度
|
|
|
+const tableHeight = ref('75vh')
|
|
|
/**excel 开始 */
|
|
|
const excelCheckboxShow = ref(false)
|
|
|
const excelType = ref('')
|
|
|
-const excelCheckIds = ref<string[]>([])
|
|
|
-const excelList = ref<{ id: string, name: string }[]>([])
|
|
|
-const funExcelChange = async (obj: any) => { //点击excel项时
|
|
|
+const excelCheckIds = ref([])
|
|
|
+const excelList = ref([])
|
|
|
+const funExcelChange = async (obj) => { //点击excel项时
|
|
|
activeTab.value = '1'
|
|
|
isChartArea.value = false
|
|
|
tableShowId.value = obj.id
|
|
@@ -32,6 +36,7 @@ const funExcelChange = async (obj: any) => { //点击excel项时
|
|
|
llgl: [[]],
|
|
|
cpz: [[]]
|
|
|
}
|
|
|
+ let poiRes = null
|
|
|
let chartResponse = null
|
|
|
tableLoading.value = true
|
|
|
if (obj.type === 'process') {
|
|
@@ -39,20 +44,35 @@ const funExcelChange = async (obj: any) => { //点击excel项时
|
|
|
} else if (obj.type === 'fitting') {
|
|
|
activeTab.value = '2'
|
|
|
res = await request.get('/power/fitting/show', { params: { id: obj.id } })
|
|
|
+ // res = tableRes
|
|
|
+ // chartResponse = dotRes
|
|
|
chartResponse = await request.get('/power/fitting/curve', { params: { id: obj.id, p: 1 } })
|
|
|
+ poiRes = await request.get('/power/fitting/curve/ratio', {params: {id: obj.id}})
|
|
|
+ // poiRes = areaDataRes
|
|
|
}
|
|
|
tableColumn.value = res.data.title.map(o => {
|
|
|
return {
|
|
|
prop: o.key,
|
|
|
+ width: o.des==='时间'? 100: 80,
|
|
|
label: o.des,
|
|
|
}
|
|
|
})
|
|
|
tableData.value = res.data.data
|
|
|
tableLoading.value = false
|
|
|
|
|
|
+ // markDot
|
|
|
+ if(poiRes && poiRes.code=== 200){
|
|
|
+ markDot.pcl5 = poiRes.data.pcl5
|
|
|
+ markDot.pcl10 = poiRes.data.pcl10
|
|
|
+ markDot.pcl12 = poiRes.data.pcl12
|
|
|
+ markDot.pcl25 = poiRes.data.pcl25
|
|
|
+ }
|
|
|
|
|
|
- if (chartResponse) {
|
|
|
+ if (chartResponse && chartResponse.code === 200) {
|
|
|
chartRes = chartResponse.data
|
|
|
+ avgObj.cpavg = chartRes.obj.cpavg?.toFixed(2)
|
|
|
+ avgObj.frequency = chartRes.obj.frequency?.toFixed(2)
|
|
|
+ avgObj.pcratio = chartRes.obj.pcratio?.toFixed(2)
|
|
|
dataSet.value = JSON.stringify([
|
|
|
{
|
|
|
source: chartRes.wyd
|
|
@@ -63,9 +83,10 @@ const funExcelChange = async (obj: any) => { //点击excel项时
|
|
|
// source: chartRes.scatterhs
|
|
|
}
|
|
|
])
|
|
|
- seriesData.value = <any>[
|
|
|
+ const color = ["#1C99FF", "#FF8700", "#3D54BE", "#fa8c16", "#1DA0D7", "#DD5044"]
|
|
|
+ seriesData.value = [
|
|
|
{
|
|
|
- name: "实际功率",
|
|
|
+ name: "拟合功率",
|
|
|
type: "line",
|
|
|
symbol: "line", //设定为实心点
|
|
|
symbolSize: 0, //设定实心点的大小
|
|
@@ -85,6 +106,9 @@ const funExcelChange = async (obj: any) => { //点击excel项时
|
|
|
{
|
|
|
type: 'effectScatter',
|
|
|
showEffectOn: "emphasis",
|
|
|
+ rippleEffect: {
|
|
|
+ scale: 1
|
|
|
+ },
|
|
|
name: '无用点',
|
|
|
symbolSize: (data) => {
|
|
|
return data.s ? data.s > 10 ? 10 : data.s : 4
|
|
@@ -94,19 +118,20 @@ const funExcelChange = async (obj: any) => { //点击excel项时
|
|
|
x: 'x',
|
|
|
y: 'y'
|
|
|
},
|
|
|
- animation: false,
|
|
|
xAxisIndex: 0,
|
|
|
yAxisIndex: 0,
|
|
|
},
|
|
|
{
|
|
|
type: 'effectScatter',
|
|
|
showEffectOn: "emphasis",
|
|
|
+ rippleEffect: {
|
|
|
+ scale: 1
|
|
|
+ },
|
|
|
name: '有用点',
|
|
|
symbolSize: (data) => {
|
|
|
return data.s ? data.s > 10 ? 10 : data.s : 4
|
|
|
},
|
|
|
datasetIndex: 1,
|
|
|
- animation: false,
|
|
|
encode: {
|
|
|
x: 'x',
|
|
|
y: 'y'
|
|
@@ -131,10 +156,10 @@ const funExcelCheckChange = ({ checkArr, data }) => { //bug
|
|
|
excelCheckIds.value = checkArr
|
|
|
}
|
|
|
/**excel fitData */
|
|
|
-const excelFitList = ref<{ id: string, name: string }[]>([])
|
|
|
+const excelFitList = ref([])
|
|
|
/**prepare tree 开始 */
|
|
|
const treeData = ref([])
|
|
|
-const funRepeatMap = (arr: any) => {
|
|
|
+const funRepeatMap = (arr) => {
|
|
|
return arr.map(o => {
|
|
|
if (o.children) {
|
|
|
const findIndex = o.children.findIndex(p => !!p.type)
|
|
@@ -246,9 +271,20 @@ const funSubmit = async (query) => {
|
|
|
}
|
|
|
}
|
|
|
/**chart Data */
|
|
|
+const avgObj = reactive({ //平均cpz等
|
|
|
+ cpavg: '',
|
|
|
+ frequency: '',
|
|
|
+ pcratio: ''
|
|
|
+})
|
|
|
+const markDot = reactive({ //3-5 point点等
|
|
|
+ pcl5: null,
|
|
|
+ pcl10: null,
|
|
|
+ pcl12: null,
|
|
|
+ pcl25: null
|
|
|
+})
|
|
|
const xAxisData = ref([])
|
|
|
const chartRef = ref() //chart 的ref
|
|
|
-const seriesData = ref<any>([])
|
|
|
+const seriesData = ref([])
|
|
|
const isChartArea = ref(false) // 用来控制图表是否区域划分
|
|
|
const dataSet = ref('')
|
|
|
const funChartSelect = async (batch) => {
|
|
@@ -309,6 +345,7 @@ const funChartSelect = async (batch) => {
|
|
|
const funChartArea = () => {
|
|
|
if (seriesData.value?.length) {
|
|
|
if (!isChartArea.value) {
|
|
|
+ // 请求一下
|
|
|
seriesData.value[0] = {
|
|
|
...seriesData.value[0],
|
|
|
markLine: {
|
|
@@ -357,7 +394,7 @@ const funChartArea = () => {
|
|
|
data: [
|
|
|
[
|
|
|
{
|
|
|
- name: '3~5m/s',
|
|
|
+ name: `3~5m 偏差率: ${markDot.pcl5}`,
|
|
|
xAxis: 3,
|
|
|
},
|
|
|
{
|
|
@@ -366,7 +403,7 @@ const funChartArea = () => {
|
|
|
],
|
|
|
[
|
|
|
{
|
|
|
- name: '5~10m/s',
|
|
|
+ name: `5~10m 偏差率: ${markDot.pcl10}`,
|
|
|
xAxis: 5,
|
|
|
},
|
|
|
{
|
|
@@ -375,7 +412,7 @@ const funChartArea = () => {
|
|
|
],
|
|
|
[
|
|
|
{
|
|
|
- name: '10~12m/s',
|
|
|
+ name: `10~12m 偏差率: ${markDot.pcl12}`,
|
|
|
xAxis: 10,
|
|
|
},
|
|
|
{
|
|
@@ -384,7 +421,7 @@ const funChartArea = () => {
|
|
|
],
|
|
|
[
|
|
|
{
|
|
|
- name: '12~25m/s',
|
|
|
+ name: `12~25m 偏差率: ${markDot.pcl25}`,
|
|
|
xAxis: 12,
|
|
|
},
|
|
|
{
|
|
@@ -392,14 +429,14 @@ const funChartArea = () => {
|
|
|
}
|
|
|
],
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
isChartArea.value = true
|
|
|
} else {
|
|
|
seriesData.value[0] = {
|
|
|
...seriesData.value[0],
|
|
|
markLine: null,
|
|
|
- markArea: null
|
|
|
+ markArea: null,
|
|
|
}
|
|
|
isChartArea.value = false
|
|
|
}
|
|
@@ -414,6 +451,23 @@ const activeTab = ref('1')
|
|
|
/**created */
|
|
|
funGetTree()
|
|
|
funGetProcessTree()
|
|
|
+/**mounted */
|
|
|
+onMounted(() => {
|
|
|
+ tableHeight.value = window.innerHeight - 254 + 'px'
|
|
|
+ excelHeight.value =(window.innerHeight - 210) / 2 + 'px'
|
|
|
+ treeHeight.value = (window.innerHeight - 210) / 2 + 'px'
|
|
|
+ window.addEventListener('resize', () => {
|
|
|
+ tableHeight.value = window.innerHeight - 254 + 'px'
|
|
|
+ excelHeight.value = (window.innerHeight - 210) / 2 + 'px'
|
|
|
+ treeHeight.value = (window.innerHeight - 210) / 2 + 'px'
|
|
|
+ })
|
|
|
+ /**test */
|
|
|
+ funExcelChange({
|
|
|
+ id: 1,
|
|
|
+ name: 'excel',
|
|
|
+ type: 'fitting',
|
|
|
+ })
|
|
|
+})
|
|
|
/**activated */
|
|
|
onActivated(() => {
|
|
|
funGetTree()
|
|
@@ -421,8 +475,9 @@ onActivated(() => {
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
- <div class="bg-white pb-[10px]">
|
|
|
- <search-cop @submit="funSubmit"></search-cop>
|
|
|
+ <div class="bg-white py-[10px] px-[10px]">
|
|
|
+ <search-cop class="mb-[20px] shadow rounded-[6px] shadow-blue-500" @submit="funSubmit">
|
|
|
+ </search-cop>
|
|
|
<el-dialog v-model="wtDialog" title="风机功率点位">
|
|
|
<el-tabs v-model="wtTab">
|
|
|
<el-tab-pane label="数据" name="table">
|
|
@@ -443,39 +498,42 @@ onActivated(() => {
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</el-dialog>
|
|
|
- <el-row :gutter="10">
|
|
|
- <el-col :span="5">
|
|
|
- <tree-cop :data="treeData" @checkChange="funTreeCheckChange" :show-checkbox="true" :height="treeHeight"
|
|
|
- @currentChange="funCurrentChange" @refresh="funGetTree"></tree-cop>
|
|
|
- <tree-cop class="mt-[10px]" :data="processTreeData" :height="treeHeight"
|
|
|
- @currentChange="funProcessCurrentChange" @refresh="funGetProcessTree"></tree-cop>
|
|
|
- </el-col>
|
|
|
- <el-col :span="3">
|
|
|
- <excel-cop :checkIds="excelCheckIds" :showCheckbox="excelCheckboxShow" :data="excelList" :height="excelHeight"
|
|
|
- @excelChange="funExcelChange" @checkChange="funExcelCheckChange"></excel-cop>
|
|
|
- <excel-cop class="mt-[10px]" :data="excelFitList" :height="excelHeight" @excelChange="funExcelChange">
|
|
|
- </excel-cop>
|
|
|
- </el-col>
|
|
|
- <el-col :span="16">
|
|
|
- <div class="px-[10px] shadow rounded-[6px] shadow-blue-500">
|
|
|
- <el-button class="absolute right-[16px] top-[4px] z-10" type="primary"
|
|
|
- v-if="activeTab === '2' && excelType === 'fitting'" @click="funChartArea">区域划分</el-button>
|
|
|
- <el-tabs v-model="activeTab">
|
|
|
- <el-tab-pane label="表格数据" name="1">
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="图表展示" name="2" v-if="excelType === 'fitting'">
|
|
|
- </el-tab-pane>
|
|
|
- <table-cop v-show="activeTab === '1'" :data="tableData" :loading="tableLoading" :column="tableColumn"
|
|
|
- :height="tableHeight" :tableId="tableShowId" :tableName="tableName"></table-cop>
|
|
|
- <div v-show="activeTab === '2'"
|
|
|
- :style="{ height: typeof tableHeight === 'string' ? tableHeight : tableHeight + 'px' }" class="p-[10px]">
|
|
|
- <CurrentScatterChart ref="chartRef" width="100%" height="100%" chartTitle="风速功率曲线图" :xAxisData="xAxisData"
|
|
|
- :yAxisData="{ splitLine: { show: false } }" :seriesData="seriesData" :showLegend="true"
|
|
|
- :brushSelected="!isChartArea" :dataSet="dataSet" @getSelected="funChartSelect" />
|
|
|
- </div>
|
|
|
- </el-tabs>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <div class="relative shadow rounded-[6px] shadow-blue-500 px-[10px] pt-[20px] pb-[10px]">
|
|
|
+ <div class="text-[14px] absolute top-[-7px] text-[#B3B3B3] left-[20px]">数据展示</div>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="5">
|
|
|
+ <tree-cop :data="treeData" @checkChange="funTreeCheckChange" :show-checkbox="true" :height="treeHeight"
|
|
|
+ @currentChange="funCurrentChange" @refresh="funGetTree"></tree-cop>
|
|
|
+ <tree-cop class="mt-[10px]" :data="processTreeData" :height="treeHeight"
|
|
|
+ @currentChange="funProcessCurrentChange" @refresh="funGetProcessTree"></tree-cop>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="3">
|
|
|
+ <excel-cop :checkIds="excelCheckIds" :showCheckbox="excelCheckboxShow" :data="excelList" :height="excelHeight"
|
|
|
+ @excelChange="funExcelChange" @checkChange="funExcelCheckChange"></excel-cop>
|
|
|
+ <excel-cop class="mt-[10px]" :data="excelFitList" :height="excelHeight" @excelChange="funExcelChange">
|
|
|
+ </excel-cop>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="16">
|
|
|
+ <div class="px-[10px] shadow rounded-[6px] shadow-blue-500 ">
|
|
|
+ <SubmitBtn class="absolute right-[16px] top-[6px] z-10" desc="区域划分" v-if="activeTab === '2' && excelType === 'fitting'" @click="funChartArea"></SubmitBtn>
|
|
|
+ <el-tabs v-model="activeTab">
|
|
|
+ <el-tab-pane label="表格数据" name="1">
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="图表展示" name="2" v-if="excelType === 'fitting'">
|
|
|
+ </el-tab-pane>
|
|
|
+ <table-cop v-show="activeTab === '1'" :data="tableData" :loading="tableLoading" :column="tableColumn"
|
|
|
+ :height="tableHeight" :tableId="tableShowId" :tableName="tableName"></table-cop>
|
|
|
+ <div v-show="activeTab === '2'"
|
|
|
+ :style="{ height: typeof tableHeight === 'string' ? tableHeight : tableHeight + 'px' }"
|
|
|
+ class="p-[10px]">
|
|
|
+ <CurrentScatterChart ref="chartRef" width="100%" height="calc( 100% - 20px )" :chartTitle="'平均Cp:'+avgObj.cpavg+'; 静风频率:'+avgObj.frequency+'; 曲线偏差率:'+avgObj.pcratio+'%'"
|
|
|
+ :xAxisData="xAxisData" :yAxisData="{ splitLine: { show: false } }" :seriesData="seriesData"
|
|
|
+ :showLegend="true" :brushSelected="!isChartArea" :dataSet="dataSet" @getSelected="funChartSelect" />
|
|
|
+ </div>
|
|
|
+ </el-tabs>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|