From 59f8b0c1c59fe8a90a34883ded9d4af29c49609e Mon Sep 17 00:00:00 2001 From: linfeng <2819853134@qq.com> Date: Wed, 12 Mar 2025 19:38:39 +0800 Subject: [PATCH] lin --- apps/server/src/tasks/init/gendev.service.ts | 4 ++-- .../src/app/main/layout/NavigationMenu.tsx | 8 ++++---- apps/web/src/app/main/staffpage/page.tsx | 2 -- .../app/main/staffpage/staffmodal/page.tsx | 20 ++++++++++++++++--- .../app/main/staffpage/stafftable/page.tsx | 5 +++-- packages/common/prisma/schema.prisma | 2 +- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/apps/server/src/tasks/init/gendev.service.ts b/apps/server/src/tasks/init/gendev.service.ts index 3700965..a0107ea 100755 --- a/apps/server/src/tasks/init/gendev.service.ts +++ b/apps/server/src/tasks/init/gendev.service.ts @@ -52,8 +52,8 @@ export class GenDevService { await this.generateStaffs(4); //await this.generateTerms(2, 6); //await this.generateCourses(8); - //await this.generateTrainContent(2,6) - //await this.generateTrainSituations() + await this.generateTrainContent(2,6) + await this.generateTrainSituations() } catch (err) { this.logger.error(err); } diff --git a/apps/web/src/app/main/layout/NavigationMenu.tsx b/apps/web/src/app/main/layout/NavigationMenu.tsx index 1cd78c5..b8c2ef8 100644 --- a/apps/web/src/app/main/layout/NavigationMenu.tsx +++ b/apps/web/src/app/main/layout/NavigationMenu.tsx @@ -7,20 +7,20 @@ export default function NavigationMenu() { console.log(location.pathname); // 导航菜单项配置 const menuItems = [ - { key: 'staff', label: '人员总览', path: '/staff' }, + { key: 'staff', label: '人员总览', path: '/' }, // 将path改为根路径 { key: 'plan', label: '培训计划', path: '/plan' }, { key: 'day', label: '每日填报', path: '/daily' }, { key: 'exam', label: '考核成绩', path: '/exam' }, ]; + return ( <> - {/* 导航菜单 */} item.path === location.pathname)?.key, + selectedKeys={[ // 改用selectedKeys替代defaultSelectedKeys + menuItems.find((item) => location.pathname.startsWith(item.path))?.key, ]} > {menuItems.map((item) => ( diff --git a/apps/web/src/app/main/staffpage/page.tsx b/apps/web/src/app/main/staffpage/page.tsx index 8137751..97e2d3d 100644 --- a/apps/web/src/app/main/staffpage/page.tsx +++ b/apps/web/src/app/main/staffpage/page.tsx @@ -3,12 +3,10 @@ import { api, useStaff } from "@nice/client"; import { Button, Form, Input, Modal, Select, Table } from "antd"; import { StaffDto, trainSituationDetailSelect } from "@nice/common"; import { useCallback, useEffect, useState } from "react"; -import toast from "react-hot-toast"; import _ from "lodash"; import { useMainContext } from "../layout/MainProvider"; import StaffTable from "./stafftable/page"; import StaffModal from "./staffmodal/page"; - export default function StaffMessage() { const {form, formValue, setFormValue, setVisible, setSearchValue} = useMainContext(); useEffect(()=>{ diff --git a/apps/web/src/app/main/staffpage/staffmodal/page.tsx b/apps/web/src/app/main/staffpage/staffmodal/page.tsx index 6936dab..9e0719f 100644 --- a/apps/web/src/app/main/staffpage/staffmodal/page.tsx +++ b/apps/web/src/app/main/staffpage/staffmodal/page.tsx @@ -1,10 +1,15 @@ -import { useStaff } from "@nice/client"; +import { api, useStaff } from "@nice/client"; import { useMainContext } from "../../layout/MainProvider"; import toast from "react-hot-toast"; import { Button, Form, Input, Modal, Select } from "antd"; +import DepartmentSelect from "@web/src/components/models/department/department-select"; export default function StaffModal() { - + // const { data: trainontents} = api.trainContent.findMany.useQuery({ + // where: { + + // } + // }); const { form, formValue, setVisible, visible, editingRecord } = useMainContext() const { create, update } = useStaff(); const handleOk = async () => { @@ -93,7 +98,14 @@ export default function StaffModal() { label="部门" // labelClassName="text-gray-300" > - + + + + + {(fields, { add, remove }) => ( <> @@ -117,6 +130,7 @@ export default function StaffModal() { > staff.absent)); const { create, update } = useStaff(); const {editingRecord, setEditingRecord} = useMainContext(); const colnums = [ @@ -31,8 +32,8 @@ export default function StaffTable() { }, { title: "职务", - dataIndex: "position", - key: "position", + dataIndex: "positionId", + key: "positionId", }, { title: "在位", diff --git a/packages/common/prisma/schema.prisma b/packages/common/prisma/schema.prisma index d924dae..b831ad2 100755 --- a/packages/common/prisma/schema.prisma +++ b/packages/common/prisma/schema.prisma @@ -427,7 +427,7 @@ model Staff { phoneNumber String? @unique @map("phone_number") age Int? @map("age") sex Boolean? @map("sex") - absent Boolean? @map("absent") + absent Boolean? @map("absent")@default(false) trainSituations TrainSituation[] position Position? @relation("StaffPosition", fields: [positionId], references: [id])