jwyu 10 месяцев назад
Родитель
Сommit
e11d80f679

+ 2 - 0
src/views/chartRelevance_manage/components/selectTarget.vue

@@ -254,12 +254,14 @@ export default {
           this.search_page = 1;
           this.search_txt=''
           this.$emit('select','')
+          this.$emit('edbTypeChange',this.targetType=='1'?0:1)
         },
 
         // 指标选择
         handleSelectTarget(e){
             let arr=this.searchOptions.filter(_item=>_item.EdbInfoId==e)
             this.$emit('select',arr[0])
+            this.$emit('edbTypeChange',this.targetType=='1'?0:1)
         },
     },
 }

+ 6 - 0
src/views/dataEntry_manage/components/sectionalCombination/referenceDateSet.vue

@@ -38,6 +38,7 @@
               :selectStyleType="3"
               selectBoxWidth="105px"
               @select="chooseEdb($event, index)"
+              @edbTypeChange="handleEdbTypeChange($event,index)"
             />
           </div>
           <div style="flex: 1">
@@ -164,6 +165,11 @@ export default {
       }
     },
 
+    handleEdbTypeChange(e,index){
+      console.log('指标类型变化',e);
+      this.list[index].edbType=e
+    },
+
     handleDelListItem(index) {
       this.list.splice(index, 1)
     },

+ 27 - 3
src/views/dataEntry_manage/components/sectionalCombination/sectionalCombinationOption.vue

@@ -22,7 +22,7 @@
         class="select-box"
         v-model="sortBasisEdb"
         :placeholder="$t('EtaChartAddPage.select_base_placehold')"
-        @change="handleGetChartData"
+        @change="handleGetChartData('sortBasisEdb')"
       >
         <el-option
           v-for="item in seriesData"
@@ -185,6 +185,7 @@
       :defaultData="seriesData"
       :referenceDateOpts="referenceDateOpts" 
       @change="handleSeriesChange" 
+      @hideChart="handleHideChart"
     />
 
     <!-- 横纵轴设置 -->
@@ -309,8 +310,12 @@ export default {
     },
 
     // 获取图表数据
-    handleGetChartData(){
-      this.$emit('getData',this.$data)
+    handleGetChartData(type){
+      const data=_.cloneDeep(this.$data)
+      if(type==='sortBasisEdb'){
+        data.XDataList=[]
+      }
+      this.$emit('getData',data)
     },
 
     // 图表配置更新
@@ -341,6 +346,19 @@ export default {
       this.showAxisSet=true
     },
 
+    // 系列删除完了
+    handleHideChart(){
+      this.seriesData=[]
+      this.sortBasisEdb=''
+      this.XDataList=[]
+      this.UnitList={
+        LeftName:'',
+        RightName:'',
+        RightTwoName:''
+      }
+      this.$emit('hideChart')
+    },
+
     // 删除系列
     async handleDelSeries(item,index){
       if(this.seriesData.length===1){
@@ -391,7 +409,13 @@ export default {
       // 设置基准为第一个系列
       if(!this.sortBasisEdb){
         this.sortBasisEdb=data[0].seriesName
+      }else{
+        // 如果改了系列名称并且基准名称不在系列里面则重置为第一个
+        if(!data.some(i=>i.seriesName==this.sortBasisEdb)){
+          this.sortBasisEdb=data[0].seriesName
+        }
       }
+      
   
       this.handleGetChartData()
     },

+ 25 - 1
src/views/dataEntry_manage/components/sectionalCombination/seriesEdit.vue

@@ -19,9 +19,10 @@
           type="primary"
           :plain="activeIndex !== index"
           @click="handleChangeSeries(index)"
+          class="series-btn"
           >{{ item.seriesName || $t('EtaChartAddPage.new_series') }}({{
             item.edbList.length
-          }})</el-button
+          }})<i class="el-icon-error" @click.stop="handleDelSeries(index)"></i></el-button
         >
         <el-button
           class="add-btn"
@@ -33,6 +34,7 @@
         >
       </div>
       <series-item-wrap
+        v-if="list.length"
         v-model="list[activeIndex]"
         :referenceDateOpts="referenceDateOpts"
         :disRightTwoAxis="
@@ -254,6 +256,18 @@ export default {
       this.activeIndex=0
     },
 
+    // 删除系列
+    async handleDelSeries(index){
+      if(this.list.length===1){
+        await this.$confirm(this.$t('EtaChartAddPage.series_del_tips'),this.$t('Dialog.warn_tit'))
+      }
+      this.list.splice(index,1)
+      if(this.list.length===0){
+        this.$emit('hideChart')
+        this.cancelHandle()
+      }
+    },
+
     // 处理复制情况
     handleCopySeries() {
       this.$nextTick(() => {
@@ -336,6 +350,16 @@ export default {
         border-color: #0052d9;
         color: #0052d9;
       }
+      .series-btn{
+        position: relative;
+        .el-icon-error{
+          position: absolute;
+          top: -8px;
+          right: -8px;
+          color: #f00;
+          font-size: 20px;
+        }
+      }
     }
   }
   .btn-bottom {

+ 1 - 0
src/views/dataEntry_manage/components/sectionalCombination/seriesItemWrap.vue

@@ -51,6 +51,7 @@
             class="btn-del"
             src="~@/assets/img/icons/delete-red.png"
             alt=""
+            v-if="compData.edbList.length>1"
             @click="handleDelListItem(index)"
           />
           <div class="top-flex-box">

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

@@ -2255,15 +2255,15 @@ export const chartSetMixin = {
       const tooltip={
         formatter:function () { 
           return `<b>${this.x}</b>
-          <br><span style="color:${this.color}">\u25CF</span>${this.x}:${this.y} ${this.series.options.unitName}`
+          <br><span style="color:${this.color}">\u25CF</span>${this.series.options.name}:${this.y} ${this.series.options.unitName}`
         },
         formatterCh:function () { 
           return `<b>${this.x}</b>
-          <br><span style="color:${this.color}">\u25CF</span>${this.x}:${this.y} ${this.series.options.unitNameCh}`
+          <br><span style="color:${this.color}">\u25CF</span>${this.series.options.nameCh}:${this.y} ${this.series.options.unitNameCh}`
         },
         formatterEn:function () { 
           return `<b>${this.x}</b>
-          <br><span style="color:${this.color}">\u25CF</span>${this.x}:${this.y} ${this.series.options.unitNameEn}`
+          <br><span style="color:${this.color}">\u25CF</span>${this.series.options.nameEn}:${this.y} ${this.series.options.unitNameEn}`
         }
       }
 
@@ -2301,6 +2301,7 @@ export const chartSetMixin = {
     // 截面组合图渲染更新
     handleUpdateSectionalCombinationChart(e){
       // console.log(e);
+      // console.log(this.sectionalCombinationData);
       if(e.type==='isAxis'){
         e.data.seriesData.forEach(item=>{
           this.sectionalCombinationData.SeriesList.forEach(_item=>{
@@ -2309,6 +2310,8 @@ export const chartSetMixin = {
             }
           })
         })
+        // 更新上下限
+        this.calcYAxislimit(this.sectionalCombinationData.SeriesList)
       }else if(e.type==='chartType'){
         e.data.seriesData.forEach(item=>{
           this.sectionalCombinationData.SeriesList.forEach(_item=>{