소스 검색

Merge branch 'eta1.4.1_1.1'

Karsa 1 년 전
부모
커밋
b6a7d9a563

+ 4 - 2
src/utils/defaultOptions.js

@@ -81,7 +81,9 @@ export const defaultOpts = {
 	legend: {
 		enabled: true,
 		verticalAlign: 'top',
-		margin:5,
+		margin:12,
+		itemMarginBottom:0,
+		itemMarginTop: 0
 		// layout: 'vertical'
 	},
 	//滚动条
@@ -200,7 +202,7 @@ export const copyOtherOptions = {
 			color: '#444',
 			textOverflow:undefined
 		},
-		itemMarginBottom:5,
+		itemMarginBottom:0,
 		itemDistance: 0,
 		padding: 0,
 		margin: 10

+ 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;
       // 设置起始日期和最新日期

+ 6 - 6
src/views/dataEntry_manage/components/markersSection.vue

@@ -67,7 +67,7 @@
       <div
         class="add-cont"
         v-if="!chartInstruction.text"
-        @click="addChartInductionHandle"
+        @click="addChartInductionHandle('add')"
       >
         <img
           src="~@/assets/img/set_m/add_ico.png"
@@ -155,8 +155,8 @@ export default {
       chartInstruction:{
         text: '',
         isShow: true,
-        color: this.chartInfo.ChartThemeStyle?JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.color:'#333',
-        fontSize: this.chartInfo.ChartThemeStyle?JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.fontSize:12
+        color: '',
+        fontSize: ''
       } ,
 
       /* 标识线区弹窗 */
@@ -213,13 +213,13 @@ export default {
       this.updateChartHandle()
     },
 
-    addChartInductionHandle() {
+    addChartInductionHandle(type='') {
       const { text,color,fontSize } = this.chartInstruction;
       this.chartInductionDiaForm = {
         show: true,
         text,
-        color,
-        fontSize
+        color:type==='add'?JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.color:color,
+        fontSize: type==='add'?JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.fontSize:fontSize
       }
     },
 

+ 12 - 6
src/views/dataEntry_manage/databaseComponents/chartTrendRender.vue

@@ -505,8 +505,10 @@ export default {
 					text: yTitleText,
 					align: 'high',
 					rotation: 0,
-					y: -15,
-					offset: 0,
+					y: -12,
+					x: 0,
+					textAlign: 'left',
+					reserveSpace: false,
 					style:yTitleStyle
 				},
 				labels: {
@@ -607,8 +609,10 @@ export default {
 							!this.chartInfo.UnitEn && this.chartInfo.Unit && this.chartInfo.Unit!='无' ? '英文单位':this.chartInfo.UnitEn,
               align: 'high',
               rotation: 0,
-              y: -15,
-              offset: -(12 * this.chartInfo.Unit.length),
+							y: -12,
+							x: 0,
+							textAlign: 'left',
+							reserveSpace: false,
             },
             max: Number(this.chartInfo.MaxValue),
             min: Number(this.chartInfo.MinValue),
@@ -648,8 +652,10 @@ export default {
 							!this.chartInfo.UnitEn && this.chartInfo.Unit && this.chartInfo.Unit!='无' ? '英文单位':this.chartInfo.UnitEn,
               align: 'high',
               rotation: 0,
-              y: -15,
-              offset: -(12 * this.chartInfo.Unit.length),
+              y: -12,
+							x: 0,
+							textAlign: 'left',
+							reserveSpace: false,
             },
             max: Number(this.chartInfo.MaxValue),
             min: Number(this.chartInfo.MinValue),

+ 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);
 

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

@@ -288,6 +288,10 @@ export default {
 				if(res.Ret !== 200) return
 
 				const { EdbInfoList,XEdbIdValue,YDataList,ChartInfo } = res.Data;
+				this.chartInfo = {
+					...this.chartInfo,
+					ChartSource: ChartInfo.ChartSource
+				}
 
 				let xData = XEdbIdValue.map(_ => EdbInfoList.find(edb => edb.EdbInfoId===_).EdbAliasName)
 
@@ -306,7 +310,7 @@ export default {
 				}
 				
 				//默认来源搞一下
-				this.setDefaultSourceFrom(ChartInfo);
+				this.setDefaultSourceFrom();
 			})
 		},
 
@@ -575,6 +579,10 @@ export default {
 				if(res.Ret !== 200) return
 				
 				const { EdbInfoList,DataResp,ChartInfo } = res.Data;
+				this.chartInfo = {
+					...this.chartInfo,
+					ChartSource: ChartInfo.ChartSource
+				}
 
 				this.sectionScatterData = DataResp;
 				this.tableData = EdbInfoList;
@@ -592,7 +600,7 @@ export default {
 				}
 
 				//默认来源搞一下
-				this.setDefaultSourceFrom(ChartInfo);
+				this.setDefaultSourceFrom();
 			})
 		},
 
@@ -761,6 +769,7 @@ export default {
 
 				this.tableData[index].ChartWidth = themeOpt.lineOptions.lineWidth;
 			})
+
 		},
 
 		/* 获取主题列表  type init时重新设置默认样式和主题*/
@@ -781,14 +790,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 +869,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

@@ -2445,6 +2445,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(); //设置默认的日期选中

+ 51 - 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';
@@ -202,6 +202,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);
@@ -371,6 +374,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
@@ -511,7 +527,6 @@ export default {
      
     /* 主题样式*/
     const chartTheme =  ChartThemeStyle ? JSON.parse(ChartThemeStyle) : null;
-    console.log(chartTheme)
 
       this.$nextTick(() => {
         let is_linear = options.series 
@@ -547,7 +562,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,
@@ -914,6 +929,39 @@ export default {
 			})
 			this.setEnName = false
 		},
+
+    /* 生成ppt时图表追加底部文字 来源/说明 */
+    transChartBottomInfo(slide,{x,y,width,height},data) {
+      let chartData = data;
+      let yPercent = Number(Math.ceil(height.replace(/%/,''))+Math.ceil(y.replace(/%/,'')))+'%';
+      // console.log(yPercent)
+
+      if(chartData.SourcesFrom&&JSON.parse(chartData.SourcesFrom).isShow) {
+        let sourceObj = JSON.parse(chartData.SourcesFrom);
+        slide.addText(`来源:${sourceObj.text}`,{
+          x:x,
+          y: yPercent,
+          w: width,
+          margin:10,
+          fontSize: sourceObj.fontSize*0.75,
+          color: sourceObj.color.includes('rgb') ? rgbaToHex(sourceObj.color).color.substring(1) : sourceObj.color.indexOf('#')===0 ? sourceObj.color.substring(1): '666',
+        })
+      }
+
+      if(chartData.Instructions&&JSON.parse(chartData.Instructions).isShow) {
+        let instructObj = JSON.parse(chartData.Instructions);
+
+        slide.addText(instructObj.text,{
+          x:x,
+          y: yPercent,
+          w: width,
+          align:'right',
+          margin:10,
+          fontSize: instructObj.fontSize*0.75,
+          color: instructObj.color.includes('rgb') ? rgbaToHex(instructObj.color).color.substring(1) : instructObj.color.indexOf('#')===0 ? instructObj.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 

+ 17 - 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})`);
       }
@@ -293,6 +306,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,{

+ 18 - 3
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,pptInit,rgbaToHex } 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,7 +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,{
               x:x,