Prechádzať zdrojové kódy

ETA_1.9.0 图表配置优化

hbchen 5 mesiacov pred
rodič
commit
7783535012

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

@@ -219,6 +219,15 @@ export const refreshCustomSheet = params => {
 	return http.get('/datamanage/excel_info/table/refresh',params)
 }
 
+/**
+ * 表格 获取原始指标来源
+ * @param {*} params  EdbInfoId
+ * @returns  
+ */
+export const getEdbBaseSource = params => {
+	return http.get('/datamanage/excel_info/get_edb_source',params)
+}
+
 /**
  * 下载excel
  * @param {*} params ExcelInfoId authorization

+ 12 - 4
src/views/datasheet_manage/components/calculateEdbDia.vue

@@ -368,7 +368,8 @@ export default {
         MoveForward: 0,
         relationDate: '',//关联的表格日期
         relationUid: '',//关联格子的uid
-      }
+      },
+      baseSourceName:''
     }
   },
   mounted(){
@@ -460,7 +461,7 @@ export default {
         EdbInfoId: this.selectEdbInfo.EdbInfoId,
         InsertValue: res.Data.ShowValue||"",
         Str: JSON.stringify(params),
-        sourceName:this.selectEdbInfo.SourceName||''
+        sourceName:this.baseSourceName||''
       }
 
       // if(!this.calculateShowData.length) return this.$message.warning('该日期无数据')
@@ -484,7 +485,15 @@ export default {
 
       if(res.Ret !== 200) return
 
-      const { EdbInfoId,EdbCode,EdbName,Frequency,Unit,StartDate,ModifyTime,SourceName,PredictDataList,DataList,HaveOperaAuth } = res.Data.Item;
+      sheetInterface.getEdbBaseSource({EdbInfoId:e.EdbInfoId}).then(res=>{
+        if(res.Ret == 200){
+          // 获取原始指标的来源
+          this.baseSourceName = res.Data.ExcelSource || ''
+        }
+      })
+      
+      const { EdbInfoId,EdbCode,EdbName,Frequency,Unit,StartDate,ModifyTime,PredictDataList,DataList,HaveOperaAuth } = res.Data.Item;
+
       this.selectEdbInfo = {
         EdbCode,
         EdbName,
@@ -492,7 +501,6 @@ export default {
         Unit,
         StartDate,
         ModifyTime,
-        SourceName,
         EdbInfoId,
         HaveOperaAuth,
         DataList: PredictDataList ? [...PredictDataList,...DataList].slice(0,5) : DataList.slice(0,5)

+ 11 - 3
src/views/datasheet_manage/components/insertDateDia.vue

@@ -151,23 +151,31 @@ export default {
       let backData = {}
       //插入系统日期
       // if(this.info.key==='insert-sys-date') {
-
+        // console.log(this.selectEdbInfo,'this.selectEdbInfo');
+        // return 
         let valueParam = {
           EdbInfoId: this.selectEdbInfo.EdbInfoId||0,
           MoveForward: this.formData.MoveForward,
           DateChange: this.$refs.dateMoveWayRef.dateChangeArr
         }
-
         let { Data } = await sheetInterface.getSystemDate({
           DataTimeType: this.dateChangeSelect,
           Value: JSON.stringify(valueParam)
         })
         
+        // 获取原始指标来源
+        let baseSourceName=''
+        let SourceData = await sheetInterface.getEdbBaseSource({
+          EdbInfoId:this.selectEdbInfo.EdbInfoId
+        })
+        if(SourceData.Ret == 200){
+          baseSourceName = SourceData.Data.ExcelSource
+        }
         backData = {
           insertValue: Data.Date,
           dataTimeType: this.dateChangeSelect,
           str: JSON.stringify(valueParam),
-          sourceName:this.selectEdbInfo.SourceName||''
+          sourceName:baseSourceName||''
         }
       // }else { //指标日期
       //   backData = {

+ 10 - 2
src/views/datasheet_manage/components/selectTargetValueDia.vue

@@ -180,11 +180,19 @@ export default {
       if(res.Ret !== 200) return
 
       this.result = res.Data;
-
+      console.log(this.result,'this.result');
       let value = (this.result.List&&this.result.List.length)
         ? this.result.List.find(_ => _.DataTime===this.result.Date) ? this.result.List.find(_ => _.DataTime===this.result.Date).Value.toString() : ''
         : ''
 
+      // 获取原始指标来源
+      let baseSourceName=''
+      let SourceData = await sheetInterface.getEdbBaseSource({
+        EdbInfoId:this.edbInfo.EdbInfoId
+      })
+      if(SourceData.Ret == 200){
+        baseSourceName = SourceData.Data.ExcelSource
+      }
       this.chooseItem = {
         relationDate: Date,
         relationUid: this.dateSelectForm.Type===2 ? this.dateSelectForm.relationUid : '',
@@ -194,7 +202,7 @@ export default {
           MoveForward: this.dateSelectForm.MoveForward,
           DateChange: this.$refs.dateMoveWayRef.dateChangeArr
         }),
-        sourceName:this.edbInfo.SourceName||''
+        sourceName:baseSourceName||''
       }
 
       this.$emit('insert',this.chooseItem)

+ 7 - 7
src/views/datasheet_manage/customSheetEdit.vue

@@ -217,13 +217,13 @@ export default {
         },1000)
         return 
       }
-      const { ExcelName,ExcelClassifyId,ExcelType,TableData,ModifyTime,Button,SourcesFrom} = res.Data;
+      const { ExcelName,ExcelClassifyId,ExcelType,TableData,ModifyTime,Button,SourcesFrom,ExcelSource} = res.Data;
       this.sheetButton=Button
       this.sheetForm = {
         name: ExcelName,
         classify: ExcelClassifyId,
         sheetType: ExcelType,
-        SourcesFrom:SourcesFrom || this.setDefaultSource()
+        SourcesFrom:SourcesFrom || this.setDefaultSource(ExcelSource)
       }
 
       this.sheetSourceFrom = JSON.parse(this.sheetForm.SourcesFrom)
@@ -234,10 +234,10 @@ export default {
       })
       this.$refs.customTableRef.initSheetData(TableData);
     },
-    setDefaultSource(){
+    setDefaultSource(sourceText){
       return JSON.stringify({
         isShow: true,
-        text: '',
+        text: sourceText,
         color: "#606266",
         fontSize: 9
       })
@@ -245,7 +245,6 @@ export default {
     /* 选择指标push指标数组 */
     async handleSelectTarget(e) {
       if(!e) return
-      this.updateSourceFrom(e.SourceName)
       const { EdbName,EdbNameEn,UnitEn,EdbInfoId,Unit,Frequency } = e;
       if(this.$refs.customTableRef.config.data.find(_ => _.EdbInfoId===EdbInfoId)) return this.$message.warning(this.$t('OnlineExcelPage.already_exists_msg') )
       
@@ -260,7 +259,8 @@ export default {
         SortType: this.$refs.customTableRef.config.order===1 ? 'desc' : 'asc',
         Num: 12
       })
-      
+      console.log(Data,'DataData');
+      this.updateSourceFrom(Data.ExcelSource)
       this.$refs.customTableRef.updateEdbData({
         Data: Data.Data.map(_ => ({..._,DataTimeType: 1,})),
         EdbAliasName: '',
@@ -387,7 +387,7 @@ export default {
       if(!source) return
       let concatSourceArr = this.sheetSourceFrom.text?`${this.sheetSourceFrom.text},${source}`.split(','):[source];
       let sourceStr = Array.from(new Set(concatSourceArr)).join(',');
-      this.sheetSourceFrom.text=sourceStr
+      this.$set(this.sheetSourceFrom,'text',sourceStr)
       this.sheetForm.SourcesFrom=JSON.stringify(this.sheetSourceFrom)
     }
   },

+ 5 - 5
src/views/datasheet_manage/mixedSheetEdit.vue

@@ -162,7 +162,7 @@ export default {
     /* 获取表格详情 */
     async getDetail(type='init') {
       if(!this.sheetId){
-        this.sheetForm.SourcesFrom = this.setDefaultSource()
+        this.sheetForm.SourcesFrom = this.setDefaultSource('')
         this.sheetSourceFrom = JSON.parse(this.sheetForm.SourcesFrom)
         return
       } 
@@ -184,12 +184,12 @@ export default {
         return 
       }
 
-      const { ExcelName,ExcelClassifyId,TableData,ModifyTime,Button,SourcesFrom } = res.Data;
+      const { ExcelName,ExcelClassifyId,TableData,ModifyTime,Button,SourcesFrom,ExcelSource } = res.Data;
       this.sheetButton=Button
       this.sheetForm = {
         name: ExcelName,
         classify: ExcelClassifyId,
-        SourcesFrom:SourcesFrom || this.setDefaultSource()
+        SourcesFrom:SourcesFrom || this.setDefaultSource(ExcelSource)
       }
       this.sheetSourceFrom = this.sheetForm.SourcesFrom?JSON.parse(this.sheetForm.SourcesFrom):null
       this.$nextTick(()=>{
@@ -201,10 +201,10 @@ export default {
       
       type==='refresh' && this.$message.success(this.$t('OnlineExcelPage.table_data_update_msg') )
     },
-    setDefaultSource(){
+    setDefaultSource(sourceText){
       return JSON.stringify({
         isShow: true,
-        text: '',
+        text: sourceText,
         color: "#606266",
         fontSize: 9
       })

+ 12 - 2
src/views/datasheet_manage/sheetList.vue

@@ -907,7 +907,10 @@ export default {
           this.sheetDetailInfo = res.Data;
           this.saveTime = this.$moment(this.sheetDetailInfo.ModifyTime).format('YYYY-MM-DD HH:mm:ss')||''
           this.editButtonText = this.sheetDetailInfo.CanEdit?'':`${this.sheetDetailInfo.Editor}${this.$t('OnlineExcelPage.editing_msg')}`
- 
+          if(!this.sheetDetailInfo.SourcesFrom){
+            this.sheetDetailInfo.SourcesFrom = this.setDefaultSource(this.sheetDetailInfo.ExcelSource)
+          }
+          
           this.$nextTick(() => {
             //sheet组件Mounted已经init一次,再次调用会导致工具栏样式错乱
             //this.sheetDetailInfo.Source === 1 && this.$refs.sheetRef.init();
@@ -920,7 +923,14 @@ export default {
           });
         });
     },
-
+    setDefaultSource(sourceText){
+      return JSON.stringify({
+        isShow: true,
+        text: sourceText,
+        color: "#606266",
+        fontSize: 9
+      })
+    },
     /* 删除表格 */
     delSheetHandle({cell, type = ""}) {
       const { ExcelClassifyId, ExcelInfoId  } = cell;