Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
34ac7d2d
提交
34ac7d2d
authored
4月 19, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
9ff2f106
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
60 行增加
和
19 行删除
+60
-19
RFMRuleItem.vue
src/components/rule/RFMRuleItem.vue
+33
-7
useAllData.ts
src/composables/useAllData.ts
+27
-12
没有找到文件。
src/components/rule/RFMRuleItem.vue
浏览文件 @
34ac7d2d
<
script
setup
lang=
"ts"
>
import
{
useUserAttr
,
useMetaEvent
}
from
'@/composables/useAllData'
import
{
searchMetaMemberAttrs
}
from
'@/api/base'
defineProps
<
{
label
:
string
}
>
()
const
form
=
defineModel
<
any
>
()
...
...
@@ -24,7 +25,7 @@ const defaultScore = [
]
onMounted
(()
=>
{
form
.
value
=
Object
.
assign
({
basis
:
'1'
,
rule
:
'101'
,
event_id
:
'
0
'
,
attr_id
:
''
,
attr_type
:
''
,
config
:
[...
defaultScore
]
},
form
.
value
)
form
.
value
=
Object
.
assign
({
basis
:
'1'
,
rule
:
'101'
,
event_id
:
'
-1
'
,
attr_id
:
''
,
attr_type
:
''
,
config
:
[...
defaultScore
]
},
form
.
value
)
})
const
{
userAttrList
}
=
useUserAttr
()
...
...
@@ -36,9 +37,6 @@ const currentRuleList = computed(() => {
const
currentAttrList
=
computed
(()
=>
{
let
list
=
userAttrList
.
value
if
(
form
.
value
.
basis
===
'2'
)
{
list
=
metaEventList
.
value
.
find
(
item
=>
item
.
id
===
form
.
value
.
event_id
)?.
event_attrs
||
[]
}
return
list
.
filter
(
item
=>
{
if
(
form
.
value
.
rule
===
'101'
)
{
return
[
'2'
,
'3'
,
'4'
,
'5'
].
includes
(
item
.
type
)
...
...
@@ -48,6 +46,9 @@ const currentAttrList = computed(() => {
return
true
})
})
const
currentMetaEventList
=
computed
(()
=>
{
return
[{
id
:
'-1'
,
name
:
'全部事件'
},
...
metaEventList
.
value
]
})
function
handleBasisChange
(
value
:
any
)
{
if
(
value
===
'1'
)
{
...
...
@@ -65,11 +66,34 @@ function handleRuleChange(value: any) {
}
else
{
form
.
value
.
config
=
[...
defaultScore
]
}
form
.
value
.
attr_id
=
''
}
function
handleAttrChange
(
value
:
any
)
{
form
.
value
.
attr_type
=
currentAttrList
.
value
.
find
(
item
=>
item
.
id
===
value
)?.
type
}
const
options
=
ref
<
{
label
:
string
;
value
:
string
}[]
>
([])
const
loading
=
ref
(
false
)
async
function
remoteMethod
(
search
:
string
=
''
)
{
options
.
value
=
[]
if
(
form
.
value
.
attr_id
)
{
loading
.
value
=
true
await
searchMetaMemberAttrs
({
search
,
member_meta_id
:
form
.
value
.
attr_id
,
per_page
:
100
}).
then
(
res
=>
{
options
.
value
=
res
.
data
.
list
.
map
((
item
:
any
)
=>
{
return
{
label
:
item
.
attr_value
,
value
:
item
.
attr_value
}
})
})
loading
.
value
=
false
}
}
watch
(
()
=>
form
.
value
.
attr_id
,
()
=>
{
form
.
value
.
rule
===
'102'
&&
remoteMethod
()
},
{
immediate
:
true
}
)
</
script
>
<
template
>
...
...
@@ -89,9 +113,9 @@ function handleAttrChange(value: any) {
<el-option
v-for=
"item in currentRuleList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
<el-select
v-model=
"form.event_id"
placeholder=
"选择事件"
style=
"width: 160px"
v-if=
"form.basis === '2'"
>
<el-option
v-for=
"item in
m
etaEventList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
></el-option>
<el-option
v-for=
"item in
currentM
etaEventList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
></el-option>
</el-select>
<el-select
v-model=
"form.attr_id"
placeholder=
"选择属性"
style=
"width: 160px"
@
change=
"handleAttrChange"
>
<el-select
v-model=
"form.attr_id"
placeholder=
"选择属性"
style=
"width: 160px"
@
change=
"handleAttrChange"
v-else
>
<el-option
v-for=
"item in currentAttrList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
></el-option>
</el-select>
</div>
...
...
@@ -102,7 +126,9 @@ function handleAttrChange(value: any) {
<b>
{{
item
.
level
}}
</b>
</div>
<div
class=
"rfm-box-body"
>
<el-input
placeholder=
"选择属性值"
v-model=
"item.value"
></el-input>
<el-select
placeholder=
"选择属性值"
v-model=
"item.value"
filterable
allow-create
:loading=
"loading"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</div>
</div>
</
template
>
...
...
src/composables/useAllData.ts
浏览文件 @
34ac7d2d
...
...
@@ -37,53 +37,67 @@ export interface ConnectionType {
// 所有用户属性
const
userAttrList
=
ref
<
AttrType
[]
>
([])
const
userAttrLoading
=
ref
(
false
)
export
function
useUserAttr
()
{
function
fetchUserAttrList
()
{
getMetaUserAttrList
({
check_role
:
true
}).
then
((
res
:
any
)
=>
{
async
function
fetchUserAttrList
()
{
if
(
userAttrLoading
.
value
)
return
userAttrLoading
.
value
=
true
await
getMetaUserAttrList
({
check_role
:
true
}).
then
((
res
:
any
)
=>
{
userAttrList
.
value
=
res
.
data
.
items
})
userAttrLoading
.
value
=
false
}
onMounted
(()
=>
{
if
(
!
userAttrList
.
value
?.
length
)
fetchUserAttrList
()
})
return
{
fetchUserAttrList
,
userAttrList
}
return
{
fetchUserAttrList
,
userAttrList
,
userAttrLoading
}
}
// 所有事件
const
metaEventList
=
ref
<
MetaEventType
[]
>
([])
const
metaEventLoading
=
ref
(
false
)
export
function
useMetaEvent
()
{
function
fetchMetaEventList
()
{
getMetaEventList
({
check_role
:
true
}).
then
((
res
:
any
)
=>
{
async
function
fetchMetaEventList
()
{
if
(
metaEventLoading
.
value
)
return
metaEventLoading
.
value
=
true
await
getMetaEventList
({
check_role
:
true
}).
then
((
res
:
any
)
=>
{
metaEventList
.
value
=
res
.
data
.
items
})
metaEventLoading
.
value
=
false
}
onMounted
(()
=>
{
if
(
!
metaEventList
.
value
?.
length
)
fetchMetaEventList
()
})
return
{
fetchMetaEventList
,
metaEventList
}
return
{
fetchMetaEventList
,
metaEventList
,
metaEventLoading
}
}
// 所有标签
const
tagList
=
ref
<
TagType
[]
>
([])
const
tagLoading
=
ref
(
false
)
export
function
useTag
()
{
function
fetchTagList
()
{
getTagList
({
check_role
:
1
}).
then
((
res
:
any
)
=>
{
async
function
fetchTagList
()
{
if
(
tagLoading
.
value
)
return
tagLoading
.
value
=
true
await
getTagList
({
check_role
:
1
}).
then
((
res
:
any
)
=>
{
tagList
.
value
=
res
.
data
.
items
})
tagLoading
.
value
=
false
}
onMounted
(()
=>
{
if
(
!
tagList
.
value
?.
length
)
fetchTagList
()
})
return
{
fetchTagList
,
tagList
}
return
{
fetchTagList
,
tagList
,
tagLoading
}
}
// 所有连接
const
connectionList
=
ref
<
ConnectionType
[]
>
([])
const
connectionLoading
=
ref
(
false
)
export
function
useConnection
()
{
async
function
fetchConnectionList
()
{
if
(
connectionLoading
.
value
)
return
connectionLoading
.
value
=
true
const
connectionType
=
useMapStore
().
getMapValuesByKey
(
'experiment_connection_type'
)
getConnectionList
().
then
((
res
:
any
)
=>
{
await
getConnectionList
().
then
((
res
:
any
)
=>
{
connectionList
.
value
=
res
.
data
.
items
.
map
((
item
:
any
)
=>
{
const
connection
=
connectionType
.
find
(
type
=>
type
.
value
==
item
.
type
)
const
attrs
=
typeof
item
.
config_attributes
===
'string'
?
JSON
.
parse
(
item
.
config_attributes
)
:
item
.
config_attributes
...
...
@@ -91,11 +105,12 @@ export function useConnection() {
return
{
...
item
,
config_attributes
:
attrs
,
name
,
type_name
:
connection
?.
label
||
item
.
type
}
})
})
connectionLoading
.
value
=
false
}
onMounted
(()
=>
{
if
(
!
connectionList
.
value
?.
length
)
fetchConnectionList
()
})
return
{
fetchConnectionList
,
connectionList
}
return
{
fetchConnectionList
,
connectionList
,
connectionLoading
}
}
// 所有成员
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论