Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
b279dd96
提交
b279dd96
authored
5月 23, 2022
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev' into dev
上级
6930dda9
cd07cee1
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
167 行增加
和
29 行删除
+167
-29
JdbcProvider.java
...in/java/io/dataease/provider/datasource/JdbcProvider.java
+42
-27
util.js
frontend/src/views/chart/chart/util.js
+41
-0
ColorSelector.vue
...d/src/views/chart/components/shape-attr/ColorSelector.vue
+83
-2
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+1
-0
没有找到文件。
backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java
浏览文件 @
b279dd96
...
@@ -3,6 +3,7 @@ package io.dataease.provider.datasource;
...
@@ -3,6 +3,7 @@ package io.dataease.provider.datasource;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.pool.DruidPooledConnection
;
import
com.alibaba.druid.pool.DruidPooledConnection
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
io.dataease.commons.utils.LogUtil
;
import
io.dataease.dto.datasource.*
;
import
io.dataease.dto.datasource.*
;
import
io.dataease.exception.DataEaseException
;
import
io.dataease.exception.DataEaseException
;
import
io.dataease.i18n.Translator
;
import
io.dataease.i18n.Translator
;
...
@@ -31,12 +32,14 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -31,12 +32,14 @@ public class JdbcProvider extends DefaultJdbcProvider {
@Resource
@Resource
private
DeDriverMapper
deDriverMapper
;
private
DeDriverMapper
deDriverMapper
;
@Override
@Override
public
boolean
isUseDatasourcePool
(){
public
boolean
isUseDatasourcePool
()
{
return
true
;
return
true
;
}
}
@Override
@Override
public
String
getType
(){
public
String
getType
()
{
return
"built-in"
;
return
"built-in"
;
}
}
/**
/**
...
@@ -69,14 +72,14 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -69,14 +72,14 @@ public class JdbcProvider extends DefaultJdbcProvider {
@Override
@Override
public
List
<
TableField
>
getTableFileds
(
DatasourceRequest
datasourceRequest
)
throws
Exception
{
public
List
<
TableField
>
getTableFileds
(
DatasourceRequest
datasourceRequest
)
throws
Exception
{
if
(
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"mongo"
))
{
if
(
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"mongo"
))
{
datasourceRequest
.
setQuery
(
"select * from "
+
datasourceRequest
.
getTable
());
datasourceRequest
.
setQuery
(
"select * from "
+
datasourceRequest
.
getTable
());
return
fetchResultField
(
datasourceRequest
);
return
fetchResultField
(
datasourceRequest
);
}
}
List
<
TableField
>
list
=
new
LinkedList
<>();
List
<
TableField
>
list
=
new
LinkedList
<>();
try
(
Connection
connection
=
getConnectionFromPool
(
datasourceRequest
))
{
try
(
Connection
connection
=
getConnectionFromPool
(
datasourceRequest
))
{
if
(
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"oracle"
))
{
if
(
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"oracle"
))
{
Method
setRemarksReporting
=
extendedJdbcClassLoader
.
loadClass
(
"oracle.jdbc.driver.OracleConnection"
).
getMethod
(
"setRemarksReporting"
,
boolean
.
class
);
Method
setRemarksReporting
=
extendedJdbcClassLoader
.
loadClass
(
"oracle.jdbc.driver.OracleConnection"
).
getMethod
(
"setRemarksReporting"
,
boolean
.
class
);
setRemarksReporting
.
invoke
(((
DruidPooledConnection
)
connection
).
getConnection
(),
true
);
setRemarksReporting
.
invoke
(((
DruidPooledConnection
)
connection
).
getConnection
(),
true
);
}
}
DatabaseMetaData
databaseMetaData
=
connection
.
getMetaData
();
DatabaseMetaData
databaseMetaData
=
connection
.
getMetaData
();
...
@@ -105,10 +108,10 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -105,10 +108,10 @@ public class JdbcProvider extends DefaultJdbcProvider {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
DataEaseException
.
throwException
(
e
);
DataEaseException
.
throwException
(
e
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"ds_doris"
))
{
if
(
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"ds_doris"
))
{
datasourceRequest
.
setQuery
(
"select * from "
+
datasourceRequest
.
getTable
());
datasourceRequest
.
setQuery
(
"select * from "
+
datasourceRequest
.
getTable
());
return
fetchResultField
(
datasourceRequest
);
return
fetchResultField
(
datasourceRequest
);
}
else
{
}
else
{
DataEaseException
.
throwException
(
Translator
.
get
(
"i18n_datasource_connect_error"
)
+
e
.
getMessage
());
DataEaseException
.
throwException
(
Translator
.
get
(
"i18n_datasource_connect_error"
)
+
e
.
getMessage
());
}
}
...
@@ -210,9 +213,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -210,9 +213,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
private
List
<
String
[]>
getDataResult
(
ResultSet
rs
,
DatasourceRequest
datasourceRequest
)
throws
Exception
{
private
List
<
String
[]>
getDataResult
(
ResultSet
rs
,
DatasourceRequest
datasourceRequest
)
throws
Exception
{
String
charset
=
null
;
String
charset
=
null
;
if
(
datasourceRequest
!=
null
&&
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"oracle"
))
{
if
(
datasourceRequest
!=
null
&&
datasourceRequest
.
getDatasource
().
getType
().
equalsIgnoreCase
(
"oracle"
))
{
JdbcConfiguration
JdbcConfiguration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
JdbcConfiguration
.
class
);
JdbcConfiguration
JdbcConfiguration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
JdbcConfiguration
.
class
);
if
(
StringUtils
.
isNotEmpty
(
JdbcConfiguration
.
getCharset
())
&&
!
JdbcConfiguration
.
getCharset
().
equalsIgnoreCase
(
"Default"
)
)
{
if
(
StringUtils
.
isNotEmpty
(
JdbcConfiguration
.
getCharset
())
&&
!
JdbcConfiguration
.
getCharset
().
equalsIgnoreCase
(
"Default"
))
{
charset
=
JdbcConfiguration
.
getCharset
();
charset
=
JdbcConfiguration
.
getCharset
();
}
}
}
}
...
@@ -233,9 +236,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -233,9 +236,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
row
[
j
]
=
rs
.
getBoolean
(
j
+
1
)
?
"1"
:
"0"
;
row
[
j
]
=
rs
.
getBoolean
(
j
+
1
)
?
"1"
:
"0"
;
break
;
break
;
default
:
default
:
if
(
charset
!=
null
&&
StringUtils
.
isNotEmpty
(
rs
.
getString
(
j
+
1
)))
{
if
(
charset
!=
null
&&
StringUtils
.
isNotEmpty
(
rs
.
getString
(
j
+
1
)))
{
row
[
j
]
=
new
String
(
rs
.
getString
(
j
+
1
).
getBytes
(
charset
),
"UTF-8"
);
row
[
j
]
=
new
String
(
rs
.
getString
(
j
+
1
).
getBytes
(
charset
),
"UTF-8"
);
}
else
{
}
else
{
row
[
j
]
=
rs
.
getString
(
j
+
1
);
row
[
j
]
=
rs
.
getString
(
j
+
1
);
}
}
break
;
break
;
...
@@ -278,6 +281,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -278,6 +281,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
}
}
return
fieldList
;
return
fieldList
;
}
}
@Override
@Override
public
List
<
String
[]>
getData
(
DatasourceRequest
dsr
)
throws
Exception
{
public
List
<
String
[]>
getData
(
DatasourceRequest
dsr
)
throws
Exception
{
List
<
String
[]>
list
=
new
LinkedList
<>();
List
<
String
[]>
list
=
new
LinkedList
<>();
...
@@ -296,6 +300,17 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -296,6 +300,17 @@ public class JdbcProvider extends DefaultJdbcProvider {
return
list
;
return
list
;
}
}
@Override
public
String
checkStatus
(
DatasourceRequest
datasourceRequest
)
throws
Exception
{
String
queryStr
=
getTablesSql
(
datasourceRequest
);
try
(
Connection
con
=
getConnection
(
datasourceRequest
);
Statement
statement
=
con
.
createStatement
();
ResultSet
resultSet
=
statement
.
executeQuery
(
queryStr
))
{
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
"Datasource is invalid: "
+
datasourceRequest
.
getDatasource
().
getName
()
,
e
);
io
.
dataease
.
plugins
.
common
.
exception
.
DataEaseException
.
throwException
(
e
.
getMessage
());
}
return
"Success"
;
}
@Override
@Override
public
Connection
getConnection
(
DatasourceRequest
datasourceRequest
)
throws
Exception
{
public
Connection
getConnection
(
DatasourceRequest
datasourceRequest
)
throws
Exception
{
String
username
=
null
;
String
username
=
null
;
...
@@ -376,26 +391,26 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -376,26 +391,26 @@ public class JdbcProvider extends DefaultJdbcProvider {
customDriver
=
hiveConfiguration
.
getCustomDriver
();
customDriver
=
hiveConfiguration
.
getCustomDriver
();
jdbcurl
=
hiveConfiguration
.
getJdbc
();
jdbcurl
=
hiveConfiguration
.
getJdbc
();
if
(
StringUtils
.
isNotEmpty
(
hiveConfiguration
.
getAuthMethod
())
&&
hiveConfiguration
.
getAuthMethod
().
equalsIgnoreCase
(
"kerberos"
))
{
if
(
StringUtils
.
isNotEmpty
(
hiveConfiguration
.
getAuthMethod
())
&&
hiveConfiguration
.
getAuthMethod
().
equalsIgnoreCase
(
"kerberos"
))
{
System
.
setProperty
(
"java.security.krb5.conf"
,
"/opt/dataease/conf/krb5.conf"
);
System
.
setProperty
(
"java.security.krb5.conf"
,
"/opt/dataease/conf/krb5.conf"
);
ExtendedJdbcClassLoader
classLoader
;
ExtendedJdbcClassLoader
classLoader
;
if
(
isDefaultClassLoader
(
customDriver
))
{
if
(
isDefaultClassLoader
(
customDriver
))
{
classLoader
=
extendedJdbcClassLoader
;
classLoader
=
extendedJdbcClassLoader
;
}
else
{
}
else
{
deDriver
=
deDriverMapper
.
selectByPrimaryKey
(
customDriver
);
deDriver
=
deDriverMapper
.
selectByPrimaryKey
(
customDriver
);
classLoader
=
getCustomJdbcClassLoader
(
deDriver
);
classLoader
=
getCustomJdbcClassLoader
(
deDriver
);
}
}
Class
<?>
ConfigurationClass
=
classLoader
.
loadClass
(
"org.apache.hadoop.conf.Configuration"
);
Class
<?>
ConfigurationClass
=
classLoader
.
loadClass
(
"org.apache.hadoop.conf.Configuration"
);
Method
set
=
ConfigurationClass
.
getMethod
(
"set"
,
String
.
class
,
String
.
class
)
;
Method
set
=
ConfigurationClass
.
getMethod
(
"set"
,
String
.
class
,
String
.
class
)
;
Object
obj
=
ConfigurationClass
.
newInstance
();
Object
obj
=
ConfigurationClass
.
newInstance
();
set
.
invoke
(
obj
,
"hadoop.security.authentication"
,
"Kerberos"
);
set
.
invoke
(
obj
,
"hadoop.security.authentication"
,
"Kerberos"
);
Class
<?>
UserGroupInformationClass
=
classLoader
.
loadClass
(
"org.apache.hadoop.security.UserGroupInformation"
);
Class
<?>
UserGroupInformationClass
=
classLoader
.
loadClass
(
"org.apache.hadoop.security.UserGroupInformation"
);
Method
setConfiguration
=
UserGroupInformationClass
.
getMethod
(
"setConfiguration"
,
ConfigurationClass
)
;
Method
setConfiguration
=
UserGroupInformationClass
.
getMethod
(
"setConfiguration"
,
ConfigurationClass
)
;
Method
loginUserFromKeytab
=
UserGroupInformationClass
.
getMethod
(
"loginUserFromKeytab"
,
String
.
class
,
String
.
class
)
;
Method
loginUserFromKeytab
=
UserGroupInformationClass
.
getMethod
(
"loginUserFromKeytab"
,
String
.
class
,
String
.
class
)
;
setConfiguration
.
invoke
(
null
,
obj
);
setConfiguration
.
invoke
(
null
,
obj
);
loginUserFromKeytab
.
invoke
(
null
,
hiveConfiguration
.
getUsername
(),
"/opt/dataease/conf/"
+
hiveConfiguration
.
getPassword
());
loginUserFromKeytab
.
invoke
(
null
,
hiveConfiguration
.
getUsername
(),
"/opt/dataease/conf/"
+
hiveConfiguration
.
getPassword
());
}
else
{
}
else
{
username
=
hiveConfiguration
.
getUsername
();
username
=
hiveConfiguration
.
getUsername
();
password
=
hiveConfiguration
.
getPassword
();
password
=
hiveConfiguration
.
getPassword
();
}
}
...
@@ -428,12 +443,12 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -428,12 +443,12 @@ public class JdbcProvider extends DefaultJdbcProvider {
}
}
Connection
conn
;
Connection
conn
;
String
driverClassName
;
String
driverClassName
;
ExtendedJdbcClassLoader
jdbcClassLoader
;
ExtendedJdbcClassLoader
jdbcClassLoader
;
if
(
isDefaultClassLoader
(
customDriver
))
{
if
(
isDefaultClassLoader
(
customDriver
))
{
driverClassName
=
defaultDriver
;
driverClassName
=
defaultDriver
;
jdbcClassLoader
=
extendedJdbcClassLoader
;
jdbcClassLoader
=
extendedJdbcClassLoader
;
}
else
{
}
else
{
driverClassName
=
deDriver
.
getDriverClass
();
driverClassName
=
deDriver
.
getDriverClass
();
jdbcClassLoader
=
getCustomJdbcClassLoader
(
deDriver
);
jdbcClassLoader
=
getCustomJdbcClassLoader
(
deDriver
);
}
}
...
@@ -442,11 +457,11 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -442,11 +457,11 @@ public class JdbcProvider extends DefaultJdbcProvider {
ClassLoader
classLoader
=
Thread
.
currentThread
().
getContextClassLoader
();
ClassLoader
classLoader
=
Thread
.
currentThread
().
getContextClassLoader
();
try
{
try
{
Thread
.
currentThread
().
setContextClassLoader
(
jdbcClassLoader
);
Thread
.
currentThread
().
setContextClassLoader
(
jdbcClassLoader
);
conn
=
driverClass
.
connect
(
jdbcurl
,
props
);
conn
=
driverClass
.
connect
(
jdbcurl
,
props
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
e
;
throw
e
;
}
finally
{
}
finally
{
Thread
.
currentThread
().
setContextClassLoader
(
classLoader
);
Thread
.
currentThread
().
setContextClassLoader
(
classLoader
);
}
}
return
conn
;
return
conn
;
...
@@ -454,7 +469,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -454,7 +469,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
@Override
@Override
public
JdbcConfiguration
setCredential
(
DatasourceRequest
datasourceRequest
,
DruidDataSource
dataSource
)
throws
Exception
{
public
JdbcConfiguration
setCredential
(
DatasourceRequest
datasourceRequest
,
DruidDataSource
dataSource
)
throws
Exception
{
DatasourceTypes
datasourceType
=
DatasourceTypes
.
valueOf
(
datasourceRequest
.
getDatasource
().
getType
());
DatasourceTypes
datasourceType
=
DatasourceTypes
.
valueOf
(
datasourceRequest
.
getDatasource
().
getType
());
JdbcConfiguration
jdbcConfiguration
=
new
JdbcConfiguration
();
JdbcConfiguration
jdbcConfiguration
=
new
JdbcConfiguration
();
switch
(
datasourceType
)
{
switch
(
datasourceType
)
{
...
@@ -537,9 +552,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -537,9 +552,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
dataSource
.
setUsername
(
jdbcConfiguration
.
getUsername
());
dataSource
.
setUsername
(
jdbcConfiguration
.
getUsername
());
ExtendedJdbcClassLoader
classLoader
;
ExtendedJdbcClassLoader
classLoader
;
if
(
isDefaultClassLoader
(
jdbcConfiguration
.
getCustomDriver
()))
{
if
(
isDefaultClassLoader
(
jdbcConfiguration
.
getCustomDriver
()))
{
classLoader
=
extendedJdbcClassLoader
;
classLoader
=
extendedJdbcClassLoader
;
}
else
{
}
else
{
DeDriver
deDriver
=
deDriverMapper
.
selectByPrimaryKey
(
jdbcConfiguration
.
getCustomDriver
());
DeDriver
deDriver
=
deDriverMapper
.
selectByPrimaryKey
(
jdbcConfiguration
.
getCustomDriver
());
classLoader
=
getCustomJdbcClassLoader
(
deDriver
);
classLoader
=
getCustomJdbcClassLoader
(
deDriver
);
}
}
...
@@ -667,7 +682,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
...
@@ -667,7 +682,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
case
sqlServer:
case
sqlServer:
return
"select name from sys.schemas;"
;
return
"select name from sys.schemas;"
;
case
db2:
case
db2:
return
"select SCHEMANAME from syscat.SCHEMATA WHERE \"DEFINER\" ='USER'"
.
replace
(
"USER"
,
db2Configuration
.
getUsername
().
toUpperCase
())
;
return
"select SCHEMANAME from syscat.SCHEMATA WHERE \"DEFINER\" ='USER'"
.
replace
(
"USER"
,
db2Configuration
.
getUsername
().
toUpperCase
());
case
pg:
case
pg:
return
"SELECT nspname FROM pg_namespace;"
;
return
"SELECT nspname FROM pg_namespace;"
;
case
redshift:
case
redshift:
...
...
frontend/src/views/chart/chart/util.js
浏览文件 @
b279dd96
...
@@ -228,6 +228,7 @@ export const TYPE_CONFIGS = [
...
@@ -228,6 +228,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -265,6 +266,7 @@ export const TYPE_CONFIGS = [
...
@@ -265,6 +266,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -307,6 +309,8 @@ export const TYPE_CONFIGS = [
...
@@ -307,6 +309,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -378,6 +382,8 @@ export const TYPE_CONFIGS = [
...
@@ -378,6 +382,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -450,6 +456,8 @@ export const TYPE_CONFIGS = [
...
@@ -450,6 +456,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -520,6 +528,8 @@ export const TYPE_CONFIGS = [
...
@@ -520,6 +528,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -588,6 +598,7 @@ export const TYPE_CONFIGS = [
...
@@ -588,6 +598,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'label-selector-ant-v'
:
[
'label-selector-ant-v'
:
[
...
@@ -647,6 +658,8 @@ export const TYPE_CONFIGS = [
...
@@ -647,6 +658,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -718,6 +731,8 @@ export const TYPE_CONFIGS = [
...
@@ -718,6 +731,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -788,6 +803,8 @@ export const TYPE_CONFIGS = [
...
@@ -788,6 +803,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -838,6 +855,8 @@ export const TYPE_CONFIGS = [
...
@@ -838,6 +855,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -888,6 +907,8 @@ export const TYPE_CONFIGS = [
...
@@ -888,6 +907,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -937,6 +958,7 @@ export const TYPE_CONFIGS = [
...
@@ -937,6 +958,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'label-selector-ant-v'
:
[
'label-selector-ant-v'
:
[
...
@@ -1015,6 +1037,8 @@ export const TYPE_CONFIGS = [
...
@@ -1015,6 +1037,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'size-selector-ant-v'
:
[
'size-selector-ant-v'
:
[
...
@@ -1081,6 +1105,8 @@ export const TYPE_CONFIGS = [
...
@@ -1081,6 +1105,8 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'colorPanel'
,
'customColor'
,
'alpha'
'alpha'
],
],
'label-selector-ant-v'
:
[
'label-selector-ant-v'
:
[
...
@@ -1269,6 +1295,7 @@ export const TYPE_CONFIGS = [
...
@@ -1269,6 +1295,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1317,6 +1344,7 @@ export const TYPE_CONFIGS = [
...
@@ -1317,6 +1344,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1390,6 +1418,7 @@ export const TYPE_CONFIGS = [
...
@@ -1390,6 +1418,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1464,6 +1493,7 @@ export const TYPE_CONFIGS = [
...
@@ -1464,6 +1493,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1552,6 +1582,7 @@ export const TYPE_CONFIGS = [
...
@@ -1552,6 +1582,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1625,6 +1656,7 @@ export const TYPE_CONFIGS = [
...
@@ -1625,6 +1656,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1698,6 +1730,7 @@ export const TYPE_CONFIGS = [
...
@@ -1698,6 +1730,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1772,6 +1805,7 @@ export const TYPE_CONFIGS = [
...
@@ -1772,6 +1805,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1846,6 +1880,7 @@ export const TYPE_CONFIGS = [
...
@@ -1846,6 +1880,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1903,6 +1938,7 @@ export const TYPE_CONFIGS = [
...
@@ -1903,6 +1938,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -1962,6 +1998,7 @@ export const TYPE_CONFIGS = [
...
@@ -1962,6 +1998,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -2024,6 +2061,7 @@ export const TYPE_CONFIGS = [
...
@@ -2024,6 +2061,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -2074,6 +2112,7 @@ export const TYPE_CONFIGS = [
...
@@ -2074,6 +2112,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -2144,6 +2183,7 @@ export const TYPE_CONFIGS = [
...
@@ -2144,6 +2183,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
@@ -2199,6 +2239,7 @@ export const TYPE_CONFIGS = [
...
@@ -2199,6 +2239,7 @@ export const TYPE_CONFIGS = [
propertyInner
:
{
propertyInner
:
{
'color-selector'
:
[
'color-selector'
:
[
'value'
,
'value'
,
'custom'
,
'alpha'
'alpha'
],
],
'size-selector'
:
[
'size-selector'
:
[
...
...
frontend/src/views/chart/components/shape-attr/ColorSelector.vue
浏览文件 @
b279dd96
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
<el-col>
<el-col>
<el-form
ref=
"colorForm"
:model=
"colorForm"
label-width=
"80px"
size=
"mini"
>
<el-form
ref=
"colorForm"
:model=
"colorForm"
label-width=
"80px"
size=
"mini"
>
<div>
<div>
<el-form-item
v-show=
"showProperty('value')"
:label=
"$t('chart.color_case')"
class=
"form-item"
>
<el-form-item
:label=
"$t('chart.color_case')"
class=
"form-item"
>
<el-popover
<el-popover
placement=
"bottom"
placement=
"bottom"
width=
"400"
width=
"400"
trigger=
"click"
trigger=
"click"
>
>
<div
style=
"padding: 6px 10px;"
>
<div
style=
"padding: 6px 10px;"
>
<div>
<div
v-show=
"showProperty('value')"
>
<span
class=
"color-label"
>
{{
$t
(
'chart.system_case'
)
}}
</span>
<span
class=
"color-label"
>
{{
$t
(
'chart.system_case'
)
}}
</span>
<el-select
v-model=
"colorForm.value"
:placeholder=
"$t('chart.pls_slc_color_case')"
size=
"mini"
@
change=
"changeColorOption('value')"
>
<el-select
v-model=
"colorForm.value"
:placeholder=
"$t('chart.pls_slc_color_case')"
size=
"mini"
@
change=
"changeColorOption('value')"
>
<el-option
v-for=
"option in colorCases"
:key=
"option.value"
:label=
"option.name"
:value=
"option.value"
style=
"display: flex;align-items: center;"
>
<el-option
v-for=
"option in colorCases"
:key=
"option.value"
:label=
"option.name"
:value=
"option.value"
style=
"display: flex;align-items: center;"
>
...
@@ -22,6 +22,10 @@
...
@@ -22,6 +22,10 @@
</el-select>
</el-select>
<el-button
size=
"mini"
type=
"text"
style=
"margin-left: 2px;"
@
click=
"resetCustomColor"
>
{{
$t
(
'commons.reset'
)
}}
</el-button>
<el-button
size=
"mini"
type=
"text"
style=
"margin-left: 2px;"
@
click=
"resetCustomColor"
>
{{
$t
(
'commons.reset'
)
}}
</el-button>
</div>
</div>
<!--自定义配色方案-->
<div
v-show=
"showProperty('custom')"
>
<div
style=
"display: flex;align-items: center;margin-top: 10px;"
>
<div
style=
"display: flex;align-items: center;margin-top: 10px;"
>
<span
class=
"color-label"
>
{{
$t
(
'chart.custom_case'
)
}}
</span>
<span
class=
"color-label"
>
{{
$t
(
'chart.custom_case'
)
}}
</span>
<span>
<span>
...
@@ -39,6 +43,37 @@
...
@@ -39,6 +43,37 @@
</span>
</span>
</div>
</div>
</div>
</div>
<!--自定义系列或维度枚举值颜色-->
<div
v-show=
"showProperty('colorPanel')"
style=
"display: flex;align-items: center;margin-top: 10px;"
>
<span
class=
"color-label"
/>
<span>
<span
v-for=
"(c,index) in colorForm.colors"
:key=
"index"
style=
"padding: 2px;"
>
<span
:style=
"
{width: '20px',height: '20px',display:'inline-block',backgroundColor: c}" />
</span>
</span>
</div>
</div>
<div
v-if=
"!batchOptStatus"
v-show=
"showProperty('customColor')"
class=
"custom-color-style"
>
<div
v-for=
"(item,index) in colorForm.seriesColors"
:key=
"index"
style=
"display: flex;align-items: center;margin: 2px 0;"
>
<span
class=
"span-label"
:title=
"item.name"
>
{{
item
.
name
}}
</span>
<el-color-picker
v-model=
"item.color"
class=
"color-picker-style"
:predefine=
"predefineColors"
@
change=
"switchCustomColor(index)"
/>
</div>
</div>
<div
slot=
"reference"
style=
"cursor: pointer;margin-top: 2px;width: 180px;"
>
<div
slot=
"reference"
style=
"cursor: pointer;margin-top: 2px;width: 180px;"
>
<span
v-for=
"(c,index) in colorForm.colors"
:key=
"index"
:style=
"
{width: '20px',height: '20px',display:'inline-block',backgroundColor: c}" />
<span
v-for=
"(c,index) in colorForm.colors"
:key=
"index"
:style=
"
{width: '20px',height: '20px',display:'inline-block',backgroundColor: c}" />
</div>
</div>
...
@@ -81,6 +116,8 @@
...
@@ -81,6 +116,8 @@
<
script
>
<
script
>
import
{
COLOR_PANEL
,
DEFAULT_COLOR_CASE
}
from
'../../chart/chart'
import
{
COLOR_PANEL
,
DEFAULT_COLOR_CASE
}
from
'../../chart/chart'
import
{
getColors
}
from
'@/views/chart/chart/util'
import
{
mapState
}
from
'vuex'
export
default
{
export
default
{
name
:
'ColorSelector'
,
name
:
'ColorSelector'
,
...
@@ -209,6 +246,11 @@ export default {
...
@@ -209,6 +246,11 @@ export default {
}
}
}
}
},
},
computed
:
{
...
mapState
([
'batchOptStatus'
])
},
mounted
()
{
mounted
()
{
this
.
init
()
this
.
init
()
},
},
...
@@ -227,6 +269,10 @@ export default {
...
@@ -227,6 +269,10 @@ export default {
this
.
customColor
=
this
.
colorForm
.
colors
[
0
]
this
.
customColor
=
this
.
colorForm
.
colors
[
0
]
this
.
colorIndex
=
0
this
.
colorIndex
=
0
// reset custom color
this
.
colorForm
.
seriesColors
=
[]
this
.
initCustomColor
(
true
)
this
.
changeColorCase
(
modifyName
)
this
.
changeColorCase
(
modifyName
)
},
},
changeColorCase
(
modifyName
)
{
changeColorCase
(
modifyName
)
{
...
@@ -254,6 +300,8 @@ export default {
...
@@ -254,6 +300,8 @@ export default {
}
}
this
.
colorForm
.
tableBorderColor
=
this
.
colorForm
.
tableBorderColor
?
this
.
colorForm
.
tableBorderColor
:
DEFAULT_COLOR_CASE
.
tableBorderColor
this
.
colorForm
.
tableBorderColor
=
this
.
colorForm
.
tableBorderColor
?
this
.
colorForm
.
tableBorderColor
:
DEFAULT_COLOR_CASE
.
tableBorderColor
this
.
initCustomColor
()
}
}
}
}
},
},
...
@@ -273,6 +321,24 @@ export default {
...
@@ -273,6 +321,24 @@ export default {
},
},
showProperty
(
property
)
{
showProperty
(
property
)
{
return
this
.
propertyInner
.
includes
(
property
)
return
this
.
propertyInner
.
includes
(
property
)
},
switchCustomColor
(
index
)
{
this
.
colorForm
.
seriesColors
[
index
].
isCustom
=
true
this
.
switchColorCase
()
},
initCustomColor
(
reset
)
{
if
(
!
this
.
batchOptStatus
&&
this
.
chart
.
render
&&
this
.
chart
.
render
===
'antv'
&&
(
this
.
chart
.
type
.
includes
(
'bar'
)
||
this
.
chart
.
type
.
includes
(
'line'
)
||
this
.
chart
.
type
.
includes
(
'pie'
)
||
this
.
chart
.
type
===
'funnel'
||
this
.
chart
.
type
===
'radar'
||
this
.
chart
.
type
===
'scatter'
))
{
const
chart
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
chart
))
this
.
colorForm
.
seriesColors
=
getColors
(
chart
,
this
.
colorForm
.
colors
,
reset
)
}
}
}
}
}
}
}
...
@@ -326,4 +392,19 @@ export default {
...
@@ -326,4 +392,19 @@ export default {
.el-radio.is-checked
{
.el-radio.is-checked
{
border
:
1px
solid
#0a7be0
;
border
:
1px
solid
#0a7be0
;
}
}
.span-label
{
width
:
100px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
display
:
inline-block
;
}
.custom-color-style
{
height
:
300px
;
overflow-y
:
auto
;
padding
:
4px
;
border
:
1px
solid
#e6e6e6
;
}
</
style
>
</
style
>
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
b279dd96
...
@@ -1282,6 +1282,7 @@ export default {
...
@@ -1282,6 +1282,7 @@ export default {
this
.
resetDrill
()
this
.
resetDrill
()
this
.
initFromPanel
()
this
.
initFromPanel
()
this
.
getChart
(
this
.
param
.
id
)
this
.
getChart
(
this
.
param
.
id
)
this
.
getData
(
this
.
param
.
id
)
},
},
bindPluginEvent
()
{
bindPluginEvent
()
{
bus
.
$on
(
'show-dimension-edit-filter'
,
this
.
showDimensionEditFilter
)
bus
.
$on
(
'show-dimension-edit-filter'
,
this
.
showDimensionEditFilter
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论