Merge branch 'dev' of github.com:dataease/dataease into dev

This commit is contained in:
taojinlong 2022-06-20 17:40:49 +08:00
commit e5538941ce
7 changed files with 120 additions and 56 deletions

View File

@ -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<DatasetTableFunction> listByTableId(@PathVariable String tableId) {

View File

@ -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());
}

View File

@ -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`<br>
`data:` 当前点击的节点数据<br>
`node:` 当前点击的node<br>
`vm:` 当前组件的vm
*/
点击复选框对外抛出 `data, node, vm`<br>
`data:` 当前点击的节点数据<br>
`node:` 当前点击的node<br>
`vm:` 当前组件的vm
*/
node.checkedKeys = checkedNodes.map(node => node.id)
this.$emit('check', data, node, vm)
this._emitFun()
},

View File

@ -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

View File

@ -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()
})
},

View File

@ -28,7 +28,6 @@
<el-input
v-model="scope.row.name"
size="mini"
:disabled="!hasDataPermission('manage',param.privileges)"
@blur="saveEdit(scope.row)"
@keyup.enter.native="saveEdit(scope.row)"
/>
@ -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)"
>
<el-option
@ -149,7 +147,6 @@
icon="el-icon-sort"
size="mini"
circle
:disabled="!hasDataPermission('manage',param.privileges)"
@click="dqTrans(scope.row,'d')"
/>
</template>
@ -158,7 +155,6 @@
<template slot-scope="scope">
<el-button
v-if="scope.row.extField === 2"
:disabled="!hasDataPermission('manage',param.privileges)"
type="text"
size="mini"
@click="editField(scope.row)"
@ -166,7 +162,6 @@
</el-button>
<el-button
v-if="scope.row.extField !== 0"
:disabled="!hasDataPermission('manage',param.privileges)"
type="text"
size="mini"
@click="deleteField(scope.row)"
@ -184,7 +179,6 @@
<el-input
v-model="scope.row.name"
size="mini"
:disabled="!hasDataPermission('manage',param.privileges)"
@blur="saveEdit(scope.row)"
@keyup.enter.native="saveEdit(scope.row)"
/>
@ -196,7 +190,6 @@
v-model="scope.row.deType"
size="mini"
style="display: inline-block;width: 26px;"
:disabled="!hasDataPermission('manage',param.privileges)"
@change="saveEdit(scope.row)"
>
<el-option
@ -297,7 +290,6 @@
icon="el-icon-sort"
size="mini"
circle
:disabled="!hasDataPermission('manage',param.privileges)"
@click="dqTrans(scope.row,'q')"
/>
</template>
@ -306,7 +298,6 @@
<template slot-scope="scope">
<el-button
v-if="scope.row.extField === 2"
:disabled="!hasDataPermission('manage',param.privileges)"
type="text"
size="mini"
@click="editField(scope.row)"
@ -314,7 +305,6 @@
</el-button>
<el-button
v-if="scope.row.extField !== 0"
:disabled="!hasDataPermission('manage',param.privileges)"
type="text"
size="mini"
@click="deleteField(scope.row)"

View File

@ -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'