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.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);
}

View File

@ -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 (
<>
{/* 导航菜单 */}
<Menu
theme="dark"
mode="inline"
className="!bg-transparent !border-0 pt-4 [&_.ant-menu-item]:!mt-2"
defaultSelectedKeys={[
menuItems.find((item) => item.path === location.pathname)?.key,
selectedKeys={[ // 改用selectedKeys替代defaultSelectedKeys
menuItems.find((item) => location.pathname.startsWith(item.path))?.key,
]}
>
{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 { 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(()=>{

View File

@ -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 () => {
@ -92,6 +97,13 @@ export default function StaffModal() {
name={"deptId"}
label="部门"
// labelClassName="text-gray-300"
>
<DepartmentSelect></DepartmentSelect>
</Form.Item>
<Form.Item
name={"positionId"}
label="职务"
// labelClassName="text-gray-300"
>
<Input className="rounded-lg" />
</Form.Item>
@ -104,6 +116,7 @@ export default function StaffModal() {
<Select.Option value={false}></Select.Option>
</Select>
</Form.Item>
<Form.List name="trainSituations">
{(fields, { add, remove }) => (
<>
@ -117,6 +130,7 @@ export default function StaffModal() {
>
<Select placeholder="选择培训内容">
{/* 这里需要从后端获取培训内容选项 */}
<Select.Option value="1">1</Select.Option>
</Select>
</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 {editingRecord, setEditingRecord} = useMainContext();
const colnums = [
@ -31,8 +32,8 @@ export default function StaffTable() {
},
{
title: "职务",
dataIndex: "position",
key: "position",
dataIndex: "positionId",
key: "positionId",
},
{
title: "在位",

View File

@ -429,7 +429,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])