Compare commits
No commits in common. "dev" and "main" have entirely different histories.
|
|
@ -8,7 +8,6 @@
|
|||
"name": "notify-admin",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.3.1",
|
||||
"@types/node": "^16.18.88",
|
||||
"@types/react": "^18.2.65",
|
||||
"@types/react-dom": "^18.2.21",
|
||||
|
|
@ -17,8 +16,7 @@
|
|||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"react-scripts": "5.0.1",
|
||||
"typescript": "^4.9.5",
|
||||
"xlsx": "^0.18.5"
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
|
|
@ -4487,14 +4485,6 @@
|
|||
"node": ">=8.9"
|
||||
}
|
||||
},
|
||||
"node_modules/adler-32": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/adler-32/-/adler-32-1.3.1.tgz",
|
||||
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz",
|
||||
|
|
@ -5526,18 +5516,6 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/cfb": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmmirror.com/cfb/-/cfb-1.2.2.tgz",
|
||||
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"crc-32": "~1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-2.4.2.tgz",
|
||||
|
|
@ -5769,14 +5747,6 @@
|
|||
"node": ">= 4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/codepage": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmmirror.com/codepage/-/codepage-1.15.0.tgz",
|
||||
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/collect-v8-coverage": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz",
|
||||
|
|
@ -5991,17 +5961,6 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/crc-32": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmmirror.com/crc-32/-/crc-32-1.2.2.tgz",
|
||||
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||
"bin": {
|
||||
"crc32": "bin/crc32.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
|
|
@ -8203,14 +8162,6 @@
|
|||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/frac": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/frac/-/frac-1.1.2.tgz",
|
||||
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/fraction.js": {
|
||||
"version": "4.3.7",
|
||||
"resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.3.7.tgz",
|
||||
|
|
@ -16112,17 +16063,6 @@
|
|||
"resolved": "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
|
||||
},
|
||||
"node_modules/ssf": {
|
||||
"version": "0.11.2",
|
||||
"resolved": "https://registry.npmmirror.com/ssf/-/ssf-0.11.2.tgz",
|
||||
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
|
||||
"dependencies": {
|
||||
"frac": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/stable": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmmirror.com/stable/-/stable-0.1.8.tgz",
|
||||
|
|
@ -18074,22 +18014,6 @@
|
|||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/wmf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/wmf/-/wmf-1.0.2.tgz",
|
||||
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/word": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/word/-/word-0.3.0.tgz",
|
||||
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/word-wrap": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmmirror.com/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||
|
|
@ -18507,26 +18431,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xlsx": {
|
||||
"version": "0.18.5",
|
||||
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
|
||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"cfb": "~1.2.1",
|
||||
"codepage": "~1.15.0",
|
||||
"crc-32": "~1.2.1",
|
||||
"ssf": "~0.11.2",
|
||||
"wmf": "~1.0.1",
|
||||
"word": "~0.3.0"
|
||||
},
|
||||
"bin": {
|
||||
"xlsx": "bin/xlsx.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/xml-name-validator": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
"name": "EVA Tech"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.3.1",
|
||||
"@types/node": "^16.18.88",
|
||||
"@types/react": "^18.2.65",
|
||||
"@types/react-dom": "^18.2.21",
|
||||
|
|
@ -15,8 +14,7 @@
|
|||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"react-scripts": "5.0.1",
|
||||
"typescript": "^4.9.5",
|
||||
"xlsx": "^0.18.5"
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
|
|
|||
14
src/App.tsx
14
src/App.tsx
|
|
@ -8,7 +8,7 @@ import {
|
|||
} from '@ant-design/icons';
|
||||
import type { MenuProps } from 'antd';
|
||||
import { Breadcrumb, Layout, Menu, theme } from 'antd';
|
||||
import { AppRouter, routes, routeName } from './router';
|
||||
import { AppRouter } from './router';
|
||||
import PageFooter from './components/PageFooter';
|
||||
|
||||
const { Content, Sider } = Layout;
|
||||
|
|
@ -62,17 +62,17 @@ function defSubMenu(
|
|||
}
|
||||
|
||||
const items: MenuItem[] = [
|
||||
defMenu('主页', 'mainpage', <DesktopOutlined />, routes.main),
|
||||
defMenu('主页', 'mainpage', <DesktopOutlined />, '/'),
|
||||
defRootMenu('展示信息管理', 'sub1', <UserOutlined />, [
|
||||
defSubMenu('排班表管理', '1', routes.admin.dutyTable),
|
||||
defSubMenu('成员权限管理', '2', routes.admin.userControl),
|
||||
defSubMenu('值班信息管理', '3', routes.admin.dutyInfo),
|
||||
defSubMenu('选项1', '1', '/admin/hello1'),
|
||||
defSubMenu('选项2', '2', '/admin/hello2'),
|
||||
defSubMenu('选项3', '3', '/admin/hello3'),
|
||||
]),
|
||||
defRootMenu('值班组长', 'sub2', <TeamOutlined />, [
|
||||
defSubMenu('选项1', '4', '/duty/hi1'),
|
||||
defSubMenu('选项2', '5', '/duty/hi2'),
|
||||
]),
|
||||
defMenu('关于我们', 'aboutpage', <UserOutlined />, routes.about),
|
||||
defMenu('关于我们', 'aboutpage', <UserOutlined />, '/about'),
|
||||
];
|
||||
|
||||
interface BreadcrumbItem {
|
||||
|
|
@ -97,7 +97,7 @@ const AppLayout: FC<{ router: JSX.Element }> = (props) => {
|
|||
for (var i = 1; i < pathArray.length; i++) {
|
||||
currentRouteItems.push({
|
||||
href: '',
|
||||
title: <span>{routeName.get(pathArray[i])}</span>,
|
||||
title: <span>{pathArray[i]}</span>,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
import { Button, Upload } from 'antd';
|
||||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import { FC } from 'react';
|
||||
import { readExcelFile } from '../utils/excel';
|
||||
|
||||
const DutyTablePage: FC = () => {
|
||||
return (
|
||||
<Upload
|
||||
name='file'
|
||||
action=''
|
||||
beforeUpload={(file) => {
|
||||
let data = readExcelFile(file, 0);
|
||||
data
|
||||
.then((d) => console.log('read data', d))
|
||||
.catch((e) => console.log('got error', e));
|
||||
return false;
|
||||
}}
|
||||
>
|
||||
<Button icon={<UploadOutlined />}>上传排班表文件</Button>
|
||||
</Upload>
|
||||
);
|
||||
};
|
||||
|
||||
export default DutyTablePage;
|
||||
|
|
@ -1,37 +1,15 @@
|
|||
import { Routes, Route } from 'react-router-dom';
|
||||
import Todo from './components/Todo';
|
||||
import DutyTablePage from './pages/DutyTable';
|
||||
|
||||
export const routes = {
|
||||
main: '/',
|
||||
about: '/about',
|
||||
admin: {
|
||||
dutyTable: '/admin/dutytable',
|
||||
userControl: '/admin/usercontrol',
|
||||
dutyInfo: '/admin/dutyinfo',
|
||||
},
|
||||
duty: {},
|
||||
};
|
||||
|
||||
export const routeName = new Map<string, string>([
|
||||
['admin', '展示信息'],
|
||||
['about', '关于我们'],
|
||||
['duty', '值班组长'],
|
||||
['dutytable', '排班表'],
|
||||
['usercontrol', '成员权限'],
|
||||
['dutyinfo', '值班信息'],
|
||||
]);
|
||||
|
||||
export const AppRouter: React.FC = () => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path={routes.main} element={<Todo />} />
|
||||
<Route path={routes.admin.dutyTable} element={<DutyTablePage />} />
|
||||
<Route path={routes.admin.userControl} element={<Todo />} />
|
||||
<Route path={routes.admin.dutyInfo} element={<Todo />} />
|
||||
<Route path='/' element={<Todo />} />
|
||||
<Route path='/admin/hello1' element={<Todo />} />
|
||||
<Route path='/admin/hello2' element={<Todo />} />
|
||||
<Route path='/admin/hello3' element={<Todo />} />
|
||||
<Route path='/duty/hi1' element={<Todo />} />
|
||||
<Route path='/duty/hi2' element={<Todo />} />
|
||||
<Route path={routes.about} element={<Todo />} />
|
||||
</Routes>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
import { read as xlsxRead, utils as xlsxUtils } from 'xlsx';
|
||||
import { readFile } from './readfile';
|
||||
|
||||
export async function readExcelFile(file: File, sheetIndex: number) {
|
||||
let data = await readFile(file);
|
||||
let workbook = xlsxRead(data, { type: 'binary' });
|
||||
let worksheet = workbook.Sheets[workbook.SheetNames[sheetIndex]];
|
||||
data = xlsxUtils.sheet_to_json(worksheet);
|
||||
return data;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
export function readFile(file: File) {
|
||||
return new Promise((resolve) => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsBinaryString(file);
|
||||
reader.onload = (ev) => {
|
||||
resolve(ev.target?.result);
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue