Yansen 2 anni fa
parent
commit
57f785614e

+ 2
- 2
index.html Vedi File

@@ -2,9 +2,9 @@
2 2
 <html lang="en">
3 3
   <head>
4 4
     <meta charset="UTF-8" />
5
-    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
5
+    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
6 6
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
-    <title>Vite + React</title>
7
+    <title>海安军供保障信息管理系统</title>
8 8
   </head>
9 9
   <body>
10 10
     <div id="root"></div>

BIN
public/favicon.ico Vedi File


+ 0
- 1
public/vite.svg Vedi File

@@ -1 +0,0 @@
1
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

+ 4
- 0
src/components/Money/float.js Vedi File

@@ -0,0 +1,4 @@
1
+const epsilonN = N => num => Math.round( num * N + Number.EPSILON ) / N;
2
+const epsilon2 = epsilonN(1e2);
3
+
4
+export default epsilon2;

+ 30
- 0
src/components/Money/index.jsx Vedi File

@@ -0,0 +1,30 @@
1
+import { InputNumber } from "antd"
2
+import { useEffect, useState } from "react"
3
+import epsilon2 from './float'
4
+
5
+export default (props) => {
6
+
7
+  const { value, onChange, ...leftProps } = props
8
+
9
+  const [money, setMoney] = useState(0)
10
+
11
+  useEffect(() => {
12
+    setMoney(epsilon2(value / 100))
13
+  }, [value])
14
+
15
+  const handleChange = (val) => {
16
+    onChange(epsilon2(val * 100))
17
+  }
18
+
19
+  return (
20
+    <InputNumber
21
+      min='0'
22
+      {...leftProps}
23
+      value={money}
24
+      onChange={handleChange}
25
+      precision={2}
26
+      formatter={value => `¥ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
27
+      parser={value => value.replace(/\¥\s?|(,*)/g, '')}
28
+    />
29
+  )
30
+}

+ 4
- 2
src/layouts/AuthLayout/components/Footer.jsx Vedi File

@@ -1,12 +1,14 @@
1 1
 import React from 'react';
2 2
 import { Layout, Spin } from 'antd';
3
+import { useModel } from '@/store';
3 4
 
4 5
 const { Footer } = Layout;
5
-
6 6
 const year = new Date().getFullYear();
7
+
7 8
 export default (props) => {
8 9
 
9
-  const copyRight = `南京云致 @${year}`
10
+  const { app } = useModel('system');
11
+  const copyRight = `${app.company} @ ${year}`
10 12
 
11 13
   return (
12 14
     <Footer style={{ textAlign: 'center' }}>{copyRight}</Footer>

+ 14
- 1
src/layouts/AuthLayout/components/Header/SplitMenu.jsx Vedi File

@@ -1,12 +1,25 @@
1 1
 import React from 'react';
2 2
 import { Menu } from 'antd';
3
+import { Link } from 'react-router-dom';
3 4
 
4 5
 export default (props) => {
5 6
   const { items, location } = props;
6 7
 
8
+  const menus = React.useMemo(() => {
9
+    const homeIndex = {
10
+      key: '/',
11
+      label: <Link to='/'>首页</Link>,
12
+      title: '首页',
13
+    }
14
+
15
+    return [homeIndex].concat(items);
16
+    return items;
17
+  }, [items]);
7 18
   const selectedKeys = React.useMemo(() => `/${location.pathname.split('/')[1]}`, [location.pathname]);
8 19
 
20
+  console.log(menus, items)
21
+
9 22
   return (
10
-    <Menu className='split-menu' mode="horizontal" items={items} selectedKeys={selectedKeys} />
23
+    <Menu className='split-menu' mode="horizontal" items={menus} selectedKeys={selectedKeys} />
11 24
   )
12 25
 }

+ 2
- 1
src/layouts/AuthLayout/style.less Vedi File

@@ -10,7 +10,8 @@
10 10
 
11 11
   .split-menu {
12 12
     flex: 0;
13
-    max-width: 1000px;
13
+    min-width: 900px;
14
+    // max-width: 1000px;
14 15
     background: transparent;
15 16
     font-size: 20px;
16 17
     color: #fff;

+ 0
- 1
src/pages/cms/emergencyPlan/list/index.jsx Vedi File

@@ -4,7 +4,6 @@ import { PageContainer, ProTable } from "@ant-design/pro-components";
4 4
 import { useNavigate } from "react-router-dom";
5 5
 import { Button, message, Popconfirm } from "antd";
6 6
 import { useRef, useState, useEffect } from "react";
7
-import { floatMultiply, floatDivide } from "@/utils";
8 7
 
9 8
 const regex = /(<([^>]+)>)/gi;
10 9
 

+ 0
- 1
src/pages/cms/files/list/index.jsx Vedi File

@@ -4,7 +4,6 @@ import { PageContainer, ProTable, ProList } from "@ant-design/pro-components";
4 4
 import { useNavigate } from "react-router-dom";
5 5
 import { Button, message, Popconfirm } from "antd";
6 6
 import { useRef, useState, useEffect } from "react";
7
-import { floatMultiply, floatDivide } from "@/utils";
8 7
 import AddFiles from "./addFiles";
9 8
 
10 9
 const FilesList = (props) => {

+ 10
- 3
src/pages/dish/edit/index.jsx Vedi File

@@ -1,9 +1,10 @@
1 1
 import { addDish, getDishById } from '@/services/dish';
2 2
 import { getStoreList } from '@/services/stock';
3
-import { PageContainer, ProForm, ProFormSelect, ProFormText } from '@ant-design/pro-components';
3
+import { PageContainer, ProForm, ProFormSelect, ProFormText, ProFormMoney } from '@ant-design/pro-components';
4 4
 import { useNavigate, useSearchParams } from 'react-router-dom';
5 5
 import { Card, Col, message, Row, Space } from 'antd';
6 6
 import { useEffect, useRef, useState } from 'react';
7
+import { floatMultiply, floatDivide } from "@/utils/float";
7 8
 
8 9
 export default (props) => {
9 10
   const [searchParams] = useSearchParams();
@@ -26,7 +27,7 @@ export default (props) => {
26 27
   useEffect(() => {
27 28
     if (id) {
28 29
       getDishById(id).then((res) => {
29
-        formRef.current.setFieldsValue(res);
30
+        formRef.current.setFieldsValue({ ...res, price: floatDivide(res.price, 100) });
30 31
       });
31 32
     }
32 33
   }, [id]);
@@ -34,7 +35,7 @@ export default (props) => {
34 35
   const onFinish = async (values) => {
35 36
     console.log(values, '===');
36 37
 
37
-    addDish({ ...values, id }).then((res) => {
38
+    addDish({ ...values, price: floatMultiply(values.price, 100), id }).then((res) => {
38 39
       message.success('添加成功');
39 40
       navigate(-1);
40 41
     });
@@ -82,6 +83,12 @@ export default (props) => {
82 83
             rules={[{ required: true, message: '请输入菜肴单位' }]}
83 84
             width={460}
84 85
           />
86
+          <ProFormMoney
87
+            name="price"
88
+            label="价格"
89
+            rules={[{ required: true, message: '请输入菜肴价格' }]}
90
+            width={460}
91
+          />
85 92
           <ProFormSelect
86 93
             mode="multiple"
87 94
             name="ingredientsIdList"

+ 2
- 2
src/pages/dish/list/index.jsx Vedi File

@@ -57,7 +57,7 @@ const DishList = (props) => {
57 57
           style={{ padding: 0 }}
58 58
           type="link"
59 59
           onClick={() => {
60
-            navigate(`/material/dish/edit?id=${record.id}`);
60
+            navigate(`/stock/dish/edit?id=${record.id}`);
61 61
           }}
62 62
         >
63 63
           修改
@@ -90,7 +90,7 @@ const DishList = (props) => {
90 90
             key="2"
91 91
             type="primary"
92 92
             onClick={() => {
93
-              navigate('/material/dish/edit');
93
+              navigate('/stock/dish/edit');
94 94
             }}
95 95
           >
96 96
             新增

+ 9
- 0
src/pages/package/BasicForm.jsx Vedi File

@@ -1,6 +1,7 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Button, Checkbox, Card, Form, Input, notification } from 'antd';
3 3
 import { addPackage, updataPackage } from '@/services/package';
4
+import Money from '@/components/Money';
4 5
 
5 6
 export default (props) => {
6 7
   const { current, onChange } = props;
@@ -27,6 +28,7 @@ export default (props) => {
27 28
     form.setFieldsValue({
28 29
       name: current.name,
29 30
       unit: current.unit,
31
+      price: current.price,
30 32
     });
31 33
   }, [form, current])
32 34
 
@@ -54,6 +56,13 @@ export default (props) => {
54 56
           <Input placeholder='请输入套餐单位' />
55 57
         </Form.Item>
56 58
 
59
+        <Form.Item
60
+          label="价格"
61
+          name="price"
62
+        >
63
+          <Money style={{ width: '100%' }} />
64
+        </Form.Item>
65
+
57 66
         <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
58 67
           <Button type="primary" htmlType="submit" loading={loading}>
59 68
             保存

+ 1
- 1
src/pages/purchase/bill/edit/index.jsx Vedi File

@@ -15,7 +15,7 @@ import { useNavigate, useSearchParams } from "react-router-dom";
15 15
 import { Card, Col, message, Row, Space, Form, Button } from "antd";
16 16
 import { useEffect, useRef, useState } from "react";
17 17
 import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
18
-import { floatMultiply, floatDivide } from "@/utils";
18
+import { floatMultiply, floatDivide } from "@/utils/float";
19 19
 
20 20
 export default (props) => {
21 21
   const [searchParams] = useSearchParams();

+ 1
- 1
src/pages/purchase/inStore/edit/index.jsx Vedi File

@@ -14,7 +14,7 @@ import { useNavigate, useSearchParams } from "react-router-dom";
14 14
 import { Card, Col, message, Row, Space, Form, Button } from "antd";
15 15
 import { useEffect, useRef, useState } from "react";
16 16
 import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
17
-import { floatMultiply, floatDivide } from "@/utils";
17
+import { floatMultiply, floatDivide } from "@/utils/float";
18 18
 
19 19
 export default (props) => {
20 20
   const [searchParams] = useSearchParams();

+ 1
- 1
src/pages/purchase/plan/edit/index.jsx Vedi File

@@ -15,7 +15,7 @@ import { useNavigate, useSearchParams } from "react-router-dom";
15 15
 import { Card, Col, message, Row, Space, Form, Button } from "antd";
16 16
 import { useEffect, useRef, useState } from "react";
17 17
 import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
18
-import { floatMultiply, floatDivide } from "@/utils";
18
+import { floatMultiply, floatDivide } from "@/utils/float";
19 19
 
20 20
 export default (props) => {
21 21
   const [searchParams] = useSearchParams();

+ 1
- 1
src/pages/purchase/plan/list/index.jsx Vedi File

@@ -10,7 +10,7 @@ import { PageContainer, ProTable } from "@ant-design/pro-components";
10 10
 import { useNavigate } from "react-router-dom";
11 11
 import { Button, message, Popconfirm } from "antd";
12 12
 import { useRef, useState, useEffect } from "react";
13
-import { floatMultiply, floatDivide } from "@/utils";
13
+import { floatMultiply, floatDivide } from "@/utils/float";
14 14
 
15 15
 // type plan 采购计划  bill 采购账单  inStore  采购入库
16 16
 const StockList = (props) => {

+ 1
- 1
src/pages/user/Edit.jsx Vedi File

@@ -80,7 +80,7 @@ export default (props) => {
80 80
 
81 81
   return (
82 82
     <Card loading={loading}>
83
-      <Form onFinish={onFinish} form={form} {...formItemLayout} scrollToFirstError>
83
+      <Form onFinish={onFinish} form={form} {...formItemLayout} scrollToFirstError style={{ maxWidth: '1000px' }}>
84 84
         <Form.Item
85 85
           name="name"
86 86
           label="姓名"

+ 59
- 75
src/routes/routes.jsx Vedi File

@@ -22,7 +22,7 @@ import GuaranteeTaskEvaluate from "@/pages/evaluate";
22 22
 import GuaranteeTaskEvaluateList from "@/pages/evaluate/evaluateList";
23 23
 import DishList from '@/pages/dish/list';
24 24
 import DishEdit from '@/pages/dish/edit';
25
-import PackageList from '@/pages/package/List';
25
+import PackageList from '@/pages/package';
26 26
 import StockList from '@/pages/stock/list';
27 27
 import StockEdit from '@/pages/stock/edit';
28 28
 import StockInOut from '@/pages/stock/outAndIn';
@@ -68,7 +68,6 @@ export const authRoutes = [
68 68
     element: <Container />,
69 69
     meta: {
70 70
       title: "军供任务",
71
-      icon: <AppstoreOutlined />,
72 71
     },
73 72
     children: [
74 73
       {
@@ -117,11 +116,10 @@ export const authRoutes = [
117 116
     ],
118 117
   },
119 118
   {
120
-    path: "material",
119
+    path: "stock",
121 120
     element: <Container />,
122 121
     meta: {
123
-      title: "物资管理",
124
-      icon: <AppstoreOutlined />,
122
+      title: "库存物资",
125 123
     },
126 124
     children: [
127 125
       {
@@ -150,20 +148,6 @@ export const authRoutes = [
150 148
           title: "套餐管理",
151 149
         },
152 150
       },
153
-    ],
154
-  },
155
-  {
156
-    path: "stock",
157
-    element: <Container />,
158
-    meta: {
159
-      title: "库存管理",
160
-      icon: <AppstoreOutlined />,
161
-    },
162
-    children: [
163
-      {
164
-        index: true,
165
-        element: <Navigate to="list" replace />,
166
-      },
167 151
       {
168 152
         path: "list",
169 153
         element: <StockList />,
@@ -285,130 +269,130 @@ export const authRoutes = [
285 269
     },
286 270
   },
287 271
   {
288
-    path: "system",
272
+    path: "purchase",
289 273
     element: <Container />,
290 274
     meta: {
291
-      title: "系统管理",
275
+      title: "采购管理",
292 276
     },
293 277
     children: [
294 278
       {
295 279
         index: true,
296
-        element: <Navigate to="stockClassification/list" replace />,
280
+        element: <Navigate to="plan/list" replace />,
297 281
       },
298 282
       {
299
-        path: "stockClassification/list",
300
-        element: <StockClassificationList />,
283
+        path: "plan/list",
284
+        element: <PurchasePlanList type="plan" />,
301 285
         meta: {
302
-          title: "库存分类",
286
+          title: "采购计划",
303 287
         },
304 288
       },
305 289
       {
306
-        path: "stockClassification/edit",
307
-        element: <StockClassificationEdit />,
290
+        path: "plan/edit",
291
+        element: <PurchasePlanEdit />,
308 292
         meta: {
309
-          title: "库存分类维护",
293
+          title: "采购计划维护",
310 294
           hideInMenu: true,
311 295
         },
312 296
       },
313 297
       {
314
-        path: "log",
315
-        element: <StockLog />,
316
-        meta: {
317
-          title: "操作日志",
318
-        },
319
-      },
320
-      {
321
-        path: "roles",
322
-        element: <Roles />,
323
-        meta: {
324
-          title: "角色管理",
325
-        },
326
-      },
327
-      {
328
-        path: "user",
329
-        element: <UserList />,
298
+        path: "bill/list",
299
+        element: <PurchasePlanList type="bill" />,
330 300
         meta: {
331
-          title: "用户管理",
301
+          title: "采购账单",
332 302
         },
333 303
       },
334 304
       {
335
-        path: "user/edit",
336
-        element: <UserEdit />,
305
+        path: "bill/edit",
306
+        element: <PurchaseBillEdit />,
337 307
         meta: {
308
+          title: "采购账单维护",
338 309
           hideInMenu: true,
339
-          title: "系统用户编辑",
340 310
         },
341 311
       },
342 312
       {
343
-        path: "message",
344
-        element: <MessageList />,
313
+        path: "inStore/list",
314
+        element: <PurchasePlanList type="inStore" />,
345 315
         meta: {
346
-          title: "消息列表",
316
+          title: "采购入库",
347 317
         },
348 318
       },
349 319
       {
350
-        path: "message/detail",
351
-        element: <MessageDetail />,
320
+        path: "inStore/edit",
321
+        element: <PurchaseInStoreEdit />,
352 322
         meta: {
353
-          title: "消息详情",
323
+          title: "采购入库维护",
354 324
           hideInMenu: true,
355 325
         },
356 326
       },
357 327
     ],
358 328
   },
359 329
   {
360
-    path: "purchase",
330
+    path: "system",
361 331
     element: <Container />,
362 332
     meta: {
363
-      title: "采购管理",
333
+      title: "系统管理",
364 334
     },
365 335
     children: [
366 336
       {
367 337
         index: true,
368
-        element: <Navigate to="plan/list" replace />,
338
+        element: <Navigate to="stockClassification/list" replace />,
369 339
       },
370 340
       {
371
-        path: "plan/list",
372
-        element: <PurchasePlanList type="plan" />,
341
+        path: "stockClassification/list",
342
+        element: <StockClassificationList />,
373 343
         meta: {
374
-          title: "采购计划",
344
+          title: "库存分类",
375 345
         },
376 346
       },
377 347
       {
378
-        path: "plan/edit",
379
-        element: <PurchasePlanEdit />,
348
+        path: "stockClassification/edit",
349
+        element: <StockClassificationEdit />,
380 350
         meta: {
381
-          title: "采购计划维护",
351
+          title: "库存分类维护",
382 352
           hideInMenu: true,
383 353
         },
384 354
       },
385 355
       {
386
-        path: "bill/list",
387
-        element: <PurchasePlanList type="bill" />,
356
+        path: "log",
357
+        element: <StockLog />,
388 358
         meta: {
389
-          title: "采购账单",
359
+          title: "操作日志",
390 360
         },
391 361
       },
392 362
       {
393
-        path: "bill/edit",
394
-        element: <PurchaseBillEdit />,
363
+        path: "roles",
364
+        element: <Roles />,
365
+        meta: {
366
+          title: "角色管理",
367
+        },
368
+      },
369
+      {
370
+        path: "user",
371
+        element: <UserList />,
372
+        meta: {
373
+          title: "用户管理",
374
+        },
375
+      },
376
+      {
377
+        path: "user/edit",
378
+        element: <UserEdit />,
395 379
         meta: {
396
-          title: "采购账单维护",
397 380
           hideInMenu: true,
381
+          title: "系统用户编辑",
398 382
         },
399 383
       },
400 384
       {
401
-        path: "inStore/list",
402
-        element: <PurchasePlanList type="inStore" />,
385
+        path: "message",
386
+        element: <MessageList />,
403 387
         meta: {
404
-          title: "采购入库",
388
+          title: "消息列表",
405 389
         },
406 390
       },
407 391
       {
408
-        path: "inStore/edit",
409
-        element: <PurchaseInStoreEdit />,
392
+        path: "message/detail",
393
+        element: <MessageDetail />,
410 394
         meta: {
411
-          title: "采购入库维护",
395
+          title: "消息详情",
412 396
           hideInMenu: true,
413 397
         },
414 398
       },

+ 3
- 3
src/store/models/system.js Vedi File

@@ -6,9 +6,9 @@ export default function useSystem() {
6 6
 
7 7
   // 其他配置
8 8
   const [app, setApp] = useState({
9
-    fullName: '云致科技信息管理系统',
10
-    shorName: '云致科技',
11
-    company: '云致科技'
9
+    fullName: '海安军供保障信息管理系统',
10
+    shorName: '海安军供',
11
+    company: '南京云致'
12 12
   });
13 13
 
14 14
   return {

src/utils/index.jsx → src/utils/float.js Vedi File


+ 1
- 1
vite.config.js Vedi File

@@ -9,7 +9,7 @@ export default defineConfig({
9 9
     proxy: {
10 10
       '/api/': {
11 11
         // 要代理的地址
12
-        target: 'http://192.168.89.76:8087',
12
+        target: 'http://127.0.0.1:8087',
13 13
         // 配置了这个可以从 http 代理到 https
14 14
         // 依赖 origin 的功能可能需要这个,比如 cookie
15 15
         changeOrigin: true,