|
@@ -81,7 +81,8 @@ export default {
|
|
|
sourceEditForm: {
|
|
|
|
|
|
},
|
|
|
- updateData:[]
|
|
|
+ updateData:[],
|
|
|
+ useUnit:''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -160,19 +161,78 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- formatUpdateData(data){
|
|
|
- return {
|
|
|
- ...data,
|
|
|
- isChange:data.isChange||false,
|
|
|
- changeType:data.changeType||1,
|
|
|
- changeNum:data.changeNum||100,
|
|
|
- changeUnit:data.Unit||'',
|
|
|
- changeUnitEn:data.UnitEn||''
|
|
|
- }
|
|
|
- },
|
|
|
- checkTableChange(type){
|
|
|
- console.log('change')
|
|
|
- this.isEdbDataChange = true
|
|
|
+ //转换从接口获取的tableData数据
|
|
|
+ formatUpdateData(data){
|
|
|
+ return {
|
|
|
+ ...data,
|
|
|
+ IsConvert:Boolean(data.IsConvert),
|
|
|
+ ConvertType:data.ConvertType||1,
|
|
|
+ ConvertValue:data.ConvertValue||100,
|
|
|
+ ConvertUnit:data.IsConvert?data.ConvertUnit:data.ConvertUnit||data.Unit,
|
|
|
+ ConvertEnUnit:data.ConvertEnUnit||data.UnitEn||''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //接口获取更新后的数据
|
|
|
+ changeTableData(index){
|
|
|
+ const {IsConvert,ConvertType,ConvertValue,ConvertUnit,ConvertEnUnit,EdbInfoId} = this.updateData[index]
|
|
|
+ if(!IsConvert) return
|
|
|
+ //计算方式是否合法
|
|
|
+ if(!this.checkConver(ConvertType,ConvertValue)){
|
|
|
+ return this.$message.warning("数据转换不合法")
|
|
|
+ }
|
|
|
+ //柱形图单独设置
|
|
|
+ if(this.chartInfo.ChartType===7){
|
|
|
+ return this.setChangeBarData(index)
|
|
|
+ }
|
|
|
+ //请求接口...
|
|
|
+ let dateArray=this.chartInfo.ChartType==2?this.season_year:this.select_date
|
|
|
+ dataBaseInterface.getChangeEdbData({
|
|
|
+ EdbInfoId,
|
|
|
+ ChartType: this.chartInfo.ChartType,
|
|
|
+ DateType: this.year_select,
|
|
|
+ StartYear:this.count_year,
|
|
|
+ StartDate:
|
|
|
+ this.year_select === 5 || this.year_select === 6
|
|
|
+ ? dateArray[0]
|
|
|
+ : '',
|
|
|
+ EndDate: this.year_select === 5 ? dateArray[1] : '',
|
|
|
+ IsConvert:Number(IsConvert),
|
|
|
+ ConvertType,ConvertValue:Number(ConvertValue),
|
|
|
+ ConvertUnit,ConvertEnUnit
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ const {EdbInfoList=[]} = res.Data||{}
|
|
|
+ if(index===this.useUnit&&this.chartInfo.ChartType===7){
|
|
|
+ this.chartInfo.Unit = ConvertUnit
|
|
|
+ this.chartInfo.UnitEn = ConvertEnUnit
|
|
|
+ }
|
|
|
+ this.tableData.splice(index,1,EdbInfoList[0])
|
|
|
+ //this.updateData[index] = this.formatUpdateData(this.tableData[index])
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setChangeBarData(index){
|
|
|
+ const {IsConvert,ConvertType,ConvertValue,ConvertUnit,ConvertEnUnit,EdbInfoId} = this.updateData[index]
|
|
|
+ if(!IsConvert) return
|
|
|
+ //计算方式是否合法
|
|
|
+ if(!this.checkConver(ConvertType,ConvertValue)){
|
|
|
+ return this.$message.warning("数据转换不合法")
|
|
|
+ }
|
|
|
+ //请求接口。。。
|
|
|
+ if(index===this.useUnit&&this.chartInfo.ChartType===7){
|
|
|
+ this.chartInfo.Unit = ConvertUnit
|
|
|
+ this.chartInfo.UnitEn = ConvertEnUnit
|
|
|
+ }
|
|
|
+ //触发tabledata的watch->触发柱形图重绘
|
|
|
+ //this.tableData.splice(index,1,EdbInfoList[0])
|
|
|
+ },
|
|
|
+ checkConver(type,value){
|
|
|
+ //对数:value>1
|
|
|
+ //乘除:value!=0
|
|
|
+ if(type===3){
|
|
|
+ return value>1
|
|
|
+ }else{
|
|
|
+ return value!=0
|
|
|
+ }
|
|
|
},
|
|
|
/* 选择指标 获取指标详情并push到表格中*/
|
|
|
selectTarget(item,type='') {
|
|
@@ -282,6 +342,8 @@ export default {
|
|
|
this.search_txt = '';
|
|
|
this.chartInfo.Unit = this.chartInfo.Unit||edb.Unit
|
|
|
this.tableData.push(edb)
|
|
|
+ const tempItem = this.formatUpdateData(edb)
|
|
|
+ this.updateData.push(tempItem)
|
|
|
|
|
|
},
|
|
|
|
|
@@ -543,6 +605,9 @@ export default {
|
|
|
if(!this.tableData.length) {
|
|
|
this.chartInfo.MarkersLines = ""
|
|
|
this.chartInfo.MarkersAreas = ""
|
|
|
+ this.chartInfo.Unit = ""
|
|
|
+ this.chartInfo.UnitEn = ""
|
|
|
+ this.useUnit = ''
|
|
|
}
|
|
|
},
|
|
|
|