Эх сурвалжийг харах

Merge branch 'master' of http://8.136.199.33:3000/eta_front/eta_front

hbchen 8 сар өмнө
parent
commit
f9bd0ff8c1

+ 2 - 0
src/views/chartRelevance_manage/components/chartCard.vue

@@ -125,6 +125,8 @@ export default {
       switch(data.ChartInfo.Source) {//1曲线 
         case 1:
           this.chartInfo = data.ChartInfo;
+          //初始化上下限
+          this.setLimitData(data.EdbInfoList)
           this.setDefaultChart(data.EdbInfoList);
           break
         case 3: //3相关性 

+ 83 - 4
src/views/dataEntry_manage/addChart.vue

@@ -410,7 +410,7 @@
 							</h2>
 
 							<Chart :options="options" :chartInfo="chartInfo" ref="chartRef"/>
-							<div class="range-cont left" v-if="leftIndex != -1">
+							<!-- <div class="range-cont left" v-if="leftIndex != -1">
 								<el-input
 									style="width: 60px; display: block"
 									size="mini"
@@ -442,7 +442,6 @@
 									v-model="tableData[rightIndex].MinData"
 								/>
 							</div>
-							<!-- 右2上下限设置 -->
 							<div class="range-cont rightTwo" v-if="rightTwoIndex != -1">
 								<el-input
 									style="width: 60px; display: block"
@@ -458,7 +457,65 @@
 									placeholder="下限"
 									v-model="tableData[rightTwoIndex].MinData"
 								/>
-							</div>
+							</div> -->
+							<!-- 需求:曲线图、堆积柱状图、组合图加入新指标时上下限自动调整 -->
+							<template v-if="![7,10,11].includes(chartInfo.ChartType)">
+								<div class="range-cont left" v-if="leftIndex !== -1">
+									<el-input
+										style="width: 60px; display: block"
+										size="mini"
+										type="number"
+										placeholder="上限"
+										v-model="chartLimit.max"
+										@change="changeLimit"
+									/>
+									<el-input
+										class="min-data-input"
+										size="mini"
+										type="number"
+										placeholder="下限"
+										v-model="chartLimit.min"
+										@change="changeLimit"
+									/>
+								</div>
+								<div class="range-cont right" v-if="rightIndex !== -1">
+									<el-input
+										style="width: 60px; display: block"
+										size="mini"
+										type="number"
+										placeholder="上限"
+										v-model="chartLimit.rightMax"
+										@change="changeLimit"
+									/>
+									<el-input
+										class="min-data-input"
+										size="mini"
+										type="number"
+										placeholder="下限"
+										v-model="chartLimit.rightMin"
+										@change="changeLimit"
+									/>
+								</div>
+								<!-- 右2上下限设置 -->
+								<div class="range-cont rightTwo" v-if="rightTwoIndex !== -1">
+									<el-input
+										style="width: 60px; display: block"
+										size="mini"
+										type="number"
+										placeholder="上限"
+										v-model="chartLimit.rightTwoMax"
+										@change="changeLimit"
+									/>
+									<el-input
+										class="min-data-input"
+										size="mini"
+										type="number"
+										placeholder="下限"
+										v-model="chartLimit.rightTwoMin"
+										@change="changeLimit"
+									/>
+								</div>
+							</template>
 
 							<!-- 后续新图专用上下限 和其他数据依赖不公用 柱形图 截面散点-->
 							<template v-if="[7,10,11].includes(chartInfo.ChartType)">	
@@ -717,7 +774,7 @@ export default {
 					}else {
 						//拼接标题
 						this.chartInfo.ChartName =  this.sameOptionType.includes(this.chartInfo.ChartType) ? newval.map((item,index) => index === newval.length-1 ? item.EdbName : `${item.EdbName}和`).join('') : `${newval[0].EdbName}季节性`;
-	
+						this.EdbAxisChange()
 						this.setAddChartDefault();
 						this.setChartOptionHandle(newval);
 					}
@@ -792,6 +849,13 @@ export default {
 							MinData: Number(item.MinData)
 						})
 					)
+					let hasLimitChange = false
+					//需检测上下限是否修改
+					if(![7,10,11].includes(this.chartInfo.ChartType)){
+						const limitSame= this.getLimitInfo()
+						hasLimitChange = !limitSame
+					}
+					
 					if(![10,11].includes(this.chartInfo.ChartType)){
 						//每个数据转换需要检测是否合法
 						for(let i=0;i<db_arr.length;i++){
@@ -850,6 +914,21 @@ export default {
 								EndDate: this.year_select === 5 ? this.select_date[1] : '',
 							} 
 						: typePrams
+					if(![7,10,11].includes(this.chartInfo.ChartType)){
+						const {
+							min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+						} = this.chartLimit
+						params = {
+							...params,
+							LeftMin:min+'',
+							LeftMax:max+'',
+							RightMin:rightMin+'',
+							RightMax:rightMax+'',
+							Right2Min:rightTwoMin+'',
+							Right2Max:rightTwoMax+'',
+							MinMaxSave:Number(hasLimitChange)
+						}
+					}
 					dataBaseInterface.chartAdd(params).then(res => {
 						if(res.Ret !== 200) return;
 							this.setChartImage(res.Data);

+ 85 - 5
src/views/dataEntry_manage/chartSetting.vue

@@ -382,7 +382,7 @@
 
                     <Chart :options="options" :chartInfo="chartInfo" ref="chartRef"/>
 
-                    <div class="range-cont left" v-if="leftIndex != -1">
+                   <!--  <div class="range-cont left" v-if="leftIndex != -1">
                       <el-input
                         style="width: 60px; display: block"
                         size="mini"
@@ -421,8 +421,6 @@
                         v-model="tableData[rightIndex].MinData"
                       />
                     </div>
-
-                    <!-- 右2上下限设置 -->
                     <div class="range-cont rightTwo" v-if="rightTwoIndex != -1">
                       <el-input
                         style="width: 60px; display: block"
@@ -440,7 +438,72 @@
                         :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
                         v-model="tableData[rightTwoIndex].MinData"
                       />
+                    </div> -->
+                    <template v-if="![7,10,11].includes(chartInfo.ChartType)">
+                        <div class="range-cont left" v-if="leftIndex != -1">
+                            <el-input
+                                style="width: 60px; display: block"
+                                size="mini"
+                                type="number"
+                                placeholder="上限"
+                                :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
+                                v-model="chartLimit.max"
+                                @change="changeLimit"
+                            />
+                            <el-input
+                                class="min-data-input"
+                                size="mini"
+                                type="number"
+                                placeholder="下限"
+                                :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
+                                v-model="chartLimit.min"
+                                @change="changeLimit"
+                            />
+                        </div>
+                    <div 
+                      class="range-cont right" 
+                      v-if="rightIndex != -1"
+                    >
+                      <el-input
+                        style="width: 60px; display: block"
+                        size="mini"
+                        type="number"
+                        placeholder="上限"
+                        :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
+                        v-model="chartLimit.rightMax"
+                        @change="changeLimit"
+                      />
+                      <el-input
+                        class="min-data-input"
+                        size="mini"
+                        type="number"
+                        placeholder="下限"
+                        :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
+                        v-model="chartLimit.rightMin"
+                        @change="changeLimit"
+                      />
                     </div>
+                    <div class="range-cont rightTwo" v-if="rightTwoIndex != -1">
+                      <el-input
+                        style="width: 60px; display: block"
+                        size="mini"
+                        type="number"
+                        placeholder="上限"
+                        :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
+                        v-model="chartLimit.rightTwoMax"
+                        @change="changeLimit"
+                      />
+                      <el-input
+                        class="min-data-input"
+                        size="mini"
+                        type="number"
+                        placeholder="下限"
+                        :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
+                        v-model="chartLimit.rightTwoMin"
+                        @change="changeLimit"
+                      />
+                    </div>
+                    </template>
 
                     <!-- 后续新图专用上下限 和其他数据依赖不公用 柱形图 截面散点-->
                     <template v-if="[7,10,11].includes(chartInfo.ChartType)">	
@@ -798,7 +861,6 @@ import {
   copyOtherOptions
 } from '@/utils/defaultOptions';
 import { chartSetMixin } from './mixins/chartPublic'
-
 import mPage from '@/components/mPage';
 import Chart from './components/chart';
 import chartDialog from './components/chartDialog';
@@ -1597,6 +1659,9 @@ export default {
 			this.setDefaultSourceFrom();
   
       this.tableData = res.Data.EdbInfoList;
+      //初始化上下限
+      this.setLimitData(this.tableData)
+        
       // 设置起始日期和最新日期
       this.setExtremumDate()
 
@@ -1854,7 +1919,22 @@ export default {
               EndDate: this.year_select === 5 ? this.select_date[1] : '',
             }
           : typeChartParam;
-
+        if(![7,10,11].includes(this.selected_chartType)){
+            const {
+                min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+            } = this.chartLimit
+            params = {
+                ...params,
+                LeftMin:min+'',
+                LeftMax:max+'',
+                RightMin:rightMin+'',
+                RightMax:rightMax+'',
+                Right2Min:rightTwoMin+'',
+                Right2Max:rightTwoMax+'',
+                //手动保存视为更改过上下限
+                MinMaxSave:1
+            }
+        }
         dataBaseInterface.chartSave(params).then((res) => {
           if (res.Ret === 200) {
             this.$message.success('保存成功');

+ 85 - 5
src/views/dataEntry_manage/editChart.vue

@@ -407,7 +407,7 @@
 								{{ chartInfo.ChartName }}
 							</h2>
 							<Chart :options="options" :chartInfo="chartInfo" ref="chartRef" />
-							<div class="range-cont left" v-if="leftIndex != -1">
+							<!-- <div class="range-cont left" v-if="leftIndex != -1">
 								<el-input
 									style="width: 60px; display: block"
 									size="mini"
@@ -439,7 +439,6 @@
 									v-model="tableData[rightIndex].MinData"
 								/>
 							</div>
-							<!-- 右2上下限设置 -->
 							<div class="range-cont rightTwo" v-if="rightTwoIndex != -1">
 								<el-input
 									style="width: 60px; display: block"
@@ -455,7 +454,65 @@
 									placeholder="下限"
 									v-model="tableData[rightTwoIndex].MinData"
 								/>
-							</div>
+							</div> -->
+							<!-- 需求:曲线图、堆积柱状图、组合图加入新指标时上下限自动调整 -->
+							<template v-if="![7,10,11].includes(chartInfo.ChartType)">
+								<div class="range-cont left" v-if="leftIndex !== -1">
+									<el-input
+										style="width: 60px; display: block"
+										size="mini"
+										type="number"
+										placeholder="上限"
+										v-model="chartLimit.max"
+										@change="changeLimit"
+									/>
+									<el-input
+										class="min-data-input"
+										size="mini"
+										type="number"
+										placeholder="下限"
+										v-model="chartLimit.min"
+										@change="changeLimit"
+									/>
+								</div>
+								<div class="range-cont right" v-if="rightIndex !== -1">
+									<el-input
+										style="width: 60px; display: block"
+										size="mini"
+										type="number"
+										placeholder="上限"
+										v-model="chartLimit.rightMax"
+										@change="changeLimit"
+									/>
+									<el-input
+										class="min-data-input"
+										size="mini"
+										type="number"
+										placeholder="下限"
+										v-model="chartLimit.rightMin"
+										@change="changeLimit"
+									/>
+								</div>
+								<!-- 右2上下限设置 -->
+								<div class="range-cont rightTwo" v-if="rightTwoIndex !== -1">
+									<el-input
+										style="width: 60px; display: block"
+										size="mini"
+										type="number"
+										placeholder="上限"
+										v-model="chartLimit.rightTwoMax"
+										@change="changeLimit"
+									/>
+									<el-input
+										class="min-data-input"
+										size="mini"
+										type="number"
+										placeholder="下限"
+										v-model="chartLimit.rightTwoMin"
+										@change="changeLimit"
+									/>
+								</div>
+							</template>
 
 							<!-- 后续新图专用上下限 和其他数据依赖不公用 柱形图 截面散点-->
 							<template v-if="[7,10,11].includes(chartInfo.ChartType)">	
@@ -669,7 +726,6 @@ import { dataBaseInterface } from '@/api/api.js';
 import { chartSetMixin } from './mixins/chartPublic';
 import {unitArr} from '@/utils/defaultOptions.js'
 import addOrEditMixn from './mixins/addOreditMixin';
-
 import Chart from './components/chart';
 import DateChooseDia from './components/DateChooseDia';
 import SaveChartOther from './components/SaveChartOther';
@@ -717,6 +773,7 @@ export default {
 						//雷达图
 						this.chartInfo.ChartType === 11 && this.$refs.BarOptRef && this.$refs.BarOptRef.getBarData();
 					}else {
+						this.EdbAxisChange()
 						this.setAddChartDefault();
 						newval.length && !this.chartInfo.WarnMsg && this.setChartOptionHandle(newval);
 					}
@@ -798,6 +855,8 @@ export default {
 					this.chartInfo.ChartType === 11 && this.initRadarData(res.Data);
 					
 					this.getThemeList();
+					//初始化上下限
+					this.setLimitData(this.tableData)
 
         });
 		},
@@ -892,6 +951,13 @@ export default {
 							MinData: Number(item.MinData)
 						})
 					)
+					
+					let hasLimitChange = Boolean(this.chartInfo.MinMaxSave)
+					//需检测上下限是否修改
+					if(![7,10,11].includes(this.chartInfo.ChartType)&&!this.chartInfo.MinMaxSave){
+						const limitSame= this.getLimitInfo()
+						hasLimitChange = !limitSame
+					}
 					if(![10,11].includes(this.chartInfo.ChartType)){
 						//每个数据转换需要检测是否合法
 						for(let i=0;i<db_arr.length;i++){
@@ -957,7 +1023,21 @@ export default {
 							height: 230,
 						}
 					});
-
+					if(![7,10,11].includes(this.chartInfo.ChartType)){
+						const {
+							min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+						} = this.chartLimit
+						params = {
+							...params,
+							LeftMin:min+'',
+							LeftMax:max+'',
+							RightMin:rightMin+'',
+							RightMax:rightMax+'',
+							Right2Min:rightTwoMin+'',
+							Right2Max:rightTwoMax+'',
+							MinMaxSave:Number(hasLimitChange)
+						}
+					}
 					dataBaseInterface.chartEdit(params).then(res => {
 						if(res.Ret !== 200) return;
 						

+ 82 - 3
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -82,6 +82,7 @@ export default {
 			sourceEditForm: {
 
 			},
+
 			updateData:[],
 			useUnit:''
 		}
@@ -153,6 +154,8 @@ export default {
 
 				//共用结构的类型切换可以直接画图
 				if(![7,10,11].includes(newval)) {
+					//初始化上下限
+					this.setLimitData(this.tableData)
 					//单指标允许切换到季节图需药重新请求数据
 					this.tableData.length===1 && this.selectTarget(this.tableData[0],'switch');
 					this.tableData.length > 1 && this.setChartOptionHandle(this.tableData);
@@ -314,6 +317,8 @@ export default {
 									text: sourceStr
 								});
 							}
+							//新增指标后,检测上下限变化,修改上下限
+							this.EdbAxisChange()
 
 							this.$nextTick(()=>{
 								// 等待 tableData的 监听里面的获取到 起始时间和最近日期
@@ -578,7 +583,14 @@ export default {
 			this.dateForm = {};
 			this.dateTip = '请选择时间段';
 			this.barDateList = [];
-      this.chartLimit = {};
+			this.chartLimit = {
+				min:'', //左轴上下限
+				max:'',
+				rightMin:'',//右轴上下限
+				rightMax:'',
+				rightTwoMin:'',//右二轴上下限
+				rightTwoMax:'',
+			};
       this.sectionScatterData = {};
 
 			this.$nextTick(()=>{
@@ -662,7 +674,8 @@ export default {
 			this.tableData.splice(index, 1);
 			this.updateData.splice(index, 1)
 			this.$message.success('删除成功')
-
+			//删除指标时,检测上下限,修改上下限
+			this.EdbAxisChange()
 			//添加图表时重置默认样式
 			this.$route.path==='/addchart' && this.resetChartEdbDefault();
 			
@@ -1036,6 +1049,72 @@ export default {
 				...JSON.parse(this.chartInfo.SourcesFrom),
 				isShow:this.chartInfo.SourcesFromVisable
 			})
-		}
+		},
+		/* 图表轴发生变化:增加/删除指标,改变指标左右轴*/
+		EdbAxisChange(){
+			//若用户没有修改过,则计算y轴的上下限
+			if(!this.chartInfo.MinMaxSave){
+				this.calcYAxislimit(this.tableData)
+			}else{
+				//若用户修改过,则检测轴的上下限是否为空,若为空,则需要计算对应轴的上下限
+				this.checkChartLimit(this.tableData)
+			}
+		},
+		//新增/编辑保存图表时-判断用户有没有手动更改过上下限
+		getLimitInfo(){
+			//散点图单独处理
+			if(this.chartInfo.ChartType===5){
+				if(this.tableData[1]){
+					const {min,max} = this.chartLimit
+					return Number(max)===Number(this.tableData[1].MaxData)
+					&& Number(min)===Number(this.tableData[1].MinData)
+				}
+				return false
+			}
+			const leftData = this.tableData.filter(i=>i.IsAxis===1).map(i=>[Number(i.MinData),Number(i.MaxData)])
+			const rightData = this.tableData.filter(i=>!i.IsAxis).map(i=>[Number(i.MinData),Number(i.MaxData)])
+			const rightTwoData = this.tableData.filter(i=>i.IsAxis===2).map(i=>[Number(i.MinData),Number(i.MaxData)])
+			let leftLimitSame=true,rightLimitSame=true,rightTwoLimitSame=true
+			const {
+				min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+			} = this.chartLimit
+			//若每个轴的最大值和最小值不一致,则认为是更改过
+			if(leftData.length){
+				const {Max,Min} = this.calcLimit(leftData.flat())
+				leftLimitSame = Max===Number(max)&&Min===Number(min)
+				console.table([{
+					'y轴': '左轴',
+					'设置最大值': max,
+					'设置最小值': min,
+					'指标最大值':Max,
+					'指标最小值':Min
+				}])
+			}
+			if(rightData.length){
+				const {Max,Min} = this.calcLimit(rightData.flat())
+				rightLimitSame = Max===Number(rightMax)&&Min===Number(rightMin)
+				console.table([{
+					'y轴': '右轴',
+					'设置最大值': rightMax,
+					'设置最小值': rightMin,
+					'指标最大值':Max,
+					'指标最小值':Min
+				}])
+			}
+			if(rightTwoData.length){
+				const {Max,Min} = this.calcLimit(rightTwoData.flat())
+				rightTwoLimitSame = Max===Number(rightTwoMax)&&Min===Number(rightTwoMin)
+				console.table([{
+					'y轴': '右二轴',
+					'设置最大值': rightTwoMax,
+					'设置最小值': rightTwoMin,
+					'指标最大值':Max,
+					'指标最小值':Min
+				}])
+			}
+			let limitSame = leftLimitSame&&rightLimitSame&&rightTwoLimitSame
+			console.log('是否修改过上下限?',!limitSame)
+			return limitSame
+		},
 	}
 }

+ 250 - 13
src/views/dataEntry_manage/mixins/chartPublic.js

@@ -38,7 +38,7 @@ const basicYAxis = {
 }
 /**备注一下 越多越乱
  * @params
- * Source 1 ; chartType 1曲线 2季节 3面积 4堆积柱 5散点 6组合 7柱形 8截面散点
+ * Source 1 ; chartType 1曲线 2季节 3面积 4堆积柱 5散点 6组合 7柱形 10截面散点 11雷达图
  * 2 商品价格
  * 3 相关性
  * 4 滚动相关性
@@ -158,7 +158,15 @@ export const chartSetMixin = {
       barXData: [],//柱形图的x轴
       barXIdList: [],//x轴id数组 用于切换英文遍历用
       barEdbData: [],//柱形图的表格数据 只用于取值
-      chartLimit: {},
+      chartLimit: {
+        min:'', //左轴上下限
+        max:'',
+        rightMin:'',//右轴上下限
+        rightMax:'',
+        rightTwoMin:'',//右二轴上下限
+        rightTwoMax:'',
+
+      },
 
       /* 商品价格曲线 本来逻辑分开写 但需求又得加入myeta和eta图库共存 还是写一块算了 */
       commodityChartData: [],
@@ -567,7 +575,14 @@ export const chartSetMixin = {
         this.leftIndex = -1;
         this.rightIndex = -1;
         this.rightTwoIndex = -1;
-        this.chartLimit = {};
+        this.chartLimit = {
+            min:'', //左轴上下限
+            max:'',
+            rightMin:'',//右轴上下限
+            rightMax:'',
+            rightTwoMin:'',//右二轴上下限
+            rightTwoMax:'',
+        };
       }else {
         this.leftIndex = newval.findIndex((item) => item.IsAxis===1);
         this.rightIndex = newval.findIndex((item) => !item.IsAxis);
@@ -588,7 +603,31 @@ export const chartSetMixin = {
         let sameSideIndex = chartData.findIndex(
           (i) => i.IsAxis === item.IsAxis
         );
-
+        
+        //获取对应轴的上下限
+        //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
+        const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
+        //非ETA图库图表也不设置自定义上下限,相关性和统计特征也会用到曲线图
+        //若chartInfo.Source为1,需在之前调用setLimitData
+        const isETASource = this.chartInfo.Source===1
+        let minLimit = 0,maxLimit = 0
+        if(useTableLimit||!isETASource){
+            minLimit = newval[sameSideIndex].MinData
+            maxLimit = newval[sameSideIndex].MaxData
+        }
+        if(!useTableLimit&&isETASource){
+            const limitMap = {
+                0:['rightMin','rightMax'],
+                1:['min','max'],
+                2:['rightTwoMin','rightTwoMax']
+            }
+            if(limitMap[item.IsAxis]){
+                minLimit = this.chartLimit[`${limitMap[item.IsAxis][0]}`]||0
+                maxLimit = this.chartLimit[`${limitMap[item.IsAxis][1]}`]||0
+            }
+        }
+        
+        
         //y轴
         const textZh = item.ConvertUnit||item.Unit
         const textEn = item.ConvertEnUnit||item.UnitEn||item.ConvertUnit||item.Unit
@@ -621,8 +660,8 @@ export const chartSetMixin = {
           },
           opposite: [0,2].includes(item.IsAxis),
           reversed: item.IsOrder,
-          min: Number(item.MinData),
-          max: Number(item.MaxData),
+          min: Number(minLimit),
+          max: Number(maxLimit),
           tickWidth: 1,
           visible: sameSideIndex === index,
           plotBands: this.setAxisPlotAreas(item.IsAxis),
@@ -768,6 +807,26 @@ export const chartSetMixin = {
         ? -1
         : newval.findIndex((item) => item.IsAxis===2);
 
+
+        //获取对应轴的上下限
+        //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
+        const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
+        let minLimit = 0,maxLimit = 0
+        if(useTableLimit){
+            minLimit = chartData[sameSideIndex].MinData
+            maxLimit = chartData[sameSideIndex].MaxData
+        }else{
+            const limitMap = {
+                0:['rightMin','rightMax'],
+                1:['min','max'],
+                2:['rightTwoMin','rightTwoMax']
+            }
+            if(limitMap[item.IsAxis]){
+                minLimit = this.chartLimit[`${limitMap[item.IsAxis][0]}`]||0
+                maxLimit = this.chartLimit[`${limitMap[item.IsAxis][1]}`]||0
+            }
+        }
+        
         //y轴
         const textZh = item.ConvertUnit||item.Unit
         const textEn = item.ConvertEnUnit||item.UnitEn||item.ConvertUnit||item.Unit
@@ -800,8 +859,8 @@ export const chartSetMixin = {
           },
           opposite: [0,2].includes(item.IsAxis),
           reversed: item.IsOrder,
-          min: Number(chartData[sameSideIndex].MinData),
-          max: Number(chartData[sameSideIndex].MaxData),
+          min: Number(minLimit),
+          max: Number(maxLimit),
           tickWidth: 1,
           visible: serie_yIndex === index && sameSideIndex ===index,
           plotBands: this.setAxisPlotAreas(item.IsAxis),
@@ -898,6 +957,18 @@ export const chartSetMixin = {
       let seasonYdata = [],
         seasonData = [];
 
+        //获取对应轴的上下限
+        //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
+        const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
+        let minLimit = 0,maxLimit = 0
+        if(useTableLimit){
+            minLimit = chartData.MinData
+            maxLimit = chartData.MaxData
+        }else{
+            minLimit = this.chartLimit.min||0
+            maxLimit = this.chartLimit.max||0
+        }
+
       //数据列
       for (let j of chartDataHandle) {
         //预测指标配置
@@ -950,8 +1021,8 @@ export const chartSetMixin = {
           textAlign: 'left',
           reserveSpace: false
         },
-        max: Number(chartData.MaxData),
-        min: Number(chartData.MinData),
+        max: Number(maxLimit),
+        min: Number(minLimit),
         plotBands: this.setAxisPlotAreas(1),
         plotLines: this.setAxisPlotLines(1)
       }];
@@ -1115,6 +1186,18 @@ export const chartSetMixin = {
       } */
 
 
+      //获取对应轴的上下限
+        //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
+        const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
+        let minLimit = 0,maxLimit = 0
+        if(useTableLimit){
+            minLimit = Math.min(...real_data.map(_ => _.y));
+            maxLimit = Math.max(...real_data.map(_ => _.y));
+        }else{
+            minLimit = this.chartLimit.min||0
+            maxLimit = this.chartLimit.max||0
+        }
+
       const { IsOrder,ChartColor } = newval[0];
       //y轴
       const textYZh = newval[1].ConvertUnit||newval[1].Unit
@@ -1148,8 +1231,8 @@ export const chartSetMixin = {
         },
         opposite: false,
         reversed: IsOrder,
-        min: Number(newval[1].MinData),
-        max: Number(newval[1].MaxData),
+        min: Number(minLimit),
+        max: Number(maxLimit),
         tickWidth: 1,
         plotBands: this.setAxisPlotAreas(1),
         plotLines: this.setAxisPlotLines(1)
@@ -1215,6 +1298,9 @@ export const chartSetMixin = {
       x轴为指标名称的柱形图 以日期作为series
     */
     setBarChart() {
+      this.leftIndex = -1;
+      this.rightIndex = -1;
+      this.rightTwoIndex = -1;
       let seriesData = [];
       const data = _.cloneDeep(this.barDateList);
 
@@ -2489,6 +2575,12 @@ export const chartSetMixin = {
     changeLimit() {
       //source1 eta图库的类型对应
       const typeMap = {
+        1: this.setDefaultChart,
+        2: this.setSeasonChart,
+        3: this.setStackOrCombinChart,
+        4: this.setStackOrCombinChart,
+        5: this.setScatterChart,
+        6: this.setStackOrCombinChart,
         7: this.setBarChart,
         10: this.setSectionScatterChart,
         11: this.setRadarChart
@@ -2500,7 +2592,13 @@ export const chartSetMixin = {
         // 3:
       }
       if(this.chartInfo.Source === 1) {
-        typeMap[this.chartInfo.ChartType]()
+        if([7,10,11].includes(this.chartInfo.ChartType)){
+            typeMap[this.chartInfo.ChartType]()
+        }else{
+            this.setAddChartDefault&&this.setAddChartDefault();
+            typeMap[this.chartInfo.ChartType](this.tableData)
+        }
+        
       }else {
         sourceMap[this.chartInfo.Source]();
       }
@@ -2632,5 +2730,144 @@ export const chartSetMixin = {
 				});
 			}
 		},
+    /* ----自定义上下限相关--- */
+        /* 计算y轴上下限 */
+        calcYAxislimit(tableData=[]) {
+            //散点图单独处理
+            if(this.chartInfo.ChartType===5){
+                if(tableData[1]){
+                    this.chartLimit.min = tableData[1].MinData
+                    this.chartLimit.max = tableData[1].MaxData
+                }
+                return 
+            }
+            //分组
+            const leftData = tableData.filter(i => i.IsAxis === 1).map(i => [Number(i.MinData), Number(i.MaxData)])
+            const rightData = tableData.filter(i => !i.IsAxis).map(i => [Number(i.MinData), Number(i.MaxData)])
+            const rightTwoData = tableData.filter(i => i.IsAxis === 2).map(i => [Number(i.MinData), Number(i.MaxData)])
+            //计算最大最小值
+            if (leftData.length) {
+                const {
+                    Max,
+                    Min
+                } = this.calcLimit(leftData.flat())
+                this.chartLimit.min=Min
+                this.chartLimit.max=Max
+            } else {
+                this.leftIndex = -1
+                this.chartLimit.min=0
+                this.chartLimit.max=0
+            }
+            if (rightData.length) {
+                const {
+                    Max,
+                    Min
+                } = this.calcLimit(rightData.flat())
+                this.chartLimit.rightMin = Min
+                this.chartLimit.rightMax = Max
+            } else {
+                this.rightIndex = -1
+                this.chartLimit.rightMin = 0
+                this.chartLimit.rightMax = 0
+            }
+            if (rightTwoData.length) {
+                const {
+                    Max,
+                    Min
+                } = this.calcLimit(rightTwoData.flat())
+                this.chartLimit.rightTwoMin = Min
+                this.chartLimit.rightTwoMax = Max
+            } else {
+                this.rightTwoIndex = -1
+                this.chartLimit.rightTwoMin = 0
+                this.chartLimit.rightTwoMax = 0
+            }
+            console.table([{
+                    'y轴': '左轴',
+                    '最大值': this.chartLimit.max,
+                    '最小值': this.chartLimit.min
+                },
+                {
+                    'y轴': '右轴',
+                    '最大值': this.chartLimit.rightMax,
+                    '最小值': this.chartLimit.rightMin
+                },
+                {
+                    'y轴': '右二轴',
+                    '最大值': this.chartLimit.rightTwoMax,
+                    '最小值': this.chartLimit.rightTwoMin
+                }
+            ])
+        },
+        calcLimit(arr) {
+            return {
+                Max: Math.max(...arr),
+                Min: Math.min(...arr)
+            }
+        },
+        //图表详情-设置图表上下限
+        setLimitData(tableData=[]){
+            const {
+                //左右轴极值字段 
+                LeftMin=0,LeftMax=0,
+                RightMin=0,RightMax=0,
+                Right2Min=0,Right2Max=0,
+                MinMaxSave
+            } = this.chartInfo
+            if(MinMaxSave){
+                this.chartLimit.min = Number(LeftMin)
+                this.chartLimit.max = Number(LeftMax)
+                this.chartLimit.rightMin = Number(RightMin)
+                this.chartLimit.rightMax = Number(RightMax)
+                this.chartLimit.rightTwoMin = Number(Right2Min)
+                this.chartLimit.rightTwoMax = Number(Right2Max)
+                //若用户修改过,则检测轴的上下限是否为空,若为空,则需要计算对应轴的上下限
+                this.checkChartLimit(tableData)
+            }else{
+                this.calcYAxislimit(tableData)
+            }
+        },
+        checkChartLimit(tableData=[]){
+            //散点图单独处理
+            if(this.chartInfo.ChartType===5){
+                if(tableData[1]){
+                    const {min,max} = this.chartLimit
+                    if(Number(min)===0&&Number(max)===0){
+                        this.chartLimit.min = tableData[1].MinData
+                        this.chartLimit.max = tableData[1].MaxData
+                    }
+                }
+                return 
+            }
+            const {
+                min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+            } = this.chartLimit
+            //若轴的上下限均为0,则不管用户有没有修改过,都重新赋值
+            if(Number(min)===0&&Number(max)===0){
+                const leftData = tableData.filter(i=>i.IsAxis===1).map(i=>[Number(i.MinData),Number(i.MaxData)])
+                if(leftData.length){
+                    const {Max,Min} = this.calcLimit(leftData.flat())
+                    this.chartLimit.min=Min
+                    this.chartLimit.max=Max
+                }
+            }
+            if(Number(rightMin)===0&&Number(rightMax)===0){
+                const rightData = tableData.filter(i => !i.IsAxis).map(i=>[Number(i.MinData),Number(i.MaxData)])
+                if(rightData.length){
+                    const {Max,Min} = this.calcLimit(rightData.flat())
+                    this.chartLimit.rightMin = Min
+                    this.chartLimit.rightMax = Max
+                }
+            }
+            if(Number(rightTwoMin)===0&&Number(rightTwoMax)===0){
+                const rightTwoData = tableData.filter(i=>i.IsAxis===2).map(i=>[Number(i.MinData),Number(i.MaxData)])
+                if(rightTwoData.length){
+                    const {Max,Min} = this.calcLimit(rightTwoData.flat())
+                    this.chartLimit.rightTwoMin = Min
+                    this.chartLimit.rightTwoMax = Max
+                }
+            }
+        },
+    /*-------------------- */
 	}
 }

+ 76 - 58
src/views/mychart_manage/components/chartDetailDia.vue

@@ -214,62 +214,63 @@
               <template v-if="!chartInfo.WarnMsg">
                 <Chart :options="options" :chartInfo="chartInfo" ref="chartRef"/>
                 <!-- 上下限 -->
-                <div class="range-cont left" v-if="leftIndex != -1">
-                  <el-input
-                    style="width: 60px; display: block"
-                    size="mini"
-                    type="number"
-                    placeholder="上限"
-                    :disabled="!isAllowEditLimit"
-                    v-model="tableData[leftIndex].MaxData"
-                  />
-                  <el-input
-                    class="min-data-input"
-                    size="mini"
-                    type="number"
-                    placeholder="下限"
-                    :disabled="!isAllowEditLimit"
-                    v-model="tableData[leftIndex].MinData"
-                  />
-                </div>
-                <div class="range-cont right" v-if="rightIndex != -1">
-                  <el-input
-                    style="width: 60px; display: block"
-                    size="mini"
-                    type="number"
-                    placeholder="上限"
-                    :disabled="!isAllowEditLimit"
-                    v-model="tableData[rightIndex].MaxData"
-                  />
-                  <el-input
-                    class="min-data-input"
-                    size="mini"
-                    type="number"
-                    placeholder="下限"
-                    :disabled="!isAllowEditLimit"
-                    v-model="tableData[rightIndex].MinData"
-                  />
-                </div>
-
-                <!-- 右2上下限设置 -->
-                <div class="range-cont rightTwo" v-if="rightTwoIndex != -1">
-                  <el-input
-                    style="width: 60px; display: block"
-                    size="mini"
-                    type="number"
-                    placeholder="上限"
-                    :disabled="!isAllowEditLimit"
-                    v-model="tableData[rightTwoIndex].MaxData"
-                  />
-                  <el-input
-                    class="min-data-input"
-                    size="mini"
-                    type="number"
-                    placeholder="下限"
-                    :disabled="!isAllowEditLimit"
-                    v-model="tableData[rightTwoIndex].MinData"
-                  />
-                </div>
+                <template v-if="chartInfo.Source===1&&![7,10,11].includes(chartInfo.ChartType)">
+                    <div class="range-cont left" v-if="leftIndex !== -1">
+                        <el-input
+                            style="width: 60px; display: block"
+                            size="mini"
+                            type="number"
+                            placeholder="上限"
+                            v-model="chartLimit.max"
+                            @change="changeLimit"
+                        />
+                        <el-input
+                            class="min-data-input"
+                            size="mini"
+                            type="number"
+                            placeholder="下限"
+                            v-model="chartLimit.min"
+                            @change="changeLimit"
+                        />
+                    </div>
+                    <div class="range-cont right" v-if="rightIndex !== -1">
+                        <el-input
+                            style="width: 60px; display: block"
+                            size="mini"
+                            type="number"
+                            placeholder="上限"
+                            v-model="chartLimit.rightMax"
+                            @change="changeLimit"
+                        />
+                        <el-input
+                            class="min-data-input"
+                            size="mini"
+                            type="number"
+                            placeholder="下限"
+                            v-model="chartLimit.rightMin"
+                            @change="changeLimit"
+                        />
+                    </div>
+                    <!-- 右2上下限设置 -->
+                    <div class="range-cont rightTwo" v-if="rightTwoIndex !== -1">
+                        <el-input
+                            style="width: 60px; display: block"
+                            size="mini"
+                            type="number"
+                            placeholder="上限"
+                            v-model="chartLimit.rightTwoMax"
+                            @change="changeLimit"
+                        />
+                        <el-input
+                            class="min-data-input"
+                            size="mini"
+                            type="number"
+                            placeholder="下限"
+                            v-model="chartLimit.rightTwoMin"
+                            @change="changeLimit"
+                        />
+                    </div>
+                </template>
 
                   <!-- 后续新图专用上下限 和其他数据依赖不公用 柱形图 截面散点-->
                 <template v-if="[7,10,11].includes(chartInfo.ChartType)">	
@@ -592,7 +593,7 @@ import { copyFit } from '@/utils/svgToblob.js';
 
 export default {
   components: { Chart, DateChooseDia,SaveChartOther,changeLang,setEnNameDia },
-  mixins: [ chartSetMixin ],
+  mixins: [ chartSetMixin],
   directives: {
     'click-outside':{
       bind(el, binding) {
@@ -731,8 +732,12 @@ export default {
             this.setDefaultSourceFrom();
             
             this.tableData = res.Data.EdbInfoList;
+            //初始化上下限
+            this.setLimitData(this.tableData)
+            
             //eta图
             this.setDefaultDateSelect(); //设置默认的日期选中
+
             this.chartInfo.ChartType === 7 && this.initBarData(res.Data);
 
             //截面散点图
@@ -1200,7 +1205,20 @@ export default {
             EndDate: this.year_select === 5 ? this.select_date[1] : '',
           }
         : typeChartParam;
-
+        
+        if(![7,10,11].includes(this.selected_chartType)){
+            params = {
+                ...params,
+                LeftMin:min+'',
+                LeftMax:max+'',
+                RightMin:rightMin+'',
+                RightMax:rightMax+'',
+                Right2Min:rightTwoMin+'',
+                Right2Max:rightTwoMax+'',
+                //手动保存视为更改过上下限
+                MinMaxSave:1
+            }
+        }
       dataBaseInterface.chartSave(params).then((res) => {
         if (res.Ret === 200) {
           this.$message.success('保存成功');

+ 180 - 10
src/views/ppt_manage/mixins/mixins.js

@@ -52,7 +52,14 @@ export default {
       barDateList: [],//柱形图的绘图数据
       barXIdData: [],//柱形图的x轴
       barEdbData: [],//柱形图的表格数据 只用于取值
-      chartLimit: {},
+      chartLimit: {
+        min:'', //左轴上下限
+        max:'',
+        rightMin:'',//右轴上下限
+        rightMax:'',
+        rightTwoMin:'',//右二轴上下限
+        rightTwoMax:'',
+      },
 
       /* 商品价格曲线 */
       commodityChartData: [],
@@ -115,6 +122,26 @@ export default {
       chartData.forEach((item, index) => {
         //轴位置值相同的下标
         let sameSideIndex = chartData.findIndex(i => i.IsAxis === item.IsAxis);
+        //获取对应轴的上下限
+        //非ETA图库图表也不设置自定义上下限
+        const isETASource = this.chartInfo.Source===1
+        let minLimit = 0,maxLimit = 0
+        if(isETASource){
+            const limitMap = {
+                0:['rightMin','rightMax'],
+                1:['min','max'],
+                2:['rightTwoMin','rightTwoMax']
+            }
+            if(limitMap[item.IsAxis]){
+                minLimit = this.chartLimit[`${limitMap[item.IsAxis][0]}`]||0
+                maxLimit = this.chartLimit[`${limitMap[item.IsAxis][1]}`]||0
+            }
+        }else{
+            minLimit = this.dataList[sameSideIndex].MinData
+            maxLimit = this.dataList[sameSideIndex].MaxData
+            console.log('useDefault',minLimit,maxLimit)
+        }
+        
         //y轴
         const textZh = item.ConvertUnit||item.Unit
         const textEn = item.ConvertEnUnit||item.UnitEn||item.ConvertUnit||item.Unit
@@ -147,8 +174,8 @@ export default {
           },
           opposite: [0,2].includes(item.IsAxis),
           reversed: item.IsOrder,
-          min: Number(item.MinData),
-          max: Number(item.MaxData),
+          min: Number(minLimit),
+          max: Number(maxLimit),
           tickWidth: 1,
           visible: sameSideIndex === index,
           plotBands: this.setAxisPlotAreas(item.IsAxis),
@@ -278,6 +305,19 @@ export default {
         ? -1
         : this.dataList.findIndex((item) => item.IsAxis===2);
 
+         //获取对应轴的上下限
+         let minLimit = 0,maxLimit = 0
+         const limitMap = {
+            0:['rightMin','rightMax'],
+            1:['min','max'],
+            2:['rightTwoMin','rightTwoMax']
+        }
+        if(limitMap[item.IsAxis]){
+            minLimit = this.chartLimit[`${limitMap[item.IsAxis][0]}`]||0
+            maxLimit = this.chartLimit[`${limitMap[item.IsAxis][1]}`]||0
+        }
+        console.log('test堆积',minLimit,maxLimit)
+
         //y轴
         let yItem = {
           ...basicYAxis,
@@ -308,8 +348,8 @@ export default {
           },
           opposite: [0,2].includes(item.IsAxis),
           reversed: item.IsOrder,
-          min: Number(chartData[sameSideIndex].MinData),
-          max: Number(chartData[sameSideIndex].MaxData),
+          min: Number(minLimit),
+          max: Number(maxLimit),
           tickWidth: sameSideIndex !== index ? 0 : 1,
           visible: serie_yIndex === index && sameSideIndex ===index,
           plotBands: this.setAxisPlotAreas(item.IsAxis),
@@ -402,6 +442,10 @@ export default {
       let seasonYdata = [],
         seasonData = []
 
+        //获取对应轴的上下限
+        let minLimit = 0,maxLimit = 0
+        minLimit = this.chartLimit.min||0
+        maxLimit = this.chartLimit.max||0
       //数据列
       for (let j of chartDataHandle) {
           //预测指标配置
@@ -455,8 +499,8 @@ export default {
           textAlign: 'left',
           reserveSpace: false
         },
-        max: Number(chartData.MaxData),
-        min: Number(chartData.MinData),
+        max: Number(maxLimit),
+        min: Number(minLimit),
         plotBands: this.setAxisPlotAreas(1),
         plotLines: this.setAxisPlotLines(1)
       }];
@@ -560,6 +604,10 @@ export default {
       }
 
       const { IsOrder,ChartColor,MaxData,MinData } = chartData[0];
+      //获取对应轴的上下限
+      let minLimit = 0,maxLimit = 0
+      minLimit = this.chartLimit.min||0
+      maxLimit = this.chartLimit.max||0
       //y轴
       const textYZh = chartData[1].ConvertUnit||chartData[1].Unit
       const textYEn = chartData[1].ConvertEnUnit||chartData[1].UnitEn||chartData[1].ConvertUnit||chartData[1].Unit
@@ -587,8 +635,8 @@ export default {
         },
         opposite: false,
         reversed: IsOrder,
-        min: Number(chartData[1].MinData),
-        max: Number(chartData[1].MaxData),
+        min: Number(minLimit),
+        max: Number(maxLimit),
         tickWidth: 1,
         tickLength: 5,
         lineWidth: 1,
@@ -1812,6 +1860,128 @@ export default {
       })
 
       return plotBands
-    }
+    },
+    /* ----自定义上下限相关--- */
+    setLimitData(tableData=[]){
+        const {
+            //左右轴极值字段 
+            LeftMin=0,LeftMax=0,
+            RightMin=0,RightMax=0,
+            Right2Min=0,Right2Max=0,
+            MinMaxSave
+        } = this.chartInfo
+        if(MinMaxSave){
+            this.chartLimit.min = Number(LeftMin)
+            this.chartLimit.max = Number(LeftMax)
+            this.chartLimit.rightMin = Number(RightMin)
+            this.chartLimit.rightMax = Number(RightMax)
+            this.chartLimit.rightTwoMin = Number(Right2Min)
+            this.chartLimit.rightTwoMax = Number(Right2Max)
+            //若用户修改过,则检测轴的上下限是否为空,若为空,则需要计算对应轴的上下限
+            this.checkChartLimit(tableData)
+        }else{
+            this.calcYAxislimit(tableData)
+        }
+    },
+    checkChartLimit(tableData=[]){
+        //散点图单独处理
+        if(this.chartInfo.ChartType===5){
+            if(tableData[1]){
+                const {min,max} = this.chartLimit
+                if(Number(min)===0&&Number(max)===0){
+                    this.chartLimit.min = tableData[1].MinData
+                    this.chartLimit.max = tableData[1].MaxData
+                }
+            }
+            return 
+        }
+        const {
+            min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+        } = this.chartLimit
+        //若轴的上下限均为0,则不管用户有没有修改过,都重新赋值
+        if(Number(min)===0&&Number(max)===0){
+            const leftData = tableData.filter(i=>i.IsAxis===1).map(i=>[Number(i.MinData),Number(i.MaxData)])
+            if(leftData.length){
+                const {Max,Min} = this.calcLimit(leftData.flat())
+                this.chartLimit.min=Min
+                this.chartLimit.max=Max
+            }
+        }
+        if(Number(rightMin)===0&&Number(rightMax)===0){
+            const rightData = tableData.filter(i => !i.IsAxis).map(i=>[Number(i.MinData),Number(i.MaxData)])
+            if(rightData.length){
+                const {Max,Min} = this.calcLimit(rightData.flat())
+                this.chartLimit.rightMin = Min
+                this.chartLimit.rightMax = Max
+            }
+        }
+        if(Number(rightTwoMin)===0&&Number(rightTwoMax)===0){
+            const rightTwoData = tableData.filter(i=>i.IsAxis===2).map(i=>[Number(i.MinData),Number(i.MaxData)])
+            if(rightTwoData.length){
+                const {Max,Min} = this.calcLimit(rightTwoData.flat())
+                this.chartLimit.rightTwoMin = Min
+                this.chartLimit.rightTwoMax = Max
+            }
+        }
+    },
+    /* 计算y轴上下限 */
+    calcYAxislimit(tableData=[]) {
+        //散点图单独处理
+        if(this.chartInfo.ChartType===5){
+            if(tableData[1]){
+                this.chartLimit.min = tableData[1].MinData
+                this.chartLimit.max = tableData[1].MaxData
+            }
+            return 
+        }
+        //分组
+        const leftData = tableData.filter(i => i.IsAxis === 1).map(i => [Number(i.MinData), Number(i.MaxData)])
+        const rightData = tableData.filter(i => !i.IsAxis).map(i => [Number(i.MinData), Number(i.MaxData)])
+        const rightTwoData = tableData.filter(i => i.IsAxis === 2).map(i => [Number(i.MinData), Number(i.MaxData)])
+        //计算最大最小值
+        if (leftData.length) {
+            const {
+                Max,
+                Min
+            } = this.calcLimit(leftData.flat())
+            this.chartLimit.min=Min
+            this.chartLimit.max=Max
+        } else {
+            this.leftIndex = -1
+            this.chartLimit.min=0
+            this.chartLimit.max=0
+        }
+        if (rightData.length) {
+            const {
+                Max,
+                Min
+            } = this.calcLimit(rightData.flat())
+            this.chartLimit.rightMin = Min
+            this.chartLimit.rightMax = Max
+        } else {
+            this.rightIndex = -1
+            this.chartLimit.rightMin = 0
+            this.chartLimit.rightMax = 0
+        }
+        if (rightTwoData.length) {
+            const {
+                Max,
+                Min
+            } = this.calcLimit(rightTwoData.flat())
+            this.chartLimit.rightTwoMin = Min
+            this.chartLimit.rightTwoMax = Max
+        } else {
+            this.rightTwoIndex = -1
+            this.chartLimit.rightTwoMin = 0
+            this.chartLimit.rightTwoMax = 0
+        }
+    },
+    calcLimit(arr) {
+        return {
+            Max: Math.max(...arr),
+            Min: Math.min(...arr)
+        }
+    },
+    /*-------------------- */
   },
 };

+ 2 - 0
src/views/ppt_manage/mixins/pptMixins.js

@@ -211,6 +211,8 @@ export default {
         this.setDefaultSourceFrom();
         
         this.dataList = Data.EdbInfoList;
+        //初始化上下限
+        this.setLimitData(this.dataList)
         //柱形图独立数据
         this.chartInfo.ChartType === 7 && this.initBarData(res.Data);
         //截面散点图

+ 2 - 1
src/views/sandbox_manage/sandFlowNew/components/addLInkDia.vue

@@ -388,7 +388,8 @@ import { dataBaseInterface,reportlist} from '@/api/api.js';
         if (res.Ret !== 200) return;
         this.chartInfo = res.Data.ChartInfo || {}
         this.edbData = res.Data.EdbInfoList|| []
-
+        //初始化上下限
+        this.setLimitData(this.edbData)
         const chartTypeMap = {
           7: this.initBarData, //柱形图
           10: this.initSectionScatterData //截面散点