ソースを参照

右轴为选取指标时参数更改,校验

cxmo 11 ヶ月 前
コミット
805746d121

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

@@ -358,6 +358,7 @@
 						v-if="tableData.length"
 						ref="markerSectionRef"
 						:chartInfo="chartInfo"
+						:tableData="tableData"
 						@update="setChartMarkerInfo"
 						@updateSeason="updateSeasonChart"
 						@previewSeason="previewSeasonChart"

+ 237 - 167
src/views/dataEntry_manage/components/addMarkerDialog.vue

@@ -6,7 +6,7 @@
 		@close="cancelHandle"
 		custom-class="marker-edit-dialog"
 		center
-		width="650px"
+		width="750px"
 		v-dialogDrag
     top="8vh"
     :title="form.title"
@@ -35,10 +35,10 @@
           <el-form-item :label="form.markerType==='line'?$t('EtaChartAddPage.label_line_scale'):$t('EtaChartAddPage.label_area_scale')" prop="value">
             <!-- 标识线 -->
             <template v-if="form.markerType==='line'">
-              <div class="mark-value-wrap">
+              <div class="mark-value-wrap form-item-content">
                 <!-- 固定值:原标识线输入框 -->
                 <div class="default-value">
-                    <!-- <el-radio v-model="radio" label="固定值"></el-radio> -->
+                    <el-radio v-model="radio" label="固定" style="margin-right: 20px;"></el-radio>
                     <!-- 时间轴1,2,4,6的y轴数字 x轴日期  -->
                     <template v-if="[1,2,4,6].includes(chartInfo.ChartType)">
                         <el-date-picker
@@ -46,7 +46,7 @@
                             v-model="markerForm.value"
                             :popper-class="{'month-day-picker':chartInfo.ChartType===2}"
                             type="date"
-                            style="width: 200px;"
+                            style="width: 100px;"
                             :placeholder="$t('EtaChartAddPage.label_date_choose')"
                             :clearable="false"
                             :format="chartInfo.ChartType===2?'MM-dd':'yyyy-MM-dd'"
@@ -57,7 +57,7 @@
                             v-else
                             v-model="markerForm.value"
                             class="number-input"
-                            style="width: 200px;"
+                            style="width: 100px;"
                             type="number"
                             :placeholder="$t('Edb.InputHolderAll.input_number')"
                         />
@@ -67,7 +67,7 @@
                     <template v-else-if="[5,7,10].includes(chartInfo.ChartType)">
                         <el-input
                             v-model="markerForm.value"
-                            style="width: 200px;"
+                            style="width: 100px;"
                             type="number"
                             class="number-input"
                             :placeholder="$t('Edb.InputHolderAll.input_number')"
@@ -76,9 +76,9 @@
                     </template>
                 </div>
                 <!-- 指标计算 -->
-                <!-- <div class="custom-value">
-                    <el-radio v-model="radio" label="指标计算"></el-radio>
-                </div> -->
+                <div class="custom-value">
+                    <el-radio v-model="radio" label="指标计算" style="margin-left: 20px;"></el-radio>
+                </div>
               </div>
             </template>
 
@@ -156,170 +156,186 @@
           <div class="custom-value-setting-wrap" v-if="form.markerType==='line'&&radio==='指标计算'">
             <!-- 指标选择 -->
             <el-form-item label="指标">
-                <!-- 固定第一个指标 -->
-                <div class="fixed-edb">
-                    <el-radio v-model="fixed" label="图上第一个指标"></el-radio>
-                    <p>指标名称指标名称</p>
-                </div>
-                <!-- 指标/预测指标库的指标 -->
-                <div class="other-edb">
-                    <el-radio v-model="fixed" label="其他指标"></el-radio>
-                    <el-input
-                            v-model="markerForm.fixed"
-                            style="width: 200px;"
-                            placeholder="请选择指标名称"
-                            clearable
-                        />
+                <div class="edb-box-wrap form-item-content">
+                    <!-- 固定第一个指标 -->
+                    <div class="fixed-edb">
+                        <el-radio v-model="markerExtraConfig.edbType" :label="1">图上第一个指标</el-radio>
+                        <p>指标名称指标名称</p>
+                    </div>
+                    <!-- 指标/预测指标库的指标 -->
+                    <div class="other-edb">
+                        <el-radio v-model="markerExtraConfig.edbType" :label="2" style="margin-right: 20px;">其他指标</el-radio>
+                        <!-- /datamanage/edb_info/filter_by_es/all -->
+                        <el-input
+                                v-model="markerForm.fixed"
+                                style="width: 200px;"
+                                placeholder="请选择指标名称"
+                                clearable
+                            />
+                    </div>
                 </div>
             </el-form-item>
             <!-- 时间区间选择 -->
             <el-form-item label="时间区间">
-
+                <div class="time-area-wrap">
+                    <el-radio v-model="markerExtraConfig.timeInterval" :label="0">跟随图表</el-radio>
+                    <el-radio v-model="markerExtraConfig.timeInterval" :label="1">自定义</el-radio>
+                </div>
             </el-form-item>
-            <!-- 自定义时间区间选择 -->
-            <!-- 起始时间 -->
-            <el-form-item label="起始时间">
-                <div class="fixed-time">
-                    <el-radio v-model="fixedTime" label="固定"></el-radio>
-                    <el-date-picker
-                        v-model="markerForm.fixedTime"
-                        type="date"
-                        style="width: 200px;"
-                        placeholder="请输入固定时间"
-                        :clearable="false"
-                        format="yyyy-MM-dd"
-                        value-format="yyyy-MM-dd"
-                    ></el-date-picker>
+            <!-- 如果时间区间选择自定义 -->
+            <div class="custom-time-wrap" v-if="markerExtraConfig.timeInterval===1">
+                <!-- 起始时间 -->
+                <el-form-item label="起始时间">
+                    <div class="form-item-content">
+                        <div class="fixed-time">
+                            <el-radio v-model="fixedTime" label="固定" style="margin-right: 20px;"></el-radio>
+                            <el-date-picker
+                                v-model="markerForm.fixedTime"
+                                type="date"
+                                style="width: 100px;"
+                                placeholder="请输入固定时间"
+                                :clearable="false"
+                                format="yyyy-MM-dd"
+                                value-format="yyyy-MM-dd"
+                            ></el-date-picker>
+                        </div>
+                        <div class="custom-time">
+                            <el-radio v-model="fixedTime" label="动态" style="margin-left:20px;margin-right:5px"></el-radio>
+                            <el-tooltip effect="dark" content="说明说明" placement="top">
+                                <i class="el-icon-question" style="font-size: 16px;"></i>
+                            </el-tooltip>
+                        </div>
+                    </div>
+                    
+                </el-form-item>
+                <!-- 起始时间为动态 -->
+                <div class="start-time-custom-wrap">
+                    <!-- 基准日期 -->
+                    <el-form-item label="基准日期">
+                        <el-radio v-model="startTimeSetting" label="系统日期"></el-radio>
+                        <div class="edb-new-date">
+                            <el-radio v-model="startTimeSetting" label="指标最新日期"></el-radio>
+                            <p>期数前移<el-input style="width:80px"></el-input>期</p>
+                        </div>
+                    </el-form-item>
+                    <!-- 日期变换 -->
+                    <el-form-item label="日期变换">
+                        <div class="select-box">
+                            <el-select v-model="selectDate">
+                                <el-option label="指定频率"></el-option>
+                                <el-option label="日期位移"></el-option>
+                            </el-select>
+                            <el-button>添加</el-button>
+                        </div>
+                        <div class="select-list">
+                            <!-- 日期位移 [] 天 [] 月 [] 年 -->
+                        </div>
+                    </el-form-item>
                 </div>
-                <div class="custom-time">
-                    <el-radio v-model="fixedTime" label="动态"></el-radio>
-                    <p>说明说明</p>
+                
+                <!-- 结束时间 -->
+                <el-form-item label="结束时间">
+                    <el-radio v-model="fixedTime" label="至今"></el-radio>
+                    <div class="fixed-time">
+                        <el-radio v-model="fixedTime" label="固定"></el-radio>
+                        <el-date-picker
+                            v-model="markerForm.fixedTime"
+                            type="date"
+                            style="width: 200px;"
+                            placeholder="请输入固定时间"
+                            :clearable="false"
+                            format="yyyy-MM-dd"
+                            value-format="yyyy-MM-dd"
+                        ></el-date-picker>
+                    </div>
+                    <div class="custom-time">
+                        <el-radio v-model="fixedTime" label="动态"></el-radio>
+                        <p>说明说明</p>
+                    </div>
+                </el-form-item>
+                <!-- 结束时间为动态 -->
+                <div class="end-time-custom-wrap">
+                    <!-- 结束时间-基准日期 -->
+                    <!-- 结束日期日期变换 -->
                 </div>
+            </div>
+            <!-- 计算方式选择 -->
+          </div>
+
+          <!-- 标识线样式 可收起 -->
+          <div class="mark-box" @click="isMarkStyleShow = !isMarkStyleShow;">
+            <span></span><span>样式</span>
+          </div>
+          <div class="mark-style-wrap" v-show="isMarkStyleShow">
+            <el-form-item :label="$t('EtaChartAddPage.label_line_sty')" prop="dashStyle" v-if="form.markerType==='line'">
+                <el-select 
+                v-model="markerForm.dashStyle"
+                style="width:200px;"
+                >
+                <el-option 
+                    v-for="item in dashOptions" 
+                    :key="item.value" 
+                    :label="item.label" 
+                    :value="item.value"
+                >
+                    <svg width="60" height="10" viewBox="0 0 60 10" fill="none" xmlns="http://www.w3.org/2000/svg" v-html="item.svg"></svg>
+                </el-option>
+                </el-select>
             </el-form-item>
-            <!-- 起始时间为动态 -->
-            <!-- 基准日期 -->
-            <el-form-item label="基准日期">
-                <el-radio v-model="startTimeSetting" label="系统日期"></el-radio>
-                <div class="edb-new-date">
-                    <el-radio v-model="startTimeSetting" label="指标最新日期"></el-radio>
-                    <p>期数前移<el-input style="width:80px"></el-input>期</p>
-                </div>
+            <el-form-item :label="$t('Chart.Detail.color')" prop="color" style="margin-bottom:8px;">
+                <el-color-picker
+                v-model="markerForm.color"
+                :predefine="predefineColors"
+                show-alpha
+                style="width: 90px"
+                />
             </el-form-item>
-            <!-- 基准日期为系统日期 -->
-            <!-- 日期变换 -->
-            <el-form-item label="日期变换">
-                <div class="select-box">
-                    <el-select v-model="selectDate">
-                        <el-option label="指定频率"></el-option>
-                        <el-option label="日期位移"></el-option>
-                    </el-select>
-                    <el-button>添加</el-button>
-                </div>
-                <div class="select-list">
-                    <!-- 日期位移 [] 天 [] 月 [] 年 -->
-                </div>
+            <el-form-item :label="$t('Chart.Detail.size')" prop="lineWidth" v-if="form.markerType==='line'">
+                <el-input
+                v-model="markerForm.lineWidth"
+                style="width: 90px"
+                type="number"
+                :min="1"
+                />
             </el-form-item>
-            <!-- 结束时间 -->
-            <el-form-item label="结束时间">
-                <el-radio v-model="fixedTime" label="至今"></el-radio>
-                <div class="fixed-time">
-                    <el-radio v-model="fixedTime" label="固定"></el-radio>
-                    <el-date-picker
-                        v-model="markerForm.fixedTime"
-                        type="date"
-                        style="width: 200px;"
-                        placeholder="请输入固定时间"
-                        :clearable="false"
-                        format="yyyy-MM-dd"
-                        value-format="yyyy-MM-dd"
-                    ></el-date-picker>
-                </div>
-                <div class="custom-time">
-                    <el-radio v-model="fixedTime" label="动态"></el-radio>
-                    <p>说明说明</p>
-                </div>
+            <el-form-item :label="form.markerType==='line'?$t('EtaChartAddPage.label_line_intru'):$t('EtaChartAddPage.label_area_intru')" prop="text">
+                <el-input
+                v-model="markerForm.text"
+                style="width: 200px"
+                :placeholder="$t('Chart.InputHolderAll.input_content')"
+                />
+            </el-form-item>
+            <el-form-item :label="$t('EtaChartAddPage.label_text_pos')" prop="textPosition">
+                <el-select 
+                v-model="markerForm.textPosition"
+                style="width:200px;"
+                >
+                <el-option 
+                    v-for="item in verticalPositions" 
+                    :key="item.value" 
+                    :label="item.label" 
+                    :value="item.value"
+                />
+                </el-select>
+            </el-form-item>
+            <el-form-item :label="$t('EtaChartAddPage.label_text_color')" prop="textColor" style="margin-bottom:8px;">
+                <el-color-picker
+                v-model="markerForm.textColor"
+                show-alpha
+                :predefine="predefineColors"
+                style="width: 90px"
+                />
+            </el-form-item>
+            <el-form-item :label="$t('EtaChartAddPage.label_text_size')" prop="textFontSize">
+                <el-input
+                v-model="markerForm.textFontSize"
+                class="number-input"
+                style="width: 90px"
+                type="number"
+                :min="1"
+                />
             </el-form-item>
-            <!-- 结束时间为动态 -->
-            <!-- 结束时间-基准日期 -->
-            <!-- 基准日期为系统时间 -->
-            <!-- 结束日期基准日期-日期变换 -->
-            
-            <!-- 计算方式选择 -->
           </div>
-
-
-
-
-
-
-          <el-form-item :label="$t('EtaChartAddPage.label_line_sty')" prop="dashStyle" v-if="form.markerType==='line'">
-            <el-select 
-              v-model="markerForm.dashStyle"
-              style="width:200px;"
-            >
-              <el-option 
-                v-for="item in dashOptions" 
-                :key="item.value" 
-                :label="item.label" 
-                :value="item.value"
-              >
-                <svg width="60" height="10" viewBox="0 0 60 10" fill="none" xmlns="http://www.w3.org/2000/svg" v-html="item.svg"></svg>
-              </el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item :label="$t('Chart.Detail.color')" prop="color" style="margin-bottom:8px;">
-            <el-color-picker
-              v-model="markerForm.color"
-              :predefine="predefineColors"
-              show-alpha
-              style="width: 90px"
-            />
-          </el-form-item>
-          <el-form-item :label="$t('Chart.Detail.size')" prop="lineWidth" v-if="form.markerType==='line'">
-            <el-input
-              v-model="markerForm.lineWidth"
-              style="width: 90px"
-              type="number"
-              :min="1"
-            />
-          </el-form-item>
-          <el-form-item :label="form.markerType==='line'?$t('EtaChartAddPage.label_line_intru'):$t('EtaChartAddPage.label_area_intru')" prop="text">
-            <el-input
-              v-model="markerForm.text"
-              style="width: 200px"
-              :placeholder="$t('Chart.InputHolderAll.input_content')"
-            />
-          </el-form-item>
-          <el-form-item :label="$t('EtaChartAddPage.label_text_pos')" prop="textPosition">
-            <el-select 
-              v-model="markerForm.textPosition"
-              style="width:200px;"
-            >
-              <el-option 
-                v-for="item in verticalPositions" 
-                :key="item.value" 
-                :label="item.label" 
-                :value="item.value"
-              />
-            </el-select>
-          </el-form-item>
-          <el-form-item :label="$t('EtaChartAddPage.label_text_color')" prop="textColor" style="margin-bottom:8px;">
-            <el-color-picker
-              v-model="markerForm.textColor"
-              show-alpha
-              :predefine="predefineColors"
-              style="width: 90px"
-            />
-          </el-form-item>
-          <el-form-item :label="$t('EtaChartAddPage.label_text_size')" prop="textFontSize">
-            <el-input
-              v-model="markerForm.textFontSize"
-              class="number-input"
-              style="width: 90px"
-              type="number"
-              :min="1"
-            />
-          </el-form-item>
       </el-form>
     </div>
 
@@ -331,6 +347,7 @@
   </el-dialog>
 </template>
 <script>
+import dateMoveWaySec from '@/views/datasheet_manage/components/dateMoveWaySection.vue'
 import { defaultOpts } from '@/utils/defaultOptions';
 import { verticalPositions } from '@/views/system_manage/chartTheme/common/config';
 export default {
@@ -350,7 +367,9 @@ export default {
     chartInfo: {
       type:Object
     }
-
+  },
+  components:{
+    dateMoveWaySec
   },
   watch: {
     isShow(nval) {
@@ -370,8 +389,8 @@ export default {
           axis: this.canSelectLeftYaxis?1:0,
           axisName:this.axisLabelMap[this.canSelectLeftYaxis?1:0],
           value: '',
-          from: '',
-          to:'',
+          fromValue: '',
+          toValue:'',
           lineWidth: 2,
           dashStyle: 'ShortDashDot',
           color: '#999',
@@ -434,7 +453,46 @@ export default {
         text: '',
         textPosition: 'top',
         textColor: '#999',
-        textFontSize: 12
+        textFontSize: 12,
+        //markerType:'line'
+      },
+      //eta1.9.4新增标识线设置
+      markerExtraConfig:{
+        markLineType:1,//标识线所在刻度 1固定值 2指标计算
+        edbType:1,//指标 1图上第一个指标 2其他指标 -
+        edbInfo:{
+            EdbInfoId:'123456',//指标唯一标识
+            //其他可能需要存的信息
+        },//edbType选择其他指标时,有值
+        timeInterval:0,//时间区间 0跟随图表 1自定义
+        startTimeInfo:{//当timeInterval为1时,有值
+            timeType:1,//起始时间类型 1 固定 2动态
+            date:'2020-01-01',//固定的时间值,timeType为2时为空
+
+            baseTimeType:1,//基准日期 1系统日期 2指标最新日期
+            moveValue:0,//baseTimeType为2时,表示前移的期数
+            dateChangeInfo:[
+                {//和 datasheet_manage/components/dateMoveWaySection 保持一致
+                    ChangeType:1,//1日期位移 2指定频率
+                    Day: 0,
+                    Month: 0,
+                    Year: 0,
+                    Frequency: '本周',
+                    FrequencyDay: '周一'
+                }
+            ]//日期变换的值,最多两项,最少0项,
+
+        },
+        endTimeInfo:{
+            timeType:1,//起始时间类型 0至今 1 固定 2动态
+            date:'2024-01-01',//固定的时间值,timeType不为1时为空
+            baseTimeType:1,//基准日期 1系统日期 2指标最新日期
+            moveValue:0,//baseTimeType为2时,表示前移的期数
+            dateChangeInfo:[]
+        },
+        calculation:1,//计算方式 1区间均值 2区间均值+标准差 3区间百分位个数分位 4区间百分位数值分位
+        calculationValue:'',//计算方式对应值,calculatin为2时表示标准差的倍数,为3时表示个数分位的百分数
+
       },
 
       axisLabelMap: { //暂时没有横轴的代表key 规定为3好了
@@ -445,7 +503,9 @@ export default {
       },
 
       //temp mock
-      radio:'固定值'
+      radio:'固定值',
+
+      isMarkStyleShow:false,
     }
   },
   mounted(){
@@ -482,7 +542,7 @@ export default {
 </script>
 <style scoped lang='scss'>
 .main {
-  padding-left: 20%;
+  padding-left: 15%;
 }
 .bottom {
   margin: 30px 0;
@@ -494,6 +554,16 @@ export default {
 .marker-edit-dialog {
   .el-color-picker__trigger { width: 100%;padding: 0;border-radius: 4px; }
   .number-input .el-input__inner { padding: 0 2px 0 10px; }
+  .form-item-content{
+    display: flex;
+  }
+  .mark-box{
+    background-color: #EBEFF6;
+    border:1px solid #C8CDD9;
+    padding:12px;
+    cursor: pointer;
+    margin-bottom: 20px;
+  }
 
 }
 .month-day-picker {

+ 33 - 30
src/views/dataEntry_manage/components/addRightEdbDialog.vue

@@ -164,6 +164,9 @@ export default {
             type:Boolean,
             default:false
         },
+        tableData:{
+            type:Array
+        }
     },
     computed:{
         formRules(){ //方便英文翻译
@@ -172,8 +175,11 @@ export default {
     },
     data() {
         return {
+            search_page:1,
             current_search:'',
             search_txt:'',
+            search_have_more:false,
+            searchOptions:[],
             rightEdbForm:{
                 IndicatorType:1,//1左轴同比 2指标库 3预测指标
                 Style:'column',//生成样式 column/mark
@@ -187,6 +193,7 @@ export default {
                 LineWidth:3,//线条粗细
                 LineStyle:'Solid',//线条线型
             },
+            rightEdbData:{},
             markTypesOpts,lineStylesOpts,
             predefineColors: defaultOpts.colors.slice(0, 2),
         };
@@ -224,46 +231,42 @@ export default {
             if(!this.search_have_more) return;
             this.searchApi(this.current_search,++this.search_page);
         },
-        //选择指标,不需要拿详情,仅保存基本信息
-        selectTarget(item,type=''){
+        //选择指标,获取详情,保存基本信息
+        async selectTarget(item){
             if(!item) return 
+            //检查添加指标是否已存在
+            let have_bol = this.tableData.every(i => i.EdbInfoId === item.EdbInfoId);
+            if(have_bol){
+                // this.$message.warning('录入指标已存在');
+                this.search_txt = ''
+                return this.$message.warning(this.$t('Chart.OptMsg.edb_haved_msg'));
+            }
+            //以曲线图的参数获取指标详情
             let params = {
                 EdbInfoId: item.EdbInfoId,
                 ChartType: 1,
-                Calendar: '',
+                Calendar: undefined,
                 DateType: 3,
                 StartYear:0,
-                StartDate:'',
-                EndDate:''
-            }
-            //检查添加指标是否已存在
-            let have_bol = this.tableData.every(item => item.EdbInfoId === tableItem.EdbInfoId);
-            if(have_bol){
-                // this.$message.warning('录入指标已存在');
-                this.$message.warning(this.$t('Chart.OptMsg.edb_haved_msg'));
-            }else{
-                 //默认拼接来源
-                 /* if(!this.chartInfo.SourcesFrom) {
-                    this.chartInfo.SourcesFrom = JSON.stringify({
-                        isShow: this.chartInfo.SourcesFromVisable,
-                        text: item.SourceName,
-                        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
-                    });
-                } */
+                StartDate: '',
+                EndDate: '',
+            } 
+            const res = await dataBaseInterface.chartInfo(params)
+            if(res.Ret!==200) return 
+            const tableItem = res.Data.EdbInfoList[0]
+            this.rightEdbData = {
+                EdbInfoId: tableItem.EdbInfoId,
+                EdbInfoType:tableItem.EdbInfoType,
+                LeadValue:tableItem.LeadValue,
+                LeadUnit:tableItem.LeadUnit,
             }
         },
         confirmPerson(){
             //校验
-            this.$emit('modify',this.rightEdbForm)
+            if(!this.search_txt){
+                return this.$message.warning('请选择指标!')
+            }
+            this.$emit('modify',{form:this.rightEdbForm,data:this.rightEdbData})
         }
     },
 };

+ 15 - 4
src/views/dataEntry_manage/components/markersSection.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="chart-markers-section">
     <!-- 季节性图升级-添加右轴指标-->
-    <!-- <div class="section-item" v-if="chartInfo.ChartType===2">
+    <div class="section-item" v-if="chartInfo.ChartType===2">
         <div class="average-item" v-if="rightEdbForm.IsAdd">
             <span>{{rightEdbForm.EdbName||0}}</span>
             <div style="flex-shrink:0">
@@ -21,7 +21,7 @@
             />
             <span>{{`添加右轴指标`}}</span>
         </div>
-    </div> -->
+    </div>
     <!-- 雷达不要 -->
     <template v-if="chartInfo.ChartType!==11">
       <!-- 标示线 -->
@@ -238,6 +238,7 @@
     <!-- 右轴指标弹窗 -->
     <addRightEdbDialog 
         :isShow="isAddRightEdbDialogShow"
+        :tableData="tableData"
         @close="isAddRightEdbDialogShow=false"
         @modify="addRightEdb"
     />
@@ -275,6 +276,9 @@ export default {
   props: {
     chartInfo: {
       type: Object
+    },
+    tableData:{
+        type:Array
     }
   },
   data() {
@@ -432,7 +436,7 @@ export default {
         this.previewSeason('previewSeason')
     },
     //添加右轴指标
-    addRightEdb(form){
+    addRightEdb({form,data}){
         //mock tableData
         const mockTableData = {
             Unit:"",//若数字格式为百分数,这里有值%
@@ -514,11 +518,18 @@ export default {
             "ChartStyle":"line",
             "ChartColor":"rgba(102, 255, 0, 1)",
         }
+        const tableData = {
+            ...data,
+            IsAxis:0,
+            Unit:form.NumFormat===1?'%':'',
+            UnitEn:''
+
+        }
         Object.assign(this.rightEdbForm,form)
         this.rightEdbForm.IsAdd = true
         this.rightEdbForm.IsShow = true
         this.isAddRightEdbDialogShow = false
-        this.$emit('previewSeasonRight',{rightConfig:this.rightEdbForm,tableData:mockTableData})
+        this.$emit('previewSeasonRight',{rightConfig:this.rightEdbForm,tableData})
     },
     //取消添加右轴指标
     deleteRightEdb(){

+ 49 - 29
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -360,19 +360,6 @@ export default {
 				})
 
 		},
-		//季节性图选择右轴指标,将指标详情push到表格中,并更新上下限,拼接来源等
-		selectSeasonRightTarget(data){
-			//设置为右轴
-			data.IsAxis = 1
-			//format updateData 数据转换用
-			const tempItem = this.formatUpdateData(data)
-			this.updateData.push(tempItem)
-			//检测上下限变化
-			this.isModifyEdb = true
-			if(this.updateLimit){
-				this.EdbAxisChange()
-			}
-		},
 
 
 		/* 添加柱形图 /雷达图指标数组 */
@@ -1081,6 +1068,7 @@ export default {
 		
 		//更新标识线,区 重绘图 不用重新获取数据 
 		reLoadChartOption() {
+			console.log('reloadChartOption')
 			if(!this.options.series) return
 			
 			const chartTypeMap = {
@@ -1100,13 +1088,13 @@ export default {
 				this.chartInfo.SeasonAverageConfig.SamePeriodAverage.IsShow = SamePeriodAverage.IsShow||false
 				this.chartInfo.SeasonAverageConfig.SamePeriodStandardDeviation.IsShow = SamePeriodStandardDeviation.IsShow||false
 			}
-			if(this.chartInfo.SearonRightConfig){
-				this.chartInfo.SearonRightConfig.IsShow = SeasonRightEdbConfig.IsShow||false
+			if(this.chartInfo.SeasonRightConfig){
+				this.chartInfo.SeasonRightConfig.IsShow = SeasonRightEdbConfig.IsShow||false
 			}
 			this.reLoadChartOption()
 		},
 		//预览季节性图(请求接口)
-		previewSeasonChart({SeasonAverageConfig,SeasonRightEdbConfig={IndicatorType:1}}){
+		previewSeasonChart({SeasonAverageConfig={},SeasonRightEdbConfig={IndicatorType:1}}){
 			let db_arr = this.tableData.map((_,index) => {
 				const {IsConvert,ConvertType,ConvertValue,ConvertUnit,ConvertEnUnit} = this.updateData[index]
 					return {
@@ -1128,9 +1116,9 @@ export default {
 				EndDate:this.year_select === 5 ? dateArray[1]: '',
 				Calendar: this.calendar_type,
 				StartYear:this.count_year || 0,
-				ChartEdbInfoList:SeasonRightEdbConfig.IndicatorType===1?db_arr[0]:db_arr,//如果右轴为左轴同比,则只取第一个
+				ChartEdbInfoList:SeasonRightEdbConfig.IndicatorType===1?[db_arr[0]]:db_arr,//如果右轴为左轴同比,则只取第一个
 			}
-			const {MaxMinLimits,SamePeriodAverage,SamePeriodStandardDeviation} = SeasonAverageConfig
+			const {MaxMinLimits={},SamePeriodAverage={},SamePeriodStandardDeviation={}} = SeasonAverageConfig
 			const SeasonExtraConfig = {
 				...this.SeasonExtraConfig,
 				MaxMinLimits:MaxMinLimits.IsAdd?SeasonAverageConfig.MaxMinLimits:{},
@@ -1143,28 +1131,60 @@ export default {
 			dataBaseInterface.getSplinePreviewData(params).then(res=>{
 				if(res.Ret!==200) return 
 				const {DataResp} = res.Data
-				const {MaxMinLimits,SamePeriodAverage,SamePeriodStandardDeviation,RightAxis} = DataResp
+				const {MaxMinLimits,SamePeriodAverage,SamePeriodStandardDeviation,
+						RightAxis={
+							IndicatorType:1,
+							EdbInfoList:[]
+						}} = DataResp
 				this.chartInfo.SeasonAverageConfig = {
 					MaxMinLimits,SamePeriodAverage,SamePeriodStandardDeviation
 				}
-				this.chartInfo.SearonRightConfig = RightAxis
-				this.reLoadChartOption()
+				//更新SearonRightConfig
+				this.chartInfo.SeasonRightConfig = RightAxis
+				//更新chartLimit.rightMin/rightMax
+				const {EdbInfoList=[]} = res.Data
+				let MinData=0,MaxData
+				if(RightAxis.IndicatorType===1){
+					MinData = RightAxis.EdbInfoList[0].MinData||0
+					MaxData = RightAxis.EdbInfoList[0].MaxData||0
+				}else{
+					MinData = EdbInfoList[1]&&EdbInfoList[1].MinData||0
+					MaxData = EdbInfoList[1]&&EdbInfoList[1].MaxData||0
+				}
+				this.chartLimit.rightMin = MinData
+				this.chartLimit.rightMax = MaxData
+				//更新tableData&updateData
+				if(RightAxis.IndicatorType!==1){
+					this.tableData = EdbInfoList
+					this.updateData = this.tableData.map(item=>{
+						return this.formatUpdateData(item)
+					})
+				}else{
+					this.reLoadChartOption()
+				}
+				
 			})
 
 		},
 		//预览季节性图右轴
 		previewSeasonRight({rightConfig,tableData}){
-			this.chartInfo.SearonRightConfig = rightConfig
+			this.chartInfo.SeasonRightConfig = 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
+				//若为指标/预测指标
+				if(rightConfig.IndicatorType!==1){
+					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)
+				if(rightConfig.IndicatorType!==1){
+					this.delTarget(tableData)
+				}
 			}
-			//mock
+			//mock 预览
 			//this.reLoadChartOption()
 			this.previewSeasonChart({SeasonAverageConfig:this.chartInfo.SeasonAverageConfig,SeasonRightEdbConfig:rightConfig})
 		},

+ 19 - 23
src/views/dataEntry_manage/mixins/chartPublic.js

@@ -1084,7 +1084,8 @@ export const chartSetMixin = {
     setSeasonChart(newval) {
       /* 季节性图的图表配置 */
       this.leftIndex = 0;
-      this.rightIndex = newval[1]?1:-1;
+      const {SeasonRightConfig={}} = this.chartInfo
+      this.rightIndex = SeasonRightConfig.IsShow?1:-1;
       this.rightTwoIndex = -1;
       const chartData = newval[0];
       // 农历数据需要去除第一项  农历和公历处理逻辑一样
@@ -1110,11 +1111,7 @@ export const chartSetMixin = {
         if(useTableLimit){
             minLimit = chartData.MinData
             maxLimit = chartData.MaxData
-            //加上右轴
-            if(this.rightIndex!=-1){
-                rightMin = newval[1].MinData
-                rightMax = newval[1].MaxData
-            }
+            //这几个页面的季节性图没有右轴,若有,取SearonRightConfig.EdbInfoList[0]的MinData/MaxData
         }else{
             minLimit = this.chartLimit.min||0
             maxLimit = this.chartLimit.max||0
@@ -1124,11 +1121,9 @@ export const chartSetMixin = {
                 rightMax = this.chartLimit.rightMax||0
             }
         }
-
       //数据列-常规左轴
       for (let index in chartDataHandle) {
         let j = chartDataHandle[index]
-        // console.log(j,index);
         //预测指标配置
         let predict_params =  chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
 
@@ -1195,33 +1190,33 @@ export const chartSetMixin = {
         seasonData.push(serieItem)
       }
       //数据列-右轴
-      const {SearonRightConfig} = this.chartInfo
-      if(newval[1]&&SearonRightConfig.IsShow){
+      if(SeasonRightConfig.IsShow){
         //右轴的设置
-        let serieConfig = SearonRightConfig.Style==='column'?{
+        let serieConfig = SeasonRightConfig.Style==='column'?{
             //柱形
             type:'column',
-            color:SearonRightConfig.ChartColor
+            color:SeasonRightConfig.ChartColor
         }:{
             //标记点
             type:'spline',
-            lineWidth:SearonRightConfig.LineWidth,
-            dashStyle:SearonRightConfig.LineStyle,
-            color:SearonRightConfig.IsConnected?SearonRightConfig.LineColor:'rgba(255, 255, 255, 0)',//没有连线颜色设置为透明
+            lineWidth:SeasonRightConfig.LineWidth,
+            dashStyle:SeasonRightConfig.LineStyle,
+            color:SeasonRightConfig.IsConnected?SeasonRightConfig.LineColor:'rgba(255, 255, 255, 0)',//没有连线颜色设置为透明
             marker:{
                 enabled:true,
-                symbol:SearonRightConfig.Shape,
-                fillColor:SearonRightConfig.ChartColor,
-                radius:SearonRightConfig.Size
+                symbol:SeasonRightConfig.Shape,
+                fillColor:SeasonRightConfig.ChartColor,
+                radius:SeasonRightConfig.Size
             },
         }
         let serieItem = {
             ...serieConfig,
-            name:SearonRightConfig.Legend||'右轴test',
+            name:SeasonRightConfig.Legend||'右轴test',
             data:[],
             yAxis:1,
         }
-        newval[1].DataList.forEach(item=>{
+        const DataList = (SeasonRightConfig.IndicatorType===1?SeasonRightConfig.EdbInfoList[0].DataList:newval[1].DataList)||[]
+        DataList.forEach(item=>{
             serieItem.data.push([item.DataTimestamp,item.Value])
         })
         seasonData.push(serieItem)
@@ -1264,7 +1259,8 @@ export const chartSetMixin = {
         plotLines: this.setAxisPlotLines(1)
       }];
       //如果有右轴,seasonYdata加上右轴
-      if(newval[1]&&SearonRightConfig.IsShow){
+      if(SeasonRightConfig.IsShow){
+        const rightEdb = (SeasonRightConfig.IndicatorType===1?SeasonRightConfig.EdbInfoList[0]:newval[1])||{unit:''}
         seasonYdata.push({
             ...seasonOptions.yAxis,
             opposite: true,//右轴
@@ -1279,14 +1275,14 @@ export const chartSetMixin = {
                 }
               },
               title: {
-                text: SearonRightConfig.Legend||'右轴test',
+                text: SeasonRightConfig.Legend||'右轴test',
                 style:{
                   ...chartTheme&&chartTheme.yAxisOptions.style
                 },
                 align: 'high',
                 rotation: 0,
                 y: -12,
-                x: -newval[1].Unit.length*12 ,
+                x: -rightEdb.Unit.length*12 ,
                 textAlign: 'right',
                 reserveSpace: false,
               },