提交 2c912887 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 修改RFM

上级 eb8297d4
...@@ -26,7 +26,18 @@ const defaultScore = [ ...@@ -26,7 +26,18 @@ const defaultScore = [
] ]
onMounted(() => { onMounted(() => {
form.value = Object.assign({ basis: '1', rule: '101', event_id: '-1', 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],
extend_config: { default_score_config: { switch: false, score: undefined } }
},
form.value
)
}) })
const { userAttrList, fetchUserAttrList } = useUserAttr() const { userAttrList, fetchUserAttrList } = useUserAttr()
...@@ -111,6 +122,8 @@ const a = [ ...@@ -111,6 +122,8 @@ const a = [
{ id: '004', label: '2200' }, { id: '004', label: '2200' },
{ id: '005', label: '1800' } { id: '005', label: '1800' }
] ]
const defaultOptions = Array.from({ length: 5 }).map((_, index) => ({ value: index + 1, label: index + 1 }))
</script> </script>
<template> <template>
...@@ -169,9 +182,15 @@ const a = [ ...@@ -169,9 +182,15 @@ const a = [
<el-select v-model="form.attr_id" placeholder="选择属性" style="width: 160px" @change="handleAttrChange" v-else> <el-select v-model="form.attr_id" placeholder="选择属性" style="width: 160px" @change="handleAttrChange" v-else>
<el-option v-for="item in userAttrList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in userAttrList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
<template v-if="form.basis == 1 && form.rule != '102' && form.attr_id"> <div style="flex: 1; display: flex; justify-content: space-between" v-if="form.basis == 1 && form.rule != '102' && form.attr_id">
<p>最小值:{{ userAttrRange.min }} <br />最大值:{{ userAttrRange.max }}<br />平均值:{{ userAttrRange.avg }}</p> <p>最小值:{{ userAttrRange.min }} <br />最大值:{{ userAttrRange.max }}</p>
</template> <p>平均值:{{ userAttrRange.avg }}<br />中位值:{{ userAttrRange.median }}</p>
</div>
</div>
<div class="rfm-header-extra" v-if="form.rule === '101'">
<p>未匹配数据默认赋值</p>
<el-select-v2 v-model="form.extend_config.default_score_config.score" :options="defaultOptions" style="width: 100px; margin: 0 10px" clearable />
<el-switch v-model="form.extend_config.default_score_config.switch"></el-switch>
</div> </div>
<div class="rfm-body"> <div class="rfm-body">
<template v-if="form.rule === '102'"> <template v-if="form.rule === '102'">
...@@ -254,4 +273,8 @@ const a = [ ...@@ -254,4 +273,8 @@ const a = [
margin: 10px 0; margin: 10px 0;
} }
} }
.rfm-header-extra {
display: flex;
align-items: center;
}
</style> </style>
...@@ -41,7 +41,7 @@ export function useMetaEvent() { ...@@ -41,7 +41,7 @@ export function useMetaEvent() {
// 最大值最小值 // 最大值最小值
export function useUserAttrRange() { export function useUserAttrRange() {
const userAttrRange = ref<{ min: string; max: string; avg: string }>({ min: '', max: '', avg: '' }) const userAttrRange = ref<{ min: string; max: string; avg: string; median: string }>({ min: '', max: '', avg: '', median: '' })
async function fetchUserAttrRange(member_meta_id: string) { async function fetchUserAttrRange(member_meta_id: string) {
await getMemberAttrRange({ member_meta_id }).then((res: any) => { await getMemberAttrRange({ member_meta_id }).then((res: any) => {
userAttrRange.value = res.data.detail userAttrRange.value = res.data.detail
......
...@@ -115,7 +115,7 @@ function handleUpdate() { ...@@ -115,7 +115,7 @@ function handleUpdate() {
</script> </script>
<template> <template>
<el-dialog title="标签规则管理" :close-on-click-modal="false" width="980px" @update:modelValue="value => $emit('update:modelValue', value)"> <el-dialog title="标签规则管理" :close-on-click-modal="false" width="1000px" @update:modelValue="value => $emit('update:modelValue', value)">
<el-form label-suffix=":" label-width="82px"> <el-form label-suffix=":" label-width="82px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论