|
@@ -1,126 +1,39 @@
|
1
|
|
-import { history, Link } from 'umi';
|
2
|
|
-import { useRef, useState, useEffect } from 'react';
|
3
|
|
-import { Button, Popconfirm, message, Tooltip } from 'antd';
|
4
|
|
-import { PlusOutlined, QuestionCircleOutlined, DownOutlined } from '@ant-design/icons';
|
5
|
1
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
6
|
|
-import ProTable from '@ant-design/pro-table';
|
|
2
|
+import PageTable from '@/components/PageTable';
|
|
3
|
+import { getWorkMassageList } from '@/services/workMessage'
|
7
|
4
|
|
8
|
5
|
export default (props) => {
|
9
|
|
- const dataSource = [
|
10
|
|
- {
|
11
|
|
- id: 2121329,
|
12
|
|
- title: '这是是一个标题标题',
|
13
|
|
- name: '胡彦斌',
|
14
|
|
- pushPerson: '农机手',
|
15
|
|
- status: 'APP内消息中心推送',
|
16
|
|
- },
|
17
|
|
- ];
|
18
|
|
- const gotoDetail = (id) => {
|
19
|
|
- history.push(`./MessageEdit`);
|
20
|
|
- };
|
21
|
|
-
|
22
|
|
- const actions = () => [
|
23
|
|
- <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>
|
24
|
|
- 新增商户
|
25
|
|
- </Button>,
|
26
|
|
- ];
|
27
|
6
|
const columns = [
|
28
|
7
|
{
|
29
|
|
- title: '消息ID',
|
30
|
|
-
|
31
|
|
- key: 'id',
|
32
|
|
- dataIndex: 'id',
|
33
|
|
- search: false,
|
34
|
|
-
|
35
|
|
- render: (t, record) => (
|
36
|
|
- <Link key={1} to={`./edit?id=${record.shopId}`}>
|
37
|
|
- {record.shopName}
|
38
|
|
- </Link>
|
39
|
|
- ),
|
40
|
|
- },
|
41
|
|
-
|
42
|
|
- {
|
43
|
|
- title: '消息标题',
|
44
|
|
- key: 'title',
|
45
|
|
- dataIndex: 'title',
|
46
|
|
- render: (t, record) => (
|
47
|
|
- <Link key={1} to={`./package?shopId=${record.shopId}`}>
|
48
|
|
- {record?.packageNum}
|
49
|
|
- </Link>
|
50
|
|
- ),
|
|
8
|
+ title: '订单号',
|
|
9
|
+ key: 'orderNo',
|
|
10
|
+ dataIndex: 'orderNo',
|
51
|
11
|
},
|
52
|
|
-
|
53
|
12
|
{
|
54
|
|
- title: '推送对象',
|
55
|
|
- key: 'pushPerson',
|
|
13
|
+ title: '消息',
|
|
14
|
+ key: 'messageType',
|
|
15
|
+ dataIndex: 'messageType',
|
56
|
16
|
search: false,
|
57
|
|
- dataIndex: 'pushPerson',
|
58
|
|
- render: (t, record) => (record.pushPerson === 1 ? '农机手' : '农户'),
|
59
|
|
- },
|
60
|
|
-
|
61
|
|
- {
|
62
|
|
- title: '推送方式',
|
63
|
|
- key: 'status',
|
64
|
|
- dataIndex: 'status',
|
65
|
|
- // render: (t, record) => record.status === 1 ? '发布' : '未发布',
|
66
|
|
- formItemProps: { label: '推送方式' },
|
67
|
|
- valueType: 'select',
|
68
|
|
- valueEnum: {
|
69
|
|
- 0: { text: '通知栏推送' },
|
70
|
|
- 1: { text: 'APP内消息中心推送' },
|
71
|
|
- 2: { text: '短信推送' },
|
|
17
|
+ render: (t, record) => {
|
|
18
|
+ console.log(t);
|
|
19
|
+ if (t === 'appoint') {
|
|
20
|
+ return record.appointTime + ' ' + record.appointPerson + ' 预约了一台' + record.appointMachineryType + '。'
|
|
21
|
+ }
|
|
22
|
+ else {
|
|
23
|
+ return record.acceptTime + ' ' + record.acceptPerson + ' 接到了一个订单。'
|
|
24
|
+ }
|
72
|
25
|
},
|
73
|
|
- },
|
74
|
|
-
|
75
|
|
- {
|
76
|
|
- title: (
|
77
|
|
- <>
|
78
|
|
- 创建时间
|
79
|
|
- <Tooltip placement="top">
|
80
|
|
- <QuestionCircleOutlined style={{ marginLeft: 4 }} />
|
81
|
|
- </Tooltip>
|
82
|
|
- </>
|
83
|
|
- ),
|
84
|
|
- width: 140,
|
85
|
|
- key: 'createdAt',
|
86
|
|
- dataIndex: 'createdAt',
|
87
|
|
- valueType: 'date',
|
88
|
|
- // render: (t) => formatterTime(t),
|
89
|
|
- sorter: (a, b) => a.createdAt - b.createdAt,
|
90
|
|
- },
|
91
|
|
-
|
92
|
|
- {
|
93
|
|
- title: '操作',
|
94
|
|
- valueType: 'option',
|
95
|
|
- width: '300px',
|
96
|
|
- render: (_, record) => [
|
97
|
|
- <Link key={2} to={`./MessageEdit`}>
|
98
|
|
- 编辑
|
99
|
|
- </Link>,
|
100
|
|
- <Popconfirm
|
101
|
|
- key={3}
|
102
|
|
- title="您是否确认删除 ?"
|
103
|
|
- onConfirm={() => handleDelete(record.noticeId)}
|
104
|
|
- okText="确定"
|
105
|
|
- cancelText="取消"
|
106
|
|
- >
|
107
|
|
- <a href="#">删除</a>
|
108
|
|
- </Popconfirm>,
|
109
|
|
- ],
|
110
|
|
- },
|
|
26
|
+ }
|
111
|
27
|
];
|
112
|
28
|
|
113
|
29
|
return (
|
114
|
30
|
<PageHeaderWrapper>
|
115
|
|
- {/* <ProTable
|
116
|
|
- dataSource={dataSource}
|
|
31
|
+ <PageTable
|
|
32
|
+ request={getWorkMassageList}
|
117
|
33
|
columns={columns}
|
118
|
|
- // request={getList}
|
119
|
|
- rowKey="id"
|
|
34
|
+ rowKey="messageId"
|
120
|
35
|
options={false}
|
121
|
|
- toolBarRender={actions}
|
122
|
|
- scroll={{ x: 1000 }}
|
123
|
|
- /> */}
|
|
36
|
+ />
|
124
|
37
|
</PageHeaderWrapper>
|
125
|
38
|
);
|
126
|
39
|
};
|