Blame view

src/pages/finance/Reimburse/FieldService/index.tsx 2.74 KB
13912960   jiangwei   财务报销设置
1
2
  import useInitial from "@/hooks/useInitail";
  import { PageHeaderWrapper } from "@ant-design/pro-layout";
f02065e0   jiangwei   界面改动
3
  import { Button, Card, Row, Table, Popconfirm, message } from "antd";
13912960   jiangwei   财务报销设置
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  import React, { useState } from "react";
  import * as API from "./api";
  import Modal from "./components/Modal";
  import FeeModal from './components/FeeModal';
  
  const Column = Table.Column;
  
  const CateringSubsidies = () => {
    const { data, loading, setLoading } = useInitial(API.fetchList, [], "");
    const [visiable, setVisiable] = useState(false);
    const [current, setCurrent] = useState<any>();
    const [feeVisible, setFeeVisible] = useState(false);
  
    const onEdit = (row: any) => {
      setCurrent(row);
      setVisiable(true);
    };
  
    const onAdd = () => {
      setVisiable(true);
      setCurrent(undefined);
    };
  
f02065e0   jiangwei   界面改动
27
28
29
30
31
32
33
34
35
36
37
     const onDelete = (row: any) => {
      API.deleteApi(row.id)
        .then((res) => {
          message.success("删除成功");
          setLoading(true);
        })
        .catch((err) => {
          message.error("删除失败", err);
        });
    };
  
13912960   jiangwei   财务报销设置
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    return (
      <PageHeaderWrapper title="外勤报销">
        <Card>
          <Row style={{ justifyContent: "flex-end", marginBottom: 20 }}>
            <Button type="primary" onClick={() => onAdd()}>
              新增
            </Button>
          </Row>
          <Table
            dataSource={data}
            rowKey="id"
            loading={loading}
            pagination={false}
          >
e2252dc0   jiangwei   财富报销设置外勤参数变动
52
            <Column title="外勤类型" dataIndex="outsideTypeName" align="center" />
13912960   jiangwei   财务报销设置
53
54
55
56
57
58
59
60
61
62
63
64
65
66
            <Column title="是否允许报销" align="center" render={r => (r.isAllowReimburse ? '允许' : '不允许')} />
            <Column 
              title="餐费补贴" 
              align="center" 
              render={r => (r.mealFee ? <a onClick={() => { setFeeVisible(true); setCurrent(r); }}>查看</a> : '无')} 
            />    
            <Column
              title="操作"
              align="center"
              render={(text, row: any) => (
                <div>
                  <Button type="link" onClick={() => onEdit(row)}>
                    编辑
                  </Button>
f02065e0   jiangwei   界面改动
67
68
69
70
71
72
73
74
75
76
                  <Popconfirm
                    title="是否删除"
                    onConfirm={() => onDelete(row)}
                    okText="确定"
                    cancelText="取消"
                  >
                    <Button type="link" danger>
                      删除
                    </Button>
                  </Popconfirm>
13912960   jiangwei   财务报销设置
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
                </div>
              )}
            />
          </Table>
        </Card>
        <Modal
          visiable={visiable}
          setVisiable={setVisiable}
          setLoading={setLoading}
          current={current}
        />
        <FeeModal visiable={feeVisible} setVisiable={setFeeVisible} current={current} />
      </PageHeaderWrapper>
    );
  };
  
  export default CateringSubsidies;