Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
7db5e731
提交
7db5e731
authored
5月 19, 2022
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev' into dev
上级
9ae6b821
cb9f4277
隐藏空白字符变更
内嵌
并排
正在显示
38 个修改的文件
包含
1259 行增加
和
87 行删除
+1259
-87
DeLog.java
backend/src/main/java/io/dataease/auth/annotation/DeLog.java
+34
-0
DeCleanerAnnotationHandler.java
...java/io/dataease/auth/aop/DeCleanerAnnotationHandler.java
+2
-44
DeLogAnnotationHandler.java
...ain/java/io/dataease/auth/aop/DeLogAnnotationHandler.java
+143
-0
SysLogConstants.java
...n/java/io/dataease/commons/constants/SysLogConstants.java
+72
-0
AopUtils.java
...end/src/main/java/io/dataease/commons/utils/AopUtils.java
+52
-0
DatasourceController.java
.../dataease/controller/datasource/DatasourceController.java
+24
-3
DeleteDsRequest.java
...taease/controller/datasource/request/DeleteDsRequest.java
+16
-0
SysLogController.java
...ain/java/io/dataease/controller/sys/SysLogController.java
+57
-0
SysUserController.java
...in/java/io/dataease/controller/sys/SysUserController.java
+21
-0
SysLogDTO.java
backend/src/main/java/io/dataease/dto/SysLogDTO.java
+24
-0
SysLogGridDTO.java
backend/src/main/java/io/dataease/dto/SysLogGridDTO.java
+25
-0
FolderItem.java
backend/src/main/java/io/dataease/dto/log/FolderItem.java
+16
-0
ExtSysLogMapper.java
backend/src/main/java/io/dataease/ext/ExtSysLogMapper.java
+15
-0
ExtSysLogMapper.xml
backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml
+118
-0
XDeptServer.java
...src/main/java/io/dataease/plugins/server/XDeptServer.java
+20
-0
XRoleServer.java
...src/main/java/io/dataease/plugins/server/XRoleServer.java
+16
-0
SysUserService.java
...src/main/java/io/dataease/service/sys/SysUserService.java
+1
-0
LogManager.java
...src/main/java/io/dataease/service/sys/log/LogManager.java
+133
-0
LogService.java
...src/main/java/io/dataease/service/sys/log/LogService.java
+148
-0
V35__1.11.sql
backend/src/main/resources/db/migration/V35__1.11.sql
+25
-0
messages_en_US.properties
backend/src/main/resources/i18n/messages_en_US.properties
+20
-0
messages_zh_CN.properties
backend/src/main/resources/i18n/messages_zh_CN.properties
+23
-0
messages_zh_TW.properties
backend/src/main/resources/i18n/messages_zh_TW.properties
+19
-0
package.json
frontend/package.json
+1
-1
datasource.js
frontend/src/api/system/datasource.js
+5
-4
log.js
frontend/src/api/system/log.js
+26
-0
zh.js
frontend/src/lang/zh.js
+9
-0
index.scss
frontend/src/styles/index.scss
+4
-0
ChartDragItem.vue
...nd/src/views/chart/components/drag-item/ChartDragItem.vue
+2
-1
DimensionExtItem.vue
...src/views/chart/components/drag-item/DimensionExtItem.vue
+2
-1
DimensionItem.vue
...nd/src/views/chart/components/drag-item/DimensionItem.vue
+1
-1
DrillItem.vue
frontend/src/views/chart/components/drag-item/DrillItem.vue
+2
-1
FilterItem.vue
frontend/src/views/chart/components/drag-item/FilterItem.vue
+2
-1
QuotaExtItem.vue
...end/src/views/chart/components/drag-item/QuotaExtItem.vue
+3
-2
QuotaItem.vue
frontend/src/views/chart/components/drag-item/QuotaItem.vue
+3
-2
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+2
-2
DsTree.vue
frontend/src/views/system/datasource/DsTree.vue
+36
-24
index.vue
frontend/src/views/system/log/index.vue
+137
-0
没有找到文件。
backend/src/main/java/io/dataease/auth/annotation/DeLog.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
auth
.
annotation
;
import
io.dataease.commons.constants.SysLogConstants.OPERATE_TYPE
;
import
io.dataease.commons.constants.SysLogConstants.SOURCE_TYPE
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Target
({
ElementType
.
TYPE
,
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
DeLog
{
OPERATE_TYPE
operatetype
();
SOURCE_TYPE
sourcetype
();
int
positionIndex
()
default
-
1
;
String
positionKey
()
default
""
;
int
sourceIndex
()
default
0
;
String
sourceKey
()
default
""
;
int
targetIndex
()
default
-
1
;
String
targetKey
()
default
""
;
SOURCE_TYPE
targetType
()
default
SOURCE_TYPE
.
USER
;
String
value
()
default
""
;
}
backend/src/main/java/io/dataease/auth/aop/DeCleanerAnnotationHandler.java
浏览文件 @
7db5e731
...
...
@@ -2,10 +2,10 @@ package io.dataease.auth.aop;
import
io.dataease.auth.annotation.DeCleaner
;
import
io.dataease.auth.api.dto.CurrentUserDto
;
import
io.dataease.auth.util.ReflectUtil
;
import
io.dataease.commons.constants.AuthConstants
;
import
io.dataease.commons.constants.DePermissionType
;
import
io.dataease.commons.model.AuthURD
;
import
io.dataease.commons.utils.AopUtils
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.LogUtil
;
import
io.dataease.listener.util.CacheUtils
;
...
...
@@ -19,11 +19,8 @@ import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.Method
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
@Aspect
...
...
@@ -43,7 +40,7 @@ public class DeCleanerAnnotationHandler {
if
(
ObjectUtils
.
isNotEmpty
(
key
)
&&
ArrayUtils
.
isNotEmpty
(
args
))
{
int
pi
=
deCleaner
.
paramIndex
();
Object
arg
=
point
.
getArgs
()[
pi
];
paramValue
=
getParamValue
(
arg
,
key
,
0
);
paramValue
=
AopUtils
.
getParamValue
(
arg
,
key
,
0
);
}
switch
(
type
.
name
())
{
...
...
@@ -136,44 +133,5 @@ public class DeCleanerAnnotationHandler {
});
}
private
Object
getParamValue
(
Object
arg
,
String
key
,
int
layer
)
throws
Exception
{
if
(
ObjectUtils
.
isNotEmpty
(
arg
))
return
null
;
Class
<?>
parameterType
=
arg
.
getClass
();
if
(
parameterType
.
isPrimitive
()
||
ReflectUtil
.
isWrapClass
(
parameterType
)
||
ReflectUtil
.
isString
(
parameterType
))
{
return
arg
;
}
else
if
(
ReflectUtil
.
isArray
(
parameterType
))
{
Object
result
;
for
(
int
i
=
0
;
i
<
Array
.
getLength
(
arg
);
i
++)
{
Object
o
=
Array
.
get
(
arg
,
i
);
if
(
ObjectUtils
.
isNotEmpty
((
result
=
getParamValue
(
o
,
key
,
layer
))))
{
return
result
;
}
}
return
null
;
}
else
if
(
ReflectUtil
.
isCollection
(
parameterType
))
{
Object
[]
array
=
((
Collection
)
arg
).
toArray
();
Object
result
;
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
Object
o
=
array
[
i
];
if
(
ObjectUtils
.
isNotEmpty
((
result
=
getParamValue
(
o
,
key
,
layer
))))
{
return
result
;
}
}
return
null
;
}
else
if
(
ReflectUtil
.
isMap
(
parameterType
))
{
Map
<
String
,
Object
>
argMap
=
(
Map
)
arg
;
String
[]
values
=
key
.
split
(
"\\."
);
Object
o
=
argMap
.
get
(
values
[
layer
]);
return
getParamValue
(
o
,
key
,
++
layer
);
}
else
{
// 当作自定义类处理
String
[]
values
=
key
.
split
(
"\\."
);
String
fieldName
=
values
[
layer
];
Object
fieldValue
=
ReflectUtil
.
getFieldValue
(
arg
,
values
[
layer
]);
return
getParamValue
(
fieldValue
,
key
,
++
layer
);
}
}
}
backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
auth
.
aop
;
import
io.dataease.auth.annotation.DeLog
;
import
io.dataease.commons.constants.SysLogConstants
;
import
io.dataease.commons.utils.AopUtils
;
import
io.dataease.controller.ResultHolder
;
import
io.dataease.dto.SysLogDTO
;
import
io.dataease.dto.log.FolderItem
;
import
io.dataease.service.sys.log.LogManager
;
import
io.dataease.service.sys.log.LogService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
@Aspect
@Component
public
class
DeLogAnnotationHandler
{
@Resource
private
LogManager
logManager
;
@Resource
private
LogService
logService
;
private
static
List
<
Integer
>
befores
=
new
ArrayList
<>();
@PostConstruct
public
void
init
()
{
befores
.
add
(
SysLogConstants
.
OPERATE_TYPE
.
DELETE
.
getValue
());
befores
.
add
(
SysLogConstants
.
OPERATE_TYPE
.
UNSHARE
.
getValue
());
befores
.
add
(
SysLogConstants
.
OPERATE_TYPE
.
UNAUTHORIZE
.
getValue
());
}
private
SysLogDTO
exec
(
JoinPoint
point
,
DeLog
deLog
)
throws
Exception
{
Object
[]
args
=
point
.
getArgs
();
if
(
ArrayUtils
.
isEmpty
(
args
))
return
null
;
SysLogConstants
.
OPERATE_TYPE
operatetype
=
deLog
.
operatetype
();
SysLogConstants
.
SOURCE_TYPE
sourcetype
=
deLog
.
sourcetype
();
String
sourceKey
=
StringUtils
.
isNotBlank
(
deLog
.
sourceKey
())
?
deLog
.
sourceKey
()
:
deLog
.
value
();
int
sourceIndex
=
deLog
.
sourceIndex
();
if
(
args
.
length
<=
sourceIndex
)
return
null
;
Object
arg
=
args
[
sourceIndex
];
Object
sourceIdValue
=
AopUtils
.
getParamValue
(
arg
,
sourceKey
,
0
);
if
(
ObjectUtils
.
isEmpty
(
sourceIdValue
))
return
null
;
SysLogDTO
sysLogDTO
=
new
SysLogDTO
();
sysLogDTO
.
setOperateType
(
operatetype
.
getValue
());
sysLogDTO
.
setSourceType
(
sourcetype
.
getValue
());
sysLogDTO
.
setSourceId
(
sourceIdValue
.
toString
());
FolderItem
sourceInfo
=
logManager
.
nameWithId
(
sourceIdValue
.
toString
(),
sourcetype
.
getValue
());
if
(
ObjectUtils
.
isEmpty
(
sourceInfo
))
{
return
null
;
}
sysLogDTO
.
setSourceName
(
sourceInfo
.
getName
());
// 填充资源位置信息
int
positionIndex
=
deLog
.
positionIndex
();
if
(
positionIndex
>
-
1
&&
args
.
length
>
positionIndex
){
String
positionKey
=
deLog
.
positionKey
();
Object
positionArg
=
args
[
positionIndex
];
Object
bottomPositionValue
=
AopUtils
.
getParamValue
(
positionArg
,
positionKey
,
0
);
if
(
ObjectUtils
.
isNotEmpty
(
bottomPositionValue
))
{
if
(
sourcetype
==
SysLogConstants
.
SOURCE_TYPE
.
DATASOURCE
)
{
FolderItem
folderItem
=
logManager
.
dsTypeInfo
(
bottomPositionValue
.
toString
());
List
<
FolderItem
>
items
=
new
ArrayList
<>();
items
.
add
(
folderItem
);
sysLogDTO
.
setPositions
(
items
);
}
else
{
List
<
FolderItem
>
parentsAndSelf
=
parents
(
bottomPositionValue
.
toString
(),
sourcetype
);
sysLogDTO
.
setPositions
(
parentsAndSelf
);
}
}
}
// 填充资源目标位置信息
int
targetIndex
=
deLog
.
targetIndex
();
if
(
targetIndex
>
-
1
&&
args
.
length
>
targetIndex
){
String
targetKey
=
deLog
.
targetKey
();
Object
targetArg
=
args
[
targetIndex
];
SysLogConstants
.
SOURCE_TYPE
targetType
=
deLog
.
targetType
();
Object
bottomTargetValue
=
AopUtils
.
getParamValue
(
targetArg
,
targetKey
,
0
);
if
(
ObjectUtils
.
isNotEmpty
(
bottomTargetValue
))
{
List
<
FolderItem
>
parentsAndSelf
=
parents
(
bottomTargetValue
.
toString
(),
targetType
);
sysLogDTO
.
setRemarks
(
parentsAndSelf
);
}
}
return
sysLogDTO
;
}
@Around
(
value
=
"@annotation(io.dataease.auth.annotation.DeLog)"
)
public
Object
logAround
(
ProceedingJoinPoint
point
)
throws
Throwable
{
SysLogDTO
logDTO
=
null
;
Object
result
=
null
;
DeLog
log
=
getLog
(
point
);
if
(
befores
.
contains
(
log
.
operatetype
().
getValue
()))
{
// 前置处理 比如删除操作 需要在数据删除之前查询
logDTO
=
exec
(
point
,
log
);
result
=
point
.
proceed
(
point
.
getArgs
());
}
else
{
// 后置处理 比如保存操作 需要在保存之后才有主键
result
=
point
.
proceed
(
point
.
getArgs
());
logDTO
=
exec
(
point
,
log
);
}
if
(
ObjectUtils
.
isNotEmpty
(
result
)
&&
result
instanceof
ResultHolder
&&
!((
ResultHolder
)
result
).
isSuccess
())
{
return
result
;
}
Optional
.
ofNullable
(
logDTO
).
ifPresent
(
logService:
:
saveLog
);
return
result
;
}
private
DeLog
getLog
(
JoinPoint
point
)
{
MethodSignature
ms
=
(
MethodSignature
)
point
.
getSignature
();
Method
method
=
ms
.
getMethod
();
DeLog
deLog
=
method
.
getAnnotation
(
DeLog
.
class
);
return
deLog
;
}
public
List
<
FolderItem
>
parents
(
String
value
,
SysLogConstants
.
SOURCE_TYPE
type
)
{
return
logManager
.
parentsAndSelf
(
value
,
type
);
}
}
backend/src/main/java/io/dataease/commons/constants/SysLogConstants.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
commons
.
constants
;
import
java.util.Arrays
;
import
java.util.Optional
;
public
class
SysLogConstants
{
public
static
String
operateTypeName
(
Integer
value
)
{
Optional
<
OPERATE_TYPE
>
any
=
Arrays
.
stream
(
OPERATE_TYPE
.
class
.
getEnumConstants
()).
filter
(
e
->
e
.
value
==
value
).
findAny
();
if
(
any
.
isPresent
())
return
any
.
get
().
name
;
return
null
;
}
public
enum
OPERATE_TYPE
{
CREATE
(
1
,
"OPERATE_TYPE_CREATE"
),
MODIFY
(
2
,
"OPERATE_TYPE_MODIFY"
),
DELETE
(
3
,
"OPERATE_TYPE_DELETE"
),
SHARE
(
4
,
"OPERATE_TYPE_SHARE"
),
UNSHARE
(
5
,
"OPERATE_TYPE_UNSHARE"
),
AUTHORIZE
(
6
,
"OPERATE_TYPE_AUTHORIZE"
),
UNAUTHORIZE
(
7
,
"OPERATE_TYPE_UNAUTHORIZE"
),
CREATELINK
(
8
,
"OPERATE_TYPE_CREATELINK"
),
DELETELINK
(
9
,
"OPERATE_TYPE_DELETELINK"
),
MODIFYLINK
(
10
,
"OPERATE_TYPE_MODIFYLINK"
);
private
Integer
value
;
private
String
name
;
OPERATE_TYPE
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
public
static
String
sourceTypeName
(
Integer
value
)
{
Optional
<
SOURCE_TYPE
>
any
=
Arrays
.
stream
(
SOURCE_TYPE
.
class
.
getEnumConstants
()).
filter
(
e
->
e
.
value
==
value
).
findAny
();
if
(
any
.
isPresent
())
return
any
.
get
().
name
;
return
null
;
}
public
enum
SOURCE_TYPE
{
DATASOURCE
(
1
,
"SOURCE_TYPE_DATASOURCE"
),
DATASET
(
2
,
"SOURCE_TYPE_DATASET"
),
PANEL
(
3
,
"SOURCE_TYPE_PANEL"
),
VIEW
(
4
,
"SOURCE_TYPE_VIEW"
),
/*LINK(5, "SOURCE_TYPE_LINK"),*/
USER
(
6
,
"SOURCE_TYPE_USER"
),
DEPT
(
7
,
"SOURCE_TYPE_DEPT"
),
ROLE
(
8
,
"SOURCE_TYPE_ROLE"
);
private
Integer
value
;
private
String
name
;
SOURCE_TYPE
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
}
backend/src/main/java/io/dataease/commons/utils/AopUtils.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
commons
.
utils
;
import
io.dataease.auth.util.ReflectUtil
;
import
org.apache.commons.lang3.ObjectUtils
;
import
java.lang.reflect.Array
;
import
java.util.Collection
;
import
java.util.Map
;
public
class
AopUtils
{
public
static
Object
getParamValue
(
Object
arg
,
String
key
,
int
layer
)
throws
Exception
{
if
(
ObjectUtils
.
isEmpty
(
arg
))
return
null
;
Class
<?>
parameterType
=
arg
.
getClass
();
if
(
parameterType
.
isPrimitive
()
||
ReflectUtil
.
isWrapClass
(
parameterType
)
||
ReflectUtil
.
isString
(
parameterType
))
{
return
arg
;
}
else
if
(
ReflectUtil
.
isArray
(
parameterType
))
{
Object
result
;
for
(
int
i
=
0
;
i
<
Array
.
getLength
(
arg
);
i
++)
{
Object
o
=
Array
.
get
(
arg
,
i
);
if
(
ObjectUtils
.
isNotEmpty
((
result
=
getParamValue
(
o
,
key
,
layer
))))
{
return
result
;
}
}
return
null
;
}
else
if
(
ReflectUtil
.
isCollection
(
parameterType
))
{
Object
[]
array
=
((
Collection
)
arg
).
toArray
();
Object
result
;
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
Object
o
=
array
[
i
];
if
(
ObjectUtils
.
isNotEmpty
((
result
=
getParamValue
(
o
,
key
,
layer
))))
{
return
result
;
}
}
return
null
;
}
else
if
(
ReflectUtil
.
isMap
(
parameterType
))
{
Map
<
String
,
Object
>
argMap
=
(
Map
)
arg
;
String
[]
values
=
key
.
split
(
"\\."
);
Object
o
=
argMap
.
get
(
values
[
layer
]);
return
getParamValue
(
o
,
key
,
++
layer
);
}
else
{
// 当作自定义类处理
String
[]
values
=
key
.
split
(
"\\."
);
String
fieldName
=
values
[
layer
];
Object
fieldValue
=
ReflectUtil
.
getFieldValue
(
arg
,
values
[
layer
]);
return
getParamValue
(
fieldValue
,
key
,
++
layer
);
}
}
}
backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java
浏览文件 @
7db5e731
package
io
.
dataease
.
controller
.
datasource
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
io.dataease.auth.annotation.DeLog
;
import
io.dataease.auth.annotation.DePermission
;
import
io.dataease.commons.constants.SysLogConstants
;
import
io.dataease.controller.datasource.request.DeleteDsRequest
;
import
io.dataease.plugins.common.base.domain.Datasource
;
import
io.dataease.commons.constants.DePermissionType
;
import
io.dataease.commons.constants.ResourceAuthLevel
;
...
...
@@ -39,6 +42,12 @@ public class DatasourceController {
@DePermission
(
type
=
DePermissionType
.
DATASOURCE
,
value
=
"id"
)
@ApiOperation
(
"新增数据源"
)
@PostMapping
(
"/add"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
CREATE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
DATASOURCE
,
positionIndex
=
0
,
positionKey
=
"type"
,
value
=
"id"
)
public
Datasource
addDatasource
(
@RequestBody
Datasource
datasource
)
throws
Exception
{
return
datasourceService
.
addDatasource
(
datasource
);
}
...
...
@@ -81,15 +90,27 @@ public class DatasourceController {
@RequiresPermissions
(
"datasource:read"
)
@DePermission
(
type
=
DePermissionType
.
DATASOURCE
,
level
=
ResourceAuthLevel
.
DATASOURCE_LEVEL_MANAGE
)
@ApiOperation
(
"删除数据源"
)
@PostMapping
(
"/delete/{datasourceID}"
)
public
ResultHolder
deleteDatasource
(
@PathVariable
(
value
=
"datasourceID"
)
String
datasourceID
)
throws
Exception
{
return
datasourceService
.
deleteDatasource
(
datasourceID
);
@PostMapping
(
"/delete"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
DELETE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
DATASOURCE
,
positionIndex
=
0
,
positionKey
=
"type"
,
value
=
"id"
)
public
ResultHolder
deleteDatasource
(
@RequestBody
DeleteDsRequest
request
)
throws
Exception
{
return
datasourceService
.
deleteDatasource
(
request
.
getId
());
}
@RequiresPermissions
(
"datasource:read"
)
@DePermission
(
type
=
DePermissionType
.
DATASOURCE
,
value
=
"id"
,
level
=
ResourceAuthLevel
.
DATASOURCE_LEVEL_MANAGE
)
@ApiOperation
(
"更新数据源"
)
@PostMapping
(
"/update"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
MODIFY
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
DATASOURCE
,
positionIndex
=
0
,
positionKey
=
"type"
,
value
=
"id"
)
public
void
updateDatasource
(
@RequestBody
UpdataDsRequest
dsRequest
)
throws
Exception
{
datasourceService
.
updateDatasource
(
dsRequest
);
}
...
...
backend/src/main/java/io/dataease/controller/datasource/request/DeleteDsRequest.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
controller
.
datasource
.
request
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
DeleteDsRequest
implements
Serializable
{
@ApiModelProperty
(
value
=
"ID"
,
required
=
true
)
private
String
id
;
@ApiModelProperty
(
value
=
"类型"
,
required
=
true
)
private
String
type
;
}
backend/src/main/java/io/dataease/controller/sys/SysLogController.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
controller
.
sys
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
io.dataease.commons.utils.PageUtils
;
import
io.dataease.commons.utils.Pager
;
import
io.dataease.controller.handler.annotation.I18n
;
import
io.dataease.controller.sys.base.BaseGridRequest
;
import
io.dataease.dto.SysLogGridDTO
;
import
io.dataease.dto.log.FolderItem
;
import
io.dataease.service.sys.log.LogService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
@RestController
@Api
(
tags
=
"系统:日志管理"
)
@ApiSupport
(
order
=
220
)
@RequestMapping
(
"/api/log"
)
public
class
SysLogController
{
@Resource
private
LogService
logService
;
@I18n
@ApiOperation
(
"查询日志"
)
@PostMapping
(
"/logGrid/{goPage}/{pageSize}"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"path"
,
name
=
"goPage"
,
value
=
"页码"
,
required
=
true
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
paramType
=
"path"
,
name
=
"pageSize"
,
value
=
"页容量"
,
required
=
true
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"request"
,
value
=
"查询条件"
,
required
=
true
)
})
public
Pager
<
List
<
SysLogGridDTO
>>
logGrid
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
BaseGridRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
return
PageUtils
.
setPageInfo
(
page
,
logService
.
query
(
request
));
}
@ApiOperation
(
"操作类型"
)
@PostMapping
(
"/opTypes"
)
public
List
<
FolderItem
>
types
()
{
return
logService
.
types
();
}
@ApiOperation
(
"导出操作日志"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
)
throws
Exception
{
logService
.
exportExcel
(
response
);
}
}
backend/src/main/java/io/dataease/controller/sys/SysUserController.java
浏览文件 @
7db5e731
...
...
@@ -3,7 +3,9 @@ package io.dataease.controller.sys;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
io.dataease.auth.annotation.DeLog
;
import
io.dataease.auth.api.dto.CurrentUserDto
;
import
io.dataease.commons.constants.SysLogConstants
;
import
io.dataease.exception.DataEaseException
;
import
io.dataease.i18n.Translator
;
import
io.dataease.plugins.common.base.domain.SysRole
;
...
...
@@ -69,6 +71,11 @@ public class SysUserController {
@ApiOperation
(
"创建用户"
)
@RequiresPermissions
(
"user:add"
)
@PostMapping
(
"/create"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
CREATE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
USER
,
value
=
"userId"
)
public
void
create
(
@RequestBody
SysUserCreateRequest
request
)
{
sysUserService
.
save
(
request
);
}
...
...
@@ -76,6 +83,11 @@ public class SysUserController {
@ApiOperation
(
"更新用户"
)
@RequiresPermissions
(
"user:edit"
)
@PostMapping
(
"/update"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
MODIFY
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
USER
,
value
=
"userId"
)
public
void
update
(
@RequestBody
SysUserCreateRequest
request
)
{
sysUserService
.
update
(
request
);
}
...
...
@@ -84,6 +96,10 @@ public class SysUserController {
@RequiresPermissions
(
"user:del"
)
@PostMapping
(
"/delete/{userId}"
)
@ApiImplicitParam
(
paramType
=
"path"
,
value
=
"用户ID"
,
name
=
"userId"
,
required
=
true
,
dataType
=
"Integer"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
DELETE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
USER
)
public
void
delete
(
@PathVariable
(
"userId"
)
Long
userId
)
{
sysUserService
.
delete
(
userId
);
}
...
...
@@ -92,6 +108,11 @@ public class SysUserController {
@RequiresPermissions
(
"user:edit"
)
@RequiresRoles
(
"1"
)
@PostMapping
(
"/updateStatus"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
MODIFY
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
USER
,
value
=
"userId"
)
public
void
updateStatus
(
@RequestBody
SysUserStateRequest
request
)
{
sysUserService
.
updateStatus
(
request
);
}
...
...
backend/src/main/java/io/dataease/dto/SysLogDTO.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
dto
;
import
io.dataease.dto.log.FolderItem
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
SysLogDTO
implements
Serializable
{
private
Integer
sourceType
;
private
String
sourceId
;
private
String
sourceName
;
private
Integer
operateType
;
private
List
<
FolderItem
>
positions
;
private
List
<
FolderItem
>
remarks
;
}
backend/src/main/java/io/dataease/dto/SysLogGridDTO.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
SysLogGridDTO
implements
Serializable
{
@ApiModelProperty
(
"操作类型"
)
private
String
opType
;
@ApiModelProperty
(
"资源类型"
)
private
String
sourceType
;
@ApiModelProperty
(
"详细信息"
)
private
String
detail
;
@ApiModelProperty
(
"操作人"
)
private
String
user
;
@ApiModelProperty
(
"操作时间"
)
private
Long
time
;
}
backend/src/main/java/io/dataease/dto/log/FolderItem.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
dto
.
log
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
FolderItem
implements
Serializable
{
private
String
id
;
private
String
name
;
private
Integer
type
;
}
backend/src/main/java/io/dataease/ext/ExtSysLogMapper.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
ext
;
import
io.dataease.dto.log.FolderItem
;
import
io.dataease.ext.query.GridExample
;
import
io.dataease.plugins.common.base.domain.SysLogWithBLOBs
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ExtSysLogMapper
{
List
<
SysLogWithBLOBs
>
query
(
GridExample
example
);
List
<
FolderItem
>
idAndName
(
@Param
(
"ids"
)
List
<
String
>
ids
,
@Param
(
"type"
)
Integer
type
);
}
backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml
0 → 100644
浏览文件 @
7db5e731
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"io.dataease.ext.ExtSysLogMapper"
>
<select
id=
"query"
parameterType=
"io.dataease.ext.query.GridExample"
resultMap=
"io.dataease.plugins.common.base.mapper.SysLogMapper.ResultMapWithBLOBs"
>
select * from sys_log
<if
test=
"_parameter != null"
>
<include
refid=
"io.dataease.ext.query.GridSql.gridCondition"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
<if
test=
"orderByClause == null"
>
order by time desc
</if>
</select>
<select
id=
"idAndName"
resultType=
"io.dataease.dto.log.FolderItem"
>
select
<if
test=
"type == 1"
>
id, name
from datasource
<where>
id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
<if
test=
"type == 2"
>
id, name
from dataset_group
<where>
id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
<if
test=
"type == 3"
>
id, name
from panel_group
<where>
id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
<if
test=
"type == 4"
>
id, name
from chart_view
<where>
id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
<if
test=
"type == 5"
>
id, name
from panel_group
<where>
id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
<if
test=
"type == 6"
>
user_id as id, nick_name as name
from sys_user
<where>
user_id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
<if
test=
"type == 7"
>
dept_id as id, name
from sys_dept
<where>
dept_id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
<if
test=
"type == 8"
>
role_id as id, name
from sys_role
<where>
role_id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</where>
</if>
</select>
</mapper>
backend/src/main/java/io/dataease/plugins/server/XDeptServer.java
浏览文件 @
7db5e731
package
io
.
dataease
.
plugins
.
server
;
import
io.dataease.auth.annotation.DeLog
;
import
io.dataease.auth.service.ExtAuthService
;
import
io.dataease.commons.constants.SysLogConstants
;
import
io.dataease.commons.utils.BeanUtils
;
import
io.dataease.controller.sys.response.DeptNodeResponse
;
import
io.dataease.plugins.common.entity.XpackGridRequest
;
...
...
@@ -70,6 +72,12 @@ public class XDeptServer {
@RequiresPermissions
(
"dept:add"
)
@ApiOperation
(
"创建"
)
@PostMapping
(
"/create"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
CREATE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
DEPT
,
positionIndex
=
0
,
positionKey
=
"pid"
,
value
=
"deptId"
)
public
int
create
(
@RequestBody
XpackCreateDept
dept
){
DeptXpackService
deptService
=
SpringContextUtil
.
getBean
(
DeptXpackService
.
class
);
return
deptService
.
add
(
dept
);
...
...
@@ -78,6 +86,12 @@ public class XDeptServer {
@RequiresPermissions
(
"dept:del"
)
@ApiOperation
(
"删除"
)
@PostMapping
(
"/delete"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
DELETE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
DEPT
,
positionIndex
=
0
,
positionKey
=
"pid"
,
value
=
"deptId"
)
public
void
delete
(
@RequestBody
List
<
XpackDeleteDept
>
requests
){
DeptXpackService
deptService
=
SpringContextUtil
.
getBean
(
DeptXpackService
.
class
);
requests
.
forEach
(
request
->
{
...
...
@@ -89,6 +103,12 @@ public class XDeptServer {
@RequiresPermissions
(
"dept:edit"
)
@ApiOperation
(
"更新"
)
@PostMapping
(
"/update"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
MODIFY
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
DEPT
,
positionIndex
=
0
,
positionKey
=
"pid"
,
value
=
"deptId"
)
public
int
update
(
@RequestBody
XpackCreateDept
dept
){
DeptXpackService
deptService
=
SpringContextUtil
.
getBean
(
DeptXpackService
.
class
);
return
deptService
.
update
(
dept
);
...
...
backend/src/main/java/io/dataease/plugins/server/XRoleServer.java
浏览文件 @
7db5e731
...
...
@@ -3,7 +3,9 @@ package io.dataease.plugins.server;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
io.dataease.auth.annotation.DeLog
;
import
io.dataease.auth.service.ExtAuthService
;
import
io.dataease.commons.constants.SysLogConstants
;
import
io.dataease.commons.utils.PageUtils
;
import
io.dataease.commons.utils.Pager
;
import
io.dataease.plugins.common.entity.XpackGridRequest
;
...
...
@@ -30,6 +32,11 @@ public class XRoleServer {
@RequiresPermissions
(
"role:add"
)
@ApiOperation
(
"新增角色"
)
@PostMapping
(
"/create"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
CREATE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
ROLE
,
value
=
"roleId"
)
public
void
create
(
@RequestBody
XpackRoleDto
role
){
RoleXpackService
roleXpackService
=
SpringContextUtil
.
getBean
(
RoleXpackService
.
class
);
roleXpackService
.
save
(
role
);
...
...
@@ -39,6 +46,10 @@ public class XRoleServer {
@RequiresPermissions
(
"role:del"
)
@ApiOperation
(
"删除角色"
)
@PostMapping
(
"/delete/{roleId}"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
DELETE
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
ROLE
)
public
void
delete
(
@PathVariable
(
"roleId"
)
Long
roleId
){
RoleXpackService
roleXpackService
=
SpringContextUtil
.
getBean
(
RoleXpackService
.
class
);
extAuthService
.
clearDeptResource
(
roleId
);
...
...
@@ -49,6 +60,11 @@ public class XRoleServer {
@RequiresPermissions
(
"role:edit"
)
@ApiOperation
(
"更新角色"
)
@PostMapping
(
"/update"
)
@DeLog
(
operatetype
=
SysLogConstants
.
OPERATE_TYPE
.
MODIFY
,
sourcetype
=
SysLogConstants
.
SOURCE_TYPE
.
ROLE
,
value
=
"roleId"
)
public
void
update
(
@RequestBody
XpackRoleDto
role
){
RoleXpackService
roleXpackService
=
SpringContextUtil
.
getBean
(
RoleXpackService
.
class
);
roleXpackService
.
update
(
role
);
...
...
backend/src/main/java/io/dataease/service/sys/SysUserService.java
浏览文件 @
7db5e731
...
...
@@ -94,6 +94,7 @@ public class SysUserService {
}
int
insert
=
sysUserMapper
.
insert
(
user
);
SysUser
dbUser
=
findOne
(
user
);
request
.
setUserId
(
dbUser
.
getUserId
());
saveUserRoles
(
dbUser
.
getUserId
(),
request
.
getRoleIds
());
//插入用户角色关联
return
insert
;
}
...
...
backend/src/main/java/io/dataease/service/sys/log/LogManager.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
service
.
sys
.
log
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
io.dataease.commons.constants.SysLogConstants
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.dto.log.FolderItem
;
import
io.dataease.ext.ExtSysLogMapper
;
import
io.dataease.i18n.Translator
;
import
io.dataease.plugins.common.base.domain.SysLogWithBLOBs
;
import
io.dataease.plugins.common.dto.datasource.DataSourceType
;
import
io.dataease.service.datasource.DatasourceService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
public
class
LogManager
{
protected
static
final
String
contentFormat
=
"【%s】"
;
protected
static
final
String
positionFormat
=
"在【%s】"
;
protected
static
final
String
format
=
"给%s【%s】"
;
protected
Gson
gson
=
new
Gson
();
protected
Type
type
=
new
TypeToken
<
List
<
FolderItem
>>()
{}.
getType
();
@Resource
private
ExtSysLogMapper
extSysLogMapper
;
@Resource
private
DatasourceService
datasourceService
;
public
String
detailInfo
(
SysLogWithBLOBs
vo
)
{
String
sourceName
=
vo
.
getSourceName
();
String
postion
=
null
;
String
operateTypeName
=
SysLogConstants
.
operateTypeName
(
vo
.
getOperateType
());
operateTypeName
=
Translator
.
get
(
operateTypeName
);
String
sourceTypeName
=
SysLogConstants
.
sourceTypeName
(
vo
.
getSourceType
());
sourceTypeName
=
Translator
.
get
(
sourceTypeName
);
String
result
=
operateTypeName
+
sourceTypeName
+
String
.
format
(
contentFormat
,
sourceName
)
+
remarkInfo
(
vo
);
if
((
postion
=
vo
.
getPosition
())
!=
null
)
{
List
<
FolderItem
>
folderItems
=
gson
.
fromJson
(
postion
,
type
);
String
template
=
folderItems
.
stream
().
map
(
folderItem
->
folderItem
.
getName
()).
collect
(
Collectors
.
joining
(
"/"
));
String
postionResult
=
String
.
format
(
positionFormat
,
template
);
return
postionResult
+
result
;
}
return
result
;
}
public
String
remarkInfo
(
SysLogWithBLOBs
vo
)
{
String
remakrk
=
null
;
if
((
remakrk
=
vo
.
getRemark
())
!=
null
)
{
List
<
FolderItem
>
targetInfos
=
gson
.
fromJson
(
remakrk
,
type
);
String
target
=
targetInfos
.
stream
().
map
(
item
->
{
Integer
targetType
=
item
.
getType
();
String
targetTypeName
=
SysLogConstants
.
sourceTypeName
(
targetType
);
return
String
.
format
(
format
,
targetTypeName
,
item
.
getName
());
}).
collect
(
Collectors
.
joining
(
"/"
));
return
target
;
}
return
""
;
}
public
List
<
FolderItem
>
parentsAndSelf
(
String
id
,
SysLogConstants
.
SOURCE_TYPE
type
)
{
Integer
value
=
type
.
getValue
();
String
typeValue
=
""
;
switch
(
value
)
{
case
2
:
typeValue
=
"dataset"
;
break
;
case
3
:
typeValue
=
"panel"
;
break
;
case
7
:
typeValue
=
"dept"
;
break
;
default
:
break
;
}
List
<
String
>
ids
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
typeValue
))
{
ids
.
addAll
(
AuthUtils
.
parentResources
(
id
,
typeValue
));
}
else
{
ids
.
add
(
id
);
}
List
<
FolderItem
>
folderItems
=
extSysLogMapper
.
idAndName
(
ids
,
value
);
folderItems
.
forEach
(
item
->
item
.
setType
(
value
));
return
folderItems
;
}
public
FolderItem
nameWithId
(
String
id
,
Integer
type
)
{
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
id
);
List
<
FolderItem
>
folderItems
=
extSysLogMapper
.
idAndName
(
ids
,
type
);
if
(
CollectionUtils
.
isNotEmpty
(
folderItems
))
{
return
folderItems
.
get
(
0
);
}
return
null
;
}
public
FolderItem
dsTypeInfo
(
String
typeId
)
{
ArrayList
<
DataSourceType
>
dataSourceTypes
=
new
ArrayList
<>(
datasourceService
.
types
());
String
name
=
null
;
for
(
int
i
=
0
;
i
<
dataSourceTypes
.
size
();
i
++)
{
if
(
dataSourceTypes
.
get
(
i
).
getType
().
equals
(
typeId
)){
name
=
dataSourceTypes
.
get
(
i
).
getName
();
break
;
}
}
FolderItem
folderItem
=
new
FolderItem
();
folderItem
.
setId
(
typeId
);
folderItem
.
setName
(
StringUtils
.
isNotBlank
(
name
)
?
name
:
typeId
);
return
folderItem
;
}
}
backend/src/main/java/io/dataease/service/sys/log/LogService.java
0 → 100644
浏览文件 @
7db5e731
package
io
.
dataease
.
service
.
sys
.
log
;
import
com.google.gson.Gson
;
import
io.dataease.auth.api.dto.CurrentUserDto
;
import
io.dataease.commons.constants.SysLogConstants
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.BeanUtils
;
import
io.dataease.controller.sys.base.BaseGridRequest
;
import
io.dataease.controller.sys.base.ConditionEntity
;
import
io.dataease.dto.SysLogDTO
;
import
io.dataease.dto.SysLogGridDTO
;
import
io.dataease.dto.log.FolderItem
;
import
io.dataease.ext.ExtSysLogMapper
;
import
io.dataease.ext.query.GridExample
;
import
io.dataease.i18n.Translator
;
import
io.dataease.plugins.common.base.domain.SysLogWithBLOBs
;
import
io.dataease.plugins.common.base.mapper.SysLogMapper
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
LogService
{
private
Gson
gson
=
new
Gson
();
private
static
Integer
[]
unPanelOperates
=
{
4
,
5
,
8
,
9
,
10
};
@Resource
private
SysLogMapper
sysLogMapper
;
@Resource
private
ExtSysLogMapper
extSysLogMapper
;
@Resource
private
LogManager
logManager
;
public
List
<
SysLogGridDTO
>
query
(
BaseGridRequest
request
)
{
List
<
ConditionEntity
>
conditions
=
request
.
getConditions
();
if
(
CollectionUtils
.
isNotEmpty
(
conditions
))
{
ConditionEntity
optypeCondition
=
null
;
ConditionEntity
sourceCondition
=
null
;
int
matchIndex
=
-
1
;
for
(
int
i
=
0
;
i
<
conditions
.
size
();
i
++)
{
ConditionEntity
conditionEntity
=
conditions
.
get
(
i
);
String
field
=
conditionEntity
.
getField
();
Object
value
=
conditionEntity
.
getValue
();
if
(
StringUtils
.
isNotBlank
(
field
)
&&
StringUtils
.
equals
(
"optype"
,
field
)
&&
ObjectUtils
.
isNotEmpty
(
value
))
{
matchIndex
=
i
;
optypeCondition
=
new
ConditionEntity
();
sourceCondition
=
new
ConditionEntity
();
List
<
String
>
values
=
(
List
<
String
>)
value
;
sourceCondition
.
setField
(
"source_type"
);
optypeCondition
.
setField
(
"operate_type"
);
List
<
Integer
>
opValue
=
values
.
stream
().
map
(
v
->
Integer
.
parseInt
(
v
.
split
(
"-"
)[
0
])).
collect
(
Collectors
.
toList
());
List
<
Integer
>
soValue
=
values
.
stream
().
map
(
v
->
Integer
.
parseInt
(
v
.
split
(
"-"
)[
1
])).
collect
(
Collectors
.
toList
());
optypeCondition
.
setValue
(
opValue
);
sourceCondition
.
setValue
(
soValue
);
optypeCondition
.
setOperator
(
conditionEntity
.
getOperator
());
sourceCondition
.
setOperator
(
conditionEntity
.
getOperator
());
}
}
if
(
matchIndex
>=
0
)
{
conditions
.
remove
(
matchIndex
);
if
(
ObjectUtils
.
isNotEmpty
(
optypeCondition
))
conditions
.
add
(
optypeCondition
);
if
(
ObjectUtils
.
isNotEmpty
(
sourceCondition
))
conditions
.
add
(
sourceCondition
);
}
}
GridExample
gridExample
=
request
.
convertExample
();
List
<
SysLogWithBLOBs
>
voLogs
=
extSysLogMapper
.
query
(
gridExample
);
List
<
SysLogGridDTO
>
dtos
=
voLogs
.
stream
().
map
(
this
::
convertDTO
).
collect
(
Collectors
.
toList
());
return
dtos
;
}
public
List
<
FolderItem
>
types
()
{
List
<
Integer
>
integers
=
Arrays
.
stream
(
unPanelOperates
).
collect
(
Collectors
.
toList
());
List
<
FolderItem
>
results
=
new
ArrayList
<>();
SysLogConstants
.
SOURCE_TYPE
[]
sourceTypes
=
SysLogConstants
.
SOURCE_TYPE
.
values
();
SysLogConstants
.
OPERATE_TYPE
[]
operateTypes
=
SysLogConstants
.
OPERATE_TYPE
.
values
();
for
(
int
i
=
0
;
i
<
sourceTypes
.
length
;
i
++)
{
SysLogConstants
.
SOURCE_TYPE
sourceType
=
sourceTypes
[
i
];
for
(
int
j
=
0
;
j
<
operateTypes
.
length
;
j
++)
{
SysLogConstants
.
OPERATE_TYPE
operateType
=
operateTypes
[
j
];
if
(
sourceType
.
getValue
()
>
3
&&
operateType
.
getValue
()
>
3
){
continue
;
}
if
(
sourceType
.
getValue
()
!=
3
&&
integers
.
contains
(
operateType
.
getValue
()))
{
continue
;
}
FolderItem
folderItem
=
new
FolderItem
();
folderItem
.
setId
(
operateType
.
getValue
()
+
"-"
+
sourceType
.
getValue
());
String
operateTypeName
=
operateType
.
getName
();
String
sourceTypeName
=
sourceType
.
getName
();
folderItem
.
setName
(
Translator
.
get
(
operateTypeName
)
+
Translator
.
get
(
sourceTypeName
));
results
.
add
(
folderItem
);
}
}
return
results
;
}
public
SysLogGridDTO
convertDTO
(
SysLogWithBLOBs
vo
)
{
SysLogGridDTO
sysLogGridDTO
=
new
SysLogGridDTO
();
sysLogGridDTO
.
setOpType
(
SysLogConstants
.
operateTypeName
(
vo
.
getOperateType
()));
sysLogGridDTO
.
setSourceType
(
SysLogConstants
.
sourceTypeName
(
vo
.
getSourceType
()));
sysLogGridDTO
.
setTime
(
vo
.
getTime
());
sysLogGridDTO
.
setUser
(
vo
.
getNickName
());
sysLogGridDTO
.
setDetail
(
logManager
.
detailInfo
(
vo
));
return
sysLogGridDTO
;
}
public
void
saveLog
(
SysLogDTO
sysLogDTO
)
{
// String ip = "";
CurrentUserDto
user
=
AuthUtils
.
getUser
();
SysLogWithBLOBs
sysLogWithBLOBs
=
BeanUtils
.
copyBean
(
new
SysLogWithBLOBs
(),
sysLogDTO
);
if
(
CollectionUtils
.
isNotEmpty
(
sysLogDTO
.
getPositions
()))
{
sysLogWithBLOBs
.
setPosition
(
gson
.
toJson
(
sysLogDTO
.
getPositions
()));
}
if
(
CollectionUtils
.
isNotEmpty
(
sysLogDTO
.
getRemarks
()))
{
sysLogWithBLOBs
.
setRemark
(
gson
.
toJson
(
sysLogDTO
.
getRemarks
()));
}
sysLogWithBLOBs
.
setTime
(
System
.
currentTimeMillis
());
sysLogWithBLOBs
.
setUserId
(
user
.
getUserId
());
sysLogWithBLOBs
.
setLoginName
(
user
.
getUsername
());
sysLogWithBLOBs
.
setNickName
(
user
.
getNickName
());
// sysLogWithBLOBs.setIp(ip);
sysLogMapper
.
insert
(
sysLogWithBLOBs
);
}
public
void
exportExcel
(
HttpServletResponse
response
)
throws
Exception
{
}
}
backend/src/main/resources/db/migration/V35__1.11.sql
浏览文件 @
7db5e731
...
...
@@ -3,3 +3,28 @@ ADD COLUMN `status` varchar(255) NULL DEFAULT 'publish' COMMENT '1.publish--发
UPDATE
`sys_menu`
SET
`sub_count`
=
1
WHERE
`menu_id`
=
40
;
INSERT
INTO
`sys_menu`
(
`menu_id`
,
`pid`
,
`sub_count`
,
`type`
,
`title`
,
`name`
,
`component`
,
`menu_sort`
,
`icon`
,
`path`
,
`i_frame`
,
`cache`
,
`hidden`
,
`permission`
,
`create_by`
,
`update_by`
,
`create_time`
,
`update_time`
)
VALUES
(
401
,
40
,
0
,
2
,
'查看系统模板'
,
NULL
,
NULL
,
999
,
NULL
,
NULL
,
0
,
0
,
0
,
'sys-template:read'
,
NULL
,
NULL
,
1614930862373
,
1614930862373
);
-- ----------------------------
-- Table structure for sys_log
-- ----------------------------
DROP
TABLE
IF
EXISTS
`sys_log`
;
CREATE
TABLE
`sys_log`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`user_id`
bigint
(
20
)
NOT
NULL
COMMENT
'操作人'
,
`login_name`
varchar
(
255
)
NOT
NULL
COMMENT
'登录账号'
,
`nick_name`
varchar
(
255
)
NOT
NULL
COMMENT
'姓名'
,
`ip`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'ip'
,
`source_type`
int
(
8
)
NOT
NULL
COMMENT
'资源类型'
,
`source_id`
varchar
(
255
)
NOT
NULL
COMMENT
'资源ID'
,
`source_name`
varchar
(
255
)
NOT
NULL
COMMENT
'资源名称'
,
`operate_type`
int
(
8
)
NOT
NULL
COMMENT
'操作类型'
,
`position`
longtext
COMMENT
'资源位置'
,
`remark`
longtext
COMMENT
'备注信息'
,
`time`
bigint
(
13
)
NOT
NULL
COMMENT
'操作时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
1
DEFAULT
CHARSET
=
utf8mb4
;
SET
FOREIGN_KEY_CHECKS
=
1
;
INSERT
INTO
`sys_menu`
VALUES
(
618
,
1
,
1
,
1
,
'日志管理'
,
'system-log'
,
'system/log/index'
,
15
,
'peoples'
,
'log'
,
b
'0'
,
b
'0'
,
b
'0'
,
'log:read'
,
NULL
,
NULL
,
NULL
,
1620281952752
);
INSERT
INTO
`sys_menu`
VALUES
(
619
,
618
,
0
,
2
,
'导出日志'
,
NULL
,
NULL
,
1
,
NULL
,
NULL
,
b
'0'
,
b
'0'
,
b
'0'
,
'log:export'
,
NULL
,
NULL
,
NULL
,
NULL
);
backend/src/main/resources/i18n/messages_en_US.properties
浏览文件 @
7db5e731
...
...
@@ -128,3 +128,23 @@ i18n_wrong_content=Wrong content
i18n_wrong_tel
=
Wrong tel format
i18n_wrong_email
=
Wrong email format
i18n_wrong_name_format
=
Wrong name format
OPERATE_TYPE_CREATE
=
Create
OPERATE_TYPE_MODIFY
=
Modify
OPERATE_TYPE_DELETE
=
Delete
OPERATE_TYPE_SHARE
=
Share
OPERATE_TYPE_UNSHARE
=
Unshare
OPERATE_TYPE_AUTHORIZE
=
Authorize
OPERATE_TYPE_UNAUTHORIZE
=
Unauthorize
OPERATE_TYPE_CREATELINK
=
Create Link
OPERATE_TYPE_DELETELINK
=
Delete Link
OPERATE_TYPE_MODIFYLINK
=
Modify Link
SOURCE_TYPE_DATASOURCE
=
数据源
SOURCE_TYPE_DATASET
=
数据集
SOURCE_TYPE_PANEL
=
仪表板
SOURCE_TYPE_VIEW
=
视图
SOURCE_TYPE_USER
=
用户
SOURCE_TYPE_DEPT
=
组织
SOURCE_TYPE_ROLE
=
角色
backend/src/main/resources/i18n/messages_zh_CN.properties
浏览文件 @
7db5e731
...
...
@@ -128,3 +128,26 @@ i18n_wrong_tel=电话格式错误
i18n_wrong_email
=
邮箱格式错误
i18n_wrong_name_format
=
姓名格式错误
OPERATE_TYPE_CREATE
=
创建
OPERATE_TYPE_MODIFY
=
修改
OPERATE_TYPE_DELETE
=
删除
OPERATE_TYPE_SHARE
=
分享
OPERATE_TYPE_UNSHARE
=
取消分享
OPERATE_TYPE_AUTHORIZE
=
授权
OPERATE_TYPE_UNAUTHORIZE
=
取消授权
OPERATE_TYPE_CREATELINK
=
创建公共链接
OPERATE_TYPE_DELETELINK
=
删除公共链接
OPERATE_TYPE_MODIFYLINK
=
修改公共链接
SOURCE_TYPE_DATASOURCE
=
数据源
SOURCE_TYPE_DATASET
=
数据集
SOURCE_TYPE_PANEL
=
仪表板
SOURCE_TYPE_VIEW
=
视图
SOURCE_TYPE_USER
=
用户
SOURCE_TYPE_DEPT
=
组织
SOURCE_TYPE_ROLE
=
角色
I18N_OPERATE_TYPE
=
操作类型
I18N_DETAIL
=
操作详情
I18N_USER
=
操作人
I18N_TIME
=
操作时间
backend/src/main/resources/i18n/messages_zh_TW.properties
浏览文件 @
7db5e731
...
...
@@ -128,3 +128,22 @@ i18n_wrong_content=內容不合法
i18n_wrong_tel
=
電話格式錯誤
i18n_wrong_email
=
郵箱格式錯誤
i18n_wrong_name_format
=
姓名格式錯誤
OPERATE_TYPE_CREATE
=
創建
OPERATE_TYPE_MODIFY
=
修改
OPERATE_TYPE_DELETE
=
刪除
OPERATE_TYPE_SHARE
=
分享
OPERATE_TYPE_UNSHARE
=
取消分享
OPERATE_TYPE_AUTHORIZE
=
授權
OPERATE_TYPE_UNAUTHORIZE
=
取消授權
OPERATE_TYPE_CREATELINK
=
創建公共鏈接
OPERATE_TYPE_DELETELINK
=
刪除公共鏈接
OPERATE_TYPE_MODIFYLINK
=
修改公共鏈接
SOURCE_TYPE_DATASOURCE
=
數據源
SOURCE_TYPE_DATASET
=
數據集
SOURCE_TYPE_PANEL
=
儀表板
SOURCE_TYPE_VIEW
=
視圖
SOURCE_TYPE_USER
=
用戶
SOURCE_TYPE_DEPT
=
組織
SOURCE_TYPE_ROLE
=
角色
frontend/package.json
浏览文件 @
7db5e731
...
...
@@ -27,7 +27,7 @@
"element-ui"
:
"2.15.7"
,
"file-save"
:
"^0.2.0"
,
"file-saver"
:
"^2.0.5"
,
"fit2cloud-ui"
:
"
1.5.4
"
,
"fit2cloud-ui"
:
"
^1.8.0
"
,
"flv.js"
:
"^1.6.2"
,
"html2canvasde"
:
"^v1.1.4-de"
,
"jquery"
:
"^3.1.1"
,
...
...
frontend/src/api/system/datasource.js
浏览文件 @
7db5e731
...
...
@@ -47,11 +47,12 @@ export function editDs(data) {
})
}
export
function
delDs
(
id
)
{
export
function
delDs
(
data
)
{
return
request
({
url
:
'datasource/delete
/'
+
id
,
url
:
'datasource/delete
'
,
loading
:
true
,
method
:
'post'
method
:
'post'
,
data
})
}
...
...
@@ -81,7 +82,7 @@ export function getSchema(data) {
})
}
export
function
checkApiDatasource
(
data
){
export
function
checkApiDatasource
(
data
)
{
return
request
({
url
:
'datasource/checkApiDatasource'
,
method
:
'post'
,
...
...
frontend/src/api/system/log.js
0 → 100644
浏览文件 @
7db5e731
import
request
from
'@/utils/request'
export
function
logGrid
(
page
,
size
,
data
)
{
return
request
({
url
:
'/api/log/logGrid/'
+
page
+
'/'
+
size
,
method
:
'post'
,
data
,
loading
:
true
})
}
export
function
opTypes
()
{
return
request
({
url
:
'/api/log/opTypes'
,
method
:
'post'
,
loading
:
true
})
}
export
function
exportExcel
()
{
return
request
({
url
:
'/api/log/export'
,
method
:
'post'
,
loading
:
true
})
}
frontend/src/lang/zh.js
浏览文件 @
7db5e731
...
...
@@ -2042,5 +2042,14 @@ export default {
port
:
'端口'
,
user
:
'用户名'
,
passwd
:
'密码'
},
log
:
{
title
:
'操作日志'
,
optype
:
'操作类型'
,
detail
:
'操作详情'
,
user
:
'操作用户'
,
time
:
'操作时间'
,
export
:
'导出'
,
search_by_key
:
'搜索详情'
}
}
frontend/src/styles/index.scss
浏览文件 @
7db5e731
...
...
@@ -827,3 +827,6 @@ div:focus {
// position: relative !important;
right
:
0px
;
}
.fu-operator-component__operator
{
display
:
none
!
important
;
}
\ No newline at end of file
frontend/src/views/chart/components/drag-item/ChartDragItem.vue
浏览文件 @
7db5e731
<
template
>
<span>
<span
style=
"position: relative;display: inline-block;"
>
<i
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<el-dropdown
trigger=
"click"
size=
"mini"
@
command=
"clickItem"
>
<span
class=
"el-dropdown-link"
>
<el-tag
size=
"small"
class=
"item-axis"
:type=
"tagType"
>
...
...
frontend/src/views/chart/components/drag-item/DimensionExtItem.vue
浏览文件 @
7db5e731
<
template
>
<span>
<span
style=
"position: relative;display: inline-block;"
>
<i
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<el-dropdown
trigger=
"click"
size=
"mini"
@
command=
"clickItem"
>
<span
class=
"el-dropdown-link"
>
<el-tag
size=
"small"
class=
"item-axis"
:type=
"tagType"
>
...
...
frontend/src/views/chart/components/drag-item/DimensionItem.vue
浏览文件 @
7db5e731
<
template
>
<span
style=
"position: relative;display: inline-block;"
>
<i
v-show=
"false"
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<i
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<el-dropdown
trigger=
"click"
size=
"mini"
@
command=
"clickItem"
>
<span
class=
"el-dropdown-link"
>
<el-tag
size=
"small"
class=
"item-axis"
:type=
"tagType"
>
...
...
frontend/src/views/chart/components/drag-item/DrillItem.vue
浏览文件 @
7db5e731
<
template
>
<span>
<span
style=
"position: relative;display: inline-block;"
>
<i
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<el-dropdown
trigger=
"click"
size=
"mini"
@
command=
"clickItem"
>
<span
class=
"el-dropdown-link"
>
<el-tag
size=
"small"
class=
"item-axis"
:type=
"tagType"
>
...
...
frontend/src/views/chart/components/drag-item/FilterItem.vue
浏览文件 @
7db5e731
<
template
>
<span>
<span
style=
"position: relative;display: inline-block;"
>
<i
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<el-dropdown
trigger=
"click"
size=
"mini"
@
command=
"clickItem"
>
<span
class=
"el-dropdown-link"
>
<el-tag
size=
"small"
class=
"item-axis"
:type=
"tagType"
>
...
...
frontend/src/views/chart/components/drag-item/QuotaExtItem.vue
浏览文件 @
7db5e731
<
template
>
<span>
<span
style=
"position: relative;display: inline-block;"
>
<i
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<el-dropdown
trigger=
"click"
size=
"mini"
@
command=
"clickItem"
>
<span
class=
"el-dropdown-link"
>
<el-tag
size=
"small"
class=
"item-axis"
:type=
"tagType"
>
...
...
@@ -346,7 +347,7 @@ export default {
margin-left
:
4px
;
color
:
#878d9f
;
position
:
absolute
;
right
:
25
px
;
right
:
40
px
;
}
.inner-dropdown-menu
{
...
...
frontend/src/views/chart/components/drag-item/QuotaItem.vue
浏览文件 @
7db5e731
<
template
>
<span>
<span
style=
"position: relative;display: inline-block;"
>
<i
class=
"el-icon-arrow-down el-icon-delete"
style=
"position: absolute;top: 6px;right: 24px;color: #878d9f;cursor: pointer;z-index: 1;"
@
click=
"removeItem"
/>
<el-dropdown
trigger=
"click"
size=
"mini"
@
command=
"clickItem"
>
<span
class=
"el-dropdown-link"
>
<el-tag
size=
"small"
class=
"item-axis"
:type=
"tagType"
>
...
...
@@ -342,7 +343,7 @@ export default {
margin-left
:
4px
;
color
:
#878d9f
;
position
:
absolute
;
right
:
25
px
;
right
:
40
px
;
}
.inner-dropdown-menu
{
...
...
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
7db5e731
...
...
@@ -652,7 +652,7 @@
</el-tab-pane>
<el-tab-pane
:label=
"$t('chart.chart_style')"
class=
"padding-tab"
style=
"width: 300px"
>
<chart-style
v-if=
"chartProperties"
v-if=
"chartProperties
|| view.isPlugin
"
:param=
"param"
:view=
"view"
:chart=
"chart"
...
...
@@ -1171,7 +1171,7 @@ export default {
const
_this
=
this
if
(
_this
.
chart
&&
_this
.
chart
.
render
)
{
const
viewConfig
=
TYPE_CONFIGS
.
filter
(
item
=>
item
.
render
===
_this
.
chart
.
render
&&
item
.
value
===
_this
.
chart
.
type
)
if
(
viewConfig
)
{
if
(
viewConfig
&&
viewConfig
.
length
)
{
return
viewConfig
[
0
].
properties
}
else
{
return
null
...
...
frontend/src/views/system/datasource/DsTree.vue
浏览文件 @
7db5e731
...
...
@@ -5,11 +5,16 @@
<span
class=
"title-text"
>
{{
$t
(
'commons.datasource'
)
}}
</span>
<el-button
icon=
"el-icon-plus"
type=
"text"
size=
"mini"
style=
"float: right;"
@
click=
"addFolder"
/>
<el-button
icon=
"el-icon-plus"
type=
"text"
size=
"mini"
style=
"float: right;"
@
click=
"addFolder"
/>
</el-row>
<el-divider/>
<el-divider
/>
<el-row>
<el-form>
<el-form-item
class=
"form-item"
>
...
...
@@ -39,35 +44,41 @@
<span
slot-scope=
"
{ node, data }" class="custom-tree-node-list father">
<span
style=
"display: flex;flex: 1;width: 0;"
>
<span
v-if=
"data.type !== 'folder' && data.status !== 'Error' && data.status !== 'Warning'"
>
<svg-icon
icon-class=
"datasource"
class=
"ds-icon-scene"
/>
<svg-icon
icon-class=
"datasource"
class=
"ds-icon-scene"
/>
</span>
<span
v-if=
"data.status === 'Error'"
>
<svg-icon
icon-class=
"exclamationmark"
class=
"ds-icon-scene"
/>
<svg-icon
icon-class=
"exclamationmark"
class=
"ds-icon-scene"
/>
</span>
<span
v-if=
"data.status === 'Warning'"
>
<svg-icon
icon-class=
"exclamationmark2"
class=
"ds-icon-scene"
/>
<svg-icon
icon-class=
"exclamationmark2"
class=
"ds-icon-scene"
/>
</span>
<span
v-if=
"data.type === 'folder'"
>
<i
class=
"el-icon-folder"
/>
<i
class=
"el-icon-folder"
/>
</span>
<span
v-if=
" data.status === 'Error'"
style=
"margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
>
<span
v-if=
" data.status === 'Error'"
style=
"margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
>
<el-tooltip
effect=
"dark"
:content=
"$t('datasource.in_valid')"
placement=
"right"
>
<span>
{{
data
.
name
}}
</span>
</el-tooltip>
</span>
<span
v-if=
" data.status === 'Warning'"
style=
"margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
>
<span
v-if=
" data.status === 'Warning'"
style=
"margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
>
<el-tooltip
effect=
"dark"
:content=
"$t('datasource.warning')"
placement=
"right"
>
<span>
{{
data
.
name
}}
</span>
</el-tooltip>
</span>
<span
v-if=
"data.status !== 'Error' && data.status !== 'Warning'"
style=
"margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
>
<span
v-if=
"data.status !== 'Error' && data.status !== 'Warning'"
style=
"margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
>
{{
data
.
name
}}
</span>
...
...
@@ -103,7 +114,7 @@
</el-col>
</
template
>
<
script
>
import
{
listDatasource
,
listDatasourceByType
,
delDs
,
listDatasourceType
}
from
'@/api/system/datasource'
import
{
listDatasource
,
listDatasourceByType
,
delDs
,
listDatasourceType
}
from
'@/api/system/datasource'
export
default
{
name
:
'DsTree'
,
...
...
@@ -162,14 +173,14 @@ export default {
listDatasourceByType
(
datasource
.
type
).
then
(
res
=>
{
typeData
=
this
.
buildTree
(
res
.
data
)
if
(
typeData
.
length
===
0
)
{
le
t
index
=
this
.
tData
.
findIndex
(
item
=>
{
cons
t
index
=
this
.
tData
.
findIndex
(
item
=>
{
if
(
item
.
id
===
datasource
.
type
)
{
return
true
;
return
true
}
})
this
.
tData
.
splice
(
index
,
1
)
}
else
{
let
find
=
false
;
let
find
=
false
for
(
let
index
=
0
;
index
<
this
.
tData
.
length
;
index
++
)
{
if
(
typeData
[
0
].
id
===
this
.
tData
[
index
].
id
)
{
this
.
tData
[
index
].
children
=
typeData
[
0
].
children
...
...
@@ -212,7 +223,7 @@ export default {
this
.
switchMain
(
'DsForm'
,
{},
this
.
tData
,
this
.
dsTypes
)
},
addFolderWithType
(
data
)
{
this
.
switchMain
(
'DsForm'
,
{
type
:
data
.
id
},
this
.
tData
,
this
.
dsTypes
)
this
.
switchMain
(
'DsForm'
,
{
type
:
data
.
id
},
this
.
tData
,
this
.
dsTypes
)
},
nodeClick
(
node
,
data
)
{
if
(
node
.
type
===
'folder'
)
return
...
...
@@ -220,7 +231,7 @@ export default {
},
clickFileMore
(
param
)
{
const
{
optType
,
data
}
=
param
const
{
optType
,
data
}
=
param
switch
(
optType
)
{
case
'edit'
:
this
.
edit
(
data
)
...
...
@@ -233,13 +244,13 @@ export default {
}
},
beforeClickFile
(
optType
,
data
,
node
)
{
return
{
optType
,
data
,
node
}
return
{
optType
,
data
,
node
}
},
edit
(
row
)
{
this
.
switchMain
(
'DsForm'
,
row
,
this
.
tData
,
this
.
dsTypes
)
},
showInfo
(
row
)
{
const
param
=
{
...
row
.
data
,
...{
showModel
:
'show'
}}
const
param
=
{
...
row
.
data
,
...{
showModel
:
'show'
}}
this
.
switchMain
(
'DsForm'
,
param
,
this
.
tData
,
this
.
dsTypes
)
},
_handleDelete
(
datasource
)
{
...
...
@@ -248,12 +259,13 @@ export default {
cancelButtonText
:
this
.
$t
(
'commons.cancel'
),
type
:
'warning'
}).
then
(()
=>
{
delDs
(
datasource
.
id
).
then
(
res
=>
{
if
(
res
.
success
){
const
parma
=
{
type
:
datasource
.
type
,
id
:
datasource
.
id
}
delDs
(
parma
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
$success
(
this
.
$t
(
'commons.delete_success'
))
this
.
switchMain
(
'DataHome'
,
{},
this
.
tData
,
this
.
dsTypes
)
this
.
refreshType
(
datasource
)
}
else
{
}
else
{
this
.
$message
({
type
:
'error'
,
message
:
res
.
message
...
...
frontend/src/views/system/log/index.vue
0 → 100644
浏览文件 @
7db5e731
<
template
>
<layout-content
:header=
"$t('log.title')"
>
<complex-table
v-loading=
"$store.getters.loadingMap[$store.getters.currentPath]"
:data=
"data"
:columns=
"columns"
local-key=
"logGrid"
:search-config=
"searchConfig"
:pagination-config=
"paginationConfig"
@
select=
"select"
@
search=
"search"
@
sort-change=
"sortChange"
>
<template
#
toolbar
>
<el-button
v-permission=
"['log:export']"
icon=
"el-icon-download"
size=
"mini"
@
click=
"exportData"
>
{{
$t
(
'log.export'
)
}}
</el-button>
</
template
>
<el-table-column
prop=
"opType"
:label=
"$t('log.optype')"
width=
"120"
>
<
template
v-slot:default=
"{row}"
>
<span>
{{
row
.
opType
+
row
.
sourceType
}}
</span>
</
template
>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
prop=
"detail"
:label=
"$t('log.detail')"
/>
<el-table-column
prop=
"user"
:label=
"$t('log.user')"
width=
"80"
/>
<el-table-column
:show-overflow-tooltip=
"true"
prop=
"time"
sortable=
"custom"
:label=
"$t('log.time')"
width=
"180"
>
<
template
v-slot:default=
"scope"
>
<span>
{{
scope
.
row
.
time
|
timestampFormatDate
}}
</span>
</
template
>
</el-table-column>
</complex-table>
</layout-content>
</template>
<
script
>
import
LayoutContent
from
'@/components/business/LayoutContent'
import
ComplexTable
from
'@/components/business/complex-table'
import
{
formatCondition
,
formatQuickCondition
,
addOrder
,
formatOrders
}
from
'@/utils/index'
import
{
logGrid
,
opTypes
,
exportExcel
}
from
'@/api/system/log'
export
default
{
components
:
{
ComplexTable
,
LayoutContent
},
data
()
{
return
{
columns
:
[],
searchConfig
:
{
useQuickSearch
:
false
,
useComplexSearch
:
true
,
quickPlaceholder
:
this
.
$t
(
'log.search_by_key'
),
components
:
[
{
field
:
'optype'
,
label
:
this
.
$t
(
'log.optype'
),
component
:
'FuComplexMixSelect'
,
options
:
[],
multiple
:
true
,
class
:
'de-log-filter'
,
defaultOperator
:
'in'
},
{
field
:
'nick_name'
,
label
:
this
.
$t
(
'log.user'
),
component
:
'DeComplexInput'
,
class
:
'de-log-filter'
},
{
field
:
'time'
,
label
:
this
.
$t
(
'log.time'
),
component
:
'FuComplexDateTime'
,
defaultOperator
:
'between'
,
class
:
'de-log-filter'
}
]
},
paginationConfig
:
{
currentPage
:
1
,
pageSize
:
10
,
total
:
0
},
data
:
[],
types
:
[],
orderConditions
:
[],
last_condition
:
null
}
},
created
()
{
this
.
types
=
[]
opTypes
().
then
(
res
=>
{
const
datas
=
res
.
data
datas
.
forEach
(
item
=>
{
this
.
types
.
push
({
'label'
:
item
.
name
,
'value'
:
item
.
id
})
})
this
.
searchConfig
.
components
[
0
].
options
=
this
.
types
})
},
mounted
()
{
this
.
search
()
},
methods
:
{
exportData
()
{
console
.
log
(
'exportting...'
)
exportExcel
().
then
(
res
=>
{
})
},
sortChange
({
column
,
prop
,
order
})
{
this
.
orderConditions
=
[]
if
(
!
order
)
{
this
.
search
(
this
.
last_condition
)
return
}
this
.
orderConditions
=
[]
addOrder
({
field
:
prop
,
value
:
order
},
this
.
orderConditions
)
this
.
search
(
this
.
last_condition
)
},
select
(
selection
)
{
},
search
(
condition
)
{
this
.
last_condition
=
condition
condition
=
formatQuickCondition
(
condition
,
'key'
)
const
temp
=
formatCondition
(
condition
)
const
param
=
temp
||
{}
param
[
'orders'
]
=
formatOrders
(
this
.
orderConditions
)
const
{
currentPage
,
pageSize
}
=
this
.
paginationConfig
logGrid
(
currentPage
,
pageSize
,
param
).
then
(
response
=>
{
this
.
data
=
response
.
data
.
listObject
this
.
paginationConfig
.
total
=
response
.
data
.
itemCount
})
}
}
}
</
script
>
<
style
scoped
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论