Browse Source

Merge branch 'demand-151'

cxmo 6 tháng trước cách đây
mục cha
commit
f7aa0e8956

+ 5 - 2
src/views/dataEntry_manage/addChart.vue

@@ -215,7 +215,7 @@
 										<el-checkbox v-model="item.IsOrder"><!-- 逆序 -->{{$t('Chart.Detail.re_order')}}</el-checkbox>
 									</li>
 									<li>
-										<el-radio-group v-model="item.IsAxis" size="mini">
+										<el-radio-group v-model="item.IsAxis" size="mini" @input="isChangeEdbAxis=true">
 											<el-radio-button :label="1"><!-- 左轴 -->{{$t('Chart.Detail.l_axis')}}</el-radio-button>
 											<el-radio-button :label="0"><!-- 右轴 -->{{$t('Chart.Detail.r_axis')}}</el-radio-button>
 
@@ -786,7 +786,10 @@ 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()
+						//只有当新增指标or切换左右轴时,才更新上下限
+						if(this.updateLimit){
+							this.EdbAxisChange()
+						}
 						this.setAddChartDefault();
 						this.setChartOptionHandle(newval);
 					}

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

@@ -221,7 +221,7 @@
 										<el-checkbox v-model="item.IsOrder"><!-- 逆序 -->{{$t('Chart.Detail.re_order')}}</el-checkbox>
 									</li>
 									<li>
-										<el-radio-group v-model="item.IsAxis" size="mini">
+										<el-radio-group v-model="item.IsAxis" size="mini" @input="isChangeEdbAxis=true">
 											<el-radio-button :label="1"><!-- 左轴 -->{{$t('Chart.Detail.l_axis')}}</el-radio-button>
 											<el-radio-button :label="0"><!-- 右轴 -->{{$t('Chart.Detail.r_axis')}}</el-radio-button>
 											<!-- 指标有右轴时才可以选右2轴 不然没有右2这个概念的意义 -->
@@ -794,7 +794,10 @@ export default {
 						//雷达图
 						this.chartInfo.ChartType === 11 && this.$refs.BarOptRef && this.$refs.BarOptRef.getBarData();
 					}else {
-						this.EdbAxisChange()
+						//只有当新增指标or切换左右轴时,才更新上下限
+						if(this.updateLimit){
+							this.EdbAxisChange()
+						}
 						this.setAddChartDefault();
 						newval.length && !this.chartInfo.WarnMsg && this.setChartOptionHandle(newval);
 					}

+ 21 - 4
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -84,13 +84,20 @@ export default {
 			},
 
 			updateData:[],
-			useUnit:''
+			useUnit:'',
+
+			isModifyEdb:false,//添加,删除指标后,该值为true,触发设置上下限后,该值为false
+			isChangeEdbAxis:false,//指标左右轴,数据转换改变时,该值为true,触发设置上下限后,该值为false
 		}
 	},
 	computed: {
 		...mapState({
 			chart_lang: state => state.edb.chart_lang,	
-		})
+		}),
+		//是否需要更新上下限
+		updateLimit(){
+			return this.isModifyEdb||this.isChangeEdbAxis
+		}
 	},
 	watch: {
 		edbFromType() {
@@ -191,6 +198,7 @@ export default {
 					return this.$message.warning("指标数据含有负数或0,无法进行对数运算")
 				}
 			}
+			this.isChangeEdbAxis = true
 			//柱形图单独设置
 			if(this.chartInfo.ChartType===7){
 				return this.setChangeBarData(index)
@@ -331,7 +339,11 @@ export default {
 								});
 							}
 							//新增指标后,检测上下限变化,修改上下限
-							this.EdbAxisChange()
+							this.isModifyEdb = true
+							if(this.updateLimit){
+								this.EdbAxisChange()
+							}
+							
 
 							this.$nextTick(()=>{
 								// 等待 tableData的 监听里面的获取到 起始时间和最近日期
@@ -689,7 +701,10 @@ export default {
 			this.updateData.splice(index, 1)
 			this.$message.success(this.$t('MsgPrompt.delete_msg'))
 			//删除指标时,检测上下限,修改上下限
-			this.EdbAxisChange()
+			this.isModifyEdb = true
+			if(this.updateLimit){
+				this.EdbAxisChange()
+			}
 			//添加图表时重置默认样式
 			this.$route.path==='/addchart' && this.resetChartEdbDefault();
 			
@@ -1073,6 +1088,8 @@ export default {
 				//若用户修改过,则检测轴的上下限是否为空,若为空,则需要计算对应轴的上下限
 				this.checkChartLimit(this.tableData)
 			}
+			this.isModifyEdb = false
+			this.isChangeEdbAxis = false
 		},
 		//新增/编辑保存图表时-判断用户有没有手动更改过上下限
 		getLimitInfo(){