Pārlūkot izejas kodu

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

Yansen 2 gadus atpakaļ
vecāks
revīzija
79fdff265e

+ 20
- 10
src/pages/dish/edit/index.jsx Parādīt failu

@@ -1,16 +1,28 @@
1
-import { addDish, updataDish, getDishById, getDishList } from '@/services/api/dish';
1
+import { addDish, updataDish, getDishById, getDishList, getFoodIngredientsList } from '@/services/api/dish';
2 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 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 6
 import { values } from 'lodash';
7 7
 import { useEffect, useRef, useState } from 'react';
8 8
 
9 9
 export default (props) => {
10 10
   const [searchParams] = useSearchParams();
11 11
   const id = searchParams.get('id');
12
+  const [datas, setDatas] = useState([]);
12 13
   const [data, setData] = useState({});
13 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 26
   useEffect(() => {
15 27
     if (id) {
16 28
       getDishById(id).then((res) => {
@@ -22,7 +34,7 @@ export default (props) => {
22 34
   }, [id]);
23 35
 
24 36
   const onFinish = async (values) => {
25
-    console.log(values)
37
+
26 38
 
27 39
     if (id) {
28 40
       // 修改
@@ -40,7 +52,7 @@ export default (props) => {
40 52
 
41 53
     return false;
42 54
   };
43
-
55
+  console.log("datas", datas)
44 56
   return (
45 57
     <PageContainer>
46 58
       <Card>
@@ -70,11 +82,9 @@ export default (props) => {
70 82
         >
71 83
           <ProFormText name="name" label="菜肴名称" placeholder="请输入菜肴名称" width={460} />
72 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 88
         </ProForm>
79 89
       </Card>
80 90
     </PageContainer>

+ 7
- 5
src/pages/dish/list/index.jsx Parādīt failu

@@ -38,11 +38,13 @@ const DishList = (props) => {
38 38
     {
39 39
       title: '菜肴单位',
40 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 49
       title: '操作',
48 50
       valueType: 'option',
@@ -88,7 +90,7 @@ const DishList = (props) => {
88 90
   return (
89 91
     <PageContainer>
90 92
       <ProTable
91
-        search={false}
93
+        search={true}
92 94
         actionRef={actionRef}
93 95
         rowKey="id"
94 96
         toolBarRender={() => [

+ 140
- 5
src/pages/guaranteeTask/index.jsx Parādīt failu

@@ -1,7 +1,142 @@
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 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 Parādīt failu

@@ -7,6 +7,13 @@ import { request } from '@umijs/max';
7 7
  */
8 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 19
  * @param {*} id

+ 17
- 1
src/services/api/guaranteeTask.js Parādīt failu

@@ -41,4 +41,20 @@ import { request } from '@umijs/max';
41 41
  * @param {*} data
42 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' });