李志伟 3 anni fa
parent
commit
82c345aa21

+ 16
- 0
config/routes.js Vedi File

@@ -71,6 +71,22 @@ export default [
71 71
       },
72 72
     ],
73 73
   },
74
+  {
75
+    path: '/customer',
76
+    name: '客户管理',
77
+    icon: 'IdcardOutlined',
78
+    access: 'customer',
79
+    component: '../layouts/BasicLayout',
80
+    routes: [
81
+      {
82
+        path: '/customer/index.jsx',
83
+        name: '客户列表',
84
+        access: 'sys-customer',
85
+        icon: 'smile',
86
+        component: './customer',
87
+      },
88
+    ],
89
+  },
74 90
   {
75 91
     path: '/Machinery',
76 92
     name: '农机管理',

+ 3
- 3
src/pages/Machinery/Machinery/edit.jsx Vedi File

@@ -172,9 +172,9 @@ export default (props) => {
172 172
               <DatePicker format="YYYY-MM-DD" onChange={onDateChange} style={{ width: '350px' }} />
173 173
             </FormItem>
174 174
             <FormItem label="状态" name="status" rules={[{ required: true, message: '请选择' }]}>
175
-              <Select placeholder="请选择是否发布" style={{ width: '350px' }}>
176
-                <Option value={1}>发布</Option>
177
-                <Option value={0}>未发布</Option>
175
+              <Select placeholder="请选择农机状态" style={{ width: '350px' }}>
176
+                <Option value={1}>正常</Option>
177
+                <Option value={0}>维修</Option>
178 178
               </Select>
179 179
             </FormItem>
180 180
             {id && (

+ 8
- 7
src/pages/Machinery/Person/index.jsx Vedi File

@@ -93,6 +93,12 @@ export default (props) => {
93 93
       setLoading(false);
94 94
       return false;
95 95
     }
96
+    if (!/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(newData.ID)) {
97
+      message.warning('请输入正确的身份证号');
98
+      setLoading(false);
99
+      return false;
100
+    }
101
+
96 102
     if (userId) {
97 103
       updateUser(userId, newData).then(() => {
98 104
         setLoading(false);
@@ -115,6 +121,7 @@ export default (props) => {
115 121
           message.error(err.message || err);
116 122
         });
117 123
     }
124
+
118 125
   };
119 126
   //表单点击取消按钮
120 127
   const onCancel = () => {
@@ -286,12 +293,6 @@ export default (props) => {
286 293
       key: 'phone',
287 294
       width: 120,
288 295
     },
289
-    {
290
-      title: '邮箱',
291
-      dataIndex: 'email',
292
-      key: 'email',
293
-      search: false,
294
-    },
295 296
     {
296 297
       title: '注册时间',
297 298
       dataIndex: 'createDate',
@@ -399,7 +400,7 @@ export default (props) => {
399 400
           <FormItem label="手机号" name="phone" rules={[{ required: true, message: '请输入' }]}>
400 401
             <Input maxLength="11" placeholder="请输入" />
401 402
           </FormItem>
402
-          <FormItem label="邮箱" name="email" rules={[{ required: true, message: '请输入' }]}>
403
+          <FormItem label="身份证" name="ID" rules={[{ required: true, message: '请输入' }]}>
403 404
             <Input placeholder="请输入" />
404 405
           </FormItem>
405 406
           <FormItem label="登录账号" name="loginName" rules={[{ required: true, message: '请输入登录账号' }]}>

+ 18
- 11
src/pages/OrderManage/dispatch.jsx Vedi File

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Card, Form, Button, Select, message } from 'antd';
2
+import { Card, Form, Button, Select, message, Modal } from 'antd';
3 3
 import ProCard from '@ant-design/pro-card';
4 4
 import { getOrderDetail } from '@/services/order'
5 5
 import { getMachineryList, getduty } from '@/services/machinery';
@@ -57,15 +57,22 @@ export default (props) => {
57 57
     setDispatch({ ...dispatch, workerId: e })
58 58
   }
59 59
   const onCancel = () => {
60
-    setCancelLoading(true)
61
-    cancelDispatch(dispatchId).then(() => {
62
-      setCancelLoading(false)
63
-      setDispatchId()
64
-      setDispatch({ ...dispatch, machineryId: null, workerId: null })
65
-      message.success('取消成功');
66
-    }).catch((err) => {
67
-      setCancelLoading(false);
68
-      message.error(err.message || err);
60
+    Modal.confirm({
61
+      title: '确认取消?',
62
+      okText: '确认',
63
+      cancelText: '取消',
64
+      onOk() {
65
+        setCancelLoading(true)
66
+        cancelDispatch(dispatchId).then(() => {
67
+          setCancelLoading(false)
68
+          setDispatchId()
69
+          setDispatch({ ...dispatch, machineryId: null, workerId: null })
70
+          message.success('取消成功');
71
+        }).catch((err) => {
72
+          setCancelLoading(false);
73
+          message.error(err.message || err);
74
+        });
75
+      },
69 76
     });
70 77
   }
71 78
   useEffect(() => {
@@ -144,7 +151,7 @@ export default (props) => {
144 151
               {
145 152
                 dispatchId ?
146 153
                   <Button loading={cancelLoading} onClick={onCancel} style={{ marginLeft: '4em' }}>
147
-                    取消
154
+                    取消调度
148 155
                   </Button> :
149 156
                   <Button type="primary" loading={loading} onClick={submit} style={{ marginLeft: '4em' }}>
150 157
                     保存

+ 2
- 2
src/pages/Welcome.jsx Vedi File

@@ -123,7 +123,7 @@ const Welcome = () => {
123 123
                   <div style={{ height: '448px', width: '100%' }}>
124 124
                     {dispatchList.map(item =>
125 125
                       <div style={{ height: '60px' }} key={item.orderId} onClick={() => goDispatch(item)} >
126
-                        {item.personName || item.phone + ' 于 ' + item.createDate + ' 下了一单请您尽快处理!'}
126
+                        {(item.personName || item.phone) + ' 于 ' + item.createDate + ' 下了一单请您尽快处理!'}
127 127
                       </div>
128 128
                     )}
129 129
                   </div> :
@@ -141,7 +141,7 @@ const Welcome = () => {
141 141
                   >
142 142
                     {dispatchList.map((item) => (
143 143
                       <SwiperSlide key={item.orderId} onClick={() => goDispatch(item)}>
144
-                        {item.personName || item.phone + ' 于 ' + item.createDate + ' 下了一单请您尽快处理!'}
144
+                        {(item.personName || item.phone) + ' 于 ' + item.createDate + ' 下了一单请您尽快处理!'}
145 145
                       </SwiperSlide>
146 146
                     ))}
147 147
                   </Swiper>

+ 85
- 0
src/pages/customer/index.jsx Vedi File

@@ -0,0 +1,85 @@
1
+import React, { useState, useRef } from 'react';
2
+import { DatePicker } from 'antd';
3
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
4
+import moment from 'moment';
5
+import PageTable from '@/components/PageTable';
6
+import { getUserList } from '@/services/user'
7
+
8
+const formatterTime = (val) => {
9
+  return val ? moment(val).format('YYYY-MM-DD HH:mm') : '';
10
+};
11
+const { RangePicker } = DatePicker;
12
+
13
+export default (props) => {
14
+  const [start, setStartDate] = useState()
15
+  const [end, setEndDate] = useState()
16
+
17
+  const handelChange = (date, dateStrings) => {
18
+    setStartDate(dateStrings[0])
19
+    setEndDate(dateStrings[1])
20
+  }
21
+  const ref = useRef();
22
+  const Reset = () => {
23
+    setStartDate()
24
+    setEndDate()
25
+    ref.current.reload();
26
+  }
27
+
28
+  const columns = [
29
+    {
30
+      title: '姓名',
31
+      dataIndex: 'name',
32
+      key: 'name',
33
+    },
34
+    {
35
+      title: '头像',
36
+      dataIndex: 'avatar',
37
+      key: 'avatar',
38
+    },
39
+    {
40
+      title: '手机号',
41
+      dataIndex: 'phone',
42
+      key: 'phone',
43
+    },
44
+    {
45
+      title: '身份',
46
+      dataIndex: 'type',
47
+      key: 'type',
48
+      dataIndex: 'position',
49
+      render: (_, record) => {
50
+        return record.position === 'index'
51
+          ? '农户'
52
+          : record.position === 'appIndex'
53
+            ? '农机手' : ''
54
+      },
55
+      valueType: 'select',
56
+      valueEnum: {
57
+        'index': { text: '农户' },
58
+        'appIndex': { text: '农机手' },
59
+      },
60
+    },
61
+
62
+    {
63
+      title: '注册时间',
64
+      dataIndex: 'createDate',
65
+      key: 'createDate',
66
+      render: (t, render) => formatterTime(render.createDate),
67
+      renderFormItem: (_, record) => <RangePicker placeholder={['开始日期', '结束日期']} format='YYYY-MM-DD' onChange={handelChange} />
68
+    },
69
+  ];
70
+
71
+  return (
72
+    <PageHeaderWrapper>
73
+      <PageTable
74
+        actionRef={ref}
75
+        request={getUserList}
76
+        // expfunc={exportPersonList}
77
+        columns={columns}
78
+        rowKey="userId"
79
+        params={{ start, end }}
80
+        onReset={Reset}
81
+        options={false}
82
+      />
83
+    </PageHeaderWrapper>
84
+  );
85
+};