diff --git a/config/oneapi.json b/config/oneapi.json index c77d988..cf31322 100644 --- a/config/oneapi.json +++ b/config/oneapi.json @@ -43,35 +43,6 @@ }, "x-swagger-router-controller": "api" }, - "/api/login/captcha": { - "post": { - "description": "发送验证码", - "operationId": "getFakeCaptcha", - "tags": ["login"], - "parameters": [ - { - "name": "phone", - "in": "query", - "description": "手机号", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FakeCaptcha" - } - } - } - } - } - } - }, "/api/login/outLogin": { "post": { "description": "登录接口", @@ -144,155 +115,6 @@ }, "x-swagger-router-controller": "api" }, - "/api/notices": { - "summary": "getNotices", - "description": "NoticeIconItem", - "get": { - "tags": ["api"], - "operationId": "getNotices", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NoticeIconList" - } - } - } - } - } - } - }, - "/api/rule": { - "get": { - "tags": ["rule"], - "description": "获取规则列表", - "operationId": "rule", - "parameters": [ - { - "name": "current", - "in": "query", - "description": "当前的页码", - "schema": { - "type": "number" - } - }, - { - "name": "pageSize", - "in": "query", - "description": "页面的容量", - "schema": { - "type": "number" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleList" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "post": { - "tags": ["rule"], - "description": "新建规则", - "operationId": "addRule", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleListItem" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "put": { - "tags": ["rule"], - "description": "新建规则", - "operationId": "updateRule", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleListItem" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "delete": { - "tags": ["rule"], - "description": "删除规则", - "operationId": "removeRule", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "x-swagger-router-controller": "api" - }, "/swagger": { "x-swagger-pipe": "swagger_raw" } diff --git a/config/routes.ts b/config/routes.ts index 65cb340..184bb4c 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -4,18 +4,27 @@ export default [ layout: false, routes: [{ name: '登录', path: '/user/login', component: './User/Login' }], }, - { path: '/welcome', name: '欢迎', icon: 'smile', component: './Welcome' }, + { path: '/welcome', name: '仪表盘', icon: 'smile', component: './Welcome' }, { path: '/admin', - name: '管理页', + name: '主席团管理', icon: 'crown', access: 'canAdmin', routes: [ - { path: '/admin', redirect: '/admin/sub-page' }, - { path: '/admin/sub-page', name: '二级管理页', component: './Admin' }, + { path: '/admin', redirect: '/admin/dutyinfo' }, + { path: '/admin/dutyinfo', name: '值班信息', component: './Admin/DutyInfo' }, + { path: '/admin/dutytable', name: '值班表管理', component: './Admin/DutyTable' }, + ], + }, + { + path: '/leader', + name: '值班管理', + icon: 'team', + routes: [ + { path: '/leader', redirect: '/admin/dutyinfo' }, + { path: '/leader/conclusion', name: '值班总结', component: './Leader/Conclusion' }, ], }, - { name: '查询表格', icon: 'table', path: '/list', component: './TableList' }, { name: '日志', icon: 'clockCircle', path: '/logs', component: './Logs' }, { name: '关于我们', icon: 'thunderbolt', path: '/about', component: './About' }, { path: '/', redirect: '/welcome' }, diff --git a/mock/listTableList.ts b/mock/listTableList.ts deleted file mode 100644 index 35ec3ce..0000000 --- a/mock/listTableList.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { Request, Response } from 'express'; -import moment from 'moment'; -import { parse } from 'url'; - -// 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: moment().format('YYYY-MM-DD'), - createdAt: moment().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).forEach((key) => { - let nextSort = next?.[key] as number; - let 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).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 && b.body) || req.body; - const { method, name, desc, key } = body; - - switch (method) { - /* eslint no-case-declarations:0 */ - 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: moment().format('YYYY-MM-DD'), - createdAt: moment().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, -}; diff --git a/mock/notices.ts b/mock/notices.ts deleted file mode 100644 index 616c921..0000000 --- a/mock/notices.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { Request, Response } from 'express'; - -const getNotices = (req: Request, res: Response) => { - res.json({ - data: [ - { - id: '000000001', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/MSbDR4FR2MUAAAAAAAAAAAAAFl94AQBr', - title: '你收到了 14 份新周报', - datetime: '2017-08-09', - type: 'notification', - }, - { - id: '000000002', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/hX-PTavYIq4AAAAAAAAAAAAAFl94AQBr', - title: '你推荐的 曲妮妮 已通过第三轮面试', - datetime: '2017-08-08', - type: 'notification', - }, - { - id: '000000003', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/jHX5R5l3QjQAAAAAAAAAAAAAFl94AQBr', - title: '这种模板可以区分多种通知类型', - datetime: '2017-08-07', - read: true, - type: 'notification', - }, - { - id: '000000004', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Wr4mQqx6jfwAAAAAAAAAAAAAFl94AQBr', - title: '左侧图标用于区分不同的类型', - datetime: '2017-08-07', - type: 'notification', - }, - { - id: '000000005', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Mzj_TbcWUj4AAAAAAAAAAAAAFl94AQBr', - title: '内容不要超过两行字,超出时自动截断', - datetime: '2017-08-07', - type: 'notification', - }, - { - id: '000000006', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/eXLzRbPqQE4AAAAAAAAAAAAAFl94AQBr', - title: '曲丽丽 评论了你', - description: '描述信息描述信息描述信息', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000007', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/w5mRQY2AmEEAAAAAAAAAAAAAFl94AQBr', - title: '朱偏右 回复了你', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000008', - avatar: - 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/wPadR5M9918AAAAAAAAAAAAAFl94AQBr', - title: '标题', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000009', - title: '任务名称', - description: '任务需要在 2017-01-12 20:00 前启动', - extra: '未开始', - status: 'todo', - type: 'event', - }, - { - id: '000000010', - title: '第三方紧急代码变更', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '马上到期', - status: 'urgent', - type: 'event', - }, - { - id: '000000011', - title: '信息安全考试', - description: '指派竹尔于 2017-01-09 前完成更新并发布', - extra: '已耗时 8 天', - status: 'doing', - type: 'event', - }, - { - id: '000000012', - title: 'ABCD 版本发布', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '进行中', - status: 'processing', - type: 'event', - }, - ], - }); -}; - -export default { - 'GET /api/notices': getNotices, -}; diff --git a/mock/requestRecord.mock.js b/mock/requestRecord.mock.js index 9e752c4..0041e4d 100644 --- a/mock/requestRecord.mock.js +++ b/mock/requestRecord.mock.js @@ -86,294 +86,6 @@ module.exports = { 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, - pageSize: 20, - current: 1, - }, 'POST /api/login/outLogin': { data: {}, success: true }, 'POST /api/login/account': { status: 'ok', diff --git a/mock/user.ts b/mock/user.ts index 75edd34..d0596b9 100644 --- a/mock/user.ts +++ b/mock/user.ts @@ -8,11 +8,6 @@ const waitTime = (time: number = 100) => { }); }; -async function getFakeCaptcha(req: Request, res: Response) { - await waitTime(2000); - return res.json('captcha-xxx'); -} - const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env; /** @@ -198,6 +193,4 @@ export default { path: '/base/category/list', }); }, - - 'GET /api/login/captcha': getFakeCaptcha, }; diff --git a/src/pages/About.tsx b/src/pages/About.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/pages/About/index.tsx b/src/pages/About/index.tsx new file mode 100644 index 0000000..d6a98d1 --- /dev/null +++ b/src/pages/About/index.tsx @@ -0,0 +1,14 @@ +import { Todo } from '@/components'; +import { PageContainer } from '@ant-design/pro-components'; +import { Card } from 'antd'; + +const Logs: React.FC = () => { + return ( + + + + + + ); +}; +export default Logs; \ No newline at end of file diff --git a/src/pages/Admin.tsx b/src/pages/Admin.tsx deleted file mode 100644 index e0a1aae..0000000 --- a/src/pages/Admin.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons'; -import { PageContainer } from '@ant-design/pro-components'; -import '@umijs/max'; -import { Alert, Card, Typography } from 'antd'; -import React from 'react'; -const Admin: React.FC = () => { - return ( - - - - - Ant Design Pro You - - -

- Want to add more pages? Please refer to{' '} - - use block - - 。 -

-
- ); -}; -export default Admin; diff --git a/src/pages/Admin/DutyInfo.tsx b/src/pages/Admin/DutyInfo.tsx new file mode 100644 index 0000000..d6a98d1 --- /dev/null +++ b/src/pages/Admin/DutyInfo.tsx @@ -0,0 +1,14 @@ +import { Todo } from '@/components'; +import { PageContainer } from '@ant-design/pro-components'; +import { Card } from 'antd'; + +const Logs: React.FC = () => { + return ( + + + + + + ); +}; +export default Logs; \ No newline at end of file diff --git a/src/pages/Admin/DutyTable.tsx b/src/pages/Admin/DutyTable.tsx new file mode 100644 index 0000000..d6a98d1 --- /dev/null +++ b/src/pages/Admin/DutyTable.tsx @@ -0,0 +1,14 @@ +import { Todo } from '@/components'; +import { PageContainer } from '@ant-design/pro-components'; +import { Card } from 'antd'; + +const Logs: React.FC = () => { + return ( + + + + + + ); +}; +export default Logs; \ No newline at end of file diff --git a/src/pages/Leader/Conclusion.tsx b/src/pages/Leader/Conclusion.tsx new file mode 100644 index 0000000..d6a98d1 --- /dev/null +++ b/src/pages/Leader/Conclusion.tsx @@ -0,0 +1,14 @@ +import { Todo } from '@/components'; +import { PageContainer } from '@ant-design/pro-components'; +import { Card } from 'antd'; + +const Logs: React.FC = () => { + return ( + + + + + + ); +}; +export default Logs; \ No newline at end of file diff --git a/src/pages/TableList/components/UpdateForm.tsx b/src/pages/TableList/components/UpdateForm.tsx deleted file mode 100644 index 958d8b9..0000000 --- a/src/pages/TableList/components/UpdateForm.tsx +++ /dev/null @@ -1,155 +0,0 @@ -import { - ProFormDateTimePicker, - ProFormRadio, - ProFormSelect, - ProFormText, - ProFormTextArea, - StepsForm, -} from '@ant-design/pro-components'; -import '@umijs/max'; -import { Modal } from 'antd'; -import React from 'react'; -export type FormValueType = { - target?: string; - template?: string; - type?: string; - time?: string; - frequency?: string; -} & Partial; -export type UpdateFormProps = { - onCancel: (flag?: boolean, formVals?: FormValueType) => void; - onSubmit: (values: FormValueType) => Promise; - updateModalOpen: boolean; - values: Partial; -}; -const UpdateForm: React.FC = (props) => { - return ( - { - return ( - { - props.onCancel(); - }} - > - {dom} - - ); - }} - onFinish={props.onSubmit} - > - - - - - - - - - - - - - - - ); -}; -export default UpdateForm; diff --git a/src/pages/TableList/index.tsx b/src/pages/TableList/index.tsx deleted file mode 100644 index f6617b7..0000000 --- a/src/pages/TableList/index.tsx +++ /dev/null @@ -1,329 +0,0 @@ -import { addRule, removeRule, rule, updateRule } from '@/services/ant-design-pro/api'; -import { PlusOutlined } from '@ant-design/icons'; -import type { ActionType, ProColumns, ProDescriptionsItemProps } from '@ant-design/pro-components'; -import { - FooterToolbar, - ModalForm, - PageContainer, - ProDescriptions, - ProFormText, - ProFormTextArea, - ProTable, -} from '@ant-design/pro-components'; -import '@umijs/max'; -import { Button, Drawer, Input, message } from 'antd'; -import React, { useRef, useState } from 'react'; -import type { FormValueType } from './components/UpdateForm'; -import UpdateForm from './components/UpdateForm'; - -/** - * @en-US Add node - * @zh-CN 添加节点 - * @param fields - */ -const handleAdd = async (fields: API.RuleListItem) => { - const hide = message.loading('正在添加'); - try { - await addRule({ - ...fields, - }); - hide(); - message.success('Added successfully'); - return true; - } catch (error) { - hide(); - message.error('Adding failed, please try again!'); - return false; - } -}; - -/** - * @en-US Update node - * @zh-CN 更新节点 - * - * @param fields - */ -const handleUpdate = async (fields: FormValueType) => { - const hide = message.loading('Configuring'); - try { - await updateRule({ - name: fields.name, - desc: fields.desc, - key: fields.key, - }); - hide(); - message.success('Configuration is successful'); - return true; - } catch (error) { - hide(); - message.error('Configuration failed, please try again!'); - return false; - } -}; - -/** - * Delete node - * @zh-CN 删除节点 - * - * @param selectedRows - */ -const handleRemove = async (selectedRows: API.RuleListItem[]) => { - const hide = message.loading('正在删除'); - if (!selectedRows) return true; - try { - await removeRule({ - key: selectedRows.map((row) => row.key), - }); - hide(); - message.success('Deleted successfully and will refresh soon'); - return true; - } catch (error) { - hide(); - message.error('Delete failed, please try again'); - return false; - } -}; -const TableList: React.FC = () => { - /** - * @en-US Pop-up window of new window - * @zh-CN 新建窗口的弹窗 - * */ - const [createModalOpen, handleModalOpen] = useState(false); - /** - * @en-US The pop-up window of the distribution update window - * @zh-CN 分布更新窗口的弹窗 - * */ - const [updateModalOpen, handleUpdateModalOpen] = useState(false); - const [showDetail, setShowDetail] = useState(false); - const actionRef = useRef(); - const [currentRow, setCurrentRow] = useState(); - const [selectedRowsState, setSelectedRows] = useState([]); - - /** - * @en-US International configuration - * @zh-CN 国际化配置 - * */ - - const columns: ProColumns[] = [ - { - title: '规则名称', - dataIndex: 'name', - tip: 'The rule name is the unique key', - render: (dom, entity) => { - return ( - { - setCurrentRow(entity); - setShowDetail(true); - }} - > - {dom} - - ); - }, - }, - { - title: '描述', - dataIndex: 'desc', - valueType: 'textarea', - }, - { - title: '服务调用次数', - dataIndex: 'callNo', - sorter: true, - hideInForm: true, - renderText: (val: string) => `${val}${'万'}`, - }, - { - title: '状态', - dataIndex: 'status', - hideInForm: true, - valueEnum: { - 0: { - text: '关闭', - status: 'Default', - }, - 1: { - text: '运行中', - status: 'Processing', - }, - 2: { - text: '已上线', - status: 'Success', - }, - 3: { - text: '异常', - status: 'Error', - }, - }, - }, - { - title: '上次调度时间', - sorter: true, - dataIndex: 'updatedAt', - valueType: 'dateTime', - renderFormItem: (item, { defaultRender, ...rest }, form) => { - const status = form.getFieldValue('status'); - if (`${status}` === '0') { - return false; - } - if (`${status}` === '3') { - return ; - } - return defaultRender(item); - }, - }, - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - render: (_, record) => [ - { - handleUpdateModalOpen(true); - setCurrentRow(record); - }} - > - 配置 - , - - 订阅警报 - , - ], - }, - ]; - return ( - - - headerTitle={'查询表格'} - actionRef={actionRef} - rowKey="key" - search={{ - labelWidth: 120, - }} - toolBarRender={() => [ - , - ]} - request={rule} - columns={columns} - rowSelection={{ - onChange: (_, selectedRows) => { - setSelectedRows(selectedRows); - }, - }} - /> - {selectedRowsState?.length > 0 && ( - - 已选择{' '} - - {selectedRowsState.length} - {' '} - 项    - - 服务调用次数总计 {selectedRowsState.reduce((pre, item) => pre + item.callNo!, 0)} 万 - - - } - > - - - - )} - { - const success = await handleAdd(value as API.RuleListItem); - if (success) { - handleModalOpen(false); - if (actionRef.current) { - actionRef.current.reload(); - } - } - }} - > - - - - { - const success = await handleUpdate(value); - if (success) { - handleUpdateModalOpen(false); - setCurrentRow(undefined); - if (actionRef.current) { - actionRef.current.reload(); - } - } - }} - onCancel={() => { - handleUpdateModalOpen(false); - if (!showDetail) { - setCurrentRow(undefined); - } - }} - updateModalOpen={updateModalOpen} - values={currentRow || {}} - /> - - { - setCurrentRow(undefined); - setShowDetail(false); - }} - closable={false} - > - {currentRow?.name && ( - - column={2} - title={currentRow?.name} - request={async () => ({ - data: currentRow || {}, - })} - params={{ - id: currentRow?.name, - }} - columns={columns as ProDescriptionsItemProps[]} - /> - )} - - - ); -}; -export default TableList; diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx deleted file mode 100644 index d0c49f7..0000000 --- a/src/pages/Welcome.tsx +++ /dev/null @@ -1,164 +0,0 @@ -import { PageContainer } from '@ant-design/pro-components'; -import { useModel } from '@umijs/max'; -import { Card, theme } from 'antd'; -import React from 'react'; - -/** - * 每个单独的卡片,为了复用样式抽成了组件 - * @param param0 - * @returns - */ -const InfoCard: React.FC<{ - title: string; - index: number; - desc: string; - href: string; -}> = ({ title, href, index, desc }) => { - const { useToken } = theme; - - const { token } = useToken(); - - return ( -
-
-
- {index} -
-
- {title} -
-
-
- {desc} -
- - 了解更多 {'>'} - -
- ); -}; - -const Welcome: React.FC = () => { - const { token } = theme.useToken(); - const { initialState } = useModel('@@initialState'); - return ( - - -
-
- 欢迎使用 Ant Design Pro -
-

- Ant Design Pro 是一个整合了 umi,Ant Design 和 ProComponents - 的脚手架方案。致力于在设计规范和基础组件的基础上,继续向上构建,提炼出典型模板/业务组件/配套设计资源,进一步提升企业级中后台产品设计研发过程中的『用户』和『设计者』的体验。 -

-
- - - -
-
-
-
- ); -}; - -export default Welcome; diff --git a/src/pages/Welcome/index.tsx b/src/pages/Welcome/index.tsx new file mode 100644 index 0000000..d6a98d1 --- /dev/null +++ b/src/pages/Welcome/index.tsx @@ -0,0 +1,14 @@ +import { Todo } from '@/components'; +import { PageContainer } from '@ant-design/pro-components'; +import { Card } from 'antd'; + +const Logs: React.FC = () => { + return ( + + + + + + ); +}; +export default Logs; \ No newline at end of file