优化接口参数类型及UI显示细节

This commit is contained in:
2024-12-26 11:47:45 +08:00
parent dfda574ca2
commit 648ceef0e6
16 changed files with 169 additions and 93 deletions
+16 -10
View File
@@ -40,7 +40,12 @@
<el-table v-loading="loading" :height="autoTableHeight" border :data="articleList"
@selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="ID" align="center" prop="id" v-if="true" width="180px" />
<!-- <el-table-column label="ID" align="center" prop="id" v-if="true" width="180px" /> -->
<el-table-column fixed label="序号" align="center" width="80">
<template #default="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="标题" align="center" prop="title" />
<el-table-column label="内容" align="center" prop="content" width="80px">
<template #default="scope">
@@ -58,7 +63,7 @@
<template #default="scope">
<el-tag v-if="scope.row.status == 0" type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 1" type="success">审核中</el-tag>
<el-tag v-if="scope.row.status == 2" type="success">已发布</el-tag>
<el-tag v-if="scope.row.status == 2" type="primary">已发布</el-tag>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime" width="120">
@@ -69,9 +74,9 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160px">
<template #default="scope">
<el-button link type="primary" v-if="scope.row.status == 0" @click="updateRow(scope.row,'2')"
<el-button link type="primary" v-if="scope.row.status == 0" @click="updateRow(scope.row,1)"
v-hasPermi="['manage:article:edit']">发布</el-button>
<el-button link type="primary" v-if="scope.row.status == 2" @click="updateRow(scope.row,'0')"
<el-button link type="primary" v-if="scope.row.status == 2" @click="updateRow(scope.row,0)"
v-hasPermi="['manage:article:edit']">撤销发布</el-button>
<el-tooltip content="编辑" placement="top" v-if="scope.row.status == 0">
<el-button link type="primary" @click="handleUpdate(scope.row)"
@@ -88,7 +93,7 @@
<pagination id="table_page" v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getList" />
<!-- 添加或修改文章对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="700px" append-to-body>
<el-dialog :title="dialog.title" v-model="dialog.visible" :width="dialogWidth" append-to-body>
<el-form ref="articleFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文章标题" prop="title">
<el-input v-model="form.title" placeholder="请输入文章标题" />
@@ -131,7 +136,7 @@
import { listTag,tagAll } from '@/api/manage/tag';
import { listArticle, getArticle, delArticle, addArticle, updateArticle } from '@/api/manage/article';
import { ArticleVO, ArticleQuery, ArticleForm } from '@/api/manage/article/types';
const dialogWidth=ref(window.innerWidth*0.6+'px');
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const sys_user_tagOptions = ref([]); //标签库
const autoTableHeight = ref<number>(750);
@@ -286,11 +291,12 @@ const handleUpdate = async (row?:any) => {
* @param row 发布,撤销发布
* @param type
*/
const updateRow = async (row: any, type: string) => {
await proxy?.$modal.confirm('是否确认' + (type == '0' ? '撤销发布' : '发布') + '名称为"' + row.title + '"的数据项?');
row.status = type;
const updateRow = async (row: any, type: number) => {
await proxy?.$modal.confirm('是否确认' + (type == 0 ? '撤销发布' : '发布') + '名称为"' + row.title + '"的数据项?');
Object.assign(form.value, row);
form.value.status = type;
buttonLoading.value = true;
await updateArticle(row).finally(() => (buttonLoading.value = false));
await updateArticle(form.value).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
getList();
};
+1 -1
View File
@@ -44,7 +44,7 @@
<el-table-column label="状态" align="center" prop="" width="90px">
<template #default="scope">
<el-tag v-if="scope.row.status == 0" type="info">未上架</el-tag>
<el-tag v-if="scope.row.status == 1" type="success">已上架</el-tag>
<el-tag v-if="scope.row.status == 1" type="primary">已上架</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px">
+18 -9
View File
@@ -48,13 +48,22 @@
<el-table :height="autoTableHeight" v-loading="loading" :data="dyUserList" @selection-change="handleSelectionChange"
style="width: 100%" border>
<!-- <el-table-column fixed type="selection" width="55" align="center" /> -->
<el-table-column fixed label="用户ID" align="center" prop="id" />
<el-table-column fixed label="序号" align="center" width="80">
<template #default="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<!-- <el-table-column fixed label="用户ID" align="center" prop="id" /> -->
<el-table-column fixed label="帐号状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="dy_user_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column fixed label="会员等级" align="center" prop="levelName" />
<el-table-column fixed label="会员等级" align="center" prop="levelId">
<template #default="scope">
<span>{{ levelList.find(item => item.id === scope.row.levelId)?.levelName }}</span>
</template>
</el-table-column>
<el-table-column fixed label="昵称" align="center" prop="nickName" />
<el-table-column label="用户性别" align="center" prop="sex">
<template #default="scope">
@@ -134,7 +143,7 @@
</el-table-column>
<el-table-column width="80" label="处理方式" align="center" prop="">
<template #default="scope">
<dict-tag :options="dy_user_status" :value="scope.row.status" />
<dict-tag v-if="scope.row.status!=0" :options="dy_user_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column width="150" label="封禁理由" align="center" prop="reason" show-overflow-tooltip>
@@ -142,9 +151,9 @@
<dict-tag :options="dy_user_ban_mode" :value="scope.row.reason" />
</template>
</el-table-column>
<el-table-column width="80" label="封禁天数" align="center" prop="banDays">
<el-table-column width="80" label="封禁天数" align="center" prop="">
<template #default="scope">
<dict-tag :options="dy_user_ban_days" :value="scope.row.banDays" />
<dict-tag v-if="scope.row.banDays!='0'" :options="dy_user_ban_days" :value="scope.row.banDays" />
</template>
</el-table-column>
<el-table-column width="90" label="操作人" align="center" prop="" />
@@ -173,8 +182,8 @@
</el-form-item>
<el-form-item label="处理方式" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in dy_user_status" :key="dict.value" :label="dict.label"
:value="parseInt(dict.value)">{{ dict.label }}</el-radio>
<el-radio v-for="dict in dy_user_status" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"
v-show="dict.value != '0'">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="处理天数" prop="banDays">
@@ -514,8 +523,8 @@ const handleStatus = async (row: DyUserVO) => {
await proxy?.$modal.confirm('是否确认解封用户昵称为"' + row.nickName + '"的数据项?')
Object.assign(form.value, row);
form.value.status = 0;
form.value.reason = null;
form.value.banDays=null
form.value.reason = '';
form.value.banDays='0';
loading.value = true;
await updateDyUser(form.value).finally(() => (loading.value = false));
proxy?.$modal.msgSuccess('操作成功');
+6 -4
View File
@@ -12,8 +12,9 @@
<el-form-item label="发布状态" prop="status">
<el-select v-model="queryParams.status" class="inputWidth" placeholder="请选择发布状态" clearable
@keyup.enter="handleQuery">
<el-option label="已发布" :value="1" />
<el-option label="未发布" :value="0" />
<el-option label="审核中" :value="1" />
<el-option label="已发布" :value="2" />
</el-select>
</el-form-item>
<el-form-item>
@@ -41,8 +42,9 @@
<el-table-column label="排序" align="center" prop="shor" />
<el-table-column label="发布状态" align="center" prop="status">
<template #default="scope">
<el-tag v-if="scope.row.status == 1" type="success">发布</el-tag>
<el-tag v-else type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 0" type="info">发布</el-tag>
<el-tag v-else-if="scope.row.status == 1" type="success">审核中</el-tag>
<el-tag v-else-if="scope.row.status == 1" type="primary">已发布</el-tag>
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="createName" />
@@ -244,7 +246,7 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: IpImageVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除IP形象编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
await proxy?.$modal.confirm('是否确认删除IP形象为"' + row.ipName + '"的数据项?').finally(() => loading.value = false);
await delIpImage(_ids);
proxy?.$modal.msgSuccess("删除成功");
await getList();
+2 -1
View File
@@ -37,7 +37,8 @@
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<span>{{ scope.row.status == 0 ? '未发布' : '已发布' }}</span>
<el-tag v-if="scope.row.status == 0" type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 1" type="primary">已发布</el-tag>
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="createName" />
+2 -1
View File
@@ -53,7 +53,8 @@
<!-- 0-未上架 1-已上架 -->
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<span>{{ scope.row.status == 1 ? '已上架' : '未上架'}}</span>
<el-tag v-if="scope.row.status == 0" type="info">未上架</el-tag>
<el-tag v-if="scope.row.status == 1" type="primary">已上架</el-tag>
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="updateByName" />
+13 -6
View File
@@ -71,7 +71,11 @@
</template>
</el-table-column>
<el-table-column label="订单号" align="center" prop="orderNumber" />
<el-table-column label="来源" align="center" prop="source" width="80px" />
<el-table-column label="来源" align="center" prop="source" width="80px">
<template #default="scope">
<dict-tag :options="dy_order_source" :value="scope.row.source" />
</template>
</el-table-column>
<el-table-column label="商品名称" align="center" prop="productName" />
<el-table-column label="商品图片" align="center" prop="productImageUrl" width="100">
<template #default="scope">
@@ -86,7 +90,9 @@
<el-table-column label="供应商" align="center" prop="vendorId" />
<el-table-column label="订单状态" align="center" prop="orderStatus">
<template #default="scope">
<dict-tag :options="dy_order_status" :value="scope.row.orderStatus" />
<!-- <dict-tag :options="dy_order_status" :value="scope.row.orderStatus" /> -->
<el-tag v-if="scope.row.orderStatus == 0" type="info">未发货</el-tag>
<el-tag v-if="scope.row.orderStatus == 1" type="primary">已发货</el-tag>
</template>
</el-table-column>
<el-table-column label="物流名称" align="center" prop="logisticsName" />
@@ -94,8 +100,8 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" v-if="scope.row.orderStatus == 0" v-hasPermi="['manage:orders:edit']"
@click="handleOrderStatus(scope.row,'1')">发货</el-button>
<el-button link type="primary" @click="handleOrderStatus(scope.row,'0')" v-if="scope.row.orderStatus == 1"
@click="handleOrderStatus(scope.row,1)">发货</el-button>
<el-button link type="primary" @click="handleOrderStatus(scope.row,0)" v-if="scope.row.orderStatus == 1"
v-hasPermi="['manage:orders:edit']">撤销发货</el-button>
</template>
</el-table-column>
@@ -267,9 +273,10 @@ const handleAdd = () => {
*/
const handleOrderStatus = async (row: OrdersVO,type:string|number) => {
await proxy?.$modal.confirm('是否确认' + (type == '0' ? '撤销发货' : '发货') + '商品名称为"' + row.productName + '"的数据项?');
row.orderStatus = type;
Object.assign(form.value, row);
form.value.orderStatus = type;
buttonLoading.value = true;
await updateOrders(row).finally(() => (buttonLoading.value = false));
await updateOrders(form.value).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
getList();
}
+9 -2
View File
@@ -32,7 +32,12 @@
<el-table v-loading="loading" border :height="autoTableHeight" :data="productList"
@selection-change="handleSelectionChange">
<el-table-column label="商品ID" align="center" prop="id" v-if="true" width="180px" />
<!-- <el-table-column label="商品ID" align="center" prop="id" v-if="true" width="180px" /> -->
<el-table-column fixed label="序号" align="center" width="80">
<template #default="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" align="center" prop="productName" />
<el-table-column label="商品类别" align="center" prop="categoryId">
<template #default="scope">
@@ -48,7 +53,9 @@
<el-table-column label="排序" align="center" prop="sortNum" />
<el-table-column label="商品状态" align="center" prop="status">
<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 == 1" type="primary">已上架</el-tag>
</template>
</el-table-column>
<el-table-column label="供应商" align="center" prop="vendorId">
+2 -2
View File
@@ -133,7 +133,7 @@ const productCategoryFormRef = ref<ElFormInstance>();
const wishParams = reactive({
pageNum: 1,
pageSize: 10,
id: undefined,
productCategoryId: undefined,
})
const dialog = reactive<DialogOption>({
visible: false,
@@ -274,7 +274,7 @@ const handleMakeWish = async (row: ProductCategoryVO) => {
return
}
loading.value = true;
wishParams.id= row.id;
wishParams.productCategoryId= row.id;
getWishUserList();
makeWish.visible = true;
}
+20 -15
View File
@@ -130,9 +130,9 @@
<template #default="scope">
<!-- <span>{{ scope.row.status == 0 ? '未发布' : scope.row.status == 1 ? '审核中' : scope.row.status == 2 ? '已发布' : '草稿' }}</span> -->
<el-tag v-if="scope.row.status == 0" type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 1" type="warning">审核中</el-tag>
<el-tag v-if="scope.row.status == 2" type="success">已发布</el-tag>
<el-tag v-if="scope.row.status == 3" type="danger">草稿</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>
<el-tag v-if="scope.row.status == 3" type="warning">草稿</el-tag>
</template>
</el-table-column>
<el-table-column label="操作人" align="center" prop="updateByName" width="120px" />
@@ -226,7 +226,8 @@
</el-col>
<el-col :span="12">
<el-form-item label="标签" prop="tagId_copy">
<el-select class="inputWidth" v-model="form.tagId_copy" multiple filterable placeholder="请选择标签" clearable>
<el-select class="inputWidth" v-model="form.tagId_copy" multiple filterable placeholder="请选择标签" clearable
@visible-change="getTagList">
<el-option v-for="dict in sys_user_tagOptions" :key="dict.id" :label="dict.title"
:value="String(dict.id)" />
</el-select>
@@ -602,6 +603,11 @@ const getTag = async () => {
const res = await tagAll();
sys_user_tagOptions.value = res; //标签库
};
const getTagList = async (visible: boolean) => {
if (visible) {
getTag(); //标签库
}
}
//输入位置,搜索位置
const performSearch = async (text) => {
// 这里简单模拟延迟,模拟真实的异步请求耗时
@@ -618,21 +624,20 @@ const performSearch = async (text) => {
jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?address=${text}&key=${'6XFBZ-SAVLT-JGIX2-VOLMK-6S2H3-XUBGO'}&output=jsonp`, {}).then((data) => {
console.log(data);
if (data.status == 0) {
center.value.lat = data.result.location.lat;
center.value.lng = data.result.location.lng;
form.value.address =
data.result.address_components.province +
data.result.address_components.city +
data.result.address_components.district +
data.result.address_components.street +
data.result.address_components.street_number;
data.result.address_components.province +
data.result.address_components.city +
data.result.address_components.district +
data.result.address_components.street +
data.result.address_components.street_number;
form.value.latitude = data.result.location.lat;
form.value.longitude = data.result.location.lng;
form.value.region = data.result.ad_info.adcode; //行政区划编码
form.value.regionCode = data.result.ad_info.adcode; //行政区划编码
// form.value.province = data.result.address_components.province;
// form.value.city = data.result.address_components.city;
center.value = { lat: data.result.location.lat, lng: data.result.location.lng };
geometries.value = [{ styleId: 'marker', position: { lat: data.result.location.lat, lng: data.result.location.lng } }];
} else if (data.status == 348) {
//地址信息不明确,需弹出提示
@@ -662,8 +667,7 @@ const onClick = (e: any) => {
// form.value.city = data.result.address_component.city;
form.value.region = data.result.ad_info.adcode; //行政区划编码
form.value.regionCode = data.result.ad_info.adcode; //行政区划编码
center.value.lat = data.result.location.lat;
center.value.lng = data.result.location.lng;
center.value = { lat: data.result.location.lat, lng: data.result.location.lng };
searchLocation.value = data.result.formatted_addresses.recommend;
geometries.value = [{ styleId: 'marker', position: { lat: data.result.location.lat, lng: data.result.location.lng } }];
}
@@ -853,7 +857,8 @@ const submitForm = async (type: string) => {
if (form.value.id) {
await updateArticle(form.value).finally(() => (buttonLoading.value = false));
} else {
await addArticle(form.value).finally(() => (buttonLoading.value = false));
let res = await addArticle(form.value).finally(() => (buttonLoading.value = false));
form.value.id = res.msg;
}
proxy?.$modal.msgSuccess('操作成功');
// dialog.visible = false;
+3 -1
View File
@@ -52,7 +52,9 @@
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="dy_user_level_status" :value="scope.row.status" />
<!-- <dict-tag :options="dy_user_level_status" :value="scope.row.status" /> -->
<el-tag v-if="scope.row.status == 0" type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 1" type="primary">已发布</el-tag>
</template>
</el-table-column>
<!-- <el-table-column label="等级名称" align="center" prop="levelName" />