feat(视图): 快速计算支持周环比
This commit is contained in:
parent
d70e8eb750
commit
6e9aadaa26
@ -10,5 +10,6 @@ public class ChartConstants {
|
||||
public static final String YEAR_YOY = "year_yoy";
|
||||
public static final String DAY_MOM = "day_mom";
|
||||
public static final String MONTH_YOY = "month_yoy";
|
||||
public static final String[] M_Y = {YEAR_MOM, MONTH_MOM, YEAR_YOY, DAY_MOM, MONTH_YOY};
|
||||
public static final String WEEK_MOM = "week_mom";
|
||||
public static final String[] M_Y = {YEAR_MOM, MONTH_MOM, YEAR_YOY, DAY_MOM, MONTH_YOY, WEEK_MOM};
|
||||
}
|
||||
|
||||
@ -1328,9 +1328,9 @@ public class ChartViewService {
|
||||
data = resultCustomSort(xAxis, data);
|
||||
}
|
||||
// 如果是表格导出查询 则在此处直接就可以返回
|
||||
if(chartExtRequest.getExcelExportFlag()){
|
||||
if (chartExtRequest.getExcelExportFlag()) {
|
||||
Map<String, Object> sourceInfo = ChartDataBuild.transTableNormal(xAxis, yAxis, view, data, extStack, desensitizationList);
|
||||
sourceInfo.put("sourceData",data);
|
||||
sourceInfo.put("sourceData", data);
|
||||
view.setData(sourceInfo);
|
||||
return view;
|
||||
}
|
||||
@ -1723,6 +1723,12 @@ public class ChartViewService {
|
||||
} else {
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(dateStyle, "y_W")) {
|
||||
if (StringUtils.equalsIgnoreCase(datePattern, "date_split")) {
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy/'W'w");
|
||||
} else {
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-'W'w");
|
||||
}
|
||||
}
|
||||
Date date = simpleDateFormat.parse(cTime);
|
||||
calendar.setTime(date);
|
||||
@ -1758,6 +1764,17 @@ public class ChartViewService {
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
lastTime = simpleDateFormat.format(calendar.getTime());
|
||||
} else if (StringUtils.equalsIgnoreCase(type, ChartConstants.WEEK_MOM)) {
|
||||
SimpleDateFormat simpleDateFormat = null;
|
||||
if (StringUtils.equalsIgnoreCase(datePattern, "date_split")) {
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy/'W'w");
|
||||
} else {
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-'W'w");
|
||||
}
|
||||
Date date = simpleDateFormat.parse(cTime);
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.WEEK_OF_YEAR, -1);
|
||||
lastTime = simpleDateFormat.format(calendar.getTime());
|
||||
}
|
||||
return lastTime;
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -27,3 +27,8 @@ export const compareDayList = [
|
||||
{ name: 'month_yoy', value: 'month_yoy' },
|
||||
{ name: 'year_yoy', value: 'year_yoy' }
|
||||
]
|
||||
|
||||
export const compareWeekList = [
|
||||
{ name: 'week_mom', value: 'week_mom' },
|
||||
{ name: 'year_yoy', value: 'year_yoy' }
|
||||
]
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { compareDayList, compareMonthList, compareYearList } from '@/views/chart/chart/compare'
|
||||
import { compareDayList, compareMonthList, compareWeekList, compareYearList } from '@/views/chart/chart/compare'
|
||||
|
||||
export default {
|
||||
name: 'CompareEdit',
|
||||
@ -128,6 +128,9 @@ export default {
|
||||
case 'y_M_d':
|
||||
this.compareList = compareDayList
|
||||
break
|
||||
case 'y_W':
|
||||
this.compareList = compareWeekList
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user