Merge branch 'main' of github.com:dataease/dataease into main

This commit is contained in:
taojinlong 2021-03-11 16:24:55 +08:00
commit c0f3ec646f
3 changed files with 33 additions and 45 deletions

View File

@ -153,7 +153,7 @@ public class ChartViewService {
public String transMysqlSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis) { public String transMysqlSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis) {
// TODO 字段汇总 排序等 // TODO 字段汇总 排序等
String[] field = yAxis.stream().map(y -> "CAST(" + y.getSummary() + "(" + y.getOriginName() + ") AS DECIMAL(10,2))").toArray(String[]::new); String[] field = yAxis.stream().map(y -> "CAST(" + y.getSummary() + "(" + y.getOriginName() + ") AS DECIMAL(20,2))").toArray(String[]::new);
String[] group = xAxis.stream().map(ChartViewFieldDTO::getOriginName).toArray(String[]::new); String[] group = xAxis.stream().map(ChartViewFieldDTO::getOriginName).toArray(String[]::new);
return MessageFormat.format("SELECT {0},{1} FROM {2} GROUP BY {3}", StringUtils.join(group, ","), StringUtils.join(field, ","), table, StringUtils.join(group, ",")); return MessageFormat.format("SELECT {0},{1} FROM {2} GROUP BY {3}", StringUtils.join(group, ","), StringUtils.join(field, ","), table, StringUtils.join(group, ","));
} }

View File

@ -2,20 +2,17 @@
<span> <span>
<el-dropdown trigger="click" size="small"> <el-dropdown trigger="click" size="small">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<span <el-tag size="small" class="item-axis">
class="item-axis"
>
{{ item.name }}<i class="el-icon-arrow-down el-icon--right" /> {{ item.name }}<i class="el-icon-arrow-down el-icon--right" />
<span /> </el-tag>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-edit-outline"> <el-dropdown-item icon="el-icon-edit-outline">
item1 item1
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item icon="el-icon-delete"> <el-dropdown-item icon="el-icon-delete">
item2 item2
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</span>
</span> </span>
</el-dropdown> </el-dropdown>
</span> </span>
@ -43,13 +40,10 @@ export default {
.item-axis { .item-axis {
padding: 1px 6px; padding: 1px 6px;
margin: 0 3px 2px 3px; margin: 0 3px 2px 3px;
border: solid 1px #eee;
background-color: #f1f1f1;
text-align: left; text-align: left;
height: 24px; height: 24px;
line-height: 22px; line-height: 22px;
display: inline-block; display: inline-block;
color: #1890ff;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
white-space: nowrap; white-space: nowrap;

View File

@ -2,32 +2,29 @@
<span> <span>
<el-dropdown trigger="click" size="small"> <el-dropdown trigger="click" size="small">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<span <el-tag size="small" class="item-axis">
class="item-axis"
>
{{ item.name }}<span class="summary-span">{{ $t('chart.'+item.summary) }}</span><i class="el-icon-arrow-down el-icon--right" /> {{ item.name }}<span class="summary-span">{{ $t('chart.'+item.summary) }}</span><i class="el-icon-arrow-down el-icon--right" />
<span /> </el-tag>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-notebook-2"> <el-dropdown-item icon="el-icon-notebook-2">
<el-dropdown placement="right-start" size="small" @command="summary"> <el-dropdown placement="right-start" size="small" @command="summary">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{ $t('chart.summary') }}<span class="summary-span">({{ $t('chart.'+item.summary) }})</span><i class="el-icon-arrow-right el-icon--right" /> {{ $t('chart.summary') }}<span class="summary-span">({{ $t('chart.'+item.summary) }})</span><i class="el-icon-arrow-right el-icon--right" />
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeSummary('sum')">{{ $t('chart.sum') }}</el-dropdown-item> <el-dropdown-item :command="beforeSummary('sum')">{{ $t('chart.sum') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('avg')">{{ $t('chart.avg') }}</el-dropdown-item> <el-dropdown-item :command="beforeSummary('avg')">{{ $t('chart.avg') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('max')">{{ $t('chart.max') }}</el-dropdown-item> <el-dropdown-item :command="beforeSummary('max')">{{ $t('chart.max') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('min')">{{ $t('chart.min') }}</el-dropdown-item> <el-dropdown-item :command="beforeSummary('min')">{{ $t('chart.min') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('std')">{{ $t('chart.std') }}</el-dropdown-item> <el-dropdown-item :command="beforeSummary('std')">{{ $t('chart.std') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSummary('var_samp')">{{ $t('chart.var_samp') }}</el-dropdown-item> <el-dropdown-item :command="beforeSummary('var_samp')">{{ $t('chart.var_samp') }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item icon="el-icon-delete"> <el-dropdown-item icon="el-icon-delete">
item4 item4
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</span>
</span> </span>
</el-dropdown> </el-dropdown>
</span> </span>
@ -67,13 +64,10 @@ export default {
.item-axis { .item-axis {
padding: 1px 6px; padding: 1px 6px;
margin: 0 3px 2px 3px; margin: 0 3px 2px 3px;
border: solid 1px #eee;
background-color: #f1f1f1;
text-align: left; text-align: left;
height: 24px; height: 24px;
line-height: 22px; line-height: 22px;
display: inline-block; display: inline-block;
color: #1890ff;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
white-space: nowrap; white-space: nowrap;