Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
3f33dc38
提交
3f33dc38
authored
5月 20, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 查询组件数据存储到store
上级
6659beae
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
93 行增加
和
3 行删除
+93
-3
ComponentWrapper.vue
.../components/canvas/components/Editor/ComponentWrapper.vue
+9
-0
DeSelect.vue
frontend/src/components/widget/DeWidget/DeSelect.vue
+2
-1
getters.js
frontend/src/store/getters.js
+2
-1
index.js
frontend/src/store/index.js
+3
-1
conditions.js
frontend/src/store/modules/conditions.js
+77
-0
没有找到文件。
frontend/src/components/canvas/components/Editor/ComponentWrapper.vue
浏览文件 @
3f33dc38
...
...
@@ -2,6 +2,15 @@
<div
@
click=
"handleClick"
>
<component
:is=
"config.component"
v-if=
"config.type==='custom'"
:id=
"'component' + config.id"
class=
"component"
:style=
"getStyle(config.style)"
:element=
"config"
/>
<component
:is=
"config.component"
v-else
class=
"component"
:style=
"getStyle(config.style)"
:prop-value=
"config.propValue"
...
...
frontend/src/components/widget/DeWidget/DeSelect.vue
浏览文件 @
3f33dc38
<
template
>
<el-select
v-if=
"options!== null && options.attrs!==null"
v-model=
"
values"
:multiple=
"options.attrs.multiple"
:placeholder=
"options.attrs.placeholder"
@
change=
"changeValue"
>
<el-select
v-if=
"options!== null && options.attrs!==null"
v-model=
"
options.value"
clearable
:multiple=
"options.attrs.multiple"
:placeholder=
"options.attrs.placeholder"
@
change=
"changeValue"
>
<el-option
v-for=
"item in options.attrs.datas"
:key=
"item[options.attrs.key]"
...
...
@@ -52,6 +52,7 @@ export default {
},
methods
:
{
changeValue
(
value
)
{
this
.
inDraw
&&
this
.
$store
.
dispatch
(
'conditions/add'
,
{
component
:
this
.
element
,
value
:
[
this
.
options
.
value
],
operator
:
this
.
operator
})
this
.
inDraw
&&
this
.
$emit
(
'set-condition-value'
,
{
component
:
this
.
element
,
value
:
[
value
],
operator
:
this
.
operator
})
}
}
...
...
frontend/src/store/getters.js
浏览文件 @
3f33dc38
...
...
@@ -24,6 +24,7 @@ const getters = {
drawWidgetMap
:
state
=>
state
.
application
.
drawWidgetMap
,
validate
:
state
=>
state
.
lic
.
validate
,
licMsg
:
state
=>
state
.
lic
.
licMsg
,
uiInfo
:
state
=>
state
.
user
.
uiInfo
uiInfo
:
state
=>
state
.
user
.
uiInfo
,
conditions
:
state
=>
state
.
conditions
.
conditions
}
export
default
getters
frontend/src/store/index.js
浏览文件 @
3f33dc38
...
...
@@ -11,6 +11,7 @@ import request from './modules/request'
import
panel
from
'./modules/panel'
import
application
from
'./modules/application'
import
lic
from
'./modules/lic'
import
conditions
from
'./modules/conditions'
import
animation
from
'@/components/canvas/store/animation'
import
compose
from
'@/components/canvas/store/compose'
import
contextmenu
from
'@/components/canvas/store/contextmenu'
...
...
@@ -135,7 +136,8 @@ const data = {
request
,
panel
,
application
,
lic
lic
,
conditions
},
getters
}
...
...
frontend/src/store/modules/conditions.js
0 → 100644
浏览文件 @
3f33dc38
import
{
Condition
}
from
'@/components/widget/bean/Condition'
const
state
=
{
conditions
:
[]
}
const
mutations
=
{
ADD_CONDITION
:
(
state
,
condition
)
=>
{
!
condition
&&
(
condition
=
[])
state
.
conditions
.
push
(
condition
)
},
REDUCE_CONDITION
:
(
state
,
index
)
=>
{
state
.
conditions
&&
state
.
conditions
.
length
>
index
&&
state
.
conditions
.
splice
(
index
,
1
)
}
}
const
actions
=
{
add
({
commit
},
data
)
{
const
condition
=
formatCondition
(
data
)
if
(
!
state
.
conditions
||
state
.
conditions
.
length
===
0
)
{
state
.
conditions
=
[]
}
const
validResult
=
isValid
(
condition
)
if
(
!
validResult
.
statu
&&
validResult
.
hasOwnProperty
(
'existIndex'
)
&&
validResult
.
existIndex
!==
-
1
)
{
commit
(
'REDUCE_CONDITION'
,
validResult
.
existIndex
)
commit
(
'ADD_CONDITION'
,
condition
)
}
if
(
validResult
.
statu
)
{
commit
(
'ADD_CONDITION'
,
condition
)
}
},
reduce
({
commit
},
index
)
{
commit
(
'ADD_CONDITION'
,
index
)
}
}
// 判断条件condition是否有效
const
isValid
=
condition
=>
{
const
nullResult
=
{
statu
:
false
,
msg
:
'condition is null'
}
const
repeatResult
=
{
statu
:
false
,
existIndex
:
-
1
,
msg
:
'condition is exist'
}
const
validResult
=
{
statu
:
true
,
msg
:
null
}
if
(
!
condition
)
{
return
nullResult
}
for
(
let
index
=
0
;
index
<
state
.
conditions
.
length
;
index
++
)
{
const
item
=
state
.
conditions
[
index
]
if
(
item
.
componentId
===
condition
.
componentId
)
{
repeatResult
.
existIndex
=
index
return
repeatResult
}
}
return
validResult
}
const
formatCondition
=
obj
=>
{
const
{
component
,
value
,
operator
}
=
obj
const
fieldId
=
component
.
options
.
attrs
.
fieldId
const
viewIds
=
component
.
options
.
attrs
.
viewIds
const
condition
=
new
Condition
(
component
.
id
,
fieldId
,
operator
,
value
,
viewIds
)
return
condition
}
export
default
{
namespaced
:
true
,
state
,
mutations
,
actions
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论