jwyu 11 сар өмнө
parent
commit
79f81eae26

+ 11 - 0
src/api/modules/sheetApi.js

@@ -176,6 +176,17 @@ export const editBalanceChart=params=>{
 	return http.post('/datamanage/excel_info/balance/chart_edit',params)
 }
 
+//平衡表中删除图表
+export const delBalanceChart=params=>{
+	return http.post('/datamanage/excel_info/balance/chart_del',params)
+}
+
+//平衡表季节图预览 获取数据
+export const balanceSeasonChart=params=>{
+	return http.post('/datamanage/excel_info/balance/chartLegend/preview',params)
+}
+
+
 /* =====自定义表格====== */
 
 /**

+ 4 - 0
src/lang/modules/ETATables/commonLang.js

@@ -82,6 +82,10 @@ export default {
       en: "Insertion Successful",
       zh: "插入成功",
     },
+    is_del_balance_chart_msg:{
+      en:'After deletion, this chart will no longer be referenced. Are you sure to delete it?',
+      zh:'删除后该图表将不能再引用,确认删除吗?',
+    },
   },
   Date: {
     monday: {

+ 66 - 16
src/views/datasheet_manage/components/BalanceAddChart.vue

@@ -361,7 +361,7 @@
             class="add-edb-btn"
             style="color: #0052d9; cursor: pointer"
             v-if="formData.chartType === 2"
-            @click="legendEditDiaShow = true"
+            @click="handleShowEditLegend"
           >
             <span>{{$t('EtaChartAddPage.label_legend_set')}}<!-- 图例名称设置 --></span>
 						<img style="width:15px" src="~@/assets/img/icons/edit-blue.png" />
@@ -480,10 +480,46 @@ export default {
     this.edbList.push(this.createEbdListItem('A'))
   },
   methods: {
+    // 季节图点击编辑图例
+    async handleShowEditLegend(){
+      // 如果没有选择指标数据
+      if(!(this.edbList[0].timeSerial&&this.edbList[0].valueSerial)){
+        this.legendEditDiaShow=true
+        return
+      }
+      // 获取当前选择的 时间序列和数值序列的值
+      const dateObj=this.getSeriesNum(this.edbList[0].timeSerial)
+      const valueObj=this.getSeriesNum(this.edbList[0].valueSerial)
+      const dateArr=this.findLimitData(dateObj.start,dateObj.end).valueArr
+      const valueArr=this.findLimitData(valueObj.start,valueObj.end).valueArr
+      const params={
+        DateArr:dateArr,
+        DataArr:valueArr,
+        Calendar:this.SeasonExtraConfig.type,
+        SeasonExtraConfig:{
+          ChartLegend:this.SeasonExtraConfig.ChartLegend,// 图例名称数组
+          XStartDate:this.SeasonExtraConfig.XStartDate,
+          XEndDate:this.SeasonExtraConfig.XEndDate,
+          JumpYear:this.SeasonExtraConfig.JumpYear?1:0
+        }
+      }
+      console.log(params);
+      const res=await sheetInterface.balanceSeasonChart(params)
+      if(res.Ret===200){
+        const arr=res.Data.List||[]
+        const temarr=arr.map(item=>{
+          return {Name:item.Years,Value:item.ChartLegend}
+        })
+        this.SeasonExtraConfig.ChartLegend=temarr
+        this.legendEditDiaShow=true
+      }
+      
+    },
+
     // 编辑时初始化数据
     initEditData(e){
       console.log('edit回显数据',e);
-      const {ChartInfo,EdbInfoList}=e
+      const {ChartInfo,EdbInfoList,ExcelEdbList}=e
       this.editChartInfoId=ChartInfo.ChartInfoId
       this.formData.chartName=ChartInfo.ChartName
       this.formData.chartSource=JSON.parse(ChartInfo.SourcesFrom).text
@@ -496,10 +532,10 @@ export default {
       this.formData.rightTwoMin=ChartInfo.Right2Min?Number(ChartInfo.Right2Min):0
       this.formData.rightTwoMax=ChartInfo.Right2Max?Number(ChartInfo.Right2Max):0
       if(ChartInfo.ChartType===2&&ChartInfo.SeasonExtraConfig){
-        this.SeasonExtraConfig.ChartLegend=ChartInfo.SeasonExtraConfig.ChartLegend
-        this.SeasonExtraConfig.XStartDate=ChartInfo.SeasonExtraConfig.XStartDate
-        this.SeasonExtraConfig.XEndDate=ChartInfo.SeasonExtraConfig.XEndDate
-        this.SeasonExtraConfig.JumpYear=ChartInfo.SeasonExtraConfig.JumpYear?true:false
+        this.SeasonExtraConfig.ChartLegend=JSON.parse(ChartInfo.SeasonExtraConfig).ChartLegend
+        this.SeasonExtraConfig.XStartDate=JSON.parse(ChartInfo.SeasonExtraConfig).XStartDate
+        this.SeasonExtraConfig.XEndDate=JSON.parse(ChartInfo.SeasonExtraConfig).XEndDate
+        this.SeasonExtraConfig.JumpYear=JSON.parse(ChartInfo.SeasonExtraConfig).JumpYear?true:false
         this.SeasonExtraConfig.type=ChartInfo.Calendar
       }
 
@@ -508,10 +544,10 @@ export default {
       let temEdbList=[]
       arr.forEach((item,index)=>{
         temEdbList.push({
-          tag: '',
+          tag: ExcelEdbList[index].FromTag,
           ExcelChartEdbId:item.EdbInfoId,
-          timeSerial: '',
-          valueSerial: '',
+          timeSerial: ExcelEdbList[index].DateSequenceStr,
+          valueSerial: ExcelEdbList[index].DataSequenceStr,
           maxData:item.MaxData,//选中数据的最大值
           minData:item.MinData,//选中数据的最小值
           name: item.EdbAliasName,
@@ -538,9 +574,8 @@ export default {
       this.updateLimit()
     },
 
-    // 手动输入数值序列改变
-    handleValInputChange(str){
-      console.log('数值序列改变',str);
+    // 通过字符串sheet1!$A$3:$A$13 获取开始和结束序列号
+    getSeriesNum(str){
       // 正则表达式模式,确保格式正确且感叹号后面有两个$,冒号前后各两个$
       const formatPattern = /^.*!\$[A-Z0-9]+\$[A-Z0-9]+:\$[A-Z0-9]+\$[A-Z0-9]/;
       // 检查字符串是否符合格式要求
@@ -576,14 +611,27 @@ export default {
           start.row=matches[1]-1
           end.col=this.$parent.columnHeader.findIndex(_e=>_e===matches[2])
           end.row=matches[3]-1
-          this.tableSelect(start,end,str)
+
+          return {
+            start,
+            end
+          }
 
       } else {
           console.log("字符串格式不符合要求");
           this.$message.warning('格式不合法')
+          return false
       }
     },
 
+    // 手动输入数值序列改变
+    handleValInputChange(str){
+      console.log('数值序列改变',str);
+      const obj=this.getSeriesNum(str)
+      if(!obj) return
+      this.tableSelect(obj.start,obj.end,str)
+    },
+
     // 选中的序列
     tableSelect(start,end,str){
       console.log(start,end,str);
@@ -642,7 +690,7 @@ export default {
       let numArr=[]
       // 判断是选择的同行还是同列
       if(start.col===end.col&&start.row!=end.row){//同列
-        for (let index = start.row; index < end.row; index++) {
+        for (let index = start.row; index <= end.row; index++) {
          numArr.push(data[index][start.col].ShowValue)
         }
       }
@@ -657,6 +705,8 @@ export default {
         numArr.push(data[start.row][start.col].ShowValue)
       }
 
+      const valueArr=JSON.parse(JSON.stringify(numArr))
+
       numArr=[...new Set(numArr)]
       numArr=numArr.filter(item=>!isNaN(item)).map(Number)
       
@@ -668,17 +718,16 @@ export default {
       // console.log(numArr);
       // console.log(minData,maxData);
       return{
+        valueArr,
         maxData,
         minData
       }
     },
 
-
     // 图例编辑接口保存
 		saveLegend(copyList){
 			if(copyList && copyList.length>0){
 				this.SeasonExtraConfig.ChartLegend = copyList
-				// this.getPreviewSplineInfo()
 				this.legendEditDiaShow=false
 			}
 		},
@@ -819,6 +868,7 @@ export default {
     },
     cancelHandle() {
       this.$emit('update:isShow', false);
+      this.initData()
     },
 
     /* 领先指标 过滤负数 小数点*/

+ 12 - 1
src/views/datasheet_manage/components/BalanceSheetChartItem.vue

@@ -18,7 +18,7 @@
                 <!-- 编辑 -->
                 <span class="btn-o" @click="handleEditChart">{{$t('Chart.chart_edit_btn')}}</span>
                 <!-- 删除 -->
-                <span class="btn-o" style="color:#f00">{{$t('Chart.chart_del_btn')}}</span>
+                <span class="btn-o" style="color:#f00" @click="handleDelChart">{{$t('Chart.chart_del_btn')}}</span>
             </div>
         </div>
 
@@ -75,6 +75,17 @@ export default {
             this.$emit('edit',this.chartData)
         },
 
+        handleDelChart(){
+            this.$confirm(this.$t('ETable.Msg.is_del_balance_chart_msg') , this.$t('Confirm.prompt') , {
+                confirmButtonText:  this.$t('Dialog.confirm_btn'),
+                cancelButtonText: this.$t('Dialog.cancel_btn'),
+                type: "warning",
+            }).then(() => {
+                this.$emit('delete',this.chartData)
+            }).catch(() => {});
+            
+        },
+
         /* 加入我的图库成功 */
         addMySuccess(params){
             this.isAddMyChart = false;

+ 16 - 3
src/views/datasheet_manage/components/BalanceTable.vue

@@ -21,6 +21,7 @@
       </div>
       <div class="table-content-wrap">
         <div class="left-wrap">
+          <!-- <div style="padding:20px;background-color: #fff;" @mouseleave="endSelection"> -->
           <div :class="['table-wrap',startSelectTable?'text-select-disabled':'']">
             <table
               width="auto"
@@ -47,7 +48,7 @@
                 </tr>
               </thead>
 
-              <tbody @mouseleave="endSelection">
+              <tbody>
                 <tr v-for="(row, index) in config.data" :key="index">
                   <!-- 行头 -->
                   <th
@@ -194,6 +195,7 @@
               </tbody>
             </table>
           </div>
+          <!-- </div> -->
           <!-- 底部sheet -->
           <div class="bot-sheet-box">
             <ul class="sheet-list">
@@ -245,6 +247,7 @@
               v-for="item in chartList" 
               :key="item.ChartInfo.ChartInfoId"
               @edit="handleEditChart"
+              @delete="handleDelChart"
             />
           </div>
           
@@ -545,6 +548,14 @@ export default {
       this.isShowAddChart=true
       this.$refs.balanceAddChart.initEditData(e)
     },
+    //删除图表
+    handleDelChart(e){
+      sheetInterface.delBalanceChart({ChartInfoId:e.ChartInfo.ChartInfoId}).then(res=>{
+        if(res.Ret===200){
+          this.chartList=this.chartList.filter(item=>item.ChartInfo.ChartInfoId!==e.ChartInfo.ChartInfoId)
+        }
+      })
+    },
 
 
     startSelection(startRow, startCol) {
@@ -1736,6 +1747,7 @@ export default {
     display: flex;
     .left-wrap {
       flex: 1;
+      overflow: hidden;
       .text-select-disabled{
         -webkit-user-select: none;
         -moz-user-select: none;
@@ -1757,10 +1769,11 @@ export default {
     }
   }
   .table-wrap {
+    width: 100%;
     background-color: #fff;
-    padding: 20px;
+    // padding: 20px;
     height: calc(100vh - 480px);
-    overflow-y: auto;
+    overflow: auto;
   }
   .bot-sheet-box {
     margin-top: 20px;