李志伟 3 yıl önce
ebeveyn
işleme
3296eb5d3a

+ 11
- 20
config/routes.js Dosyayı Görüntüle

@@ -98,26 +98,23 @@ export default [
98 98
       },
99 99
     ],
100 100
   },
101
-  {
102
-    path: '/GPSDevice/GPS',
103
-    name: '设备管理',
104
-    icon: 'CompassOutlined',
105
-    component: './GPSDevice/GPS',
106
-    routes: [
107
-      {
108
-        path: '/GPSDevice/GPS/GPSEdit',
109
-        name: '新增设备',
110
-        component: './GPSDevice/GPS/GPSEdit',
111
-        hideInMenu: true,
112
-      },
113
-    ],
114
-  },
115 101
   {
116 102
     path: '/Machinery',
117 103
     name: '农机管理',
118 104
     icon: 'CarOutlined',
119 105
     component: '../layouts/BasicLayout',
120 106
     routes: [
107
+      {
108
+        path: '/Machinery/GPS',
109
+        name: '设备管理',
110
+        component: './Machinery/GPS',
111
+      },
112
+      {
113
+        path: '/Machinery/GPS/edit.jsx',
114
+        name: '设备编辑',
115
+        component: './Machinery/GPS/edit.jsx',
116
+        hideInMenu: true,
117
+      },
121 118
       {
122 119
         path: '/Machinery/MachineryType',
123 120
         name: '农机分类列表',
@@ -147,12 +144,6 @@ export default [
147 144
         name: '农机统计',
148 145
         component: './MachineryStatistics',
149 146
       },
150
-      {
151
-        path: '/GPSDevice/GPS/GPSEdit',
152
-        name: '新增设备',
153
-        component: './GPSDevice/GPS/GPSEdit',
154
-        hideInMenu: true,
155
-      },
156 147
     ],
157 148
   },
158 149
   {

+ 0
- 50
src/pages/GPSDevice/GPS/GPSEdit/index.jsx Dosyayı Görüntüle

@@ -1,50 +0,0 @@
1
-import { Input, Card, Select, Button, message } from "antd"
2
-import { useEffect, useState } from 'react'
3
-import { Form } from "antd";
4
-import { history } from 'umi';
5
-import ProCard from '@ant-design/pro-card'
6
-
7
-const { Option } = Select
8
-const goBack = () => {
9
-  history.goBack()
10
-}
11
-const FormItem = Form.Item
12
-export default (props) => {
13
-
14
-  const [form] = Form.useForm()
15
-  const [loading, setLoading] = useState(false)
16
-
17
-  const formItemLayout = {
18
-    //布局
19
-    labelCol: { span: 6 },
20
-    wrapperCol: { span: 14 },
21
-  };
22
-
23
-  const Submit = values => {
24
-    setLoading(false)
25
-    console.log("🚀 ~ file: index.jsx ~ line 21 ~ values", values)
26
-
27
-  };
28
-
29
-  return (
30
-    <Card >
31
-      <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}
32
-      >
33
-        <ProCard.TabPane key={1} tab="设备管理">
34
-          <Form {...formItemLayout} onFinish={Submit} form={form} >
35
-            <FormItem label="设备ID" name="shopName" rules={[{ required: true, message: '请输入' }]}>
36
-              <Input placeholder="请输入" style={{ width: '350px' }} />
37
-            </FormItem>
38
-            <FormItem label="设备号" name="title" rules={[{ required: true, message: '请输入' }]}>
39
-              <Input placeholder="请输入" style={{ width: '350px' }} />
40
-            </FormItem>
41
-            <FormItem label=" " colon={false} >
42
-              <Button type='default' onClick={() => goBack()} >返回</Button>
43
-              <Button type='primary' loading={loading} htmlType="Submit" style={{ marginLeft: '4em' }}>保存</Button>
44
-            </FormItem>
45
-          </Form>
46
-        </ProCard.TabPane>
47
-      </ProCard>
48
-    </Card>
49
-  )
50
-}

+ 60
- 0
src/pages/Machinery/GPS/edit.jsx Dosyayı Görüntüle

@@ -0,0 +1,60 @@
1
+import { Input, Card, Select, Button, message } from 'antd';
2
+import { useEffect, useState } from 'react';
3
+import { Form } from 'antd';
4
+import { history } from 'umi';
5
+import ProCard from '@ant-design/pro-card';
6
+
7
+const { Option } = Select;
8
+const goBack = () => {
9
+  history.goBack();
10
+};
11
+const FormItem = Form.Item;
12
+export default (props) => {
13
+  const [form] = Form.useForm();
14
+  const [loading, setLoading] = useState(false);
15
+
16
+  const formItemLayout = {
17
+    //布局
18
+    labelCol: { span: 6 },
19
+    wrapperCol: { span: 14 },
20
+  };
21
+
22
+  const Submit = (values) => {
23
+    setLoading(false);
24
+    console.log('🚀 ~ file: index.jsx ~ line 21 ~ values', values);
25
+  };
26
+
27
+  return (
28
+    <Card>
29
+      <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}>
30
+        <ProCard.TabPane key={1} tab="设备管理">
31
+          <Form {...formItemLayout} onFinish={Submit} form={form}>
32
+            <FormItem
33
+              label="设备ID"
34
+              name="shopName"
35
+              rules={[{ required: true, message: '请输入' }]}
36
+            >
37
+              <Input placeholder="请输入" style={{ width: '350px' }} />
38
+            </FormItem>
39
+            <FormItem label="设备号" name="title" rules={[{ required: true, message: '请输入' }]}>
40
+              <Input placeholder="请输入" style={{ width: '350px' }} />
41
+            </FormItem>
42
+            <FormItem label=" " colon={false}>
43
+              <Button type="default" onClick={() => goBack()}>
44
+                返回
45
+              </Button>
46
+              <Button
47
+                type="primary"
48
+                loading={loading}
49
+                htmlType="Submit"
50
+                style={{ marginLeft: '4em' }}
51
+              >
52
+                保存
53
+              </Button>
54
+            </FormItem>
55
+          </Form>
56
+        </ProCard.TabPane>
57
+      </ProCard>
58
+    </Card>
59
+  );
60
+};

src/pages/GPSDevice/GPS/index.jsx → src/pages/Machinery/GPS/index.jsx Dosyayı Görüntüle

@@ -1,11 +1,10 @@
1 1
 import { history, Link } from 'umi';
2 2
 import { useRef } from 'react';
3
-import { Button, message, Popconfirm, } from 'antd';
4
-import { PlusOutlined, } from '@ant-design/icons';
3
+import { Button, message, Popconfirm } from 'antd';
4
+import { PlusOutlined } from '@ant-design/icons';
5 5
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
6 6
 import ProTable, { TableDropdown } from '@ant-design/pro-table';
7 7
 
8
-
9 8
 export default (props) => {
10 9
   const dataSource = [
11 10
     {
@@ -16,27 +15,27 @@ export default (props) => {
16 15
       status: 1,
17 16
       zz: '西湖区湖底公园1号',
18 17
     },
19
-
20 18
   ];
21 19
 
22 20
   // 测试内容👆-------------------------
23 21
 
24 22
   const actionRef = useRef();
25 23
   const gotoDetail = (id) => {
26
-    history.push(`./GPS/GPSEdit`)
27
-  }
28
-
24
+    history.push(`./GPS/edit.jsx`);
25
+  };
29 26
 
30 27
   const handleDelete = (e) => {
31
-    deleteNote(e.noteId).then(res => {
28
+    deleteNote(e.noteId).then((res) => {
32 29
       message.success('删除成功');
33 30
       actionRef.current.reload();
34
-    })
35
-  }
31
+    });
32
+  };
36 33
 
37 34
   const actions = () => [
38
-    <Button key='add' type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>新增</Button>,
39
-  ]
35
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>
36
+      新增
37
+    </Button>,
38
+  ];
40 39
   const columns = [
41 40
     {
42 41
       title: 'ID',
@@ -56,10 +55,9 @@ export default (props) => {
56 55
       valueEnum: {
57 56
         0: { text: '已启用', status: 'Success' },
58 57
         1: { text: '已禁用', status: 'Error' },
59
-      }
58
+      },
60 59
     },
61 60
 
62
-
63 61
     {
64 62
       title: '操作',
65 63
       valueType: 'option',
@@ -67,7 +65,9 @@ export default (props) => {
67 65
       ellipsis: true,
68 66
       width: 200,
69 67
       render: (_, record) => [
70
-        <Link key={2} to={`./GPS/GPSEdit`}>编辑</Link>,
68
+        <Link key={2} to={`./GPS/edit.jsx`}>
69
+          编辑
70
+        </Link>,
71 71
         <Popconfirm
72 72
           key={3}
73 73
           title="您是否确认删除 ?"
@@ -75,11 +75,11 @@ export default (props) => {
75 75
           okText="确定"
76 76
           cancelText="取消"
77 77
         >
78
-          <a href="#"  >删除</a>
78
+          <a href="#">删除</a>
79 79
         </Popconfirm>,
80
-      ]
80
+      ],
81 81
     },
82
-  ]
82
+  ];
83 83
 
84 84
   return (
85 85
     <PageHeaderWrapper>
@@ -93,5 +93,5 @@ export default (props) => {
93 93
         actionRef={actionRef}
94 94
       />
95 95
     </PageHeaderWrapper>
96
-  )
97
-}
96
+  );
97
+};