lisenzhou 2 years ago
parent
commit
f769008d6b
5 changed files with 159 additions and 149 deletions
  1. 35
    32
      src/pages/guaranteeTask/index.jsx
  2. 121
    114
      src/routes/routes.jsx
  3. 1
    1
      src/services/dish.js
  4. 1
    1
      src/services/guaranteeTask.js
  5. 1
    1
      src/services/package.js

+ 35
- 32
src/pages/guaranteeTask/index.jsx View File

@@ -1,11 +1,14 @@
1
-import { deleteGuaranteeTask, getGuaranteeTaskList } from '@/services/guaranteeTask';
2
-import { queryTable } from '@/utils/request';
3
-import { PageContainer, ProTable } from '@ant-design/pro-components';
4
-import { Link, useNavigate } from 'react-router-dom';
1
+import {
2
+  deleteGuaranteeTask,
3
+  getGuaranteeTaskList,
4
+} from "@/services/guaranteeTask";
5
+import { queryTable } from "@/utils/request";
6
+import { PageContainer, ProTable } from "@ant-design/pro-components";
7
+import { Link, useNavigate } from "react-router-dom";
5 8
 
6
-import { Button, message, Popconfirm } from 'antd';
7
-import moment from 'moment';
8
-import { useRef, useState } from 'react';
9
+import { Button, message, Popconfirm } from "antd";
10
+import moment from "moment";
11
+import { useRef, useState } from "react";
9 12
 
10 13
 const GuaranteeTaskList = (props) => {
11 14
   const navigate = useNavigate();
@@ -18,7 +21,7 @@ const GuaranteeTaskList = (props) => {
18 21
   const handleDelete = (id) => {
19 22
     if (id) {
20 23
       deleteGuaranteeTask(id).then((res) => {
21
-        message.success('删除成功');
24
+        message.success("删除成功");
22 25
         actionRef.current.reload();
23 26
       });
24 27
     }
@@ -31,47 +34,47 @@ const GuaranteeTaskList = (props) => {
31 34
 
32 35
   const columns = [
33 36
     {
34
-      title: '保障序号',
35
-      dataIndex: 'guaranteeNo',
37
+      title: "保障序号",
38
+      dataIndex: "guaranteeNo",
36 39
     },
37 40
     {
38
-      title: '受领人',
39
-      dataIndex: 'receiver',
41
+      title: "受领人",
42
+      dataIndex: "receiver",
40 43
     },
41 44
     {
42
-      title: '时间区间',
43
-      dataIndex: 'dateRange',
44
-      valueType: 'dateRange',
45
+      title: "时间区间",
46
+      dataIndex: "dateRange",
47
+      valueType: "dateRange",
45 48
       search: {
46 49
         transform: (value) => {
47
-          console.log(value, value[0].valueOf(), 'valuevalue');
50
+          console.log(value, value[0].valueOf(), "valuevalue");
48 51
 
49 52
           return {
50
-            startDate: moment(value[0]).format('yyyy-MM-DD'),
51
-            endDate: moment(value[1]).format('yyyy-MM-DD'),
53
+            startDate: moment(value[0]).format("yyyy-MM-DD"),
54
+            endDate: moment(value[1]).format("yyyy-MM-DD"),
52 55
           };
53 56
         },
54 57
       },
55 58
     },
56 59
     {
57
-      title: '保障地点',
58
-      dataIndex: 'address',
60
+      title: "保障地点",
61
+      dataIndex: "address",
59 62
       search: false,
60 63
     },
61 64
     {
62
-      title: '保障人数',
63
-      dataIndex: 'totalPersonNum',
65
+      title: "保障人数",
66
+      dataIndex: "totalPersonNum",
64 67
       search: false,
65 68
     },
66 69
     {
67
-      title: '伙食标准',
68
-      dataIndex: 'standard',
70
+      title: "伙食标准",
71
+      dataIndex: "standard",
69 72
       search: false,
70 73
     },
71 74
 
72 75
     {
73
-      title: '操作',
74
-      valueType: 'option',
76
+      title: "操作",
77
+      valueType: "option",
75 78
       width: 200,
76 79
       render: (_, record) => [
77 80
         <Button
@@ -97,13 +100,13 @@ const GuaranteeTaskList = (props) => {
97 100
             删除
98 101
           </Button>
99 102
         </Popconfirm>,
100
-        <Button
103
+        <a
101 104
           key={4}
102
-          style={{ padding: 0 }}
103
-          type="link"
105
+          href={`${window.location.pathname}#/task/guaranteeTask/print?id=${record.id}`}
106
+          target="_blank"
104 107
         >
105
-          <Link target="_blank" to={`/task/guaranteeTask/print?id=${record.id}`}>打印</Link>
106
-        </Button>,
108
+          执行
109
+        </a>,
107 110
       ],
108 111
     },
109 112
   ];
@@ -125,7 +128,7 @@ const GuaranteeTaskList = (props) => {
125 128
             key="2"
126 129
             type="primary"
127 130
             onClick={() => {
128
-              history.push('/guaranteeTask/edit');
131
+              navigate(`/task/guaranteeTask/edit`);
129 132
             }}
130 133
           >
131 134
             新增

+ 121
- 114
src/routes/routes.jsx View File

@@ -6,34 +6,34 @@ import {
6 6
   MenuFoldOutlined,
7 7
   MenuUnfoldOutlined,
8 8
   PieChartOutlined,
9
-} from '@ant-design/icons';
10
-import { Navigate } from 'react-router-dom';
11
-import AuthLayout from '@/layouts/AuthLayout';
12
-import Container from '@/layouts/Container';
13
-import Login from '@/pages/login';
14
-import Page404 from '@/pages/404';
15
-import Home from '@/pages/sample/home';
16
-import BasicForm from '@/pages/sample/form';
17
-import BasicTable from '@/pages/sample/table';
18
-import GuaranteeTaskList from '@/pages/guaranteeTask';
19
-import GuaranteeTaskEdit from '@/pages/guaranteeTask/Edit';
20
-import GuaranteeTaskPrint from '@/pages/guaranteeTask/print';
21
-import DishList from '@/pages/dish/list';
22
-import DishEdit from '@/pages/dish/edit';
23
-import PackageList from '@/pages/package/List';
24
-import StockList from '@/pages/stock/list';
25
-import StockEdit from '@/pages/stock/edit';
26
-import StockInOut from '@/pages/stock/outAndIn';
27
-import StockLog from '@/pages/stock/stockLog';
28
-import StockClassificationList from '@/pages/stockClassification/list';
29
-import StockClassificationEdit from '@/pages/stockClassification/edit';
30
-import RotationChartList from '@/pages/rotationChart/list';
31
-import RotationChartEdit from '@/pages/rotationChart/edit';
32
-import RotationChartIntroduction from '@/pages/rotationChart/introduction';
33
-import Roles from '@/pages/roles/index';
34
-import RegulationList from '@/regulation';
35
-import UserList from '@/pages/user';
36
-import UserEdit from '@/pages/user/Edit';
9
+} from "@ant-design/icons";
10
+import { Navigate } from "react-router-dom";
11
+import AuthLayout from "@/layouts/AuthLayout";
12
+import Container from "@/layouts/Container";
13
+import Login from "@/pages/login";
14
+import Page404 from "@/pages/404";
15
+import Home from "@/pages/sample/home";
16
+import BasicForm from "@/pages/sample/form";
17
+import BasicTable from "@/pages/sample/table";
18
+import GuaranteeTaskList from "@/pages/guaranteeTask";
19
+import GuaranteeTaskEdit from "@/pages/guaranteeTask/Edit";
20
+import GuaranteeTaskPrint from "@/pages/guaranteeTask/print";
21
+import DishList from "@/pages/dish/list";
22
+import DishEdit from "@/pages/dish/edit";
23
+import PackageList from "@/pages/package";
24
+import StockList from "@/pages/stock/list";
25
+import StockEdit from "@/pages/stock/edit";
26
+import StockInOut from "@/pages/stock/outAndIn";
27
+import StockLog from "@/pages/stock/stockLog";
28
+import StockClassificationList from "@/pages/stockClassification/list";
29
+import StockClassificationEdit from "@/pages/stockClassification/edit";
30
+import RotationChartList from "@/pages/rotationChart/list";
31
+import RotationChartEdit from "@/pages/rotationChart/edit";
32
+import RotationChartIntroduction from "@/pages/rotationChart/introduction";
33
+import Roles from "@/pages/roles/index";
34
+import RegulationList from "@/regulation";
35
+import UserList from "@/pages/user";
36
+import UserEdit from "@/pages/user/Edit";
37 37
 import PurchasePlanList from "@/pages/purchase/plan/list";
38 38
 import PurchasePlanEdit from "@/pages/purchase/plan/edit";
39 39
 import PurchaseBillEdit from "@/pages/purchase/bill/edit";
@@ -42,8 +42,8 @@ import EmergencyPlanList from "@/pages/cms/emergencyPlan/list";
42 42
 import EmergencyPlanEdit from "@/pages/cms/emergencyPlan/edit";
43 43
 import EmergencyPlanDetail from "@/pages/cms/emergencyPlan/detail";
44 44
 import FilesList from "@/pages/cms/files/list";
45
-import MessageList from '@/pages/message';
46
-import MessageDetail from '@/pages/message/detail';
45
+import MessageList from "@/pages/message";
46
+import MessageDetail from "@/pages/message/detail";
47 47
 
48 48
 /**
49 49
  * meta 用来扩展自定义数据数据
@@ -58,151 +58,158 @@ import MessageDetail from '@/pages/message/detail';
58 58
 
59 59
 export const authRoutes = [
60 60
   {
61
-    path: 'task',
61
+    path: "task",
62 62
     element: <Container />,
63 63
     meta: {
64
-      title: '军供任务',
64
+      title: "军供任务",
65 65
       icon: <AppstoreOutlined />,
66 66
     },
67 67
     children: [
68 68
       {
69 69
         index: true,
70
-        element: <Navigate to='guaranteeTask' replace />,
70
+        element: <Navigate to="guaranteeTask" replace />,
71 71
       },
72 72
       {
73
-        path: 'guaranteeTask',
73
+        path: "guaranteeTask",
74 74
         element: <GuaranteeTaskList />,
75 75
         meta: {
76
-          title: '军供通报',
76
+          title: "军供通报",
77 77
         },
78 78
       },
79 79
       {
80
-        path: 'guaranteeTask/edit',
80
+        path: "guaranteeTask/edit",
81 81
         element: <GuaranteeTaskEdit />,
82 82
         meta: {
83
-          title: '任务配置',
83
+          title: "任务配置",
84 84
         },
85 85
       },
86 86
       {
87
-        path: 'guaranteeTask/print',
87
+        path: "guaranteeTask/print",
88 88
         element: <GuaranteeTaskPrint />,
89 89
         meta: {
90 90
           hideInMenu: true,
91 91
           noLayout: true,
92
-          target: '_blank',
93
-          title: '任务执行',
92
+          target: "_blank",
93
+          title: "任务执行",
94 94
         },
95
-      }
96
-    ]
95
+      },
96
+      {
97
+        path: "guaranteeTask/print",
98
+        element: <GuaranteeTaskPrint />,
99
+        meta: {
100
+          title: "任务评价",
101
+        },
102
+      },
103
+    ],
97 104
   },
98 105
   {
99
-    path: 'material',
106
+    path: "material",
100 107
     element: <Container />,
101 108
     meta: {
102
-      title: '物资管理',
109
+      title: "物资管理",
103 110
       icon: <AppstoreOutlined />,
104 111
     },
105 112
     children: [
106 113
       {
107 114
         index: true,
108
-        element: <Navigate to='dish/list' replace />,
115
+        element: <Navigate to="dish/list" replace />,
109 116
       },
110 117
       {
111
-        path: 'dish/list',
118
+        path: "dish/list",
112 119
         element: <DishList />,
113 120
         meta: {
114
-          title: '菜肴管理',
121
+          title: "菜肴管理",
115 122
         },
116 123
       },
117 124
       {
118
-        path: 'dish/edit',
125
+        path: "dish/edit",
119 126
         element: <DishEdit />,
120 127
         meta: {
121 128
           hideInMenu: true,
122
-          title: '菜肴维护',
129
+          title: "菜肴维护",
123 130
         },
124 131
       },
125 132
       {
126
-        path: 'package/list',
133
+        path: "package/list",
127 134
         element: <PackageList />,
128 135
         meta: {
129
-          title: '套餐管理',
136
+          title: "套餐管理",
130 137
         },
131 138
       },
132
-    ]
139
+    ],
133 140
   },
134 141
   {
135
-    path: 'stock',
142
+    path: "stock",
136 143
     element: <Container />,
137 144
     meta: {
138
-      title: '库存管理',
145
+      title: "库存管理",
139 146
       icon: <AppstoreOutlined />,
140 147
     },
141 148
     children: [
142 149
       {
143 150
         index: true,
144
-        element: <Navigate to='list' replace />,
151
+        element: <Navigate to="list" replace />,
145 152
       },
146 153
       {
147
-        path: 'list',
154
+        path: "list",
148 155
         element: <StockList />,
149 156
         meta: {
150
-          title: '库存列表',
157
+          title: "库存列表",
151 158
         },
152 159
       },
153 160
       {
154
-        path: 'add',
161
+        path: "add",
155 162
         element: <StockEdit />,
156 163
         meta: {
157
-          title: '库存维护',
164
+          title: "库存维护",
158 165
         },
159 166
       },
160 167
     ],
161 168
   },
162 169
   {
163
-    path: 'cms',
170
+    path: "cms",
164 171
     element: <Container />,
165 172
     meta: {
166
-      title: '公告文件',
173
+      title: "公告文件",
167 174
     },
168 175
     children: [
169 176
       {
170 177
         index: true,
171
-        element: <Navigate to='rotationChart/list' replace />,
178
+        element: <Navigate to="rotationChart/list" replace />,
172 179
       },
173 180
       {
174
-        path: 'station',
181
+        path: "station",
175 182
         element: null,
176 183
         meta: {
177
-          title: '本站信息',
184
+          title: "本站信息",
178 185
         },
179 186
       },
180 187
       {
181
-        path: 'rotationChart/list',
188
+        path: "rotationChart/list",
182 189
         element: <RotationChartList />,
183 190
         meta: {
184
-          title: '公告内容',
191
+          title: "公告内容",
185 192
         },
186 193
       },
187 194
       {
188
-        path: 'rotationChart/add',
195
+        path: "rotationChart/add",
189 196
         element: <RotationChartEdit />,
190 197
         meta: {
191
-          title: '公告维护',
198
+          title: "公告维护",
192 199
         },
193 200
       },
194 201
       {
195
-        path: 'rotationChart/introduction',
202
+        path: "rotationChart/introduction",
196 203
         element: <RotationChartIntroduction />,
197 204
         meta: {
198
-          title: '本站信息简介',
205
+          title: "本站信息简介",
199 206
         },
200 207
       },
201 208
       {
202
-        path: 'regulation',
209
+        path: "regulation",
203 210
         element: null,
204 211
         meta: {
205
-          title: '规章制度',
212
+          title: "规章制度",
206 213
         },
207 214
       },
208 215
       {
@@ -236,86 +243,85 @@ export const authRoutes = [
236 243
           title: "文件管理",
237 244
         },
238 245
       },
239
-     
240 246
     ],
241 247
   },
242 248
   {
243
-    path: 'static',
249
+    path: "static",
244 250
     element: <Container />,
245 251
     meta: {
246
-      title: '数据分析',
252
+      title: "数据分析",
247 253
     },
248 254
   },
249 255
   {
250
-    path: 'system',
256
+    path: "system",
251 257
     element: <Container />,
252 258
     meta: {
253
-      title: '系统管理',
259
+      title: "系统管理",
254 260
     },
255 261
     children: [
256 262
       {
257 263
         index: true,
258
-        element: <Navigate to='stockClassification/list' replace />,
264
+        element: <Navigate to="stockClassification/list" replace />,
259 265
       },
260 266
       {
261
-        path: 'stockClassification/list',
267
+        path: "stockClassification/list",
262 268
         element: <StockClassificationList />,
263 269
         meta: {
264
-          title: '库存分类',
270
+          title: "库存分类",
265 271
         },
266 272
       },
267 273
       {
268
-        path: 'stockClassification/edit',
274
+        path: "stockClassification/edit",
269 275
         element: <StockClassificationEdit />,
270 276
         meta: {
271
-          title: '库存分类维护',
277
+          title: "库存分类维护",
272 278
           hideInMenu: true,
273 279
         },
274 280
       },
275 281
       {
276
-        path: 'log',
282
+        path: "log",
277 283
         element: <StockLog />,
278 284
         meta: {
279
-          title: '操作日志',
285
+          title: "操作日志",
280 286
         },
281 287
       },
282 288
       {
283
-        path: 'roles',
289
+        path: "roles",
284 290
         element: <Roles />,
285 291
         meta: {
286
-          title: '角色管理',
292
+          title: "角色管理",
287 293
         },
288 294
       },
289 295
       {
290
-        path: 'user',
296
+        path: "user",
291 297
         element: <UserList />,
292 298
         meta: {
293
-          title: '用户管理',
299
+          title: "用户管理",
294 300
         },
295 301
       },
296 302
       {
297
-        path: 'user/edit',
303
+        path: "user/edit",
298 304
         element: <UserEdit />,
299 305
         meta: {
300 306
           hideInMenu: true,
301
-          title: '系统用户编辑',
307
+          title: "系统用户编辑",
302 308
         },
303 309
       },
304 310
       {
305
-        path: 'message',
311
+        path: "message",
306 312
         element: <MessageList />,
307 313
         meta: {
308
-          title: '消息列表',
314
+          title: "消息列表",
309 315
         },
310 316
       },
311 317
       {
312
-        path: 'message/detail',
318
+        path: "message/detail",
313 319
         element: <MessageDetail />,
314 320
         meta: {
315
-          title: '消息详情',
321
+          title: "消息详情",
316 322
           hideInMenu: true,
317 323
         },
318
-      }
324
+      },
319 325
     ],
320 326
   },
321 327
   {
@@ -368,7 +374,7 @@ export const authRoutes = [
368 374
       },
369 375
       {
370 376
         path: "inStore/edit",
371
-        element: <PurchaseInStoreEdit  />,
377
+        element: <PurchaseInStoreEdit />,
372 378
         meta: {
373 379
           title: "采购入库维护",
374 380
           hideInMenu: true,
@@ -376,11 +382,11 @@ export const authRoutes = [
376 382
       },
377 383
     ],
378 384
   },
379
-]
385
+];
380 386
 
381 387
 export const defaultRoutes = [
382 388
   {
383
-    path: '/',
389
+    path: "/",
384 390
     element: <AuthLayout />,
385 391
     children: [
386 392
       {
@@ -388,30 +394,30 @@ export const defaultRoutes = [
388 394
         element: <Home />,
389 395
       },
390 396
       {
391
-        path: 'home',
397
+        path: "home",
392 398
         element: <Home />,
393 399
         meta: {
394
-          title: '首页',
400
+          title: "首页",
395 401
           icon: <DesktopOutlined />,
396 402
         },
397 403
       },
398 404
       {
399
-        path: '*',
400
-        element: <Page404 />
401
-      }
405
+        path: "*",
406
+        element: <Page404 />,
407
+      },
402 408
     ],
403 409
   },
404 410
   {
405
-    path: '/login',
411
+    path: "/login",
406 412
     element: <Login />,
407 413
   },
408 414
   {
409
-    path: '*',
410
-    element: <Page404 />
411
-  }
415
+    path: "*",
416
+    element: <Page404 />,
417
+  },
412 418
 ];
413 419
 
414
-export function mergeAuthRoutes (r1, r2) {
420
+export function mergeAuthRoutes(r1, r2) {
415 421
   const r = r1.slice();
416 422
   const children = r1[0].children.slice();
417 423
   r[0].children = children.concat(r2);
@@ -421,21 +427,22 @@ export function mergeAuthRoutes (r1, r2) {
421 427
 // 全部路由
422 428
 export const routes = mergeAuthRoutes(defaultRoutes, authRoutes);
423 429
 
424
-function getPath(parent = '/', current = '') {
425
-  if (current.indexOf('/') === 0 || current.indexOf('http') === 0) return current;
426
-  return `${parent}/${current}`.replace(/\/\//g, '/');
430
+function getPath(parent = "/", current = "") {
431
+  if (current.indexOf("/") === 0 || current.indexOf("http") === 0)
432
+    return current;
433
+  return `${parent}/${current}`.replace(/\/\//g, "/");
427 434
 }
428 435
 
429 436
 // 路由数组, 一维数组
430 437
 export const routeArr = (() => {
431
-  const flatten = (routes, parentPath = '/') => {
438
+  const flatten = (routes, parentPath = "/") => {
432 439
     return routes.reduce((acc, route) => {
433 440
       const path = getPath(parentPath, route.path);
434 441
       const children = route.children ? flatten(route.children, path) : [];
435
-      
442
+
436 443
       return acc.concat([{ ...route, path }].concat(children));
437 444
     }, []);
438
-  }
445
+  };
439 446
 
440 447
   return flatten(routes);
441 448
 })();

+ 1
- 1
src/services/dish.js View File

@@ -5,7 +5,7 @@ import request from '@/utils/request';
5 5
  * @param {*} params
6 6
  * @returns
7 7
  */
8
-export const getDishList = (params) => request('/dishes', { params });
8
+export const getDishList = (params) => request('/dishes', { params,successTip:false });
9 9
 
10 10
 /**
11 11
  * 查询食材列表

+ 1
- 1
src/services/guaranteeTask.js View File

@@ -50,7 +50,7 @@ import request from '@/utils/request';
50 50
  * @param {*} params
51 51
  * @returns
52 52
  */
53
-export const getGuaranteeTaskList = (params) => request('/guaranteeTask', { params });
53
+export const getGuaranteeTaskList = (params) => request('/guaranteeTask', { params,successTip:false });
54 54
 
55 55
 /**
56 56
  * 删除

+ 1
- 1
src/services/package.js View File

@@ -5,7 +5,7 @@ import request from '@/utils/request';
5 5
  * @param {*} params
6 6
  * @returns
7 7
  */
8
-export const getPackageList = (params) => request('/package', { params });
8
+export const getPackageList = (params) => request('/package', { params,successTip:false });
9 9
 
10 10
 
11 11
 /**