|
@@ -52,15 +52,19 @@ export default {
|
|
|
search_have_more: true,
|
|
|
search_page: 1,
|
|
|
current_search:'',
|
|
|
- // 横坐标显示范围 - 季节性图
|
|
|
- xAxisRange:[],
|
|
|
+ // 季节性图和额外配置
|
|
|
+ SeasonExtraConfig:{
|
|
|
+ ChartLegend:[], // 图例名称数组
|
|
|
+ XStartDate:"01-01", // 横坐标显示范围 - 开始
|
|
|
+ XEndDate:"12-31", // 横坐标显示范围-结束
|
|
|
+ JumpYear:0, //是否跨年
|
|
|
+ },
|
|
|
+ // 横坐标显示范围回显 - 季节性图
|
|
|
+ xAxisRange:["01-01","12-31"],
|
|
|
// 是否跨过一年
|
|
|
isSpanYear:false,
|
|
|
isSpanYearDisable:false,
|
|
|
legendEditDiaShow:false,
|
|
|
- legendList:[],
|
|
|
- // 用于还原
|
|
|
- legendListResetUse:[]
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -140,31 +144,50 @@ export default {
|
|
|
|
|
|
/* 正常图获取指标数据 柱形图不获取 */
|
|
|
if(this.chartInfo.ChartType !== 7) {
|
|
|
- let params = this.sameOptionType.includes(this.chartInfo.ChartType)
|
|
|
- ? {
|
|
|
- EdbInfoId: item.EdbInfoId,
|
|
|
- ChartType: this.chartInfo.ChartType,
|
|
|
- DateType: this.year_select,
|
|
|
- StartDate:
|
|
|
- this.year_select === 5 || this.year_select === 6
|
|
|
- ? this.select_date[0]
|
|
|
- : '',
|
|
|
- EndDate: this.year_select === 5 ? this.select_date[1] : '',
|
|
|
- }
|
|
|
- : {
|
|
|
- EdbInfoId: item.EdbInfoId,
|
|
|
- ChartType: this.chartInfo.ChartType,
|
|
|
- Calendar: this.calendar_type,
|
|
|
- SeasonStartDate: this.season_year ? this.season_year[0] : '',
|
|
|
- SeasonEndDate: this.season_year ? this.season_year[1] : '',
|
|
|
- };
|
|
|
+ // let params = this.sameOptionType.includes(this.chartInfo.ChartType)
|
|
|
+ // ? {
|
|
|
+ // EdbInfoId: item.EdbInfoId,
|
|
|
+ // ChartType: this.chartInfo.ChartType,
|
|
|
+ // DateType: this.year_select,
|
|
|
+ // StartDate:
|
|
|
+ // this.year_select === 5 || this.year_select === 6
|
|
|
+ // ? this.select_date[0]
|
|
|
+ // : '',
|
|
|
+ // EndDate: this.year_select === 5 ? this.select_date[1] : '',
|
|
|
+ // }
|
|
|
+ // : {
|
|
|
+ // EdbInfoId: item.EdbInfoId,
|
|
|
+ // ChartType: this.chartInfo.ChartType,
|
|
|
+ // Calendar: this.calendar_type,
|
|
|
+ // SeasonStartDate: '',
|
|
|
+ // SeasonEndDate: '',
|
|
|
+ // };
|
|
|
+ let dateArray=this.chartInfo.ChartType==2?this.season_year:this.select_date
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ EdbInfoId: item.EdbInfoId,
|
|
|
+ ChartType: this.chartInfo.ChartType,
|
|
|
+ Calendar: this.chartInfo.ChartType===2?this.calendar_type:undefined,
|
|
|
+ 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] : '',
|
|
|
+ }
|
|
|
dataBaseInterface.chartInfo(params).then((res) => {
|
|
|
if(res.Ret !== 200) return;
|
|
|
let [ tableItem ] = res.Data.EdbInfoList;
|
|
|
-
|
|
|
// 同一指标切换图表类型
|
|
|
if(type) {
|
|
|
this.tableData = [ tableItem ];
|
|
|
+
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ // 等待 tableData的 监听里面的获取到 起始时间和最近日期
|
|
|
+ this.setChartDefault()
|
|
|
+ })
|
|
|
+
|
|
|
return
|
|
|
};
|
|
|
//检查添加指标是否已存在
|
|
@@ -246,16 +269,20 @@ export default {
|
|
|
|
|
|
/* 曲线图切换筛选项时请求数据 */
|
|
|
async getPreviewSplineInfo() {
|
|
|
+ let dateArray=this.chartInfo.ChartType==2?this.season_year:this.select_date
|
|
|
let params = {
|
|
|
ChartType: this.chartInfo.ChartType,
|
|
|
DateType: this.year_select,
|
|
|
- StartDate: [5, 6].includes(this.year_select)
|
|
|
- ? this.select_date[0]
|
|
|
+ StartDate: [5 , 6].includes(this.year_select)
|
|
|
+ ? dateArray[0]
|
|
|
: '',
|
|
|
- EndDate: this.year_select === 5 ? this.select_date[1] : '',
|
|
|
+ EndDate: this.year_select === 5 ? dateArray[1]: '',
|
|
|
Calendar: this.calendar_type,
|
|
|
- SeasonStartDate: this.season_year ? this.season_year[0] : '',
|
|
|
- SeasonEndDate: this.season_year ? this.season_year[1] : '',
|
|
|
+ StartYear:this.count_year || 0,
|
|
|
+ // ETA1.0.5 去除了这两个入参
|
|
|
+ // SeasonStartDate: this.season_year ? this.season_year[0] : '',
|
|
|
+ // SeasonEndDate: this.season_year ? this.season_year[1] : '',
|
|
|
+ SeasonExtraConfig:this.SeasonExtraConfig,
|
|
|
ChartEdbInfoList: this.tableData.map(_ => ({
|
|
|
EdbInfoId: _.EdbInfoId,
|
|
|
EdbInfoType: _.EdbInfoType,
|
|
@@ -270,6 +297,18 @@ export default {
|
|
|
|
|
|
const { EdbInfoList } = res.Data;
|
|
|
|
|
|
+ if(this.chartInfo.ChartType == 2){
|
|
|
+ const chartDataHandle = this.calendar_type === "农历"?
|
|
|
+ EdbInfoList[0].DataList.filter((item, index) => index > 0):
|
|
|
+ EdbInfoList[0].DataList
|
|
|
+
|
|
|
+ // 季节性图例回显
|
|
|
+ this.SeasonExtraConfig.ChartLegend = []
|
|
|
+ chartDataHandle.map(item =>{
|
|
|
+ this.SeasonExtraConfig.ChartLegend.push({Name:item.Years,Value:item.ChartLegend})
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
this.tableData.forEach((item) => {
|
|
|
let edbData = EdbInfoList.find(_ => _.EdbInfoId===item.EdbInfoId);
|
|
|
item.DataList = edbData.DataList;
|
|
@@ -299,7 +338,7 @@ export default {
|
|
|
? selectDateStart
|
|
|
: '',
|
|
|
end_date: this.year_select === 5 ? selectDateEnd : '',
|
|
|
- count_year: this.year_select === 100 ? this.count_year : ''
|
|
|
+ count_year: this.year_select === 20 ? this.count_year : ''
|
|
|
};
|
|
|
this.isDateDia = true;
|
|
|
},
|
|
@@ -308,39 +347,35 @@ export default {
|
|
|
this.year_select = data.dateType;
|
|
|
this.isDateDia = false;
|
|
|
this.count_year = data.count_year
|
|
|
+
|
|
|
+ let dateStart = data.start_date
|
|
|
+ let dateEnd = data.end_date
|
|
|
+ let latestYear = parseInt(this.latestDate.substring(0,4))
|
|
|
+ if(data.dateType==20){
|
|
|
+ dateStart = `${latestYear-data.count_year+1}-01-01`
|
|
|
+ dateEnd = `${latestYear}-12-31`
|
|
|
+ }
|
|
|
+
|
|
|
if(this.chartInfo.ChartType === 2){
|
|
|
- this.season_year = [data.start_date, data.end_date];
|
|
|
- /*
|
|
|
- 根据区间更新 横坐标显示范围的值
|
|
|
- 根据选择的时间长度和指标数据区间交集,取最新数据所在年份,修改横坐标显示范围的年份
|
|
|
- */
|
|
|
- // console.log(data.start_date,this.latestDate);
|
|
|
- // if(new Date(data.start_date) > new Date(this.latestDate)){
|
|
|
- // let latestYear = parseInt(this.latestDate.substring(0,4))
|
|
|
- // this.xAxisRange=[`${latestYear}-01-01`,`${latestYear}-12-31`]
|
|
|
- // }else if(new Date(data.end_date) > new Date(this.latestDate)){
|
|
|
- // let latestYear = parseInt(this.latestDate.substring(0,4))
|
|
|
- // let startMonthAndDate = this.xAxisRange[0].substring(4)
|
|
|
- // let endMonthAndDate = this.xAxisRange[1].substring(4)
|
|
|
- // this.xAxisRange=[latestYear+startMonthAndDate,latestYear+endMonthAndDate]
|
|
|
- // }else{
|
|
|
- // let latestYear = parseInt(data.end_date.substring(0,4))
|
|
|
- // let startMonthAndDate = this.xAxisRange[0].substring(4)
|
|
|
- // let endMonthAndDate = this.xAxisRange[1].substring(4)
|
|
|
- // this.xAxisRange=[latestYear+startMonthAndDate,latestYear+endMonthAndDate]
|
|
|
- // }
|
|
|
- }else{
|
|
|
- this.select_date = [data.start_date, data.end_date];
|
|
|
- if(data.dateType==100){
|
|
|
- this.dateTip = `最近${data.count_year}年`
|
|
|
- }else if (data.dateType === 5) {
|
|
|
- this.dateTip = `${data.start_date}~${data.end_date}`;
|
|
|
- } else {
|
|
|
- this.dateTip = `${data.start_date}~至今`;
|
|
|
+ if(data.dateType==6){
|
|
|
+ // 回显
|
|
|
+ dateEnd = this.$moment(new Date()).format("YYYY-MM-DD")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // this.getPreviewSplineInfo();
|
|
|
+ this.season_year = [dateStart, dateEnd];
|
|
|
+ // 因为原本季节性图不支持 DateType为5和6的 所以季节性也将StartDate和EndDate传过去
|
|
|
+ this.select_date = [dateStart, dateEnd];
|
|
|
+
|
|
|
+ if(data.dateType==20){
|
|
|
+ this.dateTip = `最近${data.count_year}年`
|
|
|
+ }else if (data.dateType === 5) {
|
|
|
+ this.dateTip = `${data.start_date}~${data.end_date}`;
|
|
|
+ } else {
|
|
|
+ this.dateTip = `${data.start_date}~至今`;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getPreviewSplineInfo();
|
|
|
},
|
|
|
|
|
|
/* 季节图切换年份 保持当前配置 */
|
|
@@ -350,7 +385,7 @@ export default {
|
|
|
|
|
|
/* 切换图重置状态 */
|
|
|
initStatus() {
|
|
|
- this.year_select = 3;
|
|
|
+ this.year_select = this.chartInfo.ChartType === 2?20:3;
|
|
|
this.select_date = '';
|
|
|
this.isSetExtremeValue = true;
|
|
|
this.calendar_type = '公历';
|
|
@@ -515,9 +550,11 @@ export default {
|
|
|
return {
|
|
|
...public_param,
|
|
|
Calendar: this.calendar_type,
|
|
|
- CountYear: this.count_year,
|
|
|
- SeasonStartDate: this.season_year ? this.season_year[0] : '',
|
|
|
- SeasonEndDate: this.season_year ? this.season_year[1] : '',
|
|
|
+ DateType: this.year_select,
|
|
|
+ StartYear: this.count_year || 0,
|
|
|
+ StartDate: this.season_year ? this.season_year[0] : '',
|
|
|
+ EndDate: this.season_year ? this.season_year[1] : '',
|
|
|
+ SeasonExtraConfig:this.SeasonExtraConfig
|
|
|
}
|
|
|
case 7:
|
|
|
return {
|
|
@@ -548,8 +585,6 @@ export default {
|
|
|
StartDate: "",
|
|
|
EndDate: "",
|
|
|
Calendar: "公历",
|
|
|
- SeasonStartDate: "",
|
|
|
- SeasonEndDate: "",
|
|
|
ExtraConfig: JSON.stringify({
|
|
|
XName: this.$refs.SectionScatterOptRef.seriesArr[0].x_title,
|
|
|
YName: this.$refs.SectionScatterOptRef.seriesArr[0].y_title,
|
|
@@ -597,18 +632,29 @@ export default {
|
|
|
},
|
|
|
// 设置图表的默认值
|
|
|
setChartDefault(){
|
|
|
- console.log(this.latestDate,this.earliestDate,'earliestDate');
|
|
|
+ // console.log(this.latestDate,this.earliestDate,'earliestDate');
|
|
|
if(!(this.tableData && this.tableData.length>0)) return
|
|
|
if(this.chartInfo.ChartType === 2){
|
|
|
// 季节性图默认选择最近5年
|
|
|
- this.year_select = 100
|
|
|
+ this.year_select = 20
|
|
|
this.count_year = 5
|
|
|
// 获取最近日期的年
|
|
|
let latestYear = parseInt(this.latestDate.substring(0,4))
|
|
|
- this.season_year=[`${latestYear-4}-01-01`,`${latestYear}-12-31`]
|
|
|
+
|
|
|
+ this.season_year=[`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`]
|
|
|
this.xAxisRange = ['01-01','12-31']
|
|
|
+ this.SeasonExtraConfig.XStartDate = this.xAxisRange[0]
|
|
|
+ this.SeasonExtraConfig.XEndDate = this.xAxisRange[1]
|
|
|
this.isSpanYear=false
|
|
|
this.isSpanYearDisable=false
|
|
|
+ this.SeasonExtraConfig.ChartLegend=[]
|
|
|
+
|
|
|
+ const chartDataHandle = this.calendar_type === "农历"?
|
|
|
+ this.tableData[0].DataList.filter((item, index) => index > 0):
|
|
|
+ this.tableData[0].DataList
|
|
|
+ chartDataHandle.map(item =>{
|
|
|
+ this.SeasonExtraConfig.ChartLegend.push({Name:item.Years,Value:item.ChartLegend})
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
// 横轴显示范围改变
|
|
@@ -617,39 +663,36 @@ export default {
|
|
|
// console.log(date[0],date[1]);
|
|
|
let xStartDate = date[0]
|
|
|
let xEndDate = date[1]
|
|
|
- if(new Date(`2013-${xStartDate}`) > new Date(`2013-${xEndDate}`) ||
|
|
|
- new Date(`2013-${xStartDate}`) == new Date(`2013-${xEndDate}`)){
|
|
|
+ if(new Date(`2023-${xStartDate}`) > new Date(`2023-${xEndDate}`) ||
|
|
|
+ new Date(`2023-${xStartDate}`) == new Date(`2023-${xEndDate}`)){
|
|
|
// 开始日期 >= 结束日期 跨年
|
|
|
this.isSpanYear=true
|
|
|
this.isSpanYearDisable=true
|
|
|
}else{
|
|
|
this.isSpanYearDisable=false
|
|
|
}
|
|
|
+ this.xAxisRange = [xStartDate,xEndDate]
|
|
|
+ this.SeasonExtraConfig.XStartDate = xStartDate
|
|
|
+ this.SeasonExtraConfig.XEndDate = xEndDate
|
|
|
+ this.SeasonExtraConfig.JumpYear = this.isSpanYear?1:0
|
|
|
+ this.getPreviewSplineInfo()
|
|
|
}else{
|
|
|
this.isSpanYearDisable=false
|
|
|
}
|
|
|
},
|
|
|
+ changeIsSpanYear(value){
|
|
|
+ this.SeasonExtraConfig.JumpYear = value?1:0
|
|
|
+ this.getPreviewSplineInfo()
|
|
|
+ },
|
|
|
// 打开图例编辑窗口
|
|
|
openLegendEditDia(){
|
|
|
this.legendEditDiaShow=true
|
|
|
- console.log(this.tableData);
|
|
|
- if(!(this.legendListResetUse && this.legendListResetUse.length>0)){
|
|
|
- // 由于季节性只有一个指标列
|
|
|
- this.tableData[0].DataList.map((item,index) => {
|
|
|
- this.legendListResetUse.push({legendId:index+1,legendName:item.Year+''})
|
|
|
- this.legendList.push({legendId:index+1,legendName:item.Year+''})
|
|
|
- })
|
|
|
- }else{
|
|
|
- let len = this.legendList.length
|
|
|
- let resetUseLen = this.legendListResetUse.length
|
|
|
-
|
|
|
- }
|
|
|
- console.log(this.legendList,'legendList');
|
|
|
},
|
|
|
// 图例编辑接口保存
|
|
|
saveLegend(copyList){
|
|
|
if(copyList && copyList.length>0){
|
|
|
- this.legendList = copyList
|
|
|
+ this.SeasonExtraConfig.ChartLegend = copyList
|
|
|
+ this.getPreviewSplineInfo()
|
|
|
this.legendEditDiaShow=false
|
|
|
}
|
|
|
}
|