|
@@ -52,6 +52,19 @@ export default {
|
|
|
search_have_more: true,
|
|
|
search_page: 1,
|
|
|
current_search:'',
|
|
|
+ // 季节性图和额外配置
|
|
|
+ SeasonExtraConfig:{
|
|
|
+ ChartLegend:[], // 图例名称数组
|
|
|
+ XStartDate:"01-01", // 横坐标显示范围 - 开始
|
|
|
+ XEndDate:"12-31", // 横坐标显示范围-结束
|
|
|
+ JumpYear:0, //是否跨年
|
|
|
+ },
|
|
|
+ // 横坐标显示范围回显 - 季节性图
|
|
|
+ // xAxisRange:["01-01","12-31"],
|
|
|
+ // 是否跨过一年
|
|
|
+ isSpanYear:false,
|
|
|
+ isSpanYearDisable:false,
|
|
|
+ legendEditDiaShow:false,
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -131,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
|
|
|
};
|
|
|
//检查添加指标是否已存在
|
|
@@ -167,7 +199,13 @@ export default {
|
|
|
else if(this.chartInfo.ChartType === 5 && this.tableData.length >= 2) return this.$message.warning('您选择的图表样式为散点图,最多支持2个指标')
|
|
|
this.tableData.push(tableItem);
|
|
|
this.isSetExtremeValue = true;
|
|
|
- console.log(this.tableData)
|
|
|
+ // console.log(this.tableData)
|
|
|
+
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ // 等待 tableData的 监听里面的获取到 起始时间和最近日期
|
|
|
+ this.setChartDefault()
|
|
|
+ })
|
|
|
+
|
|
|
}else {
|
|
|
this.$message.warning('录入指标已存在');
|
|
|
}
|
|
@@ -231,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,
|
|
@@ -255,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;
|
|
@@ -274,13 +328,17 @@ export default {
|
|
|
/* 打开时间段弹窗 */
|
|
|
openDateDia() {
|
|
|
// 自定义时间段回显
|
|
|
+ let selectDateStart = this.chartInfo.ChartType === 2?this.season_year[0]:this.select_date[0]
|
|
|
+ let selectDateEnd = this.chartInfo.ChartType === 2?this.season_year[1]:this.select_date[1]
|
|
|
+
|
|
|
this.dateForm = {
|
|
|
date_type: this.year_select,
|
|
|
start_date:
|
|
|
this.year_select === 5 || this.year_select === 6
|
|
|
- ? this.select_date[0]
|
|
|
+ ? selectDateStart
|
|
|
: '',
|
|
|
- end_date: this.year_select === 5 ? this.select_date[1] : '',
|
|
|
+ end_date: this.year_select === 5 ? selectDateEnd : '',
|
|
|
+ count_year: this.year_select === 20 ? this.count_year : ''
|
|
|
};
|
|
|
this.isDateDia = true;
|
|
|
},
|
|
@@ -288,23 +346,46 @@ export default {
|
|
|
dataChangeBack(data) {
|
|
|
this.year_select = data.dateType;
|
|
|
this.isDateDia = false;
|
|
|
- this.select_date = [data.start_date, data.end_date];
|
|
|
- if (data.dateType === 5) {
|
|
|
+ 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){
|
|
|
+ if(data.dateType==6){
|
|
|
+ // 回显
|
|
|
+ dateEnd = this.$moment(new Date()).format("YYYY-MM-DD")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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();
|
|
|
},
|
|
|
|
|
|
/* 季节图切换年份 保持当前配置 */
|
|
|
- seasonYearChange() {
|
|
|
- this.getPreviewSplineInfo();
|
|
|
- },
|
|
|
+ // seasonYearChange() {
|
|
|
+ // this.getPreviewSplineInfo();
|
|
|
+ // },
|
|
|
|
|
|
/* 切换图重置状态 */
|
|
|
initStatus() {
|
|
|
- this.year_select = 3;
|
|
|
+ this.year_select = this.chartInfo.ChartType === 2?20:3;
|
|
|
this.select_date = '';
|
|
|
this.isSetExtremeValue = true;
|
|
|
this.calendar_type = '公历';
|
|
@@ -314,6 +395,11 @@ export default {
|
|
|
this.barDateList = [];
|
|
|
this.chartLimit = {};
|
|
|
this.sectionScatterData = {};
|
|
|
+
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ // 等待 tableData的 监听里面的获取到 起始时间和最近日期
|
|
|
+ this.setChartDefault()
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/* 添加指标时 配置默认颜色 线条等 */
|
|
@@ -464,8 +550,11 @@ export default {
|
|
|
return {
|
|
|
...public_param,
|
|
|
Calendar: this.calendar_type,
|
|
|
- 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 {
|
|
@@ -496,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,
|
|
@@ -542,6 +629,92 @@ export default {
|
|
|
if(!this.options.series) return
|
|
|
|
|
|
this.options.yAxis[0].title.text = val;
|
|
|
+ },
|
|
|
+ // 设置图表的默认值
|
|
|
+ setChartDefault(){
|
|
|
+ // console.log(this.latestDate,this.earliestDate,'earliestDate');
|
|
|
+ if(!(this.tableData && this.tableData.length>0)) return
|
|
|
+ if(this.chartInfo.ChartType === 2){
|
|
|
+ // 季节性图默认选择最近5年
|
|
|
+ this.year_select = 20
|
|
|
+ this.count_year = 5
|
|
|
+ // 获取最近日期的年
|
|
|
+ let latestYear = parseInt(this.latestDate.substring(0,4))
|
|
|
+
|
|
|
+ this.season_year=[`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`]
|
|
|
+ // this.xAxisRange = ['01-01','12-31']
|
|
|
+ this.SeasonExtraConfig.XStartDate = '01-01'
|
|
|
+ this.SeasonExtraConfig.XEndDate = '12-31'
|
|
|
+ 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})
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 横轴显示范围改变
|
|
|
+ // xAxisRangeChange(date){
|
|
|
+ // console.log(date);
|
|
|
+ // if(date && date.length>0){
|
|
|
+ // // console.log(date[0],date[1]);
|
|
|
+ // let xStartDate = date[0]
|
|
|
+ // let xEndDate = date[1]
|
|
|
+ // 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
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // 横轴显示范围改变
|
|
|
+ xAxisChange(date){
|
|
|
+ if(this.SeasonExtraConfig.XStartDate && this.SeasonExtraConfig.XEndDate){
|
|
|
+ if(new Date(`2023-${this.SeasonExtraConfig.XStartDate}`) > new Date(`2023-${this.SeasonExtraConfig.XEndDate}`) ||
|
|
|
+ new Date(`2023-${this.SeasonExtraConfig.XStartDate}`) == new Date(`2023-${this.SeasonExtraConfig.XEndDate}`)){
|
|
|
+ // 开始日期 >= 结束日期 跨年
|
|
|
+ this.isSpanYear=true
|
|
|
+ this.isSpanYearDisable=true
|
|
|
+ }else{
|
|
|
+ this.isSpanYearDisable=false
|
|
|
+ }
|
|
|
+ this.SeasonExtraConfig.JumpYear = this.isSpanYear?1:0
|
|
|
+ //修改横轴的时候,请求入参里的图例名称需要清空一下
|
|
|
+ this.SeasonExtraConfig.ChartLegend=[]
|
|
|
+ this.getPreviewSplineInfo()
|
|
|
+ }else{
|
|
|
+ this.isSpanYearDisable=false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeIsSpanYear(value){
|
|
|
+ this.SeasonExtraConfig.JumpYear = value?1:0
|
|
|
+ this.getPreviewSplineInfo()
|
|
|
+ },
|
|
|
+ // 打开图例编辑窗口
|
|
|
+ openLegendEditDia(){
|
|
|
+ this.legendEditDiaShow=true
|
|
|
+ },
|
|
|
+ // 图例编辑接口保存
|
|
|
+ saveLegend(copyList){
|
|
|
+ if(copyList && copyList.length>0){
|
|
|
+ this.SeasonExtraConfig.ChartLegend = copyList
|
|
|
+ this.getPreviewSplineInfo()
|
|
|
+ this.legendEditDiaShow=false
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|