Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
8bbb8c7e
提交
8bbb8c7e
authored
3月 30, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 封装条件组件类
上级
59163995
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
260 行增加
和
42 行删除
+260
-42
WidgetService.js
frontend/src/components/widget/service/WidgetService.js
+14
-1
ButtonSureServiceImpl.js
...rc/components/widget/serviceImpl/ButtonSureServiceImpl.js
+42
-0
TimeYearServiceImpl.js
.../src/components/widget/serviceImpl/TimeYearServiceImpl.js
+40
-0
WidgetServiceImpl.js
...nd/src/components/widget/serviceImpl/WidgetServiceImpl.js
+15
-15
index.vue
frontend/src/views/panel/edit/index.vue
+9
-7
index.vue
frontend/src/views/panel/filter/index.vue
+140
-19
没有找到文件。
frontend/src/components/widget/service/WidgetService.js
浏览文件 @
8bbb8c7e
import
store
from
'@/store'
export
const
commonStyle
=
{
rotate
:
0
,
opacity
:
1
}
export
const
commonAttr
=
{
animations
:
[],
events
:
{},
groupStyle
:
{},
// 当一个组件成为 Group 的子组件时使用
isLock
:
false
// 是否锁定组件
}
export
class
WidgetService
{
constructor
(
options
)
{
this
.
name
=
options
.
name
console
.
log
(
'init parent class WidgetService'
)
options
=
{
...
commonAttr
,
...
options
}
Object
.
assign
(
this
,
options
)
this
.
style
=
{
...
commonStyle
,
...
options
.
style
}
this
.
storeWidget
()
}
storeWidget
()
{
...
...
frontend/src/components/widget/serviceImpl/ButtonSureServiceImpl.js
0 → 100644
浏览文件 @
8bbb8c7e
import
{
WidgetService
}
from
'../service/WidgetService'
const
defaultOptions
=
{
name
:
'buttonSureWidget'
,
icon
:
null
,
label
:
'确定'
,
style
:
{
width
:
100
,
height
:
34
,
borderWidth
:
''
,
borderColor
:
''
,
borderRadius
:
''
,
fontSize
:
14
,
fontWeight
:
500
,
lineHeight
:
''
,
letterSpacing
:
0
,
textAlign
:
''
,
color
:
''
,
backgroundColor
:
''
},
propValue
:
'按钮'
,
component
:
'v-button'
}
class
ButtonSureServiceImpl
extends
WidgetService
{
constructor
(
options
)
{
Object
.
assign
(
options
,
defaultOptions
)
super
(
options
)
}
initWidget
()
{
// console.log('this is first initWidget')
}
toDrawWidget
()
{
// console.log('this is first toDrawWidget')
}
// 移动到画布之前回掉
beforeToDraw
()
{
}
}
const
buttonSureServiceImpl
=
new
ButtonSureServiceImpl
({
name
:
'buttonSureWidget'
})
export
default
buttonSureServiceImpl
frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js
0 → 100644
浏览文件 @
8bbb8c7e
import
{
WidgetService
}
from
'../service/WidgetService'
const
defaultOptions
=
{
name
:
'timeYearWidget'
,
icon
:
null
,
label
:
'年份'
,
style
:
{
width
:
200
,
height
:
22
,
fontSize
:
14
,
fontWeight
:
500
,
lineHeight
:
''
,
letterSpacing
:
0
,
textAlign
:
''
,
color
:
''
},
deProp
:
{
type
:
'year'
},
component
:
'el-date-picker'
}
class
TimeYearServiceImpl
extends
WidgetService
{
constructor
(
options
)
{
Object
.
assign
(
options
,
defaultOptions
)
super
(
options
)
}
initWidget
()
{
// console.log('this is first initWidget')
}
toDrawWidget
()
{
// console.log('this is first toDrawWidget')
}
// 移动到画布之前回掉
beforeToDraw
()
{
}
}
const
timeYearServiceImpl
=
new
TimeYearServiceImpl
({
name
:
'timeYearWidget'
})
export
default
timeYearServiceImpl
frontend/src/components/widget/serviceImpl/WidgetServiceImpl.js
浏览文件 @
8bbb8c7e
import
{
WidgetService
}
from
'../service/WidgetService'
class
WidgetServiceImpl
extends
WidgetService
{
constructor
(
options
)
{
super
(
options
)
console
.
log
(
'init child class WidgetServiceImpl'
)
}
//
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
//
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/views/panel/edit/index.vue
浏览文件 @
8bbb8c7e
...
...
@@ -92,7 +92,7 @@ import '@/components/canvas/assets/iconfont/iconfont.css'
import
'@/components/canvas/styles/animate.css'
import
'element-ui/lib/theme-chalk/index.css'
import
'@/components/canvas/styles/reset.css'
import
{
ApplicationContext
}
from
'@/utils/ApplicationContext'
export
default
{
components
:
{
DeMainContainer
,
...
...
@@ -249,11 +249,13 @@ export default {
debugger
// 其他组件设置
componentList
.
forEach
(
componentTemp
=>
{
if
(
componentInfo
.
id
===
componentTemp
.
id
)
{
component
=
deepCopy
(
componentTemp
)
}
})
// componentList.forEach(componentTemp => {
// if (componentInfo.id === componentTemp.id) {
// component = deepCopy(componentTemp)
// }
// })
component
=
deepCopy
(
ApplicationContext
.
getService
(
componentInfo
.
id
))
component
.
style
.
top
=
e
.
offsetY
component
.
style
.
left
=
e
.
offsetX
...
...
@@ -329,7 +331,7 @@ export default {
.leftPanel
{
width
:
100%
;
max-width
:
2
0
0px
;
max-width
:
2
4
0px
;
height
:
calc
(
100vh
-
91px
);
position
:
fixed
;
top
:
91px
;
...
...
frontend/src/views/panel/filter/index.vue
浏览文件 @
8bbb8c7e
<
template
>
<div>
<el-card
class=
"filter-card-class"
>
<div
class=
"filter-container"
@
dragstart=
"handleDragStart"
>
<!--
<el-card
class=
"filter-card-class"
>
<div
slot=
"header"
>
<span>
卡片名称
</span>
</div>
...
...
@@ -18,7 +19,23 @@
</div>
</div>
</el-card>
</el-card>
-->
<div
v-for=
"(item, key) in widgetSubjects"
:key=
"key"
class=
"widget-subject"
>
<div
class=
"filter-header"
>
<div
class=
"filter-header-text"
>
{{
key
}}
</div>
</div>
<div
class=
"filter-widget-content"
>
<div
v-for=
"(widget, index) in item"
:key=
"widget.name+index"
:data-id=
"widget.name"
draggable
:data-index=
"index"
class=
"filter-widget"
>
<div
class=
"filter-widget-icon"
>
<i
:class=
"(widget.icon || 'el-icon-setting') + ' widget-icon-i'"
/>
</div>
<div
class=
"filter-widget-text"
>
{{
widget
.
label
}}
</div>
</div>
</div>
</div>
</div>
</
template
>
...
...
@@ -29,12 +46,25 @@ export default {
name
:
'FilterGroup'
,
data
()
{
return
{
componentList
componentList
,
widgetSubjects
:
{
'时间过滤组件'
:
[
'timeYearWidget'
],
'按钮'
:
[
'buttonSureWidget'
]
}
}
},
mounted
()
{
const
wid
=
ApplicationContext
.
getService
(
'testWidget'
)
console
.
log
(
wid
)
created
()
{
for
(
const
key
in
this
.
widgetSubjects
)
{
const
widgetNames
=
this
.
widgetSubjects
[
key
]
this
.
widgetSubjects
[
key
]
=
widgetNames
.
map
(
widgetName
=>
{
const
widget
=
ApplicationContext
.
getService
(
widgetName
)
return
widget
})
}
},
methods
:
{
...
...
@@ -52,26 +82,117 @@ export default {
<
style
lang=
"scss"
scoped
>
.item
{
font-size
:
12px
;
width
:
100px
;
height
:
36px
;
.filter-container
{
width
:
240px
;
overflow
:
hidden
auto
;
min-height
:
24px
;
padding-top
:
0px
;
padding-bottom
:
0px
;
position
:
relative
;
height
:
940px
;
max-height
:
976px
;
}
.filter-header
{
overflow
:
hidden
;
position
:
relative
;
margin-top
:
24px
;
margin-left
:
15px
;
align-items
:
center
;
word-break
:
break-all
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
flex-start
;
flex-wrap
:
nowrap
;
}
.filter-header-text
{
font-size
:
14px
;
max-width
:
100%
;
color
:
gray
;
text-align
:
left
;
white-space
:
pre
;
text-overflow
:
ellipsis
;
position
:
relative
;
flex-shrink
:
0
;
box-sizing
:
border-box
;
overflow
:
hidden
;
overflow-x
:
hidden
;
overflow-y
:
hidden
;
word-break
:
break-all
;
}
.filter-widget-content
{
position
:
relative
;
margin-left
:
5px
;
}
.filter-widget
{
width
:
100px
;
height
:
36px
;
position
:
relative
;
float
:
left
;
margin-top
:
10px
;
margin-left
:
10px
;
background-color
:
rgba
(
54
,
133
,
242
,.
1
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
#1a3685
f2
,
endColorstr
=
#1a3685
f2
);
font-size
:
12px
;
border-radius
:
2px
;
cursor
:
pointer
;
:hover
{
background-color
:
#3685f2
;
color
:
#fff
;
}
}
.clearfix
:before
,
.clearfix
:after
{
display
:
table
;
content
:
""
;
.filter-widget-icon
{
width
:
40px
;
height
:
36px
;
text-align
:
center
;
line-height
:
1
;
position
:
absolute
;
top
:
0px
;
bottom
:
0px
;
left
:
0px
;
justify-content
:
center
;
align-items
:
center
;
flex-direction
:
row
;
flex-wrap
:
nowrap
;
display
:
flex
;
.widget-icon-i
{
width
:
24px
;
height
:
24px
;
position
:
relative
;
flex-shrink
:
0
;
font-size
:
24px
;
margin
:
auto
;
font-family
:
fineui
;
font-style
:
normal
;
-webkit-font-smoothing
:
antialiased
;
text-align
:
center
;
}
}
.clearfix
:after
{
clear
:
both
.filter-widget-text
{
font-size
:
14px
;
height
:
36px
;
line-height
:
36px
;
text-align
:
left
;
white-space
:
pre
;
text-overflow
:
ellipsis
;
position
:
absolute
;
inset
:
0px
0px
0px
40px
;
box-sizing
:
border-box
;
overflow
:
hidden
;
overflow-x
:
hidden
;
overflow-y
:
hidden
;
word-break
:
break-all
;
cursor
:
pointer
;
color
:
#3d4d66
;
}
.
box-card
{
width
:
480px
;
.
widget-subject
{
display
:
flow-root
;
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论