提交 84f37b52 authored 作者: lhh's avatar lhh

update

上级 7b1d6b14
const experimentConfig: any = [ <script setup lang="ts">
{ import type { FormInstance, FormRules } from 'element-plus'
id: 1, import { ElMessage } from 'element-plus'
name: '基础配置', import { pick } from 'lodash-es'
is_checked: true, import { updateExam, getAllExamList } from '../api'
pid: 0,
children: [ interface Props {
{ id: 2, name: '连接管理', is_checked: true, pid: 1, children: [] }, id: string
{ id: 3, name: '用户属性管理', is_checked: true, pid: 1, children: [] }, data?: any
{ id: 4, name: '事件属性管理', is_checked: true, pid: 1, children: [] } type: string
] }
}, const props = defineProps<Props>()
{
id: 5, const emit = defineEmits<{
name: '营销策划', (e: 'update'): void
is_checked: true, (e: 'update:modelValue', visible: boolean): void
pid: 0, }>()
children: []
}, const formRef = ref<FormInstance>()
{ const form = reactive<any>({
id: 6, experiment_id: props.id,
name: '用户画像', exam_id: ''
is_checked: true, })
pid: 0, watchEffect(() => {
children: [] if (!props.data) return
}, Object.assign(form, props.data)
{ })
id: 7,
name: '用户识别', const rules = ref<FormRules>({
is_checked: true, exam_id: [{ required: true, message: '请选择考试', trigger: 'change' }]
pid: 0, })
children: [ const isUpdate = $computed(() => {
{ id: 8, name: '标签管理', is_checked: true, pid: 7, children: [] }, return !!props.data?.id
{ id: 9, name: '群组管理', is_checked: true, pid: 7, children: [] } })
] const title = computed(() => {
}, return isUpdate ? '编辑理论考试' : '新增理论考试'
{ })
id: 10,
name: '营销内容设计', const examList = ref<Record<string, any>[]>([])
is_checked: true, // 获取关联考试列表
pid: 0, function fetchExamList() {
children: [ getAllExamList({ project: 'x1', 'per-page': 1000 }).then(res => {
{ id: 11, name: '文本资料管理', is_checked: true, pid: 10, children: [] }, examList.value = res.data.list || []
{ id: 12, name: '图片资料管理', is_checked: true, pid: 10, children: [] }, })
{ id: 13, name: '卡券资料管理', is_checked: true, pid: 10, children: [] }, }
{ id: 14, name: '视频资料管理', is_checked: true, pid: 10, children: [] }, onMounted(() => {
{ id: 15, name: 'H5资料管理', is_checked: true, pid: 10, children: [] }, fetchExamList()
{ id: 16, name: '二维码资料管理', is_checked: true, pid: 10, children: [] }, })
{ id: 17, name: '语言资料管理', is_checked: true, pid: 10, children: [] }, // 提交
{ id: 18, name: '小程序资料管理', is_checked: true, pid: 10, children: [] } function handleSubmit() {
] formRef.value?.validate().then(() => {
}, const params = Object.assign({ type: props.type }, pick(form, ['experiment_id', 'exam_id']))
{ isUpdate ? handleUpdate(params) : handleUpdate(params)
id: 19, })
name: '自动化营销', }
is_checked: true,
pid: 0, // 修改
children: [] function handleUpdate(params: any) {
}, params.id = props.data?.id
{ updateExam(params).then(() => {
id: 20, ElMessage({ message: '修改成功', type: 'success' })
name: '直播带货', emit('update')
is_checked: true, emit('update:modelValue', false)
pid: 0, })
children: [ }
{ id: 21, name: '商品品类管理', is_checked: true, pid: 20, children: [] }, </script>
{ id: 22, name: '商品属性管理', is_checked: true, pid: 20, children: [] },
{ id: 23, name: '商品管理', is_checked: true, pid: 20, children: [] }, <template>
{ id: 24, name: '直播练习', is_checked: true, pid: 20, children: [] }, <el-dialog
{ id: 25, name: '直播话术管理', is_checked: true, pid: 20, children: [] } :title="title"
] :close-on-click-modal="false"
}, width="600px"
{ @update:modelValue="value => $emit('update:modelValue', value)"
id: 26, >
name: '数据分析', <el-form ref="formRef" :model="form" :rules="rules" label-width="90px">
is_checked: true, <el-form-item label="考试名称" prop="exam_id">
pid: 0, <el-select v-model="form.exam_id" filterable style="width: 100%">
children: [ <el-option v-for="item in examList" :key="item.exam_id" :label="item.name" :value="item.exam_id"></el-option>
{ id: 27, name: '用户分析', is_checked: true, pid: 26, children: [] }, </el-select>
{ id: 28, name: '标签群组分析', is_checked: true, pid: 26, children: [] }, </el-form-item>
{ id: 29, name: '事件分析', is_checked: true, pid: 26, children: [] }, <el-row justify="center">
{ id: 30, name: '营销分析', is_checked: true, pid: 26, children: [] } <el-button type="primary" round auto-insert-space @click="handleSubmit">保存</el-button>
] <el-button round auto-insert-space @click="$emit('update:modelValue', false)">取消</el-button>
} </el-row>
] </el-form>
\ No newline at end of file </el-dialog>
</template>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论