This commit is contained in:
Rao 2025-03-12 19:50:48 +08:00
commit 7287a36bdc
6 changed files with 27 additions and 14 deletions

View File

@ -52,8 +52,8 @@ export class GenDevService {
await this.generateStaffs(4); await this.generateStaffs(4);
//await this.generateTerms(2, 6); //await this.generateTerms(2, 6);
//await this.generateCourses(8); //await this.generateCourses(8);
//await this.generateTrainContent(2,6) await this.generateTrainContent(2,6)
//await this.generateTrainSituations() await this.generateTrainSituations()
} catch (err) { } catch (err) {
this.logger.error(err); this.logger.error(err);
} }

View File

@ -7,20 +7,20 @@ export default function NavigationMenu() {
console.log(location.pathname); console.log(location.pathname);
// 导航菜单项配置 // 导航菜单项配置
const menuItems = [ const menuItems = [
{ key: 'staff', label: '人员总览', path: '/staff' }, { key: 'staff', label: '人员总览', path: '/' }, // 将path改为根路径
{ key: 'plan', label: '培训计划', path: '/plan' }, { key: 'plan', label: '培训计划', path: '/plan' },
{ key: 'day', label: '每日填报', path: '/daily' }, { key: 'day', label: '每日填报', path: '/daily' },
{ key: 'exam', label: '考核成绩', path: '/exam' }, { key: 'exam', label: '考核成绩', path: '/exam' },
]; ];
return ( return (
<> <>
{/* 导航菜单 */}
<Menu <Menu
theme="dark" theme="dark"
mode="inline" mode="inline"
className="!bg-transparent !border-0 pt-4 [&_.ant-menu-item]:!mt-2" className="!bg-transparent !border-0 pt-4 [&_.ant-menu-item]:!mt-2"
defaultSelectedKeys={[ selectedKeys={[ // 改用selectedKeys替代defaultSelectedKeys
menuItems.find((item) => item.path === location.pathname)?.key, menuItems.find((item) => location.pathname.startsWith(item.path))?.key,
]} ]}
> >
{menuItems.map((item) => ( {menuItems.map((item) => (

View File

@ -3,12 +3,10 @@ import { api, useStaff } from "@nice/client";
import { Button, Form, Input, Modal, Select, Table } from "antd"; import { Button, Form, Input, Modal, Select, Table } from "antd";
import { StaffDto, trainSituationDetailSelect } from "@nice/common"; import { StaffDto, trainSituationDetailSelect } from "@nice/common";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import toast from "react-hot-toast";
import _ from "lodash"; import _ from "lodash";
import { useMainContext } from "../layout/MainProvider"; import { useMainContext } from "../layout/MainProvider";
import StaffTable from "./stafftable/page"; import StaffTable from "./stafftable/page";
import StaffModal from "./staffmodal/page"; import StaffModal from "./staffmodal/page";
export default function StaffMessage() { export default function StaffMessage() {
const {form, formValue, setFormValue, setVisible, setSearchValue} = useMainContext(); const {form, formValue, setFormValue, setVisible, setSearchValue} = useMainContext();
useEffect(()=>{ useEffect(()=>{

View File

@ -1,10 +1,15 @@
import { useStaff } from "@nice/client"; import { api, useStaff } from "@nice/client";
import { useMainContext } from "../../layout/MainProvider"; import { useMainContext } from "../../layout/MainProvider";
import toast from "react-hot-toast"; import toast from "react-hot-toast";
import { Button, Form, Input, Modal, Select } from "antd"; import { Button, Form, Input, Modal, Select } from "antd";
import DepartmentSelect from "@web/src/components/models/department/department-select";
export default function StaffModal() { export default function StaffModal() {
const { data: trainontents} = api.trainContent.findMany.useQuery({
where: {
}
});
const { form, formValue, setVisible, visible, editingRecord } = useMainContext() const { form, formValue, setVisible, visible, editingRecord } = useMainContext()
const { create, update } = useStaff(); const { create, update } = useStaff();
const handleOk = async () => { const handleOk = async () => {
@ -92,6 +97,13 @@ export default function StaffModal() {
name={"deptId"} name={"deptId"}
label="部门" label="部门"
// labelClassName="text-gray-300" // labelClassName="text-gray-300"
>
<DepartmentSelect></DepartmentSelect>
</Form.Item>
<Form.Item
name={"positionId"}
label="职务"
// labelClassName="text-gray-300"
> >
<Input className="rounded-lg" /> <Input className="rounded-lg" />
</Form.Item> </Form.Item>
@ -104,6 +116,7 @@ export default function StaffModal() {
<Select.Option value={false}></Select.Option> <Select.Option value={false}></Select.Option>
</Select> </Select>
</Form.Item> </Form.Item>
<Form.List name="trainSituations"> <Form.List name="trainSituations">
{(fields, { add, remove }) => ( {(fields, { add, remove }) => (
<> <>
@ -117,6 +130,7 @@ export default function StaffModal() {
> >
<Select placeholder="选择培训内容"> <Select placeholder="选择培训内容">
{/* 这里需要从后端获取培训内容选项 */} {/* 这里需要从后端获取培训内容选项 */}
<Select.Option value="1">1</Select.Option>
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item

View File

@ -16,6 +16,7 @@ export default function StaffTable() {
} }
} }
}); });
// console.log(staffs.map((staff) => staff.absent));
const { create, update } = useStaff(); const { create, update } = useStaff();
const {editingRecord, setEditingRecord} = useMainContext(); const {editingRecord, setEditingRecord} = useMainContext();
const colnums = [ const colnums = [
@ -31,8 +32,8 @@ export default function StaffTable() {
}, },
{ {
title: "职务", title: "职务",
dataIndex: "position", dataIndex: "positionId",
key: "position", key: "positionId",
}, },
{ {
title: "在位", title: "在位",

View File

@ -429,7 +429,7 @@ model Staff {
phoneNumber String? @unique @map("phone_number") phoneNumber String? @unique @map("phone_number")
age Int? @map("age") age Int? @map("age")
sex Boolean? @map("sex") sex Boolean? @map("sex")
absent Boolean? @map("absent") absent Boolean? @map("absent")@default(false)
trainSituations TrainSituation[] trainSituations TrainSituation[]
position Position? @relation("StaffPosition", fields: [positionId], references: [id]) position Position? @relation("StaffPosition", fields: [positionId], references: [id])