Browse Source

将上下限统一到chartLimit内维护

cxmo 9 months ago
parent
commit
bd5df735a4

+ 21 - 18
src/views/dataEntry_manage/addChart.vue

@@ -466,16 +466,16 @@
 										size="mini"
 										type="number"
 										placeholder="上限"
-										v-model="leftLimitData[0]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.max"
+										@change="changeLimit"
 									/>
 									<el-input
 										class="min-data-input"
 										size="mini"
 										type="number"
 										placeholder="下限"
-										v-model="leftLimitData[1]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.min"
+										@change="changeLimit"
 									/>
 								</div>
 								<div class="range-cont right" v-if="rightIndex !== -1">
@@ -484,16 +484,16 @@
 										size="mini"
 										type="number"
 										placeholder="上限"
-										v-model="rightLimitData[0]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightMax"
+										@change="changeLimit"
 									/>
 									<el-input
 										class="min-data-input"
 										size="mini"
 										type="number"
 										placeholder="下限"
-										v-model="rightLimitData[1]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightMin"
+										@change="changeLimit"
 									/>
 								</div>
 								<!-- 右2上下限设置 -->
@@ -503,16 +503,16 @@
 										size="mini"
 										type="number"
 										placeholder="上限"
-										v-model="rightTwoLimitData[0]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightTwoMax"
+										@change="changeLimit"
 									/>
 									<el-input
 										class="min-data-input"
 										size="mini"
 										type="number"
 										placeholder="下限"
-										v-model="rightTwoLimitData[1]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightTwoMin"
+										@change="changeLimit"
 									/>
 								</div>
 							</template>
@@ -901,14 +901,17 @@ export default {
 							} 
 						: typePrams
 					if(![7,10,11].includes(this.chartInfo.ChartType)){
+						const {
+							min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+						} = this.chartLimit
 						params = {
 							...params,
-							LeftMin:this.leftLimitData[1]+'',
-							LeftMax:this.leftLimitData[0]+'',
-							RightMin:this.rightLimitData[1]+'',
-							RightMax:this.rightLimitData[0]+'',
-							Right2Min:this.rightTwoLimitData[1]+'',
-							Right2Max:this.rightTwoLimitData[0]+'',
+							LeftMin:min+'',
+							LeftMax:max+'',
+							RightMin:rightMin+'',
+							RightMax:rightMax+'',
+							Right2Min:rightTwoMin+'',
+							Right2Max:rightTwoMax+'',
 							MinMaxSave:Number(hasLimitChange)
 						}
 					}

+ 22 - 19
src/views/dataEntry_manage/chartSetting.vue

@@ -439,7 +439,7 @@
                         v-model="tableData[rightTwoIndex].MinData"
                       />
                     </div> -->
-                    <template v-if="![7,10].includes(chartInfo.ChartType)">
+                    <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"
@@ -447,8 +447,8 @@
                                 type="number"
                                 placeholder="上限"
                                 :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
-                                v-model="leftLimitData[0]"
-                                @change="changeAxisLimit"
+                                v-model="chartLimit.max"
+                                @change="changeLimit"
                             />
                             <el-input
                                 class="min-data-input"
@@ -456,8 +456,8 @@
                                 type="number"
                                 placeholder="下限"
                                 :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
-                                v-model="leftLimitData[1]"
-                                @change="changeAxisLimit"
+                                v-model="chartLimit.min"
+                                @change="changeLimit"
                             />
                         </div>
                     <div 
@@ -470,8 +470,8 @@
                         type="number"
                         placeholder="上限"
                         :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
-                        v-model="rightLimitData[0]"
-                        @change="changeAxisLimit"
+                        v-model="chartLimit.rightMax"
+                        @change="changeLimit"
                       />
                       <el-input
                         class="min-data-input"
@@ -479,8 +479,8 @@
                         type="number"
                         placeholder="下限"
                         :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
-                        v-model="rightLimitData[1]"
-                        @change="changeAxisLimit"
+                        v-model="chartLimit.rightMin"
+                        @change="changeLimit"
                       />
                     </div>
                     <div class="range-cont rightTwo" v-if="rightTwoIndex != -1">
@@ -490,8 +490,8 @@
                         type="number"
                         placeholder="上限"
                         :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
-                        v-model="rightTwoLimitData[0]"
-                        @change="changeAxisLimit"
+                        v-model="chartLimit.rightTwoMax"
+                        @change="changeLimit"
                       />
                       <el-input
                         class="min-data-input"
@@ -499,8 +499,8 @@
                         type="number"
                         placeholder="下限"
                         :disabled="!permissionBtn.isShowBtn('chartLibPermission','chartLib_editLimit')"
-                        v-model="rightTwoLimitData[1]"
-                        @change="changeAxisLimit"
+                        v-model="chartLimit.rightTwoMin"
+                        @change="changeLimit"
                       />
                     </div>
                     </template>
@@ -1914,14 +1914,17 @@ export default {
             }
           : typeChartParam;
         if(![7,10,11].includes(this.selected_chartType)){
+            const {
+                min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
+            } = this.chartLimit
             params = {
                 ...params,
-                LeftMin:this.leftLimitData[1]+'',
-                LeftMax:this.leftLimitData[0]+'',
-                RightMin:this.rightLimitData[1]+'',
-                RightMax:this.rightLimitData[0]+'',
-                Right2Min:this.rightTwoLimitData[1]+'',
-                Right2Max:this.rightTwoLimitData[0]+'',
+                LeftMin:min+'',
+                LeftMax:max+'',
+                RightMin:rightMin+'',
+                RightMax:rightMax+'',
+                Right2Min:rightTwoMin+'',
+                Right2Max:rightTwoMax+'',
                 //手动保存视为更改过上下限
                 MinMaxSave:1
             }

+ 18 - 18
src/views/dataEntry_manage/editChart.vue

@@ -463,16 +463,16 @@
 										size="mini"
 										type="number"
 										placeholder="上限"
-										v-model="leftLimitData[0]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.max"
+										@change="changeLimit"
 									/>
 									<el-input
 										class="min-data-input"
 										size="mini"
 										type="number"
 										placeholder="下限"
-										v-model="leftLimitData[1]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.min"
+										@change="changeLimit"
 									/>
 								</div>
 								<div class="range-cont right" v-if="rightIndex !== -1">
@@ -481,16 +481,16 @@
 										size="mini"
 										type="number"
 										placeholder="上限"
-										v-model="rightLimitData[0]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightMax"
+										@change="changeLimit"
 									/>
 									<el-input
 										class="min-data-input"
 										size="mini"
 										type="number"
 										placeholder="下限"
-										v-model="rightLimitData[1]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightMin"
+										@change="changeLimit"
 									/>
 								</div>
 								<!-- 右2上下限设置 -->
@@ -500,16 +500,16 @@
 										size="mini"
 										type="number"
 										placeholder="上限"
-										v-model="rightTwoLimitData[0]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightTwoMax"
+										@change="changeLimit"
 									/>
 									<el-input
 										class="min-data-input"
 										size="mini"
 										type="number"
 										placeholder="下限"
-										v-model="rightTwoLimitData[1]"
-										@change="changeAxisLimit"
+										v-model="chartLimit.rightTwoMin"
+										@change="changeLimit"
 									/>
 								</div>
 							</template>
@@ -1012,12 +1012,12 @@ export default {
 					if(![7,10,11].includes(this.chartInfo.ChartType)){
 						params = {
 							...params,
-							LeftMin:this.leftLimitData[1]+'',
-							LeftMax:this.leftLimitData[0]+'',
-							RightMin:this.rightLimitData[1]+'',
-							RightMax:this.rightLimitData[0]+'',
-							Right2Min:this.rightTwoLimitData[1]+'',
-							Right2Max:this.rightTwoLimitData[0]+'',
+							LeftMin:min+'',
+							LeftMax:max+'',
+							RightMin:rightMin+'',
+							RightMax:rightMax+'',
+							Right2Min:rightTwoMin+'',
+							Right2Max:rightTwoMax+'',
 							MinMaxSave:Number(hasLimitChange)
 						}
 					}

+ 16 - 12
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -1030,7 +1030,7 @@ export default {
 				this.calcYAxislimit(this.tableData)
 			}else{
 				//若用户修改过,则检测轴的上下限是否为空,若为空,则需要计算对应轴的上下限
-				this.checkLimit(this.tableData)
+				this.checkChartLimit(this.tableData)
 			}
 		},
 		//新增/编辑保存图表时-判断用户有没有手动更改过上下限
@@ -1038,8 +1038,9 @@ export default {
 			//散点图单独处理
 			if(this.chartInfo.ChartType===5){
 				if(this.tableData[1]){
-					return Number(this.leftLimitData[0])===Number(this.tableData[1].MaxData)
-					&& Number(this.leftLimitData[1])===Number(this.tableData[1].MinData)
+					const {min,max} = this.chartLimit
+					return Number(max)===Number(this.tableData[1].MaxData)
+					&& Number(min)===Number(this.tableData[1].MinData)
 				}
 				return false
 			}
@@ -1047,36 +1048,39 @@ export default {
 			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(this.leftLimitData[0])&&Min===Number(this.leftLimitData[1])
+				leftLimitSame = Max===Number(max)&&Min===Number(min)
 				console.table([{
 					'y轴': '左轴',
-					'设置最大值': this.leftLimitData[0],
-					'设置最小值': this.leftLimitData[1],
+					'设置最大值': max,
+					'设置最小值': min,
 					'指标最大值':Max,
 					'指标最小值':Min
 				}])
 			}
 			if(rightData.length){
 				const {Max,Min} = this.calcLimit(rightData.flat())
-				rightLimitSame = Max===Number(this.rightLimitData[0])&&Min===Number(this.rightLimitData[1])
+				rightLimitSame = Max===Number(rightMax)&&Min===Number(rightMin)
 				console.table([{
 					'y轴': '右轴',
-					'设置最大值': this.rightLimitData[0],
-					'设置最小值': this.rightLimitData[1],
+					'设置最大值': rightMax,
+					'设置最小值': rightMin,
 					'指标最大值':Max,
 					'指标最小值':Min
 				}])
 			}
 			if(rightTwoData.length){
 				const {Max,Min} = this.calcLimit(rightTwoData.flat())
-				rightTwoLimitSame = Max===Number(this.rightTwoLimitData[0])&&Min===Number(this.rightTwoLimitData[1])
+				rightTwoLimitSame = Max===Number(rightTwoMax)&&Min===Number(rightTwoMin)
 				console.table([{
 					'y轴': '右二轴',
-					'设置最大值': this.rightTwoLimitData[0],
-					'设置最小值': this.rightTwoLimitData[1],
+					'设置最大值': rightTwoMax,
+					'设置最小值': rightTwoMin,
 					'指标最大值':Max,
 					'指标最小值':Min
 				}])

+ 86 - 56
src/views/dataEntry_manage/mixins/chartPublic.js

@@ -134,9 +134,6 @@ export const chartSetMixin = {
       leftIndex: -1, //左侧上下限对应下标
       rightIndex: -1, //右侧上下限对应下标
       rightTwoIndex: -1,//右2上下限对应下标
-      leftLimitData:[0,0],//左轴上下限
-      rightLimitData:[0,0],//右轴上下限
-      rightTwoLimitData:[0,0],//右二轴上下限
       left_extreme: [],
       right_extreme: [],
       
@@ -161,7 +158,15 @@ export const chartSetMixin = {
       barXData: [],//柱形图的x轴
       barXIdList: [],//x轴id数组 用于切换英文遍历用
       barEdbData: [],//柱形图的表格数据 只用于取值
-      chartLimit: {},
+      chartLimit: {
+        min:'', //左轴上下限
+        max:'',
+        rightMin:'',//右轴上下限
+        rightMax:'',
+        rightTwoMin:'',//右二轴上下限
+        rightTwoMax:'',
+
+      },
 
       /* 商品价格曲线 本来逻辑分开写 但需求又得加入myeta和eta图库共存 还是写一块算了 */
       commodityChartData: [],
@@ -605,12 +610,15 @@ export const chartSetMixin = {
         }
         if(!useTableLimit&&isETASource){
             const limitMap = {
-                0:this.rightLimitData||[],
-                1:this.leftLimitData||[],
-                2:this.rightTwoLimitData||[]
+                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
             }
-            minLimit = limitMap[item.IsAxis][1]||0
-            maxLimit = limitMap[item.IsAxis][0]||0
+            console.log('test',minLimit,maxLimit)
         }
         
         
@@ -803,12 +811,15 @@ export const chartSetMixin = {
             maxLimit = chartData[sameSideIndex].MaxData
         }else{
             const limitMap = {
-                0:this.rightLimitData||[],
-                1:this.leftLimitData||[],
-                2:this.rightTwoLimitData||[]
+                0:['rightMin','rightMax'],
+                1:['min','max'],
+                2:['rightTwoMin','rightTwoMax']
             }
-            minLimit = limitMap[item.IsAxis][1]||0
-            maxLimit = limitMap[item.IsAxis][0]||0
+            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轴
@@ -949,8 +960,8 @@ export const chartSetMixin = {
             minLimit = chartData.MinData
             maxLimit = chartData.MaxData
         }else{
-            minLimit = this.leftLimitData[1]||0
-            maxLimit = this.leftLimitData[0]||0
+            minLimit = this.chartLimit.min||0
+            maxLimit = this.chartLimit.max||0
         }
 
       //数据列
@@ -1137,8 +1148,8 @@ export const chartSetMixin = {
             minLimit = Math.min(...real_data.map(_ => _.y));
             maxLimit = Math.max(...real_data.map(_ => _.y));
         }else{
-            minLimit = this.leftLimitData[1]||0
-            maxLimit = this.leftLimitData[0]||0
+            minLimit = this.chartLimit.min||0
+            maxLimit = this.chartLimit.max||0
         }
 
       const { IsOrder,ChartColor } = newval[0];
@@ -2518,6 +2529,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
@@ -2529,7 +2546,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]();
       }
@@ -2667,7 +2690,8 @@ export const chartSetMixin = {
             //散点图单独处理
             if(this.chartInfo.ChartType===5){
                 if(tableData[1]){
-                    this.leftLimitData = [tableData[1].MaxData,tableData[1].MinData]
+                    this.chartLimit.min = tableData[1].MinData
+                    this.chartLimit.max = tableData[1].MaxData
                 }
                 return 
             }
@@ -2681,45 +2705,51 @@ export const chartSetMixin = {
                     Max,
                     Min
                 } = this.calcLimit(leftData.flat())
-                this.leftLimitData = [Max, Min]
+                this.chartLimit.min=Min
+                this.chartLimit.max=Max
             } else {
                 this.leftIndex = -1
-                this.leftLimitData = [0, 0]
+                this.chartLimit.min=0
+                this.chartLimit.max=0
             }
             if (rightData.length) {
                 const {
                     Max,
                     Min
                 } = this.calcLimit(rightData.flat())
-                this.rightLimitData = [Max, Min]
+                this.chartLimit.rightMin = Min
+                this.chartLimit.rightMax = Max
             } else {
                 this.rightIndex = -1
-                this.rightLimitData = [0, 0]
+                this.chartLimit.rightMin = 0
+                this.chartLimit.rightMax = 0
             }
             if (rightTwoData.length) {
                 const {
                     Max,
                     Min
                 } = this.calcLimit(rightTwoData.flat())
-                this.rightTwoLimitData = [Max, Min]
+                this.chartLimit.rightTwoMin = Min
+                this.chartLimit.rightTwoMax = Max
             } else {
                 this.rightTwoIndex = -1
-                this.rightTwoLimitData = [0, 0]
+                this.chartLimit.rightTwoMin = 0
+                this.chartLimit.rightTwoMax = 0
             }
             console.table([{
                     'y轴': '左轴',
-                    '最大值': this.leftLimitData[0],
-                    '最小值': this.leftLimitData[1]
+                    '最大值': this.chartLimit.max,
+                    '最小值': this.chartLimit.min
                 },
                 {
                     'y轴': '右轴',
-                    '最大值': this.rightLimitData[0],
-                    '最小值': this.rightLimitData[1]
+                    '最大值': this.chartLimit.rightMax,
+                    '最小值': this.chartLimit.rightMin
                 },
                 {
                     'y轴': '右二轴',
-                    '最大值': this.rightTwoLimitData[0],
-                    '最小值': this.rightTwoLimitData[1]
+                    '最大值': this.chartLimit.rightTwoMax,
+                    '最小值': this.chartLimit.rightTwoMin
                 }
             ])
         },
@@ -2729,11 +2759,6 @@ export const chartSetMixin = {
                 Min: Math.min(...arr)
             }
         },
-        //输入框改变上下限时触发
-        changeAxisLimit() {
-            this.setAddChartDefault&&this.setAddChartDefault();
-            this.setChartOptionHandle(this.tableData);
-        },
         //图表详情-设置图表上下限
         setLimitData(tableData=[]){
             const {
@@ -2744,51 +2769,56 @@ export const chartSetMixin = {
                 MinMaxSave
             } = this.chartInfo
             if(MinMaxSave){
-                this.leftLimitData = [Number(LeftMax),Number(LeftMin)]
-                this.rightLimitData = [Number(RightMax),Number(RightMin)]
-                this.rightTwoLimitData = [Number(Right2Max),Number(Right2Min)]
+                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.checkLimit(tableData)
+                this.checkChartLimit(tableData)
             }else{
                 this.calcYAxislimit(tableData)
             }
         },
-        checkLimit(tableData=[]){
+        checkChartLimit(tableData=[]){
             //散点图单独处理
             if(this.chartInfo.ChartType===5){
                 if(tableData[1]){
-                    if(Number(this.leftLimitData[0])===0&&Number(this.leftLimitData[1])===0){
-                        this.leftLimitData = [tableData[1].MaxData,tableData[1].MinData]
+                    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(this.leftLimitData[0])===0&&Number(this.leftLimitData[1])===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.leftLimitData = [Max,Min]
-                }else{
-                    this.leftLimitData = [0,0]
+                    this.chartLimit.min=Min
+                    this.chartLimit.max=Max
                 }
             }
-            if(Number(this.rightLimitData[0])===0&&Number(this.rightLimitData[1])===0){
+            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.rightLimitData = [Max,Min]
-                }else{
-                    this.rightLimitData = [0,0]
+                    this.chartLimit.rightMin = Min
+                    this.chartLimit.rightMax = Max
                 }
             }
-            if(Number(this.rightTwoLimitData[0])===0&&Number(this.rightTwoLimitData[1])===0){
+            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.rightTwoLimitData = [Max,Min]
-                }else{
-                    this.rightTwoLimitData = [0,0]
+                    this.chartLimit.rightTwoMin = Min
+                    this.chartLimit.rightTwoMax = Max
                 }
             }
         },

+ 18 - 18
src/views/mychart_manage/components/chartDetailDia.vue

@@ -221,16 +221,16 @@
                             size="mini"
                             type="number"
                             placeholder="上限"
-                            v-model="leftLimitData[0]"
-                            @change="changeAxisLimit"
+                            v-model="chartLimit.max"
+                            @change="changeLimit"
                         />
                         <el-input
                             class="min-data-input"
                             size="mini"
                             type="number"
                             placeholder="下限"
-                            v-model="leftLimitData[1]"
-                            @change="changeAxisLimit"
+                            v-model="chartLimit.min"
+                            @change="changeLimit"
                         />
                     </div>
                     <div class="range-cont right" v-if="rightIndex !== -1">
@@ -239,16 +239,16 @@
                             size="mini"
                             type="number"
                             placeholder="上限"
-                            v-model="rightLimitData[0]"
-                            @change="changeAxisLimit"
+                            v-model="chartLimit.rightMax"
+                            @change="changeLimit"
                         />
                         <el-input
                             class="min-data-input"
                             size="mini"
                             type="number"
                             placeholder="下限"
-                            v-model="rightLimitData[1]"
-                            @change="changeAxisLimit"
+                            v-model="chartLimit.rightMin"
+                            @change="changeLimit"
                         />
                     </div>
                     <!-- 右2上下限设置 -->
@@ -258,16 +258,16 @@
                             size="mini"
                             type="number"
                             placeholder="上限"
-                            v-model="rightTwoLimitData[0]"
-                            @change="changeAxisLimit"
+                            v-model="chartLimit.rightTwoMax"
+                            @change="changeLimit"
                         />
                         <el-input
                             class="min-data-input"
                             size="mini"
                             type="number"
                             placeholder="下限"
-                            v-model="rightTwoLimitData[1]"
-                            @change="changeAxisLimit"
+                            v-model="chartLimit.rightTwoMin"
+                            @change="changeLimit"
                         />
                     </div>
                 </template>
@@ -1204,12 +1204,12 @@ export default {
         if(![7,10,11].includes(this.selected_chartType)){
             params = {
                 ...params,
-                LeftMin:this.leftLimitData[1]+'',
-                LeftMax:this.leftLimitData[0]+'',
-                RightMin:this.rightLimitData[1]+'',
-                RightMax:this.rightLimitData[0]+'',
-                Right2Min:this.rightTwoLimitData[1]+'',
-                Right2Max:this.rightTwoLimitData[0]+'',
+                LeftMin:min+'',
+                LeftMax:max+'',
+                RightMin:rightMin+'',
+                RightMax:rightMax+'',
+                Right2Min:rightTwoMin+'',
+                Right2Max:rightTwoMax+'',
                 //手动保存视为更改过上下限
                 MinMaxSave:1
             }

+ 69 - 45
src/views/ppt_manage/mixins/mixins.js

@@ -31,9 +31,6 @@ const basicYAxis = {
 export default {
   data() {
     return {
-      leftLimitData:[0,0],//左轴上下限
-      rightLimitData:[0,0],//右轴上下限
-      rightTwoLimitData:[0,0],//右二轴上下限
       bgList:[
         {image_url:require('@/assets/img/ppt_m/bg3.jpg')},
         {image_url:require('@/assets/img/ppt_m/bg4.jpg')},
@@ -55,7 +52,14 @@ export default {
       barDateList: [],//柱形图的绘图数据
       barXIdData: [],//柱形图的x轴
       barEdbData: [],//柱形图的表格数据 只用于取值
-      chartLimit: {},
+      chartLimit: {
+        min:'', //左轴上下限
+        max:'',
+        rightMin:'',//右轴上下限
+        rightMax:'',
+        rightTwoMin:'',//右二轴上下限
+        rightTwoMax:'',
+      },
 
       /* 商品价格曲线 */
       commodityChartData: [],
@@ -124,12 +128,14 @@ export default {
         let minLimit = 0,maxLimit = 0
         if(isETASource){
             const limitMap = {
-                0:this.rightLimitData||[],
-                1:this.leftLimitData||[],
-                2:this.rightTwoLimitData||[]
+                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
             }
-            minLimit = limitMap[item.IsAxis][1]||0
-            maxLimit = limitMap[item.IsAxis][0]||0
         }else{
             minLimit = this.dataList[sameSideIndex].MinData
             maxLimit = this.dataList[sameSideIndex].MaxData
@@ -302,12 +308,15 @@ export default {
          //获取对应轴的上下限
          let minLimit = 0,maxLimit = 0
          const limitMap = {
-             0:this.rightLimitData||[],
-             1:this.leftLimitData||[],
-             2:this.rightTwoLimitData||[]
-         }
-         minLimit = limitMap[item.IsAxis][1]||0
-         maxLimit = limitMap[item.IsAxis][0]||0
+            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 = {
@@ -435,8 +444,8 @@ export default {
 
         //获取对应轴的上下限
         let minLimit = 0,maxLimit = 0
-        minLimit = this.leftLimitData[1]||0
-        maxLimit = this.leftLimitData[0]||0
+        minLimit = this.chartLimit.min||0
+        maxLimit = this.chartLimit.max||0
       //数据列
       for (let j of chartDataHandle) {
           //预测指标配置
@@ -597,8 +606,8 @@ export default {
       const { IsOrder,ChartColor,MaxData,MinData } = chartData[0];
       //获取对应轴的上下限
       let minLimit = 0,maxLimit = 0
-      minLimit = this.leftLimitData[1]||0
-      maxLimit = this.leftLimitData[0]||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
@@ -1862,51 +1871,56 @@ export default {
             MinMaxSave
         } = this.chartInfo
         if(MinMaxSave){
-            this.leftLimitData = [Number(LeftMax),Number(LeftMin)]
-            this.rightLimitData = [Number(RightMax),Number(RightMin)]
-            this.rightTwoLimitData = [Number(Right2Max),Number(Right2Min)]
+            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.checkLimit(tableData)
+            this.checkChartLimit(tableData)
         }else{
             this.calcYAxislimit(tableData)
         }
     },
-    checkLimit(tableData=[]){
+    checkChartLimit(tableData=[]){
         //散点图单独处理
         if(this.chartInfo.ChartType===5){
             if(tableData[1]){
-                if(Number(this.leftLimitData[0])===0&&Number(this.leftLimitData[1])===0){
-                    this.leftLimitData = [tableData[1].MaxData,tableData[1].MinData]
+                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(this.leftLimitData[0])===0&&Number(this.leftLimitData[1])===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.leftLimitData = [Max,Min]
-            }else{
-                this.leftLimitData = [0,0]
+                this.chartLimit.min=Min
+                this.chartLimit.max=Max
             }
         }
-        if(Number(this.rightLimitData[0])===0&&Number(this.rightLimitData[1])===0){
+        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.rightLimitData = [Max,Min]
-            }else{
-                this.rightLimitData = [0,0]
+                this.chartLimit.rightMin = Min
+                this.chartLimit.rightMax = Max
             }
         }
-        if(Number(this.rightTwoLimitData[0])===0&&Number(this.rightTwoLimitData[1])===0){
+        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.rightTwoLimitData = [Max,Min]
-            }else{
-                this.rightTwoLimitData = [0,0]
+                this.chartLimit.rightTwoMin = Min
+                this.chartLimit.rightTwoMax = Max
             }
         }
     },
@@ -1915,7 +1929,8 @@ export default {
         //散点图单独处理
         if(this.chartInfo.ChartType===5){
             if(tableData[1]){
-                this.leftLimitData = [tableData[1].MaxData,tableData[1].MinData]
+                this.chartLimit.min = tableData[1].MinData
+                this.chartLimit.max = tableData[1].MaxData
             }
             return 
         }
@@ -1929,27 +1944,36 @@ export default {
                 Max,
                 Min
             } = this.calcLimit(leftData.flat())
-            this.leftLimitData = [Max, Min]
+            this.chartLimit.min=Min
+            this.chartLimit.max=Max
         } else {
-            this.leftLimitData = [0, 0]
+            this.leftIndex = -1
+            this.chartLimit.min=0
+            this.chartLimit.max=0
         }
         if (rightData.length) {
             const {
                 Max,
                 Min
             } = this.calcLimit(rightData.flat())
-            this.rightLimitData = [Max, Min]
+            this.chartLimit.rightMin = Min
+            this.chartLimit.rightMax = Max
         } else {
-            this.rightLimitData = [0, 0]
+            this.rightIndex = -1
+            this.chartLimit.rightMin = 0
+            this.chartLimit.rightMax = 0
         }
         if (rightTwoData.length) {
             const {
                 Max,
                 Min
             } = this.calcLimit(rightTwoData.flat())
-            this.rightTwoLimitData = [Max, Min]
+            this.chartLimit.rightTwoMin = Min
+            this.chartLimit.rightTwoMax = Max
         } else {
-            this.rightTwoLimitData = [0, 0]
+            this.rightTwoIndex = -1
+            this.chartLimit.rightTwoMin = 0
+            this.chartLimit.rightTwoMax = 0
         }
     },
     calcLimit(arr) {