fangmingyue 2 年前
父节点
当前提交
c0035cca54
共有 79 个文件被更改,包括 1080 次插入910 次删除
  1. 3
    2
      index.html
  2. 6
    0
      public/config.js
  3. 二进制
      public/favicon.ico
  4. 0
    1
      public/vite.svg
  5. 二进制
      src/assets/avatar.png
  6. 4
    0
      src/components/Money/float.js
  7. 30
    0
      src/components/Money/index.jsx
  8. 4
    13
      src/components/Wangeditor/index.jsx
  9. 2
    2
      src/components/evaluateItem/index.jsx
  10. 1
    1
      src/components/page/style.less
  11. 17
    1
      src/index.less
  12. 5
    15
      src/layouts/AuthLayout/components/Container.jsx
  13. 5
    3
      src/layouts/AuthLayout/components/Footer.jsx
  14. 3
    1
      src/layouts/AuthLayout/components/Header/Exit.jsx
  15. 12
    1
      src/layouts/AuthLayout/components/Header/SplitMenu.jsx
  16. 16
    6
      src/layouts/AuthLayout/components/Header/User.jsx
  17. 2
    2
      src/layouts/AuthLayout/components/Header/index.jsx
  18. 1
    1
      src/layouts/AuthLayout/components/SiderBar.jsx
  19. 3
    3
      src/layouts/AuthLayout/index.jsx
  20. 3
    1
      src/layouts/AuthLayout/style.less
  21. 4
    3
      src/layouts/Container.jsx
  22. 1
    1
      src/pages/cms/emergencyPlan/detail/index.jsx
  23. 1
    9
      src/pages/cms/emergencyPlan/edit/index.jsx
  24. 1
    1
      src/pages/cms/emergencyPlan/list/index.jsx
  25. 1
    1
      src/pages/cms/files/list/addFiles.jsx
  26. 2
    3
      src/pages/cms/files/list/index.jsx
  27. 22
    4
      src/pages/dish/edit/index.jsx
  28. 4
    4
      src/pages/dish/list/index.jsx
  29. 9
    7
      src/pages/evaluate/evaluateList/index.jsx
  30. 1
    1
      src/pages/evaluate/index.jsx
  31. 3
    3
      src/pages/guaranteeTask/Edit/BasicForm.jsx
  32. 1
    1
      src/pages/guaranteeTask/Edit/DishList.jsx
  33. 1
    1
      src/pages/guaranteeTask/index.jsx
  34. 10
    1
      src/pages/package/BasicForm.jsx
  35. 1
    1
      src/pages/purchase/bill/edit/index.jsx
  36. 1
    1
      src/pages/purchase/inStore/edit/index.jsx
  37. 1
    1
      src/pages/purchase/plan/edit/index.jsx
  38. 4
    2
      src/pages/purchase/plan/list/index.jsx
  39. 3
    3
      src/pages/roles/list.jsx
  40. 37
    0
      src/pages/rotationChart/detail/index.jsx
  41. 48
    27
      src/pages/rotationChart/edit/index.jsx
  42. 2
    1
      src/pages/rotationChart/introduction/edit/index.jsx
  43. 93
    0
      src/pages/rotationChart/introduction/index.jsx
  44. 14
    3
      src/pages/rotationChart/list/index.jsx
  45. 0
    191
      src/pages/sample/home/components/AreaChart.jsx
  46. 0
    44
      src/pages/sample/home/components/Banner.jsx
  47. 0
    37
      src/pages/sample/home/components/BarChart.jsx
  48. 0
    112
      src/pages/sample/home/components/PictorialBar.jsx
  49. 0
    48
      src/pages/sample/home/components/PieChart.jsx
  50. 0
    48
      src/pages/sample/home/components/RadarChart.jsx
  51. 52
    0
      src/pages/sample/home/components/VideoPlay.jsx
  52. 110
    36
      src/pages/sample/home/index.jsx
  53. 4
    3
      src/pages/statis/charts.jsx
  54. 18
    11
      src/pages/statis/components/Age.jsx
  55. 19
    11
      src/pages/statis/components/DeviceType.jsx
  56. 10
    1
      src/pages/statis/components/Edu.jsx
  57. 41
    17
      src/pages/statis/components/Filter.jsx
  58. 67
    36
      src/pages/statis/components/StoreCost.jsx
  59. 99
    0
      src/pages/statis/components/StoreType.jsx
  60. 15
    13
      src/pages/statis/components/Task.jsx
  61. 1
    1
      src/pages/statis/components/style.global.less
  62. 11
    2
      src/pages/stock/edit/index.jsx
  63. 1
    1
      src/pages/stock/list/index.jsx
  64. 2
    2
      src/pages/stockClassification/edit/index.jsx
  65. 10
    5
      src/pages/stockClassification/list/index.jsx
  66. 10
    12
      src/pages/user/Edit.jsx
  67. 1
    1
      src/regulation/edit/index.jsx
  68. 1
    1
      src/regulation/index.jsx
  69. 4
    1
      src/routes/menus.jsx
  70. 175
    127
      src/routes/routes.jsx
  71. 1
    1
      src/services/dish.js
  72. 2
    2
      src/services/package.js
  73. 12
    7
      src/services/rotationChart.js
  74. 10
    0
      src/services/statis.js
  75. 14
    0
      src/services/user.js
  76. 3
    3
      src/store/models/system.js
  77. 0
    0
      src/utils/float.js
  78. 3
    3
      src/utils/request.js
  79. 2
    1
      vite.config.js

+ 3
- 2
index.html 查看文件

@@ -2,9 +2,10 @@
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
+    <script src="/config.js"></script>
8
+    <title>海安军供保障信息管理系统</title>
8 9
   </head>
9 10
   <body>
10 11
     <div id="root"></div>

+ 6
- 0
public/config.js 查看文件

@@ -0,0 +1,6 @@
1
+
2
+// 大华监控
3
+DH_MONITOR = 'http://192.168.3.2';
4
+
5
+// 海康监控
6
+HK_MONITOR = 'http://192.168.3.3';

二进制
public/favicon.ico 查看文件


+ 0
- 1
public/vite.svg 查看文件

@@ -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>

二进制
src/assets/avatar.png 查看文件


+ 4
- 0
src/components/Money/float.js 查看文件

@@ -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 查看文件

@@ -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
- 13
src/components/Wangeditor/index.jsx 查看文件

@@ -7,16 +7,12 @@ import { Editor, Toolbar } from "@wangeditor/editor-for-react";
7 7
 
8 8
 function MyEditor(props) {
9 9
   const {
10
-    value,
10
+    value = "",
11 11
     onChange = (e) => {
12 12
       setHtml(e);
13 13
     },
14 14
     toolbarConfig = {
15
-      excludeKeys: [
16
-
17
-        "group-image",
18
-        "group-video",
19
-      ],
15
+      excludeKeys: ["group-image", "group-video"],
20 16
     },
21 17
     editorConfig = {
22 18
       placeholder: "请输入内容...",
@@ -25,15 +21,10 @@ function MyEditor(props) {
25 21
   } = props;
26 22
   const [editor, setEditor] = useState(null); // 存储 editor 实例
27 23
   const [html, setHtml] = useState("");
28
-  console.log(props, "MyEditor");
24
+ 
29 25
   // 模拟 ajax 请求,异步设置 html
30 26
   useEffect(() => {
31
-    if(editor){
32
-      console.log(editor,editor.getConfig(),editor.getAllMenuKeys(),editor.getMenuConfig('image')) ;
33
-    }
34
-   
35
-
36
-    setHtml(value);
27
+    setHtml(value || "");
37 28
   }, [value]);
38 29
 
39 30
   // 及时销毁 editor

+ 2
- 2
src/components/evaluateItem/index.jsx 查看文件

@@ -5,8 +5,8 @@ function MyEditor(props) {
5 5
     // value,
6 6
     // onChange = (e) => {},
7 7
     options = [
8
-      { value: 2, label: "" },
9
-      { value: 1, label: "" },
8
+      { value: 2, label: "满意" },
9
+      { value: 1, label: "一般" },
10 10
       { value: 0, label: "差" },
11 11
     ],
12 12
     ...leftProps

+ 1
- 1
src/components/page/style.less 查看文件

@@ -1,5 +1,5 @@
1 1
 
2 2
 .page-container {
3 3
   margin: 24px;
4
-  margin-bottom: 0;
4
+  // margin-bottom: 0;
5 5
 }

+ 17
- 1
src/index.less 查看文件

@@ -45,7 +45,23 @@ html, body, #root {
45 45
 
46 46
   .ant-menu {
47 47
     font-size: 16px;
48
-    background: var(--theme-color);
48
+    background: #0D267C;
49
+  }
50
+
51
+  .ant-menu-item {
52
+    overflow: hidden;
53
+    border-top-right-radius: 20px;
54
+    border-bottom-right-radius: 20px;
55
+  }
56
+
57
+  .ant-menu-title-content {
58
+    padding-left: 2em;
59
+  }
60
+
61
+  &.ant-layout-sider-collapsed {
62
+    .ant-menu-title-content {
63
+      padding-left: 0;
64
+    }
49 65
   }
50 66
 }
51 67
 

+ 5
- 15
src/layouts/AuthLayout/components/Container.jsx 查看文件

@@ -6,25 +6,15 @@ import Footer from './Footer';
6 6
 
7 7
 const { Content } = Layout;
8 8
 
9
-export default (props) => {  
10
-  const containerRef = useRef();
11
-  const [minHeight, setMinHeight] = useState(0);
12
-  const contentStyle = useMemo(() => ({ minHeight: `${minHeight}px` }), [minHeight]);
13
-  
14
-  useEffect(() => {
15
-    const containerHeight = containerRef.current.offsetHeight;
16
-    const footerHeight = (document.querySelector('.ant-layout-footer') || {}).offsetHeight || 0;
17
-    setMinHeight(containerHeight - footerHeight);
18
-  }, []);
19
-
9
+export default (props) => {
20 10
   return (
21
-    <div className='layout-container' ref={containerRef}>
22
-      <Content style={contentStyle}>
11
+    <div className='layout-container'>
12
+      {/* <Content style={{ height: '100%' }}> */}
23 13
         {/* <PageTransition location={props.location}> */}
24 14
           <Outlet />
25 15
         {/* </PageTransition> */}
26
-      </Content>
27
-      {!props.noFooter && <Footer />}      
16
+      {/* </Content> */}
17
+      {/* {!noFooter && <Footer />} */}
28 18
     </div>
29 19
   )
30 20
 }

+ 5
- 3
src/layouts/AuthLayout/components/Footer.jsx 查看文件

@@ -1,14 +1,16 @@
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
-    <Footer style={{ textAlign: 'center' }}>{copyRight}</Footer>
14
+    <Footer style={{ textAlign: 'center', color: 'rgba(0,0,0, 0.3)' }}>{copyRight}</Footer>
13 15
   )
14 16
 }

+ 3
- 1
src/layouts/AuthLayout/components/Header/Exit.jsx 查看文件

@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
3 3
 import { LogoutOutlined } from '@ant-design/icons';
4 4
 import { Button, Modal } from 'antd';
5 5
 import { useModel } from '@/store';
6
+import { logout } from '@/services/user';
6 7
 
7 8
 const { confirm } = Modal;
8 9
 
@@ -15,7 +16,8 @@ export default (props) => {
15 16
     confirm({
16 17
       title: '确认退出系统?',
17 18
       onOk: () => {
18
-        sessionStorage.removeItem('token');
19
+        logout();
20
+        localStorage.removeItem('token');
19 21
         setUser();
20 22
         navigate('/login?back=true');
21 23
       }

+ 12
- 1
src/layouts/AuthLayout/components/Header/SplitMenu.jsx 查看文件

@@ -1,12 +1,23 @@
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
+  }, [items]);
17
+  
7 18
   const selectedKeys = React.useMemo(() => `/${location.pathname.split('/')[1]}`, [location.pathname]);
8 19
 
9 20
   return (
10
-    <Menu className='split-menu' mode="horizontal" items={items} selectedKeys={selectedKeys} />
21
+    <Menu className='split-menu' mode="horizontal" items={menus} selectedKeys={selectedKeys} />
11 22
   )
12 23
 }

+ 16
- 6
src/layouts/AuthLayout/components/Header/User.jsx 查看文件

@@ -1,12 +1,17 @@
1 1
 import React, { useState, forwardRef, useRef, useImperativeHandle } from 'react';
2
-import { Avatar, Button, Dropdown, Menu, Form, Input, Modal } from 'antd';
3
-import { useModel } from '@/store'
2
+import { Avatar, Button, Dropdown, Menu, Form, Input, Modal, message } from 'antd';
3
+import avatarImg from '@/assets/avatar.png';
4
+import { changePassword } from '@/services/user'
5
+import md5 from 'md5';
4 6
 
5 7
 const ChangePassword = forwardRef((props, ref) => {
6 8
   const [visible, setVisible] = useState(false);
7 9
 
8 10
   const onFinish = (values) => {
9
-    console.log('Success:', values);
11
+    changePassword({
12
+      originPassword: md5(values.password),
13
+      newPassword: md5(values.newPassword)
14
+    }).then(() => setVisible(false));
10 15
   };
11 16
 
12 17
   useImperativeHandle(ref, () => {
@@ -16,7 +21,12 @@ const ChangePassword = forwardRef((props, ref) => {
16 21
   });
17 22
 
18 23
   return (
19
-    <Modal title="修改密码" visible={visible} onCancel={() => setVisible(false)}>
24
+    <Modal
25
+      title="修改密码"
26
+      visible={visible}
27
+      onCancel={() => setVisible(false)}
28
+      footer={null}
29
+    >
20 30
       <Form
21 31
         labelCol={{ span: 8 }}
22 32
         wrapperCol={{ span: 16 }}
@@ -66,7 +76,7 @@ export default (props) => {
66 76
   ];
67 77
 
68 78
   const passRef = useRef();
69
-  const { user = {} } = useModel('user');
79
+  const { user = {} } = props;
70 80
 
71 81
   const onClick = ({ key }) => {
72 82
     if (key === 'changePassword') {
@@ -79,7 +89,7 @@ export default (props) => {
79 89
   return (
80 90
     <Dropdown overlay={menu}>
81 91
       <div className="user-info">
82
-        <Avatar size={24} src="https://joeschmoe.io/api/v1/random" />
92
+        <Avatar size={24} src={avatarImg} style={{background: '#fff'}} />
83 93
         <span className='font'>{user.name}</span>
84 94
         <ChangePassword ref={passRef} />
85 95
       </div>

+ 2
- 2
src/layouts/AuthLayout/components/Header/index.jsx 查看文件

@@ -10,7 +10,7 @@ import SplitMenu from './SplitMenu';
10 10
 const { Header } = Layout;
11 11
 
12 12
 export default (props) => {
13
-  const { menus, theme, location } = props;
13
+  const { menus, theme, location, user } = props;
14 14
 
15 15
   const className = useMemo(() => classNames({
16 16
     'layout-header': true,
@@ -22,7 +22,7 @@ export default (props) => {
22 22
       <Logo />
23 23
       <SplitMenu items={menus} location={location} />
24 24
       <Space>
25
-        <User />
25
+        <User user={user} />
26 26
         <Exit />
27 27
       </Space>
28 28
     </Header>

+ 1
- 1
src/layouts/AuthLayout/components/SiderBar.jsx 查看文件

@@ -13,7 +13,7 @@ export default (props) => {
13 13
   }, []);
14 14
 
15 15
   return (
16
-    <Sider className='layout-sidebar' theme={theme} collapsible width={width}>
16
+    <Sider className='layout-sidebar' theme={theme} width={width}>
17 17
       <Menus theme={theme} items={menus} location={location} />
18 18
     </Sider>
19 19
   );

+ 3
- 3
src/layouts/AuthLayout/index.jsx 查看文件

@@ -33,9 +33,9 @@ export default (props) => {
33 33
           noLayout
34 34
             ? <Outlet />
35 35
             : (
36
-              <Layout style={{ minHeight: '100vh' }}>
37
-                <Header theme={theme} menus={splitMenus} location={location} />
38
-                <Layout>
36
+              <Layout style={{ height: '100vh' }}>
37
+                <Header user={user} theme={theme} menus={splitMenus} location={location} />
38
+                <Layout style={{ height: 'calc(100vh - var(--header-height))' }}>
39 39
                   { !noSiderBar && <SiderBar theme={theme} menus={siderMenus} location={location} /> }
40 40
                   <Container location={location} noFooter={noFooter} />
41 41
                 </Layout>

+ 3
- 1
src/layouts/AuthLayout/style.less 查看文件

@@ -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;
@@ -93,6 +94,7 @@
93 94
 }
94 95
 
95 96
 .layout-container {
97
+  height: 100%;
96 98
   flex: 1;
97 99
 
98 100
   overflow-y: auto;

+ 4
- 3
src/layouts/Container.jsx 查看文件

@@ -4,8 +4,9 @@ import { Outlet } from 'react-router-dom';
4 4
 import useRoute from '@/utils/hooks/useRoute';
5 5
 
6 6
 const containerStyle = {
7
-  margin: '24px 24px 0 24px',
8
-  height: '100%',
7
+  // margin: '24px 24px 0 24px',
8
+  margin: '24px',
9
+  minHeight: 'calc(100% - 48px)',
9 10
 }
10 11
 const { Title } = Typography;
11 12
 
@@ -15,7 +16,7 @@ export default (props) => {
15 16
 
16 17
   return (
17 18
     <div style={style}>
18
-      {/* { meta.title && !meta.noLayout && <Title level={4} style={{ paddingBottom: '12px' }}>{ meta.title }</Title> } */}
19
+      { meta.title && !meta.noLayout && <Title level={4} style={{ paddingBottom: '12px' }}>{ meta.title }</Title> }
19 20
       <Outlet />
20 21
     </div>
21 22
   )

+ 1
- 1
src/pages/cms/emergencyPlan/detail/index.jsx 查看文件

@@ -30,7 +30,7 @@ export default (props) => {
30 30
   }, [id]);
31 31
 
32 32
   return (
33
-    <Card extra={<Button onClick={() => navigate(-1)}> 返回</Button>}>
33
+    <Card title={<Button onClick={() => navigate(-1)}> 返回</Button>}>
34 34
       <Title level={2} style={{ marginBottom: "2em" }}>
35 35
         {data.title}
36 36
       </Title>

+ 1
- 9
src/pages/cms/emergencyPlan/edit/index.jsx 查看文件

@@ -32,17 +32,9 @@ export default (props) => {
32 32
   }, [id]);
33 33
 
34 34
   const onFinish = async (values) => {
35
-    console.log(values, "===");
36
-
37
-    // if (id) {
38
-    //   updatePosts(id, { ...values, status: Number(values.status) }).then(
39
-    //     (res) => {
40
-    //       navigate(-1);
41
-    //     }
42
-    //   );
43
-    // } else {
44 35
     savePosts({
45 36
       ...values,
37
+      type: 'emergency-plan',
46 38
       filesList: values.filesList
47 39
         ? [
48 40
             {

+ 1
- 1
src/pages/cms/emergencyPlan/list/index.jsx 查看文件

@@ -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
 
@@ -126,6 +125,7 @@ const EmergencyPlanList = (props) => {
126 125
           </Button>,
127 126
         ]}
128 127
         // search={false}
128
+        params={{ type: 'emergency-plan' }}
129 129
         request={queryTable(getPostsList)}
130 130
         columns={columns}
131 131
       />

+ 1
- 1
src/pages/cms/files/list/addFiles.jsx 查看文件

@@ -17,7 +17,7 @@ export default ({onsuccess=()=>{}}) => {
17 17
     console.log(values);
18 18
     // await waitTime(2000);
19 19
 
20
-    await savePostsFiles(values);
20
+    await savePostsFiles({...values, fileType: 'pure'});
21 21
     onsuccess()
22 22
     return true;
23 23
   };

+ 2
- 3
src/pages/cms/files/list/index.jsx 查看文件

@@ -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) => {
@@ -24,6 +23,7 @@ const FilesList = (props) => {
24 23
   return (
25 24
     <PageContainer>
26 25
       <ProList
26
+        headerTitle="文件名称"
27 27
         toolBarRender={() => {
28 28
           return [
29 29
             <AddFiles
@@ -34,12 +34,11 @@ const FilesList = (props) => {
34 34
           ];
35 35
         }}
36 36
         actionRef={actionRef}
37
+        params={{ fileType: 'pure' }}
37 38
         request={queryTable(getPostsFilesList)}
38 39
         search={{}}
39 40
         rowKey="id"
40
-        // headerTitle="基础列表"
41 41
         pagination={true}
42
-        // showActions="hover"
43 42
         metas={{
44 43
           title: {
45 44
             dataIndex: "fileName",

+ 22
- 4
src/pages/dish/edit/index.jsx 查看文件

@@ -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, ProFormDigit } 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,8 +35,8 @@ export default (props) => {
34 35
   const onFinish = async (values) => {
35 36
     console.log(values, '===');
36 37
 
37
-    addDish({ ...values, id }).then((res) => {
38
-      message.success('添加成功');
38
+    addDish({ ...values, price: floatMultiply(values.price, 100), id }).then((res) => {
39
+      // message.success('添加成功');
39 40
       navigate(-1);
40 41
     });
41 42
 
@@ -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"
@@ -91,6 +98,17 @@ export default (props) => {
91 98
             width={460}
92 99
             options={foodDict}
93 100
           />
101
+          <ProFormDigit
102
+            label="元素"
103
+            name="calorie"
104
+            min={0}
105
+            width={460}
106
+            placeholder="卡路里"
107
+            fieldProps={{
108
+              addonAfter: '卡',
109
+              precision: '4'
110
+            }}
111
+          />
94 112
         </ProForm>
95 113
       </Card>
96 114
     </PageContainer>

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

@@ -15,7 +15,7 @@ const DishList = (props) => {
15 15
   const updata = (row) => {
16 16
     if (row.id) {
17 17
       updataDish(row.id, { state: row.state === '1' ? '2' : '1' }).then((res) => {
18
-        message.success('修改成功');
18
+        // message.success('修改成功');
19 19
         actionRef.current.reload();
20 20
       });
21 21
     }
@@ -24,7 +24,7 @@ const DishList = (props) => {
24 24
   const handleDelete = (id) => {
25 25
     if (id) {
26 26
       deleteDish(id).then((res) => {
27
-        message.success('删除成功');
27
+        // message.success('删除成功');
28 28
         actionRef.current.reload();
29 29
       });
30 30
     }
@@ -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
- 7
src/pages/evaluate/evaluateList/index.jsx 查看文件

@@ -18,16 +18,17 @@ const EvaluateList = (props) => {
18 18
   const formRef = useRef();
19 19
 
20 20
   const  valueEnum= {
21
-    2: { text: "", status: "Success" },
22
-    1: { text: "", status: "Processing" },
23
-    0: { text: "差", status: "Default" },
21
+    2: { text: "满意", status: "Success" },
22
+    1: { text: "一般", status: "Processing" },
23
+    0: { text: "差", status: "Error" },
24 24
   }
25 25
 
26 26
   const columns = [
27
-    // {
28
-    //   title: "任务ID",
29
-    //   dataIndex: "taskId",
30
-    // },
27
+    {
28
+      title: "日期",
29
+      dataIndex: "createDate",
30
+      valueType: 'date',
31
+    },
31 32
 
32 33
     {
33 34
       title: "服务质量",
@@ -75,6 +76,7 @@ const EvaluateList = (props) => {
75 76
         search={false}
76 77
         params={{ taskId: id }}
77 78
         rowKey="id"
79
+        headerTitle={<Link to={-1}>返回</Link>}
78 80
         toolBarRender={() => [
79 81
           <AddeValuate
80 82
             taskId={id}

+ 1
- 1
src/pages/evaluate/index.jsx 查看文件

@@ -21,7 +21,7 @@ const GuaranteeTaskList = (props) => {
21 21
   const handleDelete = (id) => {
22 22
     if (id) {
23 23
       deleteGuaranteeTask(id).then((res) => {
24
-        message.success("删除成功");
24
+        // message.success("删除成功");
25 25
         actionRef.current.reload();
26 26
       });
27 27
     }

+ 3
- 3
src/pages/guaranteeTask/Edit/BasicForm.jsx 查看文件

@@ -41,7 +41,7 @@ export default (props) => {
41 41
     func({ ...values, startDate, endDate }, id).then(res => {
42 42
       setLoading(false);
43 43
       setDataSource(res);
44
-      notification.success({ message: '操作成功' })
44
+      // notification.success({ message: '操作成功' })
45 45
     }).catch(() => {
46 46
       setLoading(false);
47 47
     });
@@ -201,8 +201,8 @@ export default (props) => {
201 201
         <Col offset={6} span={12}>
202 202
           <Button type="primary" htmlType="submit" loading={loading}>提交</Button>
203 203
           <Button style={{ marginLeft: '48px' }} onClick={() => navigate(-1)}>返回</Button>
204
-          <Button style={{ marginLeft: '48px' }}>
205
-            <Link target="_blank" to={`/guaranteeTask/print?id=${id}`}>打印预览</Link>
204
+          <Button style={{ marginLeft: '48px' }} disabled={!id}>
205
+            <a target="_blank" href={`${window.location.pathname}#/task/guaranteeTask/print?id=${id}`}>打印预览</a>
206 206
           </Button>
207 207
         </Col>
208 208
       </Row>

+ 1
- 1
src/pages/guaranteeTask/Edit/DishList.jsx 查看文件

@@ -85,7 +85,7 @@ export default (props) => {
85 85
     addGuaranteeDetailBatch(list, dataSource.id).then(res => {
86 86
       setLoading(false);
87 87
       setList(res);
88
-      notification.success({ message: '操作成功' });
88
+      // notification.success({ message: '操作成功' });
89 89
     }).catch(() => {
90 90
       setLoading(false);
91 91
     });

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

@@ -21,7 +21,7 @@ const GuaranteeTaskList = (props) => {
21 21
   const handleDelete = (id) => {
22 22
     if (id) {
23 23
       deleteGuaranteeTask(id).then((res) => {
24
-        message.success("删除成功");
24
+        // message.success("删除成功");
25 25
         actionRef.current.reload();
26 26
       });
27 27
     }

+ 10
- 1
src/pages/package/BasicForm.jsx 查看文件

@@ -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;
@@ -17,7 +18,7 @@ export default (props) => {
17 18
     func(data, current.id).then(res => {
18 19
       setLoading(false);
19 20
       onChange(res);
20
-      notification.success({ message: '操作成功' })
21
+      // notification.success({ message: '操作成功' })
21 22
     }).catch(() => {
22 23
       setLoading(false);
23 24
     });
@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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();

+ 4
- 2
src/pages/purchase/plan/list/index.jsx 查看文件

@@ -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) => {
@@ -91,6 +91,7 @@ const StockList = (props) => {
91 91
             key={4}
92 92
             style={{ padding: 0 }}
93 93
             type="link"
94
+            disabled={record?.isCompleted}
94 95
             onClick={() => {
95 96
               navigate(`/purchase/bill/edit?id=${record.id}`);
96 97
             }}
@@ -104,6 +105,7 @@ const StockList = (props) => {
104 105
             key={5}
105 106
             style={{ padding: 0 }}
106 107
             type="link"
108
+            disabled={record?.isInStore}
107 109
             onClick={() => {
108 110
               navigate(`/purchase/inStore/edit?id=${record.id}`);
109 111
             }}
@@ -135,7 +137,7 @@ const StockList = (props) => {
135 137
       <ProTable
136 138
         actionRef={actionRef}
137 139
         rowKey="id"
138
-        params={type === "inStore"? {isCompleted:true}:{}}
140
+        params={type === "inStore" ? { isCompleted: true } : {}}
139 141
         toolBarRender={() => [
140 142
           type === "plan" ? (
141 143
             <Button

+ 3
- 3
src/pages/roles/list.jsx 查看文件

@@ -61,10 +61,10 @@ export default (props) => {
61 61
     startLoading();
62 62
     const data = { name: inText };
63 63
 
64
-    if (currentRef.current) {
64
+    if (current) {
65 65
       // 修改角色
66
-      updateRole(currentRef.current.id, data).then(res => {
67
-        setList(list.map(x => x.id === currentRef.current.id ? res : x));
66
+      updateRole(current.id, data).then(res => {
67
+        setList(list.map(x => x.id === current.id ? res : x));
68 68
         cancelLoading();
69 69
         hideModel();
70 70
       }).catch(() => {

+ 37
- 0
src/pages/rotationChart/detail/index.jsx 查看文件

@@ -0,0 +1,37 @@
1
+import { getBannerdById } from "@/services/rotationChart";
2
+import { useNavigate, useSearchParams } from "react-router-dom";
3
+import { Card, Button } from "antd";
4
+import { useEffect, useState } from "react";
5
+
6
+export default (props) => {
7
+  const [searchParams] = useSearchParams();
8
+  const id = searchParams.get("id");
9
+  const [data, setData] = useState({});
10
+
11
+  const navigate = useNavigate();
12
+
13
+  useEffect(() => {
14
+    if (id) {
15
+      getBannerdById(id).then((res) => {
16
+        setData(res);
17
+      });
18
+    }
19
+  }, [id]);
20
+
21
+  return (
22
+    <Card title={<Button onClick={() => navigate(-1)}> 返回</Button>}>
23
+      <div dangerouslySetInnerHTML={{ __html: data?.desc }}></div>
24
+      {data?.type === "1" && data?.image && (
25
+        <img src={data?.image} alt="" style={{ width: "100%" }}></img>
26
+      )}
27
+      {data?.type === "2" && data?.video && (
28
+        <video
29
+          src={data?.video}
30
+          autoPlay={false}
31
+          controls="controls"
32
+          style={{ width: "100%" }}
33
+        ></video>
34
+      )}
35
+    </Card>
36
+  );
37
+};

+ 48
- 27
src/pages/rotationChart/edit/index.jsx 查看文件

@@ -1,7 +1,10 @@
1
-import UploadImage from '@/components/UploadImage';
2
-import UploadVideo from '@/components/UploadVideo';
3
-import UploadFile from '@/components/UploadFile';
4
-import { addBanner, getBannerdById, updataBanner } from '@/services/rotationChart';
1
+
2
+import UploadFile from "@/components/UploadFile";
3
+import {
4
+  addBanner,
5
+  getBannerdById,
6
+  updataBanner,
7
+} from "@/services/rotationChart";
5 8
 import {
6 9
   PageContainer,
7 10
   ProForm,
@@ -9,16 +12,17 @@ import {
9 12
   ProFormRadio,
10 13
   ProFormSelect,
11 14
   ProFormTextArea,
12
-} from '@ant-design/pro-components';
13
-import { useNavigate, useSearchParams } from 'react-router-dom';
14
-import { Card, Col, message, Row, Space, Image } from 'antd';
15
-import { useEffect, useRef, useState } from 'react';
15
+} from "@ant-design/pro-components";
16
+import { useNavigate, useSearchParams } from "react-router-dom";
17
+import { Card, Col, message, Row, Space, Image } from "antd";
18
+import { useEffect, useRef, useState } from "react";
19
+import Wangeditor from "@/components/Wangeditor";
16 20
 
17 21
 export default (props) => {
18 22
   const [searchParams, setSearchParams] = useSearchParams();
19
-  const id = searchParams.get('id');
23
+  const id = searchParams.get("id");
20 24
   const [data, setData] = useState({});
21
-  const [imgLabel, setImgLabel] = useState('图片');
25
+  const [imgLabel, setImgLabel] = useState("图片");
22 26
   const formRef = useRef();
23 27
   const navigate = useNavigate();
24 28
 
@@ -36,13 +40,13 @@ export default (props) => {
36 40
     if (id) {
37 41
       // 修改
38 42
       updataBanner(id, { ...values }).then((res) => {
39
-        message.success('修改成功');
43
+        // message.success("修改成功");
40 44
         navigate(-1);
41 45
       });
42 46
     } else {
43 47
       // 新增
44 48
       addBanner({ ...values }).then((res) => {
45
-        message.success('添加成功');
49
+        // message.success("添加成功");
46 50
         navigate(-1);
47 51
       });
48 52
     }
@@ -55,14 +59,14 @@ export default (props) => {
55 59
       <Card>
56 60
         <ProForm
57 61
           formRef={formRef}
58
-          layout={'horizontal'}
62
+          layout={"horizontal"}
59 63
           labelCol={{ span: 8 }}
60 64
           wrapperCol={{ span: 16 }}
61 65
           onFinish={onFinish}
62
-          initialValues={{ type: '1', state: '1' }}
66
+          initialValues={{ type: "1", state: "1" }}
63 67
           submitter={{
64 68
             searchConfig: {
65
-              resetText: '返回',
69
+              resetText: "返回",
66 70
             },
67 71
             onReset: () => navigate(-1),
68 72
             render: (props, doms) => {
@@ -81,12 +85,14 @@ export default (props) => {
81 85
             width="md"
82 86
             label="轮播图类型"
83 87
             valueEnum={{
84
-              1: '图片',
85
-              2: '视频',
88
+              1: "图片",
89
+              2: "视频",
86 90
             }}
87 91
             placeholder="轮播图类型"
88
-            rules={[{ required: true, message: 'Please select your country!' }]}
89
-            onChange={({ value }) =>  setImgLabel(value === '1' ? '图片' : '封面')}
92
+            rules={[{ required: true, message: "Please select your country!" }]}
93
+            onChange={({ value }) =>
94
+              setImgLabel(value === "1" ? "图片" : "封面")
95
+            }
90 96
           />
91 97
           <ProForm.Item
92 98
             width="md"
@@ -97,12 +103,16 @@ export default (props) => {
97 103
           >
98 104
             <UploadFile
99 105
               accept="image/*"
100
-              preview={src => <div style={{ marginTop: '2em' }}><Image width={200} src={src} /></div>}
106
+              preview={(src) => (
107
+                <div style={{ marginTop: "2em" }}>
108
+                  <Image width={200} src={src} />
109
+                </div>
110
+              )}
101 111
             />
102 112
           </ProForm.Item>
103 113
           <ProForm.Item noStyle shouldUpdate>
104 114
             {(form) => {
105
-              return form.getFieldValue('type') == '1' ? null : (
115
+              return form.getFieldValue("type") == "1" ? null : (
106 116
                 <ProForm.Item
107 117
                   width="md"
108 118
                   name="video"
@@ -112,7 +122,11 @@ export default (props) => {
112 122
                 >
113 123
                   <UploadFile
114 124
                     accept="video/*"
115
-                    preview={src => <div style={{ marginTop: '6px' }}><video height={360} width={480} src={src} controls /></div>}
125
+                    preview={(src) => (
126
+                      <div style={{ marginTop: "6px" }}>
127
+                        <video height={360} width={480} src={src} controls />
128
+                      </div>
129
+                    )}
116 130
                   />
117 131
                 </ProForm.Item>
118 132
               );
@@ -124,17 +138,24 @@ export default (props) => {
124 138
             radioType="button"
125 139
             options={[
126 140
               {
127
-                label: '上架',
128
-                value: '1',
141
+                label: "上架",
142
+                value: "1",
129 143
               },
130 144
               {
131
-                label: '下架',
132
-                value: '2',
145
+                label: "下架",
146
+                value: "2",
133 147
               },
134 148
             ]}
135 149
           />
136 150
           <ProFormDigit name="qz" label="权重" width="md" />
137
-          <ProFormTextArea width="md" name="desc" label="描述" placeholder="请输入描述" />
151
+          <ProForm.Item
152
+            name="desc"
153
+            label="详情"
154
+            placeholder="请输入详情"
155
+            // rules={[{ required: true, message: "请输入详情" }]}
156
+          >
157
+            <Wangeditor></Wangeditor>
158
+          </ProForm.Item>
138 159
         </ProForm>
139 160
       </Card>
140 161
     </PageContainer>

+ 2
- 1
src/pages/rotationChart/introduction/edit/index.jsx 查看文件

@@ -23,7 +23,8 @@ export default (props) => {
23 23
   const onFinish = async (values) => {
24 24
     //添加,修改
25 25
     addRegulation({ ...values, id }).then((res) => {
26
-      message.success('成功');
26
+      // message.success('成功');
27
+      navigate(-1);
27 28
     });
28 29
     return false;
29 30
   };

+ 93
- 0
src/pages/rotationChart/introduction/index.jsx 查看文件

@@ -0,0 +1,93 @@
1
+import { getRegulationList, deleteRegulation } from '@/services/regulation';
2
+import { ProFormTextArea, ProForm, PageContainer, ProTable } from '@ant-design/pro-components';
3
+import { Button, message, Popconfirm } from 'antd';
4
+import { useNavigate } from 'react-router-dom';
5
+import { queryTable } from '@/utils/request';
6
+import { useRef, useState, useEffect } from 'react';
7
+
8
+const IntroductionList = (props) => {
9
+  const actionRef = useRef();
10
+  const navigate = useNavigate();
11
+
12
+  const handleDelete = (id) => {
13
+    if (id) {
14
+      deleteRegulation(id).then((res) => {
15
+        // message.success('删除成功');
16
+        actionRef.current.reload();
17
+      });
18
+    }
19
+  };
20
+
21
+  const columns = [
22
+    {
23
+      title: 'id',
24
+      dataIndex: 'id',
25
+      width: 100,
26
+      search: false,
27
+      hideInTable: true,
28
+    },
29
+
30
+    {
31
+      title: '内容',
32
+      dataIndex: 'detail',
33
+      width: 400,
34
+      search: false,
35
+    },
36
+    {
37
+      title: '操作',
38
+      valueType: 'option',
39
+      width: 100,
40
+      render: (_, record) => [
41
+        <Button
42
+          key={2}
43
+          style={{ padding: 0 }}
44
+          type="link"
45
+          onClick={() => {
46
+            console.log(record, ']]');
47
+            navigate(`/cms/rotationChart/introduction/edit?id=${record.id}`);
48
+          }}
49
+        >
50
+          编辑
51
+        </Button>,
52
+
53
+        <Popconfirm
54
+          key={3}
55
+          title="您是否确认删除 ?"
56
+          onConfirm={() => handleDelete(record.id)}
57
+          okText="确定"
58
+          cancelText="取消"
59
+        >
60
+          {/* manualPush */}
61
+          <Button style={{ padding: 0 }} type="link">
62
+            删除
63
+          </Button>
64
+        </Popconfirm>,
65
+      ],
66
+    },
67
+  ];
68
+
69
+  return (
70
+    <PageContainer>
71
+      <ProTable
72
+        search={false}
73
+        actionRef={actionRef}
74
+        rowKey="id"
75
+        toolBarRender={() => [
76
+          <Button
77
+            key="2"
78
+            type="primary"
79
+            onClick={() => {
80
+              navigate('/cms/rotationChart/introduction/edit');
81
+            }}
82
+          >
83
+            新增
84
+          </Button>,
85
+        ]}
86
+        request={queryTable(getRegulationList)}
87
+        columns={columns}
88
+      />
89
+    </PageContainer>
90
+  );
91
+}
92
+
93
+export default IntroductionList;

+ 14
- 3
src/pages/rotationChart/list/index.jsx 查看文件

@@ -15,7 +15,7 @@ const RotationChartList = (props) => {
15 15
   const updata = (row) => {
16 16
     if (row.id) {
17 17
       updataBanner(row.id, { state: row.state === '1' ? '2' : '1' }).then((res) => {
18
-        message.success('修改成功');
18
+        // message.success('修改成功');
19 19
         actionRef.current.reload();
20 20
       });
21 21
     }
@@ -24,7 +24,7 @@ const RotationChartList = (props) => {
24 24
   const handleDelete = (id) => {
25 25
     if (id) {
26 26
       deleteBanner(id).then((res) => {
27
-        message.success('删除成功');
27
+        // message.success('删除成功');
28 28
         actionRef.current.reload();
29 29
       });
30 30
     }
@@ -92,12 +92,23 @@ const RotationChartList = (props) => {
92 92
         >
93 93
           {record.state === '1' ? '下架' : '上架'}
94 94
         </Button>,
95
+         <Button
96
+         key={4}
97
+         style={{ padding: 0 }}
98
+         type="link"
99
+         onClick={() => {
100
+      
101
+           navigate(`/cms/rotationChart/detail?id=${record.id}`);
102
+         }}
103
+       >
104
+         详情
105
+       </Button>,
95 106
         <Button
96 107
           key={2}
97 108
           style={{ padding: 0 }}
98 109
           type="link"
99 110
           onClick={() => {
100
-            console.log(record, ']]');
111
+            
101 112
             navigate(`/cms/rotationChart/add?id=${record.id}`);
102 113
           }}
103 114
         >

+ 0
- 191
src/pages/sample/home/components/AreaChart.jsx 查看文件

@@ -1,191 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import * as echarts from 'echarts/core';
4
-import Chart from '@/components/chart';
5
-
6
-export default (props) => {
7
-  const option = {
8
-    color: ['#80FFA5', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'],
9
-    // title: {
10
-    //   text: 'Gradient Stacked Area Chart'
11
-    // },
12
-    tooltip: {
13
-      trigger: 'axis',
14
-      axisPointer: {
15
-        type: 'cross',
16
-        label: {
17
-          backgroundColor: '#6a7985'
18
-        }
19
-      }
20
-    },
21
-    legend: {
22
-      data: ['Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5']
23
-    },
24
-    grid: {
25
-      left: '3%',
26
-      right: '4%',
27
-      bottom: '3%',
28
-      containLabel: true
29
-    },
30
-    xAxis: [
31
-      {
32
-        type: 'category',
33
-        boundaryGap: false,
34
-        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
35
-      }
36
-    ],
37
-    yAxis: [
38
-      {
39
-        type: 'value'
40
-      }
41
-    ],
42
-    series: [
43
-      {
44
-        name: 'Line 1',
45
-        type: 'line',
46
-        stack: 'Total',
47
-        smooth: true,
48
-        lineStyle: {
49
-          width: 0
50
-        },
51
-        showSymbol: false,
52
-        areaStyle: {
53
-          opacity: 0.8,
54
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
55
-            {
56
-              offset: 0,
57
-              color: 'rgb(128, 255, 165)'
58
-            },
59
-            {
60
-              offset: 1,
61
-              color: 'rgb(1, 191, 236)'
62
-            }
63
-          ])
64
-        },
65
-        emphasis: {
66
-          focus: 'series'
67
-        },
68
-        data: [140, 232, 101, 264, 90, 340, 250]
69
-      },
70
-      {
71
-        name: 'Line 2',
72
-        type: 'line',
73
-        stack: 'Total',
74
-        smooth: true,
75
-        lineStyle: {
76
-          width: 0
77
-        },
78
-        showSymbol: false,
79
-        areaStyle: {
80
-          opacity: 0.8,
81
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
82
-            {
83
-              offset: 0,
84
-              color: 'rgb(0, 221, 255)'
85
-            },
86
-            {
87
-              offset: 1,
88
-              color: 'rgb(77, 119, 255)'
89
-            }
90
-          ])
91
-        },
92
-        emphasis: {
93
-          focus: 'series'
94
-        },
95
-        data: [120, 282, 111, 234, 220, 340, 310]
96
-      },
97
-      {
98
-        name: 'Line 3',
99
-        type: 'line',
100
-        stack: 'Total',
101
-        smooth: true,
102
-        lineStyle: {
103
-          width: 0
104
-        },
105
-        showSymbol: false,
106
-        areaStyle: {
107
-          opacity: 0.8,
108
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
109
-            {
110
-              offset: 0,
111
-              color: 'rgb(55, 162, 255)'
112
-            },
113
-            {
114
-              offset: 1,
115
-              color: 'rgb(116, 21, 219)'
116
-            }
117
-          ])
118
-        },
119
-        emphasis: {
120
-          focus: 'series'
121
-        },
122
-        data: [320, 132, 201, 334, 190, 130, 220]
123
-      },
124
-      {
125
-        name: 'Line 4',
126
-        type: 'line',
127
-        stack: 'Total',
128
-        smooth: true,
129
-        lineStyle: {
130
-          width: 0
131
-        },
132
-        showSymbol: false,
133
-        areaStyle: {
134
-          opacity: 0.8,
135
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
136
-            {
137
-              offset: 0,
138
-              color: 'rgb(255, 0, 135)'
139
-            },
140
-            {
141
-              offset: 1,
142
-              color: 'rgb(135, 0, 157)'
143
-            }
144
-          ])
145
-        },
146
-        emphasis: {
147
-          focus: 'series'
148
-        },
149
-        data: [220, 402, 231, 134, 190, 230, 120]
150
-      },
151
-      {
152
-        name: 'Line 5',
153
-        type: 'line',
154
-        stack: 'Total',
155
-        smooth: true,
156
-        lineStyle: {
157
-          width: 0
158
-        },
159
-        showSymbol: false,
160
-        label: {
161
-          show: true,
162
-          position: 'top'
163
-        },
164
-        areaStyle: {
165
-          opacity: 0.8,
166
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
167
-            {
168
-              offset: 0,
169
-              color: 'rgb(255, 191, 0)'
170
-            },
171
-            {
172
-              offset: 1,
173
-              color: 'rgb(224, 62, 76)'
174
-            }
175
-          ])
176
-        },
177
-        emphasis: {
178
-          focus: 'series'
179
-        },
180
-        data: [220, 302, 181, 234, 210, 290, 150]
181
-      }
182
-    ]
183
-  };
184
-  
185
-
186
-  return (
187
-    <Card title='Gradient Stacked Area Chart'>
188
-      <Chart option={option} style={props.style}></Chart>
189
-    </Card>
190
-  )
191
-}

+ 0
- 44
src/pages/sample/home/components/Banner.jsx 查看文件

@@ -1,44 +0,0 @@
1
-import React from 'react';
2
-import { Row, Col, Card, Statistic } from 'antd';
3
-import { ArrowDownOutlined, ArrowUpOutlined, LikeOutlined } from '@ant-design/icons';
4
-
5
-export default (props) => {
6
-  return (
7
-    <Row gutter={24}>
8
-      <Col span={6}>
9
-        <Card>
10
-          <Statistic title="Feedback" value={1128} prefix={<LikeOutlined />} />
11
-        </Card>
12
-      </Col>
13
-      <Col span={6}>
14
-        <Card>
15
-          <Statistic title="Unmerged" value={93} suffix="/ 100" />
16
-        </Card>
17
-      </Col>
18
-      <Col span={6}>
19
-        <Card>
20
-          <Statistic
21
-            title="Active"
22
-            value={11.28}
23
-            precision={2}
24
-            valueStyle={{ color: '#3f8600' }}
25
-            prefix={<ArrowUpOutlined />}
26
-            suffix="%"
27
-          />
28
-        </Card>
29
-      </Col>
30
-      <Col span={6}>
31
-        <Card>
32
-          <Statistic
33
-            title="Idle"
34
-            value={9.3}
35
-            precision={2}
36
-            valueStyle={{ color: '#cf1322' }}
37
-            prefix={<ArrowDownOutlined />}
38
-            suffix="%"
39
-          />
40
-        </Card>
41
-      </Col>
42
-    </Row>
43
-  )
44
-}

+ 0
- 37
src/pages/sample/home/components/BarChart.jsx 查看文件

@@ -1,37 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import Chart from '@/components/chart';
4
-
5
-export default (props) => {
6
-
7
-  const option = {
8
-    legend: {},
9
-    tooltip: {},
10
-    dataset: {
11
-      source: [
12
-        ['product', '2015', '2016', '2017'],
13
-        ['Matcha Latte', 43.3, 85.8, 93.7],
14
-        ['Milk Tea', 83.1, 73.4, 55.1],
15
-        ['Cheese Cocoa', 86.4, 65.2, 82.5],
16
-        ['Walnut Brownie', 72.4, 53.9, 39.1]
17
-      ]
18
-    },
19
-    xAxis: { type: 'category' },
20
-    yAxis: {},
21
-    grid: {
22
-      left: '3%',
23
-      right: '4%',
24
-      bottom: '3%',
25
-      containLabel: true
26
-    },
27
-    // Declare several bar series, each will be mapped
28
-    // to a column of dataset.source by default.
29
-    series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
30
-  };
31
-
32
-  return (
33
-    <Card title='Bar Chart'>
34
-      <Chart option={option} style={props.style}></Chart>
35
-    </Card>
36
-  )
37
-}

+ 0
- 112
src/pages/sample/home/components/PictorialBar.jsx 查看文件

@@ -1,112 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import * as echarts from 'echarts/core';
4
-import Chart from '@/components/chart';
5
-
6
-
7
-export default (props) => {
8
-  let category = [];
9
-  let dottedBase = +new Date();
10
-  let lineData = [];
11
-  let barData = [];
12
-  for (let i = 0; i < 20; i++) {
13
-    let date = new Date((dottedBase += 3600 * 24 * 1000));
14
-    category.push(
15
-      [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-')
16
-    );
17
-    let b = Math.random() * 200;
18
-    let d = Math.random() * 200;
19
-    barData.push(b);
20
-    lineData.push(d + b);
21
-  }
22
-
23
-  const option = {
24
-    backgroundColor: '#0f375f',
25
-    tooltip: {
26
-      trigger: 'axis',
27
-      axisPointer: {
28
-        type: 'shadow'
29
-      }
30
-    },
31
-    legend: {
32
-      data: ['line', 'bar'],
33
-      textStyle: {
34
-        color: '#ccc'
35
-      }
36
-    },
37
-    xAxis: {
38
-      data: category,
39
-      axisLine: {
40
-        lineStyle: {
41
-          color: '#ccc'
42
-        }
43
-      }
44
-    },
45
-    yAxis: {
46
-      splitLine: { show: false },
47
-      axisLine: {
48
-        lineStyle: {
49
-          color: '#ccc'
50
-        }
51
-      }
52
-    },
53
-    series: [
54
-      {
55
-        name: 'line',
56
-        type: 'line',
57
-        smooth: true,
58
-        showAllSymbol: true,
59
-        symbol: 'emptyCircle',
60
-        symbolSize: 15,
61
-        data: lineData
62
-      },
63
-      {
64
-        name: 'bar',
65
-        type: 'bar',
66
-        barWidth: 10,
67
-        itemStyle: {
68
-          borderRadius: 5,
69
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
70
-            { offset: 0, color: '#14c8d4' },
71
-            { offset: 1, color: '#43eec6' }
72
-          ])
73
-        },
74
-        data: barData
75
-      },
76
-      {
77
-        name: 'line',
78
-        type: 'bar',
79
-        barGap: '-100%',
80
-        barWidth: 10,
81
-        itemStyle: {
82
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
83
-            { offset: 0, color: 'rgba(20,200,212,0.5)' },
84
-            { offset: 0.2, color: 'rgba(20,200,212,0.2)' },
85
-            { offset: 1, color: 'rgba(20,200,212,0)' }
86
-          ])
87
-        },
88
-        z: -12,
89
-        data: lineData
90
-      },
91
-      {
92
-        name: 'dotted',
93
-        type: 'pictorialBar',
94
-        symbol: 'rect',
95
-        itemStyle: {
96
-          color: '#0f375f'
97
-        },
98
-        symbolRepeat: true,
99
-        symbolSize: [12, 4],
100
-        symbolMargin: 1,
101
-        z: -10,
102
-        data: lineData
103
-      }
104
-    ]
105
-  };
106
-
107
-  return (
108
-    <Card title='Pictorial Chart'>
109
-      <Chart option={option} style={props.style}></Chart>
110
-    </Card>
111
-  )
112
-}

+ 0
- 48
src/pages/sample/home/components/PieChart.jsx 查看文件

@@ -1,48 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import Chart from '@/components/chart';
4
-
5
-export default (props) => {
6
-
7
-  const option = {
8
-    // title: {
9
-    //   text: 'Referer of a Website',
10
-    //   subtext: 'Fake Data',
11
-    //   left: 'center'
12
-    // },
13
-    tooltip: {
14
-      trigger: 'item'
15
-    },
16
-    legend: {
17
-      orient: 'vertical',
18
-      left: 'left'
19
-    },
20
-    series: [
21
-      {
22
-        name: 'Access From',
23
-        type: 'pie',
24
-        radius: '50%',
25
-        data: [
26
-          { value: 1048, name: 'Search Engine' },
27
-          { value: 735, name: 'Direct' },
28
-          { value: 580, name: 'Email' },
29
-          { value: 484, name: 'Union Ads' },
30
-          { value: 300, name: 'Video Ads' }
31
-        ],
32
-        emphasis: {
33
-          itemStyle: {
34
-            shadowBlur: 10,
35
-            shadowOffsetX: 0,
36
-            shadowColor: 'rgba(0, 0, 0, 0.5)'
37
-          }
38
-        }
39
-      }
40
-    ]
41
-  };
42
-
43
-  return (
44
-    <Card title='Basic Pie Chart'>
45
-      <Chart option={option} style={props.style}></Chart>
46
-    </Card>
47
-  )
48
-}

+ 0
- 48
src/pages/sample/home/components/RadarChart.jsx 查看文件

@@ -1,48 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import Chart from '@/components/chart';
4
-
5
-export default (props) => {
6
-
7
-  const option = {
8
-    // title: {
9
-    //   text: 'Basic Radar Chart'
10
-    // },
11
-    legend: {
12
-      data: ['Allocated Budget', 'Actual Spending']
13
-    },
14
-    radar: {
15
-      // shape: 'circle',
16
-      indicator: [
17
-        { name: 'Sales', max: 6500 },
18
-        { name: 'Administration', max: 16000 },
19
-        { name: 'Information Technology', max: 30000 },
20
-        { name: 'Customer Support', max: 38000 },
21
-        { name: 'Development', max: 52000 },
22
-        { name: 'Marketing', max: 25000 }
23
-      ]
24
-    },
25
-    series: [
26
-      {
27
-        name: 'Budget vs spending',
28
-        type: 'radar',
29
-        data: [
30
-          {
31
-            value: [4200, 3000, 20000, 35000, 50000, 18000],
32
-            name: 'Allocated Budget'
33
-          },
34
-          {
35
-            value: [5000, 14000, 28000, 26000, 42000, 21000],
36
-            name: 'Actual Spending'
37
-          }
38
-        ]
39
-      }
40
-    ]
41
-  };
42
-
43
-  return (
44
-    <Card title='Basic Radar Chart'>
45
-      <Chart option={option} style={props.style}></Chart>
46
-    </Card>
47
-  )
48
-}

+ 52
- 0
src/pages/sample/home/components/VideoPlay.jsx 查看文件

@@ -0,0 +1,52 @@
1
+import { Row, Col, Card, Statistic, Carousel } from "antd";
2
+import {
3
+  ArrowDownOutlined,
4
+  ArrowUpOutlined,
5
+  LikeOutlined,
6
+} from "@ant-design/icons";
7
+import React, { useState } from "react";
8
+
9
+import { useRef } from "react";
10
+import { useEffect } from "react";
11
+
12
+// https://image.baidu.com/search/albumsdetail?tn=albumsdetail&word=%E5%AE%A0%E7%89%A9%E5%9B%BE%E7%89%87&fr=albumslist&album_tab=%E5%8A%A8%E7%89%A9&album_id=688&rn=30
13
+
14
+// https://image.baidu.com/search/albumsdetail?tn=albumsdetail&word=%E5%9F%8E%E5%B8%82%E5%BB%BA%E7%AD%91%E6%91%84%E5%BD%B1%E4%B8%93%E9%A2%98&fr=searchindex_album%20&album_tab=%E5%BB%BA%E7%AD%91&album_id=7&rn=30
15
+const VideoPlay = (props) => {
16
+  const { url, index, current, isVideoPlayRef, style } = props;
17
+
18
+  const ref = useRef();
19
+
20
+  useEffect(() => {
21
+    if (current == index) {
22
+      ref.current
23
+        ?.play()
24
+        .then((res) => {
25
+          isVideoPlayRef.current = true;
26
+        })
27
+        .catch((err) => {
28
+          console.log(err)
29
+          isVideoPlayRef.current = false;
30
+        });
31
+    } else {
32
+      ref.current.pause();
33
+      isVideoPlayRef.current = false;
34
+    }
35
+  }, [current, index]);
36
+
37
+  useEffect(() => {}, []);
38
+
39
+  return (
40
+    <video
41
+      ref={ref}
42
+      autoPlay={false}
43
+      src={url}
44
+      controls="controls"
45
+      onEnded={() => {
46
+        isVideoPlayRef.current = false;
47
+      }}
48
+      style={style}
49
+    ></video>
50
+  );
51
+};
52
+export default VideoPlay;

+ 110
- 36
src/pages/sample/home/index.jsx 查看文件

@@ -1,41 +1,115 @@
1
-import React from 'react';
2
-import { Row, Col, Card, Space, Statistic } from 'antd';
3
-import Container from '@/components/page/Container';
4
-import Banner from './components/Banner';
5
-import AreaChart from './components/AreaChart';
6
-import BarChart from './components/BarChart';
7
-import PictorialBar from './components/PictorialBar';
8
-import RadarChart from './components/RadarChart';
9
-import PieChart from './components/PieChart';
1
+import { Carousel } from "antd";
2
+import React, { useState, useRef, useEffect, useMemo } from "react";
3
+import { getBannerList } from "@/services/rotationChart";
4
+
5
+import VideoPlay from "./components/VideoPlay";
6
+import { useNavigate } from "react-router-dom";
7
+const height = "100%";
8
+const contentStyle = {
9
+  height,
10
+  margin: "0 auto",
11
+  width: "100%",
12
+};
10 13
 
11 14
 export default (props) => {
15
+  const navigate = useNavigate();
16
+  const [height, setHeight] = useState("100%");
17
+  const [current, setCurrent] = useState(0);
18
+  const [mouse, setMouse] = useState(false);
19
+  const [mediaList, setMediaList] = useState([]);
20
+
21
+  const ref = useRef();
22
+  const boxRef = useRef();
23
+  const mouseRef = useRef(false);
24
+  const isVideoRef = useRef(false);
25
+  const isVideoPlayRef = useRef(false);
26
+
27
+  const itemStyle = useMemo(
28
+    () => ({
29
+      height,
30
+      overflow: "hidden",
31
+      width: "100%",
32
+      objectFit: "contain",
33
+    }),
34
+    [height]
35
+  );
36
+
37
+  useEffect(() => {
38
+    getBannerList().then((res) => {
39
+      setMediaList(
40
+        res?.records?.map((x) => {
41
+          if (x.type === "2") {
42
+            return {
43
+              ...x,
44
+              type: "video",
45
+              url: x.video,
46
+            };
47
+          } else {
48
+            return {
49
+              ...x,
50
+              type: "image",
51
+              url: x.image,
52
+            };
53
+          }
54
+        })
55
+      );
56
+    });
57
+    handNext();
58
+
59
+    const boxHeight = boxRef.current.offsetHeight;
60
+    setHeight(boxHeight ? `${boxHeight}px` : "100%");
61
+  }, []);
62
+
63
+  const handNext = () => {
64
+    setTimeout(() => {
65
+      if (!mouseRef.current && !isVideoRef.current && !isVideoPlayRef.current) {
66
+        ref.current?.next();
67
+      }
68
+      handNext();
69
+    }, 3000);
70
+  };
71
+
72
+  const onMouseEnter = () => {
73
+    mouseRef.current = true;
74
+  };
75
+  const onMouseLeave = () => {
76
+    mouseRef.current = false;
77
+  };
12 78
 
13
-  const chartStyle = {
14
-    height: '360px',
15
-    width: '100%',
16
-  }
79
+  const onClick = (row) => {
80
+    if (row.id) {
81
+      navigate(`/cms/rotationChart/detail?id=${row.id}`);
82
+    }
83
+  };
17 84
 
18 85
   return (
19
-    <Container>
20
-      <Banner />
21
-
22
-      <Row gutter={24} style={{ marginTop: '24px' }}>
23
-        <Col span={16}>
24
-          <AreaChart style={chartStyle}/>
25
-        </Col>
26
-        <Col span={8}>
27
-          <RadarChart style={chartStyle}/>
28
-        </Col>
29
-      </Row>
30
-
31
-      <Row gutter={24} style={{ marginTop: '24px' }}>
32
-        <Col span={8}>
33
-          <PieChart style={chartStyle}/>
34
-        </Col>
35
-        <Col span={16}>
36
-          <BarChart style={chartStyle}/>
37
-        </Col>
38
-      </Row>
39
-    </Container>
40
-  )
41
-}
86
+    <div
87
+      onMouseEnter={onMouseEnter}
88
+      onMouseLeave={onMouseLeave}
89
+      style={{ height, overflow: "hidden", background: "#081A48" }}
90
+      ref={boxRef}
91
+    >
92
+      <Carousel
93
+        ref={ref}
94
+        afterChange={(cur) => {
95
+          setCurrent(cur);
96
+        }}
97
+      >
98
+        {mediaList?.map((x, index) => (
99
+          <div key={index} onClick={()=>onClick(x)}>
100
+            {x.type === "image" && <img src={x.url} style={itemStyle}></img>}
101
+            {x.type === "video" && (
102
+              <VideoPlay
103
+                url={x.url}
104
+                isVideoPlayRef={isVideoPlayRef}
105
+                index={index}
106
+                current={current}
107
+                style={itemStyle}
108
+              />
109
+            )}
110
+          </div>
111
+        ))}
112
+      </Carousel>
113
+    </div>
114
+  );
115
+};

+ 4
- 3
src/pages/statis/charts.jsx 查看文件

@@ -3,8 +3,9 @@ import { Row, Col } from 'antd';
3 3
 import Sumary from './components/Sumary';
4 4
 import Task from './components/Task';
5 5
 import DeviceType from './components/DeviceType';
6
-import StoreCost from './components/StoreCost';
6
+import StoreType from './components/StoreType';
7 7
 import User from './components/User';
8
+import StoreCost from './components/StoreCost';
8 9
 import Styles from './style.module.less';
9 10
 
10 11
 const mtp = {
@@ -27,7 +28,7 @@ export default (props) => {
27 28
       </Row>
28 29
       <Row gutter={gutter} style={mtp}>
29 30
         <Col span={12}>
30
-          <StoreCost />
31
+          <StoreType />
31 32
         </Col>
32 33
         <Col span={12}>
33 34
           <User />
@@ -35,7 +36,7 @@ export default (props) => {
35 36
       </Row>
36 37
       <Row gutter={gutter} style={mtp}>
37 38
         <Col span={24}>
38
-          <Task />
39
+          <StoreCost />
39 40
         </Col>
40 41
       </Row>
41 42
     </div>

+ 18
- 11
src/pages/statis/components/Age.jsx 查看文件

@@ -1,24 +1,31 @@
1 1
 import React from 'react';
2 2
 import * as echarts from 'echarts/core';
3 3
 import Chart from '@/components/chart';
4
+import { getUserAge } from '@/services/statis';
4 5
 
5 6
 let dataIndex = 0;
6 7
 export default (props) => {
7 8
 
8 9
   const chartRef = React.useRef();
9
-  const option = getOption({"20(含)至29岁": 10, "20(含)至39岁": 20, "40(含)至49岁": 30, "50(含)岁以上": 40});
10
+  const [option, setOption] = React.useState({});
10 11
 
11 12
   React.useEffect(() => {
12
-    const t = setTimeout(() => {
13
-      const chart = chartRef.current;
14
-      chart.on('mousemove', function(e) {
15
-        chart.dispatchAction({ type: 'downplay', dataIndex });
16
-        chart.dispatchAction({ type: 'highlight', dataIndex: e.dataIndex });
17
-        dataIndex = e.dataIndex
18
-      });
19
-      chart.dispatchAction({ type: 'highlight', dataIndex });
20
-      clearTimeout(t);
21
-    }, 300);
13
+    getUserAge().then(res => {
14
+      // [{ age: 'xxx', cnt: 12 }] => { 'xxx': 12 }
15
+      const dataSource = (res || []).reduce((acc, x) => ({ ...acc, [x.age]: x.cnt }), {});
16
+      setOption(getOption(dataSource));
17
+
18
+      const t = setTimeout(() => {
19
+        const chart = chartRef.current;
20
+        chart.on('mousemove', function(e) {
21
+          chart.dispatchAction({ type: 'downplay', dataIndex });
22
+          chart.dispatchAction({ type: 'highlight', dataIndex: e.dataIndex });
23
+          dataIndex = e.dataIndex
24
+        });
25
+        chart.dispatchAction({ type: 'highlight', dataIndex });
26
+        clearTimeout(t);
27
+      }, 300);
28
+    });
22 29
   }, []);
23 30
 
24 31
   const onInited = (chart) => chartRef.current = chart;

+ 19
- 11
src/pages/statis/components/DeviceType.jsx 查看文件

@@ -2,6 +2,7 @@ import React from 'react';
2 2
 import * as echarts from 'echarts/core';
3 3
 import icon from '@/assets/images/statistic/设备分类统计.png';
4 4
 import Chart from '@/components/chart';
5
+import { getDeviceType } from '@/services/statis';
5 6
 import StatisCard from './StatisCard';
6 7
 
7 8
 let dataIndex = 0;
@@ -9,19 +10,26 @@ let dataIndex = 0;
9 10
 export default (props) => {
10 11
 
11 12
   const chartRef = React.useRef();
12
-  const option = getOption({ "制餐设备": 20, "运输设备": 33, "野外保障设备": 10 });
13
+  const [option, setOption] = React.useState({});
13 14
 
14 15
   React.useEffect(() => {
15
-    const t = setTimeout(() => {
16
-      const chart = chartRef.current;
17
-      chart.on('mousemove', function(e) {
18
-        chart.dispatchAction({ type: 'downplay', dataIndex });
19
-        chart.dispatchAction({ type: 'highlight', dataIndex: e.dataIndex });
20
-        dataIndex = e.dataIndex
21
-      });
22
-      chart.dispatchAction({ type: 'highlight', dataIndex });
23
-      clearTimeout(t);
24
-    }, 300);
16
+    getDeviceType().then(res => {
17
+      // 转换 [{ name: 'aaa', cnt: 10 }] 为 { 'aa': 10 }
18
+      const dataSource = (res || []).reduce((acc, x) => ({ ...acc, [x.name]: x.cnt }), {})
19
+      setOption(getOption(dataSource));
20
+
21
+      const t = setTimeout(() => {
22
+        const chart = chartRef.current;
23
+        chart.on('mousemove', function(e) {
24
+          chart.dispatchAction({ type: 'downplay', dataIndex });
25
+          chart.dispatchAction({ type: 'highlight', dataIndex: e.dataIndex });
26
+          dataIndex = e.dataIndex
27
+        });
28
+        chart.dispatchAction({ type: 'highlight', dataIndex });
29
+        clearTimeout(t);
30
+      }, 300);
31
+    });
32
+
25 33
   }, []);
26 34
 
27 35
   const onInited = (chart) => chartRef.current = chart;

+ 10
- 1
src/pages/statis/components/Edu.jsx 查看文件

@@ -1,10 +1,19 @@
1 1
 import React from 'react';
2 2
 import * as echarts from 'echarts/core';
3 3
 import Chart from '@/components/chart';
4
+import { getUserEdu } from '@/services/statis';
4 5
 
5 6
 export default (props) => {
6 7
 
7
-  const option = getOption(["本科以上", "本科及大专", "大专以下"], [10, 20, 30]);
8
+  const [option, setOption] = React.useState({});
9
+
10
+  React.useEffect(() => {
11
+    getUserEdu().then(res => {
12
+      const keys = (res || []).map(x => x.name);
13
+      const vals = (res || []).map(x => x.cnt);
14
+      setOption(getOption(keys, vals));
15
+    });
16
+  }, [])
8 17
 
9 18
   return (
10 19
     <Chart option={option} style={{ height: '300px' }} />

+ 41
- 17
src/pages/statis/components/Filter.jsx 查看文件

@@ -5,14 +5,18 @@ import 'moment/locale/zh-cn';
5 5
 import locale from 'antd/es/date-picker/locale/zh_CN';
6 6
 
7 7
 const { RangePicker } = DatePicker;
8
-const radioOptions = [
8
+const radioDateOptions = [
9 9
   { label: '本月', value: '1' },
10 10
   // { label: '本季', value: '2' },
11 11
   { label: '本年', value: '3' },
12 12
 ];
13
+const radioUnitOptions = [
14
+  { label: '按天', value: '1' },
15
+  { label: '按月', value: '2' },
16
+];
13 17
 
14
-export const last30Days = [
15
-  moment().subtract(30, 'days'),
18
+export const lastDays = [
19
+  moment().subtract(15, 'days'),
16 20
   moment(),
17 21
 ];
18 22
 
@@ -30,20 +34,13 @@ export const monthRange = [
30 34
 ]
31 35
 
32 36
 export default (props) => {
33
-  const [dateRange, setDateRange] = React.useState([]);
37
+  const [dateRange, setDateRange] = React.useState(lastDays);
34 38
   const [radioValue, setRadioValue] = React.useState();
35
-
36
-  const onChange = (val) => {
37
-    console.log(val);
38
-    if (typeof props.onChange === 'function') {
39
-      props.onChange(getStrValue(val));
40
-    }
41
-  }
39
+  const [unitValue, setUnitValue] = React.useState('1');
42 40
 
43 41
   const onPickerChange = val => {
44 42
     setDateRange(val);
45 43
     setRadioValue();
46
-    onChange(val);
47 44
   }
48 45
 
49 46
   const onRadioChange = e => {
@@ -59,23 +56,50 @@ export default (props) => {
59 56
         break;
60 57
       case '3':
61 58
         dateRange = yearRange;
59
+        setUnitValue('2');
62 60
         break;
63 61
       default:
64 62
         break;
65 63
     }
66 64
     
67 65
     setDateRange(dateRange);
68
-    onChange(dateRange);
69 66
   }
70 67
 
68
+  const onUnitChange = e => {
69
+    const val = e.target.value;
70
+    setUnitValue(val);
71
+  }
72
+
73
+  React.useEffect(() => {
74
+    if (typeof props.onChange === 'function') {
75
+      const dt = getStrValue(dateRange);
76
+      props.onChange({
77
+        startDate: dt[0],
78
+        endDate: dt[1],
79
+        unit: unitValue,
80
+      });
81
+    }
82
+  }, [dateRange, unitValue, props.onChange]);
83
+
71 84
   return (
72
-    <Row style={{ width: '460px' }} gutter={8}>
73
-      <Col span={14}>
74
-        <RangePicker locale={locale} value={dateRange} onChange={onPickerChange} />
85
+    <Row style={{ width: '500px' }} gutter={8}>
86
+      <Col span={7}>
87
+        {
88
+          !props.hideUnit && (
89
+            <Radio.Group
90
+              options={radioUnitOptions}
91
+              value={unitValue}
92
+              onChange={onUnitChange}
93
+            />
94
+          )
95
+        }
75 96
       </Col>
76 97
       <Col span={10}>
98
+        <RangePicker locale={locale} value={dateRange} onChange={onPickerChange} />
99
+      </Col>
100
+      <Col span={7}>
77 101
         <Radio.Group
78
-          options={radioOptions}
102
+          options={radioDateOptions}
79 103
           value={radioValue}
80 104
           onChange={onRadioChange}
81 105
           optionType="button"

+ 67
- 36
src/pages/statis/components/StoreCost.jsx 查看文件

@@ -1,29 +1,49 @@
1 1
 import React from 'react';
2
-import icon from '@/assets/images/statistic/社会保障机构分类统计.png';
2
+import * as echarts from 'echarts/core';
3
+import icon from '@/assets/images/statistic/任务统计.png';
3 4
 import Chart from '@/components/chart';
5
+import { getStoreCosts } from '@/services/statis';
4 6
 import StatisCard from './StatisCard';
5 7
 import Filter from './Filter';
6 8
 
7 9
 export default (props) => {
8 10
 
9
-  const [year, setYear] = React.useState();
10
-  const option = getOption(["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], [0, 0, 0, 0, 0, 0, 8, 9, 10, 1, 1, 6])
11
+  const [filter, setFilter] = React.useState();
12
+  const [option, setOption] = React.useState({});
13
+  // const option = getOption(["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], [0, 0, 0, 0, 0, 0, 8, 9, 10, 1, 1, 6])
14
+
15
+  React.useEffect(() => {
16
+    if (filter) {
17
+      getStoreCosts(filter).then(res => {
18
+        const { purchase, taskCosts } = res;
19
+
20
+        const keys = (purchase || []).map(x => x.dt);
21
+        const data1 = (purchase || []).map(x => x.price / 100); // 数据返回的单位是 分
22
+        const data2 = (taskCosts || []).map(x => x.price / 100);
23
+  
24
+        const opt = getOption(keys, data1, data2);
25
+        const dataZoom = keys.length > 31 ? { show: true, height: 20, bottom: 6 } : { show: false };
26
+  
27
+        setOption({ ...opt, dataZoom });
28
+      });
29
+    }
30
+  }, [filter]);
11 31
 
12 32
   return (
13 33
     <StatisCard
14 34
       title="成本分析"
15 35
       icon={icon}
16
-      extra={<Filter />}
36
+      extra={<Filter onChange={setFilter} />}
17 37
     >
18 38
       <Chart option={option} style={{ height: '300px' }} />
19 39
     </StatisCard>
20 40
   )
21 41
 }
22 42
 
23
-function getOption(xAxisData, seriesData) {
43
+function getOption(xAxisData, data1, data2) {
24 44
   var axisLabel = {
25 45
     fontSize: 14,
26
-    color: 'rgba(255,255,255, .6)'
46
+    color: 'rgba(255,255,255, .6)',
27 47
   };
28 48
   var lineStyle = {
29 49
     color: 'rgba(255,255,255, .16)',
@@ -31,52 +51,63 @@ function getOption(xAxisData, seriesData) {
31 51
   };
32 52
 
33 53
   return {
54
+    tooltip : {
55
+      trigger: 'axis',
56
+      axisPointer : {
57
+        type : 'shadow'
58
+      },
59
+      valueFormatter: v => `¥ ${v}`
60
+    },
34 61
     xAxis: {
35 62
       type: 'category',
36
-      axisLabel: Object.assign({
37
-        rotate: 45
38
-      }, axisLabel),
63
+      axisLabel: { ...axisLabel, rotate: 45 },
39 64
       axisLine: {
40 65
         show: true,
41 66
         lineStyle: lineStyle
42 67
       },
43 68
       data: xAxisData
44 69
     },
45
-    yAxis: {
46
-      axisLabel: axisLabel,
47
-      axisLine: {
48
-        show: true,
49
-        lineStyle: lineStyle
50
-      },
51
-      splitLine: {
52
-        lineStyle: lineStyle
70
+    yAxis: [
71
+      {
72
+        type: 'value',
73
+        axisLabel: axisLabel,
74
+        axisLine: {
75
+          show: true,
76
+          lineStyle: lineStyle
77
+        },
78
+        splitLine: {
79
+          lineStyle: lineStyle
80
+        },
53 81
       },
54
-      type: 'value'
55
-    },
56
-    tooltip : {
57
-      trigger: 'axis',
58
-      axisPointer : {
59
-        type : 'shadow'
60
-      }
61
-    },
82
+    ],
83
+    // dataZoom: [
84
+    //   {
85
+    //     show: true,
86
+    //   }
87
+    // ],
62 88
     grid: {
63 89
       top: 20,
64 90
       left: 50,
65 91
       right: 20,
66
-      bottom: 70,
92
+      bottom: 100,
67 93
     },
68
-    color: ['#9242D1'],
69
-    animationEasing: 'elasticOut',
70 94
     series: [
71 95
       {
72
-        data: seriesData,
73
-        type: 'pictorialBar',
74
-        barWidth: 16,
75
-        symbol: 'rect',
76
-        symbolRepeat: true,
77
-        animationDuration: 6000,
78
-        animationDelay: function (dataIndex, params) {
79
-          return params.index * 30;
96
+        name: '用料成本',
97
+        data: data1,
98
+        type: 'line',
99
+        smooth: true,
100
+        itemStyle: {
101
+          color: '#1EAED1'
102
+        }
103
+      },
104
+      {
105
+        name: '采购成本',
106
+        data: data2,
107
+        type: 'line',
108
+        smooth: true,
109
+        itemStyle: {
110
+          color: '#6F39B9'
80 111
         }
81 112
       }
82 113
     ]

+ 99
- 0
src/pages/statis/components/StoreType.jsx 查看文件

@@ -0,0 +1,99 @@
1
+import React from 'react';
2
+import icon from '@/assets/images/statistic/社会保障机构分类统计.png';
3
+import Chart from '@/components/chart';
4
+import { getStoreType } from '@/services/statis';
5
+import StatisCard from './StatisCard';
6
+import Filter from './Filter';
7
+
8
+export default (props) => {
9
+
10
+  const [filter, setFilter] = React.useState();
11
+  const [option, setOption] = React.useState({});
12
+
13
+  React.useEffect(() => {
14
+    if (filter) {
15
+      getStoreType(filter).then(res => {
16
+        const keys = (res || []).map(x => x.name);
17
+        const vals = (res || []).map(x => x.cnt);
18
+        
19
+        const dataZoom = res.length > 31 ? { show: true, height: 20, bottom: 6 } : { show: false };
20
+        const opt = getOption(keys, vals);
21
+
22
+        setOption({ ...opt, dataZoom });
23
+      });
24
+    }
25
+  }, [filter]);
26
+
27
+  return (
28
+    <StatisCard
29
+      title="物资分析"
30
+      icon={icon}
31
+      extra={<Filter hideUnit onChange={setFilter} />}
32
+    >
33
+      <Chart option={option} style={{ height: '300px' }} />
34
+    </StatisCard>
35
+  )
36
+}
37
+
38
+function getOption(xAxisData, seriesData) {
39
+  var axisLabel = {
40
+    fontSize: 14,
41
+    color: 'rgba(255,255,255, .6)'
42
+  };
43
+  var lineStyle = {
44
+    color: 'rgba(255,255,255, .16)',
45
+    type: 'dashed'
46
+  };
47
+
48
+  return {
49
+    xAxis: {
50
+      type: 'category',
51
+      axisLabel: Object.assign({
52
+        rotate: 45
53
+      }, axisLabel),
54
+      axisLine: {
55
+        show: true,
56
+        lineStyle: lineStyle
57
+      },
58
+      data: xAxisData
59
+    },
60
+    yAxis: {
61
+      axisLabel: axisLabel,
62
+      axisLine: {
63
+        show: true,
64
+        lineStyle: lineStyle
65
+      },
66
+      splitLine: {
67
+        lineStyle: lineStyle
68
+      },
69
+      type: 'value'
70
+    },
71
+    tooltip : {
72
+      trigger: 'axis',
73
+      axisPointer : {
74
+        type : 'shadow'
75
+      }
76
+    },
77
+    grid: {
78
+      top: 20,
79
+      left: 50,
80
+      right: 20,
81
+      bottom: 70,
82
+    },
83
+    color: ['#9242D1'],
84
+    animationEasing: 'elasticOut',
85
+    series: [
86
+      {
87
+        data: seriesData,
88
+        type: 'pictorialBar',
89
+        barWidth: 16,
90
+        symbol: 'rect',
91
+        symbolRepeat: true,
92
+        animationDuration: 6000,
93
+        animationDelay: function (dataIndex, params) {
94
+          return params.index * 30;
95
+        }
96
+      }
97
+    ]
98
+  }
99
+}

+ 15
- 13
src/pages/statis/components/Task.jsx 查看文件

@@ -4,31 +4,33 @@ import icon from '@/assets/images/statistic/任务统计.png';
4 4
 import Chart from '@/components/chart';
5 5
 import { getTaskInfo } from '@/services/statis';
6 6
 import StatisCard from './StatisCard';
7
-import Filter, { last30Days, getStrValue } from './Filter';
7
+import Filter from './Filter';
8 8
 
9
-const defaultValue = getStrValue(last30Days);
10 9
 export default (props) => {
11 10
 
12
-  const [dateRange, setDateRange] = React.useState(defaultValue);
11
+  const [filter, setFilter] = React.useState();
13 12
   const [option, setOption] = React.useState({});
14 13
   // const option = getOption(["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], [0, 0, 0, 0, 0, 0, 8, 9, 10, 1, 1, 6])
15 14
 
16 15
   React.useEffect(() => {
17
-    getTaskInfo({ startDate: dateRange[0], endDate: dateRange[1] }).then(res => {
18
-      const keys = res.map(x => x.dt);
19
-      const vals = res.map(x => x.cnt);
20
-
21
-      const opt = getOption(keys, vals);
22
-
23
-      setOption(res.length > 30 ? { ...opt, dataZoom: { height: 20, bottom: 6 } } : opt);
24
-    });
25
-  }, [dateRange]);
16
+    if (filter) {
17
+      getTaskInfo(filter).then((res = []) => {
18
+        const keys = res.map(x => x.dt);
19
+        const vals = res.map(x => x.cnt);
20
+  
21
+        const opt = getOption(keys, vals);
22
+        const dataZoom = res.length > 31 ? { show: true, height: 20, bottom: 6 } : { show: false };
23
+  
24
+        setOption({ ...opt, dataZoom });
25
+      });
26
+    }
27
+  }, [filter]);
26 28
 
27 29
   return (
28 30
     <StatisCard
29 31
       title="任务统计"
30 32
       icon={icon}
31
-      extra={<Filter onChange={setDateRange} />}
33
+      extra={<Filter onChange={setFilter} />}
32 34
     >
33 35
       <Chart option={option} style={{ height: '300px' }} />
34 36
     </StatisCard>

+ 1
- 1
src/pages/statis/components/style.global.less 查看文件

@@ -13,7 +13,7 @@
13 13
     border-bottom: none;
14 14
   }
15 15
 
16
-  .ant-picker, .ant-radio-button-wrapper, .ant-picker-separator {
16
+  .ant-picker, .ant-radio-wrapper, .ant-radio-button-wrapper, .ant-picker-separator {
17 17
     background: transparent !important;
18 18
     color: #bbb !important;
19 19
   }

+ 11
- 2
src/pages/stock/edit/index.jsx 查看文件

@@ -26,13 +26,13 @@ export default (props) => {
26 26
     if (id) {
27 27
       // 修改
28 28
       updataStore(id, { ...values }).then((res) => {
29
-        message.success('修改成功');
29
+        // message.success('修改成功');
30 30
         navigate(-1);
31 31
       });
32 32
     } else {
33 33
       // 新增
34 34
       addStore({ ...values }).then((res) => {
35
-        message.success('添加成功');
35
+        // message.success('添加成功');
36 36
         navigate(-1);
37 37
       });
38 38
     }
@@ -91,6 +91,15 @@ export default (props) => {
91 91
             allowClear={false}
92 92
             width={460}
93 93
           />
94
+          <ProFormText
95
+            initialValue={1}
96
+            name="warnAmount"
97
+            label="预警库存"
98
+            extra="库存低于此设置将会自动预警"
99
+            placeholder="请输入预警库存"
100
+            allowClear={false}
101
+            width={460}
102
+          />
94 103
           <ProFormText
95 104
             name="amount"
96 105
             label="库存"

+ 1
- 1
src/pages/stock/list/index.jsx 查看文件

@@ -20,7 +20,7 @@ const StockList = (props) => {
20 20
   const handleDelete = (id) => {
21 21
     if (id) {
22 22
       deleteStore(id).then((res) => {
23
-        message.success('删除成功');
23
+        // message.success('删除成功');
24 24
         actionRef.current.reload();
25 25
       });
26 26
     }

+ 2
- 2
src/pages/stockClassification/edit/index.jsx 查看文件

@@ -24,13 +24,13 @@ export default (props) => {
24 24
     if (id) {
25 25
       // 修改
26 26
       updataStoreType(id, { ...values }).then((res) => {
27
-        message.success('修改成功');
27
+        // message.success('修改成功');
28 28
         navigate(-1);
29 29
       });
30 30
     } else {
31 31
       // 新增;
32 32
       addStoreType({ ...values }).then((res) => {
33
-        message.success('添加成功');
33
+        // message.success('添加成功');
34 34
         navigate(-1);
35 35
       });
36 36
     }

+ 10
- 5
src/pages/stockClassification/list/index.jsx 查看文件

@@ -15,7 +15,7 @@ const StockList = (props) => {
15 15
   const handleDelete = (id) => {
16 16
     if (id) {
17 17
       deleteStoreType(id).then((res) => {
18
-        message.success('删除成功');
18
+        // message.success('删除成功');
19 19
         actionRef.current.reload();
20 20
       });
21 21
     }
@@ -26,17 +26,22 @@ const StockList = (props) => {
26 26
       title: '分类名称',
27 27
       dataIndex: 'name',
28 28
     },
29
-
30 29
     {
31
-      title: '排序',
30
+      title: '是否食材',
32 31
       dataIndex: 'isFood',
33
-      search: false,
34 32
       valueEnum: {
35 33
         1: '是',
36 34
         0: '否',
37 35
       },
38 36
     },
39
-
37
+    {
38
+      title: '是否设备',
39
+      dataIndex: 'isDevice',
40
+      valueEnum: {
41
+        1: '是',
42
+        0: '否',
43
+      },
44
+    },
40 45
     {
41 46
       title: '操作',
42 47
       valueType: 'option',

+ 10
- 12
src/pages/user/Edit.jsx 查看文件

@@ -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="姓名"
@@ -152,17 +152,15 @@ export default (props) => {
152 152
             style={{ width: '100%' }}
153 153
             placeholder="请选择文化程度"
154 154
           >
155
-            <Option value="半文盲">半文盲</Option>
156
-            <Option value="文盲">文盲</Option>
157
-            <Option value="小学">小学</Option>
158
-            <Option value="初中">初中</Option>
159
-            <Option value="高中">高中</Option>
160
-            <Option value="中专">中专</Option>
161
-            <Option value="大专">大专</Option>
162
-            <Option value="本科">本科</Option>
163
-            <Option value="硕士">硕士</Option>
164
-            <Option value="博士">博士</Option>
165
-            <Option value="博士后">博士后</Option>
155
+            <Option value="90">文盲/半文盲</Option>
156
+            <Option value="80">小学</Option>
157
+            <Option value="70">初中</Option>
158
+            <Option value="60">高中</Option>
159
+            <Option value="40">中专</Option>
160
+            <Option value="30">大专</Option>
161
+            <Option value="20">本科</Option>
162
+            <Option value="10">硕士</Option>
163
+            <Option value="1">博士/博士后</Option>
166 164
           </Select>
167 165
         </Form.Item>
168 166
         <Form.Item

+ 1
- 1
src/regulation/edit/index.jsx 查看文件

@@ -24,7 +24,7 @@ export default (props) => {
24 24
 
25 25
     //添加,修改
26 26
     addRegulation({ ...values, id }).then((res) => {
27
-      message.success('成功');
27
+      // message.success('成功');
28 28
       navigate(-1);
29 29
     });
30 30
     return false;

+ 1
- 1
src/regulation/index.jsx 查看文件

@@ -16,7 +16,7 @@ const RegulationList = (props) => {
16 16
   const handleDelete = (id) => {
17 17
     if (id) {
18 18
       deleteRegulation(id).then((res) => {
19
-        message.success('删除成功');
19
+        // message.success('删除成功');
20 20
         actionRef.current.reload();
21 21
       });
22 22
     }

+ 4
- 1
src/routes/menus.jsx 查看文件

@@ -30,7 +30,10 @@ export const getMenuItems = (routes = [], fullPath = '/') => {
30 30
     // 坑爹 react-router v6 不支持 hash 路由的 target 跳转
31 31
     const label = target === '_blank' ?
32 32
       <a href={`${window.location.pathname}#${path}`} target={target}>{title}</a>
33
-      : <Link to={path} target={target}>{title}</Link>;
33
+      : (
34
+        path.indexOf('http') === 0  ? <a href={path} target="_blank">{title}</a>
35
+        : <Link to={path} target={target}>{title}</Link>
36
+      );
34 37
 
35 38
     return Object.assign(
36 39
       {

+ 175
- 127
src/routes/routes.jsx 查看文件

@@ -6,38 +6,39 @@ 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';
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 21
 import GuaranteeTaskEvaluate from "@/pages/evaluate";
22 22
 import GuaranteeTaskEvaluateList from "@/pages/evaluate/evaluateList";
23
-import DishList from '@/pages/dish/list';
24
-import DishEdit from '@/pages/dish/edit';
25
-import PackageList from '@/pages/package/List';
26
-import StockList from '@/pages/stock/list';
27
-import StockEdit from '@/pages/stock/edit';
28
-import StockInOut from '@/pages/stock/outAndIn';
29
-import StockLog from '@/pages/stock/stockLog';
30
-import StockClassificationList from '@/pages/stockClassification/list';
31
-import StockClassificationEdit from '@/pages/stockClassification/edit';
32
-import RotationChartList from '@/pages/rotationChart/list';
33
-import RotationChartEdit from '@/pages/rotationChart/edit';
34
-import RotationChartIntroduction from '@/pages/rotationChart/introduction';
35
-import RotationChartIntroductionEdit from '@/pages/rotationChart/introduction/edit';
36
-import Roles from '@/pages/roles/index';
37
-import RegulationList from '@/regulation';
38
-import RegulationEdit from '@/regulation/edit';
39
-import UserList from '@/pages/user';
40
-import UserEdit from '@/pages/user/Edit';
23
+import DishList from "@/pages/dish/list";
24
+import DishEdit from "@/pages/dish/edit";
25
+import PackageList from "@/pages/package";
26
+import StockList from "@/pages/stock/list";
27
+import StockEdit from "@/pages/stock/edit";
28
+import StockInOut from "@/pages/stock/outAndIn";
29
+import StockLog from "@/pages/stock/stockLog";
30
+import StockClassificationList from "@/pages/stockClassification/list";
31
+import StockClassificationEdit from "@/pages/stockClassification/edit";
32
+import RotationChartList from "@/pages/rotationChart/list";
33
+import RotationChartEdit from "@/pages/rotationChart/edit";
34
+import RotationChartIntroduction from "@/pages/rotationChart/introduction";
35
+import RotationChartIntroductionEdit from "@/pages/rotationChart/introduction/edit";
36
+import RotationChartDetail from "@/pages/rotationChart/detail";
37
+import Roles from "@/pages/roles/index";
38
+import RegulationList from "@/regulation";
39
+import RegulationEdit from "@/regulation/edit";
40
+import UserList from "@/pages/user";
41
+import UserEdit from "@/pages/user/Edit";
41 42
 import PurchasePlanList from "@/pages/purchase/plan/list";
42 43
 import PurchasePlanEdit from "@/pages/purchase/plan/edit";
43 44
 import PurchaseBillEdit from "@/pages/purchase/bill/edit";
@@ -46,9 +47,9 @@ import EmergencyPlanList from "@/pages/cms/emergencyPlan/list";
46 47
 import EmergencyPlanEdit from "@/pages/cms/emergencyPlan/edit";
47 48
 import EmergencyPlanDetail from "@/pages/cms/emergencyPlan/detail";
48 49
 import FilesList from "@/pages/cms/files/list";
49
-import MessageList from '@/pages/message';
50
-import MessageDetail from '@/pages/message/detail';
51
-import StatisCharts from '@/pages/statis/charts';
50
+import MessageList from "@/pages/message";
51
+import MessageDetail from "@/pages/message/detail";
52
+import StatisCharts from "@/pages/statis/charts";
52 53
 
53 54
 /**
54 55
  * meta 用来扩展自定义数据数据
@@ -57,18 +58,29 @@ import StatisCharts from '@/pages/statis/charts';
57 58
  *    hideInMenu: 布尔值, 如果为 false, 菜单不会显示
58 59
  *    noLayout: 布尔值, 如果为 true, 将不会使用默认布局
59 60
  *    noSiderBar: 布尔值, 如果为 true, 将没有左侧菜单栏
60
- *    noFooter: 布尔值, 如果为 true, 将没有底部 footer 
61
+ *    noFooter: 布尔值, 如果为 true, 将没有底部 footer
61 62
  *    target: 字符串, 如果为 _blank, 将在新窗口打开
63
+ *    permission: 对应服务器端权限名称
62 64
  * }
63 65
  */
64 66
 
65 67
 export const authRoutes = [
68
+  {
69
+    path: "static",
70
+    element: <StatisCharts />,
71
+    meta: {
72
+      title: "数据分析",
73
+      noSiderBar: true,
74
+      noFooter: true,
75
+      permission: 'static',
76
+    },
77
+  },
66 78
   {
67 79
     path: "task",
68 80
     element: <Container />,
69 81
     meta: {
70 82
       title: "军供任务",
71
-      icon: <AppstoreOutlined />,
83
+      permission: 'task',
72 84
     },
73 85
     children: [
74 86
       {
@@ -79,7 +91,8 @@ export const authRoutes = [
79 91
         path: "guaranteeTask",
80 92
         element: <GuaranteeTaskList />,
81 93
         meta: {
82
-          title: "任务通报",
94
+          title: "军供通报",
95
+          permission: 'guaranteeTask',
83 96
         },
84 97
       },
85 98
       {
@@ -87,6 +100,7 @@ export const authRoutes = [
87 100
         element: <GuaranteeTaskEdit />,
88 101
         meta: {
89 102
           title: "任务配置",
103
+          permission: 'guaranteeTask.edit',
90 104
         },
91 105
       },
92 106
       {
@@ -97,6 +111,7 @@ export const authRoutes = [
97 111
           noLayout: true,
98 112
           target: "_blank",
99 113
           title: "任务执行",
114
+          permission: 'guaranteeTask.print',
100 115
         },
101 116
       },
102 117
       {
@@ -104,6 +119,7 @@ export const authRoutes = [
104 119
         element: <GuaranteeTaskEvaluate />,
105 120
         meta: {
106 121
           title: "任务评价",
122
+          permission: 'guaranteeTask.evaluate',
107 123
         },
108 124
       },
109 125
       {
@@ -112,16 +128,17 @@ export const authRoutes = [
112 128
         meta: {
113 129
           title: "任务评价",
114 130
           hideInMenu: true,
131
+          permission: 'guaranteeTask.evaluate.list',
115 132
         },
116 133
       },
117 134
     ],
118 135
   },
119 136
   {
120
-    path: "material",
137
+    path: "stock",
121 138
     element: <Container />,
122 139
     meta: {
123
-      title: "物资管理",
124
-      icon: <AppstoreOutlined />,
140
+      title: "库存物资",
141
+      permission: 'stock',
125 142
     },
126 143
     children: [
127 144
       {
@@ -133,6 +150,7 @@ export const authRoutes = [
133 150
         element: <DishList />,
134 151
         meta: {
135 152
           title: "菜肴管理",
153
+          permission: 'dish',
136 154
         },
137 155
       },
138 156
       {
@@ -141,6 +159,7 @@ export const authRoutes = [
141 159
         meta: {
142 160
           hideInMenu: true,
143 161
           title: "菜肴维护",
162
+          permission: 'dish.edit',
144 163
         },
145 164
       },
146 165
       {
@@ -148,34 +167,88 @@ export const authRoutes = [
148 167
         element: <PackageList />,
149 168
         meta: {
150 169
           title: "套餐管理",
170
+          permission: 'package',
171
+        },
172
+      },
173
+      {
174
+        path: "list",
175
+        element: <StockList />,
176
+        meta: {
177
+          title: "库存列表",
178
+          permission: 'stock.list',
179
+        },
180
+      },
181
+      {
182
+        path: "add",
183
+        element: <StockEdit />,
184
+        meta: {
185
+          title: "库存维护",
186
+          permission: 'stock.edit',
151 187
         },
152 188
       },
153 189
     ],
154 190
   },
155 191
   {
156
-    path: "stock",
192
+    path: "purchase",
157 193
     element: <Container />,
158 194
     meta: {
159
-      title: "库存管理",
160
-      icon: <AppstoreOutlined />,
195
+      title: "采购管理",
196
+      permission: 'purchase',
161 197
     },
162 198
     children: [
163 199
       {
164 200
         index: true,
165
-        element: <Navigate to="list" replace />,
201
+        element: <Navigate to="plan/list" replace />,
166 202
       },
167 203
       {
168
-        path: "list",
169
-        element: <StockList />,
204
+        path: "plan/list",
205
+        element: <PurchasePlanList type="plan" />,
170 206
         meta: {
171
-          title: "库存列表",
207
+          title: "采购计划",
208
+          permission: 'purchase.plan',
172 209
         },
173 210
       },
174 211
       {
175
-        path: "add",
176
-        element: <StockEdit />,
212
+        path: "plan/edit",
213
+        element: <PurchasePlanEdit />,
177 214
         meta: {
178
-          title: "库存维护",
215
+          title: "采购计划维护",
216
+          hideInMenu: true,
217
+          permission: 'purchase.plan.edit',
218
+        },
219
+      },
220
+      {
221
+        path: "bill/list",
222
+        element: <PurchasePlanList type="bill" />,
223
+        meta: {
224
+          title: "采购账单",
225
+          permission: 'purchase.bill',
226
+        },
227
+      },
228
+      {
229
+        path: "bill/edit",
230
+        element: <PurchaseBillEdit />,
231
+        meta: {
232
+          title: "采购账单维护",
233
+          hideInMenu: true,
234
+          permission: 'purchase.bill.edit',
235
+        },
236
+      },
237
+      {
238
+        path: "inStore/list",
239
+        element: <PurchasePlanList type="inStore" />,
240
+        meta: {
241
+          title: "采购入库",
242
+          permission: 'purchase.instore',
243
+        },
244
+      },
245
+      {
246
+        path: "inStore/edit",
247
+        element: <PurchaseInStoreEdit />,
248
+        meta: {
249
+          title: "采购详情",
250
+          permission: 'purchase.detail',
251
+          hideInMenu: true,
179 252
         },
180 253
       },
181 254
     ],
@@ -185,6 +258,7 @@ export const authRoutes = [
185 258
     element: <Container />,
186 259
     meta: {
187 260
       title: "公告文件",
261
+      permission: 'cms',
188 262
     },
189 263
     children: [
190 264
       {
@@ -196,13 +270,15 @@ export const authRoutes = [
196 270
         element: <RotationChartIntroductionEdit />,
197 271
         meta: {
198 272
           title: "本站信息",
273
+          permission: 'station',
199 274
         },
200 275
       },
201 276
       {
202 277
         path: "rotationChart/list",
203 278
         element: <RotationChartList />,
204 279
         meta: {
205
-          title: "公告内容",
280
+          title: "公告管理",
281
+          permission: 'rotationChart',
206 282
         },
207 283
       },
208 284
       {
@@ -210,22 +286,34 @@ export const authRoutes = [
210 286
         element: <RotationChartEdit />,
211 287
         meta: {
212 288
           title: "公告维护",
289
+          hideInMenu: true,
290
+          permission: 'rotationChart.edit',
291
+        },
292
+      },
293
+      {
294
+        path: "rotationChart/detail",
295
+        element: <RotationChartDetail />,
296
+        meta: {
297
+          title: "公告详情",
298
+          hideInMenu: true,
299
+          permission: 'rotationChart.detail',
213 300
         },
214 301
       },
215
-
216 302
       {
217
-        path: 'regulation',
303
+        path: "regulation",
218 304
         element: <RegulationList />,
219 305
         meta: {
220 306
           title: "规章制度",
307
+          permission: 'regulation',
221 308
         },
222 309
       },
223 310
       {
224
-        path: 'regulation/add',
311
+        path: "regulation/add",
225 312
         element: <RegulationEdit />,
226 313
         meta: {
227 314
           hideInMenu: true,
228
-          title: '规章制度维护',
315
+          title: "规章制度维护",
316
+          permission: 'regulation.edit',
229 317
         },
230 318
       },
231 319
       {
@@ -233,6 +321,7 @@ export const authRoutes = [
233 321
         element: <EmergencyPlanList />,
234 322
         meta: {
235 323
           title: "应急预案",
324
+          permission: 'emergency-plan',
236 325
         },
237 326
       },
238 327
       {
@@ -241,6 +330,7 @@ export const authRoutes = [
241 330
         meta: {
242 331
           title: "应急预案维护",
243 332
           hideInMenu: true,
333
+          permission: 'emergency-plan.edit',
244 334
         },
245 335
       },
246 336
       {
@@ -249,6 +339,7 @@ export const authRoutes = [
249 339
         meta: {
250 340
           title: "应急预案详情",
251 341
           hideInMenu: true,
342
+          permission: 'emergency-plan.detail',
252 343
         },
253 344
       },
254 345
 
@@ -257,35 +348,43 @@ export const authRoutes = [
257 348
         element: <FilesList />,
258 349
         meta: {
259 350
           title: "文件管理",
351
+          permission: 'files',
260 352
         },
261 353
       },
262 354
     ],
263 355
   },
264
-  {
265
-    path: 'static',
266
-    element: <StatisCharts />,
267
-    meta: {
268
-      title: '数据分析',
269
-      noSiderBar: true,
270
-      noFooter: true,
271
-    },
272
-  },
273 356
   {
274 357
     path: "system",
275 358
     element: <Container />,
276 359
     meta: {
277 360
       title: "系统管理",
361
+      permission: 'system',
278 362
     },
279 363
     children: [
280 364
       {
281 365
         index: true,
282 366
         element: <Navigate to="stockClassification/list" replace />,
283 367
       },
368
+      {
369
+        path: DH_MONITOR,
370
+        element: null,
371
+        meta: {
372
+          title: "大华监控",
373
+        },
374
+      },
375
+      {
376
+        path: DH_MONITOR,
377
+        element: null,
378
+        meta: {
379
+          title: "海康监控",
380
+        },
381
+      },
284 382
       {
285 383
         path: "stockClassification/list",
286 384
         element: <StockClassificationList />,
287 385
         meta: {
288 386
           title: "库存分类",
387
+          permission: 'stockClassification',
289 388
         },
290 389
       },
291 390
       {
@@ -294,13 +393,15 @@ export const authRoutes = [
294 393
         meta: {
295 394
           title: "库存分类维护",
296 395
           hideInMenu: true,
396
+          permission: 'stockClassification.edit',
297 397
         },
298 398
       },
299 399
       {
300 400
         path: "log",
301 401
         element: <StockLog />,
302 402
         meta: {
303
-          title: "操作日志",
403
+          title: "库存日志",
404
+          permission: 'stock.log',
304 405
         },
305 406
       },
306 407
       {
@@ -308,6 +409,7 @@ export const authRoutes = [
308 409
         element: <Roles />,
309 410
         meta: {
310 411
           title: "角色管理",
412
+          permission: 'role',
311 413
         },
312 414
       },
313 415
       {
@@ -315,6 +417,7 @@ export const authRoutes = [
315 417
         element: <UserList />,
316 418
         meta: {
317 419
           title: "用户管理",
420
+          permission: 'user',
318 421
         },
319 422
       },
320 423
       {
@@ -323,6 +426,7 @@ export const authRoutes = [
323 426
         meta: {
324 427
           hideInMenu: true,
325 428
           title: "系统用户编辑",
429
+          permission: 'user.edit',
326 430
         },
327 431
       },
328 432
       {
@@ -330,72 +434,14 @@ export const authRoutes = [
330 434
         element: <MessageList />,
331 435
         meta: {
332 436
           title: "消息列表",
437
+          permission: 'message',
333 438
         },
334 439
       },
335 440
       {
336
-        path: "message/detail",
337
-        element: <MessageDetail />,
338
-        meta: {
339
-          title: "消息详情",
340
-          hideInMenu: true,
341
-        },
342
-      },
343
-    ],
344
-  },
345
-  {
346
-    path: "purchase",
347
-    element: <Container />,
348
-    meta: {
349
-      title: "采购管理",
350
-    },
351
-    children: [
352
-      {
353
-        index: true,
354
-        element: <Navigate to="plan/list" replace />,
355
-      },
356
-      {
357
-        path: "plan/list",
358
-        element: <PurchasePlanList type="plan" />,
359
-        meta: {
360
-          title: "采购计划",
361
-        },
362
-      },
363
-      {
364
-        path: "plan/edit",
365
-        element: <PurchasePlanEdit />,
441
+        path: "foo",
442
+        element: null,
366 443
         meta: {
367
-          title: "采购计划维护",
368
-          hideInMenu: true,
369
-        },
370
-      },
371
-      {
372
-        path: "bill/list",
373
-        element: <PurchasePlanList type="bill" />,
374
-        meta: {
375
-          title: "采购账单",
376
-        },
377
-      },
378
-      {
379
-        path: "bill/edit",
380
-        element: <PurchaseBillEdit />,
381
-        meta: {
382
-          title: "采购账单维护",
383
-          hideInMenu: true,
384
-        },
385
-      },
386
-      {
387
-        path: "inStore/list",
388
-        element: <PurchasePlanList type="inStore" />,
389
-        meta: {
390
-          title: "采购入库",
391
-        },
392
-      },
393
-      {
394
-        path: "inStore/edit",
395
-        element: <PurchaseInStoreEdit />,
396
-        meta: {
397
-          title: "采购入库维护",
398
-          hideInMenu: true,
444
+          title: "操作手册",
399 445
         },
400 446
       },
401 447
     ],
@@ -409,7 +455,7 @@ export const defaultRoutes = [
409 455
     children: [
410 456
       {
411 457
         index: true,
412
-        element: <Home />,
458
+        element: <Navigate to="home" replace />,
413 459
       },
414 460
       {
415 461
         path: "home",
@@ -417,6 +463,8 @@ export const defaultRoutes = [
417 463
         meta: {
418 464
           title: "首页",
419 465
           icon: <DesktopOutlined />,
466
+          noSiderBar: true,
467
+          noFooter: true,
420 468
         },
421 469
       },
422 470
       {

+ 1
- 1
src/services/dish.js 查看文件

@@ -12,7 +12,7 @@ export const getDishList = (params) => request('/dishes', { params,successTip:fa
12 12
  * @param {*} params
13 13
  * @returns
14 14
  */
15
-export const getFoodIngredientsList = (params) => request('/foodIngredients', { params });
15
+export const getFoodIngredientsList = (params) => request('/foodIngredients', { params, successTip: false });
16 16
 
17 17
 /**
18 18
  * 详情

+ 2
- 2
src/services/package.js 查看文件

@@ -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,successTip:false });
8
+export const getPackageList = (params) => request('/package', { params, successTip: false });
9 9
 
10 10
 
11 11
 /**
@@ -36,7 +36,7 @@ export const deletePackage = id => request(`/package/${id}`, { method: 'delete'
36 36
  * @param {*} params 
37 37
  * @returns 
38 38
  */
39
-export const getPackageDetailList = params => request('/packageDetail', { params });
39
+export const getPackageDetailList = params => request('/packageDetail', { params, successTip: false });
40 40
 
41 41
 
42 42
 /**

+ 12
- 7
src/services/rotationChart.js 查看文件

@@ -1,25 +1,27 @@
1
-import request from '@/utils/request';
1
+import request from "@/utils/request";
2 2
 
3 3
 /**
4 4
  * 查询列表
5 5
  * @param {*} params
6 6
  * @returns
7 7
  */
8
-export const getBannerList = (params) => request('/banner', { params });
8
+export const getBannerList = (params) =>
9
+  request("/banner", { params, successTip: false });
9 10
 
10 11
 /**
11 12
  * 详情
12 13
  * @param {*} id
13 14
  * @returns
14 15
  */
15
-export const getBannerdById = (id) => request(`/banner/${id}`);
16
+export const getBannerdById = (id) =>
17
+  request(`/banner/${id}`, { successTip: false });
16 18
 
17 19
 /**
18 20
  * 新增
19 21
  * @param {*} data
20 22
  * @returns
21 23
  */
22
-export const addBanner = (data) => request('/banner', { method: 'post', data });
24
+export const addBanner = (data) => request("/banner", { method: "post", data });
23 25
 
24 26
 /**
25 27
  * 新增
@@ -27,18 +29,21 @@ export const addBanner = (data) => request('/banner', { method: 'post', data });
27 29
  * @param {*} data
28 30
  * @returns
29 31
  */
30
-export const updataBanner = (id, data) => request(`/banner/${id}`, { method: 'put', data });
32
+export const updataBanner = (id, data) =>
33
+  request(`/banner/${id}`, { method: "put", data });
31 34
 
32 35
 /**
33 36
  * 删除
34 37
  * @param {*} id
35 38
  * @returns
36 39
  */
37
-export const deleteBanner = (id) => request(`/banner/${id}`, { method: 'delete' });
40
+export const deleteBanner = (id) =>
41
+  request(`/banner/${id}`, { method: "delete" });
38 42
 
39 43
 /**
40 44
  * 上传文件
41 45
  * @param {*} id
42 46
  * @returns
43 47
  */
44
- export const uploadFile = (data) => request(`/upload`, { method: 'POST', data });
48
+export const uploadFile = (data) =>
49
+  request(`/upload`, { method: "POST", data });

+ 10
- 0
src/services/statis.js 查看文件

@@ -3,3 +3,13 @@ import request from '@/utils/request';
3 3
 export const getSummary = () => request('/statis/summary', { successTip: false });
4 4
 
5 5
 export const getTaskInfo = (params) => request('/statis/taskInfo', { params, successTip: false });
6
+
7
+export const getDeviceType = () => request('/statis/deviceType', { successTip: false });
8
+
9
+export const getStoreType = (params) => request('/statis/deviceType', { params, successTip: false });
10
+
11
+export const getUserEdu = () => request('/statis/userEdu', { successTip: false });
12
+
13
+export const getUserAge = () => request('/statis/userAge', { successTip: false });
14
+
15
+export const getStoreCosts = (params) => request('/statis/store-cost', { params, successTip: false });

+ 14
- 0
src/services/user.js 查看文件

@@ -16,6 +16,20 @@ import request, { restful } from '@/utils/request';
16 16
   * @returns
17 17
   */
18 18
   export const login = (data) => request('/login', { data, method: 'post' });
19
+  
20
+ /**
21
+  * 登出
22
+  * @param {*} 
23
+  * @returns
24
+  */
25
+  export const logout = () => request.post('/logout', { silent: true });
26
+  
27
+ /**
28
+  * 修改密码
29
+  * @param {*} 
30
+  * @returns
31
+  */
32
+  export const changePassword = (data) => request.put('/change-password', data, { successTip: '密码修改成功' });
19 33
 
20 34
 
21 35
   const [

+ 3
- 3
src/store/models/system.js 查看文件

@@ -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 查看文件


+ 3
- 3
src/utils/request.js 查看文件

@@ -10,7 +10,7 @@ const instance = axios.create({
10 10
 // 添加请求拦截器
11 11
 instance.interceptors.request.use(function (config) {
12 12
   const { headers = {}, responseType = 'json', download = false, successTip = true } = config;
13
-  const token = sessionStorage.getItem('token') || '';
13
+  const token = localStorage.getItem('token') || '';
14 14
 
15 15
   // 在发送请求之前做些什么
16 16
   return {
@@ -39,10 +39,10 @@ instance.interceptors.response.use(function (response) {
39 39
   
40 40
   if (data.code === 1000) {
41 41
     if (data.data.token) {
42
-      sessionStorage.setItem('token', data.data.token);
42
+      localStorage.setItem('token', data.data.token);
43 43
     }
44 44
 
45
-    if (config.successTip) {
45
+    if (config.successTip && !config.silent) {
46 46
       message.success(typeof success === 'string' ? successTip : '操作成功');
47 47
     }
48 48
 

+ 2
- 1
vite.config.js 查看文件

@@ -6,10 +6,11 @@ import vitePluginImp from 'vite-plugin-imp'
6 6
 // https://vitejs.dev/config/
7 7
 export default defineConfig({
8 8
   server: {
9
+    host: '0.0.0.0',
9 10
     proxy: {
10 11
       '/api/': {
11 12
         // 要代理的地址
12
-        target: 'http://192.168.89.147:8087',
13
+        target: 'http://127.0.0.1:8087',
13 14
         // 配置了这个可以从 http 代理到 https
14 15
         // 依赖 origin 的功能可能需要这个,比如 cookie
15 16
         changeOrigin: true,