Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
e68cd7e5
提交
e68cd7e5
authored
2月 06, 2023
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
8ad8de5c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
85 行增加
和
31 行删除
+85
-31
rule.scss
src/assets/styles/rule.scss
+16
-4
UserRule.vue
src/components/rule/UserRule.vue
+32
-19
UserRuleGroup.vue
src/components/rule/UserRuleGroup.vue
+37
-8
没有找到文件。
src/assets/styles/rule.scss
浏览文件 @
e68cd7e5
...
...
@@ -3,8 +3,8 @@
}
.rule-and-or
{
position
:
relative
;
min-width
:
3
0px
;
min-height
:
4
0px
;
min-width
:
4
0px
;
min-height
:
3
0px
;
&
:
:
before
{
content
:
' '
;
position
:
absolute
;
...
...
@@ -23,7 +23,7 @@
width
:
24px
;
height
:
24px
;
line-height
:
24px
;
color
:
#00b2a6
;
color
:
var
(
--
main-color
)
;
background
:
#fff
;
text-align
:
center
;
border
:
1px
solid
#d4dbe1
;
...
...
@@ -31,6 +31,18 @@
cursor
:
pointer
;
}
}
.rule-
righ
t
{
.rule-
attr-lis
t
{
flex
:
1
;
}
.rule-attr
{
display
:
flex
;
}
.rule-attr
+
.rule-attr
{
margin-top
:
10px
;
}
.rule-attr-content
{
flex
:
1
;
}
.rule-attr-tools
{
width
:
140px
;
}
src/components/rule/UserRule.vue
浏览文件 @
e68cd7e5
<
script
setup
lang=
"ts"
>
import
type
{
UserAttrRule
}
from
'@/types'
import
{
UserFilled
,
Plus
}
from
'@element-plus/icons-vue'
import
RuleGroup
from
'./UserRuleGroup.vue'
import
User
RuleGroup
from
'./UserRuleGroup.vue'
const
rule
=
ref
<
UserAttrRule
>
({
items
:
[
{
attr_id
:
'属性ID'
,
attr
:
'属性'
,
attr_name
:
'属性名称'
,
attr_type
:
1
,
operate
:
'操作'
,
operate_name
:
'操作名称'
,
value
:
'值'
}
],
current_logic_operate
:
'and'
})
const
rules
=
ref
<
UserAttrRule
[]
>
([
{
items
:
[
{
attr_id
:
'属性ID'
,
attr
:
'属性'
,
attr_name
:
'属性名称'
,
attr_type
:
1
,
operate
:
'操作'
,
operate_name
:
'操作名称'
,
value
:
'值'
}
],
current_logic_operate
:
'and'
}
])
function
handleChange
(
data
:
UserAttrRule
)
{
rule
.
value
=
data
function
handleChange
(
data
:
UserAttrRule
,
index
:
number
)
{
rules
.
value
[
index
]
=
data
}
// 添加条件
function
handleAdd
()
{
rules
.
value
.
push
({
items
:
[{
attr_id
:
''
,
attr
:
''
,
attr_name
:
''
,
attr_type
:
1
,
operate
:
''
,
operate_name
:
''
,
value
:
''
}],
current_logic_operate
:
'and'
})
}
</
script
>
...
...
@@ -29,7 +39,10 @@ function handleChange(data: UserAttrRule) {
<el-button
circle
color=
"#006df1"
:icon=
"UserFilled"
></el-button>
用户属性满足以下条件
</
template
>
<RuleGroup
:data=
"rule"
@
update=
"handleChange"
></RuleGroup>
<el-button
text
:icon=
"Plus"
>
添加条件
</el-button>
<UserRuleGroup
v-for=
"(item, index) in rules"
:data=
"item"
@
update=
"data => handleChange(data, index)"
></UserRuleGroup>
<el-button
text
:icon=
"Plus"
@
click=
"handleAdd"
v-if=
"!rules.length"
>
添加条件
</el-button>
</el-card>
</template>
src/components/rule/UserRuleGroup.vue
浏览文件 @
e68cd7e5
<
script
setup
lang=
"ts"
>
import
type
{
UserAttrRule
}
from
'@/types'
import
{
Plus
,
CloseBold
}
from
'@element-plus/icons-vue'
interface
Props
{
data
:
UserAttrRule
...
...
@@ -21,6 +22,28 @@ function toggleOperate() {
update
({
...
props
.
data
,
current_logic_operate
:
props
.
data
.
current_logic_operate
===
'or'
?
'and'
:
'or'
})
}
// 新增
function
handleAdd
(
index
:
number
)
{
const
items
=
props
.
data
.
items
.
slice
()
items
.
splice
(
index
,
0
,
{
attr_id
:
''
,
attr
:
''
,
attr_name
:
''
,
attr_type
:
1
,
operate
:
''
,
operate_name
:
''
,
value
:
''
})
update
({
...
props
.
data
,
items
})
}
// 删除
function
handleRemove
(
index
:
number
)
{
const
items
=
props
.
data
.
items
.
slice
()
items
.
splice
(
index
,
1
)
update
({
...
props
.
data
,
items
})
}
function
update
(
data
:
UserAttrRule
)
{
emit
(
'update'
,
data
)
}
...
...
@@ -31,14 +54,20 @@ function update(data: UserAttrRule) {
<div
class=
"rule-and-or"
>
<span
@
click=
"toggleOperate"
>
{{
andOrText
}}
</span>
</div>
<div
class=
"rule-item-wrap"
>
<div
class=
"rule-item"
v-for=
"item in data.items"
>
<el-select>
<el-option
label=
"1"
value=
"1"
></el-option>
</el-select>
<el-select>
<el-option
label=
"1"
value=
"1"
></el-option>
</el-select>
<div
class=
"rule-attr-list"
>
<div
class=
"rule-attr"
v-for=
"(item, index) in data.items"
>
<div
class=
"rule-attr-content"
>
<el-select
style=
"width: 120px"
>
<el-option
label=
"1"
value=
"1"
></el-option>
</el-select>
<el-select
style=
"width: 120px"
>
<el-option
label=
"1"
value=
"1"
></el-option>
</el-select>
</div>
<div
class=
"rule-attr-tools"
>
<el-button
text
:icon=
"Plus"
@
click=
"handleAdd(index)"
>
新增
</el-button>
<el-button
text
:icon=
"CloseBold"
@
click=
"handleRemove(index)"
v-if=
"index"
></el-button>
</div>
</div>
</div>
</div>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论