Browse Source

eta1.4.1线上问题修复

Karsa 1 year ago
parent
commit
e7bb428eb7

+ 1 - 0
src/utils/defaultOptions.js

@@ -82,6 +82,7 @@ export const defaultOpts = {
 		enabled: true,
 		verticalAlign: 'top',
 		margin:5,
+		width: '90%',
 		// layout: 'vertical'
 	},
 	//滚动条

+ 1 - 1
src/views/dataEntry_manage/addChart.vue

@@ -517,7 +517,7 @@
 									color: ${JSON.parse(chartInfo.SourcesFrom).isShow ? JSON.parse(chartInfo.SourcesFrom).color : '#999'};
 									fontSize: ${ JSON.parse(chartInfo.SourcesFrom).fontSize }px;
 								`"
-								>数据来源:{{ JSON.parse(chartInfo.SourcesFrom).text}}
+								>来源:{{ JSON.parse(chartInfo.SourcesFrom).text}}
 								</span>
 
 								<el-switch

+ 6 - 2
src/views/dataEntry_manage/chartSetting.vue

@@ -493,13 +493,14 @@
 
                   <div class="chart-bottom-insruction-info">
 
-                    <div class="chart-source" v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow">
+                    <div class="chart-source" >
                         <span
+                          v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow"
                           :style="`
                           color: ${JSON.parse(chartInfo.SourcesFrom).color};
                           fontSize: ${ JSON.parse(chartInfo.SourcesFrom).fontSize }px;
                         `"
-                        >数据来源:{{ JSON.parse(chartInfo.SourcesFrom).text}}</span>
+                        >来源:{{ JSON.parse(chartInfo.SourcesFrom).text}}</span>
                     </div>
 
                     <!-- 公历农历切换 只用于季节性图 -->
@@ -1590,6 +1591,9 @@ export default {
       }
       if (res.Ret !== 200) return;
       this.chartInfo = res.Data.ChartInfo;
+
+      //处理下历史默认来源
+			this.setDefaultSourceFrom();
   
       this.tableData = res.Data.EdbInfoList;
       // 设置起始日期和最新日期

+ 3 - 1
src/views/dataEntry_manage/editChart.vue

@@ -508,7 +508,7 @@
 										color: ${JSON.parse(chartInfo.SourcesFrom).isShow ? JSON.parse(chartInfo.SourcesFrom).color : '#999'};
 										fontSize: ${ JSON.parse(chartInfo.SourcesFrom).fontSize }px;
 									`"
-									>数据来源:{{ JSON.parse(chartInfo.SourcesFrom).text}}</span>
+									>来源:{{ JSON.parse(chartInfo.SourcesFrom).text}}</span>
 								<el-switch
 									v-if="chartInfo.SourcesFrom"
 									v-model="chartInfo.SourcesFromVisable"
@@ -735,6 +735,8 @@ export default {
 						Unit: BarChartInfo ? BarChartInfo.Unit : '',
 						SourcesFromVisable: ChartInfo.SourcesFrom ? JSON.parse(ChartInfo.SourcesFrom).isShow : true
 					};
+					//处理下历史默认来源
+					this.setDefaultSourceFrom();
 
 					this.$refs.markerSectionRef.initData(ChartInfo);
 

+ 58 - 17
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -306,7 +306,7 @@ export default {
 				}
 				
 				//默认来源搞一下
-				this.setDefaultSourceFrom(ChartInfo);
+				this.setDefaultSourceFrom();
 			})
 		},
 
@@ -592,7 +592,7 @@ export default {
 				}
 
 				//默认来源搞一下
-				this.setDefaultSourceFrom(ChartInfo);
+				this.setDefaultSourceFrom();
 			})
 		},
 
@@ -761,6 +761,7 @@ export default {
 
 				this.tableData[index].ChartWidth = themeOpt.lineOptions.lineWidth;
 			})
+
 		},
 
 		/* 获取主题列表  type init时重新设置默认样式和主题*/
@@ -781,14 +782,66 @@ export default {
 		/* 改变主题时 */
 		changeThemeHandle() {
 			this.chartInfo.ChartThemeStyle = this.chartThemeArr.find(_ => _.ChartThemeId===this.chartInfo.ChartThemeId).Config;
-			this.resetChartEdbDefault()
-			
+
+			//重置指标样式
+			this.resetChartEdbDefault();
+
+			//重置标识线区来源样式
+			this.resetMarkerThemeStyle();
+
 			this.reLoadChartOption();
 		},
 
+		//切换主题重置标示线,区,来源,说明等配置样式
+		resetMarkerThemeStyle() {
+			let themeOpt = JSON.parse(this.chartInfo.ChartThemeStyle);
+
+			if(this.chartInfo.Instructions) {
+				let instructionObj = JSON.parse(_.cloneDeep(this.chartInfo.Instructions))
+				this.chartInfo.Instructions = JSON.stringify({
+					...instructionObj,
+					color: themeOpt.markerOptions.style.color,
+      		fontSize: themeOpt.markerOptions.style.fontSize,
+				})
+
+				this.$refs.markerSectionRef&&this.$refs.markerSectionRef.initData(this.chartInfo);
+			}
+
+			if(this.chartInfo.SourcesFrom) {
+				let sourceObj = JSON.parse(_.cloneDeep(this.chartInfo.SourcesFrom))
+				this.chartInfo.SourcesFrom = JSON.stringify({
+					...sourceObj,
+					color: themeOpt.markerOptions.style.color,
+      		fontSize: themeOpt.markerOptions.style.fontSize,
+				})
+			}
+
+			if(this.chartInfo.MarkersLines&&JSON.parse(this.chartInfo.MarkersLines).length) {
+				let markerLines = JSON.parse(_.cloneDeep(this.chartInfo.MarkersLines))
+				this.chartInfo.MarkersLines = JSON.stringify(markerLines.map(_ => ({
+					..._,
+					textColor: themeOpt.markerOptions.style.color,
+          textFontSize: themeOpt.markerOptions.style.fontSize,
+				})))
+
+				this.$refs.markerSectionRef&&this.$refs.markerSectionRef.initData(this.chartInfo);
+			}
+			
+			if(this.chartInfo.MarkersAreas&&JSON.parse(this.chartInfo.MarkersAreas).length) {
+				let markerAreas = JSON.parse(_.cloneDeep(this.chartInfo.MarkersAreas))
+				this.chartInfo.MarkersAreas = JSON.stringify(markerAreas.map(_ => ({
+					..._,
+					textColor: themeOpt.markerOptions.style.color,
+          textFontSize: themeOpt.markerOptions.style.fontSize,
+				})))
+
+				this.$refs.markerSectionRef&&this.$refs.markerSectionRef.initData(this.chartInfo);
+			}
+		},
+
 		/* 更新图表标识区,标识线,图表说明 */
 		setChartMarkerInfo({ markerLinesArr,markerAreasArr,chartInstruction }) {
-			this.chartInfo.MarkersLines = JSON.stringify (markerLinesArr);
+			this.chartInfo.MarkersLines = JSON.stringify(markerLinesArr);
 			this.chartInfo.MarkersAreas = JSON.stringify(markerAreasArr);
 			this.chartInfo.Instructions = JSON.stringify(chartInstruction);
 
@@ -808,18 +861,6 @@ 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({

+ 14 - 1
src/views/dataEntry_manage/mixins/chartPublic.js

@@ -2450,6 +2450,19 @@ export const chartSetMixin = {
       })
 
       return plotBands
-    }
+    },
+
+    /* 历史图表默认显示图表来源 d毛后端不修复只能自己每次详情处理下*/
+		setDefaultSourceFrom() {
+			if(!this.chartInfo.SourcesFrom) {
+        let themeOpt = JSON.parse(this.chartInfo.ChartThemeStyle);
+				this.chartInfo.SourcesFrom = JSON.stringify({
+					isShow: true,
+					text: this.chartInfo.ChartSource,
+					color: themeOpt&&themeOpt.markerOptions.style.color,
+					fontSize: themeOpt&&themeOpt.markerOptions.style.fontSize
+				});
+			}
+		},
 	}
 }

+ 4 - 2
src/views/mychart_manage/components/chartDetailDia.vue

@@ -336,7 +336,7 @@
                     color: ${ JSON.parse(chartInfo.SourcesFrom).color };
                     fontSize: ${ JSON.parse(chartInfo.SourcesFrom).fontSize }px;
                   `"
-                  >数据来源:{{JSON.parse(chartInfo.SourcesFrom).text}}</span>
+                  >来源:{{JSON.parse(chartInfo.SourcesFrom).text}}</span>
               </div>
 
                <!-- 公历农历切换 只用于季节性图 -->
@@ -724,9 +724,11 @@ export default {
           this.refreshLoading = false;
           if (res.Ret !== 200) return;
           this.chartInfo = res.Data.ChartInfo;
-          
 
           if(this.chartInfo.Source===1) {
+            //处理下历史默认来源
+            this.setDefaultSourceFrom();
+            
             this.tableData = res.Data.EdbInfoList;
             //eta图
             this.setDefaultDateSelect(); //设置默认的日期选中

+ 35 - 3
src/views/ppt_manage/mixins/pptMixins.js

@@ -10,7 +10,7 @@ import futuresInterface from '@/api/modules/futuresBaseApi';
 import { fittingEquationInterface,statisticFeatureInterface,crossVarietyInterface } from '@/api/modules/chartRelevanceApi';
 import chartRelevanceApi from '@/api/modules/chartRelevanceApi.js';
 import { defaultOpts } from '@/utils/defaultOptions';
-import {formatPPTDate,checkPPTpageElemant,getStrSize,isShowPPTTitle,toTextProps,toJson} from '../newVersion/utils/untils.js';
+import {formatPPTDate,checkPPTpageElemant,getStrSize,isShowPPTTitle,toTextProps,toJson,rgbaToHex} from '../newVersion/utils/untils.js';
 import FormatOne from '../newVersion/components/formatPage/FormatOne.vue';
 import FormatTwo from '../newVersion/components/formatPage/FormatTwo.vue';
 import FormatThree from '../newVersion/components/formatPage/FormatThree.vue';
@@ -201,6 +201,9 @@ export default {
       this.chartInfo = Data.ChartInfo;
       if(!this.chartInfo) return
       if(this.chartInfo.Source === 1) { //常规图
+        //处理下历史默认来源
+        this.setDefaultSourceFrom();
+        
         this.dataList = Data.EdbInfoList;
         //柱形图独立数据
         this.chartInfo.ChartType === 7 && this.initBarData(res.Data);
@@ -370,6 +373,19 @@ export default {
         this.options.xAxis.title.text=this.options.xAxis.title.textEn
     },
 
+    /* 历史图表默认显示图表来源 d毛后端不修复只能自己每次详情处理下*/
+		setDefaultSourceFrom() {
+			if(!this.chartInfo.SourcesFrom) {
+        let themeOpt = JSON.parse(this.chartInfo.ChartThemeStyle);
+				this.chartInfo.SourcesFrom = JSON.stringify({
+					isShow: true,
+					text: this.chartInfo.ChartSource,
+					color: themeOpt&&themeOpt.markerOptions.style.color,
+					fontSize: themeOpt&&themeOpt.markerOptions.style.fontSize
+				});
+			}
+		},
+
     //检查图表英文配置是否完整
     checkChartEnData(){
       let result = true
@@ -510,7 +526,6 @@ export default {
      
     /* 主题样式*/
     const chartTheme =  ChartThemeStyle ? JSON.parse(ChartThemeStyle) : null;
-    console.log(chartTheme)
 
       this.$nextTick(() => {
         let is_linear = options.series 
@@ -546,7 +561,7 @@ export default {
             ...defaultOpts.legend,
             ...chartTheme&&chartTheme.legendOptions
           },
-          colors: chartTheme&&chartTheme.colorsOptions||defaultOpts.colors,
+          colors: options.colors||chartTheme&&chartTheme.colorsOptions||defaultOpts.colors,
           title: isPublish?{
             text: isShowTitle?newStr:null,
             margin:0,
@@ -913,6 +928,23 @@ export default {
 			})
 			this.setEnName = false
 		},
+
+    /* 生成ppt时图表追加底部文字 来源/说明 */
+    transChartBottomInfo({slide,x,y,width,height},data) {
+      // console.log(slide,x,y,width,height)
+      if(data.SourcesFrom&&JSON.parse(data.SourcesFrom).isShow) {
+        let sourceObj = JSON.parse(data.SourcesFrom);
+
+        slide.addText(`来源:${sourceObj.text}`,{
+          x:x,
+          y:height,
+          w:width,
+          h:20,
+          fontSize: sourceObj.fontSize,
+          color: sourceObj.color.includes('rgb') ? rgbaToHex(sourceObj.color).color.substring(1) : '666',
+        })
+      }
+    }
   },
   mounted(){
     this.getpptConfig()

+ 1 - 1
src/views/ppt_manage/newVersion/components/formatEl/ChartEl.vue

@@ -51,7 +51,7 @@
           color: ${ chartSourcesFrom.color };
           fontSize: ${ chartSourcesFrom.fontSize }px;
         `"
-        >数据来源:{{ chartSourcesFrom.text}}</span>
+        >来源:{{ chartSourcesFrom.text}}</span>
     </div>
     <!-- 图表说明 -->
     <div 

+ 14 - 1
src/views/ppt_manage/newVersion/pptEnPublish.vue

@@ -50,7 +50,7 @@
 import Cover from './components/CoverEn.vue';
 import CustomCover from './components/CustomCover.vue';
 import TransReport from './components/catalog/transReport.vue';
-import {countComponentName,pptConfigInit,toTextProps,toJson,svg2Base64,getImgRealSize,calcScale,getShapeOptions,createRandomCode,getTableData} from './utils/untils';
+import {countComponentName,pptConfigInit,toTextProps,toJson,svg2Base64,getImgRealSize,calcScale,getShapeOptions,createRandomCode,getTableData,getChartInfo} from './utils/untils';
 import {marginTop,modelConfig,pptSlideMaster,pptSlideMasterEn,pptCoverEn} from './utils/config';
 import pptmixin from '../mixins/pptMixins';
 import mixins from '../mixins/mixins';
@@ -149,6 +149,19 @@ export default {
         for(let i=0;i<this.pageList.length;i++){
           await this.initPageElements(this.pageList[i],'show')
         }
+
+        //获取已加载图表的信息
+        let chartInfoMap = {}
+        for(let i=0;i<this.pageList.length;i++){
+          this.pageList[i].elements.forEach(item=>{
+            if(item.type==='chart'){
+              let temp = getChartInfo(this.optionMap[item.chartId])
+              chartInfoMap[item.chartId] = temp
+            }
+          })
+        }
+        this.$store.commit('SET_CHART_INFO_MAP',chartInfoMap)
+
         this.dataLoading.close();
         $('.ppt-item').css('background-image',`url(${this.pptBgImage})`);
       }

+ 18 - 2
src/views/ppt_manage/newVersion/pptPublish.vue

@@ -59,7 +59,7 @@ import Cover from './components/Cover.vue';
 import CustomCover from './components/CustomCover.vue';
 import TransReport from './components/catalog/transReport.vue';
 //import {pageList} from './utils/mock';
-import {countComponentName,pptConfigInit,toTextProps,toJson,svg2Base64,getImgRealSize,calcScale,getShapeOptions,createRandomCode,getTableData} from './utils/untils';
+import {countComponentName,pptConfigInit,toTextProps,toJson,svg2Base64,getImgRealSize,calcScale,getShapeOptions,createRandomCode,getTableData,getChartInfo} from './utils/untils';
 import {marginTop,modelConfig,pptSlideMaster} from './utils/config';
 import pptmixin from '../mixins/pptMixins';
 import mixins from '../mixins/mixins';
@@ -157,6 +157,19 @@ export default {
         for(let i=0;i<this.pageList.length;i++){
           await this.initPageElements(this.pageList[i],'show')
         }
+
+         //获取已加载图表的信息
+        let chartInfoMap = {}
+        for(let i=0;i<this.pageList.length;i++){
+          this.pageList[i].elements.forEach(item=>{
+            if(item.type==='chart'){
+              let temp = getChartInfo(this.optionMap[item.chartId])
+              chartInfoMap[item.chartId] = temp
+            }
+          })
+        }
+        this.$store.commit('SET_CHART_INFO_MAP',chartInfoMap)
+
         this.dataLoading.close();
         $('.ppt-item').css('background-image',`url(${this.pptBgImage})`);
       }else{
@@ -285,7 +298,7 @@ export default {
             this.pageList[i].modelId,
             elements[j].position
           );
-          if (imgData) {
+          if (imgData) { //图表
             if(this.transChartType===1){
               slide.addImage({
                 path:imgData,
@@ -305,6 +318,9 @@ export default {
                 size: { type: "contain" },
               });
             }
+
+            //追加生成图表底部文字
+            this.transChartBottomInfo({slide,x,y,width,height},this.optionMap[this.pageList[i].elements[j].chartId])
             
           }else if (textData){
             slide.addText(textData,{