优化商品和景点管理,调整状态显示及下拉加载逻辑

This commit is contained in:
钊钊 2024-12-27 15:12:57 +08:00
parent e3f734b8d3
commit d6b952ecc5
5 changed files with 30 additions and 23 deletions

View File

@ -116,7 +116,7 @@
</el-select> </el-select>
<span style="margin: 0px 10px;"> + </span> <span style="margin: 0px 10px;"> + </span>
<el-select v-model="item.goodsId" placeholder="请选择" style="width: 120px" <el-select v-model="item.goodsId" placeholder="请选择" style="width: 120px"
:disabled="dialog.type == 'preview'" clearable> :disabled="dialog.type == 'preview'" clearable @visible-change="getProductAllList">
<el-option v-for="item in productAllList" :key="item.id" :label="item.productName" :value="item.id" /> <el-option v-for="item in productAllList" :key="item.id" :label="item.productName" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -223,9 +223,9 @@ import { listProductCategory } from '@/api/manage/productCategory';
import { listVendor } from '@/api/manage/vendor'; import { listVendor } from '@/api/manage/vendor';
onMounted(() => { onMounted(() => {
getList(); getList();
getProductAllList(true); //
getlistVendor(); // getlistVendor(); //
getProductCategoryList(); // getProductCategoryList(); //
getProductAllList(); //
}); });
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const mkConfigList = ref<MkConfigVO[]>([]); const mkConfigList = ref<MkConfigVO[]>([]);
@ -505,14 +505,18 @@ const getlistVendor = async () => {
listVendorList.value = res.rows; listVendorList.value = res.rows;
} }
/** /**
* 商品列表 下拉选择 * 商品列表 下拉选择 //
*/ */
const productAllList=ref([]); const productAllList=ref([]);
const getProductAllList=()=>{ const getProductAllList=(e:any)=>{
console.log(e);
if (e) {
productAll({status:1}).then(res=>{ productAll({status:1}).then(res=>{
Object.assign(productAllList.value,res.data) Object.assign(productAllList.value,res.data)
}) })
} }
}
/** /**
* 格式化商品类别名称 * 格式化商品类别名称
* @param row * @param row

View File

@ -14,8 +14,9 @@
<!-- <el-input class="inputWidth" v-model="queryParams.sortNum" placeholder="请输入排序" clearable <!-- <el-input class="inputWidth" v-model="queryParams.sortNum" placeholder="请输入排序" clearable
@keyup.enter="handleQuery" /> --> @keyup.enter="handleQuery" /> -->
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="inputWidth"> <el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="inputWidth">
<el-option label="已上架" :value="1"></el-option>
<el-option label="未上架" :value="0"></el-option> <el-option label="未上架" :value="0"></el-option>
<el-option label="审核中" :value="1"></el-option>
<el-option label="已上架" :value="2"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -58,7 +59,8 @@
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.status == 0" type="info">未上架</el-tag> <el-tag v-if="scope.row.status == 0" type="info">未上架</el-tag>
<el-tag v-if="scope.row.status == 1" type="primary">已上架</el-tag> <el-tag v-if="scope.row.status == 1" type="success">审核中</el-tag>
<el-tag v-if="scope.row.status == 2" type="primary">已上架</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建者" align="center" prop="updateByName" /> <el-table-column label="创建者" align="center" prop="updateByName" />
@ -67,7 +69,7 @@
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="handleStatus(scope.row,'1')" v-if="scope.row.status == 0" <el-button link type="primary" @click="handleStatus(scope.row,'1')" v-if="scope.row.status == 0"
v-hasPermi="['manage:mkPostcard:edit']">上架</el-button> v-hasPermi="['manage:mkPostcard:edit']">上架</el-button>
<el-button link type="primary" @click="handleStatus(scope.row,'0')" v-if="scope.row.status == 1" <el-button link type="primary" @click="handleStatus(scope.row,'0')" v-if="scope.row.status == 2"
v-hasPermi="['manage:mkPostcard:edit']">下架</el-button> v-hasPermi="['manage:mkPostcard:edit']">下架</el-button>
<el-tooltip content="编辑" placement="top" v-if="scope.row.status == 0"> <el-tooltip content="编辑" placement="top" v-if="scope.row.status == 0">
<el-button link type="primary" @click="handleUpdate(scope.row)" <el-button link type="primary" @click="handleUpdate(scope.row)"
@ -90,7 +92,7 @@
<el-input v-model="form.name" placeholder="请输入明信片名称" /> <el-input v-model="form.name" placeholder="请输入明信片名称" />
</el-form-item> </el-form-item>
<el-form-item label="关联景点" prop="articleId"> <el-form-item label="关联景点" prop="articleId">
<el-select v-model="form.articleId" placeholder="请选择关联景点" clearable> <el-select v-model="form.articleId" placeholder="请选择关联景点" clearable @visible-change="getContentAll">
<el-option v-for="(item,index) in contentAllList" :key="item.id" :label="item.name" <el-option v-for="(item,index) in contentAllList" :key="item.id" :label="item.name"
:value="item.id"></el-option> :value="item.id"></el-option>
</el-select> </el-select>
@ -215,10 +217,12 @@ const getList = async () => {
* 查询景点下拉列表 * 查询景点下拉列表
*/ */
const contentAllList= ref([]); const contentAllList= ref([]);
const getContentAll = async () => { const getContentAll = async (e:any) => {
if (e) {
const res = await contentAll({type:'0',status:2}); const res = await contentAll({type:'0',status:2});
Object.assign(contentAllList.value, res); Object.assign(contentAllList.value, res);
} }
}
/** 取消按钮 */ /** 取消按钮 */
const cancel = () => { const cancel = () => {
reset(); reset();
@ -355,7 +359,6 @@ const handlePostcard = async (row:MkPostcardVO)=>{
} }
onMounted(() => { onMounted(() => {
getList(); getList();
getContentAll();
nextTick(() => { nextTick(() => {
autoTableHeight.value = proxy?.autoTableHeight(); autoTableHeight.value = proxy?.autoTableHeight();
}); });

View File

@ -53,9 +53,9 @@
<el-table-column label="排序" align="center" prop="sortNum" /> <el-table-column label="排序" align="center" prop="sortNum" />
<el-table-column label="商品状态" align="center" prop="status"> <el-table-column label="商品状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<!-- <dict-tag :options="sys_shelf_status" :value="scope.row.status" /> --> <dict-tag :options="sys_shelf_status" :value="scope.row.status" />
<el-tag v-if="scope.row.status == 0" type="info">未上架</el-tag> <!-- <el-tag v-if="scope.row.status == 0" type="info">未上架</el-tag>
<el-tag v-if="scope.row.status == 1" type="primary">已上架</el-tag> <el-tag v-if="scope.row.status == 1" type="primary">已上架</el-tag> -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="vendorId"> <el-table-column label="供应商" align="center" prop="vendorId">
@ -76,7 +76,7 @@
<el-button link type="primary" @click="handleStatus(scope.row,'1')" v-hasPermi="['manage:product:edit']" <el-button link type="primary" @click="handleStatus(scope.row,'1')" v-hasPermi="['manage:product:edit']"
v-if="scope.row.status==0">上架</el-button> v-if="scope.row.status==0">上架</el-button>
<el-button link type="primary" @click="handleStatus(scope.row,'0')" v-hasPermi="['manage:product:edit']" <el-button link type="primary" @click="handleStatus(scope.row,'0')" v-hasPermi="['manage:product:edit']"
v-if="scope.row.status==1">下架</el-button> v-if="scope.row.status==2">下架</el-button>
<el-tooltip content="编辑" placement="top" v-if="scope.row.status==0"> <el-tooltip content="编辑" placement="top" v-if="scope.row.status==0">
<el-button link type="primary" @click="handleUpdate(scope.row)" <el-button link type="primary" @click="handleUpdate(scope.row)"
v-hasPermi="['manage:product:edit']">编辑</el-button> v-hasPermi="['manage:product:edit']">编辑</el-button>

View File

@ -112,15 +112,15 @@
</el-table-column> </el-table-column>
<el-table-column label="相关笔记" align="center" prop="recommendNotebookCount"> <el-table-column label="相关笔记" align="center" prop="recommendNotebookCount">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" v-if="scope.row.status!==3" @click="handleNote(scope.row)">1{{ <el-button link type="primary" v-if="scope.row.status!==3" @click="handleNote(scope.row)">{{
scope.row.pubNotebookCount }}</el-button> scope.row.recommendNotebookCount }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="queryParams.type == '0' ?'景点评论数':queryParams.type == '1' ?'租车评论数':'游艇评论数'" align="center" <el-table-column :label="queryParams.type == '0' ?'景点评论数':queryParams.type == '1' ?'租车评论数':'游艇评论数'" align="center"
prop="commentCount" width="90px"> prop="commentCount" width="90px">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" v-if="scope.row.status!==3" @click="handleNote(scope.row)">1{{ <el-button link type="primary" v-if="scope.row.status!==3" @click="handleNote(scope.row)">1{{
scope.row.notebookCommentCount }}</el-button> scope.row.commentCount }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="queryParams.type == '0' ?'景点喜欢数':queryParams.type == '1' ?'租车喜欢数':'游艇喜欢数'" align="center" <el-table-column :label="queryParams.type == '0' ?'景点喜欢数':queryParams.type == '1' ?'租车喜欢数':'游艇喜欢数'" align="center"

View File

@ -213,7 +213,7 @@ const submitForm = () => {
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row?: TagVO) => { const handleDelete = async (row?: TagVO) => {
const _ids = row?.id || ids.value; const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除标签编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); await proxy?.$modal.confirm('是否确认删除标签名称为"' + row.title + '"的数据项?').finally(() => (loading.value = false));
await delTag(_ids); await delTag(_ids);
proxy?.$modal.msgSuccess('删除成功'); proxy?.$modal.msgSuccess('删除成功');
await getList(); await getList();