浏览代码

Merge branch 'master' of http://git.ycjcjy.com/jgz/admin

Yansen 2 年前
父节点
当前提交
e65232c32a

+ 2
- 1
config/proxy.js 查看文件

11
     // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
11
     // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
12
     '/api/': {
12
     '/api/': {
13
       // 要代理的地址
13
       // 要代理的地址
14
-      target: 'http://192.168.89.147:8087',
14
+      //http://192.168.89.147:8087
15
+      target: 'http://localhost:8087',
15
       // 配置了这个可以从 http 代理到 https
16
       // 配置了这个可以从 http 代理到 https
16
       // 依赖 origin 的功能可能需要这个,比如 cookie
17
       // 依赖 origin 的功能可能需要这个,比如 cookie
17
       changeOrigin: true,
18
       changeOrigin: true,

+ 7
- 0
config/routes.js 查看文件

62
     hideInMenu: true,
62
     hideInMenu: true,
63
     component: './dish/edit',
63
     component: './dish/edit',
64
   },
64
   },
65
+  {
66
+    path: '/dish/edit',
67
+    name: '菜肴修改',
68
+    hideInMenu: true,
69
+    icon: 'VideoCameraOutlined',
70
+    component: './dish/edit',
71
+  },
65
   {
72
   {
66
     path: '/package/list',
73
     path: '/package/list',
67
     name: '套餐管理',
74
     name: '套餐管理',

+ 13
- 3
src/pages/dish/edit/index.jsx 查看文件

1
-import { addDish, updataDish } from '@/services/api/dish';
1
+import { addDish, updataDish, getDishById, getDishList } from '@/services/api/dish';
2
+import { queryTable } from '@/utils/request';
2
 import { PageContainer, ProForm, ProFormDigit, ProFormText, ModalForm, Select, Option } from '@ant-design/pro-components';
3
 import { PageContainer, ProForm, ProFormDigit, ProFormText, ModalForm, Select, Option } from '@ant-design/pro-components';
3
 import { history, useSearchParams } from '@umijs/max';
4
 import { history, useSearchParams } from '@umijs/max';
4
 import { Card, Col, message, Row, Space, Image } from 'antd';
5
 import { Card, Col, message, Row, Space, Image } from 'antd';
6
+import { values } from 'lodash';
5
 import { useEffect, useRef, useState } from 'react';
7
 import { useEffect, useRef, useState } from 'react';
6
 
8
 
7
 export default (props) => {
9
 export default (props) => {
11
   const formRef = useRef();
13
   const formRef = useRef();
12
   useEffect(() => {
14
   useEffect(() => {
13
     if (id) {
15
     if (id) {
14
-      getBannerdById(id).then((res) => {
16
+      getDishById(id).then((res) => {
15
         setData(res);
17
         setData(res);
16
 
18
 
17
         formRef.current.setFieldsValue(res);
19
         formRef.current.setFieldsValue(res);
20
   }, [id]);
22
   }, [id]);
21
 
23
 
22
   const onFinish = async (values) => {
24
   const onFinish = async (values) => {
25
+    console.log(values)
26
+
23
     if (id) {
27
     if (id) {
24
       // 修改
28
       // 修改
25
       updataDish(id, { ...values }).then((res) => {
29
       updataDish(id, { ...values }).then((res) => {
57
                 <Row>
61
                 <Row>
58
                   <Col span={8} offset={8}>
62
                   <Col span={8} offset={8}>
59
                     <Space>{doms}</Space>
63
                     <Space>{doms}</Space>
64
+
60
                   </Col>
65
                   </Col>
61
                 </Row>
66
                 </Row>
62
               );
67
               );
65
         >
70
         >
66
           <ProFormText name="name" label="菜肴名称" placeholder="请输入菜肴名称" width={460} />
71
           <ProFormText name="name" label="菜肴名称" placeholder="请输入菜肴名称" width={460} />
67
           <ProFormText name="unit" label="菜肴单位" placeholder="请输入菜肴单位" width={460} />
72
           <ProFormText name="unit" label="菜肴单位" placeholder="请输入菜肴单位" width={460} />
68
-          {/* <Select label="包含食材" mode="multiple"></Select> */}
73
+          {/* <Select label="包含食材" mode="multiple" >
74
+            <Option></Option>
75
+            <Option></Option>
76
+          </Select> */}
77
+
69
         </ProForm>
78
         </ProForm>
70
       </Card>
79
       </Card>
71
     </PageContainer>
80
     </PageContainer>
81
+
72
   );
82
   );
73
 };
83
 };

+ 10
- 12
src/pages/dish/list/index.jsx 查看文件

1
-import { getDishList, addDish, updataDish } from '@/services/api/dish';
1
+import { getDishList, addDish, updataDish, deleteDish } from '@/services/api/dish';
2
 import { queryTable } from '@/utils/request';
2
 import { queryTable } from '@/utils/request';
3
 import { PageContainer, ProTable } from '@ant-design/pro-components';
3
 import { PageContainer, ProTable } from '@ant-design/pro-components';
4
 import { history } from '@umijs/max';
4
 import { history } from '@umijs/max';
22
 
22
 
23
   const handleDelete = (id) => {
23
   const handleDelete = (id) => {
24
     if (id) {
24
     if (id) {
25
-      deleteBanner(id).then((res) => {
25
+      deleteDish(id).then((res) => {
26
         message.success('删除成功');
26
         message.success('删除成功');
27
         actionRef.current.reload();
27
         actionRef.current.reload();
28
       });
28
       });
39
       title: '菜肴单位',
39
       title: '菜肴单位',
40
       dataIndex: 'unit',
40
       dataIndex: 'unit',
41
     },
41
     },
42
-    {
43
-      title: '包含食材(种)',
44
-      dataIndex: 'itemId.amount',
45
-    },
42
+    // {
43
+    //   title: '包含食材(种)',
44
+    //   dataIndex: 'status',
45
+    // },
46
     {
46
     {
47
       title: '操作',
47
       title: '操作',
48
       valueType: 'option',
48
       valueType: 'option',
56
             updata(record);
56
             updata(record);
57
           }}
57
           }}
58
         >
58
         >
59
-          {record.state === '1' ? '下架' : '上架'}
59
+          {/* {record.state === '1' ? '下架' : '上架'} */}
60
         </Button>,
60
         </Button>,
61
         <Button
61
         <Button
62
           key={2}
62
           key={2}
63
           style={{ padding: 0 }}
63
           style={{ padding: 0 }}
64
           type="link"
64
           type="link"
65
           onClick={() => {
65
           onClick={() => {
66
-            console.log(record, ']]');
67
-            history.push(`/rotationChart/add?id=${record.id}`);
66
+            history.push(`/dish/add?id=${record.id}`);
68
           }}
67
           }}
69
         >
68
         >
70
-          编辑
69
+          修改
71
         </Button>,
70
         </Button>,
72
 
71
 
73
         <Popconfirm
72
         <Popconfirm
96
           <Button
95
           <Button
97
             key="2"
96
             key="2"
98
             type="primary"
97
             type="primary"
99
-            // onClick={() => { setCurrent({}); setVisible(true); }}
100
             onClick={() => {
98
             onClick={() => {
101
               history.push('/dish/add');
99
               history.push('/dish/add');
102
             }}
100
             }}
104
             新增
102
             新增
105
           </Button>,
103
           </Button>,
106
         ]}
104
         ]}
107
-        // request={queryTable(getDishList)}
105
+        request={queryTable(getDishList)}
108
         columns={columns}
106
         columns={columns}
109
       />
107
       />
110
     </PageContainer>
108
     </PageContainer>

+ 2
- 1
src/pages/monitor/edit.jsx 查看文件

6
 import { useEffect } from 'react';
6
 import { useEffect } from 'react';
7
 
7
 
8
 export default (props) => {
8
 export default (props) => {
9
-  const {onSubmit, onCancel, dataSource = {}, visible} = props;
9
+  const { onSubmit, onCancel, dataSource = {}, visible } = props;
10
   const [form] = Form.useForm();
10
   const [form] = Form.useForm();
11
 
11
 
12
   const handleSubmit = (values) => {
12
   const handleSubmit = (values) => {
15
         status: '1',
15
         status: '1',
16
         ...(dataSource || {}),
16
         ...(dataSource || {}),
17
         ...values
17
         ...values
18
+
18
       })
19
       })
19
     }
20
     }
20
   }
21
   }

+ 1
- 1
src/pages/monitor/index.jsx 查看文件

135
           <Button
135
           <Button
136
             key="2"
136
             key="2"
137
             type="primary"
137
             type="primary"
138
-            onClick={() => { setCurrent({}); setVisible(true);  }}
138
+            onClick={() => { setCurrent({}); setVisible(true); }}
139
           >
139
           >
140
             新增
140
             新增
141
           </Button>,
141
           </Button>,

+ 15
- 2
src/services/api/dish.js 查看文件

7
  */
7
  */
8
 export const getDishList = (params) => request('/dishes', { params });
8
 export const getDishList = (params) => request('/dishes', { params });
9
 
9
 
10
+/**
11
+ * 详情
12
+ * @param {*} id
13
+ * @returns
14
+ */
15
+export const getDishById = (id) => request(`/dishes/${id}`);
10
 
16
 
11
 /**
17
 /**
12
  * 新增
18
  * 新增
13
  * @param {*} data
19
  * @param {*} data
14
  * @returns
20
  * @returns
15
  */
21
  */
16
-export const addDish = (data) => request('/dish', { method: 'post', data });
22
+export const addDish = (data) => request('/dishes', { method: 'post', data });
17
 
23
 
18
 /**
24
 /**
19
  * 新增
25
  * 新增
21
  * @param {*} data
27
  * @param {*} data
22
  * @returns
28
  * @returns
23
  */
29
  */
24
-export const updataDish = (id, data) => request(`/dish/${id}`, { method: 'put', data });
30
+export const updataDish = (id, data) => request(`/dishes/${id}`, { method: 'put', data });
31
+
32
+/**
33
+ * 删除
34
+ * @param {*} id
35
+ * @returns
36
+ */
37
+export const deleteDish = (id) => request(`/dishes/${id}`, { method: 'delete' });