提交 403350e3 authored 作者: taojinlong's avatar taojinlong

Merge branch 'dev' into pr@dev@excel

package io.dataease.dto.chart;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* @Author gin
* @Date 2021/7/20 11:34 上午
*/
@Getter
@Setter
public class ChartCustomFilterItemDTO implements Serializable {
private String fieldId;
private String term;
private String value;
}
package io.dataease.dto.chart;
import io.dataease.base.domain.DatasetTableField;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
/**
* @Author gin
* @Date 2021/7/20 11:43 上午
*/
@Getter
@Setter
public class ChartFieldCustomFilterDTO implements Serializable {
private List<ChartCustomFilterItemDTO> filter;
}
...@@ -134,23 +134,35 @@ public class ChartViewService { ...@@ -134,23 +134,35 @@ public class ChartViewService {
}.getType()); }.getType());
List<ChartViewFieldDTO> yAxis = new Gson().fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() { List<ChartViewFieldDTO> yAxis = new Gson().fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
}.getType()); }.getType());
List<ChartCustomFilterDTO> customFilter = new Gson().fromJson(view.getCustomFilter(), new TypeToken<List<ChartCustomFilterDTO>>() { List<ChartFieldCustomFilterDTO> fieldCustomFilter = new Gson().fromJson(view.getCustomFilter(), new TypeToken<List<ChartFieldCustomFilterDTO>>() {
}.getType()); }.getType());
customFilter.forEach(ele -> ele.setField(dataSetTableFieldsService.get(ele.getFieldId()))); List<ChartCustomFilterDTO> customFilter = fieldCustomFilter.stream().map(ele -> {
ChartCustomFilterDTO dto = new ChartCustomFilterDTO();
ele.getFilter().forEach(f -> {
BeanUtils.copyBean(dto, f);
dto.setField(dataSetTableFieldsService.get(f.getFieldId()));
});
return dto;
}).collect(Collectors.toList());
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType())) { // if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType())) {
xAxis = new ArrayList<>(); // xAxis = new ArrayList<>();
if (CollectionUtils.isEmpty(yAxis)) { // if (CollectionUtils.isEmpty(yAxis)) {
ChartViewDTO dto = new ChartViewDTO(); // ChartViewDTO dto = new ChartViewDTO();
BeanUtils.copyBean(dto, view); // BeanUtils.copyBean(dto, view);
return dto; // return dto;
} // }
} else { // } else {
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis)) { // if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis)) {
ChartViewDTO dto = new ChartViewDTO(); // ChartViewDTO dto = new ChartViewDTO();
BeanUtils.copyBean(dto, view); // BeanUtils.copyBean(dto, view);
return dto; // return dto;
} // }
// }
if (CollectionUtils.isEmpty(xAxis) && CollectionUtils.isEmpty(yAxis)) {
ChartViewDTO dto = new ChartViewDTO();
BeanUtils.copyBean(dto, view);
return dto;
} }
// 过滤来自仪表板的条件 // 过滤来自仪表板的条件
...@@ -306,7 +318,7 @@ public class ChartViewService { ...@@ -306,7 +318,7 @@ public class ChartViewService {
// table组件 // table组件
List<ChartViewFieldDTO> fields = new ArrayList<>(); List<ChartViewFieldDTO> fields = new ArrayList<>();
List<Map<String, Object>> tableRow = new ArrayList<>(); List<Map<String, Object>> tableRow = new ArrayList<>();
if (ObjectUtils.isNotEmpty(xAxis)) { if (ObjectUtils.isNotEmpty(xAxis) && !StringUtils.equalsIgnoreCase("text", view.getType()) && !StringUtils.equalsIgnoreCase("gauge", view.getType())) {
fields.addAll(xAxis); fields.addAll(xAxis);
} }
fields.addAll(yAxis); fields.addAll(yAxis);
......
...@@ -15,6 +15,7 @@ export function ajaxGetData(id, data) { ...@@ -15,6 +15,7 @@ export function ajaxGetData(id, data) {
method: 'post', method: 'post',
loading: true, loading: true,
hideMsg: true, hideMsg: true,
timeout: 30000,
data data
}) })
} }
......
...@@ -22,6 +22,7 @@ export function querySubject(data) { ...@@ -22,6 +22,7 @@ export function querySubject(data) {
url: '/panel/subject/query', url: '/panel/subject/query',
method: 'post', method: 'post',
loading: true, loading: true,
timeout: 30000,
data data
}) })
} }
...@@ -30,6 +31,7 @@ export function querySubjectWithGroup(data) { ...@@ -30,6 +31,7 @@ export function querySubjectWithGroup(data) {
return request({ return request({
url: '/panel/subject/querySubjectWithGroup', url: '/panel/subject/querySubjectWithGroup',
method: 'post', method: 'post',
timeout: 30000,
data data
}) })
} }
...@@ -56,6 +58,7 @@ export function viewData(id, data) { ...@@ -56,6 +58,7 @@ export function viewData(id, data) {
return request({ return request({
url: '/chart/view/getData/' + id, url: '/chart/view/getData/' + id,
method: 'post', method: 'post',
timeout: 30000,
hideMsg: true, hideMsg: true,
data data
}) })
...@@ -64,6 +67,7 @@ export function panelSave(data) { ...@@ -64,6 +67,7 @@ export function panelSave(data) {
return request({ return request({
url: 'panel/group/save', url: 'panel/group/save',
method: 'post', method: 'post',
timeout: 30000,
loading: true, loading: true,
data data
}) })
...@@ -72,7 +76,8 @@ export function findOne(id) { ...@@ -72,7 +76,8 @@ export function findOne(id) {
return request({ return request({
url: 'panel/group/findOne/' + id, url: 'panel/group/findOne/' + id,
method: 'get', method: 'get',
loading: true loading: true,
timeout: 30000
}) })
} }
...@@ -87,6 +92,7 @@ export function getPreviewData(data) { ...@@ -87,6 +92,7 @@ export function getPreviewData(data) {
return request({ return request({
url: '/panel/table/getPreviewData', url: '/panel/table/getPreviewData',
method: 'post', method: 'post',
timeout: 30000,
data data
}) })
} }
...@@ -125,6 +131,7 @@ export function get(url) { ...@@ -125,6 +131,7 @@ export function get(url) {
export function delGroup(groupId) { export function delGroup(groupId) {
return request({ return request({
url: '/panel/group/deleteCircle/' + groupId, url: '/panel/group/deleteCircle/' + groupId,
method: 'post' method: 'post',
timeout: 30000
}) })
} }
...@@ -598,7 +598,7 @@ export default { ...@@ -598,7 +598,7 @@ export default {
chart_type: 'Chart Type', chart_type: 'Chart Type',
shape_attr: 'Attribute', shape_attr: 'Attribute',
module_style: 'Style', module_style: 'Style',
result_filter: 'Results Filter', result_filter: 'Filters',
x_axis: 'Horizontal axis', x_axis: 'Horizontal axis',
y_axis: 'Longitudinal axis', y_axis: 'Longitudinal axis',
chart: 'Chart', chart: 'Chart',
...@@ -804,7 +804,20 @@ export default { ...@@ -804,7 +804,20 @@ export default {
color_energy: 'Energy', color_energy: 'Energy',
color_red: 'Red', color_red: 'Red',
color_fast: 'Fast', color_fast: 'Fast',
color_spiritual: 'Spiritual' color_spiritual: 'Spiritual',
chart_data: 'Data',
chart_style: 'Style',
drag_block_type_axis: 'Type Axis',
drag_block_value_axis: 'Value Axis',
drag_block_table_data_column: 'Data Column',
drag_block_pie_angel: 'Sector Angle',
drag_block_pie_label: 'Sector Label',
drag_block_gauge_angel: 'Pointer Angle',
drag_block_label_value: 'Value',
drag_block_funnel_width: 'Funnel Width',
drag_block_funnel_split: 'Funnel Split',
drag_block_radar_length: 'Branch Length',
drag_block_radar_label: 'Branch Label'
}, },
dataset: { dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
......
...@@ -598,7 +598,7 @@ export default { ...@@ -598,7 +598,7 @@ export default {
chart_type: '圖表類型', chart_type: '圖表類型',
shape_attr: '圖形屬性', shape_attr: '圖形屬性',
module_style: '組件樣式', module_style: '組件樣式',
result_filter: '結果過濾器', result_filter: '過濾器',
x_axis: '橫軸', x_axis: '橫軸',
y_axis: '縱軸', y_axis: '縱軸',
chart: '視圖', chart: '視圖',
...@@ -804,7 +804,20 @@ export default { ...@@ -804,7 +804,20 @@ export default {
color_fast: '輕快', color_fast: '輕快',
color_spiritual: '靈動', color_spiritual: '靈動',
chart_details: '视图明细', chart_details: '视图明细',
export_details: '导出明细' export_details: '导出明细',
chart_data: '數據',
chart_style: '樣式',
drag_block_type_axis: '類別軸',
drag_block_value_axis: '值軸',
drag_block_table_data_column: '數據列',
drag_block_pie_angel: '扇區角度',
drag_block_pie_label: '扇區標簽',
drag_block_gauge_angel: '指針角度',
drag_block_label_value: '值',
drag_block_funnel_width: '漏鬥層寬',
drag_block_funnel_split: '漏鬥分層',
drag_block_radar_length: '分支長度',
drag_block_radar_label: '分支標簽'
}, },
dataset: { dataset: {
sheet_warn: '有多個sheet頁面,默認抽取第一個', sheet_warn: '有多個sheet頁面,默認抽取第一個',
......
...@@ -598,7 +598,7 @@ export default { ...@@ -598,7 +598,7 @@ export default {
chart_type: '图表类型', chart_type: '图表类型',
shape_attr: '图形属性', shape_attr: '图形属性',
module_style: '组件样式', module_style: '组件样式',
result_filter: '结果过滤器', result_filter: '过滤器',
x_axis: '横轴', x_axis: '横轴',
y_axis: '纵轴', y_axis: '纵轴',
chart: '视图', chart: '视图',
...@@ -804,7 +804,20 @@ export default { ...@@ -804,7 +804,20 @@ export default {
color_fast: '轻快', color_fast: '轻快',
color_spiritual: '灵动', color_spiritual: '灵动',
chart_details: '视图明细', chart_details: '视图明细',
export_details: '导出明细' export_details: '导出明细',
chart_data: '数据',
chart_style: '样式',
drag_block_type_axis: '类别轴',
drag_block_value_axis: '值轴',
drag_block_table_data_column: '数据列',
drag_block_pie_angel: '扇区角度',
drag_block_pie_label: '扇区标签',
drag_block_gauge_angel: '指针角度',
drag_block_label_value: '值',
drag_block_funnel_width: '漏斗层宽',
drag_block_funnel_split: '漏斗分层',
drag_block_radar_length: '分支长度',
drag_block_radar_label: '分支标签'
}, },
dataset: { dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个', sheet_warn: '有多个 Sheet 页,默认抽取第一个',
......
...@@ -15,5 +15,9 @@ module.exports = { ...@@ -15,5 +15,9 @@ module.exports = {
* @description Whether show the logo in sidebar * @description Whether show the logo in sidebar
*/ */
sidebarLogo: false, sidebarLogo: false,
showSettings: true showSettings: true,
interruptTokenContineUrls: [
'/api/sys_msg/list/',
'/dataset/taskLog/list/'
]
} }
...@@ -8,7 +8,7 @@ import i18n from '@/lang' ...@@ -8,7 +8,7 @@ import i18n from '@/lang'
import { tryShowLoading, tryHideLoading } from './loading' import { tryShowLoading, tryHideLoading } from './loading'
import { getLinkToken, setLinkToken } from '@/utils/auth' import { getLinkToken, setLinkToken } from '@/utils/auth'
// import router from '@/router' // import router from '@/router'
const interruptTokenContineUrls = Config.interruptTokenContineUrls
const TokenKey = Config.TokenKey const TokenKey = Config.TokenKey
const RefreshTokenKey = Config.RefreshTokenKey const RefreshTokenKey = Config.RefreshTokenKey
const LinkTokenKey = Config.LinkTokenKey const LinkTokenKey = Config.LinkTokenKey
...@@ -16,7 +16,7 @@ const LinkTokenKey = Config.LinkTokenKey ...@@ -16,7 +16,7 @@ const LinkTokenKey = Config.LinkTokenKey
const service = axios.create({ const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests // withCredentials: true, // send cookies when cross-domain requests
timeout: 0 // request timeout timeout: 10000 // request timeout
}) })
// request interceptor // request interceptor
...@@ -74,7 +74,7 @@ const checkAuth = response => { ...@@ -74,7 +74,7 @@ const checkAuth = response => {
}) })
} }
// token到期后自动续命 刷新token // token到期后自动续命 刷新token
if (response.headers[RefreshTokenKey]) { if (response.headers[RefreshTokenKey] && !interruptTokenContineUrls.some(item => response.config.url.indexOf(item) >= 0)) {
const refreshToken = response.headers[RefreshTokenKey] const refreshToken = response.headers[RefreshTokenKey]
store.dispatch('user/refreshToken', refreshToken) store.dispatch('user/refreshToken', refreshToken)
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" /> <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 === 5" icon-class="field_location" class="field-icon-location" />
</span> </span>
<span>{{ item.name }}</span> <span class="item-span-style" :title="item.name">{{ item.name }}</span>
</el-tag> </el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem"> <el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" /> <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 === 5" icon-class="field_location" class="field-icon-location" />
</span> </span>
{{ item.name }}<i class="el-icon-arrow-down el-icon--right" /> <span class="item-span-style" :title="item.name">{{ item.name }}</span>
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag> </el-tag>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item> <el-dropdown-item>
...@@ -38,9 +39,9 @@ ...@@ -38,9 +39,9 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-dropdown-item> </el-dropdown-item>
<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> <!-- <span>{{ $t('chart.filter') }}...</span>-->
</el-dropdown-item> <!-- </el-dropdown-item>-->
<el-dropdown-item v-show="item.deType === 1" divided> <el-dropdown-item v-show="item.deType === 1" divided>
<el-dropdown placement="right-start" size="mini" style="width: 100%" @command="dateStyle"> <el-dropdown placement="right-start" size="mini" style="width: 100%" @command="dateStyle">
...@@ -192,10 +193,11 @@ export default { ...@@ -192,10 +193,11 @@ export default {
text-align: left; text-align: left;
height: 24px; height: 24px;
line-height: 22px; line-height: 22px;
display: inline-block; display: flex;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
white-space: nowrap; white-space: nowrap;
width: 159px;
} }
.item-axis:hover { .item-axis:hover {
...@@ -218,4 +220,12 @@ export default { ...@@ -218,4 +220,12 @@ export default {
align-items: center; align-items: center;
width: 100% width: 100%
} }
.item-span-style{
display: inline-block;
width: 100px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style> </style>
<template> <template>
<div> <span>
<el-dropdown trigger="click" size="mini" @command="clickItem"> <el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis">
<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" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<el-tag size="small" class="item-axis"> <el-tag size="small" class="item-axis">
{{ item.name }}<i class="el-icon-arrow-down el-icon--right" /> <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" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag> </el-tag>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickItem('rename')"> <el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
<span>{{ $t('chart.show_name_set') }}</span> <span>{{ $t('chart.filter') }}...</span>
</el-dropdown-item> </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> <span>{{ $t('chart.delete') }}</span>
...@@ -15,25 +31,17 @@ ...@@ -15,25 +31,17 @@
</el-dropdown-menu> </el-dropdown-menu>
</span> </span>
</el-dropdown> </el-dropdown>
</span>
<el-dialog :title="$t('chart.show_name_set')" :visible="renameItem" :show-close="false" width="30%">
<el-form ref="itemForm" :model="itemForm" :rules="itemFormRules">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="itemForm.name" size="mini" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeRename()">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="saveRename(itemForm)">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
</div>
</template> </template>
<script> <script>
export default { export default {
name: 'FilterItem', name: 'FilterItem',
props: { props: {
param: {
type: Object,
required: true
},
item: { item: {
type: Object, type: Object,
required: true required: true
...@@ -45,15 +53,6 @@ export default { ...@@ -45,15 +53,6 @@ export default {
}, },
data() { data() {
return { return {
renameItem: false,
itemForm: {
name: ''
},
itemFormRules: {
name: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' }
]
}
} }
}, },
mounted() { mounted() {
...@@ -64,12 +63,12 @@ export default { ...@@ -64,12 +63,12 @@ export default {
return return
} }
switch (param.type) { switch (param.type) {
case 'rename':
this.showRename()
break
case 'remove': case 'remove':
this.removeItem() this.removeItem()
break break
case 'filter':
this.editFilter()
break
default: default:
break break
} }
...@@ -79,23 +78,9 @@ export default { ...@@ -79,23 +78,9 @@ export default {
type: type type: type
} }
}, },
showRename() { editFilter() {
this.itemForm.name = this.item.name this.item.index = this.index
this.renameItem = true this.$emit('editItemFilter', this.item)
},
closeRename() {
this.renameItem = false
this.resetRename()
},
saveRename(param) {
this.item.name = param.name
this.$emit('onFilterItemChange', this.item)
this.closeRename()
},
resetRename() {
this.itemForm = {
name: ''
}
}, },
removeItem() { removeItem() {
this.item.index = this.index this.item.index = this.index
...@@ -112,10 +97,11 @@ export default { ...@@ -112,10 +97,11 @@ export default {
text-align: left; text-align: left;
height: 24px; height: 24px;
line-height: 22px; line-height: 22px;
display: inline-block; display: flex;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
white-space: nowrap; white-space: nowrap;
width: 159px;
} }
.item-axis:hover { .item-axis:hover {
...@@ -126,4 +112,24 @@ export default { ...@@ -126,4 +112,24 @@ export default {
span { span {
font-size: 12px; font-size: 12px;
} }
.summary-span{
margin-left: 4px;
color: #878d9f;;
}
.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;
}
</style> </style>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" /> <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 === 5" icon-class="field_location" class="field-icon-location" />
</span> </span>
<span>{{ item.name }}</span> <span class="item-span-style" :title="item.name">{{ item.name }}</span>
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span> <span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
</el-tag> </el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem"> <el-dropdown v-else trigger="click" size="mini" @command="clickItem">
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" /> <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 === 5" icon-class="field_location" class="field-icon-location" />
</span> </span>
<span>{{ item.name }}</span> <span class="item-span-style" :title="item.name">{{ item.name }}</span>
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span> <span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
<i class="el-icon-arrow-down el-icon--right" /> <i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag> </el-tag>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item> <el-dropdown-item>
...@@ -196,10 +196,11 @@ export default { ...@@ -196,10 +196,11 @@ export default {
text-align: left; text-align: left;
height: 24px; height: 24px;
line-height: 22px; line-height: 22px;
display: inline-block; display: flex;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
white-space: nowrap; white-space: nowrap;
width: 159px;
} }
.item-axis:hover { .item-axis:hover {
...@@ -222,4 +223,12 @@ export default { ...@@ -222,4 +223,12 @@ export default {
align-items: center; align-items: center;
width: 100% width: 100%
} }
.item-span-style{
display: inline-block;
width: 80px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style> </style>
...@@ -64,26 +64,26 @@ export default { ...@@ -64,26 +64,26 @@ export default {
label: this.$t('chart.filter_not_like') label: this.$t('chart.filter_not_like')
}] }]
}, },
{ // {
label: '', // label: '',
options: [{ // options: [{
value: 'lt', // value: 'lt',
label: this.$t('chart.filter_lt') // label: this.$t('chart.filter_lt')
}, { // }, {
value: 'gt', // value: 'gt',
label: this.$t('chart.filter_gt') // label: this.$t('chart.filter_gt')
}] // }]
}, // },
{ // {
label: '', // label: '',
options: [{ // options: [{
value: 'le', // value: 'le',
label: this.$t('chart.filter_le') // label: this.$t('chart.filter_le')
}, { // }, {
value: 'ge', // value: 'ge',
label: this.$t('chart.filter_ge') // label: this.$t('chart.filter_ge')
}] // }]
}, // },
{ {
label: '', label: '',
options: [{ options: [{
......
...@@ -54,16 +54,16 @@ export default { ...@@ -54,16 +54,16 @@ export default {
label: this.$t('chart.filter_not_eq') label: this.$t('chart.filter_not_eq')
}] }]
}, },
{ // {
label: '', // label: '',
options: [{ // options: [{
value: 'like', // value: 'like',
label: this.$t('chart.filter_like') // label: this.$t('chart.filter_like')
}, { // }, {
value: 'not like', // value: 'not like',
label: this.$t('chart.filter_not_like') // label: this.$t('chart.filter_not_like')
}] // }]
}, // },
{ {
label: '', label: '',
options: [{ options: [{
......
...@@ -2,26 +2,11 @@ ...@@ -2,26 +2,11 @@
<el-col> <el-col>
<el-button icon="el-icon-plus" circle size="mini" style="margin-bottom: 10px;" @click="addFilter" /> <el-button icon="el-icon-plus" circle size="mini" style="margin-bottom: 10px;" @click="addFilter" />
<div style="max-height: 50vh;overflow-y: auto;"> <div style="max-height: 50vh;overflow-y: auto;">
<el-row v-for="(f,index) in chart.customFilter" :key="index" class="filter-item"> <el-row v-for="(f,index) in item.filter" :key="index" class="filter-item">
<el-col :span="6"> <el-col :span="4">
<el-select v-model="f.fieldId" size="mini" filterable> <span>{{ item.name }}</span>
<el-option
v-for="item in fields"
:key="item.id"
:label="item.name"
:value="item.id"
>
<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" />
</span>
<span style="float: left; color: #8492a6; font-size: 12px">{{ item.name }}</span>
</el-option>
</el-select>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="8">
<el-select v-model="f.term" size="mini"> <el-select v-model="f.term" size="mini">
<el-option-group <el-option-group
v-for="(group,idx) in options" v-for="(group,idx) in options"
...@@ -49,7 +34,7 @@ ...@@ -49,7 +34,7 @@
</template> </template>
<script> <script>
import { fieldList } from '../../../../api/dataset/dataset' // import { fieldList } from '../../../../api/dataset/dataset'
export default { export default {
name: 'ResultFilterEditor', name: 'ResultFilterEditor',
...@@ -57,78 +42,162 @@ export default { ...@@ -57,78 +42,162 @@ export default {
chart: { chart: {
type: Object, type: Object,
required: true required: true
},
item: {
type: Object,
required: true
} }
}, },
data() { data() {
return { return {
options: [{ textOptions: [
label: '', {
options: [{ label: '',
value: 'eq', options: [{
label: this.$t('chart.filter_eq') value: 'eq',
}, { label: this.$t('chart.filter_eq')
value: 'not_eq', }, {
label: this.$t('chart.filter_not_eq') value: 'not_eq',
}] label: this.$t('chart.filter_not_eq')
}, }]
{ },
label: '', {
options: [{ label: '',
value: 'like', options: [{
label: this.$t('chart.filter_like') value: 'like',
}, { label: this.$t('chart.filter_like')
value: 'not like', }, {
label: this.$t('chart.filter_not_like') value: 'not like',
}] label: this.$t('chart.filter_not_like')
}, }]
{ },
label: '', {
options: [{ label: '',
value: 'lt', options: [{
label: this.$t('chart.filter_lt') value: 'null',
}, { label: this.$t('chart.filter_null')
value: 'gt', }, {
label: this.$t('chart.filter_gt') value: 'not_null',
}] label: this.$t('chart.filter_not_null')
}, }]
{ }
label: '', ],
options: [{ dateOptions: [
value: 'le', {
label: this.$t('chart.filter_le') label: '',
}, { options: [{
value: 'ge', value: 'eq',
label: this.$t('chart.filter_ge') label: this.$t('chart.filter_eq')
}] }, {
}, value: 'not_eq',
{ label: this.$t('chart.filter_not_eq')
label: '', }]
options: [{ },
value: 'null', {
label: this.$t('chart.filter_null') label: '',
}, { options: [{
value: 'not_null', value: 'lt',
label: this.$t('chart.filter_not_null') label: this.$t('chart.filter_lt')
}] }, {
}], value: 'gt',
fields: [] label: this.$t('chart.filter_gt')
}]
},
{
label: '',
options: [{
value: 'le',
label: this.$t('chart.filter_le')
}, {
value: 'ge',
label: this.$t('chart.filter_ge')
}]
},
{
label: '',
options: [{
value: 'null',
label: this.$t('chart.filter_null')
}, {
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
}
],
valueOptions: [
{
label: '',
options: [{
value: 'eq',
label: this.$t('chart.filter_eq')
}, {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
},
{
label: '',
options: [{
value: 'lt',
label: this.$t('chart.filter_lt')
}, {
value: 'gt',
label: this.$t('chart.filter_gt')
}]
},
{
label: '',
options: [{
value: 'le',
label: this.$t('chart.filter_le')
}, {
value: 'ge',
label: this.$t('chart.filter_ge')
}]
},
{
label: '',
options: [{
value: 'null',
label: this.$t('chart.filter_null')
}, {
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
}
],
options: []
}
},
watch: {
'item': function() {
this.initOptions()
} }
}, },
mounted() { mounted() {
fieldList(this.chart.tableId).then(response => { this.initOptions()
this.fields = response.data
})
}, },
methods: { methods: {
initOptions() {
if (this.item) {
if (this.item.deType === 0 || this.item.deType === 5) {
this.options = JSON.parse(JSON.stringify(this.textOptions))
} else if (this.item.deType === 1) {
this.options = JSON.parse(JSON.stringify(this.dateOptions))
} else {
this.options = JSON.parse(JSON.stringify(this.valueOptions))
}
}
},
addFilter() { addFilter() {
this.chart.customFilter.push({ this.item.filter.push({
fieldId: '', fieldId: this.item.id,
term: 'eq', term: 'eq',
value: '' value: ''
}) })
}, },
removeFilter(index) { removeFilter(index) {
this.chart.customFilter.splice(index, 1) this.item.filter.splice(index, 1)
} }
} }
} }
...@@ -157,8 +226,4 @@ export default { ...@@ -157,8 +226,4 @@ export default {
display: inline-block; display: inline-block;
width: 80px!important; width: 80px!important;
} }
.el-select-dropdown__item{
padding: 0 20px;
font-size: 12px;
}
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论