Forráskód Böngészése

2022-12-08 update

1. 调整current-scatter-chart的height resize
2. 调整excel点击后, tableloading 在ajax失败后未取消的问题
moccus 2 éve
szülő
commit
cf8419ca07

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

@@ -78,12 +78,20 @@ export default {
       theme: 'light'
     };
   },
+  watch: {
+    height(){
+      if(this.chart){
+          this.chart.resize()
+      }
+    }
+  },
   methods: {
     resize() {},
     initChart() {
       const that = this;
       echarts.registerTheme('chartTheme', chartTheme)
       let myChart = echarts.init(document.getElementById(this.id), 'chartTheme');
+      that.chart = myChart
       //指定图表的配置项和数据
       const option = {
         //标题

+ 14 - 10
src/pages/dataAnalysis/combine/index.vue

@@ -47,15 +47,19 @@ const funExcelChange = async (obj) => { //点击excel项时
 		// chartResponse = dotRes
 		chartResponse = await request.get('/power/fitting/curve', { params: { id: obj.id, p: 1 } })
 	}
-	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
+	if(res.code === 200){
+		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
+	}else{
+		tableLoading.value = false
+	}
 
 	if (chartResponse && chartResponse.code === 200) {
 		chartRes = chartResponse.data
@@ -544,7 +548,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="avgObj.title+ '&nbsp;&nbsp;' +'平均Cp值:'+avgObj.cpavg+'; 静风频率:'+avgObj.frequency+'%; 曲线偏差率:'+avgObj.pcratio+'%'"
+								<CurrentScatterChart ref="chartRef" width="100%" :height="`calc( ${tableHeight} - 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>

+ 8 - 0
src/pages/dataAnalysis/lineAnalysis/components/current-scatter-chart.vue

@@ -78,12 +78,20 @@ export default {
       theme: 'light'
     };
   },
+  watch: {
+    height(){
+      if(this.chart){
+          this.chart.resize()
+      }
+    }
+  },
   methods: {
     resize() {},
     initChart() {
       const that = this;
       echarts.registerTheme('chartTheme', chartTheme)
       let myChart = echarts.init(document.getElementById(this.id), 'chartTheme');
+      that.chart = myChart
       //指定图表的配置项和数据
       const option = {
         //标题

+ 1 - 1
src/pages/dataAnalysis/lineAnalysis/index.vue

@@ -466,7 +466,7 @@ onActivated(() => {
               <CurrentScatterChart
                 ref="chartRef"
                 width="100%"
-                height="calc( 100% - 40px )"
+                :height="`calc( ${tableHeight} - 40px )`"
                 chartTitle=""
                 :xAxisData="xAxisData"
                 :yAxisData="{ splitLine: { show: false } }"

+ 13 - 9
src/pages/dataFilter/prepare/index.vue

@@ -18,15 +18,19 @@ const funExcelChange = async (obj) => { //点击excel项时
 	tableName.value = obj.name
 	tableLoading.value = true
 	const res = await request.get('/power/prepare/show', { params: { id: obj.id } })
-	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
+	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
+	}
 }
 /**tree 开始 */
 const treeData = ref([])

+ 13 - 9
src/pages/dataFilter/process/index.vue

@@ -25,15 +25,19 @@ const funExcelChange = async (obj) => { //点击excel项时
 	} else if (obj.type === 'process') {
 		res = await request.get('/power/process/show', { params: { id: obj.id } })
 	}
-	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
+	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
+	}
 }
 const funExcelCheckChange = ({ checkArr, data }) => {   //bug 
 	excelCheckIds.value = checkArr