11 Commits

Author SHA1 Message Date
67b9a74212 feat: 短信日志
Some checks failed
coverage CI / build (push) Has been cancelled
2025-09-23 15:34:48 +08:00
0da43ca229 feat: test
Some checks failed
coverage CI / build (push) Has been cancelled
2025-09-22 18:15:39 +08:00
7b29154116 feat: 邮箱账号 2025-09-19 17:05:00 +08:00
03009cd64d feat: 短信日志 2025-09-19 15:17:26 +08:00
706d2e2a9f feat: 短信模板 2025-09-19 14:00:03 +08:00
e109590aea feat: 短信渠道 2025-09-18 18:12:57 +08:00
8afdb0d09e feat: 消息中心-站内信管理 2025-09-18 17:47:35 +08:00
73bc5aec6b feat: 操作日志 2025-09-17 18:14:39 +08:00
6d1db25c05 Merge branch 'master' of http://gitea.tashowz.com/tashow/tashow-manager 2025-09-17 14:25:08 +08:00
d99481c346 feat: package api 2025-09-17 14:25:04 +08:00
0a2a4e7707 feat: formTypes 2025-09-17 10:52:11 +08:00
48 changed files with 4258 additions and 894 deletions

View File

@@ -1,20 +1,20 @@
// https://umijs.org/config/ // https://umijs.org/config/
import { join } from "node:path"; import { join } from 'node:path';
import { defineConfig } from "@umijs/max"; import { defineConfig } from '@umijs/max';
import defaultSettings from "./defaultSettings"; import defaultSettings from './defaultSettings';
import proxy from "./proxy"; import proxy from './proxy';
import routes from "./routes"; import routes from './routes';
const { UMI_ENV = "dev" } = process.env; const { UMI_ENV = 'dev' } = process.env;
/** /**
* @name 使用公共路径 * @name 使用公共路径
* @description 部署时的路径,如果部署在非根目录下,需要配置这个变量 * @description 部署时的路径,如果部署在非根目录下,需要配置这个变量
* @doc https://umijs.org/docs/api/config#publicpath * @doc https://umijs.org/docs/api/config#publicpath
*/ */
const PUBLIC_PATH: string = "/"; const PUBLIC_PATH: string = '/';
export default defineConfig({ export default defineConfig({
/** /**
@@ -83,7 +83,7 @@ export default defineConfig({
* @name layout 插件 * @name layout 插件
* @doc https://umijs.org/docs/max/layout-menu * @doc https://umijs.org/docs/max/layout-menu
*/ */
title: "Ant Design Pro", title: 'Ant Design Pro',
layout: { layout: {
locale: true, locale: true,
...defaultSettings, ...defaultSettings,
@@ -94,8 +94,8 @@ export default defineConfig({
* @doc https://umijs.org/docs/max/moment2dayjs * @doc https://umijs.org/docs/max/moment2dayjs
*/ */
moment2dayjs: { moment2dayjs: {
preset: "antd", preset: 'antd',
plugins: ["duration"], plugins: ['duration'],
}, },
/** /**
* @name 国际化插件 * @name 国际化插件
@@ -103,7 +103,7 @@ export default defineConfig({
*/ */
locale: { locale: {
// default zh-CN // default zh-CN
default: "zh-CN", default: 'zh-CN',
antd: true, antd: true,
// default true, when it is true, will use `navigator.language` overwrite default // default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: true, baseNavigator: true,
@@ -119,7 +119,7 @@ export default defineConfig({
theme: { theme: {
cssVar: true, cssVar: true,
token: { token: {
fontFamily: "AlibabaSans, sans-serif", fontFamily: 'AlibabaSans, sans-serif',
}, },
}, },
}, },
@@ -142,30 +142,33 @@ export default defineConfig({
*/ */
headScripts: [ headScripts: [
// 解决首次加载时白屏的问题 // 解决首次加载时白屏的问题
{ src: join(PUBLIC_PATH, "scripts/loading.js"), async: true }, { src: join(PUBLIC_PATH, 'scripts/loading.js'), async: true },
], ],
//================ pro 插件配置 ================= //================ pro 插件配置 =================
presets: ["umi-presets-pro"], presets: ['umi-presets-pro'],
/** /**
* @name openAPI 插件的配置 * @name openAPI 插件的配置
* @description 基于 openapi 的规范生成serve 和mock能减少很多样板代码 * @description 基于 openapi 的规范生成serve 和mock能减少很多样板代码
* @doc https://pro.ant.design/zh-cn/docs/openapi/ * @doc https://pro.ant.design/zh-cn/docs/openapi/
*/ */
openAPI: [ // openAPI: [
// { // // {
// requestLibPath: "import { request } from '@umijs/max'", // // requestLibPath: "import { request } from '@umijs/max'",
// schemaPath: join(__dirname, "oneapi/prodapi.json"), // // schemaPath: join(__dirname, "oneapi/prodapi.json"),
// mock: false, // // mock: false,
// projectName: "prodApi", // // projectName: "prodApi",
// }, // // },
// {schemaPath: "./docs/apifox-api.json", // // {schemaPath: "./docs/apifox-api.json",
// requestLibPath: "import { request } from '@umijs/max'", // // requestLibPath: "import { request } from '@umijs/max'",
// schemaPath: join(__dirname, "oneapi.json"), // // schemaPath: join(__dirname, "oneapi.json"),
// projectName: "login", // // projectName: "login",
// }, // // },
], // ],
codeSplitting: {
jsStrategy: 'granularChunks',
},
mock: { mock: {
include: ["mock/**/*", "src/pages/**/_mock.ts"], include: ['mock/**/*', 'src/pages/**/_mock.ts'],
}, },
/** /**
* @name 是否开启 mako * @name 是否开启 mako
@@ -177,6 +180,6 @@ export default defineConfig({
requestRecord: {}, requestRecord: {},
exportStatic: {}, exportStatic: {},
define: { define: {
"process.env.CI": process.env.CI, 'process.env.CI': process.env.CI,
}, },
}); });

View File

@@ -13,9 +13,9 @@ export default {
// 如果需要自定义本地开发服务器 请取消注释按需调整 // 如果需要自定义本地开发服务器 请取消注释按需调整
dev: { dev: {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/** // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/admin-api/": { '/admin-api/': {
// 要代理的地址 // 要代理的地址
target: "http://192.168.1.114:48080", target: 'http://114.132.60.20:48080',
// 配置了这个可以从 http 代理到 https // 配置了这个可以从 http 代理到 https
// 依赖 origin 的功能可能需要这个,比如 cookie // 依赖 origin 的功能可能需要这个,比如 cookie
changeOrigin: true, changeOrigin: true,
@@ -27,17 +27,17 @@ export default {
*/ */
test: { test: {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/** // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/api/": { '/api/': {
target: "https://proapi.azurewebsites.net", target: 'https://proapi.azurewebsites.net',
changeOrigin: true, changeOrigin: true,
pathRewrite: { "^": "" }, pathRewrite: { '^': '' },
}, },
}, },
pre: { pre: {
"/api/": { '/api/': {
target: "your pre url", target: 'your pre url',
changeOrigin: true, changeOrigin: true,
pathRewrite: { "^": "" }, pathRewrite: { '^': '' },
}, },
}, },
}; };

View File

@@ -1,187 +0,0 @@
import { parse } from 'node:url';
import dayjs from 'dayjs';
import type { Request, Response } from 'express';
// mock tableListDataSource
const genList = (current: number, pageSize: number) => {
const tableListDataSource: API.RuleListItem[] = [];
for (let i = 0; i < pageSize; i += 1) {
const index = (current - 1) * 10 + i;
tableListDataSource.push({
key: index,
disabled: i % 6 === 0,
href: 'https://ant.design',
avatar: [
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
][i % 2],
name: `TradeCode ${index}`,
owner: '曲丽丽',
desc: '这是一段描述',
callNo: Math.floor(Math.random() * 1000),
status: Math.floor(Math.random() * 10) % 4,
updatedAt: dayjs().format('YYYY-MM-DD'),
createdAt: dayjs().format('YYYY-MM-DD'),
progress: Math.ceil(Math.random() * 100),
});
}
tableListDataSource.reverse();
return tableListDataSource;
};
let tableListDataSource = genList(1, 100);
function getRule(req: Request, res: Response, u: string) {
let realUrl = u;
if (
!realUrl ||
Object.prototype.toString.call(realUrl) !== '[object String]'
) {
realUrl = req.url;
}
const { current = 1, pageSize = 10 } = req.query;
const params = parse(realUrl, true).query as unknown as API.PageParams &
API.RuleListItem & {
sorter: any;
filter: any;
};
let dataSource = [...tableListDataSource].slice(
((current as number) - 1) * (pageSize as number),
(current as number) * (pageSize as number),
);
if (params.sorter) {
const sorter = JSON.parse(params.sorter);
dataSource = dataSource.sort((prev, next) => {
let sortNumber = 0;
(Object.keys(sorter) as Array<keyof API.RuleListItem>).forEach((key) => {
const nextSort = next?.[key] as number;
const preSort = prev?.[key] as number;
if (sorter[key] === 'descend') {
if (preSort - nextSort > 0) {
sortNumber += -1;
} else {
sortNumber += 1;
}
return;
}
if (preSort - nextSort > 0) {
sortNumber += 1;
} else {
sortNumber += -1;
}
});
return sortNumber;
});
}
if (params.filter) {
const filter = JSON.parse(params.filter as any) as {
[key: string]: string[];
};
if (Object.keys(filter).length > 0) {
dataSource = dataSource.filter((item) => {
return (Object.keys(filter) as Array<keyof API.RuleListItem>).some(
(key) => {
if (!filter[key]) {
return true;
}
if (filter[key].includes(`${item[key]}`)) {
return true;
}
return false;
},
);
});
}
}
if (params.name) {
dataSource = dataSource.filter((data) =>
data?.name?.includes(params.name || ''),
);
}
const result = {
data: dataSource,
total: tableListDataSource.length,
success: true,
pageSize,
current: parseInt(`${params.current}`, 10) || 1,
};
return res.json(result);
}
function postRule(req: Request, res: Response, u: string, b: Request) {
let realUrl = u;
if (
!realUrl ||
Object.prototype.toString.call(realUrl) !== '[object String]'
) {
realUrl = req.url;
}
const body = b?.body || req.body;
const { method, name, desc, key } = body;
switch (method) {
case 'delete':
tableListDataSource = tableListDataSource.filter(
(item) => key.indexOf(item.key) === -1,
);
break;
case 'post':
(() => {
const i = Math.ceil(Math.random() * 10000);
const newRule: API.RuleListItem = {
key: tableListDataSource.length,
href: 'https://ant.design',
avatar: [
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
][i % 2],
name,
owner: '曲丽丽',
desc,
callNo: Math.floor(Math.random() * 1000),
status: Math.floor(Math.random() * 10) % 2,
updatedAt: dayjs().format('YYYY-MM-DD'),
createdAt: dayjs().format('YYYY-MM-DD'),
progress: Math.ceil(Math.random() * 100),
};
tableListDataSource.unshift(newRule);
return res.json(newRule);
})();
return;
case 'update':
(() => {
let newRule = {};
tableListDataSource = tableListDataSource.map((item) => {
if (item.key === key) {
newRule = { ...item, desc, name };
return { ...item, desc, name };
}
return item;
});
return res.json(newRule);
})();
return;
default:
break;
}
const result = {
list: tableListDataSource,
pagination: {
total: tableListDataSource.length,
},
};
res.json(result);
}
export default {
'GET /api/rule': getRule,
'POST /api/rule': postRule,
};

View File

@@ -1,345 +1,18 @@
module.exports = { module.exports = {
'GET /api/currentUser': { "GET /admin-api/system/tenant/get-id-by-name": {
data: { data: 1,
name: 'Serati Ma',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
userid: '00000001',
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服某某某事业群某某平台部某某技术部UED',
tags: [
{ key: '0', label: '很有想法的' },
{ key: '1', label: '专注设计' },
{ key: '2', label: '辣~' },
{ key: '3', label: '大长腿' },
{ key: '4', label: '川妹子' },
{ key: '5', label: '海纳百川' },
],
notifyCount: 12,
unreadCount: 11,
country: 'China',
geographic: {
province: { label: '浙江省', key: '330000' },
city: { label: '杭州市', key: '330100' },
},
address: '西湖区工专路 77 号',
phone: '0752-268888888',
},
},
'GET /api/rule': {
data: [
{
key: 99,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 99',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 503,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 81,
},
{
key: 98,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 98',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 164,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 97,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 97',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 174,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 81,
},
{
key: 96,
disabled: true,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 96',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 914,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 7,
},
{
key: 95,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 95',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 698,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 82,
},
{
key: 94,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 94',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 488,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 14,
},
{
key: 93,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 93',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 580,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 77,
},
{
key: 92,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 92',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 244,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 58,
},
{
key: 91,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 91',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 959,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 66,
},
{
key: 90,
disabled: true,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 90',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 958,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 72,
},
{
key: 89,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 89',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 301,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 2,
},
{
key: 88,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 88',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 277,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 87,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 87',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 810,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 82,
},
{
key: 86,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 86',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 780,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 22,
},
{
key: 85,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 85',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 705,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 84,
disabled: true,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 84',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 203,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 79,
},
{
key: 83,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 83',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 491,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 59,
},
{
key: 82,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 82',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 73,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 100,
},
{
key: 81,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 81',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 406,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 61,
},
{
key: 80,
disabled: false,
href: 'https://ant.design',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 80',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 112,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 20,
},
],
total: 100,
success: true, success: true,
pageSize: 20, code: 0,
current: 1,
}, },
'POST /api/login/outLogin': { data: {}, success: true }, "POST /admin-api/system/auth/login": {
'POST /api/login/account': { data: null,
status: 'ok', success: true,
type: 'account', code: 0,
currentAuthority: 'admin', },
"POST /api/login/outLogin": { data: {}, success: true },
"POST /api/login/account": {
status: "ok",
type: "account",
currentAuthority: "admin",
}, },
}; };

View File

@@ -7,8 +7,8 @@
"scripts": { "scripts": {
"analyze": "cross-env ANALYZE=1 max build", "analyze": "cross-env ANALYZE=1 max build",
"build": "max build", "build": "max build",
"deploy": "npm run build && npm run gh-pages", "deploy": "pnpm run build && npm run gh-pages",
"dev": "npm run start:dev", "dev": "pnpm run start:dev",
"gh-pages": "gh-pages -d dist", "gh-pages": "gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write", "i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "max setup", "postinstall": "max setup",

12
pnpm-lock.yaml generated
View File

@@ -14075,14 +14075,14 @@ snapshots:
'@loadable/component@5.15.2(react@18.3.1)': '@loadable/component@5.15.2(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.23.6 '@babel/runtime': 7.28.4
hoist-non-react-statics: 3.3.2 hoist-non-react-statics: 3.3.2
react: 18.3.1 react: 18.3.1
react-is: 16.13.1 react-is: 16.13.1
'@loadable/component@5.15.2(react@19.1.1)': '@loadable/component@5.15.2(react@19.1.1)':
dependencies: dependencies:
'@babel/runtime': 7.23.6 '@babel/runtime': 7.28.4
hoist-non-react-statics: 3.3.2 hoist-non-react-statics: 3.3.2
react: 19.1.1 react: 19.1.1
react-is: 16.13.1 react-is: 16.13.1
@@ -15402,7 +15402,7 @@ snapshots:
'@umijs/history@5.3.1': '@umijs/history@5.3.1':
dependencies: dependencies:
'@babel/runtime': 7.23.6 '@babel/runtime': 7.28.4
query-string: 6.14.1 query-string: 6.14.1
'@umijs/lint@4.4.12(eslint@8.35.0)(jest@30.1.3(@types/node@24.3.1)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@24.3.1)(typescript@5.9.2)))(stylelint@14.8.2)(typescript@5.9.2)': '@umijs/lint@4.4.12(eslint@8.35.0)(jest@30.1.3(@types/node@24.3.1)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@24.3.1)(typescript@5.9.2)))(stylelint@14.8.2)(typescript@5.9.2)':
@@ -16597,7 +16597,7 @@ snapshots:
babel-plugin-macros@2.6.1: babel-plugin-macros@2.6.1:
dependencies: dependencies:
'@babel/runtime': 7.4.5 '@babel/runtime': 7.28.4
cosmiconfig: 5.2.1 cosmiconfig: 5.2.1
resolve: 1.22.10 resolve: 1.22.10
@@ -23257,7 +23257,7 @@ snapshots:
react-helmet-async@1.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): react-helmet-async@1.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies: dependencies:
'@babel/runtime': 7.23.6 '@babel/runtime': 7.28.4
invariant: 2.2.4 invariant: 2.2.4
prop-types: 15.8.1 prop-types: 15.8.1
react: 18.3.1 react: 18.3.1
@@ -23267,7 +23267,7 @@ snapshots:
react-helmet-async@1.3.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1): react-helmet-async@1.3.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1):
dependencies: dependencies:
'@babel/runtime': 7.23.6 '@babel/runtime': 7.28.4
invariant: 2.2.4 invariant: 2.2.4
prop-types: 15.8.1 prop-types: 15.8.1
react: 19.1.1 react: 19.1.1

View File

@@ -1,38 +1,38 @@
import type { Settings as LayoutSettings } from '@ant-design/pro-components';
import { SettingDrawer } from '@ant-design/pro-components';
import type { RequestConfig, RunTimeLayoutConfig } from '@umijs/max';
import { history, Link, Navigate } from '@umijs/max';
import { Modal, Spin } from 'antd';
import React, { import React, {
Children, Children,
Component, Component,
createContext, createContext,
JSX, JSX,
Suspense, Suspense,
} from "react"; } from 'react';
import { Modal, Spin } from "antd";
import type { Settings as LayoutSettings } from "@ant-design/pro-components";
import { SettingDrawer } from "@ant-design/pro-components";
import type { RequestConfig, RunTimeLayoutConfig } from "@umijs/max";
import { history, Link, Navigate } from "@umijs/max";
import { import {
AvatarDropdown, AvatarDropdown,
AvatarName, AvatarName,
Footer, Footer,
Question, Question,
SelectLang, SelectLang,
} from "@/components"; } from '@/components';
import { getInfo } from "@/services/login"; import { getInfo } from '@/services/login';
import type { UserVO, TokenType, UserInfoVO } from "@/services/login/types"; import type { TokenType, UserInfoVO, UserVO } from '@/services/login/types';
import defaultSettings from "../config/defaultSettings"; import defaultSettings from '../config/defaultSettings';
import { errorConfig } from "./requestErrorConfig"; import { errorConfig } from './requestErrorConfig';
import "@ant-design/v5-patch-for-react-19"; import '@ant-design/v5-patch-for-react-19';
import { getAccessToken, getRefreshToken, getTenantId } from "@/utils/auth"; import { getAccessToken, getRefreshToken, getTenantId } from '@/utils/auth';
import { CACHE_KEY, useCache } from "./hooks/web/useCache";
import { MenuVO } from "./services/system/menu";
import { import {
transformBackendMenuToFlatRoutes, transformBackendMenuToFlatRoutes,
transformMenuToRoutes, transformMenuToRoutes,
} from "@/utils/menuUtils"; } from '@/utils/menuUtils';
const isDev = process.env.NODE_ENV === "development"; import { CACHE_KEY, useCache } from './hooks/web/useCache';
import { MenuVO } from './services/system/menu';
const isDev = process.env.NODE_ENV === 'development';
const isDevOrTest = isDev || process.env.CI; const isDevOrTest = isDev || process.env.CI;
const loginPath = "/user/login"; const loginPath = '/user/login';
// 全局存储菜单数据和路由映射 // 全局存储菜单数据和路由映射
@@ -51,7 +51,7 @@ export async function getInitialState(): Promise<{
try { try {
const token = getAccessToken(); const token = getAccessToken();
if (!token) { if (!token) {
throw new Error("No token found"); throw new Error('No token found');
} }
const data = await getInfo(); const data = await getInfo();
wsCache.set(CACHE_KEY.USER, data); wsCache.set(CACHE_KEY.USER, data);
@@ -69,8 +69,8 @@ export async function getInitialState(): Promise<{
const { location } = history; const { location } = history;
if ( if (
![loginPath, "/user/register", "/user/register-result"].includes( ![loginPath, '/user/register', '/user/register-result'].includes(
location.pathname location.pathname,
) )
) { ) {
const currentUser = wsCache.get(CACHE_KEY.USER); const currentUser = wsCache.get(CACHE_KEY.USER);
@@ -125,22 +125,22 @@ export const layout: RunTimeLayoutConfig = ({
}, },
bgLayoutImgList: [ bgLayoutImgList: [
{ {
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/D2LWSqNny4sAAAAAAAAAAAAAFl94AQBr", src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/D2LWSqNny4sAAAAAAAAAAAAAFl94AQBr',
left: 85, left: 85,
bottom: 100, bottom: 100,
height: "303px", height: '303px',
}, },
{ {
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/C2TWRpJpiC0AAAAAAAAAAAAAFl94AQBr", src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/C2TWRpJpiC0AAAAAAAAAAAAAFl94AQBr',
bottom: -68, bottom: -68,
right: -45, right: -45,
height: "303px", height: '303px',
}, },
{ {
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/F6vSTbj8KpYAAAAAAAAAAAAAFl94AQBr", src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/F6vSTbj8KpYAAAAAAAAAAAAAFl94AQBr',
bottom: 0, bottom: 0,
left: 0, left: 0,
width: "331px", width: '331px',
}, },
], ],
menuHeaderRender: undefined, menuHeaderRender: undefined,
@@ -178,14 +178,14 @@ export const layout: RunTimeLayoutConfig = ({
* @doc https://umijs.org/docs/max/request#配置 * @doc https://umijs.org/docs/max/request#配置
*/ */
export const request: RequestConfig = { export const request: RequestConfig = {
baseURL: isDev ? "" : "https://proapi.azurewebsites.net", baseURL: isDev ? '' : 'https://proapi.azurewebsites.net',
...errorConfig, ...errorConfig,
// 添加请求拦截器 // 添加请求拦截器
requestInterceptors: [ requestInterceptors: [
(url, options) => { (url, options) => {
// 为所有请求添加 API 前缀 // 为所有请求添加 API 前缀
if (url && !url.startsWith(process.env.API_PREFIX || "/admin-api")) { if (url && !url.startsWith(process.env.API_PREFIX || '/admin-api')) {
url = (process.env.API_PREFIX || "/admin-api") + url; url = (process.env.API_PREFIX || '/admin-api') + url;
} }
// 获取存储在本地的 token 和 tenantId // 获取存储在本地的 token 和 tenantId
const token = getAccessToken(); const token = getAccessToken();
@@ -193,12 +193,12 @@ export const request: RequestConfig = {
// 设置统一的请求头 // 设置统一的请求头
const headers: Record<string, string> = { const headers: Record<string, string> = {
...options.headers, ...options.headers,
Accept: "*", Accept: '*',
"tenant-id": tenantId, 'tenant-id': tenantId,
}; };
// 如果有token则添加Authorization头 // 如果有token则添加Authorization头
if (token) { if (token) {
headers["Authorization"] = `Bearer ${getAccessToken()}`; headers['Authorization'] = `Bearer ${getAccessToken()}`;
} }
return { url, options: { ...options, headers } }; return { url, options: { ...options, headers } };
}, },
@@ -210,7 +210,7 @@ export const request: RequestConfig = {
const appendParams = (key: string, value: any) => { const appendParams = (key: string, value: any) => {
if (Array.isArray(value)) { if (Array.isArray(value)) {
// 特殊处理 createTime 数组,转换为 createTime[0] 和 createTime[1] 格式 // 特殊处理 createTime 数组,转换为 createTime[0] 和 createTime[1] 格式
if (key === "createTime") { if (key === 'createTime') {
value.forEach((val, index) => { value.forEach((val, index) => {
searchParams.append(`${key}[${index}]`, val); searchParams.append(`${key}[${index}]`, val);
}); });
@@ -237,23 +237,23 @@ export function patchClientRoutes({ routes }: { routes: any }) {
const { wsCache } = useCache(); const { wsCache } = useCache();
console.log(2222); console.log(2222);
const globalMenus = wsCache.get(CACHE_KEY.ROLE_ROUTERS); const globalMenus = wsCache.get(CACHE_KEY.ROLE_ROUTERS);
const routerIndex = routes.findIndex((item: any) => item.path === "/"); const routerIndex = routes.findIndex((item: any) => item.path === '/');
const parentId = routes[routerIndex].id; const parentId = routes[routerIndex].id;
if (globalMenus) { if (globalMenus) {
routes[routerIndex]["routes"].push(...loopMenuItem(globalMenus, parentId)); routes[routerIndex]['routes'].push(...loopMenuItem(globalMenus, parentId));
} }
} }
const loopMenuItem = (menus: any[], pId: number | string): any[] => { const loopMenuItem = (menus: any[], pId: number | string): any[] => {
return menus.flatMap((item) => { return menus.flatMap((item) => {
let Component: React.ComponentType<any> | null = null; let Component: React.ComponentType<any> | null = null;
console.log(findFirstLeafRoute(item), 'item');
if (item.component && item.component.length > 0) { if (item.component && item.component.length > 0) {
// 防止配置了路由,但本地暂未添加对应的页面,产生的错误 // 防止配置了路由,但本地暂未添加对应的页面,产生的错误
console.log(item.component);
Component = React.lazy(() => { Component = React.lazy(() => {
const importComponent = () => import(`@/pages/${item.component}`); const importComponent = () => import(`@/pages/${item.component}`);
const import404 = () => import("@/pages/404"); const import404 = () => import('@/pages/404');
return importComponent().catch(import404); return importComponent().catch(import404);
}); });
} }
@@ -262,9 +262,10 @@ const loopMenuItem = (menus: any[], pId: number | string): any[] => {
{ {
path: item.path, path: item.path,
name: item.name, name: item.name,
icon: item.icon, // icon: item.icon,
id: item.id, id: item.id,
parentId: pId, parentId: pId,
children: [ children: [
{ {
path: item.url, path: item.url,
@@ -275,16 +276,18 @@ const loopMenuItem = (menus: any[], pId: number | string): any[] => {
}, },
]; ];
} else { } else {
// console.log(findFirstLeafRoute(newItem));
return [ return [
{ {
path: item.path, path: item.path,
name: item.name, name: item.name,
icon: item.icon, // icon: item.icon,
id: item.menuID, id: item.menuID,
parentId: pId, parentId: pId,
redirect: '/system/tenant/list',
element: ( element: (
<React.Suspense <React.Suspense
fallback={<Spin style={{ width: "100%", height: "100%" }} />} fallback={<Spin style={{ width: '100%', height: '100%' }} />}
> >
{Component && <Component />} {Component && <Component />}
</React.Suspense> </React.Suspense>
@@ -295,3 +298,21 @@ const loopMenuItem = (menus: any[], pId: number | string): any[] => {
} }
}); });
}; };
const findFirstLeafRoute = (menuItem: any, parent = '/'): string | null => {
// 如果没有子菜单,返回当前路径
if (!menuItem.children || menuItem.children.length === 0) {
return parent + menuItem.path;
}
// 递归查找第一个叶子节点
for (const child of menuItem.children) {
const leafRoute = findFirstLeafRoute(child, menuItem.path + '/');
if (leafRoute) {
return leafRoute;
}
}
return null;
};

View File

@@ -1,9 +1,9 @@
import React, { useImperativeHandle, forwardRef } from "react"; import { CloseOutlined } from '@ant-design/icons';
import { DrawerForm } from "@ant-design/pro-components"; import type { ProFormColumnsType } from '@ant-design/pro-components';
import type { ProFormColumnsType } from "@ant-design/pro-components"; import { BetaSchemaForm, DrawerForm } from '@ant-design/pro-components';
import { BetaSchemaForm } from "@ant-design/pro-components"; import { Button, type ColProps, Drawer, Space, Typography } from 'antd';
import { Button, Drawer, Space, Typography } from "antd"; import React, { forwardRef, useImperativeHandle } from 'react';
import { CloseOutlined } from "@ant-design/icons";
const { Title } = Typography; const { Title } = Typography;
interface ConfigurableDrawerFormProps { interface ConfigurableDrawerFormProps {
title?: string; title?: string;
@@ -11,6 +11,8 @@ interface ConfigurableDrawerFormProps {
onSubmit?: (values: any) => Promise<boolean>; onSubmit?: (values: any) => Promise<boolean>;
initialValues?: Record<string, any>; initialValues?: Record<string, any>;
width?: number; width?: number;
labelCol?: ColProps;
wrapperCol?: ColProps;
} }
export interface ConfigurableDrawerFormRef { export interface ConfigurableDrawerFormRef {
@@ -21,7 +23,19 @@ export interface ConfigurableDrawerFormRef {
const ConfigurableDrawerForm = forwardRef< const ConfigurableDrawerForm = forwardRef<
ConfigurableDrawerFormRef, ConfigurableDrawerFormRef,
ConfigurableDrawerFormProps ConfigurableDrawerFormProps
>(({ title = "表单", columns, onSubmit, initialValues, width = 600 }, ref) => { >(
(
{
title = '表单',
labelCol = { span: 4 },
wrapperCol = { span: 20 },
columns,
onSubmit,
initialValues,
width = 600,
},
ref,
) => {
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
const [formData, setFormData] = React.useState(initialValues || {}); const [formData, setFormData] = React.useState(initialValues || {});
const [loading, setLoading] = React.useState<boolean>(false); const [loading, setLoading] = React.useState<boolean>(false);
@@ -32,7 +46,7 @@ const ConfigurableDrawerForm = forwardRef<
if (data) { if (data) {
setFormData(data); setFormData(data);
} }
console.log("open"); console.log('open');
setOpen(true); setOpen(true);
}, },
close: () => setOpen(false), close: () => setOpen(false),
@@ -59,12 +73,12 @@ const ConfigurableDrawerForm = forwardRef<
const customHeader = ( const customHeader = (
<div <div
style={{ style={{
display: "flex", display: 'flex',
justifyContent: "space-between", justifyContent: 'space-between',
alignItems: "center", alignItems: 'center',
padding: "0 0px 16px 0px", padding: '0 0px 16px 0px',
borderBottom: "1px solid #f0f0f0", borderBottom: '1px solid #f0f0f0',
marginBottom: "16px", marginBottom: '16px',
}} }}
> >
<Title level={4} style={{ margin: 0 }}> <Title level={4} style={{ margin: 0 }}>
@@ -75,8 +89,8 @@ const ConfigurableDrawerForm = forwardRef<
icon={<CloseOutlined />} icon={<CloseOutlined />}
onClick={() => setOpen(false)} onClick={() => setOpen(false)}
style={{ style={{
border: "none", border: 'none',
boxShadow: "none", boxShadow: 'none',
}} }}
/> />
</div> </div>
@@ -86,8 +100,8 @@ const ConfigurableDrawerForm = forwardRef<
title={title} title={title}
styles={{ styles={{
header: { header: {
textAlign: "left", textAlign: 'left',
position: "relative", position: 'relative',
}, },
}} }}
destroyOnHidden destroyOnHidden
@@ -96,7 +110,7 @@ const ConfigurableDrawerForm = forwardRef<
onClose={() => setOpen(false)} onClose={() => setOpen(false)}
width={width} width={width}
footer={ footer={
<Space style={{ width: "100%", justifyContent: "end" }}> <Space style={{ width: '100%', justifyContent: 'end' }}>
<Button onClick={() => setOpen(false)}></Button> <Button onClick={() => setOpen(false)}></Button>
<Button loading={loading} type="primary" onClick={handleSubmit}> <Button loading={loading} type="primary" onClick={handleSubmit}>
@@ -111,12 +125,13 @@ const ConfigurableDrawerForm = forwardRef<
formRef={formRef} formRef={formRef}
columns={columns} columns={columns}
layout="horizontal" layout="horizontal"
labelCol={{ span: 4 }} labelCol={labelCol}
wrapperCol={{ span: 20 }} wrapperCol={wrapperCol}
submitter={false} submitter={false}
/> />
</Drawer> </Drawer>
); );
}); },
);
export default ConfigurableDrawerForm; export default ConfigurableDrawerForm;

View File

@@ -1,36 +1,37 @@
// components/EnhancedProTable/EnhancedProTable.tsx // components/EnhancedProTable/EnhancedProTable.tsx
import { PlusOutlined } from '@ant-design/icons';
import {
type ActionType,
type ParamsType,
ProColumns,
ProTable,
TableDropdown,
} from '@ant-design/pro-components';
import { Button, Space } from 'antd';
import React, { import React, {
useRef,
useState,
useCallback,
useMemo,
act, act,
forwardRef, forwardRef,
} from "react"; useCallback,
import { useMemo,
ProTable, useRef,
ProColumns, useState,
ActionType, } from 'react';
TableDropdown,
ParamsType,
} from "@ant-design/pro-components";
import { Button, Space } from "antd";
import {
EnhancedProTableProps,
BaseRecord,
TableAction,
ToolbarAction,
} from "./types";
import { import {
buildTableDropdownMenuItems, buildTableDropdownMenuItems,
handleTableDropdownSelect,
formatPaginationTotal, formatPaginationTotal,
} from "@/utils/antd/tableHelpers"; handleTableDropdownSelect,
import { PlusOutlined } from "@ant-design/icons"; } from '@/utils/antd/tableHelpers';
import {
type BaseRecord,
type EnhancedProTableProps,
TableAction,
ToolbarAction,
} from './types';
function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>( function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
props: EnhancedProTableProps<T, U>, props: EnhancedProTableProps<T, U>,
ref: React.Ref<ActionType | undefined> | undefined ref: React.Ref<ActionType | undefined> | undefined,
) { ) {
const { const {
columns, columns,
@@ -87,7 +88,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
</Space> </Space>
); );
}, },
[showSelection] [showSelection],
); );
const toolBarRender = useCallback( const toolBarRender = useCallback(
@@ -96,7 +97,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
rows: { rows: {
selectedRowKeys?: (string | number)[] | undefined; selectedRowKeys?: (string | number)[] | undefined;
selectedRows?: T[] | undefined; selectedRows?: T[] | undefined;
} },
) => { ) => {
const toolbarElements = const toolbarElements =
toolbarActions?.map((action) => { toolbarActions?.map((action) => {
@@ -125,7 +126,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
// ]; // ];
return toolbarElements; return toolbarElements;
}, },
[toolbarActions] [toolbarActions],
); );
return ( return (
<ProTable<T, U> <ProTable<T, U>
@@ -140,9 +141,9 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
showSorterTooltip showSorterTooltip
tableAlertRender={tableAlertRender} tableAlertRender={tableAlertRender}
// tableAlertOptionRender={tableAlertOptionRender} // tableAlertOptionRender={tableAlertOptionRender}
scroll={{ x: "max-content" }} scroll={{ x: 'max-content' }}
search={{ search={{
labelWidth: "auto", labelWidth: 'auto',
defaultCollapsed: false, defaultCollapsed: false,
...restProps.search, ...restProps.search,
}} }}
@@ -156,6 +157,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
pagination={{ pagination={{
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: true, showQuickJumper: true,
pageSize: 10,
showTotal: formatPaginationTotal, showTotal: formatPaginationTotal,
...restProps.pagination, ...restProps.pagination,
}} }}
@@ -165,7 +167,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
export default forwardRef(EnhancedProTable) as < export default forwardRef(EnhancedProTable) as <
T extends BaseRecord, T extends BaseRecord,
U extends ParamsType = any U extends ParamsType = any,
>( >(
props: EnhancedProTableProps<T, U> & { ref?: React.Ref<ActionType> } props: EnhancedProTableProps<T, U> & { ref?: React.Ref<ActionType> },
) => React.ReactElement; ) => React.ReactElement;

View File

@@ -0,0 +1,72 @@
import {
ProDescriptions,
type ProDescriptionsItemProps,
} from '@ant-design/pro-components';
import { type DescriptionsProps, Modal } from 'antd';
import React, {
forwardRef,
useCallback,
useImperativeHandle,
useState,
} from 'react';
export interface DescriptionsFormRef {
open: (data?: Record<string, any>) => void;
close: () => void;
}
interface Props {
columns: ProDescriptionsItemProps<Record<string, any>, 'text'>[];
title: string;
}
const ModalDescriptions = forwardRef((props: Props, ref) => {
const { columns, title } = props;
const [visible, setVisible] = useState<boolean>(false);
const [data, setData] = useState<DescriptionsProps['items']>([]);
useImperativeHandle(ref, () => ({
open: (data: DescriptionsProps['items']) => {
console.log(data);
if (data) {
setData(data);
}
setVisible(true);
},
close: () => setVisible(false),
}));
const changeVisible = useCallback(
(flag: boolean) => {
setVisible(flag);
},
[visible],
);
return (
<Modal
open={visible}
width={800}
onCancel={() => changeVisible(false)}
footer={null}
>
<ProDescriptions
labelStyle={{ width: '200px' }}
columns={columns}
dataSource={data}
bordered
column={1}
size="small"
title={title}
// tooltip="操作日志详情"
></ProDescriptions>
{/* <Descriptions
title="操作日志"
column={1}
bordered
size="small"
items={data}
/> */}
</Modal>
);
});
export default React.memo(ModalDescriptions);

View File

@@ -1 +1 @@
export const formStatusType = { create: "创建", update: "编辑" }; export const formStatusType = { create: '创建', update: '编辑', test: '测试' };

View File

@@ -0,0 +1,105 @@
import type {
ProColumns,
ProDescriptionsItemProps,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { LoginLogVO } from '@/services/system/log/login';
export const baseTenantColumns: ProColumns<LoginLogVO>[] = [
{
title: '日志编号',
dataIndex: 'id',
tip: '日志编号',
width: 100,
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '操作类型',
dataIndex: 'logType',
hideInSearch: true, // 在搜索表单中隐藏
tip: '操作类型', // 提示信息
},
{
title: '操作模块',
dataIndex: 'type',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '用户名称',
dataIndex: 'username',
},
{
title: '登录地址',
dataIndex: 'userIp',
},
{
title: '浏览器',
dataIndex: 'userAgent',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '登录结果',
dataIndex: 'result',
hideInSearch: true,
},
{
title: '登录日期',
dataIndex: 'createTime',
valueType: 'dateRange',
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: LoginLogVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const descriptionsColumns = (): ProDescriptionsItemProps<
Record<string, any>,
'text'
>[] => [
{
title: '日志编号',
key: 'id',
dataIndex: 'id',
},
{
title: '操作类型',
key: 'logType',
dataIndex: 'logType',
},
{
title: '用户名称',
key: 'username',
dataIndex: 'username',
},
{
title: '登录地址',
key: 'userIp',
dataIndex: 'userIp',
},
{
title: '浏览器',
key: 'userAgent',
dataIndex: 'userAgent',
},
{
title: '登录结果',
key: 'result',
dataIndex: 'result',
},
{
title: '登录日期',
key: 'createTime',
dataIndex: 'createTime',
},
];

View File

@@ -1,5 +1,67 @@
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import React, { useRef } from 'react';
import EnhancedProTable from '@/components/EnhancedProTable';
import ModalDescriptions, {
type DescriptionsFormRef,
} from '@/components/ModalDescriptions';
import { getLoginLogPage, type LoginLogVO } from '@/services/system/log/login';
import { baseTenantColumns, descriptionsColumns } from './config';
const SyStemLogLogin = () => { const SyStemLogLogin = () => {
return <>SyStemLogLogin</>; const tableRef = useRef<ActionType>(null);
const descriptionsRef = useRef<DescriptionsFormRef>(null);
const onFetch = async (
params: LoginLogVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getLoginLogPage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleDetail = (record: LoginLogVO) => {
descriptionsRef.current?.open(record);
};
const actionColumns: ProColumns<LoginLogVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 80,
render: (text: React.ReactNode, record: LoginLogVO) => [
<a key="editable" onClick={() => handleDetail(record)}>
</a>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<LoginLogVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
showSelection={false}
/>
<ModalDescriptions
ref={descriptionsRef}
title="登录日志详情"
columns={descriptionsColumns()}
/>
</>
);
}; };
export default SyStemLogLogin; export default SyStemLogLogin;

View File

@@ -0,0 +1,134 @@
import {
type ProColumns,
type ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import { DescriptionsProps } from 'antd';
import dayjs from 'dayjs';
import type { OperateLogVO } from '@/services/system/log/operate';
export const baseTenantColumns: ProColumns<OperateLogVO>[] = [
{
title: '日志编号',
dataIndex: 'id',
tip: '日志编号',
width: 100,
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '操作人',
dataIndex: 'userName',
tip: '操作人', // 提示信息
},
{
title: '操作模块',
dataIndex: 'type',
},
{
title: '操作名',
dataIndex: 'subType',
},
{
title: '操作内容',
dataIndex: 'action',
},
{
title: '操作时间',
dataIndex: 'createTime',
valueType: 'dateRange',
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: OperateLogVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '业务编号',
dataIndex: 'bizId',
},
{
title: '操作 IP',
dataIndex: 'userIp',
hideInSearch: true,
},
];
export const descriptionsColumns = (): ProDescriptionsItemProps<
Record<string, any>,
'text'
>[] => [
{
title: '日志主键',
key: 'id',
dataIndex: 'id',
},
{
title: '链路追踪',
key: 'traceId',
dataIndex: 'traceId',
},
{
title: '操作人编号',
key: 'userId',
dataIndex: 'userId',
},
{
title: '操作人名字',
key: 'userName',
dataIndex: 'userName',
},
{
title: '操作人 IP',
key: 'userIp',
dataIndex: 'userIp',
},
{
title: '操作人 UA',
key: 'userAgent',
dataIndex: 'userAgent',
},
{
title: '操作模块',
key: 'type',
dataIndex: 'type',
},
{
title: '操作名',
key: 'subType',
dataIndex: 'subType',
},
{
title: '操作内容',
key: 'action',
dataIndex: 'action',
},
{
title: '操作拓展参数',
key: 'extra',
dataIndex: 'extra',
},
{
title: '请求 URL',
key: 'requestUrl',
dataIndex: 'requestUrl',
},
{
title: '操作时间',
key: 'createTime',
dataIndex: 'createTime',
},
{
title: '业务编号',
key: 'bizId',
dataIndex: 'bizId',
},
];

View File

@@ -1,5 +1,70 @@
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import React, { useRef } from 'react';
import EnhancedProTable from '@/components/EnhancedProTable';
import ModalDescriptions, {
type DescriptionsFormRef,
} from '@/components/ModalDescriptions';
import {
getOperateLogPage,
type OperateLogVO,
} from '@/services/system/log/operate';
import { baseTenantColumns, descriptionsColumns } from './config';
const SyStemLogOperate = () => { const SyStemLogOperate = () => {
return <>SyStemLogOperate</>; const tableRef = useRef<ActionType>(null);
const descriptionsRef = useRef<DescriptionsFormRef>(null);
const onFetch = async (
params: OperateLogVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getOperateLogPage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
}; };
export default SyStemLogOperate; const handleDetail = (record: OperateLogVO) => {
descriptionsRef.current?.open(record);
};
const actionColumns: ProColumns<OperateLogVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 80,
render: (text: React.ReactNode, record: OperateLogVO) => [
<a key="editable" onClick={() => handleDetail(record)}>
</a>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<OperateLogVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="操作日志"
showIndex={false}
showSelection={false}
/>
<ModalDescriptions
ref={descriptionsRef}
title="操作日志详情"
columns={descriptionsColumns()}
/>
</>
);
};
export default React.memo(SyStemLogOperate);

View File

@@ -0,0 +1,178 @@
import type {
ProColumns,
ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { MailAccountVO } from '@/services/system/message/mail/account';
export const baseTenantColumns: ProColumns<MailAccountVO>[] = [
{
title: '邮箱',
dataIndex: 'mail',
width: 100,
},
{
title: '用户名',
dataIndex: 'username',
},
{
title: 'SMTP 服务器域名',
dataIndex: 'host',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: 'SMTP 服务器端口',
dataIndex: 'port',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '是否开启 SSL',
dataIndex: 'sslEnable',
valueType: 'radio',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '是否开启 STARTTLS',
dataIndex: 'starttlsEnable',
valueType: 'radio',
hideInSearch: true,
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
hideInSearch: true, // 在搜索表单中隐藏
render: (_, record: MailAccountVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const formColumns = (): ProFormColumnsType[] => [
{
title: '邮箱',
dataIndex: 'mail',
},
{
title: '用户名',
dataIndex: 'username',
formItemProps: {
rules: [
{
required: true,
message: '请输入用户名',
},
],
},
},
{
title: '密码',
dataIndex: 'password',
formItemProps: {
rules: [
{
required: true,
message: '请输入密码',
},
],
},
},
{
title: 'SMTP 服务器域名',
dataIndex: 'host',
formItemProps: {
rules: [
{
required: true,
message: '请输入SMTP 服务器域名',
},
],
},
},
{
title: 'SMTP 服务器端口',
dataIndex: 'port',
valueType: 'digit',
fieldProps: {
defaultValue: 465,
},
formItemProps: {
rules: [
{
required: true,
message: 'SMTP 服务器端口',
},
],
},
},
{
title: '是否开启 SSL',
dataIndex: 'sslEnable',
valueType: 'select',
fieldProps: {
placeholder: '请选择是否开启 SSL',
options: [
{
label: '正常',
value: 1,
},
{
label: '禁用',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请选择是否开启 SSL',
},
],
},
},
{
title: '是否开启 STARTTLS',
dataIndex: 'starttlsEnable',
valueType: 'select',
fieldProps: {
placeholder: '请选择是否开启 STARTTLS',
options: [
{
label: '正常',
value: 1,
},
{
label: '禁用',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请选择是否开启 STARTTLS',
},
],
},
},
];
export const formTestColumns = (type: string): ProFormColumnsType[] => [
{
title: '模板内容',
dataIndex: 'content',
valueType: 'textarea',
},
{
title: '手机号',
dataIndex: 'mobile',
},
];
// {
// title: "模板内容",
// dataIndex: "content",
// valueType: "textarea",
// },

View File

@@ -0,0 +1,152 @@
import { PlusOutlined } from '@ant-design/icons';
import type {
ActionType,
ProColumns,
ProCoreActionType,
} from '@ant-design/pro-components';
import { message, Popconfirm } from 'antd';
import React, { useCallback, useRef, useState } from 'react';
import ConfigurableDrawerForm, {
type ConfigurableDrawerFormRef,
} from '@/components/DrawerForm';
import EnhancedProTable from '@/components/EnhancedProTable';
import type { ToolbarAction } from '@/components/EnhancedProTable/types';
import { formStatusType } from '@/constants';
import {
createMailAccount,
deleteMailAccount,
getMailAccount,
getMailAccountPage,
type MailAccountVO,
updateMailAccount,
} from '@/services/system/message/mail/account';
import { baseTenantColumns, formColumns, formTestColumns } from './config';
const SyStemMessageSmsTemplate = () => {
const tableRef = useRef<ActionType>(null);
const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null);
const [type, setType] = useState<'create' | 'update' | 'test'>('create');
const testRef = useRef<ConfigurableDrawerFormRef>(null);
const [currentItem, setCurrentItem] = useState<MailAccountVO>();
const onFetch = async (
params: MailAccountVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getMailAccountPage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleSend = async (record: MailAccountVO) => {
setType('test');
setCurrentItem(record);
testRef.current?.open(record);
};
const handleEdit = (record: MailAccountVO) => {
setType('update');
setCurrentItem(record);
configurableDrawerRef.current?.open(record);
};
const handleAdd = () => {
setType('create');
configurableDrawerRef.current?.open();
};
const handleSubmit = useCallback(
async (values: MailAccountVO) => {
if (type === 'create') {
await createMailAccount(values);
message.success('创建成功');
} else {
await updateMailAccount({
...values,
id: currentItem!.id,
});
message.success('编辑成功');
}
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const toolbarActions: ToolbarAction[] = [
{
key: 'add',
label: '新建',
type: 'primary',
icon: <PlusOutlined />,
onClick: handleAdd,
},
];
const actionColumns: ProColumns<MailAccountVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 120,
render: (
text: React.ReactNode,
record: MailAccountVO,
_: number,
action: ProCoreActionType | undefined,
) => [
<a key="edit" onClick={() => handleEdit(record)}>
</a>,
// <a key="detail" onClick={() => handleSend(record)}>
// 详情
// </a>,
<Popconfirm
title="是否删除?"
key="delete"
onConfirm={async () => {
await deleteMailAccount(record.id);
message.success('删除成功');
action?.reload?.();
}}
okText="是"
cancelText="否"
>
<a style={{ color: 'var(--ant-red)' }} key="delete">
</a>
</Popconfirm>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<MailAccountVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
toolbarActions={toolbarActions}
showSelection={false}
/>
<ConfigurableDrawerForm
labelCol={{ span: 7 }}
wrapperCol={{ span: 17 }}
ref={configurableDrawerRef}
title={formStatusType[type]}
columns={formColumns()}
onSubmit={handleSubmit}
/>
</>
);
};
export default SyStemMessageSmsTemplate;

View File

@@ -0,0 +1,171 @@
import type {
ProColumns,
ProDescriptionsItemProps,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { SmsLogVO } from '@/services/system/message/sms/log';
export const baseTenantColumns: ProColumns<SmsLogVO>[] = [
{
title: '编号',
dataIndex: 'id',
width: 100,
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '手机号',
dataIndex: 'mobile',
},
{
title: '短信内容',
dataIndex: 'templateContent',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '发送状态',
dataIndex: 'sendStatus',
},
{
title: '发送人名称',
dataIndex: 'templateNickname',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '接收状态',
dataIndex: 'receiveStatus',
},
{
title: '短信渠道',
dataIndex: 'channelId',
},
{
title: '模板编号',
dataIndex: 'templateId',
},
{
title: '短信类型',
dataIndex: 'templateType',
hideInSearch: true,
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
hideInSearch: true,
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: SmsLogVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '接收时间',
dataIndex: 'receiveTime',
valueType: 'dateRange',
hideInTable: true,
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: SmsLogVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const descriptionsColumns = (): ProDescriptionsItemProps<
Record<string, any>,
'text'
>[] => [
{
title: '日志主键',
key: 'id',
dataIndex: 'id',
},
{
title: '短信渠道',
key: 'channelId',
dataIndex: 'channelId',
},
{
title: '短信模板',
key: 'templateCode',
dataIndex: 'templateCode',
},
{
title: 'API 的模板编号',
key: 'apiTemplateId',
dataIndex: 'apiTemplateId',
},
{
title: '用户信息',
key: 'mobile',
dataIndex: 'mobile',
},
{
title: '短信内容',
key: 'templateContent',
dataIndex: 'templateContent',
},
{
title: '短信参数',
key: 'templateParams',
dataIndex: 'templateParams',
},
{
title: '创建时间',
key: 'createTime',
dataIndex: 'createTime',
},
{
title: '发送状态',
key: 'sendStatus',
dataIndex: 'sendStatus',
},
{
title: '发送时间',
key: 'sendTime',
dataIndex: 'sendTime',
},
{
title: 'API 发送结果',
key: 'apiSendMsg',
dataIndex: 'apiSendMsg',
},
{
title: 'API 短信编号',
key: 'apiSerialNo',
dataIndex: 'apiSerialNo',
},
{
title: 'API 请求编号',
key: 'apiRequestId',
dataIndex: 'apiRequestId',
},
{
title: 'API 接收状态',
key: 'receiveStatus',
dataIndex: 'receiveStatus',
},
{
title: 'API 接收结果',
key: 'apiReceiveMsg',
dataIndex: 'apiReceiveMsg',
},
];

View File

@@ -0,0 +1,70 @@
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import React, { useRef } from 'react';
import EnhancedProTable from '@/components/EnhancedProTable';
import ModalDescriptions, {
type DescriptionsFormRef,
} from '@/components/ModalDescriptions';
import {
getSmsLogPage,
type SmsLogVO,
} from '@/services/system/message/sms/log';
import { baseTenantColumns, descriptionsColumns } from './config';
const SyStemMessageNotifyMessage = () => {
const tableRef = useRef<ActionType>(null);
const descriptionsRef = useRef<DescriptionsFormRef>(null);
const onFetch = async (
params: SmsLogVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getSmsLogPage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleDetail = (record: SmsLogVO) => {
descriptionsRef.current?.open(record);
};
const actionColumns: ProColumns<SmsLogVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 80,
render: (text: React.ReactNode, record: SmsLogVO) => [
<a key="editable" onClick={() => handleDetail(record)}>
</a>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<SmsLogVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
showSelection={false}
/>
<ModalDescriptions
ref={descriptionsRef}
title="登录日志详情"
columns={descriptionsColumns()}
/>
</>
);
};
export default SyStemMessageNotifyMessage;

View File

@@ -0,0 +1,165 @@
import type {
ProColumns,
ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { SmsTemplateVO } from '@/services/system/message/sms/template';
export const baseTenantColumns: ProColumns<SmsTemplateVO>[] = [
{
title: '模板编码',
dataIndex: 'code',
width: 100,
},
{
title: '模板名称',
dataIndex: 'name',
},
{
title: '模板标题',
dataIndex: 'type',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '模板内容',
dataIndex: 'content',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '发送人名称',
dataIndex: 'type',
},
{
title: '邮箱账号',
dataIndex: 'type',
},
{
title: '开启状态',
dataIndex: 'status',
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
render: (_, record: SmsTemplateVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const formColumns = (type: string): ProFormColumnsType[] => [
{
title: '短信渠道编号',
dataIndex: 'channelId',
valueType: 'select',
formItemProps: {
rules: [
{
required: true,
message: '请选择短信渠道编号',
},
],
},
},
{
title: '短信类型',
dataIndex: 'type',
valueType: 'select',
formItemProps: {
rules: [
{
required: true,
message: '请选择短信类型',
},
],
},
},
{
title: '模板编号',
dataIndex: 'code',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板编号',
},
],
},
},
{
title: '模板名称',
dataIndex: 'name',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板名称',
},
],
},
},
{
title: '模板内容',
dataIndex: 'type',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板内容',
},
],
},
},
{
title: '开启状态',
dataIndex: 'status',
valueType: 'select',
fieldProps: {
placeholder: '请选择开启状态',
options: [
{
label: '正常',
value: 1,
},
{
label: '禁用',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请选择状态',
},
],
},
},
{
title: '短信 API 模板编号',
dataIndex: 'apiTemplateId',
fieldProps: {
placeholder: '请输入短信 API 的模板编号',
},
},
{
title: '备注',
dataIndex: 'remark',
fieldProps: {
placeholder: '请输入备注',
},
},
];
export const formTestColumns = (type: string): ProFormColumnsType[] => [
{
title: '模板内容',
dataIndex: 'content',
valueType: 'textarea',
},
{
title: '手机号',
dataIndex: 'mobile',
},
];

View File

@@ -0,0 +1,174 @@
import { PlusOutlined } from '@ant-design/icons';
import type {
ActionType,
ProColumns,
ProCoreActionType,
} from '@ant-design/pro-components';
import { message, Popconfirm } from 'antd';
import React, { useCallback, useRef, useState } from 'react';
import ConfigurableDrawerForm, {
type ConfigurableDrawerFormRef,
} from '@/components/DrawerForm';
import EnhancedProTable from '@/components/EnhancedProTable';
import type { ToolbarAction } from '@/components/EnhancedProTable/types';
import { formStatusType } from '@/constants';
import {
createSmsTemplate,
deleteSmsTemplate,
getSmsTemplatePage,
type SmsTemplateVO,
sendSms,
updateSmsTemplate,
} from '@/services/system/message/sms/template';
import { baseTenantColumns, formColumns, formTestColumns } from './config';
const SyStemMessageSmsTemplate = () => {
const tableRef = useRef<ActionType>(null);
const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null);
const [type, setType] = useState<'create' | 'update' | 'test'>('create');
const testRef = useRef<ConfigurableDrawerFormRef>(null);
const [currentItem, setCurrentItem] = useState<SmsTemplateVO>();
const onFetch = async (
params: SmsTemplateVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getSmsTemplatePage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleSend = async (record: SmsTemplateVO) => {
setType('test');
setCurrentItem(record);
testRef.current?.open(record);
};
const handleEdit = (record: SmsTemplateVO) => {
setType('update');
setCurrentItem(record);
configurableDrawerRef.current?.open(record);
};
const handleAdd = () => {
setType('create');
configurableDrawerRef.current?.open();
};
const handleSubmit = useCallback(
async (values: SmsTemplateVO) => {
if (type === 'create') {
await createSmsTemplate(values);
message.success('创建成功');
} else {
await updateSmsTemplate({
...values,
id: currentItem!.id,
});
message.success('编辑成功');
}
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const handleTestSubmit = useCallback(
async (values: SmsTemplateVO) => {
if (currentItem?.status === 1) {
return message.error('请先开启状态');
}
const res = await sendSms({
...currentItem,
...values,
mobile: '',
templateParams: new Map(),
templateCode: currentItem!.code,
});
message.success('提交发送成功!发送结果,见发送日志编号:' + res);
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const toolbarActions: ToolbarAction[] = [
{
key: 'add',
label: '新建',
type: 'primary',
icon: <PlusOutlined />,
onClick: handleAdd,
},
];
const actionColumns: ProColumns<SmsTemplateVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 120,
render: (
text: React.ReactNode,
record: SmsTemplateVO,
_: number,
action: ProCoreActionType | undefined,
) => [
<a key="edit" onClick={() => handleEdit(record)}>
</a>,
<a key="detail" onClick={() => handleSend(record)}>
</a>,
<Popconfirm
title="是否删除?"
key="delete"
onConfirm={async () => {
await deleteSmsTemplate(record.id);
message.success('删除成功');
action?.reload?.();
}}
okText="是"
cancelText="否"
>
<a style={{ color: 'var(--ant-red)' }} key="delete">
</a>
</Popconfirm>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<SmsTemplateVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
toolbarActions={toolbarActions}
showSelection={false}
/>
<ConfigurableDrawerForm
ref={configurableDrawerRef}
title={formStatusType[type]}
columns={formColumns(type)}
onSubmit={handleSubmit}
/>
<ConfigurableDrawerForm
ref={testRef}
title={formStatusType[type]}
columns={formTestColumns(type)}
onSubmit={handleTestSubmit}
/>
</>
);
};
export default SyStemMessageSmsTemplate;

View File

@@ -0,0 +1,105 @@
import type {
ProColumns,
ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { NoticeVO } from '@/services/system/message/notice';
export const baseTenantColumns: ProColumns<NoticeVO>[] = [
{
title: '公告编号',
dataIndex: 'id',
width: 100,
hideInSearch: true,
},
{
title: '公告标题',
dataIndex: 'title',
},
{
title: '公告类型',
dataIndex: 'type',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '状态',
dataIndex: 'status',
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
hideInSearch: true,
render: (_, record: NoticeVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const formColumns = (type: string): ProFormColumnsType[] => [
{
title: '公告标题',
dataIndex: 'title',
tip: '公告标题', // 提示信息
formItemProps: {
rules: [
{
required: true,
message: '请输入用户名',
},
],
},
},
{
title: '公告内容',
dataIndex: 'content',
formItemProps: {
rules: [
{
required: true,
message: '请输入公告内容',
},
],
},
},
{
title: '公告类型',
dataIndex: 'type',
formItemProps: {
rules: [
{
required: true,
message: '请输入公告类型',
},
],
},
},
{
title: '状态',
dataIndex: 'status',
valueType: 'select',
fieldProps: {
options: [
{
label: '正常',
value: 1,
},
{
label: '禁用',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请选择状态',
},
],
},
},
{
title: '备注',
dataIndex: 'username',
},
];

View File

@@ -0,0 +1,126 @@
import type {
ActionType,
ProColumns,
ProCoreActionType,
} from '@ant-design/pro-components';
import { Popconfirm } from 'antd';
import React, { useCallback, useRef, useState } from 'react';
import ConfigurableDrawerForm, {
type ConfigurableDrawerFormRef,
} from '@/components/DrawerForm';
import EnhancedProTable from '@/components/EnhancedProTable';
import { formStatusType } from '@/constants';
import {
createNotice,
deleteNotice,
getNoticePage,
type NoticeVO,
pushNotice,
updateNotice,
} from '@/services/system/message/notice';
import { baseTenantColumns, formColumns } from './config';
const SyStemMessageNotice = () => {
const tableRef = useRef<ActionType>(null);
const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null);
const [type, setType] = useState<'create' | 'update'>('create');
const [id, setId] = useState<number>(0);
const onFetch = async (
params: NoticeVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getNoticePage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleSend = async (record: NoticeVO) => {
await pushNotice(record.id);
tableRef.current?.reload();
};
const handleEdit = (record: NoticeVO) => {
setType('update');
setId(record.id);
configurableDrawerRef.current?.open(record);
};
const handleSubmit = useCallback(
async (values: NoticeVO) => {
if (type === 'create') {
await createNotice(values);
} else {
await updateNotice({
...values,
id,
});
}
tableRef.current?.reload();
return true;
},
[type, id],
);
const actionColumns: ProColumns<NoticeVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 120,
render: (
text: React.ReactNode,
record: NoticeVO,
_: number,
action: ProCoreActionType | undefined,
) => [
<a key="edit" onClick={() => handleEdit(record)}>
</a>,
<Popconfirm
title="是否删除?"
key="delete"
onConfirm={async () => {
await deleteNotice(record.id);
action?.reload?.();
}}
okText="是"
cancelText="否"
>
<a style={{ color: 'var(--ant-red)' }} key="delete">
</a>
</Popconfirm>,
<a key="detail" onClick={() => handleSend(record)}>
</a>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<NoticeVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
showSelection={false}
/>
<ConfigurableDrawerForm
ref={configurableDrawerRef}
title={formStatusType[type]}
columns={formColumns(type)}
onSubmit={handleSubmit}
/>
</>
);
};
export default SyStemMessageNotice;

View File

@@ -0,0 +1,142 @@
import type {
ProColumns,
ProDescriptionsItemProps,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { NotifyMessageVO } from '@/services/system/message/notify/message';
export const baseTenantColumns: ProColumns<NotifyMessageVO>[] = [
{
title: '编号',
dataIndex: 'id',
width: 100,
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '用户类型',
dataIndex: 'userType',
},
{
title: '用户编号',
dataIndex: 'userId',
},
{
title: '模板编码',
dataIndex: 'templateCode',
},
{
title: '发送人名称',
dataIndex: 'templateNickname',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '模版内容',
dataIndex: 'templateContent',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '模版参数',
dataIndex: 'templateParams',
hideInSearch: true,
},
{
title: '模版类型',
dataIndex: 'templateType',
valueType: 'select',
},
{
title: '是否已读',
dataIndex: 'readStatus',
hideInSearch: true,
},
{
title: '阅读时间',
dataIndex: 'readTime',
hideInSearch: true,
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: NotifyMessageVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const descriptionsColumns = (): ProDescriptionsItemProps<
Record<string, any>,
'text'
>[] => [
{
title: '编号',
key: 'id',
dataIndex: 'id',
},
{
title: '用户类型',
key: 'userType',
dataIndex: 'userType',
},
{
title: '用户编号',
key: 'userId',
dataIndex: 'userId',
},
{
title: '模版编号',
key: 'templateId',
dataIndex: 'templateId',
},
{
title: '模板编码',
key: 'templateCode',
dataIndex: 'templateCode',
},
{
title: '发送人名称',
key: 'templateNickname',
dataIndex: 'templateNickname',
},
{
title: '模版内容',
key: 'templateContent',
dataIndex: 'templateContent',
},
{
title: '模版参数',
key: 'createTime',
dataIndex: 'createTime',
},
{
title: '模版类型',
key: 'templateType',
dataIndex: 'templateType',
},
{
title: '是否已读',
key: 'readStatus',
dataIndex: 'readStatus',
},
{
title: '阅读时间',
key: 'readTime',
dataIndex: 'readTime',
},
{
title: '创建时间',
key: 'createTime',
dataIndex: 'createTime',
},
];

View File

@@ -0,0 +1,70 @@
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import React, { useRef } from 'react';
import EnhancedProTable from '@/components/EnhancedProTable';
import ModalDescriptions, {
type DescriptionsFormRef,
} from '@/components/ModalDescriptions';
import {
getNotifyMessagePage,
type NotifyMessageVO,
} from '@/services/system/message/notify/message';
import { baseTenantColumns, descriptionsColumns } from './config';
const SyStemMessageNotifyMessage = () => {
const tableRef = useRef<ActionType>(null);
const descriptionsRef = useRef<DescriptionsFormRef>(null);
const onFetch = async (
params: NotifyMessageVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getNotifyMessagePage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleDetail = (record: NotifyMessageVO) => {
descriptionsRef.current?.open(record);
};
const actionColumns: ProColumns<NotifyMessageVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 80,
render: (text: React.ReactNode, record: NotifyMessageVO) => [
<a key="editable" onClick={() => handleDetail(record)}>
</a>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<NotifyMessageVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
showSelection={false}
/>
<ModalDescriptions
ref={descriptionsRef}
title="登录日志详情"
columns={descriptionsColumns()}
/>
</>
);
};
export default SyStemMessageNotifyMessage;

View File

@@ -0,0 +1,193 @@
import type {
ProColumns,
ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { NotifyTemplateVO } from '@/services/system/message/notify/template';
export const baseTenantColumns: ProColumns<NotifyTemplateVO>[] = [
{
title: '模板编码',
dataIndex: 'code',
width: 100,
},
{
title: '模板名称',
dataIndex: 'name',
},
{
title: '类型',
dataIndex: 'type',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '发送人名称',
dataIndex: 'nickname',
hideInSearch: true,
},
{
title: '模板内容',
dataIndex: 'content',
hideInSearch: true,
},
{
title: '开启状态',
dataIndex: 'status',
},
{
title: '备注',
dataIndex: 'remark',
hideInSearch: true,
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
hideInSearch: true,
render: (_, record: NotifyTemplateVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const formColumns = (type: string): ProFormColumnsType[] => [
{
title: '模版编码',
dataIndex: 'code',
tip: '模版编码', // 提示信息
formItemProps: {
rules: [
{
required: true,
message: '请输入模版编码',
},
],
},
},
{
title: '模板名称',
dataIndex: 'name',
formItemProps: {
rules: [
{
required: true,
message: '请输入模版名称',
},
],
},
},
{
title: '发件人名称',
dataIndex: 'nickname',
formItemProps: {
rules: [
{
required: true,
message: '请输入发件人名称',
},
],
},
},
{
title: '模板内容',
dataIndex: 'content',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板内容',
},
],
},
},
{
title: '类型',
dataIndex: 'type',
formItemProps: {
rules: [
{
required: true,
message: '请选择类型',
},
],
},
},
{
title: '开启状态',
dataIndex: 'status',
valueType: 'select',
fieldProps: {
placeholder: '请选择开启状态',
options: [
{
label: '正常',
value: 1,
},
{
label: '禁用',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请选择状态',
},
],
},
},
{
title: '备注',
dataIndex: 'remark',
fieldProps: {
placeholder: '请输入备注',
},
},
];
export const formTestColumns = (type: string): ProFormColumnsType[] => [
{
title: '模板内容',
dataIndex: 'content',
},
{
title: '用户类型',
dataIndex: 'userType',
valueType: 'radio',
fieldProps: {
options: [
{
label: '用户',
value: 1,
},
{
label: '管理员',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请输入模版名称',
},
],
},
},
{
title: '接收人ID',
dataIndex: 'userId',
formItemProps: {
rules: [
{
required: true,
message: '请输入接收人ID',
},
],
},
},
];

View File

@@ -0,0 +1,174 @@
import { PlusOutlined } from '@ant-design/icons';
import type {
ActionType,
ProColumns,
ProCoreActionType,
} from '@ant-design/pro-components';
import { message, Popconfirm } from 'antd';
import React, { useCallback, useRef, useState } from 'react';
import ConfigurableDrawerForm, {
type ConfigurableDrawerFormRef,
} from '@/components/DrawerForm';
import EnhancedProTable from '@/components/EnhancedProTable';
import type { ToolbarAction } from '@/components/EnhancedProTable/types';
import { formStatusType } from '@/constants';
import {
createNotifyTemplate,
deleteNotifyTemplate,
getNotifyTemplatePage,
type NotifyTemplateVO,
sendNotify,
updateNotifyTemplate,
} from '@/services/system/message/notify/template';
import { baseTenantColumns, formColumns, formTestColumns } from './config';
const SyStemMessageNotifyTemplate = () => {
const tableRef = useRef<ActionType>(null);
const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null);
const [type, setType] = useState<'create' | 'update' | 'test'>('create');
const testRef = useRef<ConfigurableDrawerFormRef>(null);
const [currentItem, setCurrentItem] = useState<NotifyTemplateVO>();
const onFetch = async (
params: NotifyTemplateVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getNotifyTemplatePage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleSend = async (record: NotifyTemplateVO) => {
setType('test');
setCurrentItem(record);
testRef.current?.open(record);
};
const handleEdit = (record: NotifyTemplateVO) => {
setType('update');
setCurrentItem(record);
configurableDrawerRef.current?.open(record);
};
const handleAdd = () => {
setType('create');
configurableDrawerRef.current?.open();
};
const handleSubmit = useCallback(
async (values: NotifyTemplateVO) => {
if (type === 'create') {
await createNotifyTemplate(values);
message.success('创建成功');
} else {
await updateNotifyTemplate({
...values,
id: currentItem!.id,
});
message.success('编辑成功');
}
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const handleTestSubmit = useCallback(
async (values: NotifyTemplateVO) => {
if (currentItem?.status === 1) {
return message.error('请先开启状态');
}
const res = await sendNotify({
...currentItem,
...values,
mobile: '',
templateParams: new Map(),
templateCode: currentItem!.code,
});
message.success('提交发送成功!发送结果,见发送日志编号:' + res);
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const toolbarActions: ToolbarAction[] = [
{
key: 'add',
label: '新建',
type: 'primary',
icon: <PlusOutlined />,
onClick: handleAdd,
},
];
const actionColumns: ProColumns<NotifyTemplateVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 120,
render: (
text: React.ReactNode,
record: NotifyTemplateVO,
_: number,
action: ProCoreActionType | undefined,
) => [
<a key="edit" onClick={() => handleEdit(record)}>
</a>,
<a key="detail" onClick={() => handleSend(record)}>
</a>,
<Popconfirm
title="是否删除?"
key="delete"
onConfirm={async () => {
await deleteNotifyTemplate(record.id);
message.success('删除成功');
action?.reload?.();
}}
okText="是"
cancelText="否"
>
<a style={{ color: 'var(--ant-red)' }} key="delete">
</a>
</Popconfirm>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<NotifyTemplateVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
toolbarActions={toolbarActions}
showSelection={false}
/>
<ConfigurableDrawerForm
ref={configurableDrawerRef}
title={formStatusType[type]}
columns={formColumns(type)}
onSubmit={handleSubmit}
/>
<ConfigurableDrawerForm
ref={testRef}
title={formStatusType[type]}
columns={formTestColumns(type)}
onSubmit={handleTestSubmit}
/>
</>
);
};
export default SyStemMessageNotifyTemplate;

View File

@@ -0,0 +1,127 @@
import type {
ProColumns,
ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { SmsChannelVO } from '@/services/system/message/sms/channel';
export const baseTenantColumns: ProColumns<SmsChannelVO>[] = [
{
title: '编号',
dataIndex: 'id',
width: 100,
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '短信签名',
dataIndex: 'signature',
},
{
title: '渠道编码',
dataIndex: 'code',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '启用状态',
dataIndex: 'status',
valueType: 'select',
},
{
title: '备注',
dataIndex: 'remark',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '短信 API 的账号',
dataIndex: 'apiKey',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '短信 API 的密钥',
dataIndex: 'apiSecret',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '短信发送回调 URL',
dataIndex: 'callbackUrl',
hideInSearch: true,
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: SmsChannelVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const formColumns = (type: string): ProFormColumnsType[] => [
{
title: '短信签名',
dataIndex: 'signature',
formItemProps: {
rules: [
{
required: true,
message: '请输入用户名',
},
],
},
},
{
title: '渠道编码',
dataIndex: 'code',
valueType: 'select',
formItemProps: {
rules: [
{
required: true,
message: '请输入用户名',
},
],
},
},
{
title: '启用状态',
dataIndex: 'status',
valueType: 'radio',
},
{
title: '备注',
dataIndex: 'remark',
},
{
title: '短信 API 的账号',
dataIndex: 'apiKey',
formItemProps: {
rules: [
{
required: true,
message: '请输入用户名',
},
],
},
},
{
title: '短信 API 的密钥',
dataIndex: 'apiSecret',
},
{
title: '短信发送回调 URL',
dataIndex: 'callbackUrl',
},
];

View File

@@ -0,0 +1,134 @@
import { PlusOutlined } from '@ant-design/icons';
import type {
ActionType,
ProColumns,
ProCoreActionType,
} from '@ant-design/pro-components';
import { message, Popconfirm } from 'antd';
import React, { useCallback, useRef, useState } from 'react';
import ConfigurableDrawerForm, {
type ConfigurableDrawerFormRef,
} from '@/components/DrawerForm';
import EnhancedProTable from '@/components/EnhancedProTable';
import type { ToolbarAction } from '@/components/EnhancedProTable/types';
import { formStatusType } from '@/constants';
import {
createSmsChannel,
deleteSmsChannel,
getSmsChannelPage,
type SmsChannelVO,
updateSmsChannel,
} from '@/services/system/message/sms/channel';
import { baseTenantColumns, formColumns } from './config';
const SyStemLogLogin = () => {
const tableRef = useRef<ActionType>(null);
const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null);
const [type, setType] = useState<'create' | 'update'>('create');
const [currentItem, setCurrentItem] = useState<SmsChannelVO>();
const onFetch = async (
params: SmsChannelVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getSmsChannelPage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleEdit = (record: SmsChannelVO) => {
setType('update');
setCurrentItem(record);
configurableDrawerRef.current?.open(record);
};
const handleAdd = () => {
setType('create');
configurableDrawerRef.current?.open({});
};
const toolbarActions: ToolbarAction[] = [
{
key: 'add',
label: '新建',
type: 'primary',
icon: <PlusOutlined />,
onClick: handleAdd,
},
];
const actionColumns: ProColumns<SmsChannelVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 80,
render: (
text: React.ReactNode,
record: SmsChannelVO,
_: number,
action: ProCoreActionType | undefined,
) => [
<a key="editable" onClick={() => handleEdit(record)}>
</a>,
<Popconfirm
title="是否删除?"
key="delete"
onConfirm={async () => {
await deleteSmsChannel(record.id);
message.success('删除成功');
action?.reload?.();
}}
okText="是"
cancelText="否"
>
<a style={{ color: 'var(--ant-red)' }} key="delete">
</a>
</Popconfirm>,
],
};
const handleSubmit = useCallback(
async (values: SmsChannelVO) => {
if (type === 'create') {
await createSmsChannel(values);
} else {
await updateSmsChannel({
...values,
id: currentItem!.id,
});
}
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<SmsChannelVO>
ref={tableRef}
columns={columns}
request={onFetch}
toolbarActions={toolbarActions}
headerTitle="短信渠道"
showIndex={false}
showSelection={false}
/>
<ConfigurableDrawerForm
ref={configurableDrawerRef}
title={formStatusType[type]}
columns={formColumns(type)}
onSubmit={handleSubmit}
/>
</>
);
};
export default SyStemLogLogin;

View File

@@ -0,0 +1,197 @@
import type {
ProColumns,
ProDescriptionsItemProps,
} from '@ant-design/pro-components';
import { Space, Tag } from 'antd';
import dayjs from 'dayjs';
import type { SmsLogVO } from '@/services/system/message/sms/log';
export const baseTenantColumns: ProColumns<SmsLogVO>[] = [
{
title: '编号',
dataIndex: 'id',
width: 100,
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
hideInSearch: true,
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: SmsLogVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '手机号',
dataIndex: 'mobile',
},
{
title: '短信内容',
dataIndex: 'templateContent',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '发送状态',
dataIndex: 'sendStatus',
},
{
title: '接收状态',
dataIndex: 'receiveStatus',
},
{
title: '短信渠道',
dataIndex: 'channelId',
},
{
title: '模板编号',
dataIndex: 'templateId',
},
{
title: '短信类型',
dataIndex: 'templateType',
hideInSearch: true,
},
{
title: '发送时间',
dataIndex: 'sendTime',
valueType: 'dateRange',
hideInTable: true,
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: SmsLogVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '接收时间',
dataIndex: 'receiveTime',
valueType: 'dateRange',
hideInTable: true,
search: {
transform: (value) => {
return {
[`createTime[0]`]: dayjs(value[0])
.startOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
[`createTime[1]`]: dayjs(value[1])
.endOf('day')
.format('YYYY-MM-DD HH:mm:ss'),
};
},
},
render: (_, record: SmsLogVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const descriptionsColumns = (): ProDescriptionsItemProps<
Record<string, any>,
'text'
>[] => [
{
title: '日志主键',
key: 'id',
dataIndex: 'id',
},
{
title: '短信渠道',
key: 'channelId',
dataIndex: 'channelId',
},
{
title: '短信模板',
key: 'templateCode',
dataIndex: 'templateCode',
},
{
title: 'API 的模板编号',
key: 'apiTemplateId',
dataIndex: 'apiTemplateId',
},
{
title: '用户信息',
key: 'mobile',
dataIndex: 'mobile',
render(dom, record) {
return (
<>
<Space>
<Tag>{record.mobile}</Tag>
{record.userId && <Tag>{record.userId}</Tag>}
</Space>
</>
);
},
},
{
title: '短信内容',
key: 'templateContent',
dataIndex: 'templateContent',
},
{
title: '短信参数',
key: 'templateParams',
dataIndex: 'templateParams',
},
{
title: '创建时间',
key: 'createTime',
dataIndex: 'createTime',
},
{
title: '发送状态',
key: 'sendStatus',
dataIndex: 'sendStatus',
},
{
title: '发送时间',
key: 'sendTime',
dataIndex: 'sendTime',
},
{
title: 'API 发送结果',
key: 'apiSendMsg',
dataIndex: 'apiSendMsg',
},
{
title: 'API 短信编号',
key: 'apiSerialNo',
dataIndex: 'apiSerialNo',
},
{
title: 'API 请求编号',
key: 'apiRequestId',
dataIndex: 'apiRequestId',
},
{
title: 'API 接收状态',
key: 'receiveStatus',
dataIndex: 'receiveStatus',
},
{
title: 'API 接收结果',
key: 'apiReceiveMsg',
dataIndex: 'apiReceiveMsg',
},
];

View File

@@ -0,0 +1,70 @@
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import React, { useRef } from 'react';
import EnhancedProTable from '@/components/EnhancedProTable';
import ModalDescriptions, {
type DescriptionsFormRef,
} from '@/components/ModalDescriptions';
import {
getSmsLogPage,
type SmsLogVO,
} from '@/services/system/message/sms/log';
import { baseTenantColumns, descriptionsColumns } from './config';
const SyStemMessageNotifyMessage = () => {
const tableRef = useRef<ActionType>(null);
const descriptionsRef = useRef<DescriptionsFormRef>(null);
const onFetch = async (
params: SmsLogVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getSmsLogPage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleDetail = (record: SmsLogVO) => {
descriptionsRef.current?.open(record);
};
const actionColumns: ProColumns<SmsLogVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 80,
render: (text: React.ReactNode, record: SmsLogVO) => [
<a key="editable" onClick={() => handleDetail(record)}>
</a>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<SmsLogVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
showSelection={false}
/>
<ModalDescriptions
ref={descriptionsRef}
title="登录日志详情"
columns={descriptionsColumns()}
/>
</>
);
};
export default SyStemMessageNotifyMessage;

View File

@@ -0,0 +1,171 @@
import type {
ProColumns,
ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { SmsTemplateVO } from '@/services/system/message/sms/template';
export const baseTenantColumns: ProColumns<SmsTemplateVO>[] = [
{
title: '模板编码',
dataIndex: 'code',
width: 100,
},
{
title: '模板名称',
dataIndex: 'name',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '模板内容',
dataIndex: 'content',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '短信类型',
dataIndex: 'type',
},
{
title: '状态',
dataIndex: 'status',
},
{
title: '备注',
dataIndex: 'remark',
hideInSearch: true,
},
{
title: '短信 API 的模板编号',
dataIndex: 'apiTemplateId',
},
{
title: '短信渠道',
dataIndex: 'channelCode',
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
render: (_, record: SmsTemplateVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const formColumns = (type: string): ProFormColumnsType[] => [
{
title: '短信渠道编号',
dataIndex: 'channelId',
valueType: 'select',
formItemProps: {
rules: [
{
required: true,
message: '请选择短信渠道编号',
},
],
},
},
{
title: '短信类型',
dataIndex: 'type',
valueType: 'select',
formItemProps: {
rules: [
{
required: true,
message: '请选择短信类型',
},
],
},
},
{
title: '模板编号',
dataIndex: 'code',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板编号',
},
],
},
},
{
title: '模板名称',
dataIndex: 'name',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板名称',
},
],
},
},
{
title: '模板内容',
dataIndex: 'type',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板内容',
},
],
},
},
{
title: '开启状态',
dataIndex: 'status',
valueType: 'select',
fieldProps: {
placeholder: '请选择开启状态',
options: [
{
label: '正常',
value: 1,
},
{
label: '禁用',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请选择状态',
},
],
},
},
{
title: '短信 API 模板编号',
dataIndex: 'apiTemplateId',
fieldProps: {
placeholder: '请输入短信 API 的模板编号',
},
},
{
title: '备注',
dataIndex: 'remark',
fieldProps: {
placeholder: '请输入备注',
},
},
];
export const formTestColumns = (type: string): ProFormColumnsType[] => [
{
title: '模板内容',
dataIndex: 'content',
valueType: 'textarea',
},
{
title: '手机号',
dataIndex: 'mobile',
},
];

View File

@@ -0,0 +1,174 @@
import { PlusOutlined } from '@ant-design/icons';
import type {
ActionType,
ProColumns,
ProCoreActionType,
} from '@ant-design/pro-components';
import { message, Popconfirm } from 'antd';
import React, { useCallback, useRef, useState } from 'react';
import ConfigurableDrawerForm, {
type ConfigurableDrawerFormRef,
} from '@/components/DrawerForm';
import EnhancedProTable from '@/components/EnhancedProTable';
import type { ToolbarAction } from '@/components/EnhancedProTable/types';
import { formStatusType } from '@/constants';
import {
createSmsTemplate,
deleteSmsTemplate,
getSmsTemplatePage,
type SmsTemplateVO,
sendSms,
updateSmsTemplate,
} from '@/services/system/message/sms/template';
import { baseTenantColumns, formColumns, formTestColumns } from './config';
const SyStemMessageSmsTemplate = () => {
const tableRef = useRef<ActionType>(null);
const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null);
const [type, setType] = useState<'create' | 'update' | 'test'>('create');
const testRef = useRef<ConfigurableDrawerFormRef>(null);
const [currentItem, setCurrentItem] = useState<SmsTemplateVO>();
const onFetch = async (
params: SmsTemplateVO & {
pageSize?: number;
current?: number;
},
) => {
const data = await getSmsTemplatePage({
...params,
pageNo: params.current,
pageSize: params.pageSize,
});
return {
data: data.list,
success: true,
total: data.total,
};
};
const handleSend = async (record: SmsTemplateVO) => {
setType('test');
setCurrentItem(record);
testRef.current?.open(record);
};
const handleEdit = (record: SmsTemplateVO) => {
setType('update');
setCurrentItem(record);
configurableDrawerRef.current?.open(record);
};
const handleAdd = () => {
setType('create');
configurableDrawerRef.current?.open();
};
const handleSubmit = useCallback(
async (values: SmsTemplateVO) => {
if (type === 'create') {
await createSmsTemplate(values);
message.success('创建成功');
} else {
await updateSmsTemplate({
...values,
id: currentItem!.id,
});
message.success('编辑成功');
}
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const handleTestSubmit = useCallback(
async (values: SmsTemplateVO) => {
if (currentItem?.status === 1) {
return message.error('请先开启状态');
}
const res = await sendSms({
...currentItem,
...values,
mobile: '',
templateParams: new Map(),
templateCode: currentItem!.code,
});
message.success('提交发送成功!发送结果,见发送日志编号:' + res);
tableRef.current?.reload();
return true;
},
[type, currentItem],
);
const toolbarActions: ToolbarAction[] = [
{
key: 'add',
label: '新建',
type: 'primary',
icon: <PlusOutlined />,
onClick: handleAdd,
},
];
const actionColumns: ProColumns<SmsTemplateVO> = {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 120,
render: (
text: React.ReactNode,
record: SmsTemplateVO,
_: number,
action: ProCoreActionType | undefined,
) => [
<a key="edit" onClick={() => handleEdit(record)}>
</a>,
<a key="detail" onClick={() => handleSend(record)}>
</a>,
<Popconfirm
title="是否删除?"
key="delete"
onConfirm={async () => {
await deleteSmsTemplate(record.id);
message.success('删除成功');
action?.reload?.();
}}
okText="是"
cancelText="否"
>
<a style={{ color: 'var(--ant-red)' }} key="delete">
</a>
</Popconfirm>,
],
};
const columns = [...baseTenantColumns, actionColumns];
return (
<>
<EnhancedProTable<SmsTemplateVO>
ref={tableRef}
columns={columns}
request={onFetch}
headerTitle="登录日志"
showIndex={false}
toolbarActions={toolbarActions}
showSelection={false}
/>
<ConfigurableDrawerForm
ref={configurableDrawerRef}
title={formStatusType[type]}
columns={formColumns(type)}
onSubmit={handleSubmit}
/>
<ConfigurableDrawerForm
ref={testRef}
title={formStatusType[type]}
columns={formTestColumns(type)}
onSubmit={handleTestSubmit}
/>
</>
);
};
export default SyStemMessageSmsTemplate;

View File

@@ -1,33 +1,37 @@
import { type TenantVO, deleteTenant } from "@/services/system/tenant/list"; import type {
import { ProColumns } from "@ant-design/pro-components"; ProColumns,
import { DatePicker, Modal, Popconfirm } from "antd"; ProFormColumnsType,
import { FormInstance } from "antd/lib"; } from '@ant-design/pro-components';
import dayjs from "dayjs"; import { DatePicker, Modal, Popconfirm } from 'antd';
import { FormInstance } from 'antd/lib';
import dayjs from 'dayjs';
import { deleteTenant, type TenantVO } from '@/services/system/tenant/list';
import { getTenantPackageList } from '@/services/system/tenant/package';
export const baseTenantColumns: ProColumns<TenantVO>[] = [ export const baseTenantColumns: ProColumns<TenantVO>[] = [
{ {
title: "租户编号", title: '租户编号',
dataIndex: "id", dataIndex: 'id',
tip: "租户编号", tip: '租户编号',
width: 100, width: 100,
hideInSearch: true, // 在搜索表单中隐藏 hideInSearch: true, // 在搜索表单中隐藏
}, },
{ {
title: "租户名", title: '租户名',
dataIndex: "name", dataIndex: 'name',
tip: "租户名", // 提示信息 tip: '租户名', // 提示信息
}, },
{ {
title: "租户套餐", title: '租户套餐',
dataIndex: "packageId", dataIndex: 'packageId',
valueType: "select", valueType: 'select',
hideInSearch: true, // 在搜索表单中隐藏
request: async () => { request: async () => {
return [ const packageList: { id: number; name: string }[] =
{ await getTenantPackageList();
label: "默认套餐", console.log(packageList);
value: 1, packageList.map((item) => ({ label: item.name, value: item.id }));
}, return packageList.map((item) => ({ label: item.name, value: item.id }));
];
}, },
// valueEnum: { // valueEnum: {
// all: { text: "全部", status: "Default" }, // all: { text: "全部", status: "Default" },
@@ -36,60 +40,67 @@ export const baseTenantColumns: ProColumns<TenantVO>[] = [
// }, // },
}, },
{ {
title: "联系人", title: '联系人',
dataIndex: "contactName", dataIndex: 'contactName',
}, },
{ {
title: "联系手机", title: '联系手机',
dataIndex: "contactMobile", dataIndex: 'contactMobile',
}, },
{ {
title: "账号额度", title: '账号额度',
dataIndex: "accountCount", dataIndex: 'accountCount',
hideInSearch: true, // 在搜索表单中隐藏 hideInSearch: true, // 在搜索表单中隐藏
}, },
{ {
title: "过期时间", title: '过期时间',
dataIndex: "expireTime", dataIndex: 'expireTime',
valueType: "dateTime", valueType: 'dateTime',
hideInSearch: true, // 在搜索表单中隐藏 hideInSearch: true, // 在搜索表单中隐藏
}, },
{ title: "绑定域名", dataIndex: "website", width: 100 }, { title: '绑定域名', dataIndex: 'website', width: 100, hideInSearch: true },
{ {
title: "租户状态", title: '租户状态',
dataIndex: "status", dataIndex: 'status',
valueType: "select", valueType: 'select',
valueEnum: { fieldProps: {
all: { text: "全部", status: "Default" }, options: [
open: { text: "未解决", status: "Error" }, {
closed: { text: "已解决", status: "Success" }, label: '开启',
value: 0,
},
{
label: '关闭',
value: 1,
},
],
}, },
}, },
{ {
title: "创建时间", title: '创建时间',
dataIndex: "createTime", dataIndex: 'createTime',
valueType: "dateRange", valueType: 'dateRange',
search: { search: {
transform: (value) => { transform: (value) => {
return [`${value[0]} 00:00:00`, `${value[1]} 00:00:00`]; return [`${value[0]} 00:00:00`, `${value[1]} 00:00:00`];
}, },
}, },
render: (_, record: TenantVO) => render: (_, record: TenantVO) =>
dayjs(record.createTime).format("YYYY-MM-DD HH:mm:ss"), dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
}, },
]; ];
export const formColumns: any = [ export const formColumns = (type: string): ProFormColumnsType[] => [
{ {
title: "租户名", title: '租户名',
dataIndex: "name", dataIndex: 'name',
tip: "租户名", // 提示信息 tip: '租户名', // 提示信息
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入用户名", message: '请输入用户名',
}, },
// { // {
// min: 2, // min: 2,
@@ -100,121 +111,121 @@ export const formColumns: any = [
}, },
}, },
{ {
title: "租户套餐", title: '租户套餐',
dataIndex: "packageId", dataIndex: 'packageId',
valueType: "select", valueType: 'select',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择租户套餐", message: '请选择租户套餐',
}, },
], ],
}, },
fieldProps: { fieldProps: {
placeholder: "请选择套餐类型", placeholder: '请选择套餐类型',
options: [ options: [
{ {
label: "普通套餐", label: '普通套餐',
value: 111, value: 111,
}, },
], ],
}, },
}, },
{ {
title: "联系人", title: '联系人',
dataIndex: "contactName", dataIndex: 'contactName',
}, },
{ {
title: "联系手机", title: '联系手机',
dataIndex: "contactMobile", dataIndex: 'contactMobile',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入联系手机", message: '请输入联系手机',
}, },
], ],
}, },
}, },
{ {
title: "用户名称", title: '用户名称',
dataIndex: "username", dataIndex: 'username',
hideInForm: true, hideInForm: type === 'update',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入用户名称", message: '请输入用户名称',
}, },
{ {
pattern: /^[a-zA-Z0-9]+$/, pattern: /^[a-zA-Z0-9]+$/,
message: "用户账号由 0-9、a-z、A-Z 组成", message: '用户账号由 0-9、a-z、A-Z 组成',
}, },
// 用户账号由 数字、字母组成 // 用户账号由 数字、字母组成
], ],
}, },
}, },
{ {
title: "用户密码", title: '用户密码',
dataIndex: "password", dataIndex: 'password',
valueType: "password", valueType: 'password',
hideInForm: true, hideInForm: type === 'update',
fieldProps: { fieldProps: {
placeholder: "请输入用户密码", placeholder: '请输入用户密码',
autoComplete: "new-password", autoComplete: 'new-password',
}, },
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入用户密码", message: '请输入用户密码',
}, },
{ {
min: 4, min: 4,
max: 16, max: 16,
message: "密码长度为4-16个字符", message: '密码长度为4-16个字符',
}, },
], ],
}, },
}, },
{ {
title: "账号额度", title: '账号额度',
dataIndex: "accountCount", dataIndex: 'accountCount',
valueType: "digit", valueType: 'digit',
}, },
{ {
title: "过期时间", title: '过期时间',
dataIndex: "expireTime", dataIndex: 'expireTime',
valueType: "date", valueType: 'date',
fieldProps: { fieldProps: {
placeholder: "请选择过期时间", placeholder: '请选择过期时间',
format: "YYYY-MM-DD", format: 'YYYY-MM-DD',
}, },
}, },
{ title: "绑定域名", dataIndex: "website" }, { title: '绑定域名', dataIndex: 'website' },
{ {
title: "租户状态", title: '租户状态',
dataIndex: "status", dataIndex: 'status',
valueType: "radio", valueType: 'radio',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择租户状态", message: '请选择租户状态',
}, },
], ],
}, },
fieldProps: { fieldProps: {
placeholder: "请选择套餐类型", placeholder: '请选择套餐类型',
options: [ options: [
{ {
label: "启用", label: '启用',
value: 1, value: 1,
}, },
{ {
label: "禁用", label: '禁用',
value: 0, value: 0,
}, },
], ],

View File

@@ -1,25 +1,24 @@
import EnhancedProTable from "@/components/EnhancedProTable"; import { PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { Modal, Popconfirm } from 'antd';
import dayjs from 'dayjs';
import { ref } from 'process';
import React, { createContext, useCallback, useRef, useState } from 'react';
import ConfigurableDrawerForm, {
type ConfigurableDrawerFormRef,
} from '@/components/DrawerForm';
import EnhancedProTable from '@/components/EnhancedProTable';
import type { ToolbarAction } from '@/components/EnhancedProTable/types';
import { formStatusType } from '@/constants';
import { import {
getTenantPage,
createTenant, createTenant,
deleteTenant,
getTenantPage,
type TenantPageReqVO, type TenantPageReqVO,
type TenantVO, type TenantVO,
deleteTenant,
updateTenant, updateTenant,
} from "@/services/system/tenant/list"; } from '@/services/system/tenant/list';
import React, { createContext, useCallback } from "react"; import { baseTenantColumns, formColumns } from './config';
import ConfigurableDrawerForm, {
ConfigurableDrawerFormRef,
} from "@/components/DrawerForm";
import { useRef, useState } from "react";
import { formColumns, baseTenantColumns } from "./config";
import { PlusOutlined } from "@ant-design/icons";
import { ref } from "process";
import { ActionType, ProColumns } from "@ant-design/pro-components";
import { ToolbarAction } from "@/components/EnhancedProTable/types";
import { Modal, Popconfirm } from "antd";
import { formStatusType } from "@/constants";
import dayjs from "dayjs";
export const waitTimePromise = async (time: number = 90) => { export const waitTimePromise = async (time: number = 90) => {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {
@@ -30,13 +29,13 @@ export const waitTimePromise = async (time: number = 90) => {
const TenantList = () => { const TenantList = () => {
const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null); const configurableDrawerRef = useRef<ConfigurableDrawerFormRef>(null);
const tableRef = useRef<ActionType>(null); const tableRef = useRef<ActionType>(null);
const [type, setType] = useState<"create" | "update">("create"); const [type, setType] = useState<'create' | 'update'>('create');
const [id, setId] = useState<number>(0); const [id, setId] = useState<number>(0);
const onFetch = async ( const onFetch = async (
params: TenantPageReqVO & { params: TenantPageReqVO & {
pageSize?: number; pageSize?: number;
current?: number; current?: number;
} },
) => { ) => {
await waitTimePromise(); await waitTimePromise();
const data = await getTenantPage({ const data = await getTenantPage({
@@ -53,7 +52,7 @@ const TenantList = () => {
const handleSubmit = useCallback( const handleSubmit = useCallback(
async (values: TenantVO) => { async (values: TenantVO) => {
if (type === "create") { if (type === 'create') {
await createTenant(values); await createTenant(values);
} else { } else {
await updateTenant({ await updateTenant({
@@ -65,34 +64,34 @@ const TenantList = () => {
tableRef.current?.reload(); tableRef.current?.reload();
return true; return true;
}, },
[type] [type, id],
); );
const handleAdd = () => { const handleAdd = () => {
setType("create"); setType('create');
configurableDrawerRef.current?.open({}); configurableDrawerRef.current?.open({});
}; };
const handleEdit = (record: TenantVO) => { const handleEdit = (record: TenantVO) => {
setType("update"); setType('update');
setId(record.id); setId(record.id);
configurableDrawerRef.current?.open(record); configurableDrawerRef.current?.open(record);
}; };
const toolbarActions: ToolbarAction[] = [ const toolbarActions: ToolbarAction[] = [
{ {
key: "add", key: 'add',
label: "新建", label: '新建',
type: "primary", type: 'primary',
icon: <PlusOutlined />, icon: <PlusOutlined />,
onClick: handleAdd, onClick: handleAdd,
}, },
]; ];
const actionColumns: ProColumns<TenantVO> = { const actionColumns: ProColumns<TenantVO> = {
title: "操作", title: '操作',
dataIndex: "option", dataIndex: 'option',
valueType: "option", valueType: 'option',
fixed: "right", fixed: 'right',
width: 120, width: 120,
render: (text: React.ReactNode, record: TenantVO, _: any, action: any) => [ render: (text: React.ReactNode, record: TenantVO, _: any, action: any) => [
<a key="editable" onClick={() => handleEdit(record)}> <a key="editable" onClick={() => handleEdit(record)}>
@@ -130,7 +129,7 @@ const TenantList = () => {
<ConfigurableDrawerForm <ConfigurableDrawerForm
ref={configurableDrawerRef} ref={configurableDrawerRef}
title={formStatusType[type]} title={formStatusType[type]}
columns={formColumns} columns={formColumns(type)}
onSubmit={handleSubmit} onSubmit={handleSubmit}
/> />
</> </>

View File

@@ -1,14 +1,15 @@
import type { RequestOptions } from "@@/plugin-request/request"; import type { RequestOptions } from '@@/plugin-request/request';
import type { RequestConfig } from "@umijs/max"; import type { RequestConfig } from '@umijs/max';
import { message, notification } from "antd"; import { request } from '@umijs/max';
import { deleteUserCache } from "@/hooks/web/useCache"; import { message, notification } from 'antd';
import { deleteUserCache } from '@/hooks/web/useCache';
import { import {
getAccessToken, getAccessToken,
getRefreshToken, getRefreshToken,
getTenantId, getTenantId,
setToken, setToken,
} from "./utils/auth"; } from './utils/auth';
import { request } from "@umijs/max";
const tenantEnable = process.env.VITE_APP_TENANT_ENABLE; const tenantEnable = process.env.VITE_APP_TENANT_ENABLE;
// const { result_code, base_url, request_timeout } = config; // const { result_code, base_url, request_timeout } = config;
// 错误处理方案: 错误类型 // 错误处理方案: 错误类型
@@ -26,6 +27,27 @@ interface ResponseStructure {
code?: number; code?: number;
msg?: string; msg?: string;
} }
const ignoreMsgs = [
'无效的刷新令牌', // 刷新令牌被删除时,不用提示
'刷新令牌已过期', // 使用刷新令牌,刷新获取新的访问令牌时,结果因为过期失败,此时需要忽略。否则,会导致继续 401无法跳转到登出界面
];
import { EventEmitter } from 'events';
export const requestEventBus = new EventEmitter();
const errorCode: { [key: string]: string } = {
'400': '请求参数不正确',
'401': '账号未登录',
'403': '当前操作没有权限',
'404': '访问资源不存在',
'405': '请求方法不正确',
'423': '请求失败,请稍后重试',
'429': '请求失败,请稍后重试',
'500': '系统异常',
'501': '功能未实现/未开启',
'502': '错误的配置项',
'900': '重复请求,请稍后重试',
default: '系统未知错误,请反馈给管理员',
};
/** /**
* @name 错误处理 * @name 错误处理
@@ -34,8 +56,8 @@ interface ResponseStructure {
*/ */
const refreshToken = async () => { const refreshToken = async () => {
return await request("/system/auth/refresh-token", { return await request('/system/auth/refresh-token', {
method: "POST", method: 'POST',
params: { refreshToken: getRefreshToken() }, params: { refreshToken: getRefreshToken() },
}); });
}; };
@@ -69,7 +91,7 @@ const handleAuthorized = () => {
// 是否正在刷新中 // 是否正在刷新中
let isRefreshToken = false; let isRefreshToken = false;
// 请求队列 // 请求队列
let requestList: any[] = []; const requestList: any[] = [];
export const errorConfig: RequestConfig = { export const errorConfig: RequestConfig = {
// 错误处理: umi@3 的错误处理方案。 // 错误处理: umi@3 的错误处理方案。
errorConfig: { errorConfig: {
@@ -78,7 +100,7 @@ export const errorConfig: RequestConfig = {
const { success, data, code, msg } = res as unknown as ResponseStructure; const { success, data, code, msg } = res as unknown as ResponseStructure;
if (!success) { if (!success) {
const error: any = new Error(msg); const error: any = new Error(msg);
error.name = "BizError"; error.name = 'BizError';
error.info = { code, msg, data }; error.info = { code, msg, data };
throw error; // 抛出自制的错误 throw error; // 抛出自制的错误
} }
@@ -87,9 +109,9 @@ export const errorConfig: RequestConfig = {
errorHandler: async (error: any, opts: any) => { errorHandler: async (error: any, opts: any) => {
if (opts?.skipErrorHandler) throw error; if (opts?.skipErrorHandler) throw error;
// 我们的 errorThrower 抛出的错误。 // 我们的 errorThrower 抛出的错误。
console.log("errorHandler", error); console.log('errorHandler', error);
const errorInfo: ResponseStructure | undefined = error.info; const errorInfo: ResponseStructure | undefined = error.info;
if (error.name === "BizError") { if (error.name === 'BizError') {
if (errorInfo) { if (errorInfo) {
const { msg, code } = errorInfo; const { msg, code } = errorInfo;
message.error(msg); message.error(msg);
@@ -99,9 +121,9 @@ export const errorConfig: RequestConfig = {
// 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围 // 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围
message.error(`Response status:${error.response.status}`); message.error(`Response status:${error.response.status}`);
} else if (error.request) { } else if (error.request) {
message.error("None response! Please retry."); message.error('None response! Please retry.');
} else { } else {
message.error("发送请求时出了点问题:" + error.msg); message.error('发送请求时出了点问题:' + error.msg);
} }
}, },
}, },
@@ -118,9 +140,31 @@ export const errorConfig: RequestConfig = {
// 响应拦截器 // 响应拦截器
responseInterceptors: [ responseInterceptors: [
async (response) => { async (response) => {
const { data } = response as unknown as ResponseStructure; let { data } = response as unknown as ResponseStructure;
const config = response.config; const config = response.config;
const { code } = data; const { code } = data;
if (!data) {
// 返回“[HTTP]请求没有返回值”;
throw new Error();
}
// 未设置状态码则默认成功状态
// 二进制数据则直接返回,例如说 Excel 导出
if (
response.request.responseType === 'blob' ||
response.request.responseType === 'arraybuffer'
) {
// 注意:如果导出的响应为 json说明可能失败了不直接返回进行下载
// if (response.data.type !== "application/json") {
// return response.data;
// }
data = await new Response(data).json();
}
// // 获取错误信息
// const msg = data.msg || errorCode[code] || errorCode["default"];
// if (ignoreMsgs.indexOf(msg) !== -1) {
// // 如果是忽略的错误码,直接返回 msg 异常
// return Promise.reject(msg);
// }
// 发送请求时出了点问题 // 发送请求时出了点问题
if (code === 401) { if (code === 401) {
if (!isRefreshToken) { if (!isRefreshToken) {
@@ -132,34 +176,25 @@ export const errorConfig: RequestConfig = {
// 2. 进行刷新访问令牌 // 2. 进行刷新访问令牌
try { try {
const refreshTokenRes = await refreshToken(); const refreshTokenRes = await refreshToken();
console.log("刷新成功", refreshTokenRes); console.log('刷新成功', refreshTokenRes);
// 2.1 刷新成功,则回放队列的请求 + 当前请求 // 2.1 刷新成功,则回放队列的请求 + 当前请求
setToken(refreshTokenRes); setToken(refreshTokenRes);
console.log(getAccessToken()); // 发出 token 刷新事件
config.headers!.Authorization = "Bearer " + getAccessToken(); requestEventBus.emit('token-refreshed');
console.log(requestList);
requestList.forEach((cb: any) => {
cb();
});
} catch (e) { } catch (e) {
// 为什么需要 catch 异常呢?刷新失败时,请求因为 Promise.reject 触发异常。 // 为什么需要 catch 异常呢?刷新失败时,请求因为 Promise.reject 触发异常。
// 2.2 刷新失败,只回放队列的请求
requestList.forEach((cb: any) => {
cb();
});
// 提示是否要登出。即不回放当前请求!不然会形成递归 // 提示是否要登出。即不回放当前请求!不然会形成递归
return handleAuthorized(); return handleAuthorized();
} finally { } finally {
requestList = [];
isRefreshToken = false; isRefreshToken = false;
} }
return; return request(config.url!, config);
} else { } else {
console.log("刷新令牌失败"); console.log('刷新令牌失败');
//添加到队列,等待刷新获取到新的令牌 //添加到队列,等待刷新获取到新的令牌
return new Promise((resolve) => { return new Promise((resolve) => {
requestList.push(() => { requestList.push(() => {
config.headers!.Authorization = "Bearer " + getAccessToken(); // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers!.Authorization = 'Bearer ' + getAccessToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
resolve(request(config.url!, config)); resolve(request(config.url!, config));
}); });
}); });
@@ -169,7 +204,7 @@ export const errorConfig: RequestConfig = {
return Promise.reject(data); return Promise.reject(data);
} }
if (data?.success === false) { if (data?.success === false) {
message.error("请求失败!"); message.error('请求失败!');
return Promise.reject(data); return Promise.reject(data);
} }

View File

@@ -0,0 +1,27 @@
import { request } from "@umijs/max";
export interface LoginLogVO {
id: number;
logType: number;
traceId: number;
userId: number;
userType: number;
username: string;
result: number;
status: number;
userIp: string;
userAgent: string;
createTime: Date;
}
// 查询登录日志列表
export async function getLoginLogPage(params: PageParam) {
return request("/system/login-log/page", {
method: "GET",
params,
});
}
// // 导出登录日志
// export const exportLoginLog = (params) => {
// return request.download({ url: '/system/login-log/export', params })
// }

View File

@@ -0,0 +1,32 @@
import { request } from "@umijs/max";
export type OperateLogVO = {
id: number;
traceId: string;
userType: number;
userId: number;
userName: string;
type: string;
subType: string;
bizId: number;
action: string;
extra: string;
requestMethod: string;
requestUrl: string;
userIp: string;
userAgent: string;
creator: string;
creatorName: string;
createTime: Date;
};
export async function getOperateLogPage(params: PageParam) {
return request("/system/operate-log/page", {
method: "GET",
params,
});
}
// // 导出操作日志
// export const exportOperateLog = (params: any) => {
// return request.download({ url: "/system/operate-log/export", params });
// };

View File

@@ -0,0 +1,73 @@
import { request } from "@umijs/max";
export interface MailAccountVO {
id: number;
mail: string;
username: string;
password: string;
host: string;
createTime: Date;
port: number;
sslEnable: boolean;
starttlsEnable: boolean;
}
// 查询邮箱账号列表
// export const getMailAccountPage = async (params: PageParam) => {
// return await request.get({ url: '/system/mail-account/page', params })
// }
export async function getMailAccountPage(params: PageParam) {
return request("/system/mail-account/page", {
method: "GET",
params,
});
}
// 查询邮箱账号详情
// export const getMailAccount = async (id: number) => {
// return await request.get({ url: '/system/mail-account/get?id=' + id })
// }
export async function getMailAccount(id: number) {
return request("/system/mail-account/get", {
method: "GET",
params: { id },
});
}
// 新增邮箱账号
// export const createMailAccount = async (data: MailAccountVO) => {
// return await request.post({ url: "/system/mail-account/create", data });
// };
export async function createMailAccount(data: MailAccountVO) {
return request("/system/mail-account/create", {
method: "POST",
data,
});
}
// 修改邮箱账号
// export const updateMailAccount = async (data: MailAccountVO) => {
// return await request.put({ url: "/system/mail-account/update", data });
// };
export async function updateMailAccount(data: MailAccountVO) {
return request("/system/mail-account/update", {
method: "PUT",
data,
});
}
// 删除邮箱账号
// export const deleteMailAccount = async (id: number) => {
// return await request.delete({ url: "/system/mail-account/delete?id=" + id });
// };
export async function deleteMailAccount(id: number) {
return request("/system/mail-account/delete", {
method: "DELETE",
params: { id },
});
}
// 获得邮箱账号精简列表
// export const getSimpleMailAccountList = async () => {
// return request.get({ url: '/system/mail-account/simple-list' })
// }
export async function getSimpleMailAccountList() {
return request("/system/mail-account/simple-list", {
method: "GET",
});
}

View File

@@ -0,0 +1,41 @@
import { request } from "@umijs/max";
export interface MailLogVO {
id: number;
userId: number;
userType: number;
toMail: string;
accountId: number;
fromMail: string;
templateId: number;
templateCode: string;
templateNickname: string;
templateTitle: string;
templateContent: string;
templateParams: string;
sendStatus: number;
sendTime: Date;
sendMessageId: string;
sendException: string;
}
// 查询邮件日志列表
// export const getMailLogPage = async (params: PageParam) => {
// return await request.get({ url: '/system/mail-log/page', params })
// }
export async function getMailLogPage(params: PageParam) {
return request("/system/mail-log/page", {
method: "GET",
params,
});
}
// 查询邮件日志详情
// export const getMailLog = async (id: number) => {
// return await request.get({ url: '/system/mail-log/get?id=' + id })
// }
export async function getMailLog(id: number) {
return request("/system/mail-log/get", {
method: "GET",
params: { id },
});
}

View File

@@ -0,0 +1,81 @@
import { request } from "@umijs/max";
export interface MailTemplateVO {
id: number;
name: string;
code: string;
accountId: number;
nickname: string;
title: string;
content: string;
params: string;
status: number;
remark: string;
}
export interface MailSendReqVO {
mail: string;
templateCode: string;
templateParams: Map<String, Object>;
}
// 查询邮件模版列表
// export const getMailTemplatePage = async (params: PageParam) => {
// return await request.get({ url: '/system/mail-template/page', params })
// }
export async function getMailTemplatePage(params: PageParam) {
return request("/system/mail-template/page", {
method: "GET",
params,
});
}
// 查询邮件模版详情
// export const getMailTemplate = async (id: number) => {
// return await request.get({ url: '/system/mail-template/get?id=' + id })
// }
export async function getMailTemplate(id: number) {
return request("/system/mail-template/get", {
method: "GET",
params: { id },
});
}
// 新增邮件模版
// export const createMailTemplate = async (data: MailTemplateVO) => {
// return await request.post({ url: '/system/mail-template/create', data })
// }
export async function createMailTemplate(data: MailTemplateVO) {
return request("/system/mail-template/create", {
method: "POST",
data,
});
}
// 修改邮件模版
// export const updateMailTemplate = async (data: MailTemplateVO) => {
// return await request.put({ url: '/system/mail-template/update', data })
// }
export async function updateMailTemplate(data: MailTemplateVO) {
return request("/system/mail-template/update", {
method: "PUT",
data,
});
}
// 删除邮件模版
// export const deleteMailTemplate = async (id: number) => {
// return await request.delete({ url: '/system/mail-template/delete?id=' + id })
// }
export async function deleteMailTemplate(id: number) {
return request("/system/mail-template/delete", {
method: "PUT",
params: { id },
});
}
// 发送邮件
// export const sendMail = (data: MailSendReqVO) => {
// return request.post({ url: '/system/mail-template/send-mail', data })
// }
export async function sendMail(data: MailTemplateVO) {
return request("/system/mail-template/send-mail", {
method: "PUT",
data,
});
}

View File

@@ -0,0 +1,74 @@
import { request } from "@umijs/max";
export interface NoticeVO {
id: number;
title: string;
type: number;
content: string;
status: number;
remark: string;
creator: string;
createTime: Date;
}
// 查询公告列表
// export const getNoticePage = (params: PageParam) => {
// return request.get({ url: '/system/notice/page', params })
// }
export async function getNoticePage(params: PageParam) {
return request("/system/notice/page", {
method: "GET",
params,
});
}
// 查询公告详情
// export const getNotice = (id: number) => {
// return request.get({ url: '/system/notice/get?id=' + id })
// }
export async function getNotice(id: number) {
return request("/system/notice/get", {
method: "GET",
params: { id },
});
}
// 新增公告
// export const createNotice = (data: NoticeVO) => {
// return request.post({ url: '/system/notice/create', data })
// }
export async function createNotice(data: NoticeVO) {
return request("/system/notice/create", {
method: "POST",
data,
});
}
// 修改公告
// export const updateNotice = (data: NoticeVO) => {
// return request.put({ url: '/system/notice/update', data })
// }
export async function updateNotice(data: NoticeVO) {
return request("/system/notice/update", {
method: "PUT",
data,
});
}
// 删除公告
// export const deleteNotice = (id: number) => {
// return request.delete({ url: '/system/notice/delete?id=' + id })
// }
export async function deleteNotice(id: number) {
return request("/system/notice/update", {
method: "DELETE",
params: { id },
});
}
// 推送公告
// export const pushNotice = (id: number) => {
// return request.post({ url: '/system/notice/push?id=' + id })
// }
export async function pushNotice(id: number) {
return request("/system/notice/push", {
method: "POST",
params: { id },
});
}

View File

@@ -0,0 +1,76 @@
import { request } from "@umijs/max";
export interface NotifyMessageVO {
id: number;
userId: number;
userType: number;
templateId: number;
templateCode: string;
templateNickname: string;
templateContent: string;
templateType: number;
templateParams: string;
readStatus: boolean;
readTime: Date;
createTime: Date;
}
// 查询站内信消息列表
// export const getNotifyMessagePage = async (params: PageParam) => {
// return await request.get({ url: '/system/notify-message/page', params })
// }
export async function getNotifyMessagePage(params: PageParam) {
return request("/system/notify-message/page", {
method: "GET",
params,
});
}
// 获得我的站内信分页
// export const getMyNotifyMessagePage = async (params: PageParam) => {
// return await request.get({ url: '/system/notify-message/my-page', params })
// }
export async function getMyNotifyMessagePage(params: PageParam) {
return request("/system/notify-message/my-page", {
method: "GET",
params,
});
}
// 批量标记已读
// export const updateNotifyMessageRead = async (ids) => {
// return await request.put({
// url: '/system/notify-message/update-read?' + qs.stringify({ ids: ids }, { indices: false })
// })
// }
export async function updateNotifyMessageRead(ids: number[]) {
return request("/system/notice/update", {
method: "PUT",
params: { ids: ids },
});
}
// 标记所有站内信为已读
// export const updateAllNotifyMessageRead = async () => {
// return await request.put({ url: '/system/notify-message/update-all-read' })
// }
export async function updateAllNotifyMessageRead() {
return request("/system/notify-message/update-all-read", {
method: "PUT",
});
}
// 获取当前用户的最新站内信列表
// export const getUnreadNotifyMessageList = async () => {
// return await request.get({ url: '/system/notify-message/get-unread-list' })
// }
export async function getUnreadNotifyMessageList() {
return request("/system/notify-message/get-unread-list", {
method: "GET",
});
}
// 获得当前用户的未读站内信数量
// export const getUnreadNotifyMessageCount = async () => {
// return await request.get({ url: '/system/notify-message/get-unread-count' })
// }
export async function getUnreadNotifyMessageCount() {
return request("/system/notify-message/get-unread-count", {
method: "GET",
});
}

View File

@@ -0,0 +1,80 @@
import { request } from "@umijs/max";
export interface NotifyTemplateVO {
id: number;
name: string;
nickname: string;
code: string;
content: string;
type?: number;
params: string;
status: number;
remark: string;
mobile: string;
createTime: Date;
userType: number;
userId: number | null;
templateCode: string;
templateParams: Map<String, Object>;
}
// 查询站内信模板列表
// export const getNotifyTemplatePage = async (params: PageParam) => {
// return await request.get({ url: 'getNotifyTemplatePage', params })
// }
export async function getNotifyTemplatePage(params: PageParam) {
return request("/system/notify-template/page", {
method: "GET",
params,
});
}
// 查询站内信模板详情
// export const getNotifyTemplate = async (id: number) => {
// return await request.get({ url: '/system/notify-template/get?id=' + id })
// }
export async function getNotifyTemplate(id: number) {
return request("/system/notify-template/get", {
method: "GET",
params: { id },
});
}
// 新增站内信模板
// export const createNotifyTemplate = async (data: NotifyTemplateVO) => {
// return await request.post({ url: '/system/notify-template/create', data })
// }
export async function createNotifyTemplate(data: NotifyTemplateVO) {
return request("/system/notify-template/create", {
method: "POST",
data,
});
}
// 修改站内信模板
// export const updateNotifyTemplate = async (data: NotifyTemplateVO) => {
// return await request.put({ url: '/system/notify-template/update', data })
// }
export async function updateNotifyTemplate(data: NotifyTemplateVO) {
return request("/system/notify-template/update", {
method: "PUT",
data,
});
}
// 删除站内信模板
// export const deleteNotifyTemplate = async (id: number) => {
// return await request.delete({ url: '/system/notify-template/delete?id=' + id })
// }
export async function deleteNotifyTemplate(id: number) {
return request("/system/notify-template/delete", {
method: "DELETE",
params: { id },
});
}
// 发送站内信
// export const sendNotify = (data: NotifySendReqVO) => {
// return request.post({ url: '/system/notify-template/send-notify', data })
// }
export async function sendNotify(data: NotifyTemplateVO) {
return request("/system/notify-template/send-notify", {
method: "POST",
data,
});
}

View File

@@ -0,0 +1,73 @@
import { request } from "@umijs/max";
export interface SmsChannelVO {
id: number;
code: string;
status: number;
signature: string;
remark: string;
apiKey: string;
apiSecret: string;
callbackUrl: string;
createTime: Date;
}
// 查询短信渠道列表
// export const getSmsChannelPage = (params: PageParam) => {
// return request.get({ url: '/system/sms-channel/page', params })
// }
export async function getSmsChannelPage(params: PageParam) {
return request("/system/sms-channel/page", {
method: "GET",
params,
});
}
// 获得短信渠道精简列表
// export function getSimpleSmsChannelList() {
// return request.get({ url: '/system/sms-channel/simple-list' })
// }
export async function getSimpleSmsChannelList() {
return request("/system/sms-channel/simple-list", {
method: "GET",
});
}
// 查询短信渠道详情
// export const getSmsChannel = (id: number) => {
// return request.get({ url: '/system/sms-channel/get?id=' + id })
// }
export async function getSmsChannel(id: number) {
return request("/system/sms-channel/get", {
method: "GET",
params: { id },
});
}
// 新增短信渠道
// export const createSmsChannel = (data: SmsChannelVO) => {
// return request.post({ url: '/system/sms-channel/create', data })
// }
export async function createSmsChannel(data: SmsChannelVO) {
return request("/system/sms-channel/create", {
method: "POST",
data,
});
}
// 修改短信渠道
// export const updateSmsChannel = (data: SmsChannelVO) => {
// return request.put({ url: '/system/sms-channel/update', data })
// }
export async function updateSmsChannel(data: SmsChannelVO) {
return request("/system/sms-channel/update", {
method: "PUT",
data,
});
}
// 删除短信渠道
// export const deleteSmsChannel = (id: number) => {
// return request.delete({ url: '/system/sms-channel/delete?id=' + id })
// }
export async function deleteSmsChannel(id: number) {
return request("/system/sms-channel/delete", {
method: "DELETE",
params: { id },
});
}

View File

@@ -0,0 +1,40 @@
import { request } from "@umijs/max";
export interface SmsLogVO {
id: number;
channelId: number | null;
channelCode: string;
templateId: number | null;
templateCode: string;
templateType: number | null;
templateContent: string;
templateParams: Map<string, object> | null;
apiTemplateId: string;
mobile: string;
userId: number | null;
userType: number | null;
sendStatus: number | null;
sendTime: Date | null;
apiSendCode: string;
apiSendMsg: string;
apiRequestId: string;
apiSerialNo: string;
receiveStatus: number | null;
receiveTime: Date | null;
apiReceiveCode: string;
apiReceiveMsg: string;
createTime: Date | null;
}
// 查询短信日志列表
export async function getSmsLogPage(params: PageParam) {
return request("/system/sms-log/page", {
method: "GET",
params,
});
}
// 导出短信日志
// export const exportSmsLog = (params) => {
// return request.download({ url: '/system/sms-log/export-excel', params })
// }

View File

@@ -0,0 +1,89 @@
import { request } from "@umijs/max";
export interface SmsTemplateVO {
id: number;
type: number;
status: number;
code: string;
name: string;
content: string;
remark: string;
apiTemplateId: string;
channelId?: number;
channelCode?: string;
params?: string[];
createTime?: Date;
mobile: string;
templateCode: string;
templateParams: Map<String, Object>;
}
// 查询短信模板列表
// export const getSmsTemplatePage = (params: PageParam) => {
// return request.get({ url: '/system/sms-template/page', params })
// }
export async function getSmsTemplatePage(params: PageParam) {
return request("/system/sms-template/page", {
method: "GET",
params,
});
}
// 查询短信模板详情
// export const getSmsTemplate = (id: number) => {
// return request.get({ url: '/system/sms-template/get?id=' + id })
// }
export async function getSmsTemplate(id: number) {
return request("/system/sms-template/get", {
method: "GET",
params: { id },
});
}
// 新增短信模板
// export const createSmsTemplate = (data: SmsTemplateVO) => {
// return request.post({ url: '/system/sms-template/create', data })
// }
export async function createSmsTemplate(data: SmsTemplateVO) {
return request("/system/sms-template/create", {
method: "POST",
data,
});
}
// 修改短信模板
// export const updateSmsTemplate = (data: SmsTemplateVO) => {
// return request.put({ url: '/system/sms-template/update', data })
// }
export async function updateSmsTemplate(data: SmsTemplateVO) {
return request("/system/sms-template/update", {
method: "PUT",
data,
});
}
// 删除短信模板
// export const deleteSmsTemplate = (id: number) => {
// return request.delete({ url: '/system/sms-template/delete?id=' + id })
// }
export async function deleteSmsTemplate(id: number) {
return request("/system/sms-template/delete", {
method: "DELETE",
params: { id },
});
}
// 导出短信模板
// export const exportSmsTemplate = (params) => {
// return request.download({
// url: '/system/sms-template/export-excel',
// params
// })
// }
// 发送短信
// export const sendSms = (data: SendSmsReqVO) => {
// return request.post({ url: '/system/sms-template/send-sms', data })
// }
export async function sendSms(data: SmsTemplateVO) {
return request("/system/sms-template/send-sms", {
method: "POST",
data,
});
}

View File

@@ -0,0 +1,75 @@
import { request } from "@umijs/max";
export interface TenantPackageVO {
id: number;
name: string;
status: number;
remark: string;
creator: string;
updater: string;
updateTime: string;
menuIds: number[];
createTime: Date;
}
// 查询租户套餐列表
// export const getTenantPackagePage = (params: PageParam) => {
// return request.get({ url: '/system/tenant-package/page', params })
// }
// 获得租户
// export const getTenantPackage = (id: number) => {
// return request.get({ url: '/system/tenant-package/get?id=' + id })
// }
export async function getTenantPackage(id: number) {
return request("/system/tenant-package", {
method: "GET",
params: { id },
});
}
// 新增租户套餐
// export const createTenantPackage = (data: TenantPackageVO) => {
// return request.post({ url: '/system/tenant-package/create', data })
// }
export async function createTenantPackage(data: TenantPackageVO) {
return request("/system/tenant-package/create", {
method: "POST",
data,
});
}
// 修改租户套餐
// export const updateTenantPackage = (data: TenantPackageVO) => {
// return request.put({ url: "/system/tenant-package/update", data });
// };
export async function updateTenantPackage(data: TenantPackageVO) {
return request("/system/tenant-package/update", {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
data,
});
}
// 删除租户套餐
// export const deleteTenantPackage = (id: number) => {
// return request.delete({ url: '/system/tenant-package/delete?id=' + id })
// }
export async function deleteTenantPackage(id: number) {
return request("/system/tenant-package/delete", {
method: "DELETE",
params: {
id,
},
});
}
// 获取租户套餐精简信息列表
// export const getTenantPackageList = () => {
// return request.get({ url: '/system/tenant-package/simple-list' })
// }
export async function getTenantPackageList() {
return request("/system/tenant-package/simple-list", {
method: "GET",
});
}