index.tsx
1.34 KB
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
import React, { useState } from "react";
import { PageHeaderWrapper } from "@ant-design/pro-layout";
import { Button, Card, Table } from "antd";
import * as TYPE from "./entity";
import Modal from "./components/Modal";
import useInitial from "@/hooks/useInitail";
import * as API from "./api";
const Column = Table.Column;
const Leave = () => {
const [visiable, setVisiable] = useState(false);
const [type, setType] = useState<number>(0);
const { data, setParams } = useInitial(API.fetchDetail, {}, type);
const onEdit = (record: any) => {
setParams(record.type, true);
setType(record.type);
setVisiable(true);
};
return (
<PageHeaderWrapper title="请假设置">
<Card>
<Table dataSource={TYPE.LeaveData} rowKey="type" pagination={false}>
<Column title="岗位名称" dataIndex="typeName" />
<Column
title="操作"
align="center"
render={(text, record, index) => (
<div>
<Button type="link" onClick={() => onEdit(record)}>
编辑
</Button>
</div>
)}
/>
</Table>
</Card>
<Modal
visiable={visiable}
setVisiable={setVisiable}
type={type}
data={data || {}}
/>
</PageHeaderWrapper>
);
};
export default Leave;