!185 refactor: (web-ele)优化多个组件的删除操作和确认逻辑

Merge pull request !185 from 痴货/master
pull/182/MERGE
芋道源码 2025-08-03 12:12:53 +00:00 committed by Gitee
commit aa6639a108
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
63 changed files with 674 additions and 662 deletions

View File

@ -113,6 +113,8 @@ export namespace MallSpuApi {
createTime?: Date; createTime?: Date;
/** 商品状态 */ /** 商品状态 */
status?: number; status?: number;
/** 浏览量 */
browseCount?: number;
} }
/** 商品状态更新 */ /** 商品状态更新 */

View File

@ -45,6 +45,8 @@ export namespace MallRewardActivityApi {
productCategoryIds?: number[]; productCategoryIds?: number[];
/** 商品 SPU 编号列表(仅表单使用) */ /** 商品 SPU 编号列表(仅表单使用) */
productSpuIds?: number[]; productSpuIds?: number[];
/** 状态 */
status?: number;
} }
} }

View File

@ -30,13 +30,13 @@ export namespace MallSeckillActivityApi {
/** 备注 */ /** 备注 */
remark?: string; remark?: string;
/** 开始时间 */ /** 开始时间 */
startTime?: Date; startTime: Date;
/** 结束时间 */ /** 结束时间 */
endTime?: Date; endTime: Date;
/** 排序 */ /** 排序 */
sort?: number; sort?: number;
/** 配置编号 */ /** 配置编号 */
configIds?: string; configIds?: number[];
/** 订单数量 */ /** 订单数量 */
orderCount?: number; orderCount?: number;
/** 用户数量 */ /** 用户数量 */

View File

@ -38,6 +38,15 @@ const routes: RouteRecordRaw[] = [
}, },
component: () => import('#/views/mall/product/spu/modules/detail.vue'), component: () => import('#/views/mall/product/spu/modules/detail.vue'),
}, },
{
path: '/product/spu',
name: 'ProductSpu',
meta: {
title: '商品列表',
activeMenu: '/mall/product/spu',
},
component: () => import('#/views/mall/product/spu/index.vue'),
},
], ],
}, },
{ {

View File

@ -9,10 +9,10 @@ import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config';
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -73,23 +73,22 @@ function onEdit(row: InfraCodegenApi.CodegenTable) {
/** 删除代码生成配置 */ /** 删除代码生成配置 */
async function onDelete(row: InfraCodegenApi.CodegenTable) { async function onDelete(row: InfraCodegenApi.CodegenTable) {
await ElMessageBox.confirm('确定要删除该代码生成配置吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.tableName]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteCodegenTable(row.id); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.tableName])); await deleteCodegenTable(row.id);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.tableName]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除代码生成配置 */ /** 批量删除代码生成配置 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该代码生成配置吗?', { await confirm('确定要批量删除该代码生成配置吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteCodegenTableList(checkedIds.value); await deleteCodegenTableList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();
@ -97,11 +96,7 @@ async function onDeleteBatch() {
/** 同步数据库 */ /** 同步数据库 */
async function onSync(row: InfraCodegenApi.CodegenTable) { async function onSync(row: InfraCodegenApi.CodegenTable) {
await ElMessageBox.confirm('确定要同步该代码生成配置吗?', { await confirm('确定要同步该代码生成配置吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await syncCodegenFromDB(row.id); await syncCodegenFromDB(row.id);
ElMessage.success($t('ui.actionMessage.updateSuccess', [row.tableName])); ElMessage.success($t('ui.actionMessage.updateSuccess', [row.tableName]));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { InfraConfigApi } from '#/api/infra/config';
import { ref } from 'vue'; import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -52,23 +52,22 @@ function onEdit(row: InfraConfigApi.Config) {
/** 删除参数 */ /** 删除参数 */
async function onDelete(row: InfraConfigApi.Config) { async function onDelete(row: InfraConfigApi.Config) {
await ElMessageBox.confirm('确定要删除该参数吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteConfig(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteConfig(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除参数 */ /** 批量删除参数 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该参数吗?', { await confirm('确定要批量删除该参数吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteConfigList(checkedIds.value); await deleteConfigList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -40,23 +40,22 @@ function onEdit(row: InfraDataSourceConfigApi.DataSourceConfig) {
/** 删除数据源 */ /** 删除数据源 */
async function onDelete(row: InfraDataSourceConfigApi.DataSourceConfig) { async function onDelete(row: InfraDataSourceConfigApi.DataSourceConfig) {
await ElMessageBox.confirm('确定要删除该数据源吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDataSourceConfig(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteDataSourceConfig(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除数据源 */ /** 批量删除数据源 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该数据源吗?', { await confirm('确定要批量删除该数据源吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteDataSourceConfigList(checkedIds.value); await deleteDataSourceConfigList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,11 +7,11 @@ import type { InfraFileApi } from '#/api/infra/file';
import { ref } from 'vue'; import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty, openWindow } from '@vben/utils'; import { isEmpty, openWindow } from '@vben/utils';
import { useClipboard } from '@vueuse/core'; import { useClipboard } from '@vueuse/core';
import { ElButton, ElImage, ElMessage, ElMessageBox } from 'element-plus'; import { ElButton, ElImage, ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteFile, deleteFileList, getFilePage } from '#/api/infra/file'; import { deleteFile, deleteFileList, getFilePage } from '#/api/infra/file';
@ -60,25 +60,24 @@ function openUrl(url?: string) {
/** 删除文件 */ /** 删除文件 */
async function onDelete(row: InfraFileApi.File) { async function onDelete(row: InfraFileApi.File) {
await ElMessageBox.confirm('确定要删除该文件吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name || row.path]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteFile(row.id as number); try {
ElMessage.success( await deleteFile(row.id as number);
$t('ui.actionMessage.deleteSuccess', [row.name || row.path]), ElMessage.success(
); $t('ui.actionMessage.deleteSuccess', [row.name || row.path]),
onRefresh(); );
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除文件 */ /** 批量删除文件 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该文件吗?', { await confirm('确定要批量删除该文件吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteFileList(checkedIds.value); await deleteFileList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -10,7 +10,7 @@ import { ref } from 'vue';
import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty, openWindow } from '@vben/utils'; import { isEmpty, openWindow } from '@vben/utils';
import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -86,23 +86,22 @@ async function onTest(row: InfraFileConfigApi.FileConfig) {
/** 删除文件配置 */ /** 删除文件配置 */
async function onDelete(row: InfraFileConfigApi.FileConfig) { async function onDelete(row: InfraFileConfigApi.FileConfig) {
await ElMessageBox.confirm('确定要删除该文件配置吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteFileConfig(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteFileConfig(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除文件配置 */ /** 批量删除文件配置 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该文件配置吗?', { await confirm('确定要批量删除该文件配置吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteFileConfigList(checkedIds.value); await deleteFileConfigList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -11,7 +11,7 @@ import { useRouter } from 'vue-router';
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -105,23 +105,22 @@ function onLog(row?: InfraJobApi.Job) {
/** 删除任务 */ /** 删除任务 */
async function onDelete(row: InfraJobApi.Job) { async function onDelete(row: InfraJobApi.Job) {
await ElMessageBox.confirm('确定要删除该任务吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteJob(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteJob(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除任务 */ /** 批量删除任务 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该任务吗?', { await confirm('确定要批量删除该任务吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteJobList(checkedIds.value); await deleteJobList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -4,7 +4,7 @@ import type { MallBrandApi } from '#/api/mall/product/brand';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteBrand, getBrandPage } from '#/api/mall/product/brand'; import { deleteBrand, getBrandPage } from '#/api/mall/product/brand';
@ -35,15 +35,17 @@ function handleEdit(row: MallBrandApi.Brand) {
/** 删除品牌 */ /** 删除品牌 */
async function handleDelete(row: MallBrandApi.Brand) { async function handleDelete(row: MallBrandApi.Brand) {
// const loadingInstance = ElLoading.service({
await ElMessageBox.confirm('确定删除该品牌吗?', { text: $t('ui.actionMessage.deleting', [row.name]),
confirmButtonText: '确定', fullscreen: true,
cancelButtonText: '取消',
type: 'warning',
}); });
await deleteBrand(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteBrand(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -7,7 +7,7 @@ import { useRouter } from 'vue-router';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteCategory, getCategoryList } from '#/api/mall/product/category'; import { deleteCategory, getCategoryList } from '#/api/mall/product/category';
@ -52,14 +52,17 @@ const handleViewSpu = (id: number) => {
/** 删除分类 */ /** 删除分类 */
async function handleDelete(row: MallCategoryApi.Category) { async function handleDelete(row: MallCategoryApi.Category) {
await ElMessageBox.confirm('确定删除该分类吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteCategory(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteCategory(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 切换树形展开/收缩状态 */ /** 切换树形展开/收缩状态 */
@ -162,8 +165,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
link: true, link: true,
icon: ACTION_ICON.VIEW, icon: ACTION_ICON.VIEW,
auth: ['product:category:update'], auth: ['product:category:update'],
ifShow: row.parentId > 0, ifShow: row.parentId !== undefined && row.parentId > 0,
onClick: handleViewSpu.bind(null, row), onClick: handleViewSpu.bind(null, row.id || 0),
}, },
{ {
label: $t('common.delete'), label: $t('common.delete'),

View File

@ -187,8 +187,8 @@ export function useGridColumns<T = MallCommentApi.Comment>(
attrs: { beforeChange: onStatusChange }, attrs: { beforeChange: onStatusChange },
name: 'CellSwitch', name: 'CellSwitch',
props: { props: {
checkedValue: true, activeValue: true,
unCheckedValue: false, inactiveValue: false,
}, },
}, },
}, },

View File

@ -7,7 +7,7 @@ import type { MallPropertyApi } from '#/api/mall/product/property';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteProperty, getPropertyPage } from '#/api/mall/product/property'; import { deleteProperty, getPropertyPage } from '#/api/mall/product/property';
@ -40,14 +40,17 @@ function handleEdit(row: any) {
/** 删除属性 */ /** 删除属性 */
async function handleDelete(row: MallPropertyApi.Property) { async function handleDelete(row: MallPropertyApi.Property) {
await ElMessageBox.confirm('确定删除该属性吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteProperty(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteProperty(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 表格事件 */ /** 表格事件 */

View File

@ -6,7 +6,7 @@ import { watch } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -47,14 +47,17 @@ function handleEdit(row: MallPropertyApi.PropertyValue) {
/** 删除字典数据 */ /** 删除字典数据 */
async function handleDelete(row: MallPropertyApi.PropertyValue) { async function handleDelete(row: MallPropertyApi.PropertyValue) {
await ElMessageBox.confirm('确定删除该属性值吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deletePropertyValue(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deletePropertyValue(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -3,7 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallSpuApi } from '#/api/mall/product/spu'; import type { MallSpuApi } from '#/api/mall/product/spu';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { confirm, DocAlert, Page } from '@vben/common-ui'; import { confirm, DocAlert, Page } from '@vben/common-ui';
import { import {
@ -13,7 +13,7 @@ import {
treeToString, treeToString,
} from '@vben/utils'; } from '@vben/utils';
import { ElDescriptions, ElMessage, ElMessageBox, ElTabs } from 'element-plus'; import { ElDescriptions, ElLoading, ElMessage, ElTabs } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getCategoryList } from '#/api/mall/product/category'; import { getCategoryList } from '#/api/mall/product/category';
@ -31,7 +31,7 @@ import { useGridColumns, useGridFormSchema } from './data';
const { push } = useRouter(); const { push } = useRouter();
const tabType = ref(0); const tabType = ref(0);
const route = useRoute(); //
const categoryList = ref(); const categoryList = ref();
// tabs // tabs
@ -64,8 +64,9 @@ const tabsData = ref([
]); ]);
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { async function onRefresh() {
gridApi.query(); gridApi.query();
await getTabCount();
} }
/** 获得每个 Tab 的数量 */ /** 获得每个 Tab 的数量 */
@ -97,28 +98,27 @@ function handleEdit(row: MallSpuApi.Spu) {
/** 删除商品 */ /** 删除商品 */
async function handleDelete(row: MallSpuApi.Spu) { async function handleDelete(row: MallSpuApi.Spu) {
await ElMessageBox.confirm('确定删除该商品吗?', { const hideLoading = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteSpu(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteSpu(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
hideLoading.close();
}
} }
/** 添加到仓库 / 回收站的状态 */ /** 添加到仓库 / 回收站的状态 */
async function handleStatus02Change(row: MallSpuApi.Spu, newStatus: number) { async function handleStatus02Change(row: MallSpuApi.Spu, newStatus: number) {
//
const text = const text =
newStatus === ProductSpuStatusEnum.RECYCLE.status newStatus === ProductSpuStatusEnum.RECYCLE.status
? '加入到回收站' ? '加入到回收站'
: '恢复到仓库'; : '恢复到仓库';
// await confirm(`确认要"${row.name}"${text}吗?`);
await ElMessageBox.confirm(`确认要jian"${row.name}"${text}吗?`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await updateStatus({ id: row.id as number, status: newStatus }); await updateStatus({ id: row.id as number, status: newStatus });
ElMessage.success(`${text}成功`); ElMessage.success(`${text}成功`);
onRefresh(); onRefresh();
@ -202,11 +202,16 @@ function onChangeTab(key: any) {
gridApi.query(); gridApi.query();
} }
onMounted(() => { onMounted(async () => {
getTabCount(); // categoryId
getCategoryList({}).then((res) => { if (route.query.categoryId) {
categoryList.value = handleTree(res, 'id', 'parentId', 'children'); gridApi.formApi.setValues({
}); categoryId: Number(route.query.categoryId),
});
}
await getTabCount();
const res = await getCategoryList({});
categoryList.value = handleTree(res, 'id', 'parentId', 'children');
}); });
</script> </script>
@ -221,11 +226,12 @@ onMounted(() => {
<Grid> <Grid>
<template #top> <template #top>
<ElTabs class="border-none" @change="onChangeTab"> <ElTabs class="border-none" @tab-change="onChangeTab">
<ElTabs.TabPane <ElTabs.TabPane
v-for="item in tabsData" v-for="item in tabsData"
:key="item.type" :key="item.type"
:tab="`${item.name} (${item.count})`" :label="`${item.name} (${item.count})`"
:name="item.type"
/> />
</ElTabs> </ElTabs>
</template> </template>
@ -261,23 +267,23 @@ onMounted(() => {
:content-style="{ width: '100px', fontSize: '14px' }" :content-style="{ width: '100px', fontSize: '14px' }"
> >
<ElDescriptions.Item label="商品分类"> <ElDescriptions.Item label="商品分类">
{{ treeToString(categoryList, row.categoryId) }} {{ treeToString(categoryList, row.categoryId || 0) }}
</ElDescriptions.Item> </ElDescriptions.Item>
<ElDescriptions.Item label="商品名称"> <ElDescriptions.Item label="商品名称">
{{ row.name }} {{ row.name }}
</ElDescriptions.Item> </ElDescriptions.Item>
<ElDescriptions.Item label="市场价"> <ElDescriptions.Item label="市场价">
{{ fenToYuan(row.marketPrice) }} {{ fenToYuan(row.marketPrice || 0) }}
</ElDescriptions.Item> </ElDescriptions.Item>
<ElDescriptions.Item label="成本价"> <ElDescriptions.Item label="成本价">
{{ fenToYuan(row.costPrice) }} {{ fenToYuan(row.costPrice || 0) }}
</ElDescriptions.Item> </ElDescriptions.Item>
<ElDescriptions.Item label="浏览量"> <ElDescriptions.Item label="浏览量">
{{ row.browseCount }} {{ row.browseCount || 0 }}
</ElDescriptions.Item> </ElDescriptions.Item>
<ElDescriptions.Item label="虚拟销量"> <ElDescriptions.Item label="虚拟销量">
{{ row.virtualSalesCount }} {{ row.virtualSalesCount || 0 }}
</ElDescriptions.Item> </ElDescriptions.Item>
</ElDescriptions> </ElDescriptions>
</template> </template>
@ -305,7 +311,7 @@ onMounted(() => {
link: true, link: true,
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['product:spu:delete'], auth: ['product:spu:delete'],
ifShow: () => row.type === 4, ifShow: () => tabType === 4,
popConfirm: { popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]), title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row), confirm: handleDelete.bind(null, row),
@ -317,7 +323,7 @@ onMounted(() => {
link: true, link: true,
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['product:spu:update'], auth: ['product:spu:update'],
ifShow: () => row.type === 4, ifShow: () => tabType === 4,
onClick: handleStatus02Change.bind( onClick: handleStatus02Change.bind(
null, null,
row, row,
@ -330,7 +336,7 @@ onMounted(() => {
link: true, link: true,
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['product:spu:update'], auth: ['product:spu:update'],
ifShow: () => row.type !== 4, ifShow: () => tabType !== 4,
onClick: handleStatus02Change.bind( onClick: handleStatus02Change.bind(
null, null,
row, row,

View File

@ -4,7 +4,7 @@ import type { MallArticleApi } from '#/api/mall/promotion/article';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteArticle, getArticlePage } from '#/api/mall/promotion/article'; import { deleteArticle, getArticlePage } from '#/api/mall/promotion/article';
@ -35,14 +35,17 @@ function handleEdit(row: MallArticleApi.Article) {
/** 删除品牌 */ /** 删除品牌 */
async function handleDelete(row: MallArticleApi.Article) { async function handleDelete(row: MallArticleApi.Article) {
await ElMessageBox.confirm('确定删除该文章吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.title]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteArticle(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); await deleteArticle(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,7 +4,7 @@ import type { MallBannerApi } from '#/api/mall/market/banner';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteBanner, getBannerPage } from '#/api/mall/market/banner'; import { deleteBanner, getBannerPage } from '#/api/mall/market/banner';
@ -35,14 +35,17 @@ function handleEdit(row: MallBannerApi.Banner) {
/** 删除Banner */ /** 删除Banner */
async function handleDelete(row: MallBannerApi.Banner) { async function handleDelete(row: MallBannerApi.Banner) {
await ElMessageBox.confirm('确定删除该Banner吗', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.title]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteBanner(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); await deleteBanner(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -2,9 +2,9 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallBargainActivityApi } from '#/api/mall/promotion/bargain/bargainActivity'; import type { MallBargainActivityApi } from '#/api/mall/promotion/bargain/bargainActivity';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -41,11 +41,7 @@ function handleEdit(row: MallBargainActivityApi.BargainActivity) {
/** 关闭砍价活动 */ /** 关闭砍价活动 */
async function handleClose(row: MallBargainActivityApi.BargainActivity) { async function handleClose(row: MallBargainActivityApi.BargainActivity) {
await ElMessageBox.confirm('确定关闭该砍价活动吗?', { await confirm('确定关闭该砍价活动吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await closeBargainActivity(row.id as number); await closeBargainActivity(row.id as number);
ElMessage.success('关闭成功'); ElMessage.success('关闭成功');
onRefresh(); onRefresh();
@ -53,14 +49,17 @@ async function handleClose(row: MallBargainActivityApi.BargainActivity) {
/** 删除砍价活动 */ /** 删除砍价活动 */
async function handleDelete(row: MallBargainActivityApi.BargainActivity) { async function handleDelete(row: MallBargainActivityApi.BargainActivity) {
await ElMessageBox.confirm('确定删除该砍价活动吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteBargainActivity(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteBargainActivity(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -2,9 +2,9 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallCombinationActivityApi } from '#/api/mall/promotion/combination/combinationActivity'; import type { MallCombinationActivityApi } from '#/api/mall/promotion/combination/combinationActivity';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -43,12 +43,7 @@ function handleEdit(row: MallCombinationActivityApi.CombinationActivity) {
async function handleClose( async function handleClose(
row: MallCombinationActivityApi.CombinationActivity, row: MallCombinationActivityApi.CombinationActivity,
) { ) {
await ElMessageBox.confirm('确定关闭该拼团活动吗?', { await confirm('确定关闭该拼团活动吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await closeCombinationActivity(row.id as number); await closeCombinationActivity(row.id as number);
ElMessage.success('关闭成功'); ElMessage.success('关闭成功');
onRefresh(); onRefresh();
@ -58,15 +53,17 @@ async function handleClose(
async function handleDelete( async function handleDelete(
row: MallCombinationActivityApi.CombinationActivity, row: MallCombinationActivityApi.CombinationActivity,
) { ) {
await ElMessageBox.confirm('确定删除该拼团活动吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
try {
await deleteCombinationActivity(row.id as number); await deleteCombinationActivity(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -6,13 +6,14 @@ import { ref } from 'vue';
import { DocAlert, Page } from '@vben/common-ui'; import { DocAlert, Page } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteCoupon, deleteCoupon,
getCouponPage, getCouponPage,
} from '#/api/mall/promotion/coupon/coupon'; } from '#/api/mall/promotion/coupon/coupon';
import { $t } from '#/locales';
import { getStatusTabs, useGridColumns, useGridFormSchema } from './data'; import { getStatusTabs, useGridColumns, useGridFormSchema } from './data';
@ -23,14 +24,17 @@ const statusTabs = ref(getStatusTabs());
/** 删除优惠券 */ /** 删除优惠券 */
async function handleDelete(row: MallCouponApi.Coupon) { async function handleDelete(row: MallCouponApi.Coupon) {
await ElMessageBox.confirm('确定回收该优惠券吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteCoupon(row.id as number); try {
ElMessage.success('回收成功'); await deleteCoupon(row.id as number);
onRefresh(); ElMessage.success('回收成功');
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 刷新表格 */ /** 刷新表格 */

View File

@ -2,9 +2,9 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallDiscountActivityApi } from '#/api/mall/promotion/discount/discountActivity'; import type { MallDiscountActivityApi } from '#/api/mall/promotion/discount/discountActivity';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -41,12 +41,7 @@ function handleEdit(row: MallDiscountActivityApi.DiscountActivity) {
/** 关闭满减活动 */ /** 关闭满减活动 */
async function handleClose(row: MallDiscountActivityApi.DiscountActivity) { async function handleClose(row: MallDiscountActivityApi.DiscountActivity) {
await ElMessageBox.confirm('确定关闭该限时折扣活动吗?', { await confirm('确定关闭该限时折扣活动吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await closeDiscountActivity(row.id as number); await closeDiscountActivity(row.id as number);
ElMessage.success('关闭成功'); ElMessage.success('关闭成功');
onRefresh(); onRefresh();
@ -54,15 +49,17 @@ async function handleClose(row: MallDiscountActivityApi.DiscountActivity) {
/** 删除满减活动 */ /** 删除满减活动 */
async function handleDelete(row: MallDiscountActivityApi.DiscountActivity) { async function handleDelete(row: MallDiscountActivityApi.DiscountActivity) {
await ElMessageBox.confirm('确定删除该限时折扣活动吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
try {
await deleteDiscountActivity(row.id as number); await deleteDiscountActivity(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -6,7 +6,7 @@ import { useRouter } from 'vue-router';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteDiyPage, getDiyPagePage } from '#/api/mall/promotion/diy/page'; import { deleteDiyPage, getDiyPagePage } from '#/api/mall/promotion/diy/page';
@ -47,14 +47,17 @@ function handleDecorate(row: MallDiyPageApi.DiyPage) {
/** 删除DIY页面 */ /** 删除DIY页面 */
async function handleDelete(row: MallDiyPageApi.DiyPage) { async function handleDelete(row: MallDiyPageApi.DiyPage) {
await ElMessageBox.confirm('确定删除该装修页面吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDiyPage(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteDiyPage(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,9 +4,9 @@ import type { MallDiyTemplateApi } from '#/api/mall/promotion/diy/template';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -51,11 +51,7 @@ function handleDecorate(row: MallDiyTemplateApi.DiyTemplate) {
/** 使用模板 */ /** 使用模板 */
async function handleUse(row: MallDiyTemplateApi.DiyTemplate) { async function handleUse(row: MallDiyTemplateApi.DiyTemplate) {
await ElMessageBox.confirm(`是否使用模板"${row.name}"?`, { await confirm(`是否使用模板"${row.name}"?`);
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
// //
await useDiyTemplate(row.id as number); await useDiyTemplate(row.id as number);
ElMessage.success('使用成功'); ElMessage.success('使用成功');
@ -64,14 +60,17 @@ async function handleUse(row: MallDiyTemplateApi.DiyTemplate) {
/** 删除DIY模板 */ /** 删除DIY模板 */
async function handleDelete(row: MallDiyTemplateApi.DiyTemplate) { async function handleDelete(row: MallDiyTemplateApi.DiyTemplate) {
await ElMessageBox.confirm('确定删除该装修模板吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDiyTemplate(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteDiyTemplate(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -1,7 +1,7 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '#/utils/dict'; import { DICT_TYPE, getDictOptions } from '#/utils/dict';
/** 表单配置 */ /** 表单配置 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
@ -55,7 +55,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请选择活动状态', placeholder: '请选择活动状态',
clearable: true, clearable: true,
dictType: DICT_TYPE.COMMON_STATUS, options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
}, },
}, },
]; ];

View File

@ -4,9 +4,9 @@ import type { MallPointActivityApi } from '#/api/mall/promotion/point';
import { computed } from 'vue'; import { computed } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -49,11 +49,7 @@ function handleEdit(row: MallPointActivityApi.PointActivity) {
/** 关闭积分活动 */ /** 关闭积分活动 */
async function handleClose(row: MallPointActivityApi.PointActivity) { async function handleClose(row: MallPointActivityApi.PointActivity) {
await ElMessageBox.confirm('确认关闭该积分商城活动吗?', { await confirm('确认关闭该积分商城活动吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await closePointActivity(row.id); await closePointActivity(row.id);
ElMessage.success('关闭成功'); ElMessage.success('关闭成功');
onRefresh(); onRefresh();
@ -61,13 +57,16 @@ async function handleClose(row: MallPointActivityApi.PointActivity) {
/** 删除积分活动 */ /** 删除积分活动 */
async function handleDelete(row: MallPointActivityApi.PointActivity) { async function handleDelete(row: MallPointActivityApi.PointActivity) {
await ElMessageBox.confirm('确定删除该积分商城活动吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.spuName]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deletePointActivity(row.id); try {
onRefresh(); await deletePointActivity(row.id);
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -2,9 +2,9 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallRewardActivityApi } from '#/api/mall/promotion/reward/rewardActivity'; import type { MallRewardActivityApi } from '#/api/mall/promotion/reward/rewardActivity';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -41,12 +41,7 @@ function handleEdit(row: MallRewardActivityApi.RewardActivity) {
/** 关闭活动 */ /** 关闭活动 */
async function handleClose(row: MallRewardActivityApi.RewardActivity) { async function handleClose(row: MallRewardActivityApi.RewardActivity) {
await ElMessageBox.confirm('确认关闭该满减送活动吗?', { await confirm('确认关闭该满减送活动吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await closeRewardActivity(row.id as number); await closeRewardActivity(row.id as number);
ElMessage.success('关闭成功'); ElMessage.success('关闭成功');
onRefresh(); onRefresh();
@ -54,14 +49,17 @@ async function handleClose(row: MallRewardActivityApi.RewardActivity) {
/** 删除活动 */ /** 删除活动 */
async function handleDelete(row: MallRewardActivityApi.RewardActivity) { async function handleDelete(row: MallRewardActivityApi.RewardActivity) {
await ElMessageBox.confirm('确定删除该满减送活动吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteRewardActivity(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteRewardActivity(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,10 +4,10 @@ import type { MallSeckillActivityApi } from '#/api/mall/promotion/seckill/seckil
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { ElMessage, ElMessageBox, ElTag } from 'element-plus'; import { ElLoading, ElMessage, ElTag } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -45,11 +45,7 @@ function handleCreate() {
/** 关闭活动 */ /** 关闭活动 */
async function handleClose(row: MallSeckillActivityApi.SeckillActivity) { async function handleClose(row: MallSeckillActivityApi.SeckillActivity) {
await ElMessageBox.confirm('确认关闭该秒杀活动吗?', { await confirm('确认关闭该秒杀活动吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await closeSeckillActivity(row.id as number); await closeSeckillActivity(row.id as number);
ElMessage.success('关闭成功'); ElMessage.success('关闭成功');
onRefresh(); onRefresh();
@ -57,14 +53,17 @@ async function handleClose(row: MallSeckillActivityApi.SeckillActivity) {
/** 删除活动 */ /** 删除活动 */
async function handleDelete(row: MallSeckillActivityApi.SeckillActivity) { async function handleDelete(row: MallSeckillActivityApi.SeckillActivity) {
await ElMessageBox.confirm('确定删除该秒杀活动吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteSeckillActivity(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteSeckillActivity(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
@ -86,6 +85,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
}, },
}, },
cellConfig: {
height: 250,
},
rowConfig: { rowConfig: {
keyField: 'id', keyField: 'id',
isHover: true, isHover: true,
@ -163,10 +165,7 @@ onMounted(async () => {
link: true, link: true,
auth: ['promotion:seckill-activity:close'], auth: ['promotion:seckill-activity:close'],
ifShow: row.status === 0, ifShow: row.status === 0,
popConfirm: { onClick: handleClose.bind(null, row),
title: '确认关闭该秒杀活动吗?',
confirm: handleClose.bind(null, row),
},
}, },
{ {
label: $t('common.delete'), label: $t('common.delete'),

View File

@ -4,7 +4,7 @@ import type { MallSeckillConfigApi } from '#/api/mall/promotion/seckill/seckillC
import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -39,14 +39,17 @@ function handleEdit(row: MallSeckillConfigApi.SeckillConfig) {
/** 删除秒杀时段 */ /** 删除秒杀时段 */
async function handleDelete(row: MallSeckillConfigApi.SeckillConfig) { async function handleDelete(row: MallSeckillConfigApi.SeckillConfig) {
await ElMessageBox.confirm('确定删除该秒杀时段吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteSeckillConfig(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteSeckillConfig(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 修改状态 */ /** 修改状态 */

View File

@ -7,6 +7,7 @@ import type { AnalysisOverviewIconItem } from '#/views/mall/home/components/data
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { confirm } from '@vben/common-ui';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { import {
calculateRelativeRate, calculateRelativeRate,
@ -17,7 +18,6 @@ import {
} from '@vben/utils'; } from '@vben/utils';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { ElMessageBox } from 'element-plus';
import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; import * as TradeStatisticsApi from '#/api/mall/statistics/trade';
import AnalysisChartCard from '#/views/mall/home/components/analysis-chart-card.vue'; import AnalysisChartCard from '#/views/mall/home/components/analysis-chart-card.vue';
@ -142,7 +142,7 @@ const loadOverview = () => {
const handleExport = async () => { const handleExport = async () => {
try { try {
// //
await ElMessageBox.confirm('确定要导出交易状况吗?'); await confirm('确定要导出交易状况吗?');
// //
exportLoading.value = true; exportLoading.value = true;
const times = shortcutDateRangePicker.value.times; const times = shortcutDateRangePicker.value.times;

View File

@ -5,7 +5,7 @@ import type { MallOrderApi } from '#/api/mall/trade/order';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { Page } from '@vben/common-ui'; import { confirm, Page } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { fenToYuan, formatDate } from '@vben/utils'; import { fenToYuan, formatDate } from '@vben/utils';
@ -14,7 +14,6 @@ import {
ElDescriptionsItem, ElDescriptionsItem,
ElImage, ElImage,
ElMessage, ElMessage,
ElMessageBox,
ElTimeline, ElTimeline,
ElTimelineItem, ElTimelineItem,
} from 'element-plus'; } from 'element-plus';
@ -74,11 +73,7 @@ const getDetail = async () => {
/** 同意售后 */ /** 同意售后 */
const agree = async () => { const agree = async () => {
// //
await ElMessageBox.confirm('是否同意售后?', '提示', { await confirm('是否同意售后?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await AfterSaleApi.agree(formData.value.id!); await AfterSaleApi.agree(formData.value.id!);
// //
ElMessage.success($t('page.common.success')); ElMessage.success($t('page.common.success'));
@ -93,11 +88,7 @@ const disagree = async () => {
/** 确认收货 */ /** 确认收货 */
const receive = async () => { const receive = async () => {
// //
await ElMessageBox.confirm('是否确认收货?', '提示', { await confirm('是否确认收货?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await AfterSaleApi.receive(formData.value.id!); await AfterSaleApi.receive(formData.value.id!);
// //
ElMessage.success($t('page.common.success')); ElMessage.success($t('page.common.success'));
@ -107,11 +98,7 @@ const receive = async () => {
/** 拒绝收货 */ /** 拒绝收货 */
const refuse = async () => { const refuse = async () => {
// //
await ElMessageBox.confirm('是否拒绝收货?', '提示', { await confirm('是否拒绝收货?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await AfterSaleApi.refuse(formData.value.id!); await AfterSaleApi.refuse(formData.value.id!);
// //
ElMessage.success($t('page.common.success')); ElMessage.success($t('page.common.success'));
@ -121,11 +108,7 @@ const refuse = async () => {
/** 确认退款 */ /** 确认退款 */
const refund = async () => { const refund = async () => {
// //
await ElMessageBox.confirm('是否确认退款?', '提示', { await confirm('是否确认退款?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await AfterSaleApi.refund(formData.value.id!); await AfterSaleApi.refund(formData.value.id!);
// //
ElMessage.success($t('page.common.success')); ElMessage.success($t('page.common.success'));

View File

@ -3,10 +3,10 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallBrokerageUserApi } from '#/api/mall/trade/brokerage/user'; import type { MallBrokerageUserApi } from '#/api/mall/trade/brokerage/user';
import { useAccess } from '@vben/access'; import { useAccess } from '@vben/access';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { ElLoading, ElMessage, ElMessageBox, ElSwitch } from 'element-plus'; import { ElLoading, ElMessage, ElSwitch } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -68,11 +68,7 @@ function openCreateUserForm() {
/** 清除上级推广人 */ /** 清除上级推广人 */
async function handleClearBindUser(row: MallBrokerageUserApi.BrokerageUser) { async function handleClearBindUser(row: MallBrokerageUserApi.BrokerageUser) {
await ElMessageBox.confirm(`确定清除"${row.nickname}"的上级推广人吗?`, { await confirm(`确定清除"${row.nickname}"的上级推广人吗?`);
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await clearBindUser({ id: row.id as number }); await clearBindUser({ id: row.id as number });
ElMessage.success('清除成功'); ElMessage.success('清除成功');
onRefresh(); onRefresh();

View File

@ -4,10 +4,10 @@ import type { MallBrokerageWithdrawApi } from '#/api/mall/trade/brokerage/withdr
import { h } from 'vue'; import { h } from 'vue';
import { Page, prompt } from '@vben/common-ui'; import { confirm, Page, prompt } from '@vben/common-ui';
import { formatDateTime } from '@vben/utils'; import { formatDateTime } from '@vben/utils';
import { ElInput, ElMessage, ElMessageBox } from 'element-plus'; import { ElInput, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -35,11 +35,7 @@ function onRefresh() {
/** 审核通过 */ /** 审核通过 */
async function handleApprove(row: MallBrokerageWithdrawApi.BrokerageWithdraw) { async function handleApprove(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
await ElMessageBox.confirm('确定要审核通过吗?', { await confirm('确定要审核通过吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await approveBrokerageWithdraw(row.id); await approveBrokerageWithdraw(row.id);
ElMessage.success($t('ui.actionMessage.operationSuccess')); ElMessage.success($t('ui.actionMessage.operationSuccess'));
onRefresh(); onRefresh();
@ -73,11 +69,7 @@ function handleReject(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
async function handleRetryTransfer( async function handleRetryTransfer(
row: MallBrokerageWithdrawApi.BrokerageWithdraw, row: MallBrokerageWithdrawApi.BrokerageWithdraw,
) { ) {
await ElMessageBox.confirm('确定要重新转账吗?', { await confirm('确定要重新转账吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await approveBrokerageWithdraw(row.id); await approveBrokerageWithdraw(row.id);
ElMessage.success($t('ui.actionMessage.operationSuccess')); ElMessage.success($t('ui.actionMessage.operationSuccess'));
onRefresh(); onRefresh();

View File

@ -26,9 +26,13 @@ export function useFormSchema(): VbenFormSchema[] {
label: '退款理由', label: '退款理由',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
mode: 'tags',
placeholder: '请直接输入退款理由', placeholder: '请直接输入退款理由',
multiple: true,
options: [],
class: 'w-full', class: 'w-full',
allowCreate: true,
filterable: true,
reserveKeyword: false,
}, },
dependencies: { dependencies: {
triggerFields: ['type'], triggerFields: ['type'],
@ -40,9 +44,13 @@ export function useFormSchema(): VbenFormSchema[] {
label: '退货理由', label: '退货理由',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
mode: 'tags',
placeholder: '请直接输入退货理由', placeholder: '请直接输入退货理由',
multiple: true,
options: [],
class: 'w-full', class: 'w-full',
allowCreate: true,
filterable: true,
reserveKeyword: false,
}, },
dependencies: { dependencies: {
triggerFields: ['type'], triggerFields: ['type'],

View File

@ -59,10 +59,6 @@ onMounted(() => {
}); });
const [Form, formApi] = useVbenForm({ const [Form, formApi] = useVbenForm({
commonConfig: {
//
labelClass: 'w-2/6',
},
wrapperClass: 'grid-cols-1', wrapperClass: 'grid-cols-1',
actionWrapperClass: 'text-center', actionWrapperClass: 'text-center',
handleSubmit: onSubmit, handleSubmit: onSubmit,
@ -75,7 +71,7 @@ const [Form, formApi] = useVbenForm({
</script> </script>
<template> <template>
<Page> <Page auto-content-height>
<template #doc> <template #doc>
<DocAlert <DocAlert
title="【交易】交易订单" title="【交易】交易订单"
@ -86,11 +82,11 @@ const [Form, formApi] = useVbenForm({
url="https://doc.iocoder.cn/mall/trade-cart/" url="https://doc.iocoder.cn/mall/trade-cart/"
/> />
</template> </template>
<ElCard> <ElCard class="h-full">
<ElTabs :active-key="activeKey" @change="handleTabChange"> <ElTabs v-model="activeKey" @tab-change="handleTabChange">
<ElTabPane tab="售后" key="afterSale" :force-render="true" /> <ElTabPane label="售后" name="afterSale" :force-render="true" />
<ElTabPane tab="配送" key="delivery" :force-render="true" /> <ElTabPane label="配送" name="delivery" :force-render="true" />
<ElTabPane tab="分销" key="brokerage" :force-render="true" /> <ElTabPane label="分销" name="brokerage" :force-render="true" />
</ElTabs> </ElTabs>
<Form class="w-3/5" /> <Form class="w-3/5" />
</ElCard> </ElCard>

View File

@ -5,7 +5,7 @@ import type { MallDeliveryExpressApi } from '#/api/mall/trade/delivery/express';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils'; import { downloadFileFromBlobPart } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -46,14 +46,17 @@ function handleEdit(row: MallDeliveryExpressApi.DeliveryExpress) {
/** 删除快递公司 */ /** 删除快递公司 */
async function handleDelete(row: MallDeliveryExpressApi.DeliveryExpress) { async function handleDelete(row: MallDeliveryExpressApi.DeliveryExpress) {
await ElMessageBox.confirm($t('ui.actionMessage.deleting', [row.name]), { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDeliveryExpress(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteDeliveryExpress(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,7 +4,7 @@ import type { MallDeliveryExpressTemplateApi } from '#/api/mall/trade/delivery/e
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -40,14 +40,17 @@ function handleEdit(row: MallDeliveryExpressTemplateApi.ExpressTemplate) {
async function handleDelete( async function handleDelete(
row: MallDeliveryExpressTemplateApi.ExpressTemplate, row: MallDeliveryExpressTemplateApi.ExpressTemplate,
) { ) {
await ElMessageBox.confirm($t('ui.actionMessage.deleting', [row.name]), { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDeliveryExpressTemplate(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteDeliveryExpressTemplate(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,7 +4,7 @@ import type { MallDeliveryPickUpStoreApi } from '#/api/mall/trade/delivery/pickU
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -49,14 +49,17 @@ function handleBind(row: MallDeliveryPickUpStoreApi.PickUpStore) {
/** 删除门店 */ /** 删除门店 */
async function handleDelete(row: MallDeliveryPickUpStoreApi.PickUpStore) { async function handleDelete(row: MallDeliveryPickUpStoreApi.PickUpStore) {
await ElMessageBox.confirm('确定要删除该门店吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDeliveryPickUpStore(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteDeliveryPickUpStore(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -117,7 +117,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<div class="order-items"> <div class="order-items">
<div v-for="item in row.items" :key="item.id" class="order-item"> <div v-for="item in row.items" :key="item.id" class="order-item">
<div class="order-item-image"> <div class="order-item-image">
<ElImage :src="item.picUrl" :width="40" :height="40" /> <ElImage :src="item.picUrl" class="h-40 w-40" />
</div> </div>
<div class="order-item-content"> <div class="order-item-content">
<div class="order-item-name"> <div class="order-item-name">
@ -131,11 +131,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
</ElTag> </ElTag>
</div> </div>
<div class="order-item-info"> <div class="order-item-info">
<span <span>
>原价{{ fenToYuan(item.price) }} / 数量{{ 原价{{ fenToYuan(item.price) }} / 数量{{
item.count item.count
}}</span }}
> </span>
<DictTag <DictTag
:type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS" :type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
:value="item.afterSaleStatus" :value="item.afterSaleStatus"

View File

@ -6,14 +6,13 @@ import type { MallOrderApi } from '#/api/mall/trade/order';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { fenToYuan, formatDate } from '@vben/utils'; import { fenToYuan, formatDate } from '@vben/utils';
import { import {
ElDescriptions, ElDescriptions,
ElDescriptionsItem, ElDescriptionsItem,
ElMessage, ElMessage,
ElMessageBox,
ElTimeline, ElTimeline,
ElTimelineItem, ElTimelineItem,
} from 'element-plus'; } from 'element-plus';
@ -109,12 +108,7 @@ const updatePrice = () => {
/** 核销 */ /** 核销 */
const handlePickUp = async () => { const handlePickUp = async () => {
// //
await ElMessageBox.confirm('确认核销订单吗?', { await confirm(`确认核销订单吗?`);
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
//
await TradeOrderApi.pickUpOrder(formData.value.id!); await TradeOrderApi.pickUpOrder(formData.value.id!);
ElMessage.success('核销成功'); ElMessage.success('核销成功');
// //

View File

@ -4,7 +4,7 @@ import type { MemberGroupApi } from '#/api/member/group';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteGroup, getGroupPage } from '#/api/member/group'; import { deleteGroup, getGroupPage } from '#/api/member/group';
@ -35,14 +35,17 @@ function handleEdit(row: MemberGroupApi.Group) {
/** 删除分组 */ /** 删除分组 */
async function handleDelete(row: MemberGroupApi.Group) { async function handleDelete(row: MemberGroupApi.Group) {
await ElMessageBox.confirm('确定要删除该分组吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteGroup(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteGroup(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,7 +4,7 @@ import type { MemberLevelApi } from '#/api/member/level';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteLevel, getLevelList } from '#/api/member/level'; import { deleteLevel, getLevelList } from '#/api/member/level';
@ -35,14 +35,17 @@ function handleEdit(row: MemberLevelApi.Level) {
/** 删除等级 */ /** 删除等级 */
async function handleDelete(row: MemberLevelApi.Level) { async function handleDelete(row: MemberLevelApi.Level) {
await ElMessageBox.confirm('确定要删除该等级吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteLevel(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteLevel(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,7 +4,7 @@ import type { MemberTagApi } from '#/api/member/tag';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteMemberTag, getMemberTagPage } from '#/api/member/tag'; import { deleteMemberTag, getMemberTagPage } from '#/api/member/tag';
@ -35,14 +35,17 @@ function handleEdit(row: MemberTagApi.Tag) {
/** 删除会员标签 */ /** 删除会员标签 */
async function handleDelete(row: MemberTagApi.Tag) { async function handleDelete(row: MemberTagApi.Tag) {
await ElMessageBox.confirm('确定要删除该会员标签吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteMemberTag(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteMemberTag(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -4,7 +4,7 @@ import type { PayAppApi } from '#/api/pay/app/index';
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { changeAppStatus, deleteApp, getAppPage } from '#/api/pay/app/index'; import { changeAppStatus, deleteApp, getAppPage } from '#/api/pay/app/index';
@ -39,14 +39,17 @@ function handleEdit(row: Required<PayAppApi.App>) {
} }
async function handleDelete(row: Required<PayAppApi.App>) { async function handleDelete(row: Required<PayAppApi.App>) {
await ElMessageBox.confirm('确定要删除该应用吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteApp(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteApp(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 更新状态 */ /** 更新状态 */

View File

@ -3,7 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -37,14 +37,17 @@ function handleEdit(row: any) {
/** 删除套餐 */ /** 删除套餐 */
async function handleDelete(row: any) { async function handleDelete(row: any) {
await ElMessageBox.confirm('确定要删除该充值套餐吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deletePackage(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deletePackage(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({

View File

@ -11,7 +11,7 @@ import { onMounted, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { Plus } from '@vben/icons';
import { ElButton, ElMessage, ElMessageBox } from 'element-plus'; import { ElButton, ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteDept, getDeptList } from '#/api/system/dept'; import { deleteDept, getDeptList } from '#/api/system/dept';
@ -62,14 +62,17 @@ function onEdit(row: SystemDeptApi.Dept) {
/** 删除部门 */ /** 删除部门 */
async function onDelete(row: SystemDeptApi.Dept) { async function onDelete(row: SystemDeptApi.Dept) {
await ElMessageBox.confirm('确定要删除该部门吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDept(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteDept(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */

View File

@ -7,10 +7,10 @@ import type { SystemDictDataApi } from '#/api/system/dict/data';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { confirm, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -59,23 +59,22 @@ function onEdit(row: any) {
/** 删除字典数据 */ /** 删除字典数据 */
async function onDelete(row: any) { async function onDelete(row: any) {
await ElMessageBox.confirm('确定要删除该字典数据吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDictData(row.id); try {
ElMessage.success($t('common.operationSuccess')); await deleteDictData(row.id);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除字典数据 */ /** 批量删除字典数据 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该字典数据吗?', { await confirm('确定要批量删除该字典数据吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteDictDataList(checkedIds.value); await deleteDictDataList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { SystemDictTypeApi } from '#/api/system/dict/type';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { confirm, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -54,23 +54,22 @@ function onEdit(row: any) {
/** 删除字典类型 */ /** 删除字典类型 */
async function onDelete(row: SystemDictTypeApi.DictType) { async function onDelete(row: SystemDictTypeApi.DictType) {
await ElMessageBox.confirm('确定要删除该字典类型吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteDictType(row.id as number); try {
ElMessage.success($t('common.operationSuccess')); await deleteDictType(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除字典类型 */ /** 批量删除字典类型 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该字典类型吗?', { await confirm('确定要批量删除该字典类型吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteDictTypeList(checkedIds.value); await deleteDictTypeList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { SystemMailAccountApi } from '#/api/system/mail/account';
import { ref } from 'vue'; import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -45,23 +45,22 @@ function onEdit(row: SystemMailAccountApi.MailAccount) {
/** 删除邮箱账号 */ /** 删除邮箱账号 */
async function onDelete(row: SystemMailAccountApi.MailAccount) { async function onDelete(row: SystemMailAccountApi.MailAccount) {
await ElMessageBox.confirm('确定要删除该邮箱账号吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.mail]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteMailAccount(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.mail])); await deleteMailAccount(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.mail]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除邮箱账号 */ /** 批量删除邮箱账号 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该邮箱账号吗?', { await confirm('确定要批量删除该邮箱账号吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteMailAccountList(checkedIds.value); await deleteMailAccountList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -8,10 +8,10 @@ import type { SystemMailTemplateApi } from '#/api/system/mail/template';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getSimpleMailAccountList } from '#/api/system/mail/account'; import { getSimpleMailAccountList } from '#/api/system/mail/account';
@ -65,23 +65,22 @@ function onSend(row: SystemMailTemplateApi.MailTemplate) {
/** 删除邮件模板 */ /** 删除邮件模板 */
async function onDelete(row: SystemMailTemplateApi.MailTemplate) { async function onDelete(row: SystemMailTemplateApi.MailTemplate) {
await ElMessageBox.confirm('确定要删除该邮件模板吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteMailTemplate(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteMailTemplate(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除邮件模板 */ /** 批量删除邮件模板 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该邮件模板吗?', { await confirm('确定要批量删除该邮件模板吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteMailTemplateList(checkedIds.value); await deleteMailTemplateList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -10,7 +10,7 @@ import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { IconifyIcon, Plus } from '@vben/icons'; import { IconifyIcon, Plus } from '@vben/icons';
import { ElButton, ElMessage, ElMessageBox } from 'element-plus'; import { ElButton, ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteMenu, getMenuList } from '#/api/system/menu'; import { deleteMenu, getMenuList } from '#/api/system/menu';
@ -47,14 +47,17 @@ function onEdit(row: SystemMenuApi.Menu) {
/** 删除菜单 */ /** 删除菜单 */
async function onDelete(row: SystemMenuApi.Menu) { async function onDelete(row: SystemMenuApi.Menu) {
await ElMessageBox.confirm('确定要删除该菜单吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteMenu(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteMenu(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */

View File

@ -7,10 +7,10 @@ import type { SystemNoticeApi } from '#/api/system/notice';
import { ref } from 'vue'; import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -46,23 +46,22 @@ function onEdit(row: SystemNoticeApi.Notice) {
/** 删除公告 */ /** 删除公告 */
async function onDelete(row: SystemNoticeApi.Notice) { async function onDelete(row: SystemNoticeApi.Notice) {
await ElMessageBox.confirm('确定要删除该公告吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.title]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteNotice(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); await deleteNotice(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除公告 */ /** 批量删除公告 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该公告吗?', { await confirm('确定要批量删除该公告吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteNoticeList(checkedIds.value); await deleteNoticeList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { SystemOAuth2ClientApi } from '#/api/system/oauth2/client';
import { ref } from 'vue'; import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -45,23 +45,22 @@ function onEdit(row: SystemOAuth2ClientApi.OAuth2Client) {
/** 删除 OAuth2 客户端 */ /** 删除 OAuth2 客户端 */
async function onDelete(row: SystemOAuth2ClientApi.OAuth2Client) { async function onDelete(row: SystemOAuth2ClientApi.OAuth2Client) {
await ElMessageBox.confirm('确定要删除该 OAuth2 客户端吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteOAuth2Client(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteOAuth2Client(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除 OAuth2 客户端 */ /** 批量删除 OAuth2 客户端 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该 OAuth2 客户端吗?', { await confirm('确定要批量删除该 OAuth2 客户端吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteOAuth2ClientList(checkedIds.value); await deleteOAuth2ClientList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,7 +7,7 @@ import type { SystemOAuth2TokenApi } from '#/api/system/oauth2/token';
import { DocAlert, Page } from '@vben/common-ui'; import { DocAlert, Page } from '@vben/common-ui';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -25,14 +25,17 @@ function onRefresh() {
/** 删除 OAuth2 令牌 */ /** 删除 OAuth2 令牌 */
async function onDelete(row: SystemOAuth2TokenApi.OAuth2Token) { async function onDelete(row: SystemOAuth2TokenApi.OAuth2Token) {
await ElMessageBox.confirm('确定要删除该令牌吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.accessToken]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteOAuth2Token(row.accessToken); try {
ElMessage.success($t('ui.actionMessage.operationSuccess')); await deleteOAuth2Token(row.accessToken);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.accessToken]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */

View File

@ -7,10 +7,10 @@ import type { SystemPostApi } from '#/api/system/post';
import { ref } from 'vue'; import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -52,23 +52,22 @@ function onEdit(row: SystemPostApi.Post) {
/** 删除岗位 */ /** 删除岗位 */
async function onDelete(row: SystemPostApi.Post) { async function onDelete(row: SystemPostApi.Post) {
await ElMessageBox.confirm('确定要删除该岗位吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deletePost(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deletePost(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除岗位 */ /** 批量删除岗位 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该岗位吗?', { await confirm('确定要批量删除该岗位吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deletePostList(checkedIds.value); await deletePostList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,11 +7,11 @@ import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue'; import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { Download, Plus } from '@vben/icons';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElButton, ElMessage, ElMessageBox } from 'element-plus'; import { ElButton, ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -66,23 +66,22 @@ function onCreate() {
/** 删除角色 */ /** 删除角色 */
async function onDelete(row: SystemRoleApi.Role) { async function onDelete(row: SystemRoleApi.Role) {
await ElMessageBox.confirm('确定要删除该角色吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteRole(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteRole(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除角色 */ /** 批量删除角色 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该角色吗?', { await confirm('确定要批量删除该角色吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteRoleList(checkedIds.value); await deleteRoleList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { SystemSmsChannelApi } from '#/api/system/sms/channel';
import { ref } from 'vue'; import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -52,23 +52,22 @@ function onEdit(row: SystemSmsChannelApi.SmsChannel) {
/** 删除短信渠道 */ /** 删除短信渠道 */
async function onDelete(row: SystemSmsChannelApi.SmsChannel) { async function onDelete(row: SystemSmsChannelApi.SmsChannel) {
await ElMessageBox.confirm('确定要删除该短信渠道吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.signature]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteSmsChannel(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.signature])); await deleteSmsChannel(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.signature]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除短信渠道 */ /** 批量删除短信渠道 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该短信渠道吗?', { await confirm('确定要批量删除该短信渠道吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteSmsChannelList(checkedIds.value); await deleteSmsChannelList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { SystemSmsTemplateApi } from '#/api/system/sms/template';
import { ref } from 'vue'; import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -63,23 +63,22 @@ function onSend(row: SystemSmsTemplateApi.SmsTemplate) {
/** 删除短信模板 */ /** 删除短信模板 */
async function onDelete(row: SystemSmsTemplateApi.SmsTemplate) { async function onDelete(row: SystemSmsTemplateApi.SmsTemplate) {
await ElMessageBox.confirm('确定要删除该短信模板吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteSmsTemplate(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteSmsTemplate(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除短信模板 */ /** 批量删除短信模板 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该短信模板吗?', { await confirm('确定要批量删除该短信模板吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteSmsTemplateList(checkedIds.value); await deleteSmsTemplateList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { SystemSocialClientApi } from '#/api/system/social/client';
import { ref } from 'vue'; import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -45,23 +45,22 @@ function onEdit(row: SystemSocialClientApi.SocialClient) {
/** 删除社交客户端 */ /** 删除社交客户端 */
async function onDelete(row: SystemSocialClientApi.SocialClient) { async function onDelete(row: SystemSocialClientApi.SocialClient) {
await ElMessageBox.confirm('确定要删除该社交客户端吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteSocialClient(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteSocialClient(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除社交客户端 */ /** 批量删除社交客户端 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该社交客户端吗?', { await confirm('确定要批量删除该社交客户端吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteSocialClientList(checkedIds.value); await deleteSocialClientList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -8,10 +8,10 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -64,23 +64,22 @@ function onEdit(row: SystemTenantApi.Tenant) {
/** 删除租户 */ /** 删除租户 */
async function onDelete(row: SystemTenantApi.Tenant) { async function onDelete(row: SystemTenantApi.Tenant) {
await ElMessageBox.confirm('确定要删除该租户吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteTenant(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteTenant(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除租户 */ /** 批量删除租户 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该租户吗?', { await confirm('确定要批量删除该租户吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteTenantList(checkedIds.value); await deleteTenantList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -7,10 +7,10 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { ref } from 'vue'; import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils'; import { isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -45,23 +45,22 @@ function onEdit(row: SystemTenantPackageApi.TenantPackage) {
/** 删除租户套餐 */ /** 删除租户套餐 */
async function onDelete(row: SystemTenantPackageApi.TenantPackage) { async function onDelete(row: SystemTenantPackageApi.TenantPackage) {
await ElMessageBox.confirm('确定要删除该租户套餐吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.name]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteTenantPackage(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); await deleteTenantPackage(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除租户套餐 */ /** 批量删除租户套餐 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该租户套餐吗?', { await confirm('确定要批量删除该租户套餐吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteTenantPackageList(checkedIds.value); await deleteTenantPackageList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();

View File

@ -336,7 +336,7 @@ export function useGridColumns<T = SystemUserApi.User>(
}, },
{ {
title: '操作', title: '操作',
width: 180, width: 250,
fixed: 'right', fixed: 'right',
slots: { default: 'actions' }, slots: { default: 'actions' },
}, },

View File

@ -8,7 +8,7 @@ import { ref } from 'vue';
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
@ -83,23 +83,22 @@ function onEdit(row: SystemUserApi.User) {
/** 删除用户 */ /** 删除用户 */
async function onDelete(row: SystemUserApi.User) { async function onDelete(row: SystemUserApi.User) {
await ElMessageBox.confirm('确定要删除该用户吗?', { const loadingInstance = ElLoading.service({
confirmButtonText: '确定', text: $t('ui.actionMessage.deleting', [row.username]),
cancelButtonText: '取消', fullscreen: true,
type: 'warning',
}); });
await deleteUser(row.id as number); try {
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.username])); await deleteUser(row.id as number);
onRefresh(); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.username]));
onRefresh();
} finally {
loadingInstance.close();
}
} }
/** 批量删除用户 */ /** 批量删除用户 */
async function onDeleteBatch() { async function onDeleteBatch() {
await ElMessageBox.confirm('确定要删除该用户吗?', { await confirm('确定要批量删除该用户吗?');
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await deleteUserList(checkedIds.value); await deleteUserList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess')); ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh(); onRefresh();
@ -261,7 +260,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['system:user:delete'], auth: ['system:user:delete'],
popConfirm: { popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]), title: $t('ui.actionMessage.deleteConfirm', [row.username]),
confirm: onDelete.bind(null, row), confirm: onDelete.bind(null, row),
}, },
}, },