feat: 解决上架问题

This commit is contained in:
duan
2025-03-07 18:30:30 +08:00
parent 8e52613f08
commit 0bd38e29c5
5 changed files with 30 additions and 25 deletions

View File

@@ -743,6 +743,7 @@ function handleOperat(data: IOperatData) {
// 属性修改
function handleModify(field: string, value: boolean | string | number, row: Record<string, any>) {
console.log(1111111111111111111111111)
if (props.contentConfig.modifyAction) {
props.contentConfig.modifyAction({
[pk]: row[pk],

View File

@@ -26,6 +26,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
// },
// exportAction: UserAPI.export,
modifyAction: function (params) {
console.log(1111112222222222222)
let obj = { sort: "1", ...params }
return UserAPI.update(obj);
},

View File

@@ -11,20 +11,20 @@
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
<template #status="scope">
<!-- <template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
</el-tag>
</template>
</template> -->
<template #type="scope">
{{ typeFilter(scope.row[scope.prop]) }}
</template>
<template #gender="scope">
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
</template>
<template #switchs="scope">
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0" active-text="启用"
inactive-text="禁用" @change="handleSwitchChange"></el-switch>
<template #shangjia="scope">
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
@click="handleSwitchChange(scope.row)"></el-switch>
</template>
<template #mobile="scope">
<el-text>{{ scope.row[scope.prop] }}</el-text>
@@ -56,13 +56,13 @@
</MyDialog>
</template>
<template v-else>
<page-content ref="contentRef" :content-config="contentConfig2" @operat-click="handleOperatClick">
<!-- <page-content ref="contentRef" :content-config="contentConfig2" @operat-click="handleOperatClick">
<template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
</el-tag>
</template>
</page-content>
</page-content> -->
</template>
</div>
</template>
@@ -108,9 +108,14 @@ async function handleAddClick() {
// addModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
}
// 上架
function handleSwitchChange(val: boolean, row: IObject) {
console.log(val, row);
// UserAPI.updateById({ id: row.id, isSale: val ? 1 : 0 });
function handleSwitchChange(data: any) {
console.log(data, '条似乎22222')
let obj = {
type: data.isGrounding ? 'sku' : 'product',
id: data.id,
isSale: data.status
}
UserAPI.onOff(obj);
}
// 编辑
async function handleEditClick(row: IObject) {

View File

@@ -771,11 +771,9 @@ const submitForm = async (formEl: FormInstance | undefined) => {
"title": "新增商品",
"path": "/product/addgoods",
"fullPath": "/product/addgoods",
"affix": false,
"keepAlive": true,
"query": {}
})
router.push({ name: 'productIndex' });
router.push('/product/index');
}, 500);
} else {
ElMessage.error("请填写完整信息");

View File

@@ -37,19 +37,19 @@ const contentConfig: IContentConfig<UserPageQuery> = {
})
})
},
modifyAction: function (data) {
let obj = {
type: data.isGrounding ? 'sku' : 'product',
id: data.id,
isSale: data.value
}
return UserAPI.onOff(obj);
},
// modifyAction: function (data) {
// let obj = {
// type: data.isGrounding ? 'sku' : 'product',
// id: data.id,
// isSale: data.value
// }
// return null
// },
deleteAction: UserAPI.deleteByIds,
importsAction(data) {
// 模拟导入数据
console.log("importsAction", data);
return Promise.resolve();
// console.log("importsAction", data);
// return Promise.resolve();
},
exportsAction: async function (params) {
// 模拟获取到的是全量数据
@@ -83,8 +83,8 @@ const contentConfig: IContentConfig<UserPageQuery> = {
label: "上架",
align: "center",
prop: "status",
templet: "switch",
slotName: "status",
templet: "custom",
slotName: "shangjia",
},
{
label: "操作",