李志伟 3 years ago
parent
commit
9c03af19e4

+ 1
- 6
config/routes.js View File

46
     path: '/MonitoringScreen',
46
     path: '/MonitoringScreen',
47
     name: '农机作业监控大屏',
47
     name: '农机作业监控大屏',
48
     icon: 'DesktopOutlined',
48
     icon: 'DesktopOutlined',
49
-    component: '../layouts/BasicLayout',
49
+    component: './MonitoringScreen',
50
     routes: [
50
     routes: [
51
-      {
52
-        path: '/MonitoringScreen/index.jsx',
53
-        name: '数据大屏',
54
-        component: './MonitoringScreen',
55
-      },
56
       {
51
       {
57
         path: '/MonitoringScreen/detail.jsx',
52
         path: '/MonitoringScreen/detail.jsx',
58
         name: '农机轨迹',
53
         name: '农机轨迹',

+ 30
- 35
src/pages/ContentManagementSystem/InformationClassification/InformationClassificationEdit/index.jsx View File

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

+ 27
- 32
src/pages/ContentManagementSystem/InformationClassification/index.jsx View File

5
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
5
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
 import ProTable, { TableDropdown } from '@ant-design/pro-table';
6
 import ProTable, { TableDropdown } from '@ant-design/pro-table';
7
 
7
 
8
-
9
 export default (props) => {
8
 export default (props) => {
10
   const dataSource = [
9
   const dataSource = [
11
     {
10
     {
15
       age: 32,
14
       age: 32,
16
       zz: '西湖区湖底公园1号',
15
       zz: '西湖区湖底公园1号',
17
     },
16
     },
18
-
19
   ];
17
   ];
20
 
18
 
21
-
22
   // 测试内容👆-------------------------
19
   // 测试内容👆-------------------------
23
 
20
 
24
   const actionRef = useRef();
21
   const actionRef = useRef();
25
   const gotoDetail = (id) => {
22
   const gotoDetail = (id) => {
26
-    history.push(`InformationClassification/InformationClassificationEdit`)
27
-  }
28
-
23
+    history.push(`InformationClassification/InformationClassificationEdit`);
24
+  };
29
 
25
 
30
   const handleDelete = (e) => {
26
   const handleDelete = (e) => {
31
-    deleteNote(e.noteId).then(res => {
27
+    deleteNote(e.noteId).then((res) => {
32
       message.success('删除成功');
28
       message.success('删除成功');
33
       actionRef.current.reload();
29
       actionRef.current.reload();
34
-    })
35
-  }
30
+    });
31
+  };
36
 
32
 
37
   const handleOK = (record, data) => {
33
   const handleOK = (record, data) => {
38
-    const titleCourse = record.status ? '您确定要禁用该用户吗? 禁用后该用户不能在后台登陆!' : '您确定要启用该用户吗? 启用后该用户将允许在后台登陆!';
34
+    const titleCourse = record.status
35
+      ? '您确定要禁用该用户吗? 禁用后该用户不能在后台登陆!'
36
+      : '您确定要启用该用户吗? 启用后该用户将允许在后台登陆!';
39
     Modal.confirm({
37
     Modal.confirm({
40
       title: titleCourse,
38
       title: titleCourse,
41
       okText: '确认',
39
       okText: '确认',
42
       cancelText: '取消',
40
       cancelText: '取消',
43
-      onOk () {
44
-        publishNote(record.noteId, record.status ? 'off' : 'on').then(res => {
41
+      onOk() {
42
+        publishNote(record.noteId, record.status ? 'off' : 'on').then((res) => {
45
           message.success('操作成功');
43
           message.success('操作成功');
46
-          actionRef.current.reload()
47
-        })
44
+          actionRef.current.reload();
45
+        });
48
       },
46
       },
49
     });
47
     });
50
-  }
48
+  };
51
   const actions = () => [
49
   const actions = () => [
52
-    <Button key='add' type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>新增</Button>,
53
-  ]
50
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>
51
+      新增
52
+    </Button>,
53
+  ];
54
   const columns = [
54
   const columns = [
55
     {
55
     {
56
-      title: '资讯分类',
57
-      key: 'zz',
58
-      dataIndex: 'zz',
59
-      search: false,
60
-
61
-    },
62
-    {
63
-      title: '资讯分类名称',
56
+      title: '分类名',
64
       dataIndex: 'name',
57
       dataIndex: 'name',
65
       key: 'name',
58
       key: 'name',
66
       search: false,
59
       search: false,
82
       dataIndex: 'createdAt',
75
       dataIndex: 'createdAt',
83
       valueType: 'date',
76
       valueType: 'date',
84
       // render: (t) => formatterTime(t),
77
       // render: (t) => formatterTime(t),
85
-      sorter: (a, b) => a.createdAt - b.createdAt,//时间排序
78
+      sorter: (a, b) => a.createdAt - b.createdAt, //时间排序
86
     },
79
     },
87
     {
80
     {
88
       title: '操作',
81
       title: '操作',
91
       ellipsis: true,
84
       ellipsis: true,
92
       width: 200,
85
       width: 200,
93
       render: (_, record) => [
86
       render: (_, record) => [
94
-        <Link key={2} to={`InformationClassification/InformationClassificationEdit`}>编辑</Link>,
87
+        <Link key={2} to={`InformationClassification/InformationClassificationEdit`}>
88
+          编辑
89
+        </Link>,
95
         <Popconfirm
90
         <Popconfirm
96
           key={3}
91
           key={3}
97
           title="您是否确认删除 ?"
92
           title="您是否确认删除 ?"
99
           okText="确定"
94
           okText="确定"
100
           cancelText="取消"
95
           cancelText="取消"
101
         >
96
         >
102
-          <a href="#"  >删除</a>
97
+          <a href="#">删除</a>
103
         </Popconfirm>,
98
         </Popconfirm>,
104
-      ]
99
+      ],
105
     },
100
     },
106
-  ]
101
+  ];
107
 
102
 
108
   return (
103
   return (
109
     <PageHeaderWrapper>
104
     <PageHeaderWrapper>
118
         actionRef={actionRef}
113
         actionRef={actionRef}
119
       />
114
       />
120
     </PageHeaderWrapper>
115
     </PageHeaderWrapper>
121
-  )
122
-}
116
+  );
117
+};

+ 41
- 34
src/pages/ContentManagementSystem/InformationList/InformationListEdit/index.jsx View File

1
-import { Input, Card, Select, Button, message } from "antd"
2
-import { useEffect, useState } from 'react'
3
-import { Form } from "antd";
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';
4
 import { history } from 'umi';
5
-import ProCard from '@ant-design/pro-card'
5
+import ProCard from '@ant-design/pro-card';
6
+// import ModalImage from './Modalimage';
6
 
7
 
7
-const { Option } = Select
8
+const { Option } = Select;
8
 const goBack = () => {
9
 const goBack = () => {
9
-  history.goBack()
10
-}
11
-const FormItem = Form.Item
10
+  history.goBack();
11
+};
12
+const FormItem = Form.Item;
12
 export default (props) => {
13
 export default (props) => {
13
-
14
-  const [form] = Form.useForm()
15
-  const [loading, setLoading] = useState(false)
14
+  const [form] = Form.useForm();
15
+  const [loading, setLoading] = useState(false);
16
 
16
 
17
   const formItemLayout = {
17
   const formItemLayout = {
18
     //布局
18
     //布局
20
     wrapperCol: { span: 14 },
20
     wrapperCol: { span: 14 },
21
   };
21
   };
22
 
22
 
23
-  const Submit = values => {
24
-    console.log("🚀 ~ file: index.jsx ~ line 21 ~ values", values)
25
-
23
+  const Submit = (values) => {
24
+    console.log('🚀 ~ file: index.jsx ~ line 21 ~ values', values);
26
   };
25
   };
27
 
26
 
28
   return (
27
   return (
29
-    <Card >
28
+    <Card>
30
       <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}>
29
       <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}>
31
         <ProCard.TabPane key={1} tab="资讯管理">
30
         <ProCard.TabPane key={1} tab="资讯管理">
32
-          <Form {...formItemLayout} onFinish={Submit} form={form} >
31
+          <Form {...formItemLayout} onFinish={Submit} form={form}>
33
             <FormItem label="资讯分类" name="user" rules={[{ required: true, message: '请选择' }]}>
32
             <FormItem label="资讯分类" name="user" rules={[{ required: true, message: '请选择' }]}>
34
               <Select
33
               <Select
35
                 placeholder="请选择"
34
                 placeholder="请选择"
41
                 <Option value="nonghu">二分类</Option>
40
                 <Option value="nonghu">二分类</Option>
42
               </Select>
41
               </Select>
43
             </FormItem>
42
             </FormItem>
44
-            <FormItem label="资讯名称" name="shopName" rules={[{ required: true, message: '请输入' }]}>
43
+            <FormItem
44
+              label="资讯名称"
45
+              name="shopName"
46
+              rules={[{ required: true, message: '请输入' }]}
47
+            >
45
               <Input placeholder="请输入" style={{ width: '350px' }} />
48
               <Input placeholder="请输入" style={{ width: '350px' }} />
46
             </FormItem>
49
             </FormItem>
47
-            <FormItem label="资讯内容" name="shaopName" rules={[{ required: true, message: '请输入' }]}>
48
-              <Input placeholder="请输入" style={{ width: '350px' }} />
50
+            <FormItem label="资讯封面" name="thumb" rules={[{ required: true, message: '请输入' }]}>
51
+              {/* <ModalImage
52
+                sortVale={sortVale}
53
+                visible={visible}
54
+                value={content}
55
+                onChange={handleChange}
56
+                onCancel={handleClose}
57
+              /> */}
49
             </FormItem>
58
             </FormItem>
50
-            <FormItem label="发布状态" name="usser" rules={[{ required: true, message: '请选择' }]}>
51
-              <Select
52
-                placeholder="请选择"
53
-                // onChange={onGenderChange}
54
-                allowClear
55
-                style={{ width: '350px' }}
59
+            <FormItem label=" " colon={false}>
60
+              <Button type="default" onClick={() => goBack()}>
61
+                返回
62
+              </Button>
63
+              <Button
64
+                type="primary"
65
+                loading={loading}
66
+                htmlType="Submit"
67
+                style={{ marginLeft: '4em' }}
56
               >
68
               >
57
-                <Option value="nongji">发布</Option>
58
-                <Option value="nonghu">未发布</Option>
59
-              </Select>
60
-            </FormItem>
61
-            <FormItem label=" " colon={false} >
62
-              <Button type='default' onClick={() => goBack()} >返回</Button>
63
-              <Button type='primary' loading={loading} htmlType="Submit" style={{ marginLeft: '4em' }}>保存</Button>
69
+                保存
70
+              </Button>
64
             </FormItem>
71
             </FormItem>
65
           </Form>
72
           </Form>
66
         </ProCard.TabPane>
73
         </ProCard.TabPane>
67
       </ProCard>
74
       </ProCard>
68
     </Card>
75
     </Card>
69
-  )
70
-}
76
+  );
77
+};

+ 31
- 35
src/pages/ContentManagementSystem/InformationList/index.jsx View File

5
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
5
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
 import ProTable, { TableDropdown } from '@ant-design/pro-table';
6
 import ProTable, { TableDropdown } from '@ant-design/pro-table';
7
 
7
 
8
-
9
 export default (props) => {
8
 export default (props) => {
10
   const dataSource = [
9
   const dataSource = [
11
     {
10
     {
15
       age: 32,
14
       age: 32,
16
       zz: '西湖区湖底公园1号',
15
       zz: '西湖区湖底公园1号',
17
     },
16
     },
18
-
19
   ];
17
   ];
20
 
18
 
21
-
22
   // 测试内容👆-------------------------
19
   // 测试内容👆-------------------------
23
 
20
 
24
   const actionRef = useRef();
21
   const actionRef = useRef();
25
   const gotoDetail = (id) => {
22
   const gotoDetail = (id) => {
26
-    history.push(`InformationList/InformationListEdit`)
27
-  }
28
-
23
+    history.push(`InformationList/InformationListEdit`);
24
+  };
29
 
25
 
30
   const handleDelete = (e) => {
26
   const handleDelete = (e) => {
31
-    deleteNote(e.noteId).then(res => {
27
+    deleteNote(e.noteId).then((res) => {
32
       message.success('删除成功');
28
       message.success('删除成功');
33
       actionRef.current.reload();
29
       actionRef.current.reload();
34
-    })
35
-  }
36
-
30
+    });
31
+  };
37
 
32
 
38
   const actions = () => [
33
   const actions = () => [
39
-    <Button key='add' type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>新增</Button>,
40
-  ]
41
-
42
-
43
-
44
-
34
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>
35
+      新增
36
+    </Button>,
37
+  ];
45
 
38
 
46
   const columns = [
39
   const columns = [
47
     {
40
     {
48
-      title: '资讯分类',
49
-      key: 'zz',
50
-      dataIndex: 'zz',
41
+      title: '分类',
42
+      key: 'typeName',
43
+      dataIndex: 'typeName',
51
       search: false,
44
       search: false,
52
-
53
     },
45
     },
54
     {
46
     {
55
-      title: '资讯名称',
56
-      dataIndex: 'name',
57
-      key: 'name',
47
+      title: '资讯标题',
48
+      dataIndex: 'title',
49
+      key: 'title',
58
       search: false,
50
       search: false,
59
-    }, {
60
-      title: '资讯内容',
61
-      dataIndex: 'nam1e',
62
-      key: 'nam1e',
51
+    },
52
+    {
53
+      title: '封面',
54
+      key: 'thumb',
55
+      dataIndex: 'thumb',
63
       search: false,
56
       search: false,
57
+      render: (t) => <img src={t} alt="" width={110} />,
64
     },
58
     },
65
     {
59
     {
66
       title: (
60
       title: (
77
       dataIndex: 'createdAt',
71
       dataIndex: 'createdAt',
78
       valueType: 'date',
72
       valueType: 'date',
79
       // render: (t) => formatterTime(t),
73
       // render: (t) => formatterTime(t),
80
-      sorter: (a, b) => a.createdAt - b.createdAt,//时间排序
74
+      sorter: (a, b) => a.createdAt - b.createdAt, //时间排序
81
     },
75
     },
82
     {
76
     {
83
       title: '状态',
77
       title: '状态',
87
       valueEnum: {
81
       valueEnum: {
88
         0: { text: '已发布', status: 'Success' },
82
         0: { text: '已发布', status: 'Success' },
89
         1: { text: '未发布', status: 'Error' },
83
         1: { text: '未发布', status: 'Error' },
90
-      }
84
+      },
91
     },
85
     },
92
 
86
 
93
     {
87
     {
97
       ellipsis: true,
91
       ellipsis: true,
98
       width: 200,
92
       width: 200,
99
       render: (_, record) => [
93
       render: (_, record) => [
100
-        <Link key={2} to={`InformationList/InformationListEdit`}>编辑</Link>,
94
+        <Link key={2} to={`InformationList/InformationListEdit`}>
95
+          编辑
96
+        </Link>,
101
         <Popconfirm
97
         <Popconfirm
102
           key={3}
98
           key={3}
103
           title="您是否确认删除 ?"
99
           title="您是否确认删除 ?"
105
           okText="确定"
101
           okText="确定"
106
           cancelText="取消"
102
           cancelText="取消"
107
         >
103
         >
108
-          <a href="#"  >删除</a>
104
+          <a href="#">删除</a>
109
         </Popconfirm>,
105
         </Popconfirm>,
110
-      ]
106
+      ],
111
     },
107
     },
112
-  ]
108
+  ];
113
 
109
 
114
   return (
110
   return (
115
     <PageHeaderWrapper>
111
     <PageHeaderWrapper>
124
         actionRef={actionRef}
120
         actionRef={actionRef}
125
       />
121
       />
126
     </PageHeaderWrapper>
122
     </PageHeaderWrapper>
127
-  )
128
-}
123
+  );
124
+};