Yansen 2 years ago
parent
commit
b16e246847

+ 61
- 40
src/components/UploadFile/index.jsx View File

@@ -1,64 +1,85 @@
1
-import React, { useCallback, useState } from 'react'
2
-import { UploadOutlined } from '@ant-design/icons';
3
-import { Upload, Button } from 'antd';
4
-import { uploadFile } from '@/services/rotationChart';
1
+import React, { useCallback, useState } from "react";
2
+import { UploadOutlined } from "@ant-design/icons";
3
+import { Upload, Button } from "antd";
4
+import { uploadFile } from "@/services/rotationChart";
5 5
 
6 6
 const customRequest = ({ file, onError, onSuccess }) => {
7 7
   const data = new FormData();
8
-  data.append('file', file);
8
+  data.append("file", file);
9 9
 
10
-  uploadFile(data).then((res) => {
11
-    onSuccess(res.url)
12
-  }).catch((err) => {
13
-    onError(err);
14
-  })
10
+  uploadFile(data)
11
+    .then((res) => {
12
+      onSuccess(res.url);
13
+    })
14
+    .catch((err) => {
15
+      onError(err);
16
+    });
15 17
 
16 18
   return {
17 19
     abort() {
18
-      console.log('upload progress is aborted.');
20
+      console.log("upload progress is aborted.");
19 21
     },
20 22
   };
21
-}
23
+};
22 24
 
23 25
 export default (props) => {
24 26
   const { value, onChange, preview, ...inputProps } = props;
25 27
   const [loading, setLoading] = useState(false);
26 28
 
27
-  const onUpload = useCallback((e) => {
28
-    const { files } = e.target;
29
-    if (!files || files.length < 1) return;
30
-
31
-    setLoading(true);
32
-    const data = new FormData();
33
-    data.append('file', files[0]);
29
+  const onUpload = useCallback(
30
+    (e) => {
31
+      const { files } = e.target;
32
+      if (!files || files.length < 1) return;
34 33
 
35
-    uploadFile(data).then((res) => {
36
-      setLoading(false);
37
-      if (typeof onChange === 'function') {
38
-        onChange(res.url)
39
-      }
40
-    }).catch((err) => {
41
-      setLoading(false);
42
-      // onError(err);
43
-    })
34
+      setLoading(true);
35
+      const data = new FormData();
36
+      data.append("file", files[0]);
44 37
 
45
-  }, [onChange])
38
+      uploadFile(data)
39
+        .then((res) => {
40
+          setLoading(false);
41
+          if (typeof onChange === "function") {
42
+            onChange(res.url);
43
+          }
44
+        })
45
+        .catch((err) => {
46
+          setLoading(false);
47
+          // onError(err);
48
+        });
49
+    },
50
+    [onChange]
51
+  );
46 52
 
47 53
   const onClick = () => {
48
-    const input = document.createElement('input');
49
-    input.type = 'file';
50
-    Object.assign(input, inputProps);    
51
-    input.addEventListener('change', onUpload);
54
+    const input = document.createElement("input");
55
+    input.type = "file";
56
+    Object.assign(input, inputProps);
57
+    input.addEventListener("change", onUpload);
52 58
     // input.removeEventListener('change', onUpload);
53 59
     input.click();
54
-  }
60
+  };
55 61
 
56 62
   return (
57 63
     <div>
58
-      <Button icon={<UploadOutlined />} onClick={onClick}>上传文件</Button>
59
-      {
60
-        value && typeof preview === 'function' && preview(value)
61
-      }
64
+      <Button icon={<UploadOutlined />} onClick={onClick}>
65
+        上传文件
66
+      </Button>
67
+      {value &&
68
+        preview &&
69
+        (typeof preview === "function" ? (
70
+          preview(value)
71
+        ) : (
72
+          <div style={{ marginTop: "1em" }}>
73
+            <a
74
+              href={`${value}`}
75
+              download
76
+              // rel="noopener noreferrer"
77
+              // key="link"
78
+            >
79
+              {value?.substring(value?.lastIndexOf("/") + 1)}
80
+            </a>
81
+          </div>
82
+        ))}
62 83
     </div>
63
-  )
64
-}
84
+  );
85
+};

+ 10
- 6
src/components/Wangeditor/index.jsx View File

@@ -2,6 +2,9 @@ import React, { useState, useEffect } from "react";
2 2
 import "@wangeditor/editor/dist/css/style.css";
3 3
 import { Editor, Toolbar } from "@wangeditor/editor-for-react";
4 4
 
5
+// 工具栏配置参考
6
+// https://www.cnblogs.com/-roc/p/16400965.html
7
+
5 8
 function MyEditor(props) {
6 9
   const {
7 10
     value,
@@ -10,11 +13,9 @@ function MyEditor(props) {
10 13
     },
11 14
     toolbarConfig = {
12 15
       excludeKeys: [
13
-        "insertImage",
14
-        "viewImageLink",
15
-        "editImage",
16
-        "uploadImage",
17
-        "uploadVideo",
16
+
17
+        "group-image",
18
+        "group-video",
18 19
       ],
19 20
     },
20 21
     editorConfig = {
@@ -27,7 +28,10 @@ function MyEditor(props) {
27 28
   console.log(props, "MyEditor");
28 29
   // 模拟 ajax 请求,异步设置 html
29 30
   useEffect(() => {
30
-    console.log(editor     );
31
+    if(editor){
32
+      console.log(editor,editor.getConfig(),editor.getAllMenuKeys(),editor.getMenuConfig('image')) ;
33
+    }
34
+   
31 35
 
32 36
     setHtml(value);
33 37
   }, [value]);

+ 15
- 1
src/pages/cms/emergencyPlan/detail/index.jsx View File

@@ -15,6 +15,7 @@ export default (props) => {
15 15
   const [searchParams] = useSearchParams();
16 16
   const id = searchParams.get("id");
17 17
   const [data, setData] = useState({});
18
+  const [url, setUrl] = useState("");
18 19
   const navigate = useNavigate();
19 20
 
20 21
   const formRef = useRef();
@@ -23,16 +24,29 @@ export default (props) => {
23 24
     if (id) {
24 25
       getPostsDetail(id).then((res) => {
25 26
         setData(res);
27
+        setUrl(res.filesList[0]?.fileAddr);
26 28
       });
27 29
     }
28 30
   }, [id]);
29 31
 
30 32
   return (
31
-    <Card extra={<Button onClick={()=>navigate(-1)}> 返回</Button>}>
33
+    <Card extra={<Button onClick={() => navigate(-1)}> 返回</Button>}>
32 34
       <Title level={2} style={{ marginBottom: "2em" }}>
33 35
         {data.title}
34 36
       </Title>
35 37
       <div dangerouslySetInnerHTML={{ __html: data?.detail }}></div>
38
+      {url && (
39
+        <div style={{marginTop:"2em"}}>
40
+          <a
41
+            href={`${url}`}
42
+            download
43
+            // rel="noopener noreferrer"
44
+            // key="link"
45
+          >
46
+            {url?.substring(url?.lastIndexOf("/") + 1)}
47
+          </a>
48
+        </div>
49
+      )}
36 50
     </Card>
37 51
   );
38 52
 };

+ 31
- 44
src/pages/cms/emergencyPlan/edit/index.jsx View File

@@ -19,21 +19,14 @@ export default (props) => {
19 19
   const navigate = useNavigate();
20 20
 
21 21
   const formRef = useRef();
22
-  // useEffect(() => {
23
-  //   getStoreList({ isDish: 1, pageSize: 9999 }).then((res) => {
24
-  //     setFoodDict(
25
-  //       res?.records?.map((x) => ({
26
-  //         label: x.name,
27
-  //         value: x.id,
28
-  //       }))
29
-  //     );
30
-  //   });
31
-  // }, [id]);
32 22
 
33 23
   useEffect(() => {
34 24
     if (id) {
35 25
       getPostsDetail(id).then((res) => {
36
-        formRef.current.setFieldsValue(res);
26
+        formRef.current.setFieldsValue({
27
+          ...res,
28
+          filesList: res.filesList?.map((x) => x.fileAddr)[0]||null,
29
+        });
37 30
       });
38 31
     }
39 32
   }, [id]);
@@ -41,17 +34,31 @@ export default (props) => {
41 34
   const onFinish = async (values) => {
42 35
     console.log(values, "===");
43 36
 
44
-    if (id) {
45
-      updatePosts(id, { ...values, status: Number(values.status) }).then(
46
-        (res) => {
47
-          navigate(-1);
48
-        }
49
-      );
50
-    } else {
51
-      savePosts({ ...values, status: Number(values.status) }).then((res) => {
52
-        navigate(-1);
53
-      });
54
-    }
37
+    // if (id) {
38
+    //   updatePosts(id, { ...values, status: Number(values.status) }).then(
39
+    //     (res) => {
40
+    //       navigate(-1);
41
+    //     }
42
+    //   );
43
+    // } else {
44
+    savePosts({
45
+      ...values,
46
+      filesList: values.filesList
47
+        ? [
48
+            {
49
+              fileAddr: values.filesList,
50
+              fileName: values.filesList?.substring(
51
+                values.filesList?.lastIndexOf("/") + 1
52
+              ),
53
+            },
54
+          ]
55
+        : null,
56
+      status: Number(values.status),
57
+      ...(id?{id}:{}),
58
+    }).then((res) => {
59
+      navigate(-1);
60
+    });
61
+    // }
55 62
 
56 63
     return false;
57 64
   };
@@ -98,28 +105,8 @@ export default (props) => {
98 105
           >
99 106
             <Wangeditor></Wangeditor>
100 107
           </ProForm.Item>
101
-          <ProForm.Item
102
-            name="file"
103
-            label="文件"
104
-   
105
-           
106
-          >
107
-            <UploadFile
108
-              preview={(value) => {
109
-                return (
110
-                  <div style={{ marginTop: "2em" }}>
111
-                    <a
112
-                      href={value}
113
-                      target="_blank"
114
-                      rel="noopener noreferrer"
115
-                      key="link"
116
-                    >
117
-                      {value}
118
-                    </a>
119
-                  </div>
120
-                );
121
-              }}
122
-            ></UploadFile>
108
+          <ProForm.Item name="filesList" label="文件">
109
+            <UploadFile preview={true}></UploadFile>
123 110
           </ProForm.Item>
124 111
 
125 112
           <ProFormSelect

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

@@ -64,7 +64,7 @@ const EmergencyPlanList = (props) => {
64 64
       width: 200,
65 65
       render: (_, record) => [
66 66
         <Button
67
-          key={3}
67
+          key={4}
68 68
           style={{ padding: 0 }}
69 69
           type="link"
70 70
           onClick={() => {

+ 35
- 34
src/pages/cms/files/list/addFiles.jsx View File

@@ -1,55 +1,56 @@
1
-import { PlusOutlined } from '@ant-design/icons';
1
+import { PlusOutlined } from "@ant-design/icons";
2 2
 import {
3 3
   ModalForm,
4 4
   ProForm,
5 5
   ProFormDateRangePicker,
6 6
   ProFormSelect,
7 7
   ProFormText,
8
-} from '@ant-design/pro-components';
9
-import { Button, Form, message } from 'antd';
8
+} from "@ant-design/pro-components";
9
+import { Button, Form, message } from "antd";
10
+import { getPostsFilesList, savePostsFiles } from "@/services/posts";
11
+import UploadFile from "@/components/UploadFile";
10 12
 
11
-
12
-
13
-export default () => {
13
+export default ({onsuccess=()=>{}}) => {
14 14
   const [form] = Form.useForm();
15 15
 
16
+  const onFinish = async (values) => {
17
+    console.log(values);
18
+    // await waitTime(2000);
16 19
 
17
-  const onFinish = ()=>{
18
-
19
-  }
20
+    await savePostsFiles(values);
21
+    onsuccess()
22
+    return true;
23
+  };
20 24
 
21 25
   return (
22 26
     <ModalForm
23
-      title="新建表单"
24
-      trigger={
25
-        <Button type="primary">
26
-          <PlusOutlined />
27
-          新建表单
28
-        </Button>
29
-      }
27
+      title="新增文件"
28
+      trigger={<Button type="primary">新增</Button>}
30 29
       form={form}
31
-      autoFocusFirstInput
30
+      layout={"horizontal"}
31
+      labelCol={{ span: 8 }}
32
+      wrapperCol={{ span: 12 }}
32 33
       modalProps={{
33 34
         destroyOnClose: true,
34
-        onCancel: () => console.log('run'),
35
+        onCancel: () => console.log("run"),
35 36
       }}
36 37
       submitTimeout={2000}
37
-      onFinish={async (values) => {
38
-        await waitTime(2000);
39
-        console.log(values.name);
40
-        message.success('提交成功');
41
-        return true;
42
-      }}
38
+      onFinish={onFinish}
43 39
     >
44
-    
45
-        <ProFormText
46
-          width="md"
47
-          name="name"
48
-          label="文件名称"
49
-
50
-          placeholder="请输入名称"
51
-        />
52
-
40
+      <ProFormText
41
+        width="md"
42
+        name="fileName"
43
+        label="文件名称"
44
+        rules={[{ required: true, message: "请输入文件名称" }]}
45
+        placeholder="请输入名称"
46
+      />
47
+      <ProForm.Item
48
+        name="fileAddr"
49
+        label="文件"
50
+        rules={[{ required: true, message: "请上传文件" }]}
51
+      >
52
+        <UploadFile preview={true}></UploadFile>
53
+      </ProForm.Item>
53 54
     </ModalForm>
54 55
   );
55
-};
56
+};

+ 26
- 115
src/pages/cms/files/list/index.jsx View File

@@ -1,157 +1,68 @@
1
-import { getPostsList, deletePosts, updatePosts } from "@/services/posts";
1
+import { getPostsFilesList, deletePostsFiles } from "@/services/posts";
2 2
 import { queryTable } from "@/utils/request";
3 3
 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 7
 import { floatMultiply, floatDivide } from "@/utils";
8
-import AddFiles from './addFiles'
8
+import AddFiles from "./addFiles";
9 9
 
10 10
 const FilesList = (props) => {
11
-
12 11
   const [showDetail, setShowDetail] = useState(false);
13 12
   const [activeKey, setActiveKey] = useState("");
14 13
   const actionRef = useRef();
15 14
   const navigate = useNavigate();
16 15
 
17
-
18
-  const updata = (row) => {
19
-    if (row.id) {
20
-      updatePosts(row.id, { status: row.status === 1 ? 0 : 1 }).then((res) => {
21
-        actionRef.current.reload();
22
-      });
23
-    }
24
-  };
25
-
26 16
   const handleDelete = (id) => {
27 17
     if (id) {
28
-      deletePosts(id).then((res) => {
18
+      deletePostsFiles(id).then((res) => {
29 19
         actionRef.current.reload();
30 20
       });
31 21
     }
32 22
   };
33 23
 
34
-  const columns = [
35
-    {
36
-      title: "内容名称",
37
-      dataIndex: "title",
38
-    },
39
-
40
-    {
41
-      title: "状态",
42
-      dataIndex: "status",
43
-      valueType: "select",
44
-      valueEnum: {
45
-        0: { text: "未发布", status: "Error" },
46
-        1: { text: "已发布", status: "Processing" },
47
-      },
48
-    },
49
-    {
50
-      title: "发布人",
51
-      dataIndex: "createPerson",
52
-      search: false,
53
-    },
54
-    {
55
-      title: "操作",
56
-      valueType: "option",
57
-      width: 200,
58
-      render: (_, record) => [
59
-        <Button
60
-          key={3}
61
-          style={{ padding: 0 }}
62
-          type="link"
63
-          onClick={() => {
64
-            updata(record);
65
-          }}
66
-        >
67
-          {record.status === 1 ? "下架" : "发布"}
68
-        </Button>,
69
-        <Button
70
-          key={1}
71
-          style={{ padding: 0 }}
72
-          type="link"
73
-          onClick={() => {
74
-            navigate(`/cms/emergency-plan/detail?id=${record.id}`);
75
-          }}
76
-        >
77
-          详情
78
-        </Button>,
79
-        <Button
80
-          key={2}
81
-          style={{ padding: 0 }}
82
-          type="link"
83
-          onClick={() => {
84
-            navigate(`/cms/emergency-plan/edit?id=${record.id}`);
85
-          }}
86
-        >
87
-          修改
88
-        </Button>,
89
-        <Popconfirm
90
-          key={3}
91
-          title="您是否确认删除 ?"
92
-          onConfirm={() => handleDelete(record.id)}
93
-          okText="确定"
94
-          cancelText="取消"
95
-        >
96
-          {/* manualPush */}
97
-          <Button style={{ padding: 0 }} type="link">
98
-            删除
99
-          </Button>
100
-        </Popconfirm>,
101
-      ],
102
-    },
103
-  ];
104
-
105 24
   return (
106 25
     <PageContainer>
107 26
       <ProList
108 27
         toolBarRender={() => {
109 28
           return [
110
-           <AddFiles />,
29
+            <AddFiles
30
+              onsuccess={() => {
31
+                actionRef.current.reload();
32
+              }}
33
+            />,
111 34
           ];
112 35
         }}
36
+        actionRef={actionRef}
37
+        request={queryTable(getPostsFilesList)}
113 38
         search={{}}
114 39
         rowKey="id"
115 40
         // headerTitle="基础列表"
116
-        pagination={{
117
-          pageSize: 5,
118
-        }}
119
-        showActions="hover"
41
+        pagination={true}
42
+        // showActions="hover"
120 43
         metas={{
121 44
           title: {
122 45
             dataIndex: "fileName",
123 46
             title: "文件名称",
124 47
           },
125
-          description: {
126
-            dataIndex: "title",
127
-            search: false,
128
-          },
48
+
129 49
           actions: {
130 50
             render: (text, row) => [
131
-              <a
132
-                href={row.url}
133
-                target="_blank"
134
-                rel="noopener noreferrer"
135
-                key="link"
136
-              >
137
-                链路
138
-              </a>,
139
-              <a
140
-                href={row.url}
141
-                target="_blank"
142
-                rel="noopener noreferrer"
143
-                key="warning"
144
-              >
145
-                报警
51
+              <a href={row.fileAddr} download>
52
+                下载
146 53
               </a>,
147
-              <a
148
-                href={row.url}
149
-                target="_blank"
150
-                rel="noopener noreferrer"
151
-                key="view"
54
+              <Popconfirm
55
+                key={3}
56
+                title="您是否确认删除 ?"
57
+                onConfirm={() => handleDelete(row.id)}
58
+                okText="确定"
59
+                cancelText="取消"
152 60
               >
153
-                查看
154
-              </a>,
61
+                {/* manualPush */}
62
+                <Button style={{ padding: 0 }} type="link">
63
+                  删除
64
+                </Button>
65
+              </Popconfirm>,
155 66
             ],
156 67
             search: false,
157 68
           },

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

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

+ 117
- 110
src/routes/routes.jsx View File

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

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

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

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

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

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

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

+ 21
- 1
src/services/posts.js View File

@@ -7,4 +7,24 @@ import { restful } from "@/utils/request";
7 7
 const [getPostsList, getPostsDetail, savePosts, updatePosts, deletePosts] =
8 8
   restful("/posts");
9 9
 
10
-export { getPostsList, getPostsDetail, savePosts, updatePosts, deletePosts };
10
+const [
11
+  getPostsFilesList,
12
+  getPostsFilesDetail,
13
+  savePostsFiles,
14
+  updatePostsFiles,
15
+  deletePostsFiles,
16
+] = restful("/postsFiles");
17
+
18
+export {
19
+  getPostsList,
20
+  getPostsDetail,
21
+  savePosts,
22
+  updatePosts,
23
+  deletePosts,
24
+  
25
+  getPostsFilesList,
26
+  getPostsFilesDetail,
27
+  savePostsFiles,
28
+  updatePostsFiles,
29
+  deletePostsFiles,
30
+};

+ 1
- 1
vite.config.js View File

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