diff --git a/apps/web/src/app/main/dailyPage/page.tsx b/apps/web/src/app/main/dailyPage/page.tsx new file mode 100644 index 0000000..ba9510d --- /dev/null +++ b/apps/web/src/app/main/dailyPage/page.tsx @@ -0,0 +1,10 @@ +import DailyContext from "@web/src/components/models/daily/DailyContext"; +import DailyLayout from "@web/src/components/models/daily/DailyLayout"; + +export default function DailyPage(){ + return <> + + + + +} \ No newline at end of file diff --git a/apps/web/src/app/main/layout/NavigationMenu.tsx b/apps/web/src/app/main/layout/NavigationMenu.tsx index 126b0fa..0b65a2f 100644 --- a/apps/web/src/app/main/layout/NavigationMenu.tsx +++ b/apps/web/src/app/main/layout/NavigationMenu.tsx @@ -7,7 +7,7 @@ export default function NavigationMenu() { const menuItems = [ { key: 'home', label: '首页', path: '/' }, { key: 'staff', label: '人员总览', path: '/staff' }, - { key: 'day', label: '日统计', path: '/day' }, + { key: 'day', label: '日统计', path: '/daily' }, { key: 'month', label: '月统计', path: '/month' }, { key: 'year', label: '年度统计', path: '/year' } ]; diff --git a/apps/web/src/components/models/daily/DailyContext.tsx b/apps/web/src/components/models/daily/DailyContext.tsx new file mode 100644 index 0000000..cac44bd --- /dev/null +++ b/apps/web/src/components/models/daily/DailyContext.tsx @@ -0,0 +1,46 @@ +import { api } from "@nice/client"; +import { createContext, ReactNode, useContext, useEffect } from "react"; + +interface DailyContextProviderProps{ + staffsMsg:{ + id:string, + showname:string, + username:string + }[], + staffsLoading:boolean +} + +interface DailyContextProps{ + children:ReactNode +} + +const DailyContextProvider = createContext(null) + +export default function DailyContext({children}:DailyContextProps){ + // 获取当前单位下的所有staff的记录 + const {data:staffs,isLoading:staffsLoading} = api.staff.findByDept.useQuery({ + deptId:"cm84jt1gv000do5gqsxx68iko" + }) + const staffsMsg = staffs?.map((staff)=>{ + return { + id:staff.id, + showname:staff.showname, + username:staff.username + } + }) + useEffect(()=>{ + console.log(staffs) + },[staffs]) + return + {children} + +} + +export function useDaily(){ + const daily = useContext(DailyContextProvider) + if(!daily) {throw new Error("useParams must be used within a ParamsProvider");} + return daily +} \ No newline at end of file diff --git a/apps/web/src/components/models/daily/DailyLayout.tsx b/apps/web/src/components/models/daily/DailyLayout.tsx new file mode 100644 index 0000000..6d7ab8e --- /dev/null +++ b/apps/web/src/components/models/daily/DailyLayout.tsx @@ -0,0 +1,11 @@ +import DailyMsgDisplayLayout from "./dailyMsgDisplay/DailyMsgDisplayLayout"; +import { DailyMsgFormLayout } from "./dailyMsgForm/DailyMsgFormLayout"; + +export default function DailyLayout(){ + return ( +
+ + +
+ ) +} \ No newline at end of file diff --git a/apps/web/src/components/models/daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx b/apps/web/src/components/models/daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx new file mode 100644 index 0000000..48ce306 --- /dev/null +++ b/apps/web/src/components/models/daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx @@ -0,0 +1,5 @@ +export default function DailyMsgDisplayLayout(){ + return ( +
+ ) +} \ No newline at end of file diff --git a/apps/web/src/components/models/daily/dailyMsgForm/DailyMsgFormLayout.tsx b/apps/web/src/components/models/daily/dailyMsgForm/DailyMsgFormLayout.tsx new file mode 100644 index 0000000..e52010d --- /dev/null +++ b/apps/web/src/components/models/daily/dailyMsgForm/DailyMsgFormLayout.tsx @@ -0,0 +1,23 @@ +import { Form, QRCode, Select } from "antd"; +import StaffSelect from "../../staff/staff-select"; +import { useDaily } from "../DailyContext"; + +export function DailyMsgFormLayout() { + const [form] = Form.useForm() + const { staffsMsg } = useDaily() + const handleChange = (value: string | string[]) => { + console.log(value) + } + return ( +
+
+ handleChange(value)} + > +
+
+ ) +} \ No newline at end of file diff --git a/apps/web/src/components/models/staff/staff-select.tsx b/apps/web/src/components/models/staff/staff-select.tsx index 5881f2a..ee46458 100755 --- a/apps/web/src/components/models/staff/staff-select.tsx +++ b/apps/web/src/components/models/staff/staff-select.tsx @@ -9,6 +9,13 @@ interface StaffSelectProps { multiple?: boolean; domainId?: string; placeholder?: string; + staffsMsg?: StaffsMsgProps[]; +} + +interface StaffsMsgProps { + id: string; + showname: string; + username: string; } export default function StaffSelect({ @@ -18,6 +25,7 @@ export default function StaffSelect({ style, multiple, domainId, + staffsMsg, }: StaffSelectProps) { const [keyword, setQuery] = useState(""); @@ -50,7 +58,7 @@ export default function StaffSelect({ }, select: { id: true, showname: true, username: true }, - take: 30, + //take: 30, orderBy: { order: "asc" } }); @@ -59,6 +67,13 @@ export default function StaffSelect({ }; const options: SelectProps["options"] = + staffsMsg ? + staffsMsg.map((staff)=>{ + return { + value:staff.id, + label:staff.showname || staff.username + } + }) : data?.map((staff: any) => ({ value: staff.id, label: staff?.showname || staff?.username, diff --git a/apps/web/src/routes/index.tsx b/apps/web/src/routes/index.tsx index 85a7d84..326bc27 100755 --- a/apps/web/src/routes/index.tsx +++ b/apps/web/src/routes/index.tsx @@ -10,6 +10,7 @@ import LoginPage from "../app/login"; import HomePage from "../app/main/home/page"; import StaffMessage from "../app/main/staffpage/page"; import MainLayout from "../app/main/layout/MainLayout"; +import DailyPage from "../app/main/dailyPage/page"; interface CustomIndexRouteObject extends IndexRouteObject { name?: string; breadcrumb?: string; @@ -51,6 +52,10 @@ export const routes: CustomRouteObject[] = [ path: "/staff", element: , }, + { + path:"/daily", + element: + } ], },