|
@@ -1,7 +1,142 @@
|
1
|
|
-import React from 'react'
|
|
1
|
+import { deleteGuaranteeTask, getGuaranteeTaskList } from '@/services/api/guaranteeTask';
|
|
2
|
+import { queryTable } from '@/utils/request';
|
|
3
|
+import { PageContainer, ProTable } from '@ant-design/pro-components';
|
|
4
|
+import { history } from '@umijs/max';
|
|
5
|
+import { Button, message, Popconfirm } from 'antd';
|
|
6
|
+import moment from 'moment';
|
|
7
|
+import { useRef, useState } from 'react';
|
|
8
|
+
|
|
9
|
+const GuaranteeTaskList = (props) => {
|
|
10
|
+ const [isOpen, setIsOpen] = useState(false);
|
|
11
|
+ const [modalData, setModalData] = useState({});
|
|
12
|
+ // const [storeTypeDict, setStoreTypeDict] = useState([]);
|
|
13
|
+ const actionRef = useRef();
|
|
14
|
+ const formRef = useRef();
|
|
15
|
+
|
|
16
|
+ const handleDelete = (id) => {
|
|
17
|
+ if (id) {
|
|
18
|
+ deleteGuaranteeTask(id).then((res) => {
|
|
19
|
+ message.success('删除成功');
|
|
20
|
+ actionRef.current.reload();
|
|
21
|
+ });
|
|
22
|
+ }
|
|
23
|
+ };
|
|
24
|
+
|
|
25
|
+ const onCancel = () => {
|
|
26
|
+ setIsOpen(false);
|
|
27
|
+ setModalData({});
|
|
28
|
+ };
|
|
29
|
+
|
|
30
|
+ const columns = [
|
|
31
|
+ {
|
|
32
|
+ title: '保障序号',
|
|
33
|
+ dataIndex: 'guaranteeNo',
|
|
34
|
+ },
|
|
35
|
+ {
|
|
36
|
+ title: '受领人',
|
|
37
|
+ dataIndex: 'receiver',
|
|
38
|
+ },
|
|
39
|
+ {
|
|
40
|
+ title: '时间区间',
|
|
41
|
+ dataIndex: 'dateRange',
|
|
42
|
+ valueType: 'dateRange',
|
|
43
|
+ search: {
|
|
44
|
+ transform: (value) => {
|
|
45
|
+ console.log(value, value[0].valueOf(), 'valuevalue');
|
|
46
|
+
|
|
47
|
+ return {
|
|
48
|
+ startDate: moment(value[0]).format('yyyy-MM-DD'),
|
|
49
|
+ endDate: moment(value[1]).format('yyyy-MM-DD'),
|
|
50
|
+ };
|
|
51
|
+ },
|
|
52
|
+ },
|
|
53
|
+ },
|
|
54
|
+ {
|
|
55
|
+ title: '保障地点',
|
|
56
|
+ dataIndex: 'address',
|
|
57
|
+ search: false,
|
|
58
|
+ },
|
|
59
|
+ {
|
|
60
|
+ title: '保障人数',
|
|
61
|
+ dataIndex: 'totalPersonNum',
|
|
62
|
+ search: false,
|
|
63
|
+ },
|
|
64
|
+ {
|
|
65
|
+ title: '伙食标准',
|
|
66
|
+ dataIndex: 'standard',
|
|
67
|
+ search: false,
|
|
68
|
+ },
|
|
69
|
+
|
|
70
|
+ {
|
|
71
|
+ title: '操作',
|
|
72
|
+ valueType: 'option',
|
|
73
|
+ width: 200,
|
|
74
|
+ render: (_, record) => [
|
|
75
|
+ <Button
|
|
76
|
+ key={2}
|
|
77
|
+ style={{ padding: 0 }}
|
|
78
|
+ type="link"
|
|
79
|
+ onClick={() => {
|
|
80
|
+ history.push(`/guaranteeTask/edit?id=${record.id}`);
|
|
81
|
+ }}
|
|
82
|
+ >
|
|
83
|
+ 修改
|
|
84
|
+ </Button>,
|
|
85
|
+
|
|
86
|
+ <Popconfirm
|
|
87
|
+ key={3}
|
|
88
|
+ title="您是否确认删除 ?"
|
|
89
|
+ onConfirm={() => handleDelete(record.id)}
|
|
90
|
+ okText="确定"
|
|
91
|
+ cancelText="取消"
|
|
92
|
+ >
|
|
93
|
+ {/* manualPush */}
|
|
94
|
+ <Button style={{ padding: 0 }} type="link">
|
|
95
|
+ 删除
|
|
96
|
+ </Button>
|
|
97
|
+ </Popconfirm>,
|
|
98
|
+ <Button
|
|
99
|
+ key={4}
|
|
100
|
+ style={{ padding: 0 }}
|
|
101
|
+ type="link"
|
|
102
|
+ onClick={() => {
|
|
103
|
+ history.push(`/guaranteeTask/print?id=${record.id}`);
|
|
104
|
+ }}
|
|
105
|
+ >
|
|
106
|
+ 打印
|
|
107
|
+ </Button>,
|
|
108
|
+ ],
|
|
109
|
+ },
|
|
110
|
+ ];
|
2
|
111
|
|
3
|
|
-export default (props) => {
|
4
|
112
|
return (
|
5
|
|
- <div></div>
|
6
|
|
- )
|
7
|
|
-}
|
|
113
|
+ <PageContainer>
|
|
114
|
+ <ProTable
|
|
115
|
+ actionRef={actionRef}
|
|
116
|
+ formRef={formRef}
|
|
117
|
+ postData={(data) => {
|
|
118
|
+ return data.map((x) => ({
|
|
119
|
+ dateRange: [x.startDate, x.endDate],
|
|
120
|
+ ...x,
|
|
121
|
+ }));
|
|
122
|
+ }}
|
|
123
|
+ rowKey="id"
|
|
124
|
+ toolBarRender={() => [
|
|
125
|
+ <Button
|
|
126
|
+ key="2"
|
|
127
|
+ type="primary"
|
|
128
|
+ onClick={() => {
|
|
129
|
+ history.push('/stock/add');
|
|
130
|
+ }}
|
|
131
|
+ >
|
|
132
|
+ 新增
|
|
133
|
+ </Button>,
|
|
134
|
+ ]}
|
|
135
|
+ request={queryTable(getGuaranteeTaskList)}
|
|
136
|
+ columns={columns}
|
|
137
|
+ />
|
|
138
|
+ </PageContainer>
|
|
139
|
+ );
|
|
140
|
+};
|
|
141
|
+
|
|
142
|
+export default GuaranteeTaskList;
|