From ab7eb50165438bad2bdd0a5d40189b9ef2e7ae9e Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 20 Jun 2022 15:41:39 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E7=9B=98=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/gauge/gauge_antv.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/chart/chart/gauge/gauge_antv.js b/frontend/src/views/chart/chart/gauge/gauge_antv.js index b554959fdc..7349aee01a 100644 --- a/frontend/src/views/chart/chart/gauge/gauge_antv.js +++ b/frontend/src/views/chart/chart/gauge/gauge_antv.js @@ -25,6 +25,7 @@ export function baseGaugeOptionAntV(plot, container, chart, action, scale = 1) { endAngel = parseInt(size.gaugeEndAngle) * Math.PI / 180 } } + const per = (parseFloat(data) - parseFloat(min)) / (parseFloat(max) - parseFloat(min)) // label if (customAttr.label) { const label = JSON.parse(JSON.stringify(customAttr.label)) @@ -49,7 +50,6 @@ export function baseGaugeOptionAntV(plot, container, chart, action, scale = 1) { } labelFormatter = label.gaugeLabelFormatter ? label.gaugeLabelFormatter : DEFAULT_LABEL.gaugeLabelFormatter } - const per = (parseFloat(data) - parseFloat(min)) / (parseFloat(max) - parseFloat(min)) const range = [0] let index = 0 From 5eb0a652e8bda85ce777a9102e3e1f76be7fb58a Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 20 Jun 2022 16:18:22 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=E8=BF=87=E6=BB=A4=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE=E9=9B=86=E6=97=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=90=E7=BA=A7=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/panel/filter/filterDialog.vue | 118 ++++++++++++++---- 1 file changed, 93 insertions(+), 25 deletions(-) diff --git a/frontend/src/views/panel/filter/filterDialog.vue b/frontend/src/views/panel/filter/filterDialog.vue index d2d2bb76c5..e1cee352e8 100644 --- a/frontend/src/views/panel/filter/filterDialog.vue +++ b/frontend/src/views/panel/filter/filterDialog.vue @@ -33,7 +33,7 @@ v-if="showDomType === 'tree'" :default-expanded-keys="expandedArray" node-key="id" - :data="datas" + :data="tempTreeDatas || datas" :props="defaultProps" @node-click="handleNodeClick" @@ -296,7 +296,8 @@ export default { viewInfos: [] }, currentElement: null, - allFields: [] + allFields: [], + tempTreeDatas: null } }, computed: { @@ -427,7 +428,6 @@ export default { }, {}) const roots = [] arrs.forEach(el => { - // 判断根节点 ### el.type = el.modelInnerType el.isLeaf = el.leaf if (el[this.defaultProps.parentId] === null || el[this.defaultProps.parentId] === 0 || el[this @@ -435,22 +435,29 @@ export default { roots.push(el) return } - // 用映射表找到父元素 const parentEl = arrs[idMapping[el[this.defaultProps.parentId]]] - // 把当前元素添加到父元素的`children`数组中 parentEl.children = [...(parentEl.children || []), el] - // 设置展开节点 如果没有子节点则不进行展开 if (parentEl.children.length > 0) { this.expandedArray.push(parentEl[this.defaultProps.id]) } }) return roots }, + getNode(id, roots) { + for (let index = 0; index < roots.length; index++) { + const node = roots[index] + if (node.id === id) return node + + if (node && node.children && node.children.length) { + const temp = this.getNode(id, node.children) + if (temp) return temp + } + } + return null + }, + loadViews() { - /* const viewIds = this.componentData - .filter(item => item.type === 'view' && item.propValue && item.propValue.viewId) - .map(item => item.propValue.viewId) */ let viewIds = []; let tabViewIds = [] for (let index = 0; index < this.componentData.length; index++) { const element = this.componentData[index] @@ -465,27 +472,21 @@ export default { } viewIds && viewIds.length > 0 && viewsWithIds(viewIds).then(res => { const datas = res.data - /* datas.forEach(item => { - if (tabViewIds.includes(item.id)) { - item.name = 'tabs(' + item.name + ')' - } - }) */ + this.viewInfos = datas this.childViews.viewInfos = datas }) viewIds && viewIds.length > 0 && paramsWithIds(viewIds).then(res => { const datas = res.data - /* datas.forEach(item => { - if (tabViewIds.includes(item.id)) { - item.name = 'tabs(' + item.name + ')' - } - }) */ + this.childViews.datasetParams = datas }) }, handleNodeClick(data) { - if (data.type !== 'group') { + if (data.modelInnerType !== 'group') { this.showFieldDatas(data) + } else { + this.showNextGroup(data) } }, @@ -499,7 +500,7 @@ export default { setTailLink(node) { const tail = this.dataSetBreads[this.dataSetBreads.length - 1] - tail.type = node.type + tail.type = node.modelInnerType tail.link = true }, comSetTailLink(node) { @@ -511,10 +512,58 @@ export default { const tail = { link: false, label: node.label || node.name, - type: node.type + type: node.modelInnerType, + id: node.id } this.dataSetBreads.push(tail) }, + addQueue(node) { + this.dataSetBreads = this.dataSetBreads.slice(0, 1) + const root = { + id: null, + children: JSON.parse(JSON.stringify(this.datas)) + } + this.getPathById(node.id, root, res => { + if (res.length > 1) { + for (let index = 1; index < res.length; index++) { + const node = res[index] + const temp = { + link: true, + label: node.label || node.name, + type: node.modelInnerType, + id: node.id + } + this.dataSetBreads.push(temp) + this.dataSetBreads[0].link = true + } + + this.dataSetBreads[this.dataSetBreads.length - 1].link = false + } + }) + }, + getPathById(id, catalog, callback) { + var temppath = [] + try { + const getNodePath = function(node) { + temppath.push(node) + if (node.id === id) { + // eslint-disable-next-line no-throw-literal + throw ('GOT IT!') + } + if (node.children && node.children.length > 0) { + for (var i = 0; i < node.children.length; i++) { + getNodePath(node.children[i]) + } + temppath.pop() + } else { + temppath.pop() + } + } + getNodePath(catalog) + } catch (e) { + callback(temppath) + } + }, comAddTail(node) { const tail = { link: false, @@ -525,9 +574,14 @@ export default { }, removeTail(bread) { + if (!bread.id) { + this.dataSetBreads = this.dataSetBreads.slice(0, 1) + this.dataSetBreads[this.dataSetBreads.length - 1]['link'] = false + return + } for (let index = 0; index < this.dataSetBreads.length; index++) { const element = this.dataSetBreads[index] - if (element.type === bread.type) { + if (element.type === bread.type && element.id === bread.id) { this.dataSetBreads = this.dataSetBreads.slice(0, index + 1) this.dataSetBreads[this.dataSetBreads.length - 1]['link'] = false return @@ -546,6 +600,15 @@ export default { this.expandedArray = [] this.keyWord = '' this.isTreeSearch = false + if (bread.id) { + const node = this.getNode(bread.id, this.datas) + if (node) { + this.tempTreeDatas = node.children + } + } else { + this.tempTreeDatas = null + } + this.datas = JSON.parse(JSON.stringify(this.defaultDatas)) }) }, @@ -580,11 +643,16 @@ export default { showFieldDatas(row) { this.keyWord = '' this.showDomType = 'field' - this.setTailLink(row) - this.addTail(row) + this.addQueue(row) this.fieldsParent = row this.loadField(row.id) }, + showNextGroup(row) { + this.tempTreeDatas = JSON.parse(JSON.stringify(row.children)) + this.keyWord = '' + this.showDomType = 'tree' + this.addQueue(row) + }, comShowFieldDatas(row) { this.viewKeyWord = '' this.comShowDomType = 'field' From 48199f9116511d98693e606a6c3ecbb903b656a8 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 20 Jun 2022 17:08:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?perf:=20=E6=A0=91=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A8=A1=E7=B3=8A=E6=90=9C=E7=B4=A2=E5=90=8E?= =?UTF-8?q?=E5=85=A8=E9=80=89=E5=8F=AA=E9=80=89=E4=B8=AD=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/ElTreeSelect/index.vue | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/ElTreeSelect/index.vue b/frontend/src/components/ElTreeSelect/index.vue index df60a28571..c135597b03 100644 --- a/frontend/src/components/ElTreeSelect/index.vue +++ b/frontend/src/components/ElTreeSelect/index.vue @@ -470,15 +470,26 @@ export default { _treeCheckFun(data, node, vm) { this.ids = [] const { propsValue } = this - node.checkedNodes.forEach(item => { + const checkKeys = this.$refs.tree.getCheckedKeys() + checkKeys.forEach((i, n) => { + const node = this.$refs.tree.getNode(i) + if (!node.visible && node.checked) { + this.$refs.tree.setChecked(i, false) + } + }) + + const checkedNodes = this.$refs.tree.getCheckedNodes() + + checkedNodes.forEach(item => { this.ids.push(item[propsValue]) }) /* - 点击复选框,对外抛出 `data, node, vm`
- `data:` 当前点击的节点数据
- `node:` 当前点击的node
- `vm:` 当前组件的vm - */ + 点击复选框,对外抛出 `data, node, vm`
+ `data:` 当前点击的节点数据
+ `node:` 当前点击的node
+ `vm:` 当前组件的vm + */ + node.checkedKeys = checkedNodes.map(node => node.id) this.$emit('check', data, node, vm) this._emitFun() }, From e39ee7844f8c301652e55ac05fa273509647a4f1 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 20 Jun 2022 17:18:07 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E6=8F=92=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/service/sys/PluginService.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/sys/PluginService.java b/backend/src/main/java/io/dataease/service/sys/PluginService.java index 2fa937a64e..6f8b118046 100644 --- a/backend/src/main/java/io/dataease/service/sys/PluginService.java +++ b/backend/src/main/java/io/dataease/service/sys/PluginService.java @@ -11,14 +11,12 @@ import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.CodingUtil; import io.dataease.commons.utils.DeFileUtils; import io.dataease.commons.utils.LogUtil; -import io.dataease.commons.utils.ZipUtils; import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.i18n.Translator; import io.dataease.listener.util.CacheUtils; import io.dataease.plugins.common.base.domain.MyPlugin; import io.dataease.plugins.common.base.mapper.MyPluginMapper; import io.dataease.plugins.config.LoadjarUtil; -import io.dataease.plugins.config.SpringContextUtil; import io.dataease.service.datasource.DatasourceService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ArrayUtils; @@ -31,7 +29,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.File; -import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.List; @@ -98,14 +95,14 @@ public class PluginService { DeFileUtils.deleteFile(folder); String msg = "缺少插件描述文件【plugin.json】"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } MyPluginDTO myPlugin = formatJsonFile(jsonFiles[0]); if (!versionMatch(myPlugin.getRequire())) { String msg = "当前插件要求系统版本最低为:" + myPlugin.getRequire(); LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } //4.加载jar包 失败则 直接返回错误 删除文件 File[] jarFiles = folderFile.listFiles(this::isPluginJar); @@ -114,13 +111,13 @@ public class PluginService { DeFileUtils.deleteFile(folder); String msg = "缺少插件jar文件"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } if (pluginExist(myPlugin)) { String msg = "插件【"+myPlugin.getName()+"】已存在,请先卸载"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } String targetDir = null; try { @@ -188,7 +185,7 @@ public class PluginService { if (ObjectUtils.isEmpty(myPlugin)) { String msg = "当前插件不存在"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } deleteJarFile(myPlugin); CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME); @@ -197,7 +194,7 @@ public class PluginService { if(myPlugin.getCategory().equalsIgnoreCase("datasource")){ if(CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))){ - throw new RuntimeException(Translator.get("i18n_plugin_not_allow_delete")); + DEException.throwException(Translator.get("i18n_plugin_not_allow_delete")); } loadjarUtil.deleteModule(myPlugin.getModuleName() + "-" + myPlugin.getVersion()); } From 78022a824424ba57f807bda0f57a0e2daf5b33a3 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 20 Jun 2022 17:40:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E8=A7=86=E5=9B=BE=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/dataset/DatasetFunctionController.java | 3 +-- frontend/src/views/chart/view/CalcChartFieldEdit.vue | 5 ++--- frontend/src/views/chart/view/ChartFieldEdit.vue | 10 ---------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/dataset/DatasetFunctionController.java b/backend/src/main/java/io/dataease/controller/dataset/DatasetFunctionController.java index 88dc66177f..d9cd8c5183 100644 --- a/backend/src/main/java/io/dataease/controller/dataset/DatasetFunctionController.java +++ b/backend/src/main/java/io/dataease/controller/dataset/DatasetFunctionController.java @@ -3,7 +3,6 @@ package io.dataease.controller.dataset; import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.auth.annotation.DePermission; import io.dataease.commons.constants.DePermissionType; -import io.dataease.commons.constants.ResourceAuthLevel; import io.dataease.plugins.common.base.domain.DatasetTableFunction; import io.dataease.service.dataset.DatasetFunctionService; import io.swagger.annotations.Api; @@ -28,7 +27,7 @@ public class DatasetFunctionController { @Resource private DatasetFunctionService datasetFunctionService; - @DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE) + @DePermission(type = DePermissionType.DATASET) @ApiOperation("查询") @PostMapping("listByTableId/{tableId}") public List listByTableId(@PathVariable String tableId) { diff --git a/frontend/src/views/chart/view/CalcChartFieldEdit.vue b/frontend/src/views/chart/view/CalcChartFieldEdit.vue index 757a6598f9..13582385d8 100644 --- a/frontend/src/views/chart/view/CalcChartFieldEdit.vue +++ b/frontend/src/views/chart/view/CalcChartFieldEdit.vue @@ -298,6 +298,7 @@ export default { watch: { 'param': function() { this.initFunctions() + this.initDsFields() }, 'field': { handler: function() { @@ -333,7 +334,7 @@ export default { this.$refs.myCm.codemirror.showHint() }) this.initFunctions() - // this.initField() + this.initDsFields() }, methods: { onCmReady(cm) { @@ -364,8 +365,6 @@ export default { post('/dataset/function/listByTableId/' + this.param.tableId, null).then(response => { this.functions = response.data this.functionData = JSON.parse(JSON.stringify(this.functions)) - - this.initDsFields() }) }, diff --git a/frontend/src/views/chart/view/ChartFieldEdit.vue b/frontend/src/views/chart/view/ChartFieldEdit.vue index 35f6efe6bf..4030b5ce80 100644 --- a/frontend/src/views/chart/view/ChartFieldEdit.vue +++ b/frontend/src/views/chart/view/ChartFieldEdit.vue @@ -28,7 +28,6 @@ @@ -40,7 +39,6 @@ v-model="scope.row.deType" size="mini" style="display: inline-block;width: 26px;" - :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit(scope.row)" > @@ -158,7 +155,6 @@ @@ -306,7 +298,6 @@