fix: 代码合并

This commit is contained in:
fit2cloud-chenyw 2023-09-12 13:20:31 +08:00
commit 9b7fc446ae
53 changed files with 573 additions and 540 deletions

View File

@ -9,5 +9,21 @@ keynode = "keynode"
SCHEM = "SCHEM"
[files]
extend-exclude = ["public/", "amap-wx/", "m-icon/", "uni-card/", "uni-col/", "uni-link/", "uni-list/", "uni-list-item/", "uni-row/", "migration/", "mapFiles/", "frontend/src/views/chart/components/table/TableNormal.vue"]
extend-exclude = [
"public/",
"amap-wx/",
"m-icon/",
"uni-card/",
"uni-col/",
"uni-link/",
"uni-list/",
"uni-list-item/",
"uni-row/",
"migration/",
"mapFiles/",
"core/frontend/src/views/chart/components/table/TableNormal.vue",
"core/backend/src/main/java/io/dataease/ext/ExtSysUserMapper.xml",
"core/backend/src/main/java/io/dataease/ext/AuthMapper.xml",
"installer/dataease/templates/be.conf"
]

View File

@ -14,7 +14,7 @@ public class PanelTemplateRequest extends PanelTemplateWithBLOBs {
@ApiModelProperty("排序")
private String sort;
@ApiModelProperty("详细信息")
private String withBlobs="Y";
private String withBlobs="N";
@ApiModelProperty("操作类型")
private String optType;
@ApiModelProperty("静态文件")

View File

@ -9,10 +9,10 @@
</resultMap>
<sql id="Base_Column_List">
panel_template.id, panel_template.`name`, panel_template.pid, panel_template.`level`, panel_template.node_type, panel_template.create_by, panel_template.create_time, panel_template.template_type
panel_template.id, panel_template.`name`, panel_template.pid, panel_template.`level`, panel_template.node_type, panel_template.create_by, panel_template.create_time, panel_template.template_type, panel_template.snapshot
</sql>
<sql id="Blob_Column_List">
panel_template.snapshot, panel_template.template_style, panel_template.template_data, panel_template.dynamic_data
panel_template.template_style, panel_template.template_data, panel_template.dynamic_data
</sql>
<select id="panelTemplate" resultMap="BaseResultMapDTO">

View File

@ -1,96 +0,0 @@
package io.dataease.plugins.server;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.dataease.auth.annotation.DePermission;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.i18n.Translator;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.auth.dto.request.DataSetRowPermissionsDTO;
import io.dataease.plugins.xpack.auth.dto.request.DatasetRowPermissions;
import io.dataease.plugins.xpack.auth.service.RowPermissionService;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@ApiIgnore
@RestController
@RequestMapping("plugin/dataset/rowPermissions")
public class RowPermissionsController {
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("保存")
@PostMapping("save")
public void save(@RequestBody DatasetRowPermissions datasetRowPermissions) throws Exception {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
DataSetRowPermissionsDTO request = new DataSetRowPermissionsDTO();
request.setAuthTargetType(datasetRowPermissions.getAuthTargetType());
request.setAuthTargetId(datasetRowPermissions.getAuthTargetId());
request.setDatasetFieldId(datasetRowPermissions.getDatasetFieldId());
List<DataSetRowPermissionsDTO> rowPermissionsDTOS = rowPermissionService.searchRowPermissions(request);
if (StringUtils.isEmpty(datasetRowPermissions.getId())) {
if (!CollectionUtils.isEmpty(rowPermissionsDTOS)) {
throw new Exception(Translator.get("i18n_rp_exist"));
}
} else {
if (!CollectionUtils.isEmpty(rowPermissionsDTOS) && rowPermissionsDTOS.size() > 1) {
throw new Exception(Translator.get("i18n_rp_exist"));
}
if (rowPermissionsDTOS.size() == 1 && !rowPermissionsDTOS.get(0).getId().equalsIgnoreCase(datasetRowPermissions.getId())) {
throw new Exception(Translator.get("i18n_rp_exist"));
}
}
rowPermissionService.save(datasetRowPermissions);
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("查询")
@PostMapping("/list")
public List<DataSetRowPermissionsDTO> rowPermissions(@RequestBody DataSetRowPermissionsDTO request) {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
return rowPermissionService.searchRowPermissions(request);
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("/delete")
public void dataSetRowPermissionInfo(@RequestBody DatasetRowPermissions datasetRowPermissions) {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
rowPermissionService.delete(datasetRowPermissions.getId());
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("分页查询")
@PostMapping("/pageList/{datasetId}/{goPage}/{pageSize}")
public Pager<List<DataSetRowPermissionsDTO>> rowPermissions(@PathVariable String datasetId, @PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
return PageUtils.setPageInfo(page, rowPermissionService.queryRowPermissions(datasetId));
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("有权限的对象")
@PostMapping("/authObjs")
public List<Object> authObjs(@RequestBody DataSetRowPermissionsDTO request) {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
return (List<Object>) rowPermissionService.authObjs(request);
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("详情")
@PostMapping("/dataSetRowPermissionInfo")
public DataSetRowPermissionsDTO dataSetRowPermissionInfo(@RequestBody DataSetRowPermissionsDTO request) {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
return rowPermissionService.dataSetRowPermissionInfo(request);
}
}

View File

@ -12,6 +12,8 @@ import io.dataease.i18n.Translator;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeRequest;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.auth.dto.request.DataSetRowPermissionsDTO;
import io.dataease.plugins.xpack.auth.service.RowPermissionService;
import io.dataease.plugins.xpack.auth.service.RowPermissionTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -21,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
//@ApiIgnore
@Api(tags = "xpack行权限")
@RestController
@RequestMapping("plugin/dataset/rowPermissionsTree")
@ -85,4 +87,13 @@ public class RowPermissionsTreeController {
Pager<List<DataSetRowPermissionsTreeDTO>> setPageInfo = PageUtils.setPageInfo(page, list);
return setPageInfo;
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("有权限的对象")
@PostMapping("/authObjs")
public List<Object> authObjs(@RequestBody DataSetRowPermissionsDTO request) {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
return (List<Object>) rowPermissionService.authObjs(request);
}
}

View File

@ -1220,8 +1220,8 @@ public class DorisQueryProvider extends QueryProvider {
if (x.getDeExtractType() == 0) {
if (StringUtils.equalsIgnoreCase(x.getDateStyle(), "y_Q")) {
fieldName = String.format(format,
String.format(DorisConstants.DATE_FORMAT, String.format(DorisConstants.STR_TO_DATE, originField, DorisConstants.DEFAULT_DATE_FORMAT), "%Y"),
String.format(DorisConstants.QUARTER, String.format(DorisConstants.STR_TO_DATE, originField, DorisConstants.DEFAULT_DATE_FORMAT)));
String.format(DorisConstants.DATE_FORMAT, String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT), "%Y"),
String.format(DorisConstants.QUARTER, String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT)));
} else {
fieldName = String.format(DorisConstants.DATE_FORMAT, String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT), format);
}

View File

@ -1149,7 +1149,7 @@ public class SqlserverQueryProvider extends QueryProvider {
String whereValue = "";
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
if(request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")) {
if(request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")) {
whereValue = "(" + value.stream().map(str -> {
return "N" + "'" + str + "'";
}).collect(Collectors.joining(",")) + ")";
@ -1171,7 +1171,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
} else {
if(request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")){
if(request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")){
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value.get(0));
}else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0));

View File

@ -604,12 +604,21 @@ public class ChartViewService {
List<ChartViewFieldDTO> viewFields = gson.fromJson(view.getViewFields(), tokenType);
final Map<String, List<ChartViewFieldDTO>> extFieldsMap = new LinkedHashMap<>();
if (CollectionUtils.isNotEmpty(viewFields)) {
viewFields.forEach(field -> {
String[] busiFlagArray = new String[] {"daxis", "locationXaxis", "locationYaxis"};
Map<String, Boolean> flagMap = new HashMap<>();
for (String s : busiFlagArray) {
flagMap.put(s, false);
}
for (ChartViewFieldDTO field : viewFields) {
flagMap.put(field.getBusiType(), true);
String busiType = field.getBusiType();
List<ChartViewFieldDTO> list = extFieldsMap.containsKey(busiType) ? extFieldsMap.get(busiType) : new ArrayList<>();
list.add(field);
extFieldsMap.put(field.getBusiType(), list);
});
}
if (flagMap.get("daxis") && (!flagMap.get("locationXaxis") || !flagMap.get("locationYaxis"))) {
viewFields = viewFields.stream().filter(field -> !StringUtils.equals("daxis", field.getBusiType())).collect(Collectors.toList());
}
}
List<ChartViewFieldDTO> xAxisBase = gson.fromJson(view.getXAxis(), tokenType);
@ -1474,6 +1483,8 @@ public class ChartViewService {
List<PluginViewField> pluginViewFields = fieldMap.entrySet().stream().flatMap(entry -> entry.getValue().stream().map(field -> {
PluginViewField pluginViewField = BeanUtils.copyBean(new PluginViewField(), field);
pluginViewField.setFilter(gson.fromJson(gson.toJson(field.getFilter()), new TypeToken<List<PluginChartCustomFilterItem>>() {
}.getType()));
pluginViewField.setTypeField(entry.getKey());
return pluginViewField;
})).collect(Collectors.toList());

View File

@ -2,6 +2,7 @@ package io.dataease.service.chart;
import cn.hutool.core.util.ReflectUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.dataease.commons.model.PluginViewSetImpl;
import io.dataease.commons.utils.TableUtils;
import io.dataease.controller.request.chart.ChartExtRequest;
@ -14,6 +15,7 @@ import io.dataease.plugins.common.constants.DatasetType;
import io.dataease.plugins.common.constants.datasource.SQLConstants;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldFilterDTO;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
@ -247,6 +249,9 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService {
methodName = "getYWheres";
}
ChartViewFieldDTO chartViewFieldDTO = BeanUtils.copyBean(new ChartViewFieldDTO(), field);
chartViewFieldDTO.setFilter(gson.fromJson(gson.toJson(field.getFilter()), new TypeToken<List<ChartViewFieldFilterDTO>>() {
}.getType()));
Object execResult;
if ((execResult = execProviderMethod(queryProvider, methodName, chartViewFieldDTO, originField, fieldAlias)) != null) {
String where = (String) execResult;

View File

@ -152,9 +152,6 @@ public class DataSetGroupService {
if (StringUtils.isNotEmpty(datasetGroup.getId())) {
criteria.andIdNotEqualTo(datasetGroup.getId());
}
if (ObjectUtils.isNotEmpty(datasetGroup.getLevel())) {
criteria.andLevelEqualTo(datasetGroup.getLevel());
}
List<DatasetGroup> list = datasetGroupMapper.selectByExample(datasetGroupExample);
if (list.size() > 0) {
throw new RuntimeException(Translator.get("I18N_DATASET_GROUP_EXIST"));

View File

@ -314,7 +314,8 @@ public class PanelAppTemplateService {
for (ChartViewWithBLOBs chartView : chartViewsInfo) {
String oldViewId = chartView.getId();
// 替换datasetId
chartView.setTableId(datasetsRealMap.get(chartView.getTableId()));
String newTableId = datasetsRealMap.get(chartView.getTableId());
chartView.setTableId(StringUtils.isEmpty(newTableId) ? " " : newTableId);
datasetsRealMap.forEach((k, v) -> {
chartView.setXAxis(chartView.getXAxis().replaceAll(k, v));
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k, v));

View File

@ -68,6 +68,7 @@ public class SysUserService {
List<SysUserGridResponse> lists = extSysUserMapper.query(request);
lists.forEach(item -> {
item.setPassword("");
List<SysUserRole> roles = item.getRoles();
List<Long> roleIds = roles.stream().filter(ObjectUtils::isNotEmpty).map(SysUserRole::getRoleId).collect(Collectors.toList());
item.setRoleIds(roleIds);

View File

@ -228,7 +228,7 @@ SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for demo_new_trend_of_diagnosis
-- ----------------------------
CREATE TABLE `demo_new_trend_of_diagnosis` (
CREATE TABLE IF NOT EXISTS `demo_new_trend_of_diagnosis` (
`date` varchar(50) NOT NULL DEFAULT '' COMMENT '日期',
`new_diagnosis` bigint(13) DEFAULT NULL COMMENT '新增确诊',
`current_diagnosis` bigint(13) DEFAULT NULL COMMENT '现有确诊'

View File

@ -47,7 +47,6 @@ ALTER TABLE `demo_stny_carbon_emission_trend` COMMENT = '官方示例模板数
ALTER TABLE `demo_stny_disposable_energy` COMMENT = '官方示例模板数据双碳及能源情况概览';
ALTER TABLE `demo_stny_energy_consumption_proportion` COMMENT = '官方示例模板数据双碳及能源情况概览';
ALTER TABLE `demo_stny_energy_consumption_total` COMMENT = '官方示例模板数据双碳及能源情况概览';
ALTER TABLE `demo_stny_province_city_ index` COMMENT = '官方示例模板数据双碳及能源情况概览';
ALTER TABLE `de_engine` COMMENT = '引擎设置表';
ALTER TABLE `file_content` COMMENT = '文件内容表';
ALTER TABLE `file_metadata` COMMENT = '文件基础信息表';

View File

@ -258,15 +258,6 @@ export function datasetTaskList(page, size, data, loading) {
})
}
export function datasetRowPermissionsList(datasetId, page, size, data, loading) {
return request({
url: 'plugin/dataset/rowPermissions/pageList/' + datasetId + '/' + page + '/' + size,
method: 'post',
data,
loading: loading
})
}
export function checkCustomDs() {
return request({
url: '/system/checkCustomDs',

View File

@ -34,6 +34,7 @@
{{ $t('commons.confirm') }}
</el-button>
<el-button
style="margin-right: 24px"
size="mini"
@click="editCancel"
>

View File

@ -120,7 +120,8 @@
icon="el-icon-plus"
round
@click="addLinkageField(null,null)"
>追加联动依赖字段</el-button>
>追加联动依赖字段
</el-button>
</el-row>
<!-- <el-button slot="reference">T</el-button>-->
@ -134,6 +135,7 @@
<script>
import {mapState} from 'vuex'
import {checkSameDataSet} from '@/api/chart/chart'
export default {
props: {
@ -172,18 +174,24 @@ export default {
},
...mapState([
'targetLinkageInfo',
'curLinkageView'
'curLinkageView',
'panelViewDetailsInfo'
])
},
mounted() {
const _this = this
//
checkSameDataSet(this.curLinkageView.propValue.viewId, this.element.propValue.viewId).then(res => {
const chartDetails = JSON.parse(this.panelViewDetailsInfo[this.curLinkageView.propValue.viewId])
const curCheckAllAxisStr = chartDetails.xaxis + chartDetails.xaxisExt + chartDetails.yaxis + chartDetails.yaxisExt
const targetChartDetails = JSON.parse(this.panelViewDetailsInfo[this.element.propValue.viewId])
const targetCheckAllAxisStr = targetChartDetails.xaxis + targetChartDetails.xaxisExt + targetChartDetails.yaxis + targetChartDetails.yaxisExt
if (res.data === 'YES' && this.linkageInfo.linkageFields.length === 0) {
this.sourceLinkageInfo.targetViewFields.forEach(item => {
_this.$nextTick(() => {
if (curCheckAllAxisStr.includes(item.id)&&targetCheckAllAxisStr.includes(item.id)) {
this.addLinkageField(item.id, item.id)
})
}
})
}
})
@ -222,6 +230,7 @@ export default {
text-align: center;
}
.ellip {
/*width: 100%;*/
margin-left: 10px;
@ -250,6 +259,7 @@ export default {
height: 35px;
border-radius: 3px;
}
::v-deep .el-popover {
height: 200px;
overflow: auto;

View File

@ -17,8 +17,7 @@
v-if="curComponent.type != 'custom-button'"
icon="el-icon-document-copy"
@click.native="copy"
><span>{{ $t('panel.copy') }}&nbsp(<span v-show="systemOS==='Mac'"><i class="icon iconfont icon-command"
/>+ D</span> <span v-show="systemOS!=='Mac'">Control + D</span>)</span>
><span>{{ $t('panel.copy') }}&nbsp;(<span v-show="systemOS==='Mac'"><i class="icon iconfont icon-command" />+ D</span> <span v-show="systemOS!=='Mac'">Control + D</span>)</span>
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-delete"
@ -193,7 +192,8 @@ export default {
'text',
'label',
'flow-map',
'bidirectional-bar'
'bidirectional-bar',
'race-bar'
],
linkageExcludeViewType: [
'richTextView',
@ -202,7 +202,8 @@ export default {
'text',
'label',
'flow-map',
'bidirectional-bar'
'bidirectional-bar',
'race-bar'
],
copyData: null,
hyperlinksSetVisible: false,

View File

@ -35,6 +35,7 @@
:obj="{active, chart, trackMenu, searchCount, terminalType: scaleCoefficientType}"
:chart="chart"
:track-menu="trackMenu"
:in-screen="inScreen"
:search-count="searchCount"
:terminal-type="scaleCoefficientType"
:scale="scale"
@ -361,7 +362,7 @@ export default {
computed: {
// 使filter
initLoad() {
return !(this.isEdit && this.currentCanvasNewId.includes(this.element.id)) && this.isFirstLoad && this.canvasId === 'canvas-main'
return !(this.isEdit && this.currentCanvasNewId.includes(this.element.id)) && this.isFirstLoad
},
scaleCoefficient() {
if (this.terminal === 'pc' && !this.mobileLayoutStatus) {

View File

@ -60,7 +60,8 @@ export default {
values: null,
onFocus: false,
show: true,
timer: null
outTimer: null,
innerTimer: null
}
},
computed: {
@ -134,12 +135,7 @@ export default {
},
watch: {
canvasStyleData: {
handler(newVal, oldVla) {
this.canvasStyleDataInit()
},
deep: true
},
'viewIds': function(value, old) {
if (typeof value === 'undefined' || value === old) return
this.setCondition()
@ -174,7 +170,9 @@ export default {
},
created() {
this.loadInit()
this.canvasStyleDataInit()
this.$nextTick(() => {
this.dynamicRefresh()
})
},
mounted() {
bus.$on('onScroll', this.onScroll)
@ -183,18 +181,14 @@ export default {
}
},
beforeDestroy() {
this.timer && clearInterval(this.timer)
this.clearTime()
bus.$off('onScroll', this.onScroll)
bus.$off('reset-default-value', this.resetDefaultValue)
},
methods: {
loadInit() {
if (this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) {
if (this.element.options.attrs.default) {
const widget = ApplicationContext.getService(this.element.serviceName)
this.values = widget.dynamicDateFormNow(this.element)
this.dateChange(this.values)
}
this.clearTime()
if (this.refreshHandler()) {
return
}
if (this.element.options.value) {
@ -202,22 +196,42 @@ export default {
this.dateChange(this.values)
}
},
canvasStyleDataInit() {
if (this.inDraw && this.canvasStyleData.refreshViewEnable && this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) {
this.searchCount = 0
this.timer && clearInterval(this.timer)
let refreshTime = 300000
if (this.canvasStyleData.refreshTime && this.canvasStyleData.refreshTime > 0) {
if (this.canvasStyleData.refreshUnit === 'second') {
refreshTime = this.canvasStyleData.refreshTime * 1000
} else {
refreshTime = this.canvasStyleData.refreshTime * 60000
refreshHandler() {
if (this.element.options.attrs.default?.isDynamic) {
const widget = ApplicationContext.getService(this.element.serviceName)
this.values = widget.dynamicDateFormNow(this.element)
this.dateChange(this.values)
return true
}
return false
},
clearTime() {
if (this.outTimer) {
clearTimeout(this.outTimer)
this.outTimer = null
}
this.timer = setInterval(() => {
this.loadInit()
this.searchCount++
}, refreshTime)
if (this.innerTimer) {
clearInterval(this.innerTimer)
this.innerTimer = null
}
},
dynamicRefresh() {
if (this.inDraw && this.element.options.attrs.default?.isDynamic) {
const nowDate = new Date()
const nowTime = nowDate.getTime()
const tomorrow = new Date(`${nowDate.getFullYear()}-${nowDate.getMonth() + 1}-${nowDate.getDate() + 1} 00:00:01`)
const tomorrowTime = tomorrow.getTime()
this.clearTime()
this.outTimer = setTimeout(() => {
if (this.inDraw) {
this.refreshHandler()
}
this.innerTimer = setInterval(() => {
if (this.inDraw) {
this.refreshHandler()
}
}, 24 * 3600 * 1000)
}, tomorrowTime - nowTime)
}
},
clearHandler() {

View File

@ -1489,6 +1489,8 @@ export default {
label_content: 'Label Content',
percent: 'Percent',
table_index_desc: 'Index Header Name',
table_row_tooltip: 'Row Tooltip',
table_col_tooltip: 'Column Tooltip',
total_sort: 'Total Sort',
total_sort_none: 'None',
total_sort_asc: 'ASC',

View File

@ -1488,6 +1488,8 @@ export default {
label_content: '標籤展示',
percent: '占比',
table_index_desc: '表頭名稱',
table_row_tooltip: '行頭提示',
table_col_tooltip: '列頭提示',
total_sort: '總計排序',
total_sort_none: '無',
total_sort_asc: '升序',

View File

@ -1487,6 +1487,8 @@ export default {
label_content: '标签展示',
percent: '占比',
table_index_desc: '表头名称',
table_row_tooltip: '行头提示',
table_col_tooltip: '列头提示',
total_sort: '总计排序',
total_sort_none: '无',
total_sort_asc: '升序',

View File

@ -40,6 +40,7 @@ import VueFriendlyIframe from 'vue-friendly-iframe'
import vueToPdf from 'vue-to-pdf'
import VueVideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
import '@antv/s2/dist/style.min.css'
// 控制标签宽高成比例的指令
import proportion from 'vue-proportion-directive'

View File

@ -45,6 +45,16 @@ export function baseBarOptionAntV(plot, container, chart, action, isGroup, isSta
yAxis: yAxis,
slider: slider,
annotations: analyse,
brush: {
enabled: true,
isStartEnable: (context) => {
// 按住 shift 键,才能开启交互
if (context.event.gEvent.originalEvent?.shiftKey) {
return true
}
return false
}
},
interactions: [
{
type: 'legend-active', cfg: {
@ -162,6 +172,16 @@ export function hBaseBarOptionAntV(plot, container, chart, action, isGroup, isSt
yAxis: yAxis,
slider: slider,
annotations: analyse,
brush: {
enabled: true,
isStartEnable: (context) => {
// 按住 shift 键,才能开启交互
if (context.event.gEvent.originalEvent?.shiftKey) {
return true
}
return false
}
},
interactions: [
{
type: 'legend-active', cfg: {

View File

@ -86,6 +86,12 @@ export const DEFAULT_SIZE = {
tableHeaderAlign: 'left',
tableItemAlign: 'right',
tableAutoBreakLine: false,
tableRowTooltip: {
show: false
},
tableColTooltip: {
show: false
},
gaugeMinType: 'fix', // fix or dynamic
gaugeMinField: {
id: '',

View File

@ -593,9 +593,11 @@ export function getXAxis(chart) {
stroke: axisCfg.lineStyle.color
}
} : null
const rotate = parseInt(a.axisLabel.rotate)
const label = a.axisLabel.show ? {
rotate: parseInt(a.axisLabel.rotate) * Math.PI / 180,
rotate: rotate * Math.PI / 180,
style: {
textAlign: rotate > 20 ? 'start' : rotate < -20 ? 'end' : 'center',
fill: a.axisLabel.color,
fontSize: parseInt(a.axisLabel.fontSize)
},

View File

@ -1,4 +1,4 @@
import { TableSheet, S2Event, PivotSheet, DataCell, EXTRA_FIELD, TOTAL_VALUE } from '@antv/s2'
import { TableSheet, S2Event, PivotSheet, DataCell, EXTRA_FIELD, TOTAL_VALUE, BaseEvent } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
import { DEFAULT_COLOR_CASE, DEFAULT_TOTAL } from '@/views/chart/chart/chart'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
@ -7,7 +7,7 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
const containerDom = document.getElementById(container)
// fields
const fields = chart.data.fields
let fields = chart.data.fields
if (!fields || fields.length === 0) {
if (s2) {
s2.destroy()
@ -17,21 +17,6 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
const columns = []
const meta = []
// add drill list
if (chart.drill) {
let drillFields = []
try {
drillFields = JSON.parse(chart.drillFields)
} catch (err) {
drillFields = JSON.parse(JSON.stringify(chart.drillFields))
}
const drillField = drillFields[chart.drillFilters.length]
const drillFilters = JSON.parse(JSON.stringify(chart.drillFilters))
const drillExp = drillFilters[drillFilters.length - 1].datasetTableField
// 记录下钻起始字段的index
let xAxis = []
try {
@ -39,68 +24,30 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
} catch (err) {
xAxis = JSON.parse(JSON.stringify(chart.xaxis))
}
let index = 0
for (let i = 0; i < xAxis.length; i++) {
if (xAxis[i].id === drillFilters[0].fieldId) {
index = i
break
const nameMap = xAxis.reduce((pre, next) => {
pre[next.dataeaseName] = next
return pre
}, {})
if (chart.drill) {
let drillFields = []
try {
drillFields = JSON.parse(chart.drillFields)
} catch (err) {
drillFields = JSON.parse(JSON.stringify(chart.drillFields))
}
// 总下钻过滤字段
const drillFilters = JSON.parse(JSON.stringify(chart.drillFilters)).map(i => i.fieldId)
// 当前下钻字段
const curDrillField = drillFields[chart.drillFilters.length]
drillFilters.push(curDrillField.id)
// 下钻入口字段的下标
const drillEnterFieldIndex = xAxis.findIndex(item => item.id === drillFilters[0])
// 移除所有下钻字段,调整当前下钻字段到下钻入口位置
fields = fields.filter(item => !drillFilters.includes(item.id))
fields.splice(drillEnterFieldIndex, 0, curDrillField)
}
// 移除所有下钻字段
const removeField = []
for (let i = 0; i < chart.drillFilters.length; i++) {
const ele = chart.drillFilters[i].datasetTableField
removeField.push(ele.dataeaseName)
}
// build field
fields.forEach(ele => {
if (removeField.indexOf(ele.dataeaseName) < 0) {
// 用下钻字段替换当前字段
if (drillExp.dataeaseName === ele.dataeaseName) {
columns.push(drillField.dataeaseName)
meta.push({
field: drillField.dataeaseName,
name: drillField.name
})
} else {
const f = getCurrentField(chart.xaxis, ele)
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name,
formatter: function(value) {
if (!f) {
return value
}
if (value === null || value === undefined) {
return value
}
if (f.groupType === 'd') {
return value
} else {
if (f.formatterCfg) {
const v = valueFormatter(value, f.formatterCfg)
return v.includes('NaN') ? value : v
} else {
const v = valueFormatter(value, formatterItem)
return v.includes('NaN') ? value : v
}
}
}
})
}
}
})
// 修正下钻字段的index获取下钻位置元素添加到index位置并删除
const ele = columns[columns.length - 1]
columns.splice(index, 0, ele)
columns.splice(columns.length - 1, 1)
} else {
fields.forEach(ele => {
const f = getCurrentField(chart.xaxis, ele)
const f = nameMap[ele.dataeaseName]
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
@ -126,7 +73,6 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
}
})
})
}
// 空值处理
const newData = handleTableEmptyStrategy(tableData, chart)
// data config
@ -174,6 +120,11 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
// click
s2.on(S2Event.DATA_CELL_CLICK, action)
// hover
const size = customAttr.size
if (size.tableColTooltip?.show) {
s2.on(S2Event.COL_CELL_HOVER, event => showTooltip(s2, event))
}
// theme
const customTheme = getCustomTheme(chart)
@ -342,7 +293,11 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
// click
s2.on(S2Event.DATA_CELL_CLICK, action)
// hover
const size = customAttr.size
if (size.tableColTooltip?.show) {
s2.on(S2Event.COL_CELL_HOVER, event => showTooltip(s2, event))
}
// theme
const customTheme = getCustomTheme(chart)
s2.setThemeCfg({ theme: customTheme })
@ -455,8 +410,8 @@ export function baseTablePivot(s2, container, chart, action, headerAction, table
// total config
let totalCfg = {}
const chartObj = JSON.parse(JSON.stringify(chart))
let customAttr
if (chartObj.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chartObj.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chartObj.customAttr))
} else {
@ -528,7 +483,14 @@ export function baseTablePivot(s2, container, chart, action, headerAction, table
s2.on(S2Event.DATA_CELL_CLICK, action)
s2.on(S2Event.ROW_CELL_CLICK, headerAction)
s2.on(S2Event.COL_CELL_CLICK, headerAction)
// hover
const size = customAttr?.size
if (size?.tableRowTooltip?.show) {
s2.on(S2Event.ROW_CELL_HOVER, event => showTooltip(s2, event))
}
if (size?.tableColTooltip?.show) {
s2.on(S2Event.COL_CELL_HOVER, event => showTooltip(s2, event))
}
// theme
const customTheme = getCustomTheme(chart)
s2.setThemeCfg({ theme: customTheme })
@ -740,3 +702,16 @@ function mappingColor(value, defaultColor, field, type) {
}
return color
}
function showTooltip(s2Instance, event) {
const cell = s2Instance.getCell(event.target)
const content = cell.actualText
s2Instance.showTooltip({
position: {
x: event.clientX,
y: event.clientY
},
content
})
}

View File

@ -62,7 +62,8 @@ export const TYPE_CONFIGS = [
'tableItemHeight',
'tableColumnMode',
'showIndex',
'indexLabel'
'indexLabel',
'tableColTooltip'
],
'title-selector-ant-v': [
'show',
@ -111,7 +112,8 @@ export const TYPE_CONFIGS = [
'tableItemHeight',
'tableColumnMode',
'showIndex',
'indexLabel'
'indexLabel',
'tableColTooltip'
],
'title-selector-ant-v': [
'show',
@ -157,7 +159,9 @@ export const TYPE_CONFIGS = [
'tableItemAlign',
'tableTitleHeight',
'tableItemHeight',
'tableColumnMode'
'tableColumnMode',
'tableRowTooltip',
'tableColTooltip'
],
'total-cfg': [
'row',

View File

@ -189,13 +189,19 @@ export default {
},
mounted() {
bus.$on('change-series-id', this.changeSeriesId)
document.getElementById(this.chartId).addEventListener('mouseover', this.bodyMouseover)
document.getElementById(this.chartId).addEventListener('mouseout', this.bodyMouseout)
const dom = document.getElementById(this.chartId)
if (dom) {
dom.addEventListener('mouseover', this.bodyMouseover)
dom.addEventListener('mouseout', this.bodyMouseout)
}
this.preDraw()
},
beforeDestroy() {
document.getElementById(this.chartId).removeEventListener('mouseover', this.bodyMouseover)
document.getElementById(this.chartId).removeEventListener('mouseout', this.bodyMouseout)
const dom = document.getElementById(this.chartId)
if (dom) {
dom.removeEventListener('mouseover', this.bodyMouseover)
dom.removeEventListener('mouseout', this.bodyMouseout)
}
bus.$off('change-series-id', this.changeSeriesId)
window.removeEventListener('resize', this.myChart.resize)
this.myChart.dispose()

View File

@ -614,3 +614,8 @@ export default {
background: transparent !important;
}
</style>
<style>
.antv-s2-tooltip-container {
padding: 4px 2px;
}
</style>

View File

@ -384,6 +384,28 @@
@blur="changeBarSizeCase('indexLabel')"
/>
</el-form-item>
<el-form-item
v-show="showProperty('tableRowTooltip')"
label-width="100px"
:label="$t('chart.table_row_tooltip')"
class="form-item"
>
<el-checkbox
v-model="sizeForm.tableRowTooltip.show"
@change="changeBarSizeCase('tableRowTooltip')"
/>
</el-form-item>
<el-form-item
v-show="showProperty('tableColTooltip')"
label-width="100px"
:label="$t('chart.table_col_tooltip')"
class="form-item"
>
<el-checkbox
v-model="sizeForm.tableColTooltip.show"
@change="changeBarSizeCase('tableColTooltip')"
/>
</el-form-item>
<!--chart-mix-start-->
<span v-show="showProperty('mix')">
@ -893,6 +915,54 @@
@change="changeBarSizeCase('quotaFontShadow')"
>{{ $t('chart.font_shadow') }}</el-checkbox>
</el-form-item>
<el-form-item
v-show="showProperty('hPosition')"
:label="$t('chart.h_position')"
class="form-item"
>
<el-select
v-model="sizeForm.hPosition"
:placeholder="$t('chart.h_position')"
@change="changeBarSizeCase('hPosition')"
>
<el-option
value="start"
:label="$t('chart.p_left')"
>{{ $t('chart.p_left') }}</el-option>
<el-option
value="center"
:label="$t('chart.p_center')"
>{{ $t('chart.p_center') }}</el-option>
<el-option
value="end"
:label="$t('chart.p_right')"
>{{ $t('chart.p_right') }}</el-option>
</el-select>
</el-form-item>
<el-form-item
v-show="showProperty('vPosition')"
:label="$t('chart.v_position')"
class="form-item"
>
<el-select
v-model="sizeForm.vPosition"
:placeholder="$t('chart.v_position')"
@change="changeBarSizeCase('vPosition')"
>
<el-option
value="start"
:label="$t('chart.p_top')"
>{{ $t('chart.p_top') }}</el-option>
<el-option
value="center"
:label="$t('chart.p_center')"
>{{ $t('chart.p_center') }}</el-option>
<el-option
value="end"
:label="$t('chart.p_bottom')"
>{{ $t('chart.p_bottom') }}</el-option>
</el-select>
</el-form-item>
<el-divider v-if="showProperty('dimensionShow')" />
<el-form-item
v-show="showProperty('dimensionShow')"
@ -983,7 +1053,6 @@
@change="changeBarSizeCase('dimensionFontShadow')"
>{{ $t('chart.font_shadow') }}</el-checkbox>
</el-form-item>
<el-divider v-if="showProperty('spaceSplit')" />
<el-form-item
v-show="showProperty('spaceSplit')"
:label="$t('chart.space_split')"
@ -996,54 +1065,6 @@
@change="changeBarSizeCase('spaceSplit')"
/>
</el-form-item>
<el-form-item
v-show="showProperty('hPosition')"
:label="$t('chart.h_position')"
class="form-item"
>
<el-select
v-model="sizeForm.hPosition"
:placeholder="$t('chart.h_position')"
@change="changeBarSizeCase('hPosition')"
>
<el-option
value="start"
:label="$t('chart.p_left')"
>{{ $t('chart.p_left') }}</el-option>
<el-option
value="center"
:label="$t('chart.p_center')"
>{{ $t('chart.p_center') }}</el-option>
<el-option
value="end"
:label="$t('chart.p_right')"
>{{ $t('chart.p_right') }}</el-option>
</el-select>
</el-form-item>
<el-form-item
v-show="showProperty('vPosition')"
:label="$t('chart.v_position')"
class="form-item"
>
<el-select
v-model="sizeForm.vPosition"
:placeholder="$t('chart.v_position')"
@change="changeBarSizeCase('vPosition')"
>
<el-option
value="start"
:label="$t('chart.p_top')"
>{{ $t('chart.p_top') }}</el-option>
<el-option
value="center"
:label="$t('chart.p_center')"
>{{ $t('chart.p_center') }}</el-option>
<el-option
value="end"
:label="$t('chart.p_bottom')"
>{{ $t('chart.p_bottom') }}</el-option>
</el-select>
</el-form-item>
</div>
<!--text&label-end-->
<!--scatter-begin-->
@ -1565,6 +1586,8 @@ export default {
this.sizeForm.tableHeaderAlign = this.sizeForm.tableHeaderAlign ? this.sizeForm.tableHeaderAlign : DEFAULT_SIZE.tableHeaderAlign
this.sizeForm.tableItemAlign = this.sizeForm.tableItemAlign ? this.sizeForm.tableItemAlign : DEFAULT_SIZE.tableItemAlign
this.sizeForm.tableRowTooltip = this.sizeForm.tableRowTooltip ?? DEFAULT_SIZE.tableRowTooltip
this.sizeForm.tableColTooltip = this.sizeForm.tableColTooltip ?? DEFAULT_SIZE.tableColTooltip
this.sizeForm.showIndex = this.sizeForm.showIndex ? this.sizeForm.showIndex : DEFAULT_SIZE.showIndex
if (this.sizeForm.indexLabel === null || this.sizeForm.indexLabel === undefined) {

View File

@ -630,6 +630,10 @@ export default {
},
panelInfo() {
return this.$store.state.panel.panelInfo
},
watchChartTypeChangeObj() {
const { type, render } = this.view
return { type, render }
}
},
watch: {
@ -649,8 +653,14 @@ export default {
this.searchPids = []
this.$refs.chartTreeRef.filter(this.filterText)
},
chartType(val) {
this.view.isPlugin = val && this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(val)
// chartType(val) {
// this.view.isPlugin = val && this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(val)
// },
watchChartTypeChangeObj(newVal, oldVal) {
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
return
}
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
}
},

View File

@ -924,6 +924,7 @@
:param="param"
:index="index"
:item="item"
:chart="chart"
:dimension-data="dimension"
:quota-data="quota"
@onItemChange="bubbleItemChange"
@ -1323,8 +1324,8 @@
ref="itemForm"
label-width="80px"
:model="itemForm"
@submit.native.prevent
:rules="itemFormRules"
@submit.native.prevent
>
<el-form-item
:label="$t('dataset.field_origin_name')"
@ -1734,7 +1735,6 @@ import QuotaFilterEditor from '../components/filter/QuotaFilterEditor'
import DimensionFilterEditor from '../components/filter/DimensionFilterEditor'
import TableNormal from '../components/table/TableNormal'
import LabelNormal from '../components/normal/LabelNormal'
// import html2canvas from 'html2canvasde'
import TableSelector from './TableSelector'
import FieldEdit from '../../dataset/data/FieldEdit'
import { areaMapping } from '@/api/map/map'
@ -1996,6 +1996,10 @@ export default {
!equalsAny(this.view.type, 'liquid', 'bidirectional-bar',
'word-cloud', 'table-pivot', 'label', 'richTextView', 'flow-map')
},
watchChartTypeChangeObj() {
const { type, render } = this.view
return { type, render }
},
...mapState([
'curComponent',
'panelViewEditInfo',
@ -2016,7 +2020,7 @@ export default {
},
'param': function(val) {
if (this.param.optType === 'new') {
//
// Do Nothing
} else if (this.param.id !== this.preChartId && this.editStatus) {
this.preChartId = this.param.id
this.chartInit()
@ -2031,8 +2035,14 @@ export default {
}
this.$emit('typeChange', newVal)
},
'view.type': function(newVal, oldVal) {
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal)
watchChartTypeChangeObj(newVal, oldVal) {
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
return
}
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, newVal.type !== oldVal.type, newVal.render !== oldVal.render)
}
},
created() {
@ -2124,9 +2134,6 @@ export default {
this.resetDrill()
this.initFromPanel()
this.getChart(this.param.id)
// if (this.componentViewsData[this.param.id]) {
// this.chart = this.componentViewsData[this.param.id]
// }
},
bindPluginEvent() {
bus.$on('show-dimension-edit-filter', this.showDimensionEditFilter)
@ -2257,9 +2264,6 @@ export default {
view.xaxis = [view.xaxis[0]]
}
view.xaxis.forEach(function(ele) {
// if (!ele.summary || ele.summary === '') {
// ele.summary = 'sum'
// }
if (!ele.dateStyle || ele.dateStyle === '') {
ele.dateStyle = 'y_M_d'
}
@ -2417,6 +2421,7 @@ export default {
view.extBubble = JSON.stringify(view.extBubble)
view.senior = JSON.stringify(view.senior)
delete view.data
return view
},
refreshAttrChange() {
@ -2435,7 +2440,6 @@ export default {
const view = this.buildParam(true, 'chart', false, switchType, switchRender)
if (!view) return
viewEditSave(this.panelInfo.id, view).then(() => {
// this.getData(this.param.id)
this.getChart(this.param.id)
bus.$emit('view-in-cache', {
type: 'propChange',
@ -2462,7 +2466,6 @@ export default {
view.senior = JSON.stringify(this.view.senior)
view.title = this.view.title
view.stylePriority = this.view.stylePriority
// view.data = this.data
this.chart = view
//
@ -2514,7 +2517,6 @@ export default {
}
},
getData(id) {
// this.hasEdit = true
if (id) {
ajaxGetDataOnly(id, this.panelInfo.id, {
filter: [],
@ -2894,12 +2896,7 @@ export default {
},
closeRename() {
this.renameItem = false
this.resetRename()
},
resetRename() {
// this.itemForm = {}
},
showQuotaEditCompare(item) {
this.quotaItemCompare = JSON.parse(JSON.stringify(item))
this.showEditQuotaCompare = true
@ -3107,14 +3104,8 @@ export default {
},
initAreas() {
// let mapping
// if ((mapping = localStorage.getItem('areaMapping')) !== null) {
// this.places = JSON.parse(mapping)
// return
// }
Object.keys(this.places).length === 0 && areaMapping().then(res => {
this.places = res.data
// localStorage.setItem('areaMapping', JSON.stringify(res.data))
})
},
@ -3182,16 +3173,13 @@ export default {
chartClick(param) {
if (this.drillClickDimensionList.length < this.view.drillFields.length - 1) {
// const isSwitch = (this.chart.type === 'map' && this.sendToChildren(param))
if (this.chart.type === 'map' || this.chart.type === 'buddle-map') {
if (this.sendToChildren(param)) {
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
// this.getData(this.param.id)
this.calcData(true, 'chart', false, false)
}
} else {
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
// this.getData(this.param.id)
this.calcData(true, 'chart', false, false)
}
} else if (this.view.drillFields.length > 0) {
@ -3219,7 +3207,6 @@ export default {
} else {
current && current.registerDynamicMap && current.registerDynamicMap(null)
}
// this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(null)
}
},
drillJump(index) {
@ -3228,8 +3215,6 @@ export default {
if (this.chart.type === 'map' || this.chart.type === 'buddle-map') {
this.backToParent(index, length)
}
// this.getData(this.param.id)
this.calcData(true, 'chart', false, false)
},
//
@ -3245,7 +3230,6 @@ export default {
}
this.currentAcreaNode = tempNode
// this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(this.currentAcreaNode.code)
const current = this.$refs.dynamicChart
if (this.view.isPlugin) {
current && current.callPluginInner && this.setDetailMapCode(this.currentAcreaNode.code) && current.callPluginInner({
@ -3271,14 +3255,11 @@ export default {
if (this.currentAcreaNode) {
aCode = this.currentAcreaNode.code
}
// const aCode = this.currentAcreaNode ? this.currentAcreaNode.code : null
const currentNode = this.findEntityByCode(aCode || this.view.customAttr.areaCode, this.places)
if (currentNode && currentNode.children && currentNode.children.length > 0) {
const nextNode = currentNode.children.find(item => item.name === name)
if (!nextNode || !nextNode.code) return null
// this.view.customAttr.areaCode = nextNode.code
this.currentAcreaNode = nextNode
// this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(nextNode.code)
const current = this.$refs.dynamicChart
if (this.view.isPlugin) {
nextNode && current && current.callPluginInner && this.setDetailMapCode(nextNode.code) && current.callPluginInner({
@ -3329,12 +3310,10 @@ export default {
this.$store.commit('recordViewEdit', { viewId: this.param.id, hasEdit: status })
},
changeChartRender() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, false, true)
// Do Nothing
},
changeChartType() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, true)
// Do Nothing
},
setChartDefaultOptions() {

View File

@ -93,9 +93,9 @@ export default {
}
},
methods: {
currentIsPlugin(type) {
currentIsPlugin(type, render) {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
return plugins.some(plugin => plugin.value === type)
return plugins.some(plugin => plugin.value === type && plugin.render === render)
},
initTypes(plugins) {
plugins.forEach(plugin => {

View File

@ -368,6 +368,7 @@
<Preview
v-if="previewVisible"
:in-screen="!previewVisible"
:class="previewVisible && 'fullscreen-visual-selects'"
:panel-info="panelInfo"
:show-type="canvasStyleData.selfAdaption?'full':'width'"
:canvas-style-data="canvasStyleData"

View File

@ -798,7 +798,7 @@ export default {
async loadField(tableId, init) {
const res = await fieldListWithPermission(tableId)
let data = res.data || []
if (init && !this.checkSuperior(data, this.anotherTableInfo(tableId))) {
if (init && (!data.length || !this.checkSuperior(data, this.anotherTableInfo(tableId)))) {
this.backToLink()
}
if (this.widget && this.widget.filterFieldMethod) {

View File

@ -155,7 +155,7 @@
:format="element.options.attrs.accuracy"
style="width: auto; min-width: 110px;"
placeholder=""
@change="eDynamicSuffixTimeChange"
@change="sDynamicSuffixTimeChange"
/>
</el-form-item>
@ -384,10 +384,22 @@ export default {
}
},
eDynamicSuffixTimeChange(val) {
const time = this.convertTime(val)
this.$set(this.element.options.attrs.default, 'eDynamicSuffixTime', time)
this.setDval()
},
sDynamicSuffixTimeChange(val) {
const time = this.convertTime(val)
this.$set(this.element.options.attrs.default, 'sDynamicSuffixTime', time)
this.setDval()
},
convertTime(val) {
const date = new Date(val)
const baseDate = new Date(this.baseTime)
date.setFullYear(baseDate.getFullYear())
date.setMonth(baseDate.getMonth())
date.setDate(baseDate.getDate())
return date.getTime()
}
}
}

View File

@ -932,6 +932,15 @@ export default {
top: inherit !important;
left: inherit !important;
}
.el-tree-select-popper {
left: 0 !important;
top: inherit !important;
}
.track-menu,
.coustom-date-picker {
left: inherit !important;
}
}
</style>

View File

@ -45,7 +45,6 @@ public class ChartMixViewStatHandler 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());
@ -79,7 +78,6 @@ public class ChartMixViewStatHandler implements PluginViewStatHandler {
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

@ -122,6 +122,9 @@ export default {
.form-item>>>.el-form-item__label{
font-size: 12px;
}
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item{
padding: 0 20px;
}

View File

@ -98,10 +98,10 @@
</template>
<script>
import DimensionItem from '@/components/views/DimensionItem'
import QuotaItem from '@/components/views/QuotaItem'
import QuotaExtItem from '@/components/views/QuotaExtItem'
import FilterItem from '@/components/views/FilterItem'
import DimensionItem from '../../../components/views/DimensionItem'
import QuotaItem from '../../../components/views/QuotaItem'
import QuotaExtItem from '../../../components/views/QuotaExtItem'
import FilterItem from '../../../components/views/FilterItem'
import messages from '@/de-base/lang/messages'
export default {

View File

@ -9,12 +9,12 @@
v-if="chart.type && antVRenderStatus"
v-show="title_show"
ref="title"
:style="title_class"
:style="titleClass"
style="cursor: default;display: block;"
>
<div style="padding:4px 4px 0;margin: 0;">
<chart-title-update
:title-class="title_class"
:title-class="titleClass"
:chart-info="chartInfo"
:bus="bus"
:axios-request="axiosRequest"
@ -33,20 +33,20 @@
<script>
import {Mix} from '@antv/g2plot'
import {uuid, hexColorToRGBA} from '@/utils/chartmix'
import ViewTrackBar from '@/components/views/ViewTrackBar'
import {getRemark} from "@/components/views/utils";
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 ChartTitleUpdate from '@/components/views/ChartTitleUpdate';
} from '../../../utils/map';
import ChartTitleUpdate from '../../../components/views/ChartTitleUpdate';
import _ from 'lodash';
import {clear} from 'size-sensor'
import {valueFormatter} from '@/utils/formatter'
import {valueFormatter} from '../../../utils/formatter'
export default {
name: 'ChartComponent',
@ -128,16 +128,6 @@ export default {
fontWeight: 'normal',
background: hexColorToRGBA('#ffffff', 0)
},
title_class: {
margin: '0 0',
width: '100%',
fontSize: '18px',
color: '#303133',
textAlign: 'left',
fontStyle: 'normal',
fontWeight: 'normal',
background: ''
},
linkageActiveParam: null,
linkageActiveHistory: false,
CHART_CONT_FAMILY_MAP: {
@ -252,7 +242,6 @@ export default {
this.titleClass.textAlign = customStyle.text.hPosition
this.titleClass.fontStyle = customStyle.text.isItalic ? 'italic' : 'normal'
this.titleClass.fontWeight = customStyle.text.isBolder ? 'bold' : 'normal'
this.titleClass.fontSize = customStyle.text.isBolder ? 'bold' : 'normal'
this.titleClass.fontFamily = customStyle.text.fontFamily ? this.CHART_CONT_FAMILY_MAP[customStyle.text.fontFamily] : 'Microsoft YaHei'
this.titleClass.letterSpacing = (customStyle.text.letterSpace ? customStyle.text.letterSpace : '0') + 'px'
@ -325,11 +314,13 @@ export default {
const _chartType = this.getChartType(yaxisList[_index].chartType);
if (_labelSetting) {
if (_chartType === "column") {
_labelSetting.position = labelPosition;
} else {
_labelSetting.position = undefined;
}
}
return {
type: _chartType,
@ -378,11 +369,13 @@ export default {
const _chartType = this.getChartType(yaxisExtList[_index].chartType);
if (_labelSetting) {
if (_chartType === "column") {
_labelSetting.position = labelPosition;
} else {
_labelSetting.position = undefined;
}
}
return {
type: _chartType,

View File

@ -59,10 +59,10 @@
</template>
<script>
import ColorSelector from '@/components/selector/ColorSelector'
import TitleSelector from '@/components/selector/TitleSelector'
import TooltipSelectorAntV from '@/components/selector/TooltipSelectorAntV'
import LabelSelector from '@/components/selector/LabelSelector.vue'
import ColorSelector from '../../../components/selector/ColorSelector'
import TitleSelector from '../../../components/selector/TitleSelector'
import TooltipSelectorAntV from '../../../components/selector/TooltipSelectorAntV'
import LabelSelector from '../../../components/selector/LabelSelector.vue'
import messages from '@/de-base/lang/messages'
export default {
components: {

View File

@ -49,20 +49,14 @@ public class RaceBarViewStatHandler 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> xFields = fieldSQLMap.get("xAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(singleField -> singleField.getField()).collect(Collectors.toList());
List<PluginViewSQL> xOrders = fieldSQLMap.get("xAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(singleField -> singleField.getSort()).collect(Collectors.toList());
// 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());
List<String> yWheres = fieldSQLMap.getOrDefault("yAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(PluginSingleField::getWhere).collect(Collectors.toList());
List<String> yWheres = fieldSQLMap.get("yAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(singleField -> singleField.getWhere()).collect(Collectors.toList());
/*List<PluginViewSQL> yExtFields = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList());
List<PluginViewSQL> yExtOrders = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(PluginSingleField::getSort).collect(Collectors.toList());
List<String> yExtWheres = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(PluginSingleField::getWhere).collect(Collectors.toList());
yFields.addAll(yExtFields);
yOrders.addAll(yExtOrders);
yWheres.addAll(yExtWheres);*/
// 处理视图中字段过滤
String customWheres = baseService.customWhere(dsType, pluginViewParam.getPluginChartFieldCustomFilters(), tableObj);
@ -75,9 +69,15 @@ public class RaceBarViewStatHandler implements PluginViewStatHandler {
if (customWheres != null) wheres.add(customWheres);
if (panelWheres != null) wheres.add(panelWheres);
if (permissionWhere != null) wheres.add(permissionWhere);
List<PluginViewSQL> groups = new ArrayList<>();
groups.addAll(xFields);
List<PluginViewSQL> orders = new ArrayList<>();
orders.addAll(xOrders);
// 外层再次套sql
List<String> aggWheres = new ArrayList<>();
aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList()));
@ -99,7 +99,9 @@ public class RaceBarViewStatHandler implements PluginViewStatHandler {
.tableAlias(String.format(table_alias_prefix, 1))
.build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return baseService.sqlLimit(dsType, st.render(), pluginViewParam.getPluginViewLimit());
}

View File

@ -40,9 +40,9 @@ public class RaceBarService extends ViewPluginService {
private static final Map<String, String[]> VIEW_STYLE_PROPERTY_INNER = new HashMap<>();
static {
VIEW_STYLE_PROPERTY_INNER.put("color-selector", new String[]{"value", "alpha"});
VIEW_STYLE_PROPERTY_INNER.put("label-selector", new String[]{"show", "fontSize", "color", "position", "formatter"});
VIEW_STYLE_PROPERTY_INNER.put("tooltip-selector", new String[]{"show", "textStyle", "formatter"});
VIEW_STYLE_PROPERTY_INNER.put("color-selector", new String[]{"value"});
VIEW_STYLE_PROPERTY_INNER.put("label-selector", new String[]{"show", "fontSize", "color", "position"});
VIEW_STYLE_PROPERTY_INNER.put("tooltip-selector", new String[]{"show", "textStyle",});
VIEW_STYLE_PROPERTY_INNER.put("title-selector", new String[]{"show", "title", "fontSize", "color", "hPosition", "vPosition", "isItalic", "isBolder"});
}
@ -107,6 +107,7 @@ public class RaceBarService extends ViewPluginService {
return null;
}
String sql = new RaceBarViewStatHandler().build(param, this);
return sql;
}
@ -143,12 +144,23 @@ public class RaceBarService extends ViewPluginService {
map.put("encode", encode);
Set<Object> xs = new HashSet<>();
Set<String> keySet = new HashSet<>();
List<String> keyList = new ArrayList<>();
data.forEach(ss -> {
xs.add(ss[encode.get("y")]);
String key = StringUtils.defaultString(ss[(Integer) map.get("extIndex")], StringUtils.EMPTY);
if (!keySet.contains(key)) {
keySet.add(key);
keyList.add(key);
}
});
Map<String, List<String[]>> groupData = data.stream().collect(Collectors.toMap(
k -> k[(Integer) map.get("extIndex")],
k -> StringUtils.defaultString(k[(Integer) map.get("extIndex")], StringUtils.EMPTY),
v -> {
List<String[]> list = new ArrayList<>();
list.add(v);
@ -160,24 +172,13 @@ public class RaceBarService extends ViewPluginService {
})
);
for (String key : groupData.keySet()) {
String finalType = type;
groupData.put(key, groupData.get(key).stream().sorted((o1, o2) -> {
if (StringUtils.equals(finalType, "LONG")) {
return Long.valueOf(o2[encode.get("x")]).compareTo(Long.valueOf(o1[encode.get("x")]));
} else if (StringUtils.equals(finalType, "DOUBLE")) {
return Double.valueOf(o2[encode.get("x")]).compareTo(Double.valueOf(o1[encode.get("x")]));
}
return o2[encode.get("x")].compareTo(o1[encode.get("x")]);
}).collect(Collectors.toList()));
}
map.put("groupData", groupData);
map.put("extXs", new ArrayList<>(groupData.keySet()).stream().sorted().collect(Collectors.toList()));
map.put("extXs", keyList);
map.put("xs", xs);
map.put("xs", new ArrayList<>(xs).stream().sorted().collect(Collectors.toList()));
return map;
}

View File

@ -17,6 +17,17 @@
<el-color-picker v-model="tooltipForm.textStyle.color" class="color-picker-style"
:predefine="predefineColors" @change="changeTooltipAttr"/>
</el-form-item>
<el-form-item
:label="$t('chart.background')"
class="form-item"
>
<el-color-picker
v-model="tooltipForm.backgroundColor"
class="color-picker-style"
:predefine="predefineColors"
@change="changeTooltipAttr"
/>
</el-form-item>
<!-- <el-form-item class="form-item">
<span slot="label">
<span class="span-box">
@ -40,7 +51,7 @@
</template>
<script>
import {COLOR_PANEL, DEFAULT_TOOLTIP} from '@/utils/map'
import {COLOR_PANEL, DEFAULT_TOOLTIP} from '../../utils/map'
export default {
name: 'TooltipSelector',
@ -127,6 +138,10 @@ export default {
font-size: 12px;
}
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item {
padding: 0 20px;
}

View File

@ -65,7 +65,7 @@
/>
</el-tag>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item>
<el-dropdown-item>
<el-dropdown
placement="right-start"
size="mini"
@ -78,7 +78,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>
@ -86,7 +86,7 @@
<el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>-->
</el-dropdown-item>
<el-dropdown-item
v-show="item.deType === 1"

View File

@ -76,6 +76,11 @@ export default {
return ['drill']
}
},
inScreen: {
type: Boolean,
required: false,
default: true
},
searchCount: {
type: Number,
required: false,
@ -393,6 +398,8 @@ export default {
this.myChart.on('finished', () => {
this.loading = false
})
this.currentIndex = 0;
})
},
loadThemeStyle() {
@ -594,7 +601,7 @@ export default {
chart_option.legend['pageIconInactiveColor'] = '#8c8c8c'
}
}
if (chart_option.tooltip) {
if (chart_option.tooltip && this.inScreen) {
chart_option.tooltip.appendToBody = true
}

View File

@ -122,6 +122,9 @@ export default {
.form-item>>>.el-form-item__label{
font-size: 12px;
}
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item{
padding: 0 20px;
}

View File

@ -105,9 +105,9 @@
</template>
<script>
import SankeyDimensionItem from '@/components/views/SankeyDimensionItem'
import SankeyQuotaItem from '@/components/views/SankeyQuotaItem'
import FilterItem from '@/components/views/FilterItem'
import SankeyDimensionItem from '../../../components/views/SankeyDimensionItem'
import SankeyQuotaItem from '../../../components/views/SankeyQuotaItem'
import FilterItem from '../../../components/views/FilterItem'
import messages from '@/de-base/lang/messages'
export default {

View File

@ -9,12 +9,12 @@
v-if="chart.type && antVRenderStatus"
v-show="title_show"
ref="title"
:style="title_class"
:style="titleClass"
style="cursor: default;display: block;"
>
<div style="padding:4px 4px 0;margin: 0;">
<chart-title-update
:title-class="title_class"
:title-class="titleClass"
:chart-info="chartInfo"
:bus="bus"
:axios-request="axiosRequest"
@ -33,11 +33,11 @@
<script>
import {Sankey} from '@antv/g2plot'
import {uuid, hexColorToRGBA} from '@/utils/sankey'
import ViewTrackBar from '@/components/views/ViewTrackBar'
import {getRemark} from "@/components/views/utils";
import {DEFAULT_TITLE_STYLE} from '@/utils/map';
import ChartTitleUpdate from '@/components/views/ChartTitleUpdate';
import {uuid, hexColorToRGBA} from '../../../utils/sankey'
import ViewTrackBar from '../../../components/views/ViewTrackBar'
import {getRemark} from "../../../components/views/utils";
import {DEFAULT_TITLE_STYLE} from '../../../utils/map';
import ChartTitleUpdate from '../../../components/views/ChartTitleUpdate';
import _ from 'lodash';
import {clear} from 'size-sensor'
@ -121,16 +121,6 @@ export default {
fontWeight: 'normal',
background: hexColorToRGBA('#ffffff', 0)
},
title_class: {
margin: '0 0',
width: '100%',
fontSize: '18px',
color: '#303133',
textAlign: 'left',
fontStyle: 'normal',
fontWeight: 'normal',
background: ''
},
linkageActiveParam: null,
linkageActiveHistory: false,
CHART_CONT_FAMILY_MAP: {
@ -244,7 +234,6 @@ export default {
this.titleClass.textAlign = customStyle.text.hPosition
this.titleClass.fontStyle = customStyle.text.isItalic ? 'italic' : 'normal'
this.titleClass.fontWeight = customStyle.text.isBolder ? 'bold' : 'normal'
this.titleClass.fontSize = customStyle.text.isBolder ? 'bold' : 'normal'
this.titleClass.fontFamily = customStyle.text.fontFamily ? this.CHART_CONT_FAMILY_MAP[customStyle.text.fontFamily] : 'Microsoft YaHei'
this.titleClass.letterSpacing = (customStyle.text.letterSpace ? customStyle.text.letterSpace : '0') + 'px'

View File

@ -59,10 +59,10 @@
</template>
<script>
import ColorSelector from '@/components/selector/ColorSelector'
import TitleSelector from '@/components/selector/TitleSelector'
import TooltipSelectorAntV from '@/components/selector/TooltipSelectorAntV'
import LabelSelector from '@/components/selector/LabelSelector.vue'
import ColorSelector from '../../../components/selector/ColorSelector'
import TitleSelector from '../../../components/selector/TitleSelector'
import TooltipSelectorAntV from '../../../components/selector/TooltipSelectorAntV'
import LabelSelector from '../../../components/selector/LabelSelector.vue'
import messages from '@/de-base/lang/messages'
export default {
components: {