|
@@ -1,37 +1,100 @@
|
1
|
1
|
import { history } from 'umi';
|
2
|
|
-import { Button } from 'antd';
|
3
|
|
-import { getDispatchList } from '@/services/dispatch';
|
|
2
|
+import { Button, DatePicker } from 'antd';
|
|
3
|
+import { useState, useRef } from 'react';
|
4
|
4
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
5
|
5
|
import moment from 'moment';
|
6
|
6
|
import PageTable from '@/components/PageTable';
|
|
7
|
+import OrgSelect from '@/components/OrgSelect';
|
|
8
|
+import MachinetySelect from '@/components/MachinetySelect';
|
|
9
|
+import TypeSelect from '@/components/TypeSelect';
|
|
10
|
+import { getDispatchList } from '@/services/dispatch';
|
7
|
11
|
|
|
12
|
+const { RangePicker } = DatePicker;
|
8
|
13
|
const formatterTime = (val) => {
|
9
|
|
- return val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
14
|
+ return val ? moment(val).format('YYYY-MM-DD') : '-';
|
10
|
15
|
};
|
11
|
16
|
const getDispatch = (val) => {
|
12
|
|
- history.push(`./dispatch.jsx?id=${val}`);
|
|
17
|
+ history.push(`./dispatch.jsx?id=${val.orderId}&&did=${val.dispatch || null}`);
|
13
|
18
|
}
|
|
19
|
+
|
14
|
20
|
export default (props) => {
|
|
21
|
+ const [startDate, setStartDate] = useState()
|
|
22
|
+ const [endDate, setEndDate] = useState()
|
|
23
|
+ const handelChange = (date, dateStrings) => {
|
|
24
|
+ setStartDate(dateStrings[0])
|
|
25
|
+ setEndDate(dateStrings[1])
|
|
26
|
+ }
|
|
27
|
+
|
|
28
|
+ const ref = useRef();
|
|
29
|
+
|
|
30
|
+ const Reset = () => {
|
|
31
|
+ setStartDate()
|
|
32
|
+ setEndDate()
|
|
33
|
+ ref.current.reload();
|
|
34
|
+ }
|
15
|
35
|
const columns = [
|
|
36
|
+ {
|
|
37
|
+ title: '机构',
|
|
38
|
+ dataIndex: 'orgId',
|
|
39
|
+ key: 'orgId',
|
|
40
|
+ hideInTable: true,
|
|
41
|
+ renderFormItem: (item, field, form) => {
|
|
42
|
+ return <OrgSelect />
|
|
43
|
+ }
|
|
44
|
+ },
|
|
45
|
+ {
|
|
46
|
+ title: '农机',
|
|
47
|
+ dataIndex: 'machineryId',
|
|
48
|
+ key: 'machineryId',
|
|
49
|
+ hideInTable: true,
|
|
50
|
+ renderFormItem: (item, field, form) => {
|
|
51
|
+ return (
|
|
52
|
+ <MachinetySelect />
|
|
53
|
+ )
|
|
54
|
+ }
|
|
55
|
+ },
|
|
56
|
+
|
16
|
57
|
{
|
17
|
58
|
title: '机构名',
|
18
|
59
|
dataIndex: 'orgName',
|
19
|
60
|
key: 'orgName',
|
|
61
|
+ search: false
|
20
|
62
|
},
|
21
|
63
|
{
|
22
|
64
|
title: '农机名',
|
23
|
65
|
dataIndex: 'machineryName',
|
24
|
66
|
key: 'machineryName',
|
|
67
|
+ search: false
|
25
|
68
|
},
|
26
|
69
|
{
|
27
|
70
|
title: '农机型号',
|
28
|
71
|
dataIndex: 'typeName',
|
29
|
72
|
key: 'typeName',
|
|
73
|
+ search: false
|
|
74
|
+ },
|
|
75
|
+ {
|
|
76
|
+ title: '农机型号',
|
|
77
|
+ dataIndex: 'typeId',
|
|
78
|
+ key: 'typeId',
|
|
79
|
+ hideInTable: true,
|
|
80
|
+ renderFormItem: (item, field, form) => {
|
|
81
|
+ return (
|
|
82
|
+ <TypeSelect />
|
|
83
|
+ )
|
|
84
|
+ }
|
|
85
|
+ },
|
|
86
|
+ {
|
|
87
|
+ title: '下单人手机',
|
|
88
|
+ dataIndex: 'phone',
|
|
89
|
+ key: 'phone',
|
|
90
|
+ labelWidth: 'auto'
|
30
|
91
|
},
|
31
|
92
|
{
|
32
|
93
|
title: '需求时间',
|
33
|
94
|
dataIndex: 'appointmentDate',
|
34
|
95
|
key: 'appointmentDate',
|
|
96
|
+ render: (t) => formatterTime(t),
|
|
97
|
+ renderFormItem: (_, record) => <RangePicker placeholder={['开始日期', '结束日期']} format='YYYY-MM-DD' onChange={handelChange} />
|
35
|
98
|
},
|
36
|
99
|
{
|
37
|
100
|
title: '作业面积',
|
|
@@ -54,6 +117,7 @@ export default (props) => {
|
54
|
117
|
render: (t) => formatterTime(t),
|
55
|
118
|
width: 200,
|
56
|
119
|
},
|
|
120
|
+
|
57
|
121
|
{
|
58
|
122
|
title: '调度状态',
|
59
|
123
|
dataIndex: 'dispatchStatus',
|
|
@@ -64,6 +128,18 @@ export default (props) => {
|
64
|
128
|
0: { text: '待调度' },
|
65
|
129
|
1: { text: '已调度' }
|
66
|
130
|
},
|
|
131
|
+ search: false
|
|
132
|
+ },
|
|
133
|
+ {
|
|
134
|
+ title: '状态',
|
|
135
|
+ dataIndex: 'status',
|
|
136
|
+ key: 'status',
|
|
137
|
+ hideInTable: true,
|
|
138
|
+ valueType: 'select',
|
|
139
|
+ valueEnum: {
|
|
140
|
+ 0: { text: '待调度' },
|
|
141
|
+ 1: { text: '已调度' }
|
|
142
|
+ },
|
67
|
143
|
},
|
68
|
144
|
{
|
69
|
145
|
title: '操作',
|
|
@@ -73,24 +149,24 @@ export default (props) => {
|
73
|
149
|
style={{ padding: 0 }}
|
74
|
150
|
type="link"
|
75
|
151
|
key={1}
|
76
|
|
- onClick={() => getDispatch(record.orderId)}
|
|
152
|
+ onClick={() => getDispatch(record)}
|
77
|
153
|
>
|
78
|
154
|
调度
|
79
|
155
|
</Button>
|
80
|
156
|
],
|
81
|
157
|
},
|
82
|
|
- //操作如果是需求多台机器则需调度 状态为待确认时 状态栏显示调度按钮跳到调度页面
|
83
|
|
- // 如果是申请退款 则出现处理按钮 显示需求时间 如果未到则退款并且改变已分配农机手状态和农机状态
|
84
|
|
- // 如果已经服务过了 则可以打电话给农户咨询具体情况看是否退部分款项
|
85
|
158
|
];
|
86
|
159
|
|
87
|
160
|
return (
|
88
|
161
|
<PageHeaderWrapper>
|
89
|
162
|
<PageTable
|
|
163
|
+ actionRef={ref}
|
90
|
164
|
request={getDispatchList}
|
91
|
165
|
// expfunc={exportPersonList}
|
92
|
166
|
columns={columns}
|
93
|
167
|
rowKey="orderId"
|
|
168
|
+ params={{ startDate, endDate }}
|
|
169
|
+ onReset={Reset}
|
94
|
170
|
options={false}
|
95
|
171
|
scroll={{ x: 1000 }}
|
96
|
172
|
/>
|