Yansen 2 years ago
parent
commit
57a31c2da0

+ 15
- 0
src/components/EditableTag/Tag.jsx View File

1
+import React from 'react';
2
+import { Button } from 'antd';
3
+import { CloseOutlined } from '@ant-design/icons';
4
+import './style.less'
5
+
6
+export default (props) => {
7
+  const { size, type, onDelete, children } = props;
8
+
9
+  return (
10
+    <div className='tag-btn-group'>
11
+      <Button size={size} type={type}>{children}</Button>
12
+      <Button size={size} type="primary" icon={<CloseOutlined />} onClick={onDelete} />
13
+    </div>
14
+  )
15
+}

+ 21
- 0
src/components/EditableTag/index.jsx View File

1
+import React from 'react';
2
+import { Button } from 'antd';
3
+import Tag from './Tag';
4
+import './style.less'
5
+
6
+export default (props) => {
7
+  const { size, type, list = [], onDelete, keyFuc, labelFunc } = props;
8
+
9
+  return (
10
+    <div className='editable-tag-box'>
11
+      {
12
+        list.map((item, index) => {
13
+          const key = keyFuc(item, index);
14
+          const label = labelFunc(item, index);
15
+
16
+          return <Tag key={key} size={size} type={type} onDelete={() => onDelete(item)}>{label}</Tag>
17
+        })
18
+      }
19
+    </div>
20
+  )
21
+}

+ 27
- 0
src/components/EditableTag/style.less View File

1
+.tag-btn-group {
2
+  .ant-btn {
3
+    vertical-align: middle;
4
+  }
5
+
6
+  .ant-btn:first-child {
7
+    border-right: none;
8
+  }
9
+
10
+  .ant-btn:last-child {
11
+    // border-left: none;
12
+    border-top-left-radius: 0;
13
+    border-bottom-left-radius: 0;
14
+    margin-left: -1px;
15
+  }
16
+}
17
+
18
+.editable-tag-box {
19
+  display: flex;
20
+  flex-wrap: wrap;
21
+
22
+  .tag-btn-group {
23
+    flex: none;
24
+    box-sizing: border-box;
25
+    padding: 1em;
26
+  }
27
+}

+ 1
- 1
src/pages/dish/edit/index.jsx View File

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, setSearchParams] = useSearchParams();
10
+  const [searchParams] = useSearchParams();
11
   const id = searchParams.get('id');
11
   const id = searchParams.get('id');
12
   const [data, setData] = useState({});
12
   const [data, setData] = useState({});
13
   const formRef = useRef();
13
   const formRef = useRef();

+ 57
- 18
src/pages/guaranteeTask/Edit/BasicForm.jsx View File

1
-import React, { useState } from 'react';
1
+import React, { useState, useEffect } from 'react';
2
+import moment from 'moment';
2
 import { Button, Row, Col, Form, Input, InputNumber, DatePicker, notification } from 'antd';
3
 import { Button, Row, Col, Form, Input, InputNumber, DatePicker, notification } from 'antd';
4
+import { addGuaranteeTask, updateGuaranteeTask } from '@/services/api/guaranteeTask';
3
 
5
 
4
 const { TextArea } = Input;
6
 const { TextArea } = Input;
5
 const { RangePicker } = DatePicker;
7
 const { RangePicker } = DatePicker;
6
 
8
 
7
 export default (props) => {
9
 export default (props) => {
10
+  const { dataSource, setDataSource } = props;
11
+
8
   const [form] = Form.useForm()
12
   const [form] = Form.useForm()
9
   const [rangeDate, setRangeDate] = useState([]);
13
   const [rangeDate, setRangeDate] = useState([]);
14
+  const [loading, setLoading] = useState(false);
10
 
15
 
11
   const onChange = (dts) => {
16
   const onChange = (dts) => {
12
     const [start, end] = dts;
17
     const [start, end] = dts;
22
       notification.warn({ message: '未检索到填写内容' });
27
       notification.warn({ message: '未检索到填写内容' });
23
       return ;
28
       return ;
24
     }
29
     }
30
+
31
+    const [start, end] = rangeDate;
32
+    const startDate = start ? start.format('YYYY-MM-DD') : undefined;
33
+    const endDate = end ? end.format('YYYY-MM-DD') : undefined;
34
+
35
+    const id = dataSource ? dataSource.id : undefined;
36
+    const func = id ? updateGuaranteeTask : addGuaranteeTask;
37
+
38
+    setLoading(true);
39
+    func({ ...values, startDate, endDate }, id).then(res => {
40
+      setLoading(false);
41
+      setDataSource(res);
42
+      notification.success({ message: '操作成功' })
43
+    }).catch(() => {
44
+      setLoading(false);
45
+    });
25
   }
46
   }
26
 
47
 
48
+  useEffect(() => {
49
+    if (dataSource) {
50
+      form.setFieldsValue(dataSource);
51
+
52
+      let rangeDt = [];
53
+
54
+      if (dataSource.startDate) {
55
+        rangeDt[0] = moment(dataSource.startDate);
56
+      }
57
+
58
+      if (dataSource.endDate) {
59
+        rangeDt[1] = moment(dataSource.endDate);
60
+      }
61
+
62
+      setRangeDate(rangeDt);
63
+    }
64
+  }, [dataSource, form]);
65
+
27
   return (
66
   return (
28
-    <Form layout="vertical" onFinish={onFinish}>
67
+    <Form layout="vertical" form={form} onFinish={onFinish}>
29
       <h3 style={{ marginBottom: '1.5em', fontWeight: 700 }}>人员安排</h3>
68
       <h3 style={{ marginBottom: '1.5em', fontWeight: 700 }}>人员安排</h3>
30
       <Row gutter={48}>
69
       <Row gutter={48}>
31
         <Col span={6}>
70
         <Col span={6}>
39
           </Form.Item>
78
           </Form.Item>
40
         </Col>
79
         </Col>
41
         <Col span={6}>
80
         <Col span={6}>
42
-          <Form.Item label="部队联系人" name="concat_person">
81
+          <Form.Item label="部队联系人" name="concatPerson">
43
             <Input allowClear />
82
             <Input allowClear />
44
           </Form.Item>
83
           </Form.Item>
45
         </Col>
84
         </Col>
46
         <Col span={6}>
85
         <Col span={6}>
47
-          <Form.Item label="部队联系人电话" name="concat_phone">
86
+          <Form.Item label="部队联系人电话" name="concatPhone">
48
             <Input allowClear />
87
             <Input allowClear />
49
           </Form.Item>
88
           </Form.Item>
50
         </Col>
89
         </Col>
56
           </Form.Item>
95
           </Form.Item>
57
         </Col>
96
         </Col>
58
         <Col span={6}>
97
         <Col span={6}>
59
-          <Form.Item label="制餐人电话" name="chef_phone">
98
+          <Form.Item label="制餐人电话" name="chefPhone">
60
             <Input allowClear />
99
             <Input allowClear />
61
           </Form.Item>
100
           </Form.Item>
62
         </Col>
101
         </Col>
63
         <Col span={6}>
102
         <Col span={6}>
64
-          <Form.Item label="送餐人" name="delivery_man">
103
+          <Form.Item label="送餐人" name="deliveryMan">
65
             <Input allowClear />
104
             <Input allowClear />
66
           </Form.Item>
105
           </Form.Item>
67
         </Col>
106
         </Col>
68
         <Col span={6}>
107
         <Col span={6}>
69
-          <Form.Item label="送餐人电话" name="delivery_phone">
108
+          <Form.Item label="送餐人电话" name="deliveryPhone">
70
             <Input allowClear />
109
             <Input allowClear />
71
           </Form.Item>
110
           </Form.Item>
72
         </Col>
111
         </Col>
75
       <h3 style={{ margin: '1.5em 0', fontWeight: 700 }}>基本情况</h3>
114
       <h3 style={{ margin: '1.5em 0', fontWeight: 700 }}>基本情况</h3>
76
       <Row gutter={48}>
115
       <Row gutter={48}>
77
         <Col span={6}>
116
         <Col span={6}>
78
-          <Form.Item label="军代表" name="deputy_man">
117
+          <Form.Item label="军代表" name="deputyMan">
79
             <Input allowClear />
118
             <Input allowClear />
80
           </Form.Item>
119
           </Form.Item>
81
         </Col>
120
         </Col>
82
         <Col span={6}>
121
         <Col span={6}>
83
-          <Form.Item label="电话" name="deputy_phone">
122
+          <Form.Item label="电话" name="deputyPhone">
84
             <Input allowClear />
123
             <Input allowClear />
85
           </Form.Item>
124
           </Form.Item>
86
         </Col>
125
         </Col>
87
         <Col span={6}>
126
         <Col span={6}>
88
-          <Form.Item label="通报时间" name="got_date">
127
+          <Form.Item label="通报时间" name="gotDate">
89
             <Input allowClear />
128
             <Input allowClear />
90
           </Form.Item>
129
           </Form.Item>
91
         </Col>
130
         </Col>
92
       </Row>
131
       </Row>
93
       <Row gutter={48}>
132
       <Row gutter={48}>
94
         <Col span={6}>
133
         <Col span={6}>
95
-          <Form.Item label="保障序号" name="guarantee_no">
134
+          <Form.Item label="保障序号" name="guaranteeNo">
96
             <Input allowClear />
135
             <Input allowClear />
97
           </Form.Item>
136
           </Form.Item>
98
         </Col>
137
         </Col>
99
         <Col span={6}>
138
         <Col span={6}>
100
-          <Form.Item label="军运号" name="transport_no">
139
+          <Form.Item label="军运号" name="transportNo">
101
             <Input allowClear />
140
             <Input allowClear />
102
           </Form.Item>
141
           </Form.Item>
103
         </Col>
142
         </Col>
104
         <Col span={6}>
143
         <Col span={6}>
105
-          <Form.Item label="车次" name="trips_no">
144
+          <Form.Item label="车次" name="tripsNo">
106
             <Input allowClear />
145
             <Input allowClear />
107
           </Form.Item>
146
           </Form.Item>
108
         </Col>
147
         </Col>
114
           </Form.Item>
153
           </Form.Item>
115
         </Col>
154
         </Col>
116
         <Col span={6}>
155
         <Col span={6}>
117
-          <Form.Item label="保障时间" name="time_range">
156
+          <Form.Item label="保障时间" name="timeRange">
118
             <Input allowClear />
157
             <Input allowClear />
119
           </Form.Item>
158
           </Form.Item>
120
         </Col>
159
         </Col>
121
       </Row>
160
       </Row>
122
       <Row gutter={48}>
161
       <Row gutter={48}>
123
         <Col span={6}>
162
         <Col span={6}>
124
-          <Form.Item label="保障人数" name="total_person_num">
163
+          <Form.Item label="保障人数" name="totalPersonNum">
125
             <InputNumber min={1} style={{ width: '100%' }}/>
164
             <InputNumber min={1} style={{ width: '100%' }}/>
126
           </Form.Item>
165
           </Form.Item>
127
         </Col>
166
         </Col>
128
         <Col span={6}>
167
         <Col span={6}>
129
-          <Form.Item label="其中回民" name="hui_person_num">
168
+          <Form.Item label="其中回民" name="huiPersonNum">
130
             <InputNumber min={0} style={{ width: '100%' }}/>
169
             <InputNumber min={0} style={{ width: '100%' }}/>
131
           </Form.Item>
170
           </Form.Item>
132
         </Col>
171
         </Col>
133
         <Col span={6}>
172
         <Col span={6}>
134
-          <Form.Item label="其中病号" name="patient_num">
173
+          <Form.Item label="其中病号" name="patientNum">
135
             <InputNumber min={0} style={{ width: '100%' }}/>
174
             <InputNumber min={0} style={{ width: '100%' }}/>
136
           </Form.Item>
175
           </Form.Item>
137
         </Col>
176
         </Col>
158
 
197
 
159
       <Row gutter={48}>
198
       <Row gutter={48}>
160
         <Col offset={6} span={6}>
199
         <Col offset={6} span={6}>
161
-          <Button type="primary" htmlType="submit">提交</Button>
200
+          <Button type="primary" htmlType="submit" loading={loading}>提交</Button>
162
           <Button style={{ marginLeft: '100px' }}>返回</Button>
201
           <Button style={{ marginLeft: '100px' }}>返回</Button>
163
         </Col>
202
         </Col>
164
       </Row>
203
       </Row>

+ 144
- 2
src/pages/guaranteeTask/Edit/DishList.jsx View File

1
-import React from 'react'
1
+import React, { useState, useEffect, useRef } from 'react';
2
+import { Row, Col, Card, Button, notification } from 'antd';
3
+import EditableTag from '@/components/EditableTag';
4
+import { getDishList } from '@/services/api/dish';
5
+import { getPackageList, getPackageDetailList } from '@/services/api/package';
6
+import {
7
+  updateGuaranteeTask,
8
+  getGuaranteeDetailList,
9
+  addGuaranteeDetailBatch,
10
+  deleteGuaranteeDetail
11
+} from '@/services/api/guaranteeTask';
12
+import Selector from './components/Selector';
2
 
13
 
3
 export default (props) => {
14
 export default (props) => {
15
+  const { dataSource, setDataSource } = props;
16
+
17
+  const [list, setList] = useState([]);
18
+  const [loading, setLoading] = useState(false);
19
+  const packageRef = useRef();
20
+
21
+  const handlePackageSubmit = ({item, amount}) => {
22
+    packageRef.current = item;
23
+
24
+    // 获取套餐下所有的菜肴
25
+    // 然后把菜肴放入到列表
26
+    getPackageDetailList({ pageNum: 1, pageSize: 500, packageId: item.id }).then(res => {
27
+      const { records = [] } = res;
28
+      if (records.length > 0) {
29
+        for (let it of records) {
30
+          const found = list.filter(x => x.dishId === it.id)[0]
31
+          if (found) {
32
+            found.dishAmount = amount;
33
+          } else {
34
+            list.push({
35
+              guaranteeId: dataSource.id,
36
+              dishId: it.id,
37
+              dishName: it.name,
38
+              dishUnit: it.unit,
39
+              dishAmount: amount,
40
+            })
41
+          }
42
+        }
43
+
44
+        setList(list.slice());
45
+      }
46
+    })
47
+  };
48
+
49
+  const handleDishSubmit = ({item, amount}) => {
50
+    const found = list.filter(x => x.dishId === item.id)[0]
51
+    if (found) {
52
+      found.dishAmount = amount;
53
+    } else {
54
+      list.push({
55
+        guaranteeId: dataSource.id,
56
+        dishId: item.id,
57
+        dishName: item.name,
58
+        dishUnit: item.unit,
59
+        dishAmount: amount,
60
+      })
61
+    }
62
+
63
+    setList(list.slice());
64
+  };
65
+
66
+  const onDelete = (item) => {
67
+    if (item.id) {
68
+      setLoading(true);
69
+      deleteGuaranteeDetail(item.id).then(res => {
70
+        setLoading(false);
71
+
72
+        const nwList = list.filter(x => x.dishId !== item.dishId);
73
+        setList(nwList);
74
+      }).catch(() => {
75
+        setLoading(false);
76
+      })
77
+    } else {
78
+      const nwList = list.filter(x => x.dishId !== item.dishId);
79
+      setList(nwList);
80
+    }
81
+  }
82
+
83
+  const onSubmit = () => {
84
+    setLoading(true);
85
+    addGuaranteeDetailBatch(list, dataSource.id).then(res => {
86
+      setLoading(false);
87
+      setList(res);
88
+      notification.success({ message: '操作成功' });
89
+    }).catch(() => {
90
+      setLoading(false);
91
+    });
92
+
93
+    if (packageRef.current) {
94
+      dataSource.packageName = packageRef.current.name;
95
+      updateGuaranteeTask(dataSource, dataSource.id).then(res => {
96
+        setDataSource(res);
97
+      });
98
+    }
99
+  }
100
+
101
+  useEffect(() => {
102
+    if (dataSource.id) {
103
+      setLoading(true);
104
+      getGuaranteeDetailList({ pageNum: 1, pageSize: 500, guaranteeId: dataSource.id }).then(res => {
105
+        setLoading(false);
106
+        setList(res.records || []);
107
+      }).catch(() => {
108
+        setLoading(false);
109
+      })
110
+    }
111
+  }, [dataSource.id])
112
+
4
   return (
113
   return (
5
-    <div></div>
114
+    <Row gutter={48}>
115
+      <Col span={8}>
116
+        <div>
117
+          <h3>选择套餐</h3>
118
+          <Selector
119
+            placeholder="请选择套餐"
120
+            fetch={getPackageList}
121
+            onSubmit={handlePackageSubmit}
122
+          />
123
+        </div>
124
+        <div style={{ marginTop: '48px' }}>
125
+          <h3>选择菜肴</h3>
126
+          <Selector
127
+            placeholder="请选择菜肴"
128
+            fetch={getDishList}
129
+            onSubmit={handleDishSubmit}
130
+          />
131
+        </div>
132
+      </Col>
133
+      <Col span={16}>
134
+        <Card
135
+          title="已选菜肴"
136
+          loading={loading}
137
+          extra={<Button type='primary' loading={loading} onClick={onSubmit}>保存</Button>}
138
+        >
139
+          <EditableTag
140
+            list={list}
141
+            keyFuc={x => x.dishId}
142
+            labelFunc={x => `${x.dishName} × ${x.dishAmount}`}
143
+            onDelete={onDelete}
144
+          />
145
+        </Card>
146
+      </Col>
147
+    </Row>
6
   )
148
   )
7
 }
149
 }

+ 70
- 0
src/pages/guaranteeTask/Edit/components/Selector.jsx View File

1
+import React, { useState, useEffect } from 'react';
2
+import { Button, Input, InputNumber, Select, notification } from 'antd';
3
+
4
+const { Group } = Input;
5
+const { Option } = Select;
6
+
7
+export default (props) => {
8
+  const { fetch, placeholder, onSubmit } = props;
9
+
10
+  const [data, setData] = useState([]);
11
+  const [value, setValue] = useState();
12
+  const [amount, setAmount] = useState();
13
+
14
+  const options = data.map(d => <Option key={d.id}>{d.name}</Option>);
15
+
16
+  const handleSearch = (name) => {
17
+    fetch({ pageNum: 1, pageSize: 20, name }).then(res => {
18
+      setData(res.records || []);
19
+    })
20
+  };
21
+
22
+  const handleChange = (val) => {
23
+    setValue(val);
24
+  }
25
+
26
+  const handleSubmit = () => {
27
+    if (!amount || amount <= 0) {
28
+      notification.warn({ message: '请输入正确的数量' });
29
+      return;
30
+    }
31
+
32
+    if (!value) {
33
+      notification.warn({ message: placeholder });
34
+      return;
35
+    }
36
+
37
+    const item = data.filter(x => `${x.id}` === `${value}`)[0];
38
+    if (item) {
39
+      onSubmit({ item, amount });
40
+    }
41
+  }
42
+
43
+  useEffect(() => {
44
+    fetch({ pageNum: 1, pageSize: 20 }).then(res => {
45
+      setData(res.records || []);
46
+    })
47
+  }, []);
48
+
49
+  return (
50
+    <Group compact>
51
+      <Select
52
+        allowClear
53
+        showSearch
54
+        value={value}
55
+        style={{ width: '50%' }}
56
+        placeholder={placeholder}
57
+        defaultActiveFirstOption={false}
58
+        showArrow={false}
59
+        filterOption={false}
60
+        onSearch={handleSearch}
61
+        onChange={handleChange}
62
+        notFoundContent={null}
63
+      >
64
+        {options}
65
+      </Select>
66
+      <InputNumber style={{ width: '30%' }} placeholder="请输入数量" value={amount} onChange={setAmount} />
67
+      <Button type="primary" onClick={handleSubmit}>确定</Button>
68
+    </Group>
69
+  )
70
+}

+ 23
- 4
src/pages/guaranteeTask/Edit/index.jsx View File

1
-import React, { useState } from 'react';
1
+import React, { useState, useEffect } from 'react';
2
+import { useSearchParams } from '@umijs/max';
2
 import { Tabs, Card } from 'antd';
3
 import { Tabs, Card } from 'antd';
3
 import { PageContainer } from '@ant-design/pro-components';
4
 import { PageContainer } from '@ant-design/pro-components';
5
+import { getGuaranteeTask } from '@/services/api/guaranteeTask';
4
 import BasicForm from './BasicForm';
6
 import BasicForm from './BasicForm';
5
 import DishList from './DishList';
7
 import DishList from './DishList';
6
 
8
 
7
 export default (props) => {
9
 export default (props) => {
8
   const [activeTabKey, setActiveTabKey] = useState('item-1');
10
   const [activeTabKey, setActiveTabKey] = useState('item-1');
11
+  const [loading, setLoading] = useState(false);
12
+  const [dataSource, setDataSource] = useState();
13
+  const [searchParams] = useSearchParams();
14
+  const id = searchParams.get('id');
9
 
15
 
10
   const tabList = [
16
   const tabList = [
11
     { tab: '基本情况', key: 'item-1', }, // 务必填写 key
17
     { tab: '基本情况', key: 'item-1', }, // 务必填写 key
12
-    { tab: '菜单详情', key: 'item-2', },
18
+    { tab: '军供菜单', key: 'item-2', },
13
   ];
19
   ];
14
 
20
 
21
+  useEffect(() => {
22
+    if (id) {
23
+      setLoading(true);
24
+      getGuaranteeTask(id).then(res => {
25
+        setLoading(false);
26
+        setDataSource(res);
27
+      }).catch(() => {
28
+        setLoading(false);
29
+      });
30
+    }
31
+  }, [id]);
32
+
15
   return (
33
   return (
16
     <PageContainer>
34
     <PageContainer>
17
       <Card
35
       <Card
18
         style={{ width: '100%' }}
36
         style={{ width: '100%' }}
37
+        loading={loading}
19
         tabList={tabList}
38
         tabList={tabList}
20
         activeTabKey={activeTabKey}
39
         activeTabKey={activeTabKey}
21
         onTabChange={setActiveTabKey}>
40
         onTabChange={setActiveTabKey}>
22
 
41
 
23
         {
42
         {
24
-          activeTabKey === 'item-1' && <BasicForm />
43
+          activeTabKey === 'item-1' && <BasicForm dataSource={dataSource} setDataSource={setDataSource} />
25
         }
44
         }
26
 
45
 
27
         {
46
         {
28
-          activeTabKey === 'item-2' && <DishList />
47
+          activeTabKey === 'item-2' && <DishList dataSource={dataSource} setDataSource={setDataSource} />
29
         }
48
         }
30
 
49
 
31
       </Card>
50
       </Card>

+ 29
- 27
src/pages/package/BasicForm.jsx View File

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
-import { Button, Checkbox, Form, Input } from 'antd';
2
+import { Button, Checkbox, Card, Form, Input } from 'antd';
3
 import { addPackage, updataPackage } from '@/services/api/package';
3
 import { addPackage, updataPackage } from '@/services/api/package';
4
 
4
 
5
 export default (props) => {
5
 export default (props) => {
30
   }, [form, current])
30
   }, [form, current])
31
 
31
 
32
   return (
32
   return (
33
-    <Form
34
-      form={form}
35
-      labelCol={{ span: 6 }}
36
-      wrapperCol={{ span: 16 }}
37
-      onFinish={onFinish}
38
-      autoComplete="off"
39
-    >
40
-      <Form.Item
41
-        label="套餐名称"
42
-        name="name"
43
-        rules={[{ required: true, message: '请输入套餐名称' }]}
33
+    <Card>
34
+      <Form
35
+        form={form}
36
+        labelCol={{ span: 6 }}
37
+        wrapperCol={{ span: 16 }}
38
+        onFinish={onFinish}
39
+        autoComplete="off"
44
       >
40
       >
45
-        <Input placeholder='请输入套餐名称' />
46
-      </Form.Item>
41
+        <Form.Item
42
+          label="套餐名称"
43
+          name="name"
44
+          rules={[{ required: true, message: '请输入套餐名称' }]}
45
+        >
46
+          <Input placeholder='请输入套餐名称' />
47
+        </Form.Item>
47
 
48
 
48
-      <Form.Item
49
-        label="套餐单位"
50
-        name="unit"
51
-      >
52
-        <Input placeholder='请输入套餐单位' />
53
-      </Form.Item>
54
-
55
-      <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
56
-        <Button type="primary" htmlType="submit" loading={loading}>
57
-          提交
58
-        </Button>
59
-      </Form.Item>
60
-    </Form>
49
+        <Form.Item
50
+          label="套餐单位"
51
+          name="unit"
52
+        >
53
+          <Input placeholder='请输入套餐单位' />
54
+        </Form.Item>
55
+
56
+        <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
57
+          <Button type="primary" htmlType="submit" loading={loading}>
58
+            保存
59
+          </Button>
60
+        </Form.Item>
61
+      </Form>
62
+    </Card>
61
   )
63
   )
62
 }
64
 }

+ 1
- 0
src/pages/package/DishList.jsx View File

118
       renderItem={item => (
118
       renderItem={item => (
119
         <List.Item
119
         <List.Item
120
           className={classNames({ active: detail.id === item.id })}
120
           className={classNames({ active: detail.id === item.id })}
121
+          onClick={() => setDetail(item)}
121
           actions={[
122
           actions={[
122
             <Popconfirm
123
             <Popconfirm
123
               key="delete"
124
               key="delete"

+ 1
- 1
src/pages/package/index.jsx View File

19
           </Col>
19
           </Col>
20
           <Col span={8}>
20
           <Col span={8}>
21
             <BasicForm current={current} onChange={it => setCurrent(it)} />
21
             <BasicForm current={current} onChange={it => setCurrent(it)} />
22
-            <div style={{ marginTop: '100px' }}>
22
+            <div style={{ marginTop: '24px' }}>
23
               <DishList current={current} />
23
               <DishList current={current} />
24
             </div>
24
             </div>
25
           </Col>
25
           </Col>

+ 44
- 0
src/services/api/guaranteeTask.js View File

1
+import { request } from '@umijs/max';
2
+
3
+/**
4
+ * 详情
5
+ * @param {*} data
6
+ * @returns
7
+ */
8
+ export const getGuaranteeTask = (id) => request(`/guaranteeTask/${id}`);
9
+
10
+/**
11
+ * 新增
12
+ * @param {*} data
13
+ * @returns
14
+ */
15
+ export const addGuaranteeTask = (data) => request('/guaranteeTask', { method: 'post', data });
16
+
17
+ 
18
+/**
19
+ * 更新
20
+ * @param {*} data
21
+ * @returns
22
+ */
23
+ export const updateGuaranteeTask = (data, id) => request(`/guaranteeTask/${id}`, { method: 'put', data });
24
+
25
+ /**
26
+  * 查询明细
27
+  * @param {*} data
28
+  * @returns
29
+  */
30
+  export const getGuaranteeDetailList = (params) => request('/guaranteeDetail', { params });
31
+
32
+/**
33
+ * 批量新增明细
34
+ * @param {*} data
35
+ * @returns
36
+ */
37
+ export const addGuaranteeDetailBatch = (data, guaranteeId) => request('/guaranteeDetail/batch', { method: 'post', data, params: { guaranteeId } });
38
+ 
39
+/**
40
+ * 删除明细
41
+ * @param {*} data
42
+ * @returns
43
+ */
44
+ export const deleteGuaranteeDetail = id => request(`/guaranteeDetail/${id}`, { method: 'delete' });