QYF-GitLab1
2025-07-22 9294bc122e923e37a0044daf046ac899b077ca66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { postOaStaffGetStaffList } from '@/services/WebApi/oaStaff';
import { Modal, Table } from 'antd';
import React, { useEffect, useState } from 'react';
 
interface StaffProps {
  open: boolean;
  setData: (data: any) => void;
  onCancel: () => void;
}
 
const Staff: React.FC<StaffProps> = (props) => {
  const { open, setData, onCancel } = props;
 
  const [staffOptions, setStaffOptions] = useState([]);
 
  const staffColums: any[] = [
    {
      title: '员工姓名',
      dataIndex: 'label',
    },
    {
      title: '部门',
      dataIndex: 'tsetwe',
    },
    {
      title: '职位',
      dataIndex: 'post',
    },
  ];
 
  // 获取员工列表
  const getStaffList = async () => {
    const res = await postOaStaffGetStaffList({ start: 0, size: 10, orgId: 4 });
    if (res && res.datas.length > 0) {
      const data = res.datas.map((item: any) => ({
        label: item.name,
        value: item.id,
      }));
      setStaffOptions(data);
    }
    return [];
  };
 
  useEffect(() => {
    if (open) {
      getStaffList();
    }
  }, [open]);
 
  return (
    <Modal title={'员工列表'} width={600} open={open} onCancel={onCancel}>
      <Table dataSource={staffOptions} columns={staffColums} pagination={false} />
    </Modal>
  );
};
 
export default Staff;