Pārlūkot izejas kodu

Merge branch 'main' of http://124.70.43.205:3000/xufenqi/PowerAnalysis into main

chenminghua 2 gadi atpakaļ
vecāks
revīzija
a8887d68f7

+ 3 - 3
src/pages/dataAnalysis/combine/components/current-scatter-chart.vue

@@ -102,11 +102,11 @@ export default {
         //     : "rgba(255,255,255,0.5)",
         //工具箱
         color: [
-            "#FF8700",
+            "#3D54BE",
             "rgb(255,0,0)",
-            "#e6b600d9",
+            "#d3d3d3",
             "#0098d9",
-            "#3D54BE",
+            "#FF8700",
             "#005eaa",
             "#cda819",
             "#32a487"

+ 6 - 2
src/pages/dataAnalysis/combine/index.vue

@@ -70,6 +70,7 @@ const funExcelChange = async (obj) => { //点击excel项时
 
 	if (chartResponse && chartResponse.code === 200) {
 		chartRes = chartResponse.data
+		avgObj.title = chartRes.obj.path.substring(chartRes.obj.path.indexOf(chartRes.obj.station + '_') + (chartRes.obj.station + '_').length).split('_')[0];
 		avgObj.cpavg = Number(chartRes.obj.cpavg).toFixed(2)
 		avgObj.frequency = Number(chartRes.obj.frequency).toFixed(2)
 		avgObj.pcratio = Number(chartRes.obj.pcratio).toFixed(2)
@@ -181,6 +182,7 @@ const funRepeatMap = (arr, type='prepare') => {
 const funGetTree = async () => {
 	const res = await request.get("/power/process/tree")
 	treeData.value = funRepeatMap(res.data)
+	excelList.value = []
 }
 const funCurrentChange = ({ current, currentNode }) => {
 	excelCheckboxShow.value = true
@@ -222,6 +224,7 @@ const processTreeData = ref([])
 const funGetProcessTree = async (flag = true) => { //flag控制是否获取tree的第一项 true为可获取
 	actTreeNode.value = null
 	const res = await request.get("/power/fitting/tree")
+	excelFitList.value = []
 	processTreeData.value = funRepeatMap(res.data, flag? 'process' : 'prepare') //flag控制对actTreeNode赋值
 	if(actTreeNode.value){
 		funProcessCurrentChange({current: actTreeNode.value, currentNode: null})
@@ -293,6 +296,7 @@ const funSubmit = async (query) => {
 }
 /**chart Data */
 const avgObj = reactive({ //平均cpz等
+	title: '',
 	cpavg: '',
 	frequency: '',
 	pcratio: ''
@@ -499,7 +503,7 @@ onActivated(() => {
 	<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-dialog v-model="wtDialog" draggable title="风机功率点位">
 			<el-tabs v-model="wtTab">
 				<el-tab-pane label="数据" name="table">
 					<el-table :data="wtData" row-key="id" :max-height="550">
@@ -547,7 +551,7 @@ onActivated(() => {
 							<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+'%'"
+								<CurrentScatterChart ref="chartRef" width="100%" height="calc( 100% - 20px )" :chartTitle="avgObj.title+ '&nbsp;&nbsp;' +'平均Cp值:'+avgObj.cpavg+'; 静风频率:'+avgObj.frequency+'%; 曲线偏差率:'+avgObj.pcratio+'%'"
 									:xAxisData="xAxisData" :yAxisData="{ splitLine: { show: false } }" :seriesData="seriesData"
 									:showLegend="true" :brushSelected="!isChartArea" :dataSet="dataSet" @getSelected="funChartSelect" />
 							</div>

+ 50 - 171
src/pages/dataAnalysis/lineAnalysis/index.vue

@@ -1,5 +1,4 @@
 <script setup name="prepare">
-import searchCop from './components/search.vue'
 import excelCop from '@/components/excel.vue'
 import treeCop from '@/components/tree.vue'
 import SubmitBtn from '@/components/SubmitBtn.vue'
@@ -12,130 +11,19 @@ import CurrentScatterChart from './components/current-scatter-chart.vue'
 // import tableRes from '@/data/table.json'
 // import areaDataRes from '@/data/areaData.json'
 /**配置参数 */
-const treeHeight = ref(window.innerHeight - 200 + 'px') //tree高度
-const excelHeight = ref(window.innerHeight - 200 + 'px') //excel高度
-const tableHeight = ref(window.innerHeight - 200 + 'px')
+const treeHeight = ref(window.innerHeight - 120 + 'px') //tree高度
+const excelHeight = ref(window.innerHeight - 120 + 'px') //excel高度
+const tableHeight = ref(window.innerHeight - 120 + 'px')
 /**excel 开始 */
 const excelCheckboxShow = ref(false)
 const excelCheckIds = ref([])
 const excelList = ref([])
 const funExcelChange = async (obj) => { //点击excel项时
 	return false
-	isChartArea.value = false
-	let res = null
-	let chartRes = {
-		scatterhs: [[]],
-		scatterls: [[]],
-		sjgl: [[]],
-		llgl: [[]],
-		cpz: [[]]
-	}
-	let poiRes = null
-	let chartResponse = null
-	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
-	}
-
-	// 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 && chartResponse.code === 200) {
-		chartRes = chartResponse.data
-		avgObj.cpavg = Number(chartRes.obj.cpavg).toFixed(2)
-		avgObj.frequency = Number(chartRes.obj.frequency).toFixed(2)
-		avgObj.pcratio = Number(chartRes.obj.pcratio).toFixed(2)
-		dataSet.value = JSON.stringify([
-			{
-				source: chartRes.wyd
-				// source: chartRes.scatterls
-			},
-			{
-				source: chartRes.yyd
-				// source: chartRes.scatterhs
-			}
-		])
-		const color = ["#1C99FF", "#FF8700", "#3D54BE", "#fa8c16", "#1DA0D7", "#DD5044"]
-		seriesData.value = [
-			{
-				name: "拟合功率",
-				type: "line",
-				symbol: "line", //设定为实心点
-				symbolSize: 0, //设定实心点的大小
-				smooth: true, //这个是把线变成曲线
-				data: chartRes.sjgl,
-				xAxisIndex: 0,
-			},
-			{
-				name: "保证功率",
-				type: "line",
-				symbol: "line", //设定为实心点
-				symbolSize: 0, //设定实心点的大小
-				smooth: true, //这个是把线变成曲线
-				data: chartRes.llgl,
-				xAxisIndex: 0,
-			},
-			{
-				type: 'effectScatter',
-				showEffectOn: "emphasis",
-				rippleEffect: {
-					scale: 1
-				},
-				name: '无用点',
-				symbolSize: (data) => {
-					return data.s ? data.s > 10 ? 10 : data.s : 4
-				},
-				datasetIndex: 0,
-				encode: {
-					x: 'x',
-					y: 'y'
-				},
-				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,
-				encode: {
-					x: 'x',
-					y: 'y'
-				},
-				xAxisIndex: 0,
-				yAxisIndex: 0,
-			},
-			{
-				name: "Cp值",
-				type: "line",
-				symbol: "line", //设定为实心点
-				symbolSize: 0, //设定实心点的大小
-				smooth: true, //这个是把线变成曲线
-				data: chartRes.cpz,
-				xAxisIndex: 0,
-				yAxisIndex: 1,
-			},
-		]
-	}
 }
 const funExcelCheckChange = ({ checkArr, data }) => {   //bug 
 	excelCheckIds.value = checkArr
+	funSubmit()
 }
 /**prepare tree 开始 */
 const treeData = ref([])
@@ -161,6 +49,7 @@ const funRepeatMap = (arr, type='fitting') => {
 const funGetTree = async () => {
 	const res = await request.get("/power/fitting/tree")
 	treeData.value = funRepeatMap(res.data)
+	excelList.value = []
 }
 const funCurrentChange = ({ current, currentNode }) => {
 	excelCheckboxShow.value = true
@@ -195,22 +84,21 @@ const funTreeCheckChange = ({ current, checkedNodes, checkedKeys, halfCheckedNod
 		}
 	}
 	excelCheckIds.value = checkIds
+	funSubmit()
 }
 
 /**search 开始 */
-const funSubmit = async (query) => {
+const funSubmit = async () => {
 	if (!excelCheckIds.value.length) {
 		ElMessage.error('请勾选要执行的项')
 		return false
 	}
 	const params = {
-		...query,
 		ids: excelCheckIds.value.join(',')
 	}
 	const res = await request.get('/power/fitting/line', { params: params })
 	if (res.code === 200) {
 		seriesData.value = []
-		console.log(res)
 		if(res.data.bzgl){
 			seriesData.value.push(
 				{
@@ -315,6 +203,9 @@ const funChartSelect = async (batch) => {
 }
 const funChartArea = () => {
 	if (seriesData.value?.length) {
+		// 获取数据后 展示dialog table 数据
+		wtDialog.value = true
+		wtData.value = []
 		if (!isChartArea.value) {
 			// 请求一下
 			seriesData.value[0] = {
@@ -422,13 +313,13 @@ const wtTab = ref('table')
 // funGetProcessTree()
 /**mounted */
 onMounted(() => {
-	tableHeight.value = window.innerHeight - 200 + 'px'
-	excelHeight.value = window.innerHeight - 200 + 'px'
-	treeHeight.value = window.innerHeight - 200 + 'px'
+	tableHeight.value = window.innerHeight - 120 + 'px'
+	excelHeight.value = window.innerHeight - 120 + 'px'
+	treeHeight.value = window.innerHeight - 120 + 'px'
 	window.addEventListener('resize', () => {
-		tableHeight.value = window.innerHeight - 200 + 'px'
-		excelHeight.value = window.innerHeight - 200 + 'px'
-		treeHeight.value = window.innerHeight - 200 + 'px'
+		tableHeight.value = window.innerHeight - 120 + 'px'
+		excelHeight.value = window.innerHeight - 120 + 'px'
+		treeHeight.value = window.innerHeight - 120 + 'px'
 	})
 	/**test */
 	// funExcelChange({
@@ -444,52 +335,40 @@ onActivated(() => {
 </script>
 <template>
   <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">
-          <el-table :data="wtData" row-key="id" :max-height="550">
-            <el-table-column property="wtId" align="center" label="风机" />
-            <el-table-column
-              property="time"
-              sortable
-              :width="160"
-              align="center"
-              label="时间"
-            />
-            <el-table-column
-              property="speed"
-              sortable
-              align="center"
-              label="风速(m/s)"
-            />
-            <el-table-column
-              property="power"
-              sortable
-              align="center"
-              label="功率(kw)"
-            />
-            <el-table-column
-              property="rr"
-              sortable
-              align="center"
-              label="转速"
-            />
-            <el-table-column
-              property="filter"
-              sortable
-              align="center"
-              label="是否有用点"
-            />
-          </el-table>
-        </el-tab-pane>
-        <el-tab-pane label="故障" name="problem" disabled> </el-tab-pane>
-        <el-tab-pane label="预警" name="warning" disabled> </el-tab-pane>
-      </el-tabs>
+    <el-dialog draggable v-model="wtDialog" title="曲线偏差率">
+			<el-table :data="wtData" row-key="id" :max-height="550">
+				<el-table-column property="wtId" align="center" label="风机" />
+				<el-table-column
+					property="speed"
+					sortable
+					align="center"
+					label="3~5m"
+				/>
+				<el-table-column
+					property="power"
+					sortable
+					align="center"
+					label="5~10m"
+				/>
+				<el-table-column
+					property="rr"
+					sortable
+					align="center"
+					label="10~12m"
+				/>
+				<el-table-column
+					property="filter"
+					sortable
+					align="center"
+					label="12~25m"
+				/>
+				<el-table-column
+					property="filter"
+					sortable
+					align="center"
+					label="3~25m"
+				/>
+			</el-table>
     </el-dialog>
     <div
       class="

+ 10 - 10
src/pages/dataAnalysis/rateAnalysis/chartTheme.json

@@ -12,10 +12,10 @@
 	"textStyle": {},
 	"title": {
 			"textStyle": {
-					"color": "#B3B3B3"
+					"color": "#b3b3b3"
 			},
 			"subtextStyle": {
-					"color": "#B3B3B3"
+					"color": "#b3b3b3"
 			}
 	},
 	"line": {
@@ -165,24 +165,24 @@
 			"axisLine": {
 					"show": true,
 					"lineStyle": {
-							"color": "#b3b3b386"
+							"color": "#b3b3b3"
 					}
 			},
 			"axisTick": {
 					"show": false,
 					"lineStyle": {
-							"color": "#b3b3b386"
+							"color": "#b3b3b3"
 					}
 			},
 			"axisLabel": {
 					"show": true,
-					"color": "#b3b3b386"
+					"color": "#b3b3b3"
 			},
 			"splitLine": {
 					"show": true,
 					"lineStyle": {
 							"color": [
-									"#b3b3b386"
+									"#b3b3b3"
 							]
 					}
 			},
@@ -200,25 +200,25 @@
 			"axisLine": {
 					"show": true,
 					"lineStyle": {
-							"color": "#b3b3b386"
+							"color": "#b3b3b3"
 					}
 			},
 			"axisTick": {
 					"show": false,
 					"lineStyle": {
-							"color": "#b3b3b386"
+							"color": "#b3b3b3"
 					}
 			},
 			"axisLabel": {
 					"show": true,
-					"color": "#b3b3b386",
+					"color": "#b3b3b3",
 					"fontSize": 10
 			},
 			"splitLine": {
 					"show": true,
 					"lineStyle": {
 							"color": [
-									"#b3b3b386"
+									"#b3b3b3"
 							]
 					}
 			},

+ 5 - 1
src/pages/dataAnalysis/rateAnalysis/components/chart.vue

@@ -54,7 +54,11 @@ const option = computed({
 			radiusAxis: {},
 			radar: props.isRadar?  [  //雷达图设定区域
 				{
-					indicator: props.xAxis.data || [],
+					indicator: props.xAxis.data.map(o => {
+						return {
+							name: o
+						}
+					}) || [],
 					center: ['60%','50%'],
 					radius: '70%',
 					splitLine: {

+ 55 - 1
src/pages/dataAnalysis/rateAnalysis/components/lineChart.vue

@@ -5,6 +5,7 @@ import { ref, toRaw, computed, onMounted, watch, nextTick } from 'vue';
 import * as echarts from 'echarts'
 const chartId = 'chart-' + util.newGUID(); //chartId
 const chartIns = ref(null)  //chart 实例
+const emits = defineEmits(['getSelected'])
 const props = defineProps({
 	xAxis: {
 		type: Object,
@@ -42,6 +43,11 @@ const props = defineProps({
 		type: String,
 		required: false
 	},
+	brush: {
+		type: Boolean,
+		required: false,
+		default: false
+	}
 })
 
 /**定义option */
@@ -60,10 +66,27 @@ const option = computed({
 				text: props.title || '',
 				subtext: props.subtext || '',
 				top: 6,
-				left: 15,
+				left: 30,
 			},
 			xAxis: props.xAxis || {},
 			yAxis: props.yAxis || {},
+			brush: {
+          seriesIndex: [1],
+          yAxisIndex: 0,
+          transformable: true,
+          throttleType: "debounce",
+          throttleDelay: 1000,
+          removeOnClick: true,
+          brushType: props.brush? "polygon" : false,
+          brushMode: "multiple",
+          brushStyle: {
+            borderWidth: 1,
+            borderColor: "#ff2424",
+          },
+        },
+			toolbox:{
+				show: props.brush,
+			},
 			tooltip: {
 				confine: true,
 				axisPointer: {
@@ -78,6 +101,7 @@ const option = computed({
 				itemWidth: 6,
 			},
 			grid: {
+				top: 80,
 				left: 40,
 				right: 40,
 				bottom: 40,
@@ -109,12 +133,42 @@ watch(() => option, (newVal, oldVal) => {
 		echartIns.setOption(toRaw(newVal.value))
 	}
 }, { deep: true })
+const funBrushChange = (flag) => {
+	const echartIns = toRaw(chartIns.value)
+		console.log(echartIns)
+	echartIns.dispatchAction({
+			type: "takeGlobalCursor",
+			// 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。
+			key: "brush",
+			brushOption: {
+				seriesIndex: [1],
+				yAxisIndex: 0,
+				transformable: true,
+				throttleType: "debounce",
+				throttleDelay: 1000,
+				removeOnClick: true,
+				brushType: flag? "polygon" : false,
+				brushMode: "multiple",
+				brushStyle: {
+					borderWidth: 1,
+					color: "rgba(255,36,36,0.2)",
+					borderColor: "#ff2424",
+				},
+			},
+		});
+	echartIns.off("brushSelected");
+	echartIns.on("brushSelected", (params) => {
+		emits("getSelected", params.batch || []);
+	});
+}
+watch(() => props.brush, (newVal, oldVal) => funBrushChange(newVal))
 
 onMounted(() => {
 	echarts.registerTheme('chartTheme', chartTheme)
 	const echartIns =	echarts.init(document.getElementById(chartId),'chartTheme') 
 	chartIns.value = echartIns
 	echartIns.setOption(option.value)
+	funBrushChange(props.brush)
 	window.addEventListener('resize', () => {
 		echartIns.resize()
 	})

+ 17 - 1
src/pages/dataAnalysis/rateAnalysis/components/scatterSingleChart.vue

@@ -26,6 +26,16 @@ const props = defineProps({
 		required: false,
 		default: '500px'
 	},
+	title: {
+		type: String,
+		required: false,
+		default: ''
+	},
+	subtext: {
+		type: String,
+		required: false,
+		default: ''
+	},
 	width: {
 		type: String,
 		required: false,
@@ -49,8 +59,14 @@ const option = computed({
 					);
 				}
 			},
+			title: {
+				text: props.title || '',
+				subtext: props.subtext || '',
+				top: 6,
+				left: 30,
+			},
 			grid: {
-				top: 20,
+				top: 40,
 				left: 2,
 				bottom: 10,
 				right: 20,

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 142 - 64
src/pages/dataAnalysis/rateAnalysis/index.vue


+ 1 - 0
src/pages/dataFilter/prepare/index.vue

@@ -48,6 +48,7 @@ const funRepeatMap = (arr) => {
 const funGetTree = async () => {
 	const res = await request.get("/power/prepare/tree")
 	treeData.value = funRepeatMap(res.data)
+	excelList.value = []
 }
 const funCurrentChange = ({ current, currentNode }) => {
 	if (current.childs) {

+ 2 - 0
src/pages/dataFilter/process/index.vue

@@ -58,6 +58,7 @@ const funRepeatMap = (arr) => {
 const funGetTree = async () => {
 	const res = await request.get("/power/prepare/tree")
 	treeData.value = funRepeatMap(res.data)
+	excelList.value = []
 }
 const funCurrentChange = ({ current, currentNode }) => {
 	excelCheckboxShow.value = true
@@ -99,6 +100,7 @@ const processTreeData = ref([])
 const funGetProcessTree = async () => {
 	const res = await request.get("/power/process/tree")
 	processTreeData.value = funRepeatMap(res.data)
+	excelList.value = []
 }
 const funProcessCurrentChange = ({ current, currentNode }) => {
 	excelCheckboxShow.value = false

+ 1 - 1
src/router/index.js

@@ -79,7 +79,7 @@ const routes = [{
                     path: '/dataAnalysis/rateAnalysis',
                     name: 'dataAnalysisRateAnalysis',
                     meta: {
-                        title: '风资源分析',
+                        title: '对风偏差分析',
                     },
                     component: () =>
                         import(