Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
3a584198
提交
3a584198
authored
5月 15, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 修改群组RFM标签
上级
f08f2e3a
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
76 行增加
和
10 行删除
+76
-10
rfm.ts
src/api/rfm.ts
+5
-0
LabelRule.vue
src/components/rule/LabelRule.vue
+22
-4
useAllData.ts
src/composables/useAllData.ts
+1
-0
useRFMData.ts
src/composables/useRFMData.ts
+19
-1
FormDialog.vue
src/modules/group/components/FormDialog.vue
+28
-4
types.ts
src/types.ts
+1
-1
没有找到文件。
src/api/rfm.ts
浏览文件 @
3a584198
...
...
@@ -14,3 +14,8 @@ export function getEventAttrList(params: { type: number }) {
export
function
getMemberAttrRange
(
params
:
{
member_meta_id
:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/experiment/tag/bda-num-member-attr-range'
,
{
params
})
}
// 获取RFM标签的结果集
export
function
getRfmRes
()
{
return
httpRequest
.
get
(
'/api/lab/v1/experiment/group/bda-rfm-res'
)
}
src/components/rule/LabelRule.vue
浏览文件 @
3a584198
...
...
@@ -2,11 +2,13 @@
import
type
{
TagRule
}
from
'@/types'
import
{
PriceTag
,
Plus
,
CloseBold
}
from
'@element-plus/icons-vue'
import
{
useTag
}
from
'@/composables/useAllData'
import
{
useRfmRes
}
from
'@/composables/useRFMData'
// const tagRule = ref(inject('tagRule') as TagRule)
const
tagRule
=
defineModel
<
TagRule
>
({
default
:
{
current_logic_operate
:
'and'
,
items
:
[]
}
})
const
{
tagList
}
=
useTag
()
const
{
rfmResList
}
=
useRfmRes
()
// 获取逻辑运算符名称
function
getLogicalName
(
value
:
'and'
|
'or'
)
{
...
...
@@ -19,14 +21,23 @@ function toggleOperate(rule: TagRule) {
}
// 添加条件
function
handleAdd
(
items
:
string
[])
{
items
.
push
(
''
)
function
handleAdd
(
items
:
any
[])
{
items
.
push
(
{
tag_id
:
''
}
)
}
// 删除
function
handleRemove
(
items
:
string
[],
index
:
number
)
{
function
handleRemove
(
items
:
any
[],
index
:
number
)
{
items
.
splice
(
index
,
1
)
}
function
showRfm
(
id
:
string
)
{
return
tagList
.
value
.
find
(
item
=>
item
.
id
===
id
)?.
label
==
'4'
}
function
handleRfmChange
(
rfmKey
:
string
,
item
:
any
)
{
const
found
=
rfmResList
.
value
.
find
(
item
=>
item
.
frm_key
===
rfmKey
)
item
.
rfm_value
=
found
?.
frm_value
}
</
script
>
<
template
>
...
...
@@ -44,9 +55,16 @@ function handleRemove(items: string[], index: number) {
<div>
标签 等于
<el-form-item>
<el-select
v-model=
"
tagRule.items[index]
"
style=
"width: 400px"
>
<el-select
v-model=
"
item.tag_id
"
style=
"width: 400px"
>
<el-option
v-for=
"option in tagList"
:key=
"option.id"
:label=
"option.name"
:value=
"option.id"
></el-option>
</el-select>
<el-select
v-model=
"item.rfm_key"
@
change=
"value => handleRfmChange(value, item)"
v-if=
"showRfm(item.tag_id)"
style=
"width: 200px; margin-left: 10px"
>
<el-option
v-for=
"item in rfmResList"
:key=
"item.frm_key"
:label=
"item.frm_value"
:value=
"item.frm_key"
></el-option>
</el-select>
</el-form-item>
</div>
<el-button
text
:icon=
"CloseBold"
@
click=
"handleRemove(tagRule.items, index)"
></el-button>
...
...
src/composables/useAllData.ts
浏览文件 @
3a584198
...
...
@@ -24,6 +24,7 @@ interface MetaEventType {
export
interface
TagType
{
id
:
string
name
:
string
label
:
string
}
// 连接类型
...
...
src/composables/useRFMData.ts
浏览文件 @
3a584198
import
{
getMemberAttrList
,
getEventAttrList
,
getMemberAttrRange
}
from
'@/api/rfm'
import
{
getMemberAttrList
,
getEventAttrList
,
getMemberAttrRange
,
getRfmRes
}
from
'@/api/rfm'
// 用户属性类型
export
interface
AttrType
{
...
...
@@ -49,3 +49,21 @@ export function useUserAttrRange() {
}
return
{
fetchUserAttrRange
,
userAttrRange
}
}
// RFM标签的结果集
interface
RfmRes
{
frm_key
:
string
frm_value
:
number
}
const
rfmResList
=
ref
<
RfmRes
[]
>
([])
export
function
useRfmRes
()
{
async
function
fetchRfmResList
()
{
await
getRfmRes
().
then
((
res
:
any
)
=>
{
rfmResList
.
value
=
res
.
data
.
items
})
}
onMounted
(()
=>
{
fetchRfmResList
()
})
return
{
fetchRfmResList
,
rfmResList
}
}
src/modules/group/components/FormDialog.vue
浏览文件 @
3a584198
...
...
@@ -49,8 +49,12 @@ function fetchInfo() {
const
[
user_attr_rule
=
{
current_logic_operate
:
'and'
,
items
:
[]
}]
=
detail
.
user_attr_rule
||
[]
const
[
event_attr_rule
=
{
current_logic_operate
:
'and'
,
items
:
[]
}]
=
detail
.
event_attr_rule
||
[]
const
[
tag_rule
=
{
current_logic_operate
:
'and'
,
items
:
[]
}]
=
detail
.
tag_rule
?.
map
((
item
:
any
)
=>
{
return
{
...
item
,
items
:
item
.
items
.
map
((
item
:
any
)
=>
item
.
id
)
}
detail
.
tag_rule
?.
map
((
tagItem
:
any
)
=>
{
const
items
=
tagItem
.
items
.
map
((
item
:
any
,
index
:
number
)
=>
{
const
rfm
=
tagItem
.
rfm_tag_map
[
index
]
||
{}
return
{
tag_id
:
item
.
id
,
...
rfm
}
})
return
{
...
tagItem
,
items
}
})
||
[]
const
attrRuleItems
=
user_attr_rule
.
items
.
map
((
item
:
any
)
=>
{
item
.
value
=
[
'in'
,
'not in'
].
includes
(
item
.
operate
)
?
item
.
value
.
split
(
','
)
:
item
.
value
...
...
@@ -86,6 +90,16 @@ async function handleCreate() {
const
params
=
pick
(
form
,
[
'name'
,
'status'
])
await
createStaticGroup
(
params
)
}
else
if
(
props
.
data
.
type
===
'2'
)
{
const
tagRule
=
form
.
tag_rule
.
items
.
reduce
(
(
result
:
any
,
item
:
any
,
index
:
number
)
=>
{
result
.
items
.
push
(
item
.
tag_id
)
if
(
item
.
rfm_key
)
{
result
.
rfm_tag_map
[
index
]
=
item
}
return
result
},
{
items
:
[],
rfm_tag_map
:
{}
}
)
// 动态群组
const
params
=
pick
(
{
...
...
@@ -93,7 +107,7 @@ async function handleCreate() {
update_rule
:
JSON
.
stringify
(
form
.
update_rule
),
user_attr_rule
:
JSON
.
stringify
([
form
.
user_attr_rule
]),
event_attr_rule
:
JSON
.
stringify
([
form
.
event_attr_rule
]),
tag_rule
:
JSON
.
stringify
([
form
.
tag_rule
])
tag_rule
:
JSON
.
stringify
([
{
...
form
.
tag_rule
,
...
tagRule
}
])
},
[
'name'
,
'status'
,
'update_status'
,
'update_rule'
,
'user_attr_rule'
,
'event_attr_rule'
,
'tag_rule'
,
'user_action_rule'
]
)
...
...
@@ -130,6 +144,16 @@ async function handleUpdate() {
item
.
value
=
Array
.
isArray
(
item
.
value
)
?
item
.
value
.
join
(
','
)
:
item
.
value
return
item
})
const
tagRule
=
form
.
tag_rule
.
items
.
reduce
(
(
result
:
any
,
item
:
any
,
index
:
number
)
=>
{
result
.
items
.
push
(
item
.
tag_id
)
if
(
item
.
rfm_key
)
{
result
.
rfm_tag_map
[
index
]
=
item
}
return
result
},
{
items
:
[],
rfm_tag_map
:
{}
}
)
// 动态群组
const
params
=
pick
(
{
...
...
@@ -137,7 +161,7 @@ async function handleUpdate() {
update_rule
:
JSON
.
stringify
(
form
.
update_rule
),
user_attr_rule
:
JSON
.
stringify
([{
...
form
.
user_attr_rule
,
items
:
attrRuleItems
}]),
event_attr_rule
:
JSON
.
stringify
([{
...
form
.
event_attr_rule
,
items
:
eventRuleItems
}]),
tag_rule
:
JSON
.
stringify
([
form
.
tag_rule
]),
tag_rule
:
JSON
.
stringify
([
{
...
form
.
tag_rule
,
...
tagRule
}
]),
user_action_rule
:
JSON
.
stringify
(
form
.
user_action_rule
)
},
[
'id'
,
'name'
,
'status'
,
'update_status'
,
'update_rule'
,
'user_attr_rule'
,
'event_attr_rule'
,
'tag_rule'
,
'user_action_rule'
]
...
...
src/types.ts
浏览文件 @
3a584198
...
...
@@ -108,7 +108,7 @@ export interface EventRuleItem {
// 标签规则
export
interface
TagRule
{
current_logic_operate
:
'and'
|
'or'
items
:
string
[]
items
:
any
[]
}
// 用户行为规则
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论