Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # apps/web-antd/src/views/infra/demo/demo01/index.vuepull/91/MERGE
commit
361cfca312
|
|
@ -0,0 +1,53 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmUserGroupApi {
|
||||
/** BPM 用户组 VO */
|
||||
export interface UserGroupVO {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
userIds: number[];
|
||||
status: number;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询用户组分页 */
|
||||
export async function getUserGroupPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<BpmUserGroupApi.UserGroupVO>>(
|
||||
'/bpm/user-group/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询用户组详情 */
|
||||
export async function getUserGroup(id: number) {
|
||||
return requestClient.get<BpmUserGroupApi.UserGroupVO>(
|
||||
`/bpm/user-group/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增用户组 */
|
||||
export async function createUserGroup(data: BpmUserGroupApi.UserGroupVO) {
|
||||
return requestClient.post<number>('/bpm/user-group/create', data);
|
||||
}
|
||||
|
||||
/** 修改用户组 */
|
||||
export async function updateUserGroup(data: BpmUserGroupApi.UserGroupVO) {
|
||||
return requestClient.put<boolean>('/bpm/user-group/update', data);
|
||||
}
|
||||
|
||||
/** 删除用户组 */
|
||||
export async function deleteUserGroup(id: number) {
|
||||
return requestClient.delete<boolean>(`/bpm/user-group/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 查询用户组列表 */
|
||||
export async function getUserGroupSimpleList() {
|
||||
return requestClient.get<BpmUserGroupApi.UserGroupVO[]>(
|
||||
`/bpm/user-group/simple-list`,
|
||||
);
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { isDocAlertEnable } from '@vben/hooks';
|
||||
import { openWindow } from '@vben/utils';
|
||||
|
||||
import { Alert, Typography } from 'ant-design-vue';
|
||||
|
||||
|
|
@ -18,7 +19,7 @@ const props = defineProps<DocAlertProps>();
|
|||
|
||||
/** 跳转 URL 链接 */
|
||||
const goToUrl = () => {
|
||||
window.open(props.url);
|
||||
openWindow(props.url);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { useVbenModal, VbenButton, VbenButtonGroup } from '@vben/common-ui';
|
||||
import { openWindow } from '@vben/utils';
|
||||
|
||||
import { Image, Tag } from 'ant-design-vue';
|
||||
|
||||
|
|
@ -13,10 +14,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||
modalApi.close();
|
||||
},
|
||||
});
|
||||
|
||||
function openWindow(url: string) {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[40%]" :title="$t('ui.widgets.qa')">
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
// 迁移至 packages/@core/base/shared/src/utils/time.ts
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
/** 时间段选择器拓展 */
|
||||
export const rangePickerExtend = () => {
|
||||
return {
|
||||
showTime: {
|
||||
format: 'HH:mm:ss',
|
||||
defaultValue: [
|
||||
dayjs('00:00:00', 'HH:mm:ss'),
|
||||
dayjs('23:59:59', 'HH:mm:ss'),
|
||||
],
|
||||
},
|
||||
// 如果需要10位时间戳(秒级)可以使用 valueFormat: 'X'
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
format: 'YYYY-MM-DD HH:mm:ss', // 显示格式
|
||||
placeholder: ['开始时间', '结束时间'],
|
||||
ranges: {
|
||||
今天: [dayjs().startOf('day'), dayjs().endOf('day')],
|
||||
|
||||
昨天: [
|
||||
dayjs().subtract(1, 'day').startOf('day'),
|
||||
dayjs().subtract(1, 'day').endOf('day'),
|
||||
],
|
||||
|
||||
本周: [dayjs().startOf('week'), dayjs().endOf('day')],
|
||||
|
||||
本月: [dayjs().startOf('month'), dayjs().endOf('day')],
|
||||
|
||||
最近7天: [
|
||||
dayjs().subtract(7, 'day').startOf('day'),
|
||||
dayjs().endOf('day'),
|
||||
],
|
||||
|
||||
最近30天: [
|
||||
dayjs().subtract(30, 'day').startOf('day'),
|
||||
dayjs().endOf('day'),
|
||||
],
|
||||
},
|
||||
transformDateFunc: (dates: any) => {
|
||||
if (dates && dates.length === 2) {
|
||||
return [dates.createTime[0], dates.createTime[1]].join(','); // 格式化为后台支持的时间格式
|
||||
}
|
||||
return {};
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
import dayjs from 'dayjs';
|
||||
|
||||
// TODO @芋艿:后续整理下 迁移至 packages/core/base/shared/src/utils/date.ts,后续删除 使用 @vben/utils 的 getRangePickerDefaultProps
|
||||
|
||||
/** 时间段选择器拓展 */
|
||||
export function getRangePickerDefaultProps(): any {
|
||||
return {
|
||||
showTime: {
|
||||
format: 'HH:mm:ss',
|
||||
defaultValue: [
|
||||
dayjs('00:00:00', 'HH:mm:ss'),
|
||||
dayjs('23:59:59', 'HH:mm:ss'),
|
||||
],
|
||||
},
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: ['开始时间', '结束时间'],
|
||||
ranges: {
|
||||
今天: [dayjs().startOf('day'), dayjs().endOf('day')],
|
||||
昨天: [
|
||||
dayjs().subtract(1, 'day').startOf('day'),
|
||||
dayjs().subtract(1, 'day').endOf('day'),
|
||||
],
|
||||
本周: [dayjs().startOf('week'), dayjs().endOf('day')],
|
||||
本月: [dayjs().startOf('month'), dayjs().endOf('day')],
|
||||
'最近 7 天': [
|
||||
dayjs().subtract(7, 'day').startOf('day'),
|
||||
dayjs().endOf('day'),
|
||||
],
|
||||
'最近 30 天': [
|
||||
dayjs().subtract(30, 'day').startOf('day'),
|
||||
dayjs().endOf('day'),
|
||||
],
|
||||
},
|
||||
transformDateFunc: (dates: any) => {
|
||||
if (dates && dates.length === 2) {
|
||||
return [dates.createTime[0], dates.createTime[1]].join(','); // 格式化为后台支持的时间格式
|
||||
}
|
||||
return {};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
// TODO @芋艿:需要优化下每个方法
|
||||
// TODO @芋艿:是不是可以共用么?
|
||||
// 后续使用 packages/core/base/shared/src/utils/download.ts 下的方法
|
||||
import { dataURLtoBlob, urlToBase64 } from './base64Conver';
|
||||
|
||||
/**
|
||||
* Download online pictures
|
||||
* @param url
|
||||
* @param filename
|
||||
* @param mime
|
||||
* @param bom
|
||||
*/
|
||||
export function downloadByOnlineUrl(
|
||||
url: string,
|
||||
filename: string,
|
||||
mime?: string,
|
||||
bom?: BlobPart,
|
||||
) {
|
||||
urlToBase64(url).then((base64) => {
|
||||
downloadByBase64(base64, filename, mime, bom);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Download pictures based on base64
|
||||
* @param buf
|
||||
* @param filename
|
||||
* @param mime
|
||||
* @param bom
|
||||
*/
|
||||
export function downloadByBase64(
|
||||
buf: string,
|
||||
filename: string,
|
||||
mime?: string,
|
||||
bom?: BlobPart,
|
||||
) {
|
||||
const base64Buf = dataURLtoBlob(buf);
|
||||
downloadByData(base64Buf, filename, mime, bom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download according to the background interface file stream
|
||||
* @param {*} data
|
||||
* @param {*} filename
|
||||
* @param {*} mime
|
||||
* @param {*} bom
|
||||
*/
|
||||
export function downloadByData(
|
||||
data: BlobPart,
|
||||
filename: string,
|
||||
mime?: string,
|
||||
bom?: BlobPart,
|
||||
) {
|
||||
const blobData = bom === undefined ? [data] : [bom, data];
|
||||
const blob = new Blob(blobData, { type: mime || 'application/octet-stream' });
|
||||
|
||||
const blobURL = window.URL.createObjectURL(blob);
|
||||
const tempLink = document.createElement('a');
|
||||
tempLink.style.display = 'none';
|
||||
tempLink.href = blobURL;
|
||||
tempLink.setAttribute('download', filename);
|
||||
if (tempLink.download === undefined)
|
||||
tempLink.setAttribute('target', '_blank');
|
||||
|
||||
document.body.append(tempLink);
|
||||
tempLink.click();
|
||||
tempLink.remove();
|
||||
window.URL.revokeObjectURL(blobURL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download file according to file address
|
||||
* @param {*} sUrl
|
||||
*/
|
||||
export function downloadByUrl({
|
||||
url,
|
||||
target = '_blank',
|
||||
fileName,
|
||||
}: {
|
||||
fileName?: string;
|
||||
target?: '_blank' | '_self';
|
||||
url: string;
|
||||
}): boolean {
|
||||
const isChrome = window.navigator.userAgent.toLowerCase().includes('chrome');
|
||||
const isSafari = window.navigator.userAgent.toLowerCase().includes('safari');
|
||||
|
||||
if (/iP/.test(window.navigator.userAgent)) {
|
||||
console.error('Your browser does not support download!');
|
||||
return false;
|
||||
}
|
||||
if (isChrome || isSafari) {
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.target = target;
|
||||
|
||||
if (link.download !== undefined)
|
||||
link.download = fileName || url.slice(url.lastIndexOf('/') + 1);
|
||||
|
||||
if (document.createEvent) {
|
||||
const e = document.createEvent('MouseEvents');
|
||||
e.initEvent('click', true, true);
|
||||
link.dispatchEvent(e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!url.includes('?')) url += '?download';
|
||||
|
||||
openWindow(url, { target });
|
||||
return true;
|
||||
}
|
||||
|
||||
export function openWindow(
|
||||
url: string,
|
||||
opt?: {
|
||||
noopener?: boolean;
|
||||
noreferrer?: boolean;
|
||||
target?: '_blank' | '_self' | string;
|
||||
},
|
||||
) {
|
||||
const { noopener = true, noreferrer = true, target = '__blank' } = opt || {};
|
||||
const feature: string[] = [];
|
||||
|
||||
noopener && feature.push('noopener=yes');
|
||||
noreferrer && feature.push('noreferrer=yes');
|
||||
|
||||
window.open(url, target, feature.join(','));
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// todo @芋艿:公用逻辑
|
||||
// 已迁移,后续使用 packages/core/base/shared/src/utils/tree.ts 下的方法
|
||||
interface TreeNode {
|
||||
[key: string]: any;
|
||||
children?: TreeNode[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造树型结构数据
|
||||
*
|
||||
* @param {*} data 数据源
|
||||
* @param {*} id id字段 默认 'id'
|
||||
* @param {*} parentId 父节点字段 默认 'parentId'
|
||||
* @param {*} children 孩子节点字段 默认 'children'
|
||||
*/
|
||||
export const handleTree = (
|
||||
data: TreeNode[],
|
||||
id: string = 'id',
|
||||
parentId: string = 'parentId',
|
||||
children: string = 'children',
|
||||
): TreeNode[] => {
|
||||
if (!Array.isArray(data)) {
|
||||
console.warn('data must be an array');
|
||||
return [];
|
||||
}
|
||||
const config = {
|
||||
id,
|
||||
parentId,
|
||||
childrenList: children,
|
||||
};
|
||||
const childrenListMap: Record<number | string, TreeNode[]> = {};
|
||||
const nodeIds: Record<number | string, TreeNode> = {};
|
||||
const tree: TreeNode[] = [];
|
||||
|
||||
// 1. 数据预处理
|
||||
// 1.1 第一次遍历,生成 childrenListMap 和 nodeIds 映射
|
||||
for (const d of data) {
|
||||
const pId = d[config.parentId];
|
||||
if (childrenListMap[pId] === undefined) {
|
||||
childrenListMap[pId] = [];
|
||||
}
|
||||
nodeIds[d[config.id]] = d;
|
||||
childrenListMap[pId].push(d);
|
||||
}
|
||||
// 1.2 第二次遍历,找出根节点
|
||||
for (const d of data) {
|
||||
const pId = d[config.parentId];
|
||||
if (nodeIds[pId] === undefined) {
|
||||
tree.push(d);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 构建树结:递归构建子节点
|
||||
const adaptToChildrenList = (node: TreeNode): void => {
|
||||
const nodeId = node[config.id];
|
||||
if (childrenListMap[nodeId]) {
|
||||
node[config.childrenList] = childrenListMap[nodeId];
|
||||
// 递归处理子节点
|
||||
for (const child of node[config.childrenList]) {
|
||||
adaptToChildrenList(child);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 3. 从根节点开始构建完整树
|
||||
for (const rootNode of tree) {
|
||||
adaptToChildrenList(rootNode);
|
||||
}
|
||||
|
||||
return tree;
|
||||
};
|
||||
|
|
@ -80,10 +80,7 @@ async function handleSubmit(values: Recordable<any>) {
|
|||
await updateUserProfile(values as SystemUserProfileApi.UpdateProfileReqVO);
|
||||
// 关闭并提示
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -78,10 +78,7 @@ async function handleSubmit(values: Recordable<any>) {
|
|||
oldPassword: values.oldPassword,
|
||||
newPassword: values.newPassword,
|
||||
});
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import type { SystemSocialUserApi } from '#/api/system/social/user';
|
|||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { Button, Card, Image, message, Modal } from 'ant-design-vue';
|
||||
import { confirm } from '@vben/common-ui';
|
||||
|
||||
import { Button, Card, Image, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { socialAuthRedirect } from '#/api/core/auth';
|
||||
|
|
@ -102,19 +104,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
/** 解绑账号 */
|
||||
function onUnbind(row: SystemSocialUserApi.SocialUser) {
|
||||
Modal.confirm({
|
||||
type: 'warning',
|
||||
title: '提示',
|
||||
confirm({
|
||||
content: `确定解绑[${getDictLabel(DICT_TYPE.SYSTEM_SOCIAL_TYPE, row.type)}]平台的[${row.openid}]账号吗?`,
|
||||
async onOk() {
|
||||
await socialUnbind({ type: row.type, openid: row.openid });
|
||||
// 提示成功
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
await gridApi.reload();
|
||||
},
|
||||
}).then(async () => {
|
||||
await socialUnbind({ type: row.type, openid: row.openid });
|
||||
// 提示成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
await gridApi.reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,10 +90,7 @@ async function onDelete(row: BpmCategoryApi.CategoryVO) {
|
|||
});
|
||||
try {
|
||||
await deleteCategory(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.code]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.code]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -45,10 +45,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,171 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { BpmCategoryApi } from '#/api/bpm/category';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { CommonStatusEnum } from '#/utils/constants';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '组名',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入组名',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'description',
|
||||
label: '描述',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入描述',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'userIds',
|
||||
label: '成员',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择成员',
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
mode: 'tags',
|
||||
},
|
||||
rules: z.array(z.number()).min(1, '请选择成员').default([]),
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '组名',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入组名',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '创建时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
placeholder: ['开始时间', '结束时间'],
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns<T = BpmCategoryApi.CategoryVO>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '组名',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: '描述',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'userIds',
|
||||
title: '成员',
|
||||
minWidth: 200,
|
||||
slots: {
|
||||
default: 'userIds-cell',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 180,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'operation',
|
||||
title: '操作',
|
||||
minWidth: 180,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
cellRender: {
|
||||
attrs: {
|
||||
nameField: 'name',
|
||||
nameTitle: '用户分组',
|
||||
onClick: onActionClick,
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
{
|
||||
code: 'edit',
|
||||
show: hasAccessByCodes(['bpm:user-group:update']),
|
||||
},
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['bpm:user-group:delete']),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -1,31 +1,141 @@
|
|||
<script lang="ts" setup>
|
||||
import { Page } from '@vben/common-ui';
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { BpmUserGroupApi } from '#/api/bpm/userGroup';
|
||||
import type { SystemUserApi } from '#/api/system/user';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Plus } from '@vben/icons';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteUserGroup, getUserGroupPage } from '#/api/bpm/userGroup';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(onActionClick),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getUserGroupPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<BpmUserGroupApi.UserGroupVO>,
|
||||
});
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<BpmUserGroupApi.UserGroupVO>) {
|
||||
switch (code) {
|
||||
case 'delete': {
|
||||
onDelete(row);
|
||||
break;
|
||||
}
|
||||
case 'edit': {
|
||||
onEdit(row);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 创建用户分组 */
|
||||
function onCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑用户分组 */
|
||||
function onEdit(row: BpmUserGroupApi.UserGroupVO) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除用户分组 */
|
||||
async function onDelete(row: BpmUserGroupApi.UserGroupVO) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
duration: 0,
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
try {
|
||||
await deleteUserGroup(row.id as number);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
const userList = ref<SystemUserApi.User[]>([]);
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
// 加载用户列表
|
||||
userList.value = await getSimpleUserList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<DocAlert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/group/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/group/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<Page auto-content-height>
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="用户分组">
|
||||
<template #toolbar-tools>
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-access:code="['bpm:category:create']"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', ['用户分组']) }}
|
||||
</Button>
|
||||
</template>
|
||||
|
||||
<template #userIds-cell="{ row }">
|
||||
<span
|
||||
v-for="(userId, index) in row.userIds"
|
||||
:key="userId"
|
||||
class="pr-5px"
|
||||
>
|
||||
{{ userList.find((user) => user.id === userId)?.nickname }}
|
||||
<span v-if="index < row.userIds.length - 1">、</span>
|
||||
</span>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
<script lang="ts" setup>
|
||||
import type { BpmUserGroupApi } from '#/api/bpm/userGroup';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
createUserGroup,
|
||||
getUserGroup,
|
||||
updateUserGroup,
|
||||
} from '#/api/bpm/userGroup';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<BpmUserGroupApi.UserGroupVO>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['用户分组'])
|
||||
: $t('ui.actionTitle.create', ['用户分组']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 100,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as BpmUserGroupApi.UserGroupVO;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateUserGroup(data)
|
||||
: createUserGroup(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<BpmUserGroupApi.UserGroupVO>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getUserGroup(data.id as number);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
|
|
@ -45,10 +45,7 @@ async function onDelete(row: CrmBusinessStatusApi.BusinessStatus) {
|
|||
});
|
||||
try {
|
||||
await deleteBusinessStatus(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ import type {
|
|||
} from '#/adapter/vxe-table';
|
||||
import type { InfraApiErrorLogApi } from '#/api/infra/api-error-log';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download } from '@vben/icons';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message, Modal } from 'ant-design-vue';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
@ -47,18 +47,13 @@ function onDetail(row: InfraApiErrorLogApi.ApiErrorLog) {
|
|||
|
||||
/** 处理已处理 / 已忽略的操作 */
|
||||
async function onProcess(id: number, processStatus: number) {
|
||||
Modal.confirm({
|
||||
title: '确认操作',
|
||||
confirm({
|
||||
content: `确认标记为${InfraApiErrorLogProcessStatusEnum.DONE ? '已处理' : '已忽略'}?`,
|
||||
onOk: async () => {
|
||||
await updateApiErrorLogStatus(id, processStatus);
|
||||
// 关闭并提示
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
onRefresh();
|
||||
},
|
||||
}).then(async () => {
|
||||
await updateApiErrorLogStatus(id, processStatus);
|
||||
// 关闭并提示
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
onRefresh();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,10 +74,7 @@ const submitForm = async () => {
|
|||
columns,
|
||||
});
|
||||
// 关闭并提示
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
close();
|
||||
} catch (error) {
|
||||
console.error('保存失败', error);
|
||||
|
|
|
|||
|
|
@ -80,10 +80,7 @@ async function onDelete(row: InfraCodegenApi.CodegenTable) {
|
|||
});
|
||||
try {
|
||||
await deleteCodegenTable(row.id);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.tableName]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.tableName]));
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
|
@ -99,10 +96,7 @@ async function onSync(row: InfraCodegenApi.CodegenTable) {
|
|||
});
|
||||
try {
|
||||
await syncCodegenFromDB(row.id);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.updateSuccess', [row.tableName]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.updateSuccess', [row.tableName]));
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
|
@ -125,10 +119,7 @@ async function onGenerate(row: InfraCodegenApi.CodegenTable) {
|
|||
link.download = `codegen-${row.className}.zip`;
|
||||
link.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
message.success({
|
||||
content: '代码生成成功',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success('代码生成成功');
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,10 +104,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
hideLoading();
|
||||
modalApi.unlock();
|
||||
|
|
|
|||
|
|
@ -53,10 +53,7 @@ async function onDelete(row: InfraConfigApi.Config) {
|
|||
});
|
||||
try {
|
||||
await deleteConfig(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,7 @@ async function onDelete(row: InfraDataSourceConfigApi.DataSourceConfig) {
|
|||
});
|
||||
try {
|
||||
await deleteDataSourceConfig(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
await handleLoadData();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,86 +1,39 @@
|
|||
<script lang="ts" setup>
|
||||
import type { VxeTableInstance } from 'vxe-table';
|
||||
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { Demo01ContactApi } from '#/api/infra/demo/demo01';
|
||||
|
||||
import { h, nextTick, onMounted, reactive, ref } from 'vue';
|
||||
import { h } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Form,
|
||||
Input,
|
||||
message,
|
||||
Pagination,
|
||||
RangePicker,
|
||||
Select,
|
||||
} from 'ant-design-vue';
|
||||
import { VxeColumn, VxeTable } from 'vxe-table';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteDemo01Contact,
|
||||
exportDemo01Contact,
|
||||
getDemo01ContactPage,
|
||||
} from '#/api/infra/demo/demo01';
|
||||
import { ContentWrap } from '#/components/content-wrap';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { downloadByData } from '#/utils/download';
|
||||
|
||||
import Demo01ContactForm from './modules/form.vue';
|
||||
|
||||
const loading = ref(true); // 列表的加载中
|
||||
const list = ref<Demo01ContactApi.Demo01Contact[]>([]); // 列表的数据
|
||||
const total = ref(0); // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
createTime: undefined,
|
||||
});
|
||||
const queryFormRef = ref(); // 搜索的表单
|
||||
const exportLoading = ref(false); // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = cloneDeep(queryParams) as any;
|
||||
if (params.createTime && Array.isArray(params.createTime)) {
|
||||
params.createTime = (params.createTime as string[]).join(',');
|
||||
}
|
||||
const data = await getDemo01ContactPage(params);
|
||||
list.value = data.list;
|
||||
total.value = data.total;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Demo01ContactForm,
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 创建示例联系人 */
|
||||
function onCreate() {
|
||||
formModalApi.setData({}).open();
|
||||
|
|
@ -100,11 +53,8 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo01Contact(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
await getList();
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
}
|
||||
|
|
@ -112,166 +62,84 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
|
|||
|
||||
/** 导出表格 */
|
||||
async function onExport() {
|
||||
try {
|
||||
exportLoading.value = true;
|
||||
const data = await exportDemo01Contact(queryParams);
|
||||
downloadByData(data, '示例联系人.xls');
|
||||
} finally {
|
||||
exportLoading.value = false;
|
||||
const data = await exportDemo01Contact(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '示例联系人.xls', source: data });
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<Demo01ContactApi.Demo01Contact>) {
|
||||
switch (code) {
|
||||
case 'delete': {
|
||||
onDelete(row);
|
||||
break;
|
||||
}
|
||||
case 'edit': {
|
||||
onEdit(row);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 隐藏搜索栏 */
|
||||
const hiddenSearchBar = ref(false);
|
||||
const tableToolbarRef = ref<InstanceType<typeof TableToolbar>>();
|
||||
const tableRef = ref<VxeTableInstance>();
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
await getList();
|
||||
await nextTick();
|
||||
// 挂载 toolbar 工具栏
|
||||
const table = tableRef.value;
|
||||
const tableToolbar = tableToolbarRef.value;
|
||||
if (table && tableToolbar) {
|
||||
await table.connect(tableToolbar.getToolbarRef()!);
|
||||
}
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(onActionClick),
|
||||
height: 'auto',
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getDemo01ContactPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<Demo01ContactApi.Demo01Contact>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<FormModal @success="getList" />
|
||||
<FormModal @success="onRefresh" />
|
||||
|
||||
<ContentWrap v-if="!hiddenSearchBar">
|
||||
<!-- 搜索工作栏 -->
|
||||
<Form :model="queryParams" ref="queryFormRef" layout="inline">
|
||||
<Form.Item label="名字" name="name">
|
||||
<Input
|
||||
v-model:value="queryParams.name"
|
||||
placeholder="请输入名字"
|
||||
allow-clear
|
||||
@press-enter="handleQuery"
|
||||
class="w-full"
|
||||
/>
|
||||
</Form.Item>
|
||||
<!-- TODO @puhui999:貌似性别的宽度不对;并且选择后,会变哈; -->
|
||||
<Form.Item label="性别" name="sex">
|
||||
<Select
|
||||
v-model:value="queryParams.sex"
|
||||
placeholder="请选择性别"
|
||||
allow-clear
|
||||
class="w-full"
|
||||
>
|
||||
<!-- TODO @puhui999:要不咱还是把 getIntDictOptions 还是搞出来?总归方便点~ -->
|
||||
<Select.Option
|
||||
v-for="dict in getDictOptions(
|
||||
DICT_TYPE.SYSTEM_USER_SEX,
|
||||
'number',
|
||||
)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item label="创建时间" name="createTime">
|
||||
<RangePicker
|
||||
v-model:value="queryParams.createTime"
|
||||
v-bind="getRangePickerDefaultProps()"
|
||||
class="w-full"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button class="ml-2" @click="resetQuery"> 重置 </Button>
|
||||
<Button class="ml-2" @click="handleQuery" type="primary">
|
||||
搜索
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap title="示例联系人">
|
||||
<!-- TODO @puhui999:暗黑模式下,会有个黑底 -->
|
||||
<template #extra>
|
||||
<TableToolbar
|
||||
ref="tableToolbarRef"
|
||||
v-model:hidden-search="hiddenSearchBar"
|
||||
<Grid table-title="示例联系人列表">
|
||||
<template #toolbar-tools>
|
||||
<Button
|
||||
:icon="h(Plus)"
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-access:code="['infra:demo01-contact:create']"
|
||||
>
|
||||
<Button
|
||||
class="ml-2"
|
||||
:icon="h(Plus)"
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-access:code="['infra:demo01-contact:create']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.create', ['示例联系人']) }}
|
||||
</Button>
|
||||
<Button
|
||||
:icon="h(Download)"
|
||||
type="primary"
|
||||
class="ml-2"
|
||||
:loading="exportLoading"
|
||||
@click="onExport"
|
||||
v-access:code="['infra:demo01-contact:export']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.export') }}
|
||||
</Button>
|
||||
</TableToolbar>
|
||||
{{ $t('ui.actionTitle.create', ['示例联系人']) }}
|
||||
</Button>
|
||||
<Button
|
||||
:icon="h(Download)"
|
||||
type="primary"
|
||||
class="ml-2"
|
||||
@click="onExport"
|
||||
v-access:code="['infra:demo01-contact:export']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.export') }}
|
||||
</Button>
|
||||
</template>
|
||||
<VxeTable ref="tableRef" :data="list" show-overflow :loading="loading">
|
||||
<VxeColumn field="id" title="编号" align="center" />
|
||||
<VxeColumn field="name" title="名字" align="center" />
|
||||
<VxeColumn field="sex" title="性别" align="center">
|
||||
<template #default="{ row }">
|
||||
<DictTag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="row.sex" />
|
||||
</template>
|
||||
</VxeColumn>
|
||||
<VxeColumn field="birthday" title="出生年" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.birthday) }}
|
||||
</template>
|
||||
</VxeColumn>
|
||||
<VxeColumn field="description" title="简介" align="center" />
|
||||
<VxeColumn field="avatar" title="头像" align="center" />
|
||||
<VxeColumn field="createTime" title="创建时间" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.createTime) }}
|
||||
</template>
|
||||
</VxeColumn>
|
||||
<VxeColumn field="operation" title="操作" align="center">
|
||||
<template #default="{ row }">
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
@click="onEdit(row as any)"
|
||||
v-access:code="['infra:demo01-contact:update']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.edit') }}
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
class="ml-2"
|
||||
@click="onDelete(row as any)"
|
||||
v-access:code="['infra:demo01-contact:delete']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.delete') }}
|
||||
</Button>
|
||||
</template>
|
||||
</VxeColumn>
|
||||
</VxeTable>
|
||||
<!-- 分页 -->
|
||||
<div class="mt-2 flex justify-end">
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:current="queryParams.pageNo"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
show-size-changer
|
||||
@change="getList"
|
||||
/>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -75,10 +75,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,7 @@ async function onDelete(row: Demo02CategoryApi.Demo02Category) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo02Category(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -60,10 +60,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,10 +59,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Student(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -56,10 +56,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,10 +57,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Course) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Course(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -56,10 +56,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,10 +57,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Grade) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Grade(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,10 +58,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Student(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -70,10 +70,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Student(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -70,10 +70,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,12 @@ import { h, nextTick, onMounted, reactive, ref } from 'vue';
|
|||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||
import {
|
||||
cloneDeep,
|
||||
downloadFileFromBlobPart,
|
||||
formatDateTime,
|
||||
getRangePickerDefaultProps,
|
||||
} from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -29,9 +34,7 @@ import { ContentWrap } from '#/components/content-wrap';
|
|||
import { DictTag } from '#/components/dict-tag';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { downloadByData } from '#/utils/download';
|
||||
|
||||
import Demo01ContactForm from './modules/form.vue';
|
||||
|
||||
|
|
@ -100,10 +103,7 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo01Contact(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
await getList();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -115,7 +115,7 @@ async function onExport() {
|
|||
try {
|
||||
exportLoading.value = true;
|
||||
const data = await exportDemo01Contact(queryParams);
|
||||
downloadByData(data, '示例联系人.xls');
|
||||
downloadFileFromBlobPart({ fileName: '示例联系人.xls', source: data });
|
||||
} finally {
|
||||
exportLoading.value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,10 +75,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,13 @@ import { h, nextTick, onMounted, reactive, ref } from 'vue';
|
|||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime, isEmpty } from '@vben/utils';
|
||||
import {
|
||||
cloneDeep,
|
||||
downloadFileFromBlobPart,
|
||||
formatDateTime,
|
||||
getRangePickerDefaultProps,
|
||||
isEmpty,
|
||||
} from '@vben/utils';
|
||||
|
||||
import { Button, Form, Input, message, RangePicker } from 'ant-design-vue';
|
||||
import { VxeColumn, VxeTable } from 'vxe-table';
|
||||
|
|
@ -20,8 +26,6 @@ import {
|
|||
import { ContentWrap } from '#/components/content-wrap';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { downloadByData } from '#/utils/download';
|
||||
|
||||
import Demo02CategoryForm from './modules/form.vue';
|
||||
|
||||
|
|
@ -90,10 +94,7 @@ async function onDelete(row: Demo02CategoryApi.Demo02Category) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo02Category(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
await getList();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -105,7 +106,7 @@ async function onExport() {
|
|||
try {
|
||||
exportLoading.value = true;
|
||||
const data = await exportDemo02Category(queryParams);
|
||||
downloadByData(data, '示例分类.xls');
|
||||
downloadFileFromBlobPart({ fileName: '示例分类.xls', source: data });
|
||||
} finally {
|
||||
exportLoading.value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,12 @@ import { h, nextTick, onMounted, reactive, ref } from 'vue';
|
|||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||
import {
|
||||
cloneDeep,
|
||||
downloadFileFromBlobPart,
|
||||
formatDateTime,
|
||||
getRangePickerDefaultProps,
|
||||
} from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -31,9 +36,7 @@ import { ContentWrap } from '#/components/content-wrap';
|
|||
import { DictTag } from '#/components/dict-tag';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { downloadByData } from '#/utils/download';
|
||||
|
||||
import Demo03CourseList from './modules/demo03-course-list.vue';
|
||||
import Demo03GradeList from './modules/demo03-grade-list.vue';
|
||||
|
|
@ -117,10 +120,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Student(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
await getList();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -132,7 +132,7 @@ async function onExport() {
|
|||
try {
|
||||
exportLoading.value = true;
|
||||
const data = await exportDemo03Student(queryParams);
|
||||
downloadByData(data, '学生.xls');
|
||||
downloadFileFromBlobPart({ fileName: '学生.xls', source: data });
|
||||
} finally {
|
||||
exportLoading.value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ import { h, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
|||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||
import {
|
||||
cloneDeep,
|
||||
formatDateTime,
|
||||
getRangePickerDefaultProps,
|
||||
} from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -26,7 +30,6 @@ import {
|
|||
import { ContentWrap } from '#/components/content-wrap';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
|
||||
import Demo03CourseForm from './demo03-course-form.vue';
|
||||
|
||||
|
|
@ -62,10 +65,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Course) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Course(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
getList();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -50,10 +50,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ import { h, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
|||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||
import {
|
||||
cloneDeep,
|
||||
formatDateTime,
|
||||
getRangePickerDefaultProps,
|
||||
} from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -26,7 +30,6 @@ import {
|
|||
import { ContentWrap } from '#/components/content-wrap';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
|
||||
import Demo03GradeForm from './demo03-grade-form.vue';
|
||||
|
||||
|
|
@ -62,10 +65,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Grade) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Grade(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
getList();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -72,10 +72,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,12 @@ import { h, nextTick, onMounted, reactive, ref } from 'vue';
|
|||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||
import {
|
||||
cloneDeep,
|
||||
downloadFileFromBlobPart,
|
||||
formatDateTime,
|
||||
getRangePickerDefaultProps,
|
||||
} from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -31,9 +36,7 @@ import { ContentWrap } from '#/components/content-wrap';
|
|||
import { DictTag } from '#/components/dict-tag';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { downloadByData } from '#/utils/download';
|
||||
|
||||
import Demo03CourseList from './modules/demo03-course-list.vue';
|
||||
import Demo03GradeList from './modules/demo03-grade-list.vue';
|
||||
|
|
@ -113,10 +116,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Student(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
await getList();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -128,7 +128,7 @@ async function onExport() {
|
|||
try {
|
||||
exportLoading.value = true;
|
||||
const data = await exportDemo03Student(queryParams);
|
||||
downloadByData(data, '学生.xls');
|
||||
downloadFileFromBlobPart({ fileName: '学生.xls', source: data });
|
||||
} finally {
|
||||
exportLoading.value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,8 +82,9 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = formData.value as Demo03StudentApi.Demo03Student;
|
||||
// 拼接子表的数据
|
||||
data.demo03Courses = demo03CourseFormRef.value?.getData();
|
||||
data.demo03Grade = demo03GradeFormRef.value?.getValues();
|
||||
data.demo03courses = demo03CourseFormRef.value?.getData();
|
||||
data.demo03grade =
|
||||
demo03GradeFormRef.value?.getValues() as Demo03StudentApi.Demo03Grade;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateDemo03Student(data)
|
||||
|
|
@ -91,10 +92,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,12 @@ import { h, nextTick, onMounted, reactive, ref } from 'vue';
|
|||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, Plus } from '@vben/icons';
|
||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||
import {
|
||||
cloneDeep,
|
||||
downloadFileFromBlobPart,
|
||||
formatDateTime,
|
||||
getRangePickerDefaultProps,
|
||||
} from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -30,9 +35,7 @@ import { ContentWrap } from '#/components/content-wrap';
|
|||
import { DictTag } from '#/components/dict-tag';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { $t } from '#/locales';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { downloadByData } from '#/utils/download';
|
||||
|
||||
import Demo03StudentForm from './modules/form.vue';
|
||||
|
||||
|
|
@ -107,10 +110,7 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
|
|||
});
|
||||
try {
|
||||
await deleteDemo03Student(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
await getList();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -122,7 +122,7 @@ async function onExport() {
|
|||
try {
|
||||
exportLoading.value = true;
|
||||
const data = await exportDemo03Student(queryParams);
|
||||
downloadByData(data, '学生.xls');
|
||||
downloadFileFromBlobPart({ fileName: '学生.xls', source: data });
|
||||
} finally {
|
||||
exportLoading.value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,10 +91,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import type { InfraFileApi } from '#/api/infra/file';
|
|||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Upload } from '@vben/icons';
|
||||
import { openWindow } from '@vben/utils';
|
||||
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { Button, Image, message } from 'ant-design-vue';
|
||||
|
|
@ -52,7 +53,7 @@ async function onCopyUrl(row: InfraFileApi.File) {
|
|||
/** 打开 URL */
|
||||
function openUrl(url?: string) {
|
||||
if (url) {
|
||||
window.open(url, '_blank');
|
||||
openWindow(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,10 +66,9 @@ async function onDelete(row: InfraFileApi.File) {
|
|||
});
|
||||
try {
|
||||
await deleteFile(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name || row.path]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success(
|
||||
$t('ui.actionMessage.deleteSuccess', [row.name || row.path]),
|
||||
);
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ import type {
|
|||
} from '#/adapter/vxe-table';
|
||||
import type { InfraFileConfigApi } from '#/api/infra/file-config';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Plus } from '@vben/icons';
|
||||
import { openWindow } from '@vben/utils';
|
||||
|
||||
import { Button, message, Modal } from 'ant-design-vue';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
@ -51,10 +52,7 @@ async function onMaster(row: InfraFileConfigApi.FileConfig) {
|
|||
});
|
||||
try {
|
||||
await updateFileConfigMaster(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -72,14 +70,13 @@ async function onTest(row: InfraFileConfigApi.FileConfig) {
|
|||
const response = await testFileConfig(row.id as number);
|
||||
hideLoading();
|
||||
// 确认是否访问该文件
|
||||
Modal.confirm({
|
||||
confirm({
|
||||
title: '测试上传成功',
|
||||
content: '是否要访问该文件?',
|
||||
okText: '访问',
|
||||
confirmText: '访问',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
window.open(response, '_blank');
|
||||
},
|
||||
}).then(() => {
|
||||
openWindow(response);
|
||||
});
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -95,10 +92,7 @@ async function onDelete(row: InfraFileConfigApi.FileConfig) {
|
|||
});
|
||||
try {
|
||||
await deleteFileConfig(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import type { InfraJobApi } from '#/api/infra/job';
|
|||
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, History, Plus } from '@vben/icons';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message, Modal } from 'ant-design-vue';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
@ -74,32 +74,24 @@ async function onUpdateStatus(row: InfraJobApi.Job) {
|
|||
? InfraJobStatusEnum.NORMAL
|
||||
: InfraJobStatusEnum.STOP;
|
||||
const statusText = status === InfraJobStatusEnum.NORMAL ? '启用' : '停用';
|
||||
Modal.confirm({
|
||||
title: '确认操作',
|
||||
|
||||
confirm({
|
||||
content: `确定${statusText} ${row.name} 吗?`,
|
||||
onOk: async () => {
|
||||
await updateJobStatus(row.id as number, status);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
onRefresh();
|
||||
},
|
||||
}).then(async () => {
|
||||
await updateJobStatus(row.id as number, status);
|
||||
// 提示成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
onRefresh();
|
||||
});
|
||||
}
|
||||
|
||||
/** 执行一次任务 */
|
||||
async function onTrigger(row: InfraJobApi.Job) {
|
||||
Modal.confirm({
|
||||
title: '确认操作',
|
||||
confirm({
|
||||
content: `确定执行一次 ${row.name} 吗?`,
|
||||
onOk: async () => {
|
||||
await runJob(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
},
|
||||
}).then(async () => {
|
||||
await runJob(row.id as number);
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -120,10 +112,7 @@ async function onDelete(row: InfraJobApi.Job) {
|
|||
});
|
||||
try {
|
||||
await deleteJob(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,10 +35,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
const result = await getAreaByIp(data.ip);
|
||||
// 设置结果
|
||||
await setFieldValue('result', result);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,7 @@ async function onDelete(row: SystemDeptApi.Dept) {
|
|||
});
|
||||
try {
|
||||
await deleteDept(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,7 @@ async function onDelete(row: SystemMailAccountApi.MailAccount) {
|
|||
});
|
||||
try {
|
||||
await deleteMailAccount(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.mail]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.mail]));
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,10 +72,7 @@ async function onDelete(row: SystemMailTemplateApi.MailTemplate) {
|
|||
});
|
||||
try {
|
||||
await deleteMailTemplate(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: '邮件发送成功',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success('邮件发送成功');
|
||||
} catch (error) {
|
||||
console.error('发送邮件失败', error);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ async function onDelete(row: SystemMenuApi.Menu) {
|
|||
});
|
||||
try {
|
||||
await deleteMenu(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,7 @@ async function onDelete(row: SystemNoticeApi.Notice) {
|
|||
});
|
||||
try {
|
||||
await deleteNotice(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.title]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.title]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -65,10 +62,7 @@ async function onPush(row: SystemNoticeApi.Notice) {
|
|||
});
|
||||
try {
|
||||
await pushNotice(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} catch {
|
||||
hideLoading();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,7 @@ async function onRead(row: SystemNotifyMessageApi.NotifyMessage) {
|
|||
// 执行标记已读操作
|
||||
await updateNotifyMessageRead([row.id]);
|
||||
// 提示成功
|
||||
message.success({
|
||||
content: '标记已读成功',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success('标记已读成功');
|
||||
onRefresh();
|
||||
|
||||
// 打开详情
|
||||
|
|
@ -60,10 +57,7 @@ async function onRead(row: SystemNotifyMessageApi.NotifyMessage) {
|
|||
async function onMarkRead() {
|
||||
const rows = gridApi.grid.getCheckboxRecords();
|
||||
if (!rows || rows.length === 0) {
|
||||
message.warning({
|
||||
content: '请选择需要标记的站内信',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.warning('请选择需要标记的站内信');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -76,10 +70,7 @@ async function onMarkRead() {
|
|||
// 执行标记已读操作
|
||||
await updateNotifyMessageRead(ids);
|
||||
// 提示成功
|
||||
message.success({
|
||||
content: '标记已读成功',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success('标记已读成功');
|
||||
await gridApi.grid.setAllCheckboxRow(false);
|
||||
onRefresh();
|
||||
}
|
||||
|
|
@ -94,10 +85,7 @@ async function onMarkAllRead() {
|
|||
// 执行标记已读操作
|
||||
await updateAllNotifyMessageRead();
|
||||
// 提示成功
|
||||
message.success({
|
||||
content: '全部标记已读成功',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success('全部标记已读成功');
|
||||
await gridApi.grid.setAllCheckboxRow(false);
|
||||
onRefresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,7 @@ async function onDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
|||
});
|
||||
try {
|
||||
await deleteNotifyTemplate(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,10 +56,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} catch (error) {
|
||||
console.error('发送站内信失败', error);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -50,10 +50,7 @@ async function onDelete(row: SystemOAuth2ClientApi.OAuth2Client) {
|
|||
});
|
||||
try {
|
||||
await deleteOAuth2Client(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ async function onDelete(row: SystemOAuth2TokenApi.OAuth2Token) {
|
|||
});
|
||||
try {
|
||||
await deleteOAuth2Token(row.accessToken);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -53,10 +53,7 @@ async function onDelete(row: SystemPostApi.Post) {
|
|||
});
|
||||
try {
|
||||
await deletePost(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,10 +67,7 @@ async function onDelete(row: SystemRoleApi.Role) {
|
|||
});
|
||||
try {
|
||||
await deleteRole(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -59,10 +59,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
});
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,10 +58,7 @@ async function onDelete(row: SystemSmsChannelApi.SmsChannel) {
|
|||
});
|
||||
try {
|
||||
await deleteSmsChannel(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.signature]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.signature]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,7 @@ async function onDelete(row: SystemSmsTemplateApi.SmsTemplate) {
|
|||
});
|
||||
try {
|
||||
await deleteSmsTemplate(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: '短信发送成功',
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success('短信发送成功');
|
||||
} catch (error) {
|
||||
console.error('发送短信失败', error);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -50,10 +50,7 @@ async function onDelete(row: SystemSocialClientApi.SocialClient) {
|
|||
});
|
||||
try {
|
||||
await deleteSocialClient(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,10 +68,7 @@ async function onDelete(row: SystemTenantApi.Tenant) {
|
|||
});
|
||||
try {
|
||||
await deleteTenant(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,7 @@ async function onDelete(row: SystemTenantPackageApi.TenantPackage) {
|
|||
});
|
||||
try {
|
||||
await deleteTenantPackage(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
|
|||
|
|
@ -63,10 +63,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import type { SystemUserApi } from '#/api/system/user';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Download, Plus, Upload } from '@vben/icons';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message, Modal } from 'ant-design-vue';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
@ -94,10 +94,7 @@ async function onDelete(row: SystemUserApi.User) {
|
|||
});
|
||||
try {
|
||||
await deleteUser(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.username]),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.username]));
|
||||
onRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
|
|
@ -114,35 +111,29 @@ function onAssignRole(row: SystemUserApi.User) {
|
|||
assignRoleModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
// TODO @芋艿:后续怎么简化一下 confirm 的实现。
|
||||
/** 更新用户状态 */
|
||||
async function onStatusChange(
|
||||
newStatus: number,
|
||||
row: SystemUserApi.User,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
Modal.confirm({
|
||||
title: '切换状态',
|
||||
confirm({
|
||||
content: `你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
onCancel() {
|
||||
reject(new Error('已取消'));
|
||||
},
|
||||
onOk() {
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新用户状态
|
||||
updateUserStatus(row.id as number, newStatus)
|
||||
.then(() => {
|
||||
// 提示并返回成功
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
resolve(true);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
},
|
||||
});
|
||||
const res = await updateUserStatus(row.id as number, newStatus);
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error('更新失败'));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,10 +42,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue