diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml index 700328593c..7a638314fa 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml @@ -187,11 +187,11 @@ `senior`, `data_from`) SELECT #{newChartId}, - `name`, + GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `name`, #{panelId}, `table_id`, `type`, - `title`, + GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `title`, `x_axis`, `x_axis_ext`, `y_axis`, diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 5862bb8c26..d42d44b804 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -116,6 +116,13 @@ public class ChartViewService { public ChartViewWithBLOBs newOne(ChartViewWithBLOBs chartView) { long timestamp = System.currentTimeMillis(); + // 校验名称 + ChartViewExample queryExample = new ChartViewExample(); + queryExample.createCriteria().andSceneIdEqualTo(chartView.getSceneId()).andNameEqualTo(chartView.getName()); + List result = chartViewMapper.selectByExample(queryExample); + if(CollectionUtils.isNotEmpty(result)){ + DEException.throwException(Translator.get("theme_name_repeat")); + } chartView.setUpdateTime(timestamp); chartView.setId(UUID.randomUUID().toString()); chartView.setCreateBy(AuthUtils.getUser().getUsername()); diff --git a/backend/src/main/resources/db/migration/V33__1.9.sql b/backend/src/main/resources/db/migration/V33__1.9.sql index e0251c26f2..2a2fd7a965 100644 --- a/backend/src/main/resources/db/migration/V33__1.9.sql +++ b/backend/src/main/resources/db/migration/V33__1.9.sql @@ -250,7 +250,7 @@ END ;; delimiter ; -INSERT INTO `my_plugin`(`plugin_id`, `name`, `store`, `free`, `cost`, `category`, `descript`, `version`, `install_type`, `creator`, `load_mybatis`, `release_time`, `install_time`, `module_name`, `icon`) VALUES (3, 'tabs插件', 'default', 0, 20000, 'panel', 'tabs插件', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 0, NULL, NULL, 'dataease-extensions-tabs-backend', NULL); +INSERT INTO `my_plugin`(`plugin_id`, `name`, `store`, `free`, `cost`, `category`, `descript`, `version`, `install_type`, `creator`, `load_mybatis`, `release_time`, `install_time`, `module_name`, `icon`) VALUES (3, '选项卡插件', 'default', 0, 20000, 'panel', '选项卡插件', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 0, NULL, NULL, 'dataease-extensions-tabs-backend', NULL); ALTER TABLE `panel_link_jump_info` ADD COLUMN `attach_params` tinyint(1) NULL COMMENT '是否附加点击参数' AFTER `checked`; @@ -259,3 +259,36 @@ ADD COLUMN `attach_params` tinyint(1) NULL COMMENT '是否附加点击参数' AF update `sys_menu` set menu_id = 100 where title = '首页'; INSERT INTO `sys_menu` VALUES (101, 1, 4, 1, '插件管理', 'system-plugin', 'system/plugin/index', 1002, 'peoples', 'plugin', b'0', b'0', b'0', 'plugin:read', NULL, NULL, NULL, 1620281952752); + +DROP FUNCTION IF EXISTS `GET_CHART_VIEW_COPY_NAME`; +delimiter ;; +CREATE FUNCTION `GET_CHART_VIEW_COPY_NAME`(chartId varchar(255),pid varchar(255)) + RETURNS varchar(255) CHARSET utf8mb4 + READS SQL DATA +BEGIN + +DECLARE chartName varchar(255); + +DECLARE regexpInfo varchar(255); + +DECLARE chartNameCount INTEGER; + +select `name` into chartName from chart_view where id =chartId; +/** +因为名称存在()等特殊字符,所以不能直接用REGEXP进行查找,qrtz_locks +1.用like 'chartName%' 过滤可能的数据项 +2.REPLACE(name,chartName,'') REGEXP '-copy\\(([0-9])+\\)$' 过滤去掉chartName后的字符以 -copy(/d) 结尾的数据 +3.(LENGTH(REPLACE(name,chartName,''))-LENGTH(replace(REPLACE(name,chartName,''),'-',''))=1) 确定只出现一次 ‘-’ 防止多次copy +**/ +select (count(1)+1) into chartNameCount from chart_view +where (LENGTH(REPLACE(name,chartName,''))-LENGTH(replace(REPLACE(name,chartName,''),'-',''))=1) +and REPLACE(name,chartName,'') REGEXP '-copy\\(([0-9])+\\)$' and name like CONCAT(chartName,'%') and chart_view.scene_id=pid ; + +RETURN concat(chartName,'-copy(',chartNameCount,')'); + +END +;; +delimiter ; + +update `my_plugin` set `name` = 'X-Pack默认插件' where `plugin_id` = 1; +update `my_plugin` set `module_name` = 'view-bubblemap-backend' where `plugin_id` = 2; diff --git a/frontend/src/views/chart/components/drag-item/ChartDragItem.vue b/frontend/src/views/chart/components/drag-item/ChartDragItem.vue index 7b6ba842d9..de4971a907 100644 --- a/frontend/src/views/chart/components/drag-item/ChartDragItem.vue +++ b/frontend/src/views/chart/components/drag-item/ChartDragItem.vue @@ -140,7 +140,7 @@ export default { }, data() { return { - tagType: getItemType(this.dimensionData, this.quotaData, this.item) + tagType: 'success' } }, watch: { diff --git a/frontend/src/views/chart/components/drag-item/DimensionItem.vue b/frontend/src/views/chart/components/drag-item/DimensionItem.vue index f8b5f60da0..8923633daf 100644 --- a/frontend/src/views/chart/components/drag-item/DimensionItem.vue +++ b/frontend/src/views/chart/components/drag-item/DimensionItem.vue @@ -120,7 +120,7 @@ export default { }, data() { return { - tagType: getItemType(this.dimensionData, this.quotaData, this.item) + tagType: 'success' } }, watch: { diff --git a/frontend/src/views/chart/components/drag-item/DrillItem.vue b/frontend/src/views/chart/components/drag-item/DrillItem.vue index 5e24b37397..c76fa5b506 100644 --- a/frontend/src/views/chart/components/drag-item/DrillItem.vue +++ b/frontend/src/views/chart/components/drag-item/DrillItem.vue @@ -56,7 +56,7 @@ export default { }, data() { return { - tagType: getItemType(this.dimensionData, this.quotaData, this.item) + tagType: 'success' } }, watch: { diff --git a/frontend/src/views/chart/components/drag-item/FilterItem.vue b/frontend/src/views/chart/components/drag-item/FilterItem.vue index 600de8f41c..56e87101c3 100644 --- a/frontend/src/views/chart/components/drag-item/FilterItem.vue +++ b/frontend/src/views/chart/components/drag-item/FilterItem.vue @@ -57,7 +57,7 @@ export default { }, data() { return { - tagType: getItemType(this.dimensionData, this.quotaData, this.item) + tagType: 'success' } }, watch: { diff --git a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue index 8c08badb3d..2979641516 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue @@ -148,7 +148,7 @@ export default { return { compareItem: compareItem, disableEditCompare: false, - tagType: getItemType(this.dimensionData, this.quotaData, this.item) + tagType: 'success' } }, watch: { diff --git a/frontend/src/views/chart/components/drag-item/QuotaItem.vue b/frontend/src/views/chart/components/drag-item/QuotaItem.vue index 7b4539ff81..3d52773f22 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaItem.vue @@ -148,7 +148,7 @@ export default { return { compareItem: compareItem, disableEditCompare: false, - tagType: getItemType(this.dimensionData, this.quotaData, this.item) + tagType: 'success' } }, watch: { diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 3a9c20a990..05180d7227 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -142,7 +142,7 @@ - + diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue index a911e7ea4d..7b1d2c576c 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue @@ -168,7 +168,7 @@ - + diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index 532a71277a..0b1a562bd4 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -204,7 +204,7 @@ !this.renderOptions.some(option => option.value === plugin.render)).map(plugin => { + return { name: plugin.render, value: plugin.render } + }) + return [...this.renderOptions, ...pluginOptions] } }, watch: { @@ -783,7 +790,7 @@ export default { view.extBubble = JSON.stringify([]) this.setChartDefaultOptions(view) const _this = this - post('/chart/view/newOne/' + this.panelInfo.id, view,true).then(response => { + post('/chart/view/newOne/' + this.panelInfo.id, view, true).then(response => { this.closeCreateChart() this.$store.dispatch('chart/setTableId', null) this.$store.dispatch('chart/setTableId', this.table.id) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 2d8b81a76c..d340d4b660 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -175,7 +175,7 @@ @change="changeChartType()" > - + !this.renderOptions.some(option => option.value === plugin.render)).map(plugin => { + return { name: plugin.render, value: plugin.render } + }) + return [...this.renderOptions, ...pluginOptions] + } }, watch: { 'param': function(val) { diff --git a/frontend/src/views/panel/list/EditPanel/index.vue b/frontend/src/views/panel/list/EditPanel/index.vue index cac5c1826b..252483d93c 100644 --- a/frontend/src/views/panel/list/EditPanel/index.vue +++ b/frontend/src/views/panel/list/EditPanel/index.vue @@ -3,7 +3,7 @@ {{ $t('panel.custom') }} - + {{ $t('panel.import_template') }} {{ $t('panel.copy_template') }} @@ -23,7 +23,7 @@ - + {{ $t('commons.cancel') }} {{ $t('commons.confirm') }} @@ -168,6 +168,7 @@ export default { this.editPanel.panelInfo.name = this.importTemplateInfo.name this.editPanel.panelInfo.panelStyle = this.importTemplateInfo.panelStyle this.editPanel.panelInfo.panelData = this.importTemplateInfo.panelData + this.editPanel.panelInfo.dynamicData = this.importTemplateInfo.dynamicData } reader.readAsText(file) },