cxmo 9 сар өмнө
parent
commit
8327a434ac

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

@@ -205,7 +205,8 @@
             <el-collapse-item v-for="(item,index) in tableData" :key="item.EdbInfoId" :disabled="[2,5].includes(chartInfo.ChartType)">
               <template slot="title">
                 <span class="text_oneLine">{{currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName}}</span>
-								<i class="el-icon-delete del-icon" @click.stop="delTarget(item)"></i>
+								<!-- 当为季节性图的第二个轴时,隐藏删除按钮 -->
+								<i class="el-icon-delete del-icon" @click.stop="delTarget(item)" v-if="!(chartInfo.ChartType===2&&index===1)"></i>
               </template>
               <ul class="setting-cont" v-if="sameOptionType.includes(chartInfo.ChartType)">
 
@@ -360,6 +361,7 @@
 						@update="setChartMarkerInfo"
 						@updateSeason="updateSeasonChart"
 						@previewSeason="previewSeasonChart"
+						@previewSeasonRight="previewSeasonRight"
 					/>
         </div>
 

+ 7 - 3
src/views/dataEntry_manage/components/addRightEdbDialog.vue

@@ -102,8 +102,8 @@
                 <!-- 如果选择左轴同比 -->
                 <el-form-item label="数字格式" v-if="rightEdbForm.IndicatorType===1">
                     <el-radio-group v-model="rightEdbForm.NumFormat">
-                        <el-radio :label="0">百分数</el-radio>
-                        <el-radio :label="1">小数</el-radio>
+                        <el-radio :label="1">百分数</el-radio>
+                        <el-radio :label="2">小数</el-radio>
                     </el-radio-group>
                 </el-form-item>
                 <!-- 如果选择标记点 -->
@@ -154,6 +154,8 @@
 </template>
 
 <script>
+import { dataBaseInterface } from '@/api/api.js';
+import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
 import { defaultOpts } from '@/utils/defaultOptions';
 import { markTypesOpts,lineStylesOpts } from '@/views/system_manage/chartTheme/common/config'
 export default {
@@ -170,6 +172,8 @@ export default {
     },
     data() {
         return {
+            current_search:'',
+            search_txt:'',
             rightEdbForm:{
                 IndicatorType:1,//1左轴同比 2指标库 3预测指标
                 Style:'column',//生成样式 column/mark
@@ -200,7 +204,7 @@ export default {
                 KeyWord:query,
                 CurrentIndex: page,
             }
-            const res = this.edbFromType === 0
+            const res = this.rightEdbForm.IndicatorType === 2
                 ? await dataBaseInterface.targetSearchByPage(params)
                 : await preDictEdbInterface.edbSearch(params)
 

+ 87 - 3
src/views/dataEntry_manage/components/markersSection.vue

@@ -433,13 +433,97 @@ export default {
     },
     //添加右轴指标
     addRightEdb(form){
-        //mock
-        
+        //mock tableData
+        const mockTableData = {
+            Unit:"",//若数字格式为百分数,这里有值%
+            UnitEn:"无",//同上
+            DataList:[
+                {
+                    "DataTimestamp": 1706486400000, //1.29
+                    "Value": -0.2015
+                },{
+                    "DataTimestamp": 1708905600000, //2.26
+                    "Value": -0.1998
+                },{
+                    "DataTimestamp": 1711843200000,//3.31
+                    "Value": -0.407
+                },{
+                    "DataTimestamp": 1714435200000,//4.30
+                    "Value": -0.1553
+                },{
+                    "DataTimestamp": 1717113600000,//5.31
+                    "Value": -0.1208
+                },
+                {
+                    "DataTimestamp": 1719705600000,//6.30
+                    "Value": -0.0092
+                },
+                {
+                    "DataTimestamp": 1722297600000,//7.30
+                    "Value": 0.2432
+                },
+                {
+                    "DataTimestamp": 1725062400000,//8.31
+                    "Value": 0.1005
+                },
+                {
+                    "DataTimestamp": 1727654400000,//9.30
+                    "Value": 0.3251
+                },
+                {
+                    "DataTimestamp": 1730160000000,//10.29
+                    "Value": 0.3751
+                },{
+                    "DataTimestamp": 1732924800000,//11.30
+                    "Value": 1.1125
+                },{
+                    "DataTimestamp": 1735603200000,//12.31
+                    "Value": 0.9805
+                },
+            ],//需要展示在页面的数据
+            "IsAxis":0,//0为右轴
+            "EdbInfoId":123456,
+            "SourceName":"同比值",
+            "Source":6,
+            "SubSource":0,
+            "EdbCode":"C2407010950156183",
+            "EdbName":"杭州螺纹价格2同比",
+            "EdbAliasName":"杭州螺纹价格2同比",
+            "EdbNameEn":"杭州螺纹价格2同比",
+            "EdbAliasNameEn":"",
+            "EdbType":2,
+            "Frequency":"日度",
+            "FrequencyEn":"day",
+            "StartDate":"2007-04-24",
+            "EndDate":"2024-05-08",
+            "ModifyTime":"2024-07-01 09:50:17",
+            "ChartEdbMappingId":0,
+            "ChartInfoId":0,
+            "MaxData":1.1125,
+            "MinData":-0.407,
+            "IsOrder":false,
+            "EdbInfoType":1,
+            "EdbInfoCategoryType":0,
+            "PredictChartColor":"rgba(102, 255, 0, 1)",
+            "ChartWidth":2,
+            "ChartType":0,
+            "LatestDate":"2024-05-08",
+            "LatestValue":-0.0419,
+            "MoveLatestDate":"2024-05-08",
+            "UniqueCode":"0494dabcba3885d03b4dedbb0dc8e594",
+            "ChartStyle":"line",
+            "ChartColor":"rgba(102, 255, 0, 1)",
+        }
+        Object.assign(this.rightEdbForm,form)
+        this.rightEdbForm.IsAdd = true
+        this.rightEdbForm.IsShow = true
+        this.isAddRightEdbDialogShow = false
+        this.$emit('previewSeasonRight',{rightConfig:this.rightEdbForm,tableData:mockTableData})
     },
     //取消添加右轴指标
     deleteRightEdb(){
         Object.assign(this.rightEdbForm,baseRightForm)
-        this.previewSeason('previewSeason')
+        this.$emit('previewSeasonRight',{rightConfig:form,tableData:{"EdbInfoId":123456,}})
     },
     //更新季节性图 同期/右轴
     //预览图表

+ 14 - 0
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -1137,6 +1137,20 @@ export default {
 			})
 
 		},
+		//预览季节性图右轴
+		previewSeasonRight({rightConfig,tableData}){
+			this.chartInfo.SearonRightConfig = rightConfig
+			if(rightConfig.IsAdd){
+				this.tableData.push(tableData)
+				const tempItem = this.formatUpdateData(tableData)
+				this.updateData.push(tempItem) //只有一个指标,不需要去计算上下限,直接取max minvalue
+				this.chartLimit.rightMin = tableData.MinData
+				this.chartLimit.rightMax = tableData.MaxData
+			}else{
+				this.delTarget(tableData)
+			}
+			this.reLoadChartOption()
+		},
 		//获取图表全局设置
 		async getChartBaseSetting(){
 			//目前是用基本配置的接口,后续有多个配置再改

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

@@ -1084,7 +1084,7 @@ export const chartSetMixin = {
     setSeasonChart(newval) {
       /* 季节性图的图表配置 */
       this.leftIndex = 0;
-      this.rightIndex = -1;
+      this.rightIndex = newval[1]?1:-1;
       this.rightTwoIndex = -1;
       const chartData = newval[0];
       // 农历数据需要去除第一项  农历和公历处理逻辑一样
@@ -1106,13 +1106,23 @@ export const chartSetMixin = {
         //获取对应轴的上下限
         //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
         const useTableLimit = ['/predictEdb','/chartThemeSet','/addpredictEdb','/editpredictEdb','/viewBalanceSheet','/editBalanceSheet'].includes(this.$route.path)
-        let minLimit = 0,maxLimit = 0
+        let minLimit = 0,maxLimit = 0,rightMin=0,rightMax=0
         if(useTableLimit){
             minLimit = chartData.MinData
             maxLimit = chartData.MaxData
+            //加上右轴
+            if(this.rightIndex!=-1){
+                rightMin = newval[1].MinData
+                rightMax = newval[1].MaxData
+            }
         }else{
             minLimit = this.chartLimit.min||0
             maxLimit = this.chartLimit.max||0
+            //加上右轴
+            if(this.rightIndex!=-1){
+                rightMin = this.chartLimit.rightMin||0
+                rightMax = this.chartLimit.rightMax||0
+            }
         }
 
       //数据列-常规左轴
@@ -1185,8 +1195,28 @@ export const chartSetMixin = {
         seasonData.push(serieItem)
       }
       //数据列-右轴
-      if(newval[1]){
+      const {SearonRightConfig} = this.chartInfo
+      if(newval[1]&&SearonRightConfig.IsShow){
         //右轴的设置
+        let serieItem = {
+            type:'line',
+            data:[],
+            name:SearonRightConfig.Legend||'右轴test',
+            lineWidth:SearonRightConfig.LineWidth,
+            dashStyle:SearonRightConfig.LineStyle,
+            color:SearonRightConfig.LineColor,
+            marker:SearonRightConfig.Style==='mark'?{
+                enabled:true,
+                symbol:SearonRightConfig.Shape,
+                fillColor:SearonRightConfig.ChartColor,
+                radius:SearonRightConfig.Size
+            }:{},
+            yAxis:1,
+        }
+        newval[1].DataList.forEach(item=>{
+            serieItem.data.push([item.DataTimestamp,item.Value])
+        })
+        seasonData.push(serieItem)
       }
 
       //y轴
@@ -1225,6 +1255,37 @@ export const chartSetMixin = {
         plotBands: this.setAxisPlotAreas(1),
         plotLines: this.setAxisPlotLines(1)
       }];
+      //如果有右轴,加上右轴
+      if(newval[1]&&SearonRightConfig.IsShow){
+        seasonYdata.push({
+            ...seasonOptions.yAxis,
+            opposite: true,//右轴
+            labels: {
+                formatter: function () {
+                  let val = this.value;
+                  return val;
+                },
+                align: 'center',
+                style: {
+                  ...chartTheme&&chartTheme.yAxisOptions.style
+                }
+              },
+              title: {
+                text: SearonRightConfig.Legend||'右轴',
+                style:{
+                  ...chartTheme&&chartTheme.yAxisOptions.style
+                },
+                align: 'high',
+                rotation: 0,
+                y: -12,
+                x: -newval[1].Unit.length*12 ,
+                textAlign: 'right',
+                reserveSpace: false,
+              },
+              max: Number(rightMax),
+              min: Number(rightMin),
+        })
+      }
 
       /* x轴显示月日 */
       const xAxis = {