|
@@ -83,6 +83,8 @@ export default {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ updateData:[],
|
|
|
|
+ useUnit:''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -161,6 +163,80 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
+ //转换从接口获取的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
|
|
|
|
+ }
|
|
|
|
+ const temp = EdbInfoList[0]
|
|
|
|
+ temp.EdbAliasName = this.tableData[index].EdbAliasName
|
|
|
|
+ this.tableData.splice(index,1,temp)
|
|
|
|
+ //this.updateData[index] = this.formatUpdateData(this.tableData[index])
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ setChangeBarData(index){
|
|
|
|
+ const {ConvertType,ConvertValue,ConvertUnit,ConvertEnUnit} = 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
|
|
|
|
+ }
|
|
|
|
+ this.barDateList.length && this.$refs.BarOptRef.getBarData();
|
|
|
|
+ },
|
|
|
|
+ checkConver(type,value){
|
|
|
|
+ //对数:value>1
|
|
|
|
+ //乘除:value!=0
|
|
|
|
+ if(!value) return false
|
|
|
|
+ if(type===3){
|
|
|
|
+ return value>1
|
|
|
|
+ }else{
|
|
|
|
+ return value!=0
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/* 选择指标 获取指标详情并push到表格中*/
|
|
/* 选择指标 获取指标详情并push到表格中*/
|
|
selectTarget(item,type='') {
|
|
selectTarget(item,type='') {
|
|
if(!item) return
|
|
if(!item) return
|
|
@@ -208,6 +284,8 @@ export default {
|
|
this.tableData.push(tableItem);
|
|
this.tableData.push(tableItem);
|
|
this.isSetExtremeValue = true;
|
|
this.isSetExtremeValue = true;
|
|
// console.log(this.tableData)
|
|
// console.log(this.tableData)
|
|
|
|
+ const tempItem = this.formatUpdateData(tableItem)
|
|
|
|
+ this.updateData.push(tempItem)
|
|
|
|
|
|
//默认拼接来源
|
|
//默认拼接来源
|
|
if(!this.chartInfo.SourcesFrom) {
|
|
if(!this.chartInfo.SourcesFrom) {
|
|
@@ -252,6 +330,8 @@ export default {
|
|
this.search_txt = '';
|
|
this.search_txt = '';
|
|
this.chartInfo.Unit = this.chartInfo.Unit||edb.Unit
|
|
this.chartInfo.Unit = this.chartInfo.Unit||edb.Unit
|
|
this.tableData.push(edb)
|
|
this.tableData.push(edb)
|
|
|
|
+ const tempItem = this.formatUpdateData(edb)
|
|
|
|
+ this.updateData.push(tempItem)
|
|
},
|
|
},
|
|
|
|
|
|
/* 奇怪柱形图的日期配置项现在不止柱形图用了 获取数据时扩展一下 */
|
|
/* 奇怪柱形图的日期配置项现在不止柱形图用了 获取数据时扩展一下 */
|
|
@@ -269,9 +349,14 @@ export default {
|
|
if(!this.tableData.length || !dateList.length) return
|
|
if(!this.tableData.length || !dateList.length) return
|
|
|
|
|
|
let params = {
|
|
let params = {
|
|
- EdbInfoIdList: this.tableData.map(_ => ({
|
|
|
|
|
|
+ EdbInfoIdList: this.tableData.map((_,index) => ({
|
|
EdbInfoId: _.EdbInfoId,
|
|
EdbInfoId: _.EdbInfoId,
|
|
- Name:_.EdbAliasName
|
|
|
|
|
|
+ Name:_.EdbAliasName,
|
|
|
|
+ IsConvert:Number(this.updateData[index].IsConvert),
|
|
|
|
+ ConvertType:this.updateData[index].ConvertType,
|
|
|
|
+ ConvertValue:Number(this.updateData[index].ConvertValue),
|
|
|
|
+ ConvertUnit:this.updateData[index].ConvertUnit,
|
|
|
|
+ ConvertEnUnit:this.updateData[index].ConvertEnUnit,
|
|
})),
|
|
})),
|
|
DateList: dateList,
|
|
DateList: dateList,
|
|
Sort: {
|
|
Sort: {
|
|
@@ -560,6 +645,7 @@ export default {
|
|
delTarget(item) {
|
|
delTarget(item) {
|
|
let index = this.tableData.findIndex(obj => obj.EdbInfoId === item.EdbInfoId);
|
|
let index = this.tableData.findIndex(obj => obj.EdbInfoId === item.EdbInfoId);
|
|
this.tableData.splice(index, 1);
|
|
this.tableData.splice(index, 1);
|
|
|
|
+ this.updateData.splice(index, 1)
|
|
this.$message.success('删除成功')
|
|
this.$message.success('删除成功')
|
|
//删除指标时,检测上下限,修改上下限
|
|
//删除指标时,检测上下限,修改上下限
|
|
this.EdbAxisChange()
|
|
this.EdbAxisChange()
|
|
@@ -569,6 +655,9 @@ export default {
|
|
if(!this.tableData.length) {
|
|
if(!this.tableData.length) {
|
|
this.chartInfo.MarkersLines = ""
|
|
this.chartInfo.MarkersLines = ""
|
|
this.chartInfo.MarkersAreas = ""
|
|
this.chartInfo.MarkersAreas = ""
|
|
|
|
+ this.chartInfo.Unit = ""
|
|
|
|
+ this.chartInfo.UnitEn = ""
|
|
|
|
+ this.useUnit = ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|