Merge branch 'dev' into pr@dev@fix_gauge_batch_edit

This commit is contained in:
wisonic-s 2023-09-06 19:41:30 +08:00
commit f502ffa6c0
18 changed files with 547 additions and 275 deletions

View File

@ -292,6 +292,7 @@ export default {
this.myChart = this.$echarts.init(document.getElementById(this.chartId))
}
this.drawEcharts()
this.myChart.off('click')
this.myChart.on('click', function(param) {
that.pointParam = param
if (that.linkageActiveParam) {

View File

@ -275,6 +275,11 @@ export default {
this.logic = this.item.logic
this.filterType = this.item.filterType
this.enumCheckField = this.item.enumCheckField
// init enum option
if (this.item.filterType === 'enum' && this.needRequestEnum) {
this.initEnumOptions()
}
},
initEnumOptions() {
//

View File

@ -1,8 +1,8 @@
#!/bin/sh
mvn clean package
cp view-chartmix-backend/target/view-chartmix-backend-1.18.9.jar .
cp view-chartmix-backend/target/view-chartmix-backend-1.18.10.jar .
zip -r chartmix.zip ./view-chartmix-backend-1.18.9.jar ./plugin.json
zip -r chartmix.zip ./view-chartmix-backend-1.18.10.jar ./plugin.json
rm -f ./view-chartmix-backend-1.18.9.jar
rm -f ./view-chartmix-backend-1.18.10.jar

View File

@ -5,9 +5,9 @@
"cost": 0,
"category": "view",
"descript": "AntV G2Plot 组合图插件",
"version": "1.18.9",
"version": "1.18.10",
"creator": "DATAEASE",
"moduleName": "view-chartmix-backend",
"require": "1.18.9",
"require": "1.18.10",
"dsType": ""
}

View File

@ -1,5 +1,6 @@
package io.dataease.plugins.view.official.handler;
import com.google.gson.Gson;
import io.dataease.plugins.common.constants.datasource.SQLConstants;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.util.ConstantsUtil;
@ -19,7 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class DefaultViewStatHandler implements PluginViewStatHandler {
public class ChartMixViewStatHandler implements PluginViewStatHandler {
@Override
public String build(PluginViewParam pluginViewParam, ViewPluginService viewPluginService) {
@ -43,6 +44,8 @@ public class DefaultViewStatHandler implements PluginViewStatHandler {
List<PluginViewSQL> xFields = fieldSQLMap.getOrDefault("xAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList());
List<PluginViewSQL> xOrders = fieldSQLMap.getOrDefault("xAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(PluginSingleField::getSort).collect(Collectors.toList());
System.out.println("11111111 orders:"+new Gson().toJson(xOrders));
// List<String> xWheres = fieldSQLMap.get("xAxis").stream().map(singleField -> singleField.getWhere()).collect(Collectors.toList());
List<PluginViewSQL> yFields = fieldSQLMap.getOrDefault("yAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList());
@ -75,6 +78,9 @@ public class DefaultViewStatHandler implements PluginViewStatHandler {
List<PluginViewSQL> orders = new ArrayList<>();
orders.addAll(xOrders);
orders.addAll(yOrders);
System.out.println("11111111 orders: " + new Gson().toJson(orders));
List<String> aggWheres = new ArrayList<>();
aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList()));

View File

@ -3,7 +3,7 @@ package io.dataease.plugins.view.official.impl;
import com.google.gson.Gson;
import io.dataease.plugins.common.dto.StaticResource;
import io.dataease.plugins.view.entity.*;
import io.dataease.plugins.view.official.handler.DefaultViewStatHandler;
import io.dataease.plugins.view.official.handler.ChartMixViewStatHandler;
import io.dataease.plugins.view.service.ViewPluginService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -110,11 +110,10 @@ public class ChartMixService extends ViewPluginService {
if (CollectionUtils.isNotEmpty(yAxisExt)) {
yAxis.addAll(yAxisExt);
}*/
System.out.println(new Gson().toJson(yAxis));
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis)) {
return null;
}
String sql = new DefaultViewStatHandler().build(param, this);
String sql = new ChartMixViewStatHandler().build(param, this);
System.out.println(sql);
return sql;

View File

@ -16,6 +16,34 @@
<el-color-picker v-model="labelForm.color" class="color-picker-style" :predefine="predefineColors"
@change="changeLabelAttr"/>
</el-form-item>
<el-form-item
class="form-item"
>
<template #label>
{{ $t('chart.label_position') }}
<el-tooltip
effect="dark"
content="仅对柱状图生效"
>
<i
class="el-icon-info"
style="cursor: pointer;"
/>
</el-tooltip>
</template>
<el-select
v-model="labelForm.position"
:placeholder="$t('chart.label_position')"
@change="changeLabelAttr"
>
<el-option
v-for="option in labelPositionV"
:key="option.value"
:label="option.name"
:value="option.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item :label="$t('chart.label')" class="form-item">
<el-select v-model="values" :placeholder="$t('commons.please_select')" multiple collapse-tags
@change="changeFields">
@ -125,7 +153,12 @@ export default {
],
predefineColors: COLOR_PANEL,
values: null,
busiType: 'labelAxis'
busiType: 'labelAxis',
labelPositionV: [
{name: this.$t('chart.text_pos_top'), value: 'top'},
{name: this.$t('chart.center'), value: 'middle'},
{name: this.$t('chart.text_pos_bottom'), value: 'bottom'}
],
}
},
watch: {

View File

@ -70,7 +70,7 @@
/>
</el-tag>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item>
<el-dropdown-item>
<el-dropdown
placement="right-start"
size="mini"
@ -83,7 +83,7 @@
<span>{{ $t('chart.sort') }}</span>
<span class="summary-span-item">({{ $t('chart.' + item.sort) }})</span>
</span>
<i class="el-icon-arrow-right el-icon&#45;&#45;right"/>
<i class="el-icon-arrow-right el-icon--right"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
@ -95,82 +95,82 @@
>{{ $t('chart.custom_sort') }}...</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>-->
<!-- <el-dropdown-item
v-show="item.deType === 1"
divided
>
<el-dropdown
placement="right-start"
size="mini"
style="width: 100%"
@command="dateStyle"
>
<span class="el-dropdown-link inner-dropdown-menu">
<span>
<i class="el-icon-c-scale-to-original"/>
<span>{{ $t('chart.dateStyle') }}</span>
<span class="summary-span-item">({{ $t('chart.' + item.dateStyle) }})</span>
</span>
<i class="el-icon-arrow-right el-icon&#45;&#45;right"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeDateStyle('y')">{{ $t('chart.y') }}</el-dropdown-item>
<el-dropdown-item
v-if="showDateExt"
:command="beforeDateStyle('y_Q')"
>{{ $t('chart.y_Q') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M')">{{ $t('chart.y_M') }}</el-dropdown-item>
<el-dropdown-item
v-if="showDateExt"
:command="beforeDateStyle('y_W')"
>{{ $t('chart.y_W') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d')">{{ $t('chart.y_M_d') }}</el-dropdown-item>
<el-dropdown-item
:command="beforeDateStyle('H_m_s')"
divided
>{{ $t('chart.H_m_s') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m')">{{ $t('chart.y_M_d_H_m') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m_s')">{{
$t('chart.y_M_d_H_m_s')
}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item v-show="item.deType === 1">
<el-dropdown
placement="right-start"
size="mini"
style="width: 100%"
@command="datePattern"
>
<span class="el-dropdown-link inner-dropdown-menu">
<span>
<i class="el-icon-timer"/>
<span>{{ $t('chart.datePattern') }}</span>
<span class="summary-span-item">({{ $t('chart.' + item.datePattern) }})</span>
</span>
<i class="el-icon-arrow-right el-icon&#45;&#45;right"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeDatePattern('date_sub')">{{
$t('chart.date_sub')
}}(1990-01-01)</el-dropdown-item>
<el-dropdown-item :command="beforeDatePattern('date_split')">{{
$t('chart.date_split')
}}(1990/01/01)</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<!-- <el-dropdown-item
v-show="item.deType === 1"
divided
>
<el-dropdown
placement="right-start"
size="mini"
style="width: 100%"
@command="dateStyle"
>
<span class="el-dropdown-link inner-dropdown-menu">
<span>
<i class="el-icon-c-scale-to-original"/>
<span>{{ $t('chart.dateStyle') }}</span>
<span class="summary-span-item">({{ $t('chart.' + item.dateStyle) }})</span>
</span>
<i class="el-icon-arrow-right el-icon&#45;&#45;right"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeDateStyle('y')">{{ $t('chart.y') }}</el-dropdown-item>
<el-dropdown-item
v-if="showDateExt"
:command="beforeDateStyle('y_Q')"
>{{ $t('chart.y_Q') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M')">{{ $t('chart.y_M') }}</el-dropdown-item>
<el-dropdown-item
v-if="showDateExt"
:command="beforeDateStyle('y_W')"
>{{ $t('chart.y_W') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d')">{{ $t('chart.y_M_d') }}</el-dropdown-item>
<el-dropdown-item
:command="beforeDateStyle('H_m_s')"
divided
>{{ $t('chart.H_m_s') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m')">{{ $t('chart.y_M_d_H_m') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m_s')">{{
$t('chart.y_M_d_H_m_s')
}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item v-show="item.deType === 1">
<el-dropdown
placement="right-start"
size="mini"
style="width: 100%"
@command="datePattern"
>
<span class="el-dropdown-link inner-dropdown-menu">
<span>
<i class="el-icon-timer"/>
<span>{{ $t('chart.datePattern') }}</span>
<span class="summary-span-item">({{ $t('chart.' + item.datePattern) }})</span>
</span>
<i class="el-icon-arrow-right el-icon&#45;&#45;right"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeDatePattern('date_sub')">{{
$t('chart.date_sub')
}}(1990-01-01)</el-dropdown-item>
<el-dropdown-item :command="beforeDatePattern('date_split')">{{
$t('chart.date_split')
}}(1990/01/01)</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item
v-if="chart && chart.render === 'antv' && chart.type.includes('table') && item.groupType === 'q'"
icon="el-icon-notebook-2"
divided
:command="beforeClickItem('formatter')"
>
<span>{{ $t('chart.value_formatter') }}...</span>
</el-dropdown-item>-->
<el-dropdown-item
v-if="chart && chart.render === 'antv' && chart.type.includes('table') && item.groupType === 'q'"
icon="el-icon-notebook-2"
divided
:command="beforeClickItem('formatter')"
>
<span>{{ $t('chart.value_formatter') }}...</span>
</el-dropdown-item>-->
<el-dropdown-item
icon="el-icon-edit-outline"
:command="beforeClickItem('rename')"

View File

@ -1,24 +1,65 @@
<template>
<span style="position: relative;display: inline-block;">
<i class="el-icon-arrow-down el-icon-delete" style="position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;" @click="removeItem" />
<el-dropdown trigger="click" size="mini" @command="clickItem">
<i
class="el-icon-arrow-down el-icon-delete"
style="position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@click="removeItem"
/>
<el-dropdown
trigger="click"
size="mini"
@command="clickItem"
>
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="tagType">
<el-tag
size="small"
class="item-axis"
:type="tagType"
>
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
<svg-icon
v-if="item.deType === 0"
icon-class="field_text"
class="field-icon-text"
/>
<svg-icon
v-if="item.deType === 1"
icon-class="field_time"
class="field-icon-time"
/>
<svg-icon
v-if="item.deType === 2 || item.deType === 3"
icon-class="field_value"
class="field-icon-value"
/>
<svg-icon
v-if="item.deType === 5"
icon-class="field_location"
class="field-icon-location"
/>
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
<span
class="item-span-style"
:title="item.name"
>{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'"/>
<i
class="el-icon-arrow-down el-icon--right"
style="position: absolute;top: 6px;right: 10px;"
/>
</el-tag>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
<el-dropdown-item
icon="el-icon-files"
:command="beforeClickItem('filter')"
>
<span>{{ $t('chart.filter') }}...</span>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-delete" divided :command="beforeClickItem('remove')">
<el-dropdown-item
icon="el-icon-delete"
divided
:command="beforeClickItem('remove')"
>
<span>{{ $t('chart.delete') }}</span>
</el-dropdown-item>
</el-dropdown-menu>
@ -28,11 +69,12 @@
</template>
<script>
import { getItemType } from './utils'
import {getItemType} from './utils'
import FieldErrorTips from './FieldErrorTips'
export default {
name: 'FilterItem',
components: { FieldErrorTips },
components: {FieldErrorTips},
props: {
param: {
type: Object,
@ -53,25 +95,34 @@ export default {
quotaData: {
type: Array,
required: true
}
},
bus: {
type: Object,
required: false,
default: null
},
},
data() {
return {
tagType: 'success'
tagType: 'success'
}
},
watch: {
dimensionData: function() {
dimensionData: function () {
this.getItemTagType()
},
quotaData: function() {
quotaData: function () {
this.getItemTagType()
},
item: function() {
item: function () {
this.getItemTagType()
}
},
mounted() {
this.bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
this.bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
clickItem(param) {
@ -110,45 +161,45 @@ export default {
</script>
<style scoped>
.item-axis {
padding: 1px 6px;
margin: 0 3px 2px 3px;
text-align: left;
height: 24px;
line-height: 22px;
display: flex;
border-radius: 4px;
box-sizing: border-box;
white-space: nowrap;
width: 159px;
}
.item-axis {
padding: 1px 6px;
margin: 0 3px 2px 3px;
text-align: left;
height: 24px;
line-height: 22px;
display: flex;
border-radius: 4px;
box-sizing: border-box;
white-space: nowrap;
width: 159px;
}
.item-axis:hover {
background-color: #fdfdfd;
cursor: pointer;
}
.item-axis:hover {
background-color: #fdfdfd;
cursor: pointer;
}
span {
font-size: 12px;
}
span {
font-size: 12px;
}
.summary-span{
margin-left: 4px;
color: #878d9f;;
}
.summary-span {
margin-left: 4px;
color: #878d9f;;
}
.inner-dropdown-menu{
display: flex;
justify-content: space-between;
align-items: center;
width: 100%
}
.inner-dropdown-menu {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%
}
.item-span-style{
display: inline-block;
width: 100px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.item-span-style {
display: inline-block;
width: 115px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style>

View File

@ -8,19 +8,19 @@
<draggable v-model="view.xaxis" group="drag" animation="300" :move="onMove" class="drag-block-style"
@add="addXaxis" @update="calcData(true)">
<transition-group class="draggable-group">
<sankey-dimension-item v-for="(item,index) in view.xaxis" :key="index"
:param="param"
:index="0"
:item="item"
:dimension-data="dimension"
:quota-data="quotaData"
:chart="chart"
@onDimensionItemChange="dimensionItemChange"
@onDimensionItemRemove="dimensionItemRemove"
@editItemFilter="showDimensionEditFilter"
@onNameEdit="showRename"
dimension-name="dimension"
:bus="bus"
<dimension-item v-for="(item,index) in view.xaxis" :key="index"
:param="param"
:index="0"
:item="item"
:dimension-data="dimension"
:quota-data="quotaData"
:chart="chart"
@onDimensionItemChange="dimensionItemChange"
@onDimensionItemRemove="dimensionItemRemove"
@editItemFilter="showDimensionEditFilter"
@onNameEdit="showRename"
dimension-name="dimension"
:bus="bus"
/>
</transition-group>
</draggable>
@ -84,7 +84,7 @@
@add="addCustomFilter" @update="calcData(true)">
<transition-group class="draggable-group">
<filter-item v-for="(item,index) in view.customFilter" :key="item.id" :param="param" :index="index"
:item="item" :dimension-data="dimension" :quota-data="quota"
:item="item" :dimension-data="dimension" :quota-data="quota" :bus="bus"
@onFilterItemRemove="filterItemRemove"
@editItemFilter="showEditFilter"/>
</transition-group>
@ -98,7 +98,7 @@
</template>
<script>
import SankeyDimensionItem from '@/components/views/SankeyDimensionItem'
import DimensionItem from '@/components/views/DimensionItem'
import QuotaItem from '@/components/views/QuotaItem'
import QuotaExtItem from '@/components/views/QuotaExtItem'
import FilterItem from '@/components/views/FilterItem'
@ -118,7 +118,7 @@ export default {
},
},
components: {
SankeyDimensionItem,
DimensionItem,
QuotaItem,
QuotaExtItem,
FilterItem
@ -197,7 +197,9 @@ export default {
},
addXaxis(e) {
if (this.view.type !== 'table-info') {
this.dragCheckType(this.view.xaxis, 'd')
}
this.dragMoveDuplicate(this.view.xaxis, e)
/*if (this.view.xaxis.length > 1) {
this.view.xaxis = [this.view.xaxis[0]]

View File

@ -36,7 +36,13 @@ import {Mix} from '@antv/g2plot'
import {uuid, hexColorToRGBA} from '@/utils/chartmix'
import ViewTrackBar from '@/components/views/ViewTrackBar'
import {getRemark} from "@/components/views/utils";
import {DEFAULT_TITLE_STYLE, DEFAULT_XAXIS_STYLE, DEFAULT_YAXIS_STYLE, transAxisPosition, getLineDash} from '@/utils/map';
import {
DEFAULT_TITLE_STYLE,
DEFAULT_XAXIS_STYLE,
DEFAULT_YAXIS_STYLE,
transAxisPosition,
getLineDash
} from '@/utils/map';
import ChartTitleUpdate from '@/components/views/ChartTitleUpdate';
import _ from 'lodash';
import {clear} from 'size-sensor'
@ -294,6 +300,7 @@ export default {
let customAttr = undefined;
let colors = undefined;
let labelSetting = undefined;
let labelPosition = 'middle';
if (this.chart.customAttr) {
customAttr = JSON.parse(this.chart.customAttr);
if (customAttr) {
@ -302,15 +309,12 @@ export default {
}
if (customAttr.label) {
labelSetting = customAttr.label.show ? {
callback: function (x) {
return {
style: {
fill: customAttr.label.color,
fontSize: parseInt(customAttr.label.fontSize),
},
};
style: {
fill: customAttr.label.color,
fontSize: parseInt(customAttr.label.fontSize),
},
} : false
labelPosition = customAttr.label.position;
}
}
}
@ -330,8 +334,16 @@ export default {
names.push(t.name);
const _chartType = this.getChartType(yaxisList[_index].chartType);
if (_chartType === "column") {
_labelSetting.position = labelPosition;
} else {
_labelSetting.position = undefined;
}
return {
type: this.getChartType(yaxisList[_index].chartType),
type: _chartType,
name: t.name,
options: {
data: _.map(t.data, (v) => {
@ -374,8 +386,17 @@ export default {
names.push(t.name);
const _chartType = this.getChartType(yaxisExtList[_index].chartType);
if (_chartType === "column") {
_labelSetting.position = labelPosition;
} else {
_labelSetting.position = undefined;
}
return {
type: this.getChartType(yaxisExtList[_index].chartType),
type: _chartType,
name: t.name,
options: {
data: _.map(t.data, (v) => {
@ -444,7 +465,6 @@ export default {
item.value = valueFormatter(item.data.value, yaxisExtList[item.data.i].formatterCfg)
}
})
console.log(originalItems)
return _.filter(originalItems, (item) => {
const v = item.data.key;
if (item.title === v && item.title === item.value && item.name === "key" || !names.includes(item.name)) {

View File

@ -1,6 +1,5 @@
package io.dataease.plugins.view.official.handler;
import com.google.gson.Gson;
import io.dataease.plugins.common.constants.datasource.SQLConstants;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.util.ConstantsUtil;
@ -21,7 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class DefaultViewStatHandler implements PluginViewStatHandler {
public class RaceBarViewStatHandler implements PluginViewStatHandler {
@Override
public String build(PluginViewParam pluginViewParam, ViewPluginService viewPluginService) {

View File

@ -1,11 +1,10 @@
package io.dataease.plugins.view.official.impl;
import com.google.gson.Gson;
import io.dataease.plugins.common.dto.StaticResource;
import io.dataease.plugins.view.entity.PluginViewField;
import io.dataease.plugins.view.entity.PluginViewParam;
import io.dataease.plugins.view.entity.PluginViewType;
import io.dataease.plugins.view.official.handler.DefaultViewStatHandler;
import io.dataease.plugins.view.official.handler.RaceBarViewStatHandler;
import io.dataease.plugins.view.service.ViewPluginService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -107,7 +106,7 @@ public class RaceBarService extends ViewPluginService {
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis) || xAxis.size() < 2) {
return null;
}
String sql = new DefaultViewStatHandler().build(param, this);
String sql = new RaceBarViewStatHandler().build(param, this);
return sql;
}

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%;">
<el-col>
<el-form v-show="chart.type" ref="labelForm" :model="labelForm" label-width="80px" size="mini">
<el-form v-show="chart.type" ref="labelForm" :model="labelForm" label-width="80px" size="mini" :rules="rules">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="labelForm.show" @change="changeAttr">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>
@ -29,30 +29,58 @@
/>
</el-form-item>
<el-form-item
:label="$t('chart.margin_model')"
class="form-item"
>
<el-radio-group
v-model="labelForm.marginModel"
size="mini"
@change="changeMarginStyle(labelForm.marginModel, 'marginModel')"
>
<el-radio-button label="absolute">{{ $t('chart.margin_model_absolute') }}</el-radio-button>
<el-radio-button label="relative">{{ $t('chart.margin_model_relative') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item
:label="$t('chart.text_pos_bottom')"
class="form-item"
prop="marginBottom"
prop="bottom"
>
<el-input
v-model="labelForm.bottom"
type="number"
class="hide-icon-number"
@change="changeAttr"
/>
>
<template
v-if="unitSuffix"
slot="append"
>
{{ unitSuffix }}
</template>
</el-input>
</el-form-item>
<el-form-item
:label="$t('chart.text_pos_right')"
class="form-item"
prop="marginRight"
prop="right"
>
<el-input
v-model="labelForm.right"
type="number"
class="hide-icon-number"
@change="changeAttr"
/>
>
<template
v-if="unitSuffix"
slot="append"
>
{{ unitSuffix }}
</template>
</el-input>
</el-form-item>
</div>
@ -62,7 +90,7 @@
</template>
<script>
import {DEFAULT_Graphic, COLOR_PANEL} from '../../utils/map'
import {DEFAULT_Graphic, COLOR_PANEL, getMarginUnit} from '../../utils/map'
export default {
name: 'SliderSetting',
@ -76,12 +104,25 @@ export default {
required: true
}
},
computed: {
unitSuffix() {
return getMarginUnit(this.labelForm)
},
},
data() {
return {
labelForm: JSON.parse(JSON.stringify(DEFAULT_Graphic)),
isSetting: false,
predefineColors: COLOR_PANEL,
fontSize: [],
rules: {
bottom: [
{validator: this.validateMarginNumber, trigger: ['blur', 'change']}
],
right: [
{validator: this.validateMarginNumber, trigger: ['blur', 'change']}
]
}
}
},
watch: {
@ -129,6 +170,35 @@ export default {
}
this.$emit('onChange', this.labelForm)
},
changeMarginStyle(value, modifyName) {
if (modifyName === 'marginModel') {
if (value === 'absolute') {
this.labelForm.bottom = JSON.parse(JSON.stringify(DEFAULT_Graphic)).bottom
this.labelForm.right = JSON.parse(JSON.stringify(DEFAULT_Graphic)).right
}
if (value === 'relative') {
this.labelForm.bottom = 15
this.labelForm.right = 5
}
}
this.labelForm['modifyName'] = modifyName
this.changeAttr()
},
validateMarginNumber(rule, value, callBack) {
if (value == null || value === '') {
callBack()
return
}
if (this.labelForm.marginModel === 'absolute' && (value < 0 || value > 200)) {
callBack(new Error(this.$t('chart.margin_placeholder')))
this.labelForm[rule.field] = 0
} else if (this.labelForm.marginModel === 'relative' && (value < 0 || value > 50)) {
callBack(new Error(this.$t('chart.margin_absolute_placeholder')))
this.labelForm[rule.field] = 0
} else {
callBack()
}
}
}
}
</script>

View File

@ -1,24 +1,65 @@
<template>
<span style="position: relative;display: inline-block;">
<i class="el-icon-arrow-down el-icon-delete" style="position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;" @click="removeItem" />
<el-dropdown trigger="click" size="mini" @command="clickItem">
<i
class="el-icon-arrow-down el-icon-delete"
style="position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@click="removeItem"
/>
<el-dropdown
trigger="click"
size="mini"
@command="clickItem"
>
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="tagType">
<el-tag
size="small"
class="item-axis"
:type="tagType"
>
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
<svg-icon
v-if="item.deType === 0"
icon-class="field_text"
class="field-icon-text"
/>
<svg-icon
v-if="item.deType === 1"
icon-class="field_time"
class="field-icon-time"
/>
<svg-icon
v-if="item.deType === 2 || item.deType === 3"
icon-class="field_value"
class="field-icon-value"
/>
<svg-icon
v-if="item.deType === 5"
icon-class="field_location"
class="field-icon-location"
/>
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
<span
class="item-span-style"
:title="item.name"
>{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'"/>
<i
class="el-icon-arrow-down el-icon--right"
style="position: absolute;top: 6px;right: 10px;"
/>
</el-tag>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
<el-dropdown-item
icon="el-icon-files"
:command="beforeClickItem('filter')"
>
<span>{{ $t('chart.filter') }}...</span>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-delete" divided :command="beforeClickItem('remove')">
<el-dropdown-item
icon="el-icon-delete"
divided
:command="beforeClickItem('remove')"
>
<span>{{ $t('chart.delete') }}</span>
</el-dropdown-item>
</el-dropdown-menu>
@ -28,11 +69,12 @@
</template>
<script>
import { getItemType } from './utils'
import {getItemType} from './utils'
import FieldErrorTips from './FieldErrorTips'
export default {
name: 'FilterItem',
components: { FieldErrorTips },
components: {FieldErrorTips},
props: {
param: {
type: Object,
@ -53,25 +95,34 @@ export default {
quotaData: {
type: Array,
required: true
}
},
bus: {
type: Object,
required: false,
default: null
},
},
data() {
return {
tagType: 'success'
tagType: 'success'
}
},
watch: {
dimensionData: function() {
dimensionData: function () {
this.getItemTagType()
},
quotaData: function() {
quotaData: function () {
this.getItemTagType()
},
item: function() {
item: function () {
this.getItemTagType()
}
},
mounted() {
this.bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
this.bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
clickItem(param) {
@ -110,45 +161,45 @@ export default {
</script>
<style scoped>
.item-axis {
padding: 1px 6px;
margin: 0 3px 2px 3px;
text-align: left;
height: 24px;
line-height: 22px;
display: flex;
border-radius: 4px;
box-sizing: border-box;
white-space: nowrap;
width: 159px;
}
.item-axis {
padding: 1px 6px;
margin: 0 3px 2px 3px;
text-align: left;
height: 24px;
line-height: 22px;
display: flex;
border-radius: 4px;
box-sizing: border-box;
white-space: nowrap;
width: 159px;
}
.item-axis:hover {
background-color: #fdfdfd;
cursor: pointer;
}
.item-axis:hover {
background-color: #fdfdfd;
cursor: pointer;
}
span {
font-size: 12px;
}
span {
font-size: 12px;
}
.summary-span{
margin-left: 4px;
color: #878d9f;;
}
.summary-span {
margin-left: 4px;
color: #878d9f;;
}
.inner-dropdown-menu{
display: flex;
justify-content: space-between;
align-items: center;
width: 100%
}
.inner-dropdown-menu {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%
}
.item-span-style{
display: inline-block;
width: 100px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.item-span-style {
display: inline-block;
width: 115px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style>

View File

@ -87,6 +87,7 @@ export const DEFAULT_SLIDER = {
export const DEFAULT_Graphic = {
show: true,
fontSize: '60',
marginModel: 'absolute',
color: '#000000',
alpha: 25,
bottom: 90,
@ -842,7 +843,7 @@ const hexToRgba = (hex, opacity) => {
}
export const getMarginUnit = marginForm => {
if (!marginForm.marginModel || marginForm.marginModel === 'auto') return null
if (!marginForm || !marginForm.marginModel || marginForm.marginModel === 'auto') return null
if (marginForm.marginModel === 'absolute') return 'px'
if (marginForm.marginModel === 'relative') return '%'
return null

View File

@ -9,18 +9,18 @@
@add="addXaxis" @update="calcData(true)">
<transition-group class="draggable-group">
<dimension-item v-for="(item,index) in view.xaxis" :key="index"
:param="param"
:index="0"
:item="item"
:dimension-data="dimension"
:quota-data="quotaData"
:chart="chart"
@onDimensionItemChange="dimensionItemChange"
@onDimensionItemRemove="dimensionItemRemove"
@editItemFilter="showDimensionEditFilter"
@onNameEdit="showRename"
dimension-name="dimension"
:bus="bus"
:param="param"
:index="0"
:item="item"
:dimension-data="dimension"
:quota-data="quotaData"
:chart="chart"
@onDimensionItemChange="dimensionItemChange"
@onDimensionItemRemove="dimensionItemRemove"
@editItemFilter="showDimensionEditFilter"
@onNameEdit="showRename"
dimension-name="dimension"
:bus="bus"
/>
</transition-group>
</draggable>
@ -97,7 +97,7 @@
@add="addCustomFilter" @update="calcData(true)">
<transition-group class="draggable-group">
<filter-item v-for="(item,index) in view.customFilter" :key="item.id" :param="param" :index="index"
:item="item" :dimension-data="dimension" :quota-data="quota"
:item="item" :dimension-data="dimension" :quota-data="quota" :bus="bus"
@onFilterItemRemove="filterItemRemove"
@editItemFilter="showEditFilter"/>
</transition-group>
@ -111,10 +111,10 @@
</template>
<script>
import DimensionItem from '@/components/views/DimensionItem'
import DimensionExtItem from '@/components/views/DimensionExtItem'
import QuotaItem from '@/components/views/QuotaItem'
import FilterItem from '@/components/views/FilterItem'
import DimensionItem from '../../../components/views/DimensionItem'
import DimensionExtItem from '../../../components/views/DimensionExtItem'
import QuotaItem from '../../../components/views/QuotaItem'
import FilterItem from '../../../components/views/FilterItem'
import messages from '@/de-base/lang/messages'
export default {
@ -176,11 +176,41 @@ export default {
quotaData() {
return this.obj.quotaData
},
listenLists() {
if (!this.view) return [0, 0, 0];
return [
this.view.xaxis ? this.view.xaxis.length : 0,
this.view.xaxisExt ? this.view.xaxisExt.length : 0,
this.view.yaxis ? this.view.yaxis.length : 0
]
}
},
created() {
this.$emit('on-add-languages', messages)
},
watch: {},
mounted() {
},
watch: {
listenLists: function (val) {
if (this.listenLists[0] <= 1 && this.listenLists[1] <= 1 && this.listenLists[2] <= 1) {
return;
}
if (this.view.xaxis.length > 1) {
this.dragCheckType(this.view.xaxis, 'd')
this.view.xaxis = [this.view.xaxis[0]]
}
if (this.view.xaxisExt.length > 1) {
this.dragCheckType(this.view.xaxisExt, 'd')
this.view.xaxisExt = [this.view.xaxisExt[0]]
}
if (this.view.yaxis.length > 1) {
this.dragCheckType(this.view.yaxis, 'q')
this.view.yaxis = [this.view.yaxis[0]]
}
this.calcData(true)
},
},
methods: {
executeAxios(url, type, data, callBack) {
const param = {
@ -210,37 +240,39 @@ export default {
},
addXaxis(e) {
if (this.view.type !== 'table-info') {
this.dragCheckType(this.view.xaxis, 'd')
}
this.dragMoveDuplicate(this.view.xaxis, e)
if (this.view.xaxis.length > 1) {
this.view.xaxis = [this.view.xaxis[0]]
//this.view.xaxis = [this.view.xaxis[0]]
} else {
this.calcData(true)
}
this.calcData(true)
},
addXaxisExt(e) {
if (this.view.type !== 'table-info') {
this.dragCheckType(this.view.xaxisExt, 'd')
}
this.dragMoveDuplicate(this.view.xaxisExt, e)
if (this.view.xaxisExt.length > 1) {
this.view.xaxisExt = [this.view.xaxisExt[0]]
//this.view.xaxisExt = [this.view.xaxisExt[0]]
} else {
this.calcData(true)
}
this.calcData(true)
},
addYaxis(e) {
this.dragCheckType(this.view.yaxis, 'q')
this.dragMoveDuplicate(this.view.yaxis, e)
if ( this.view.yaxis.length > 1) {
this.view.yaxis = [this.view.yaxis[0]]
if (this.view.yaxis.length > 1) {
//this.view.yaxis = [this.view.yaxis[0]]
} else {
this.calcData(true)
}
this.calcData(true)
},
addYaxisExt(e) {
this.dragCheckType(this.view.yaxisExt, 'q')
this.dragMoveDuplicate(this.view.yaxisExt, e)
/*if (equalsAny(this.view.type, 'map', 'bidirectional-bar') && this.view.yaxisExt.length > 1) {
this.view.yaxisExt = [this.view.yaxisExt[0]]
}*/
this.calcData(true)
},
calcData(cache) {
console.log(cache)
//console.log(cache)
//this.view.xaxis = [...this.source, ...this.target]
this.$emit('plugin-call-back', {

View File

@ -46,7 +46,7 @@ import {
componentStyle,
seniorCfg,
DEFAULT_SLIDER,
DEFAULT_Graphic,
DEFAULT_Graphic, getMarginUnit,
} from '../../../utils/map';
import ChartTitleUpdate from '../../../components/views/ChartTitleUpdate';
import {mapState} from 'vuex'
@ -554,17 +554,20 @@ export default {
chart_option.graphic.elements[0].style.text = extX;
chart_option.graphic.elements[0].style.fill = hexColorToRGBA(DEFAULT_Graphic.color, DEFAULT_Graphic.alpha);
chart_option.graphic.elements[0].style.font = 'bolder ' + DEFAULT_Graphic.fontSize + 'px monospace';
chart_option.graphic.elements[0].right = DEFAULT_Graphic.right;
chart_option.graphic.elements[0].bottom = DEFAULT_Graphic.bottom;
chart_option.graphic.elements[0].right = DEFAULT_Graphic.right + 'px';
chart_option.graphic.elements[0].bottom = DEFAULT_Graphic.bottom + 'px';
if (customAttr.graphic) {
chart_option.graphic.elements[0].style.fill = hexColorToRGBA(customAttr.graphic.color, customAttr.graphic.alpha);
chart_option.graphic.elements[0].style.font = 'bolder ' + customAttr.graphic.fontSize + 'px monospace';
const unit = _.defaultTo(getMarginUnit(customAttr.graphic), '');
if (customAttr.graphic.right !== undefined) {
chart_option.graphic.elements[0].right = customAttr.graphic.right;
chart_option.graphic.elements[0].right = customAttr.graphic.right + unit;
}
if (customAttr.graphic.bottom !== undefined) {
chart_option.graphic.elements[0].bottom = customAttr.graphic.bottom;
chart_option.graphic.elements[0].bottom = customAttr.graphic.bottom + unit;
}
}
} else {