Merge branch 'main' of http://113.45.157.195:3003/raohaotian/train-data
This commit is contained in:
commit
91e896f357
|
@ -3,13 +3,28 @@ 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";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function StaffModal() {
|
||||
const { data: trainontents} = api.trainContent.findMany.useQuery({
|
||||
where: {
|
||||
|
||||
const { data: traincontents} = api.trainSituation.findMany.useQuery({
|
||||
|
||||
select:{
|
||||
id: true,
|
||||
trainContent:{
|
||||
select:{
|
||||
id: true,
|
||||
title: true,
|
||||
type: true,
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
useEffect(() => {
|
||||
traincontents?.forEach((situation)=>{
|
||||
console.log(situation.trainContent.title);
|
||||
});
|
||||
}, [traincontents]);
|
||||
|
||||
const { form, formValue, setVisible, visible, editingRecord } = useMainContext()
|
||||
const { create, update } = useStaff();
|
||||
const handleOk = async () => {
|
||||
|
@ -124,13 +139,20 @@ export default function StaffModal() {
|
|||
<div key={key} className="flex space-x-2">
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, 'trainContentId']}
|
||||
name={[name, 'trainContent']}
|
||||
label="培训内容"
|
||||
className="flex-1"
|
||||
>
|
||||
<Select placeholder="选择培训内容">
|
||||
{/* 这里需要从后端获取培训内容选项 */}
|
||||
<Select.Option value="1">培训内容1</Select.Option>
|
||||
{/* 动态渲染培训内容选项 */}
|
||||
{traincontents?.map((situation) => (
|
||||
<Select.Option
|
||||
key={situation.id}
|
||||
value={situation.id}
|
||||
>
|
||||
{situation.trainContentId}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
|
@ -150,6 +172,7 @@ export default function StaffModal() {
|
|||
</Form.List>
|
||||
</Form>
|
||||
</Modal>
|
||||
<Button onClick={() =>{console.log(traincontents);}}>TEST</Button>
|
||||
</>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue