|
@@ -351,6 +351,13 @@ export default {
|
|
|
},
|
|
|
serieInfo: {
|
|
|
type: Object
|
|
|
+ },
|
|
|
+ edbInfoData:{
|
|
|
+ type:Array,
|
|
|
+ default:[]
|
|
|
+ },
|
|
|
+ IsNameDefault:{
|
|
|
+ type:Boolean
|
|
|
}
|
|
|
},
|
|
|
components: { mDialog },
|
|
@@ -392,8 +399,10 @@ export default {
|
|
|
date: '',
|
|
|
value: '',
|
|
|
})).filter(_ =>_.target_id)
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ //遍历请求xEdbs yEdbs的指标详情,获取最新日期和值
|
|
|
+ this.getEdbData()
|
|
|
+ this.getEdbNewInfo()
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -414,6 +423,7 @@ export default {
|
|
|
xEdbs: [],
|
|
|
yEdbs: []
|
|
|
},
|
|
|
+ edbData:{},
|
|
|
|
|
|
form: {
|
|
|
x_title:'',
|
|
@@ -515,7 +525,7 @@ export default {
|
|
|
name: item.EdbName,
|
|
|
})
|
|
|
|
|
|
- this.form.series_name = this.form.series_name || this.targetInfo.xEdbs[0].date;
|
|
|
+ this.form.series_name = this.IsNameDefault?this.targetInfo.xEdbs[0].date:this.form.series_name;
|
|
|
this.form.x_unit = this.form.x_unit || item.Unit;
|
|
|
}else {
|
|
|
this.targetInfo.yEdbs.push({
|
|
@@ -534,6 +544,9 @@ export default {
|
|
|
/* 删除指标 */
|
|
|
removeTarget(type,index) {
|
|
|
type === 'x' ? this.targetInfo.xEdbs.splice(index,1) : this.targetInfo.yEdbs.splice(index,1);
|
|
|
+ if(type === 'x'&&this.IsNameDefault){
|
|
|
+ this.form.series_name = this.targetInfo.xEdbs.length?this.targetInfo.xEdbs[0].date:''
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/* 保存 */
|
|
@@ -595,6 +608,10 @@ export default {
|
|
|
edbs: arr
|
|
|
}
|
|
|
this.$emit('saveCallback',params)
|
|
|
+ //如果没修改过,且保存时值不相等,则此次保存视为修改
|
|
|
+ if(params.series_name!==xEdbs[0].date&&this.IsNameDefault){
|
|
|
+ this.$emit('modifySeriesName')
|
|
|
+ }
|
|
|
this.cancelHandle()
|
|
|
},
|
|
|
|
|
@@ -640,13 +657,13 @@ export default {
|
|
|
target_id: item.EdbInfoId,
|
|
|
target_name: item.EdbName,
|
|
|
date: item.LatestDate,
|
|
|
- value: '',
|
|
|
+ value: item.LatestValue,
|
|
|
name: item.EdbName,
|
|
|
} : {
|
|
|
target_id: item.EdbInfoId,
|
|
|
target_name: item.EdbName,
|
|
|
date: item.LatestDate,
|
|
|
- value: '',
|
|
|
+ value: item.LatestValue,
|
|
|
}
|
|
|
}else {
|
|
|
this.replaceForm.item = { date: '' }
|
|
@@ -659,6 +676,9 @@ export default {
|
|
|
const { index,type,item } = this.replaceForm;
|
|
|
|
|
|
type==='x' ? this.targetInfo.xEdbs.splice(index,1,item) : this.targetInfo.yEdbs.splice(index,1,item);
|
|
|
+ if(type==='x'&&index===0&&this.IsNameDefault){
|
|
|
+ this.form.series_name = this.targetInfo.xEdbs[0].date;
|
|
|
+ }
|
|
|
this.cancelReplace()
|
|
|
},
|
|
|
|
|
@@ -678,6 +698,32 @@ export default {
|
|
|
|
|
|
this.$emit("update:show", false);
|
|
|
},
|
|
|
+ getEdbData(){
|
|
|
+ this.edbInfoData.forEach(e=>{
|
|
|
+ if(!this.edbData[e.EdbInfoId]){
|
|
|
+ this.edbData[e.EdbInfoId] = {
|
|
|
+ date:e.LatestDate,
|
|
|
+ value:e.LatestValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取指标的最新日期和值
|
|
|
+ getEdbNewInfo(){
|
|
|
+ const {xEdbs,yEdbs} = this.targetInfo
|
|
|
+ xEdbs.forEach(x=>{
|
|
|
+ if(this.edbData[x.target_id]){
|
|
|
+ x.date = this.edbData[x.target_id].date
|
|
|
+ x.value = this.edbData[x.target_id].value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ yEdbs.forEach(y=>{
|
|
|
+ if(this.edbData[y.target_id]){
|
|
|
+ y.date = this.edbData[y.target_id].date
|
|
|
+ y.value = this.edbData[y.target_id].value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|