提交 01464c38 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 d237c9d8
......@@ -38,22 +38,22 @@ const experimentConfig: any = [
children: [
{ id: 2, name: '连接管理', is_checked: false, pid: 1, children: [] },
{ id: 3, name: '用户属性管理', is_checked: false, pid: 1, children: [] },
{ id: 4, name: '事件属性管理', is_checked: false, pid: 1, children: [] }
]
{ id: 4, name: '事件属性管理', is_checked: false, pid: 1, children: [] },
],
},
{
id: 5,
name: '营销策划',
is_checked: false,
pid: 0,
children: []
children: [],
},
{
id: 6,
name: '用户画像',
is_checked: false,
pid: 0,
children: []
children: [],
},
{
id: 7,
......@@ -64,7 +64,7 @@ const experimentConfig: any = [
{ id: 8, name: '标签管理', is_checked: false, pid: 7, children: [] },
{ id: 9, name: '群组管理', is_checked: false, pid: 7, children: [] },
{ id: 71, name: '运营策略管理', is_checked: false, pid: 7, children: [] },
]
],
},
{
id: 10,
......@@ -79,15 +79,15 @@ const experimentConfig: any = [
{ id: 15, name: 'H5资料管理', is_checked: false, pid: 10, children: [] },
{ id: 16, name: '二维码资料管理', is_checked: false, pid: 10, children: [] },
{ id: 17, name: '语言资料管理', is_checked: false, pid: 10, children: [] },
{ id: 18, name: '小程序资料管理', is_checked: false, pid: 10, children: [] }
]
{ id: 18, name: '小程序资料管理', is_checked: false, pid: 10, children: [] },
],
},
{
id: 19,
name: '自动化营销',
is_checked: false,
pid: 0,
children: []
children: [],
},
{
id: 20,
......@@ -99,8 +99,8 @@ const experimentConfig: any = [
{ id: 22, name: '商品属性管理', is_checked: false, pid: 20, children: [] },
{ id: 23, name: '商品管理', is_checked: false, pid: 20, children: [] },
{ id: 24, name: '直播练习', is_checked: false, pid: 20, children: [] },
{ id: 25, name: '直播话术管理', is_checked: false, pid: 20, children: [] }
]
{ id: 25, name: '直播话术管理', is_checked: false, pid: 20, children: [] },
],
},
{
id: 26,
......@@ -111,9 +111,9 @@ const experimentConfig: any = [
{ id: 27, name: '用户分析', is_checked: false, pid: 26, children: [] },
{ id: 28, name: '标签群组分析', is_checked: false, pid: 26, children: [] },
{ id: 29, name: '事件分析', is_checked: false, pid: 26, children: [] },
{ id: 30, name: '营销分析', is_checked: false, pid: 26, children: [] }
]
}
{ id: 30, name: '营销分析', is_checked: false, pid: 26, children: [] },
],
},
]
const formRef = $ref<FormInstance>()
......@@ -133,7 +133,7 @@ const form = reactive({
material_ids: [],
auth_config: experimentConfig,
is_use_common_live_commodities: 0,
live_commodity_ids: []
live_commodity_ids: [],
})
// 模板列表
......@@ -142,7 +142,7 @@ let templateList = $ref<{ id: string; name: string }[]>([])
const checked = ref(false)
function fetchInfo() {
getTripConfig({ experiment_id: props.data.id }).then(res => {
getTripConfig({ experiment_id: props.data.id }).then((res) => {
const data = res.data
if (data.itinerary?.id) {
templateList = [data.itinerary]
......@@ -154,15 +154,46 @@ function fetchInfo() {
}
const user_attr_config = {
is_all: data.user_attr_config.is_all,
items: data.user_attr_config.items.map((item: any) => item.id)
items: data.user_attr_config.items.map((item: any) => item.id),
}
const event_config = {
is_all: data.event_config.is_all,
items: data.event_config.items.map((item: any) => item.id)
items: data.event_config.items.map((item: any) => item.id),
}
const tag_ids = data.tags.map((item: any) => item.id)
const group_ids = data.groups.map((item: any) => item.id)
const material_ids = data.marketing_materials.map((item: any) => item.id)
// 递归合并配置
interface MenuItem {
id: number
name: string
is_checked: boolean
pid: number
children: MenuItem[]
}
const mergeConfig = (defaultItems: MenuItem[], backendItems: MenuItem[]): MenuItem[] => {
return defaultItems.map((defaultItem) => {
const backendItem = backendItems.find((item: MenuItem) => item.id === defaultItem.id)
if (backendItem) {
return {
...defaultItem,
is_checked: backendItem.is_checked,
children:
defaultItem.children.length > 0 ? mergeConfig(defaultItem.children, backendItem.children || []) : [],
}
}
return defaultItem
})
}
// Ensure auth_config structure is maintained
let authConfig = experimentConfig
if (data.auth_config && data.auth_config.length > 0) {
authConfig = mergeConfig(experimentConfig, data.auth_config)
}
Object.assign(form, {
itinerary_id: data.itinerary.id,
connect_ids,
......@@ -175,18 +206,17 @@ function fetchInfo() {
tag_ids,
group_ids,
material_ids,
auth_config: data.auth_config && data.auth_config.length > 0 ? data.auth_config : experimentConfig,
auth_config: authConfig,
live_commodity_ids: data?.live_commodities.reduce((a: any, b: any) => {
a.push(b.id)
return a
}, []),
is_use_common_live_commodities: data.is_use_common_live_commodities
is_use_common_live_commodities: data.is_use_common_live_commodities,
})
// checked
if (data.auth_config.length) {
checked.value = data.auth_config.find((item: any) => item.is_checked === false) ? false : true
}
// form.auth_config = data.auth_config.length > 0 ? data.auth_config : experimentConfig
})
}
watchEffect(() => fetchInfo())
......@@ -218,7 +248,7 @@ function handleSubmit() {
group_ids: JSON.stringify(form.group_ids),
material_ids: JSON.stringify(form.material_ids),
auth_config: JSON.stringify(form.auth_config),
live_commodity_ids: JSON.stringify(form.live_commodity_ids)
live_commodity_ids: JSON.stringify(form.live_commodity_ids),
}
params.itinerary_id = params.itinerary_id === '' ? (params.itinerary_id = '0') : params.itinerary_id
updateTripConfig(params).then(() => {
......@@ -293,8 +323,7 @@ const handleSelectAll = () => {
title="配置数字营销实验"
:close-on-click-modal="false"
width="1000px"
@update:modelValue="value => $emit('update:modelValue', value)"
>
@update:modelValue="(value) => $emit('update:modelValue', value)">
<el-form ref="formRef" :model="form" label-suffix=":">
<el-row justify="space-between">
<el-form-item label="实验名称">{{ data.name }}</el-form-item>
......@@ -315,8 +344,7 @@ const handleSelectAll = () => {
@change="handleItemCheck(item)"
v-model="cItem.is_checked"
:label="cItem.name"
size="large"
/>
size="large" />
</template>
</div>
<el-divider />
......@@ -344,8 +372,7 @@ const handleSelectAll = () => {
:label="item.name"
:value="item.id"
:key="item.id"
disabled
></el-option>
disabled></el-option>
</el-select>
</el-form-item>
</el-tab-pane>
......@@ -359,8 +386,7 @@ const handleSelectAll = () => {
v-model="form.user_attr_config.items"
multiple
style="margin-left: 40px"
v-if="!form.user_attr_config.is_all"
>
v-if="!form.user_attr_config.is_all">
<el-option v-for="item in userAttrList" :label="item.name" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
......@@ -373,8 +399,7 @@ const handleSelectAll = () => {
v-model="form.event_config.items"
multiple
style="margin-left: 40px"
v-if="!form.event_config.is_all"
>
v-if="!form.event_config.is_all">
<el-option v-for="item in metaEventList" :label="item.name" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论