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 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";
|
import DepartmentSelect from "@web/src/components/models/department/department-select";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
export default function StaffModal() {
|
export default function StaffModal() {
|
||||||
const { data: trainontents} = api.trainContent.findMany.useQuery({
|
const { data: traincontents} = api.trainSituation.findMany.useQuery({
|
||||||
where: {
|
|
||||||
|
|
||||||
|
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 { form, formValue, setVisible, visible, editingRecord } = useMainContext()
|
||||||
const { create, update } = useStaff();
|
const { create, update } = useStaff();
|
||||||
const handleOk = async () => {
|
const handleOk = async () => {
|
||||||
|
@ -124,13 +139,20 @@ export default function StaffModal() {
|
||||||
<div key={key} className="flex space-x-2">
|
<div key={key} className="flex space-x-2">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
{...restField}
|
{...restField}
|
||||||
name={[name, 'trainContentId']}
|
name={[name, 'trainContent']}
|
||||||
label="培训内容"
|
label="培训内容"
|
||||||
className="flex-1"
|
className="flex-1"
|
||||||
>
|
>
|
||||||
<Select placeholder="选择培训内容">
|
<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>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
@ -150,6 +172,7 @@ export default function StaffModal() {
|
||||||
</Form.List>
|
</Form.List>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
<Button onClick={() =>{console.log(traincontents);}}>TEST</Button>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
Loading…
Reference in New Issue