Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
ab2a840b
提交
ab2a840b
authored
3月 29, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 封装条件组件
上级
5fcc9756
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
131 行增加
和
3 行删除
+131
-3
index.vue
frontend/src/components/widget/DeWidget/index.vue
+32
-0
widget.js
frontend/src/components/widget/bean/widget.js
+8
-0
index.js
frontend/src/components/widget/index.js
+10
-0
DrawWidgetService.js
frontend/src/components/widget/service/DrawWidgetService.js
+0
-0
WidgetService.js
frontend/src/components/widget/service/WidgetService.js
+17
-0
WidgetServiceImpl.js
...nd/src/components/widget/serviceImpl/WidgetServiceImpl.js
+16
-0
main.js
frontend/src/main.js
+2
-1
getters.js
frontend/src/store/getters.js
+2
-1
index.js
frontend/src/store/index.js
+3
-1
application.js
frontend/src/store/modules/application.js
+25
-0
ApplicationContext.js
frontend/src/utils/ApplicationContext.js
+10
-0
index.vue
frontend/src/views/panel/filter/index.vue
+6
-0
没有找到文件。
frontend/src/components/widget/DeWidget/index.vue
0 → 100644
浏览文件 @
ab2a840b
<
template
>
<div>
de-widget
</div>
</
template
>
<
script
>
import
{
ApplicationContext
}
from
'@/utils/ApplicationContext'
export
default
{
props
:
{
options
:
{
type
:
Object
,
default
:
null
}
},
data
()
{
return
{
widget
:
null
}
},
computed
()
{
this
.
widget
=
ApplicationContext
.
getService
(
this
.
options
.
name
)
console
.
log
(
this
.
widget
.
name
)
},
methods
:
{
onDraw
()
{
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
frontend/src/components/widget/bean/widget.js
0 → 100644
浏览文件 @
ab2a840b
export
class
Widget
{
constructor
(
options
=
{})
{
this
.
type
=
options
.
type
this
.
default_style
=
options
.
default_style
this
.
icon
=
options
.
icon
this
.
lable
=
options
.
label
}
}
frontend/src/components/widget/index.js
0 → 100644
浏览文件 @
ab2a840b
// import store from '@/store'
const
req
=
require
.
context
(
'./serviceImpl'
,
false
,
/
\.
js$/
)
const
requireAll
=
requireContext
=>
requireContext
.
keys
()
const
widgets
=
{}
requireAll
(
req
).
forEach
(
key
=>
{
widgets
[
key
.
replace
(
/
(\.\/
|
\.
js
)
/g
,
''
)]
=
req
(
key
).
default
})
export
default
widgets
frontend/src/components/widget/service/DrawWidgetService.js
0 → 100644
浏览文件 @
ab2a840b
frontend/src/components/widget/service/WidgetService.js
0 → 100644
浏览文件 @
ab2a840b
import
store
from
'@/store'
export
class
WidgetService
{
constructor
(
options
)
{
this
.
name
=
options
.
name
console
.
log
(
'init parent class WidgetService'
)
this
.
storeWidget
()
}
storeWidget
()
{
store
.
dispatch
(
'application/loadBean'
,
{
key
:
this
.
name
,
value
:
this
})
}
initWidget
()
{
console
.
log
(
'this is initWidget'
)
}
toDrawWidget
()
{
console
.
log
(
'this is toDrawWidget'
)
}
}
frontend/src/components/widget/serviceImpl/WidgetServiceImpl.js
0 → 100644
浏览文件 @
ab2a840b
import
{
WidgetService
}
from
'../service/WidgetService'
class
WidgetServiceImpl
extends
WidgetService
{
constructor
(
options
)
{
super
(
options
)
console
.
log
(
'init child class WidgetServiceImpl'
)
}
initWidget
()
{
console
.
log
(
'this is first initWidget'
)
}
toDrawWidget
()
{
console
.
log
(
'this is first toDrawWidget'
)
}
}
const
widgetServiceImpl
=
new
WidgetServiceImpl
({
name
:
'testWidget'
})
export
default
widgetServiceImpl
frontend/src/main.js
浏览文件 @
ab2a840b
...
...
@@ -15,11 +15,12 @@ import api from '@/api/index.js'
import
filter
from
'@/filter/filter'
import
directives
from
'./directive'
import
VueClipboard
from
'vue-clipboard2'
import
widgets
from
'@/components/widget'
import
'@/custom-component'
// 注册自定义组件
Vue
.
config
.
productionTip
=
false
Vue
.
use
(
VueClipboard
)
Vue
.
use
(
widgets
)
Vue
.
prototype
.
$api
=
api
import
*
as
echarts
from
'echarts'
...
...
frontend/src/store/getters.js
浏览文件 @
ab2a840b
...
...
@@ -17,6 +17,7 @@ const getters = {
table
:
state
=>
state
.
dataset
.
table
,
loadingMap
:
state
=>
state
.
request
.
loadingMap
,
currentPath
:
state
=>
state
.
permission
.
currentPath
,
permissions
:
state
=>
state
.
user
.
permissions
permissions
:
state
=>
state
.
user
.
permissions
,
beanMap
:
state
=>
state
.
application
.
beanMap
}
export
default
getters
frontend/src/store/index.js
浏览文件 @
ab2a840b
...
...
@@ -9,6 +9,7 @@ import dataset from './modules/dataset'
import
chart
from
'./modules/chart'
import
request
from
'./modules/request'
import
panel
from
'./modules/panel'
import
application
from
'./modules/application'
import
animation
from
'./animation'
import
compose
from
'./compose'
import
contextmenu
from
'./contextmenu'
...
...
@@ -111,7 +112,8 @@ const data = {
dataset
,
chart
,
request
,
panel
panel
,
application
},
getters
}
...
...
frontend/src/store/modules/application.js
0 → 100644
浏览文件 @
ab2a840b
const
state
=
{
beanMap
:
{}
}
const
mutations
=
{
ADD_BEAN
:
(
state
,
{
key
,
value
})
=>
{
state
.
beanMap
[
key
]
=
value
}
}
const
actions
=
{
loadBean
({
commit
},
data
)
{
commit
(
'ADD_BEAN'
,
data
)
}
}
export
default
{
namespaced
:
true
,
state
,
mutations
,
actions
}
frontend/src/utils/ApplicationContext.js
0 → 100644
浏览文件 @
ab2a840b
import
store
from
'@/store'
export
class
ApplicationContext
{
static
getService
(
name
)
{
if
(
!
name
)
{
return
null
}
const
bean
=
store
.
getters
.
beanMap
[
name
]
return
bean
}
}
frontend/src/views/panel/filter/index.vue
浏览文件 @
ab2a840b
...
...
@@ -24,6 +24,7 @@
</
template
>
<
script
>
import
componentList
from
'@/custom-component/component-list'
import
{
ApplicationContext
}
from
'@/utils/ApplicationContext'
export
default
{
name
:
'FilterGroup'
,
data
()
{
...
...
@@ -31,6 +32,11 @@ export default {
componentList
}
},
mounted
()
{
const
wid
=
ApplicationContext
.
getService
(
'testWidget'
)
console
.
log
(
wid
)
},
methods
:
{
handleDragStart
(
ev
)
{
ev
.
dataTransfer
.
effectAllowed
=
'copy'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论