This commit is contained in:
2025-03-11 11:36:34 +08:00
6 changed files with 29 additions and 6 deletions

View File

@@ -3,7 +3,8 @@
<myDialog title="选择商品" width="50%" ref="myDialogRef" @Confirm="subitgood"> <myDialog title="选择商品" width="50%" ref="myDialogRef" @Confirm="subitgood">
<page-search ref="searchRef" :search-config="searchConfig" @query-click="handleQueryClick" <page-search ref="searchRef" :search-config="searchConfig" @query-click="handleQueryClick"
@reset-click="handleResetClick" /> @reset-click="handleResetClick" />
<page-content ref="contentRef" :content-config="contentConfig" @filter-change="handleFilterChange"> <page-content ref="contentRef" v-if="switchref" :content-config="contentConfig"
@filter-change="handleFilterChange">
<template #status="scope"> <template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'"> <el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }} {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
@@ -43,13 +44,16 @@ const {
handleFilterChange, handleFilterChange,
} = usePage(); } = usePage();
let myDialogRef: any = ref(null) let myDialogRef: any = ref(null)
let switchref = ref(false)
function opens() { function opens() {
switchref.value = true
myDialogRef.value.open() myDialogRef.value.open()
} }
const emit = defineEmits(['success']) const emit = defineEmits(['success'])
// 添加商品的回调 // 添加商品的回调
function subitgood() { function subitgood() {
emit('success', contentRef.value?.getselectTable()) emit('success', contentRef.value?.getselectTable())
switchref.value = false
myDialogRef.value.close() myDialogRef.value.close()
} }
defineExpose({ opens }) defineExpose({ opens })

View File

@@ -45,6 +45,15 @@ const modalConfig: IModalConfig<UserForm> = {
}, },
initialValue: 1, initialValue: 1,
}, },
{
label: "排序",
prop: "sort",
type: "input-number",
attrs: {
placeholder: "请输入排序",
},
initialValue: 1,
}
], ],
}; };
export interface UserForm { } export interface UserForm { }

View File

@@ -15,7 +15,7 @@ const modalConfig: IModalConfig<UserForm> = {
pk: "id", pk: "id",
formAction: function (data) { formAction: function (data) {
return UserAPI.update({ ...data, sort: '1' }); return UserAPI.update({ ...data });
}, },
beforeSubmit(data) { beforeSubmit(data) {
console.log("提交之前处理", data); console.log("提交之前处理", data);
@@ -49,6 +49,15 @@ const modalConfig: IModalConfig<UserForm> = {
}, },
initialValue: 1, initialValue: 1,
}, },
{
label: "排序",
prop: "sort",
type: "input-number",
attrs: {
placeholder: "请输入排序",
},
initialValue: 1,
}
], ],
}; };
/** 用户表单类型 */ /** 用户表单类型 */

View File

@@ -113,7 +113,7 @@ function handleSwitchChange(data: any) {
let obj = { let obj = {
type: data.isGrounding ? 'sku' : 'product', type: data.isGrounding ? 'sku' : 'product',
id: data.id, id: data.id,
isSale: data.status isSale: data.isSale
} }
UserAPI.onOff(obj); UserAPI.onOff(obj);
} }

View File

@@ -771,10 +771,11 @@ const submitForm = async (formEl: FormInstance | undefined) => {
"title": "新增商品", "title": "新增商品",
"path": "/product/addgoods", "path": "/product/addgoods",
"fullPath": "/product/addgoods", "fullPath": "/product/addgoods",
"query": {}
}) })
router.push('/product/index');
}, 500); }, 500);
setTimeout(() => {
router.push({ path: '/product/index' });
}, 1000);
} else { } else {
ElMessage.error("请填写完整信息"); ElMessage.error("请填写完整信息");
console.log('error submit!', fields) console.log('error submit!', fields)

View File

@@ -82,7 +82,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
{ {
label: "上架", label: "上架",
align: "center", align: "center",
prop: "status", prop: "isSale",
templet: "custom", templet: "custom",
slotName: "shangjia", slotName: "shangjia",
}, },