瀏覽代碼

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

Yansen 2 年之前
父節點
當前提交
79fdff265e

+ 20
- 10
src/pages/dish/edit/index.jsx 查看文件

1
-import { addDish, updataDish, getDishById, getDishList } from '@/services/api/dish';
1
+import { addDish, updataDish, getDishById, getDishList, getFoodIngredientsList } from '@/services/api/dish';
2
 import { queryTable } from '@/utils/request';
2
 import { queryTable } from '@/utils/request';
3
-import { PageContainer, ProForm, ProFormDigit, ProFormText, ModalForm, Select, Option } from '@ant-design/pro-components';
3
+import { PageContainer, ProForm, ProFormDigit, ProFormText, ModalForm, ProFormSelect } from '@ant-design/pro-components';
4
 import { history, useSearchParams } from '@umijs/max';
4
 import { history, useSearchParams } from '@umijs/max';
5
-import { Card, Col, message, Row, Space, Image } from 'antd';
5
+import { Card, Col, message, Row, Space, Image, Select, Option } from 'antd';
6
 import { values } from 'lodash';
6
 import { values } from 'lodash';
7
 import { useEffect, useRef, useState } from 'react';
7
 import { useEffect, useRef, useState } from 'react';
8
 
8
 
9
 export default (props) => {
9
 export default (props) => {
10
   const [searchParams] = useSearchParams();
10
   const [searchParams] = useSearchParams();
11
   const id = searchParams.get('id');
11
   const id = searchParams.get('id');
12
+  const [datas, setDatas] = useState([]);
12
   const [data, setData] = useState({});
13
   const [data, setData] = useState({});
13
   const formRef = useRef();
14
   const formRef = useRef();
15
+  useEffect(() => {
16
+
17
+    getFoodIngredientsList().then((res) => {
18
+      setDatas(res?.records?.map((x) => ({
19
+        label: x.name,
20
+        value: x.dishId
21
+      })))
22
+
23
+    });
24
+  }, [id]);
25
+
14
   useEffect(() => {
26
   useEffect(() => {
15
     if (id) {
27
     if (id) {
16
       getDishById(id).then((res) => {
28
       getDishById(id).then((res) => {
22
   }, [id]);
34
   }, [id]);
23
 
35
 
24
   const onFinish = async (values) => {
36
   const onFinish = async (values) => {
25
-    console.log(values)
37
+
26
 
38
 
27
     if (id) {
39
     if (id) {
28
       // 修改
40
       // 修改
40
 
52
 
41
     return false;
53
     return false;
42
   };
54
   };
43
-
55
+  console.log("datas", datas)
44
   return (
56
   return (
45
     <PageContainer>
57
     <PageContainer>
46
       <Card>
58
       <Card>
70
         >
82
         >
71
           <ProFormText name="name" label="菜肴名称" placeholder="请输入菜肴名称" width={460} />
83
           <ProFormText name="name" label="菜肴名称" placeholder="请输入菜肴名称" width={460} />
72
           <ProFormText name="unit" label="菜肴单位" placeholder="请输入菜肴单位" width={460} />
84
           <ProFormText name="unit" label="菜肴单位" placeholder="请输入菜肴单位" width={460} />
73
-          {/* <Select label="包含食材" mode="multiple" >
74
-            <Option></Option>
75
-            <Option></Option>
76
-          </Select> */}
77
-
85
+          <ProFormSelect mode="multiple" label="包含食材" placeholder="多选下拉" width={460}
86
+            options={datas}
87
+          />
78
         </ProForm>
88
         </ProForm>
79
       </Card>
89
       </Card>
80
     </PageContainer>
90
     </PageContainer>

+ 7
- 5
src/pages/dish/list/index.jsx 查看文件

38
     {
38
     {
39
       title: '菜肴单位',
39
       title: '菜肴单位',
40
       dataIndex: 'unit',
40
       dataIndex: 'unit',
41
+      search: false,
42
+    },
43
+    {
44
+      title: '包含食材(种)',
45
+      dataIndex: 'status',
46
+      search: false,
41
     },
47
     },
42
-    // {
43
-    //   title: '包含食材(种)',
44
-    //   dataIndex: 'status',
45
-    // },
46
     {
48
     {
47
       title: '操作',
49
       title: '操作',
48
       valueType: 'option',
50
       valueType: 'option',
88
   return (
90
   return (
89
     <PageContainer>
91
     <PageContainer>
90
       <ProTable
92
       <ProTable
91
-        search={false}
93
+        search={true}
92
         actionRef={actionRef}
94
         actionRef={actionRef}
93
         rowKey="id"
95
         rowKey="id"
94
         toolBarRender={() => [
96
         toolBarRender={() => [

+ 140
- 5
src/pages/guaranteeTask/index.jsx 查看文件

1
-import React from 'react'
1
+import { deleteGuaranteeTask, getGuaranteeTaskList } from '@/services/api/guaranteeTask';
2
+import { queryTable } from '@/utils/request';
3
+import { PageContainer, ProTable } from '@ant-design/pro-components';
4
+import { history } from '@umijs/max';
5
+import { Button, message, Popconfirm } from 'antd';
6
+import moment from 'moment';
7
+import { useRef, useState } from 'react';
8
+
9
+const GuaranteeTaskList = (props) => {
10
+  const [isOpen, setIsOpen] = useState(false);
11
+  const [modalData, setModalData] = useState({});
12
+  // const [storeTypeDict, setStoreTypeDict] = useState([]);
13
+  const actionRef = useRef();
14
+  const formRef = useRef();
15
+
16
+  const handleDelete = (id) => {
17
+    if (id) {
18
+      deleteGuaranteeTask(id).then((res) => {
19
+        message.success('删除成功');
20
+        actionRef.current.reload();
21
+      });
22
+    }
23
+  };
24
+
25
+  const onCancel = () => {
26
+    setIsOpen(false);
27
+    setModalData({});
28
+  };
29
+
30
+  const columns = [
31
+    {
32
+      title: '保障序号',
33
+      dataIndex: 'guaranteeNo',
34
+    },
35
+    {
36
+      title: '受领人',
37
+      dataIndex: 'receiver',
38
+    },
39
+    {
40
+      title: '时间区间',
41
+      dataIndex: 'dateRange',
42
+      valueType: 'dateRange',
43
+      search: {
44
+        transform: (value) => {
45
+          console.log(value, value[0].valueOf(), 'valuevalue');
46
+
47
+          return {
48
+            startDate: moment(value[0]).format('yyyy-MM-DD'),
49
+            endDate: moment(value[1]).format('yyyy-MM-DD'),
50
+          };
51
+        },
52
+      },
53
+    },
54
+    {
55
+      title: '保障地点',
56
+      dataIndex: 'address',
57
+      search: false,
58
+    },
59
+    {
60
+      title: '保障人数',
61
+      dataIndex: 'totalPersonNum',
62
+      search: false,
63
+    },
64
+    {
65
+      title: '伙食标准',
66
+      dataIndex: 'standard',
67
+      search: false,
68
+    },
69
+
70
+    {
71
+      title: '操作',
72
+      valueType: 'option',
73
+      width: 200,
74
+      render: (_, record) => [
75
+        <Button
76
+          key={2}
77
+          style={{ padding: 0 }}
78
+          type="link"
79
+          onClick={() => {
80
+            history.push(`/guaranteeTask/edit?id=${record.id}`);
81
+          }}
82
+        >
83
+          修改
84
+        </Button>,
85
+
86
+        <Popconfirm
87
+          key={3}
88
+          title="您是否确认删除 ?"
89
+          onConfirm={() => handleDelete(record.id)}
90
+          okText="确定"
91
+          cancelText="取消"
92
+        >
93
+          {/* manualPush */}
94
+          <Button style={{ padding: 0 }} type="link">
95
+            删除
96
+          </Button>
97
+        </Popconfirm>,
98
+        <Button
99
+          key={4}
100
+          style={{ padding: 0 }}
101
+          type="link"
102
+          onClick={() => {
103
+            history.push(`/guaranteeTask/print?id=${record.id}`);
104
+          }}
105
+        >
106
+          打印
107
+        </Button>,
108
+      ],
109
+    },
110
+  ];
2
 
111
 
3
-export default (props) => {
4
   return (
112
   return (
5
-    <div></div>
6
-  )
7
-}
113
+    <PageContainer>
114
+      <ProTable
115
+        actionRef={actionRef}
116
+        formRef={formRef}
117
+        postData={(data) => {
118
+          return data.map((x) => ({
119
+            dateRange: [x.startDate, x.endDate],
120
+            ...x,
121
+          }));
122
+        }}
123
+        rowKey="id"
124
+        toolBarRender={() => [
125
+          <Button
126
+            key="2"
127
+            type="primary"
128
+            onClick={() => {
129
+              history.push('/stock/add');
130
+            }}
131
+          >
132
+            新增
133
+          </Button>,
134
+        ]}
135
+        request={queryTable(getGuaranteeTaskList)}
136
+        columns={columns}
137
+      />
138
+    </PageContainer>
139
+  );
140
+};
141
+
142
+export default GuaranteeTaskList;

+ 7
- 0
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 {*} params
13
+ * @returns
14
+ */
15
+export const getFoodIngredientsList = (params) => request('/foodIngredients', { params });
16
+
10
 /**
17
 /**
11
  * 详情
18
  * 详情
12
  * @param {*} id
19
  * @param {*} id

+ 17
- 1
src/services/api/guaranteeTask.js 查看文件

41
  * @param {*} data
41
  * @param {*} data
42
  * @returns
42
  * @returns
43
  */
43
  */
44
- export const deleteGuaranteeDetail = id => request(`/guaranteeDetail/${id}`, { method: 'delete' });
44
+ export const deleteGuaranteeDetail = id => request(`/guaranteeDetail/${id}`, { method: 'delete' });
45
+
46
+
47
+
48
+ /**
49
+ * 查询列表
50
+ * @param {*} params
51
+ * @returns
52
+ */
53
+export const getGuaranteeTaskList = (params) => request('/guaranteeTask', { params });
54
+
55
+/**
56
+ * 删除
57
+ * @param {*} data
58
+ * @returns
59
+ */
60
+ export const deleteGuaranteeTask = id => request(`/guaranteeTask/${id}`, { method: 'delete' });