Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4b7f659a1 |
No files matched your search
@@ -37,7 +37,7 @@ const props = defineProps<{
|
|||||||
carousal: {} | number
|
carousal: {} | number
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
success: [string]
|
success: [void]
|
||||||
}>()
|
}>()
|
||||||
const formRef = ref<FormInstanceFunctions | null>(null)
|
const formRef = ref<FormInstanceFunctions | null>(null)
|
||||||
const headerText = computed(() => `${props.isEdit ? '编辑' : '创建'}${props.headerTitle || ''}`)
|
const headerText = computed(() => `${props.isEdit ? '编辑' : '创建'}${props.headerTitle || ''}`)
|
||||||
@@ -118,14 +118,43 @@ const fetchSaveCarousalData = async () => {
|
|||||||
/* TODO: 校验通过保存分类数据 */
|
/* TODO: 校验通过保存分类数据 */
|
||||||
handleFormTypeData()
|
handleFormTypeData()
|
||||||
// console.log(formType.value,'formType')
|
// console.log(formType.value,'formType')
|
||||||
let res
|
formType.value === 'create' ? await createCarousalData() : await updateCarousalData()
|
||||||
|
// let res
|
||||||
switch (formType.value){
|
//
|
||||||
case 'create':
|
// switch (formType.value){
|
||||||
res = await createCarousal(carousalData.value)
|
// case 'create':
|
||||||
|
// res = await createCarousal(carousalData.value)
|
||||||
|
// emit('success')
|
||||||
|
// break;
|
||||||
|
// case 'update':
|
||||||
|
// const fieldsToKeep = ["imageUrl", "targetType", "targetUrl", "targetId"];
|
||||||
|
// const requestObj = {};
|
||||||
|
//
|
||||||
|
// for (const field of fieldsToKeep) {
|
||||||
|
// if (carousalData.value[field]!== null && carousalData.value[field]!== undefined) {
|
||||||
|
// requestObj[field] = carousalData.value[field];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// handleFormTypeData()
|
||||||
|
// res = await updateCarousalItem(carousalData.value.id,requestObj)
|
||||||
|
// emit('success')
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// res = await createCarousal(carousalData.value)
|
||||||
|
// emit('success')
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// const createCarousalApi = createCarousal(carousalData.value)
|
||||||
|
// console.log(createCarousalApi,'createCarousalApi')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const createCarousalData = async () => {
|
||||||
|
await createCarousal(carousalData.value)
|
||||||
emit('success')
|
emit('success')
|
||||||
break;
|
}
|
||||||
case 'update':
|
const updateCarousalData = async () => {
|
||||||
const fieldsToKeep = ["imageUrl", "targetType", "targetUrl", "targetId"];
|
const fieldsToKeep = ["imageUrl", "targetType", "targetUrl", "targetId"];
|
||||||
const requestObj = {};
|
const requestObj = {};
|
||||||
|
|
||||||
@@ -135,19 +164,8 @@ const fetchSaveCarousalData = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleFormTypeData()
|
handleFormTypeData()
|
||||||
res = await updateCarousalItem(carousalData.value.id,requestObj)
|
await updateCarousalItem(carousalData.value.id, requestObj)
|
||||||
emit('success')
|
emit('success')
|
||||||
break;
|
|
||||||
default:
|
|
||||||
res = await createCarousal(carousalData.value)
|
|
||||||
emit('success')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// const createCarousalApi = createCarousal(carousalData.value)
|
|
||||||
// console.log(createCarousalApi,'createCarousalApi')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const handleCloseDialog = () => {
|
const handleCloseDialog = () => {
|
||||||
// 数据&&规则校验结果重置
|
// 数据&&规则校验结果重置
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<t-dialog
|
<t-dialog
|
||||||
width="40%"
|
width="40%"
|
||||||
:header="headerText"
|
:header="header"
|
||||||
:confirmBtn="confirmBtnText"
|
:confirmBtn="confirmBtn"
|
||||||
:closeOnOverlayClick="false"
|
:closeOnOverlayClick="false"
|
||||||
@close="handleCloseDialog"
|
@close="handleCloseDialog"
|
||||||
@confirm="SaveCategoryData"
|
@confirm="SaveCategoryData"
|
||||||
|
|||||||
Reference in new issue
Block a user