فهرست منبع

默认来源拼接

Karsa 10 ماه پیش
والد
کامیت
98db8f82f4

+ 3 - 0
src/views/dataEntry_manage/components/satterSeriesDia.vue

@@ -403,6 +403,9 @@ export default {
         //遍历请求xEdbs yEdbs的指标详情,获取最新日期和值
         this.getEdbData()
         this.getEdbNewInfo()
+      }else {
+        let themeOpt = this.$parent.chartInfo.ChartThemeStyle ? JSON.parse(this.$parent.chartInfo.ChartThemeStyle) : null;      
+        this.form.color = themeOpt&&themeOpt.colorsOptions[0] || defaultOpts.colors[0];
       }
     }
   },

+ 39 - 2
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -223,6 +223,25 @@ export default {
 							this.tableData.push(tableItem);
 							this.isSetExtremeValue = true;
 							// console.log(this.tableData)
+							
+							//默认拼接来源
+							if(!this.chartInfo.SourcesFrom) {
+
+								this.chartInfo.SourcesFrom = JSON.stringify({
+									isShow: this.chartInfo.SourcesFromVisable,
+									text: res.Data.ChartInfo.ChartSource,
+									color: JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.color,
+									fontSize: JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.fontSize
+								});
+							}else {
+								let sourceObj = JSON.parse(_.cloneDeep(this.chartInfo.SourcesFrom));
+								let concatSourceArr = `${sourceObj.text},${res.Data.ChartInfo.ChartSource}`.split(',');
+								let sourceStr = Array.from(new Set(concatSourceArr)).join(',');
+								this.chartInfo.SourcesFrom = JSON.stringify({
+									...sourceObj,
+									text: sourceStr
+								});
+							}
 
 							this.$nextTick(()=>{
 								// 等待 tableData的 监听里面的获取到 起始时间和最近日期
@@ -268,7 +287,7 @@ export default {
 			dataBaseInterface.getBarData(params).then(res => {
 				if(res.Ret !== 200) return
 
-				const { EdbInfoList,XEdbIdValue,YDataList } = res.Data;
+				const { EdbInfoList,XEdbIdValue,YDataList,ChartInfo } = res.Data;
 
 				let xData = XEdbIdValue.map(_ => EdbInfoList.find(edb => edb.EdbInfoId===_).EdbAliasName)
 
@@ -285,6 +304,9 @@ export default {
 						max: Math.max(...value_arr)
 					}
 				}
+				
+				//默认来源搞一下
+				this.setDefaultSourceFrom(ChartInfo);
 			})
 		},
 
@@ -552,7 +574,7 @@ export default {
 			}).then(res => {
 				if(res.Ret !== 200) return
 				
-				const { EdbInfoList,DataResp } = res.Data;
+				const { EdbInfoList,DataResp,ChartInfo } = res.Data;
 
 				this.sectionScatterData = DataResp;
 				this.tableData = EdbInfoList;
@@ -568,6 +590,9 @@ export default {
 						x_max: Math.max(...x_value_arr)
 					}
 				}
+
+				//默认来源搞一下
+				this.setDefaultSourceFrom(ChartInfo);
 			})
 		},
 
@@ -783,6 +808,18 @@ export default {
 				: this.setChartOptionHandle(this.tableData);
 		},
 
+		/* 添加图表默认显示图表来源 */
+		setDefaultSourceFrom(ChartInfo) {
+			if(!this.chartInfo.SourcesFrom) {
+				this.chartInfo.SourcesFrom = JSON.stringify({
+					isShow: this.chartInfo.SourcesFromVisable,
+					text: ChartInfo.ChartSource,
+					color: JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.color,
+					fontSize: JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.fontSize
+				});
+			}
+		},
+
 		/* 数据来源显示隐藏 */
 		changeSourceVisable() {
 			this.chartInfo.SourcesFrom = JSON.stringify({

+ 8 - 3
src/views/dataEntry_manage/mixins/chartPublic.js

@@ -973,8 +973,10 @@ export const chartSetMixin = {
         },
         xDateFormat: '%m/%d',
       }
+
+      let colors = chartTheme&&chartTheme.colorsOptions.reverse();
       this.options = {
-        colors:chartTheme&&chartTheme.colorsOptions.slice(-chartDataHandle.length),
+        colors: colors.slice(-chartDataHandle.length),
         series: seasonData,
         yAxis: seasonYdata,
         xAxis,
@@ -2368,7 +2370,9 @@ export const chartSetMixin = {
         let markerValue='';
         if(isXDateAxis) {
           //季节图x轴额外拼个年份
-          let nowYear = new Date().getFullYear();
+          let nowYear = ChartType===2 ? new Date(this.tableData[0].DataList[1].DataList
+[0].DataTimestamp).getFullYear() : '';
+          console.log(nowYear)
           markerValue = ChartType===2 
             ? new Date(`${nowYear}-${_.value}`).getTime()
             : new Date(_.value).getTime()
@@ -2408,7 +2412,8 @@ export const chartSetMixin = {
         let fromMarkerValue='',toMarkerValue='';
         if(isXDateAxis) {
           //季节图x轴额外拼个年份
-          let nowYear = new Date().getFullYear();
+          let nowYear = ChartType===2 ? new Date(this.tableData[0].DataList[1].DataList
+            [0].DataTimestamp).getFullYear() : '';
           fromMarkerValue = ChartType===2 
             ? new Date(`${nowYear}-${_.fromValue}`).getTime()
             : new Date(_.fromValue).getTime()

+ 6 - 3
src/views/ppt_manage/mixins/mixins.js

@@ -481,8 +481,9 @@ export default {
         xDateFormat: '%m/%d',
       }
 
+      let colors = chartTheme&&chartTheme.colorsOptions.reverse();
       this.options = {
-        colors:chartTheme&&chartTheme.colorsOptions.slice(-chartDataHandle.length),
+        colors: colors.slice(-chartDataHandle.length),
         series: seasonData,
         yAxis: seasonYdata,
         xAxis,
@@ -1611,7 +1612,8 @@ export default {
         let markerValue='';
         if(isXDateAxis) {
           //季节图x轴额外拼个年份
-          let nowYear = new Date().getFullYear();
+          let nowYear = ChartType===2 ? new Date(this.dataList[0].DataList[1].DataList
+            [0].DataTimestamp).getFullYear() : '';
           markerValue = ChartType===2 
             ? new Date(`${nowYear}-${_.value}`).getTime()
             : new Date(_.value).getTime()
@@ -1651,7 +1653,8 @@ export default {
         let fromMarkerValue='',toMarkerValue='';
         if(isXDateAxis) {
           //季节图x轴额外拼个年份
-          let nowYear = new Date().getFullYear();
+          let nowYear = ChartType===2 ? new Date(this.dataList[0].DataList[1].DataList
+            [0].DataTimestamp).getFullYear() : '';
           fromMarkerValue = ChartType===2 
             ? new Date(`${nowYear}-${_.fromValue}`).getTime()
             : new Date(_.fromValue).getTime()