Browse Source

增加格式化校验

shaogen1995 11 months ago
parent
commit
64ec169313

+ 12 - 0
.editorconfig

@@ -0,0 +1,12 @@
+root = true # 控制配置文件 .editorconfig 是否生效的字段
+ 
+[**] # 匹配全部文件
+indent_style = space # 缩进风格,可选space|tab
+indent_size = 2 # 缩进的空格数
+charset = utf-8 # 设置字符集
+trim_trailing_whitespace = true # 删除一行中的前后空格
+insert_final_newline = true # 设为true表示使文件以一个空白行结尾
+end_of_line = lf
+ 
+[**.md] # 匹配md文件
+trim_trailing_whitespace = false

+ 11 - 0
.prettierrc.js

@@ -0,0 +1,11 @@
+module.exports = {
+  printWidth: 100, // 一行的字符数,如果超过会进行换行
+  tabWidth: 2, // 一个tab代表几个空格数,默认就是2
+  useTabs: false, // 是否启用tab取代空格符缩进,.editorconfig设置空格缩进,所以设置为false
+  semi: false, // 行尾是否使用分号,默认为true
+  singleQuote: true, // 字符串是否使用单引号
+  trailingComma: "none", // 对象或数组末尾是否添加逗号 none| es5| all
+  jsxSingleQuote: true, // 在jsx里是否使用单引号,你看着办
+  bracketSpacing: true, // 对象大括号直接是否有空格,默认为true,效果:{ foo: bar }
+  arrowParens: "avoid", // 箭头函数如果只有一个参数则省略括号
+};

+ 39 - 0
.vscode/settings.json

@@ -0,0 +1,39 @@
+{
+  "search.exclude": {
+    "/node_modules": true,
+    "dist": true,
+    "pnpm-lock.sh": true
+  },
+  "editor.formatOnSave": true,
+  "[javascript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[javascriptreact]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[typescript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[typescriptreact]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[json]": {
+    "editor.defaultFormatter": "vscode.json-language-features"
+  },
+  "[html]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[markdown]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[css]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[less]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[scss]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "liveServer.settings.port": 5502
+}

+ 1 - 44
src/assets/styles/base.css

@@ -39,7 +39,7 @@ textarea {
 }
 /* 主题色 */
 :root {
-  --themeColor: #9F1927;
+  --themeColor: #9f1927;
 }
 a {
   color: var(--themeColor);
@@ -67,49 +67,6 @@ a {
 #root .ant-btn-text.ant-btn-dangerous {
   color: var(--themeColor);
 }
-#root .ant-pagination .ant-pagination-item {
-  border-radius: 50%;
-  border: 1px solid #999;
-  background-color: transparent;
-}
-#root .ant-pagination .ant-pagination-item-active {
-  background-color: var(--themeColor);
-}
-#root .ant-pagination .ant-pagination-item-active a {
-  color: #fff;
-}
-#root .ant-pagination .ant-pagination-item:hover {
-  background-color: var(--themeColor);
-}
-#root .ant-pagination .ant-pagination-item:hover a {
-  color: #fff;
-}
-#root .ant-pagination-prev {
-  border-radius: 50%;
-  border: 1px solid #999;
-}
-#root .ant-pagination-prev:hover {
-  background-color: var(--themeColor);
-}
-#root .ant-pagination-prev:hover button {
-  color: #fff;
-}
-#root .ant-pagination-next {
-  border-radius: 50%;
-  border: 1px solid #999;
-}
-#root .ant-pagination-next:hover {
-  background-color: var(--themeColor);
-}
-#root .ant-pagination-next:hover button {
-  color: #fff;
-}
-#root .ant-pagination-disabled {
-  border: 1px solid #ccc;
-}
-#root .ant-pagination-disabled:hover {
-  background-color: transparent;
-}
 #root .ant-image {
   display: none !important;
 }

+ 60 - 71
src/assets/styles/base.less

@@ -11,7 +11,8 @@ html {
 }
 
 body {
-  font: 1em/1.4 'Microsoft Yahei', 'PingFang SC', 'Avenir', 'Segoe UI', 'Hiragino Sans GB', 'STHeiti', 'Microsoft Sans Serif', 'WenQuanYi Micro Hei', sans-serif;
+  font: 1em/1.4 'Microsoft Yahei', 'PingFang SC', 'Avenir', 'Segoe UI', 'Hiragino Sans GB',
+    'STHeiti', 'Microsoft Sans Serif', 'WenQuanYi Micro Hei', sans-serif;
   height: 100%;
   color: #333;
 }
@@ -48,7 +49,7 @@ textarea {
 
 /* 主题色 */
 :root {
-  --themeColor: #9F1927;
+  --themeColor: #9f1927;
 }
 
 a {
@@ -59,7 +60,6 @@ a {
   display: none !important;
 }
 
-
 /* 兼容360浏览器的下拉框 */
 .ant-select-selector {
   position: relative;
@@ -82,68 +82,62 @@ a {
     color: var(--themeColor);
   }
 
-
-
   /* antd分页器样式 */
-  .ant-pagination .ant-pagination-item {
-    border-radius: 50%;
-    border: 1px solid #999;
-    background-color: transparent;
-  }
-
-  .ant-pagination .ant-pagination-item-active {
-    background-color: var(--themeColor);
-  }
-
-
-  .ant-pagination .ant-pagination-item-active a {
-    color: #fff;
-  }
-
-  .ant-pagination .ant-pagination-item:hover {
-    background-color: var(--themeColor);
-  }
-
-  .ant-pagination .ant-pagination-item:hover a {
-    color: #fff;
-  }
-
-  .ant-pagination-prev {
-    border-radius: 50%;
-    border: 1px solid #999;
-  }
-
-  .ant-pagination-prev:hover {
-    background-color: var(--themeColor);
-  }
-
-  .ant-pagination-prev:hover button {
-    color: #fff;
-  }
-
-
-
-  .ant-pagination-next {
-    border-radius: 50%;
-    border: 1px solid #999;
-  }
-
-
-  .ant-pagination-next:hover {
-    background-color: var(--themeColor);
-  }
-
-  .ant-pagination-next:hover button {
-    color: #fff;
-  }
-
-  .ant-pagination-disabled {
-    border: 1px solid #ccc;
-  }
-
-  .ant-pagination-disabled:hover {
-    background-color: transparent;
-  }
+  // .ant-pagination .ant-pagination-item {
+  //   border-radius: 50%;
+  //   border: 1px solid #999;
+  //   background-color: transparent;
+  // }
+
+  // .ant-pagination .ant-pagination-item-active {
+  //   background-color: var(--themeColor);
+  // }
+
+  // .ant-pagination .ant-pagination-item-active a {
+  //   color: #fff;
+  // }
+
+  // .ant-pagination .ant-pagination-item:hover {
+  //   background-color: var(--themeColor);
+  // }
+
+  // .ant-pagination .ant-pagination-item:hover a {
+  //   color: #fff;
+  // }
+
+  // .ant-pagination-prev {
+  //   border-radius: 50%;
+  //   border: 1px solid #999;
+  // }
+
+  // .ant-pagination-prev:hover {
+  //   background-color: var(--themeColor);
+  // }
+
+  // .ant-pagination-prev:hover button {
+  //   color: #fff;
+  // }
+
+  // .ant-pagination-next {
+  //   border-radius: 50%;
+  //   border: 1px solid #999;
+  // }
+
+  // .ant-pagination-next:hover {
+  //   background-color: var(--themeColor);
+  // }
+
+  // .ant-pagination-next:hover button {
+  //   color: #fff;
+  // }
+
+  // .ant-pagination-disabled {
+  //   border: 1px solid #ccc;
+  // }
+
+  // .ant-pagination-disabled:hover {
+  //   background-color: transparent;
+  // }
 
   /* antd图片预览组件 */
   .ant-image {
@@ -151,13 +145,8 @@ a {
   }
 }
 
-
-
-
-
-
 /* 找不到页面 */
 .noFindPage {
   opacity: 0;
-  transition: opacity .5s;
-}
+  transition: opacity 0.5s;
+}

+ 107 - 124
src/pages/Layout/index.tsx

@@ -1,92 +1,86 @@
-import { getTokenInfo, removeTokenInfo } from "@/utils/storage";
-import styles from "./index.module.scss";
-import classNames from "classnames";
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
-import { Popconfirm, Button, Modal, Form, Input } from "antd";
-import React from "react";
-import { Route, Switch, useLocation } from "react-router-dom";
-import history from "@/utils/history";
-import SpinLoding from "@/components/SpinLoding";
-import AuthRoute from "@/components/AuthRoute";
-import { Base64 } from "js-base64";
-import encodeStr from "@/utils/pass";
-import {
-  getPowerInfoAPI,
-  getSelectAllAPI,
-  passWordEditAPI,
-} from "@/store/action/login";
-import { useDispatch, useSelector } from "react-redux";
-import { RootState } from "@/store";
-import { MessageFu } from "@/utils/message";
-
-const NotFound = React.lazy(() => import("../../components/NotFound"));
+import { getTokenInfo, removeTokenInfo } from '@/utils/storage'
+import styles from './index.module.scss'
+import classNames from 'classnames'
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { Popconfirm, Button, Modal, Form, Input } from 'antd'
+import React from 'react'
+import { Route, Switch, useLocation } from 'react-router-dom'
+import history from '@/utils/history'
+import SpinLoding from '@/components/SpinLoding'
+import AuthRoute from '@/components/AuthRoute'
+import { Base64 } from 'js-base64'
+import encodeStr from '@/utils/pass'
+import { getPowerInfoAPI, getSelectAllAPI, passWordEditAPI } from '@/store/action/login'
+import { useDispatch, useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+
+const NotFound = React.lazy(() => import('../../components/NotFound'))
 
 function Layout() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   const tabListTemp = useMemo(() => {
     return [
       {
         id: 1,
         done: true,
-        Com: React.lazy(() => import("../Home")),
-        path: "/",
-        name: "首页",
+        Com: React.lazy(() => import('../Home')),
+        path: '/',
+        name: '首页'
       },
       {
         id: 2,
         done: false,
-        Com: React.lazy(() => import("../Object")),
-        path: "/object",
-        name: "馆藏管理",
+        Com: React.lazy(() => import('../Object')),
+        path: '/object',
+        name: '馆藏管理'
       },
       {
         id: 3,
         done: true,
-        Com: React.lazy(() => import("../Stores")),
-        path: "/stores",
-        name: "库房管理",
-      },
-    ];
-  }, []);
+        Com: React.lazy(() => import('../Stores')),
+        path: '/stores',
+        name: '库房管理'
+      }
+    ]
+  }, [])
 
-  const [tabList, setTabList] = useState(tabListTemp);
+  const [tabList, setTabList] = useState(tabListTemp)
 
   // 进页面获取权限信息
   const getPowerInfoAPIFu = useCallback(async () => {
-    const res = await getPowerInfoAPI();
-    const tempArr = res.data.filter((v: any) => v.authority);
+    const res = await getPowerInfoAPI()
+    const tempArr = res.data.filter((v: any) => v.authority)
     // 页面权限信息存到仓库
-    dispatch({ type: "login/setAuthPageArr", payload: tempArr });
+    dispatch({ type: 'login/setAuthPageArr', payload: tempArr })
     // 按钮的权限信息存到仓库
-    const buttonArr = [] as any;
+    const buttonArr = [] as any
     tempArr.forEach((v: any) => {
       v.children.forEach((v2: any) => {
-        if (v2.authority) buttonArr.push(v2);
-      });
-    });
-    dispatch({ type: "login/setAuthButtonArr", payload: buttonArr });
-  }, [dispatch]);
+        if (v2.authority) buttonArr.push(v2)
+      })
+    })
+    dispatch({ type: 'login/setAuthButtonArr', payload: buttonArr })
+  }, [dispatch])
 
   // 获取页面权限信息
-  const powerInfo = useSelector(
-    (state: RootState) => state.loginStore.authPageArr
-  );
+  const powerInfo = useSelector((state: RootState) => state.loginStore.authPageArr)
 
   useEffect(() => {
-    getPowerInfoAPIFu();
-  }, [getPowerInfoAPIFu]);
+    getPowerInfoAPIFu()
+  }, [getPowerInfoAPIFu])
 
   useEffect(() => {
-    const temp = getTokenInfo().user.isAdmin;
+    const temp = getTokenInfo().user.isAdmin
     if (temp === 1 && tabListTemp.length <= 3)
       tabListTemp.push({
         id: 4,
         done: true,
-        Com: React.lazy(() => import("../System")),
-        path: "/system",
-        name: "系统管理",
-      });
+        Com: React.lazy(() => import('../System')),
+        path: '/system',
+        name: '系统管理'
+      })
 
     powerInfo.forEach((v: any) => {
       if (
@@ -97,97 +91,90 @@ function Layout() {
         v.id === 500 ||
         v.id === 600
       ) {
-        tabListTemp[1].done = true;
+        tabListTemp[1].done = true
       }
-    });
+    })
 
-    setTabList(tabListTemp.filter((v) => v.done));
-  }, [powerInfo, tabListTemp]);
+    setTabList(tabListTemp.filter(v => v.done))
+  }, [powerInfo, tabListTemp])
 
-  const location = useLocation();
-  const [path, setPath] = useState("");
+  const location = useLocation()
+  const [path, setPath] = useState('')
 
   useEffect(() => {
-    const arr = location.pathname.split("/");
-    let pathTemp = "/";
-    if (arr[1]) pathTemp = "/" + arr[1];
+    const arr = location.pathname.split('/')
+    let pathTemp = '/'
+    if (arr[1]) pathTemp = '/' + arr[1]
 
-    setPath(pathTemp);
-  }, [location]);
+    setPath(pathTemp)
+  }, [location])
 
   const userInfo = useMemo(() => {
-    return getTokenInfo().user;
-  }, []);
+    return getTokenInfo().user
+  }, [])
 
   // 顶部路由跳转
   const pathCutFu = (path: string) => {
-    history.push(path);
-  };
+    history.push(path)
+  }
 
   // 修改密码相关
-  const [open, setOpen] = useState(false);
+  const [open, setOpen] = useState(false)
 
   // 拿到新密码的输入框的值
-  const oldPasswordValue = useRef("");
+  const oldPasswordValue = useRef('')
 
-  const checkPassWord = (rule: any, value: any = "") => {
-    if (value !== oldPasswordValue.current)
-      return Promise.reject("新密码不一致!");
-    else return Promise.resolve(value);
-  };
+  const checkPassWord = (rule: any, value: any = '') => {
+    if (value !== oldPasswordValue.current) return Promise.reject('新密码不一致!')
+    else return Promise.resolve(value)
+  }
 
   const onFinish = async (values: any) => {
     // 通过校验之后发送请求
-    if (values.oldPassword === values.newPassword)
-      return MessageFu.warning("新旧密码不能相同!");
+    if (values.oldPassword === values.newPassword) return MessageFu.warning('新旧密码不能相同!')
     const obj = {
       oldPassword: encodeStr(Base64.encode(values.oldPassword)),
-      newPassword: encodeStr(Base64.encode(values.newPassword)),
-    };
-    const res: any = await passWordEditAPI(obj);
+      newPassword: encodeStr(Base64.encode(values.newPassword))
+    }
+    const res: any = await passWordEditAPI(obj)
     if (res.code === 0) {
-      MessageFu.success("修改成功!");
-      loginExit();
+      MessageFu.success('修改成功!')
+      loginExit()
     }
-  };
+  }
 
   // 点击退出登录
   const loginExit = () => {
-    removeTokenInfo();
-    history.push("/login");
-  };
+    removeTokenInfo()
+    history.push('/login')
+  }
 
   // 进来获取所有的下拉列表信息
   useEffect(() => {
-    dispatch(getSelectAllAPI());
-  }, [dispatch]);
+    dispatch(getSelectAllAPI())
+  }, [dispatch])
 
   return (
     <div className={styles.Layout}>
-      <div className="topTitle">
-        <div className="main">
-          <div className="logo"></div>
-          <div className="tabCut">
+      <div className='topTitle'>
+        <div className='main'>
+          <div className='logo'></div>
+          <div className='tabCut'>
             {tabList.map((v: any) => (
               <div
                 onClick={() => pathCutFu(v.path)}
-                className={classNames("row", v.path === path ? "active" : "")}
+                className={classNames('row', v.path === path ? 'active' : '')}
                 key={v.id}
               >
                 {v.name}
               </div>
             ))}
           </div>
-          <div className="user">
+          <div className='user'>
             {userInfo.realName}
-            <div className="userSet">
+            <div className='userSet'>
               <span onClick={() => setOpen(true)}>修改密码</span>
-              <Popconfirm
-                title="确定退出吗?"
-                okText="确定"
-                cancelText="取消"
-                onConfirm={loginExit}
-              >
+              <Popconfirm title='确定退出吗?' okText='确定' cancelText='取消' onConfirm={loginExit}>
                 退出登录
               </Popconfirm>
             </div>
@@ -195,7 +182,7 @@ function Layout() {
         </div>
       </div>
       {/* 二级路由页面 */}
-      <div className="pageMain">
+      <div className='pageMain'>
         <React.Suspense fallback={<SpinLoding />}>
           <Switch>
             {tabList.map((v: any, i: number) => (
@@ -206,7 +193,7 @@ function Layout() {
                 component={v.Com}
               />
             ))}
-            <Route path="*" component={NotFound} />
+            <Route path='*' component={NotFound} />
           </Switch>
         </React.Suspense>
       </div>
@@ -214,59 +201,55 @@ function Layout() {
       <Modal
         destroyOnClose
         open={open}
-        title="修改密码"
+        title='修改密码'
         onCancel={() => setOpen(false)}
         footer={
           [] // 设置footer为空,去掉 取消 确定默认按钮
         }
       >
         <Form
-          name="basic"
+          name='basic'
           labelCol={{ span: 5 }}
           wrapperCol={{ span: 16 }}
           onFinish={onFinish}
-          autoComplete="off"
+          autoComplete='off'
         >
           <Form.Item
-            label="旧密码"
-            name="oldPassword"
-            rules={[{ required: true, message: "不能为空!" }]}
+            label='旧密码'
+            name='oldPassword'
+            rules={[{ required: true, message: '不能为空!' }]}
           >
             <Input.Password maxLength={15} />
           </Form.Item>
 
           <Form.Item
-            label="新密码"
-            name="newPassword"
-            rules={[{ required: true, message: "不能为空!" }]}
+            label='新密码'
+            name='newPassword'
+            rules={[{ required: true, message: '不能为空!' }]}
           >
             <Input.Password
               maxLength={15}
-              onChange={(e) => (oldPasswordValue.current = e.target.value)}
+              onChange={e => (oldPasswordValue.current = e.target.value)}
             />
           </Form.Item>
 
-          <Form.Item
-            label="确定新密码"
-            name="checkPass"
-            rules={[{ validator: checkPassWord }]}
-          >
+          <Form.Item label='确定新密码' name='checkPass' rules={[{ validator: checkPassWord }]}>
             <Input.Password maxLength={15} />
           </Form.Item>
 
           <Form.Item wrapperCol={{ offset: 14, span: 16 }}>
             <Button onClick={() => setOpen(false)}>取消</Button>
             &emsp;
-            <Button type="primary" htmlType="submit">
+            <Button type='primary' htmlType='submit'>
               确定
             </Button>
           </Form.Item>
         </Form>
       </Modal>
     </div>
-  );
+  )
 }
 
-const MemoLayout = React.memo(Layout);
+const MemoLayout = React.memo(Layout)
 
-export default MemoLayout;
+export default MemoLayout

+ 205 - 224
src/pages/ObjectSon/Object2/index.tsx

@@ -1,174 +1,170 @@
-import BreadTit from "@/components/BreadTit";
-import { RootState } from "@/store";
-import { Button, Input, Pagination, Select, Table } from "antd";
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
-import { useDispatch, useSelector } from "react-redux";
-import styles from "./index.module.scss";
-import { UnorderedListOutlined, AppstoreOutlined } from "@ant-design/icons";
-import classNames from "classnames";
-import ImageLazy from "@/components/ImageLazy";
-import history from "@/utils/history";
-import { useLocation } from "react-router-dom";
-import dayjs from "dayjs";
-import ExportJsonExcel from "js-export-excel";
-import { getObject2List } from "@/store/action/object2";
-import http from "@/utils/http";
-import { Empty } from "antd";
-import { obj3InStorage } from "@/utils/dataChange";
-import { MessageFu } from "@/utils/message";
-const { Option } = Select;
+import BreadTit from '@/components/BreadTit'
+import { RootState } from '@/store'
+import { Button, Input, Pagination, Select, Table } from 'antd'
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { useDispatch, useSelector } from 'react-redux'
+import styles from './index.module.scss'
+import { UnorderedListOutlined, AppstoreOutlined } from '@ant-design/icons'
+import classNames from 'classnames'
+import ImageLazy from '@/components/ImageLazy'
+import history from '@/utils/history'
+import { useLocation } from 'react-router-dom'
+import dayjs from 'dayjs'
+import ExportJsonExcel from 'js-export-excel'
+import { getObject2List } from '@/store/action/object2'
+import http from '@/utils/http'
+import { Empty } from 'antd'
+import { obj3InStorage } from '@/utils/dataChange'
+import { MessageFu } from '@/utils/message'
+const { Option } = Select
 export default function Object2() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   // 从仓库中获取藏品编号名称下拉数据
-  const options = useSelector(
-    (state: RootState) => state.loginStore.selectAll["藏品编号名称"]
-  );
+  const options = useSelector((state: RootState) => state.loginStore.selectAll['藏品编号名称'])
 
   // 从仓库中获取表格数据(图片展示数据)
-  const results = useSelector((state: RootState) => state.object2Store.info2);
+  const results = useSelector((state: RootState) => state.object2Store.info2)
 
   // 封装发送请求的函数
   const getList = () => {
     const data = {
       ...tableSelect,
       pageNum: pageNumRef.current,
-      searchType: value,
-    };
-    dispatch(getObject2List(data));
+      searchType: value
+    }
+    dispatch(getObject2List(data))
     // console.log("------", data);
-  };
+  }
 
   // 获取地址栏参数
-  const location = useLocation();
+  const location = useLocation()
 
   // 如果有参数 根据参数页码在次发送请求
   useEffect(() => {
-    const urlParam = location.state || {};
-    if (urlParam.k && urlParam.k !== "1")
-      setTableSelect({ ...tableSelect, pageNum: Number(urlParam.k) });
+    const urlParam = location.state || {}
+    if (urlParam.k && urlParam.k !== '1')
+      setTableSelect({ ...tableSelect, pageNum: Number(urlParam.k) })
     // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, [location]);
+  }, [location])
 
   // 筛选表格的数据
   const [tableSelect, setTableSelect] = useState<any>({
     dictNum: null,
-    searchKey: "",
+    searchKey: '',
     pageSize: 10,
-    pageNum: 1,
-  });
+    pageNum: 1
+  })
 
   // 图片页面和列表页面的切换
-  const [cutShow, setCutShow] = useState("cutShow1");
+  const [cutShow, setCutShow] = useState('cutShow1')
 
   // 当前图片查看或者表格查看数据统一
 
-  const cutShowRef = useRef("1");
+  const cutShowRef = useRef('1')
 
   // 进页面如果 d的值为2 切换到表格显示
   useEffect(() => {
-    const urlParam = location.state || {};
-    if (urlParam.d && urlParam.d === "2") {
-      cutShowRef.current = "2";
+    const urlParam = location.state || {}
+    if (urlParam.d && urlParam.d === '2') {
+      cutShowRef.current = '2'
       window.setTimeout(() => {
-        setCutShow("cutShow2");
-      }, 20);
+        setCutShow('cutShow2')
+      }, 20)
     }
-  }, [location.state]);
+  }, [location.state])
 
   const cutShowFu = useCallback((val: string) => {
-    cutShowRef.current = val === "cutShow1" ? "1" : "2";
-    setCutShow(val);
-  }, []);
+    cutShowRef.current = val === 'cutShow1' ? '1' : '2'
+    setCutShow(val)
+  }, [])
 
   // 当前页码统一
-  const pageNumRef = useRef(1);
+  const pageNumRef = useRef(1)
   useEffect(() => {
-    pageNumRef.current = tableSelect.pageNum;
-  }, [tableSelect.pageNum]);
+    pageNumRef.current = tableSelect.pageNum
+  }, [tableSelect.pageNum])
 
   // 防止返回的时候发送了2次请求来对应页码
-  const getListRef = useRef(-1);
+  const getListRef = useRef(-1)
 
   useEffect(() => {
-    clearTimeout(getListRef.current);
+    clearTimeout(getListRef.current)
     getListRef.current = window.setTimeout(() => {
-      getList();
-    }, 100);
+      getList()
+    }, 100)
 
     // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, [tableSelect]);
+  }, [tableSelect])
 
   // 藏品来源下拉框改变
   const handleChange = (val: string) => {
-    setTableSelect({ ...tableSelect, dictNum: val, pageNum: 1 });
-  };
+    setTableSelect({ ...tableSelect, dictNum: val, pageNum: 1 })
+  }
 
   // 搜索输入框下拉
-  const [value, setValue] = useState("name");
+  const [value, setValue] = useState('num')
   const valueChangeFu = (val: string) => {
     if (tableSelect.searchKey) {
       // 根据输入框的值重新发送请求
-      setTableSelect({ ...tableSelect, searchType: val });
+      setTableSelect({ ...tableSelect, searchType: val })
     }
 
-    setValue(val);
-  };
-  const nameTime = useRef(-1);
+    setValue(val)
+  }
+  const nameTime = useRef(-1)
   const nameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
-    clearTimeout(nameTime.current);
+    clearTimeout(nameTime.current)
     nameTime.current = window.setTimeout(() => {
-      setTableSelect({ ...tableSelect, searchKey: e.target.value, pageNum: 1 });
-    }, 500);
-  };
+      setTableSelect({ ...tableSelect, searchKey: e.target.value, pageNum: 1 })
+    }, 500)
+  }
 
   // 关于表格的数据
   const paginationChange = (pageNum: number, pageSize: number) => {
-    setTableSelect({ ...tableSelect, pageNum, pageSize });
-  };
+    setTableSelect({ ...tableSelect, pageNum, pageSize })
+  }
 
   const columns = useMemo(() => {
     return [
       {
-        title: "缩略图",
-        render: (item: any) => (
-          <ImageLazy width={120} height={70} src={item.thumb} />
-        ),
+        title: '缩略图',
+        render: (item: any) => <ImageLazy width={120} height={70} src={item.thumb} />
       },
       {
-        title: "藏品编号名称",
-        dataIndex: "dictNum",
+        title: '藏品编号名称',
+        dataIndex: 'dictNum'
       },
       {
-        title: "藏品编号",
-        render: (item: any) => (item.num ? item.num : "-"),
+        title: '藏品编号',
+        render: (item: any) => (item.num ? item.num : '-')
       },
       {
-        title: "藏品名称",
-        dataIndex: "name",
+        title: '藏品名称',
+        dataIndex: 'name'
       },
       {
-        title: "年代",
-        dataIndex: "dictAge",
+        title: '年代',
+        dataIndex: 'dictAge'
       },
       {
-        title: "质地",
-        dataIndex: "dictTexture",
+        title: '质地',
+        dataIndex: 'dictTexture'
       },
       {
-        title: "展示状态",
-        render: (item: any) => (item.display ? "是" : "否"),
+        title: '展示状态',
+        render: (item: any) => (item.display ? '是' : '否')
       },
       {
-        title: "状态",
-        dataIndex: "storageStatusTxt",
+        title: '状态',
+        dataIndex: 'storageStatusTxt'
       },
       {
-        title: "操作",
+        title: '操作',
         render: (item: any) => (
           <>
             <Button
-              type="text"
+              type='text'
               danger
               onClick={() =>
                 history.push(
@@ -179,48 +175,45 @@ export default function Object2() {
               查看
             </Button>
           </>
-        ),
-      },
-    ];
+        )
+      }
+    ]
     // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, []);
+  }, [])
 
   // 点击导出
   const deriveFu = useCallback(async () => {
-    if (results.list.length === 0)
-      return MessageFu.warning("当前搜索条件没有数据!");
-    const name = dayjs(new Date()).format("YYYYMMDDHHmmss");
-    const res = await http.post("cms/ledger/pageList", {
+    if (results.list.length === 0) return MessageFu.warning('当前搜索条件没有数据!')
+    const name = dayjs(new Date()).format('YYYYMMDDHHmmss')
+    const res = await http.post('cms/ledger/pageList', {
       ...tableSelect,
       pageSize: 9999,
-      searchType: value,
-    });
-    const sheetData = res.data.records;
+      searchType: value
+    })
+    const sheetData = res.data.records
     sheetData.forEach((v: any) => {
       if (v.size && v.size.length) {
-        const sizeArr = v.size.split(",");
-        v.sizeRes = `(通长)${sizeArr[0]}cm;(通宽)${sizeArr[1]}cm;(通高)${sizeArr[2]}cm`;
+        const sizeArr = v.size.split(',')
+        v.sizeRes = `(通长)${sizeArr[0]}cm;(通宽)${sizeArr[1]}cm;(通高)${sizeArr[2]}cm`
       }
-      v.qualityRes = "-";
+      v.qualityRes = '-'
       if (v.quality && v.quality.length) {
-        const qualityArr = v.quality.split(",");
-        v.qualityRes = qualityArr[0] + qualityArr[1];
+        const qualityArr = v.quality.split(',')
+        v.qualityRes = qualityArr[0] + qualityArr[1]
       }
-      v.namePrimitive = v.namePrimitive ? v.namePrimitive : "-";
-      v.num = v.num ? v.num : "-";
-      v.ageSpecific = v.ageSpecific ? v.ageSpecific : "-";
-      v.repair = v.repair ? v.repair : "-";
-      v.checkInYear = v.checkInYear ? v.checkInYear : "-";
-      v.author = v.author ? v.author : "-";
-      v.vision = v.vision ? v.vision : "-";
-      v.onFile = v.onFile ? v.onFile : "-";
-      v.description = v.description ? v.description : "-";
-      v.storageAncestorName = v.storageAncestor
-        ? obj3InStorage(v.storageAncestor)
-        : "-";
-      v.outLocation = v.outLocation ? v.outLocation : "-";
-      v.display = v.display ? "是" : "否";
-    });
+      v.namePrimitive = v.namePrimitive ? v.namePrimitive : '-'
+      v.num = v.num ? v.num : '-'
+      v.ageSpecific = v.ageSpecific ? v.ageSpecific : '-'
+      v.repair = v.repair ? v.repair : '-'
+      v.checkInYear = v.checkInYear ? v.checkInYear : '-'
+      v.author = v.author ? v.author : '-'
+      v.vision = v.vision ? v.vision : '-'
+      v.onFile = v.onFile ? v.onFile : '-'
+      v.description = v.description ? v.description : '-'
+      v.storageAncestorName = v.storageAncestor ? obj3InStorage(v.storageAncestor) : '-'
+      v.outLocation = v.outLocation ? v.outLocation : '-'
+      v.display = v.display ? '是' : '否'
+    })
     const option = {
       fileName: name,
       datas: [
@@ -228,164 +221,152 @@ export default function Object2() {
           sheetData,
           sheetName: name,
           sheetFilter: [
-            "name",
-            "namePrimitive",
-            "dictNum",
-            "num",
-            "dictAge",
-            "dictTexture",
-            "ageSpecific",
-            "dictGoodType",
-            "pcs",
-            "dictLevel",
-            "sizeRes",
-            "sizeSpecific",
-            "dictQualityScope",
-            "qualityRes",
-            "complete",
-            "repair",
-            "dictCheckInScope",
-            "checkInYear",
-            "author",
-            "vision",
-            "onFile",
-            "description",
-            "storageAncestorName",
-            "outLocation",
-            "display",
+            'name',
+            'namePrimitive',
+            'dictNum',
+            'num',
+            'dictAge',
+            'dictTexture',
+            'ageSpecific',
+            'dictGoodType',
+            'pcs',
+            'dictLevel',
+            'sizeRes',
+            'sizeSpecific',
+            'dictQualityScope',
+            'qualityRes',
+            'complete',
+            'repair',
+            'dictCheckInScope',
+            'checkInYear',
+            'author',
+            'vision',
+            'onFile',
+            'description',
+            'storageAncestorName',
+            'outLocation',
+            'display'
           ],
           sheetHeader: [
-            "藏品名称",
-            "原名",
-            "藏品编号名称",
-            "藏品编号",
-            "年代",
-            "文物质地",
-            "具体年代",
-            "文物类别",
-            "实际数量",
-            "文物级别",
-            "外形尺寸",
-            "具体尺寸",
-            "质量范围",
-            "具体质量",
-            "完残程度",
-            "保存状态",
-            "入藏时间范围",
-            "入藏年度",
-            "著者",
-            "版本",
-            "存卷",
-            "来源说明",
-            "入库位置",
-            "出库位置",
-            "展示状态",
+            '藏品名称',
+            '原名',
+            '藏品编号名称',
+            '藏品编号',
+            '年代',
+            '文物质地',
+            '具体年代',
+            '文物类别',
+            '实际数量',
+            '文物级别',
+            '外形尺寸',
+            '具体尺寸',
+            '质量范围',
+            '具体质量',
+            '完残程度',
+            '保存状态',
+            '入藏时间范围',
+            '入藏年度',
+            '著者',
+            '版本',
+            '存卷',
+            '来源说明',
+            '入库位置',
+            '出库位置',
+            '展示状态'
           ],
           columnWidths: [
-            10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-            10, 10, 10, 10, 10, 10, 10,
-          ],
-        },
-      ],
-    };
+            10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+            10, 10
+          ]
+        }
+      ]
+    }
 
-    const toExcel = new ExportJsonExcel(option); //new
-    toExcel.saveExcel(); //保存
-  }, [results.list, tableSelect, value]);
+    const toExcel = new ExportJsonExcel(option) //new
+    toExcel.saveExcel() //保存
+  }, [results.list, tableSelect, value])
 
   return (
     <div className={styles.Object2}>
-      <div className="breadTit">
+      <div className='breadTit'>
         <BreadTit>
-          <div className="breadTitRow active">藏品总账</div>
+          <div className='breadTitRow active'>藏品总账</div>
         </BreadTit>
       </div>
-      <div className="objectSonMain">
+      <div className='objectSonMain'>
         {/* 顶部搜索和筛选 */}
-        <div className="searchBox">
-          <div className="row">
+        <div className='searchBox'>
+          <div className='row'>
             <span>藏品编号名称:</span>
             <Select
-              placeholder="请选择"
+              placeholder='请选择'
               allowClear
               style={{ width: 150 }}
               value={tableSelect.dictNum}
               onChange={handleChange}
               options={options.map((v: any) => ({
                 label: v.name,
-                value: v.name,
+                value: v.name
               }))}
             />
           </div>
-          <div className="row">
+          <div className='row'>
             <span>搜索:</span>
-            <Select
-              style={{ width: 100 }}
-              value={value}
-              onChange={(val) => valueChangeFu(val)}
-            >
-              <Option value="name">藏品名称</Option>
-              <Option value="age">藏品年代</Option>
-              <Option value="texture">藏品质地</Option>
+            <Select style={{ width: 100 }} value={value} onChange={val => valueChangeFu(val)}>
+              <Option value='num'>藏品编号</Option>
+              <Option value='name'>藏品名称</Option>
+              <Option value='age'>藏品年代</Option>
+              <Option value='texture'>藏品质地</Option>
+              {/* num:藏品编号 */}
             </Select>
             <Input
               maxLength={10}
               style={{ width: 150 }}
-              placeholder="请输入"
+              placeholder='请输入'
               allowClear
-              onChange={(e) => nameChange(e)}
+              onChange={e => nameChange(e)}
             />
           </div>
-          <div className="row">
+          <div className='row'>
             <Button onClick={deriveFu}>导出</Button>
           </div>
-          <div className="row">
+          <div className='row'>
             <div
-              onClick={() => cutShowFu("cutShow1")}
-              className={classNames(
-                "cutShow",
-                cutShow === "cutShow1" ? "active" : ""
-              )}
+              onClick={() => cutShowFu('cutShow1')}
+              className={classNames('cutShow', cutShow === 'cutShow1' ? 'active' : '')}
             >
               <AppstoreOutlined />
             </div>
             <div
-              onClick={() => cutShowFu("cutShow2")}
-              className={classNames(
-                "cutShow",
-                "cutShow2",
-                cutShow === "cutShow2" ? "active" : ""
-              )}
+              onClick={() => cutShowFu('cutShow2')}
+              className={classNames('cutShow', 'cutShow2', cutShow === 'cutShow2' ? 'active' : '')}
             >
               <UnorderedListOutlined />
             </div>
           </div>
         </div>
         {/* 图片展示列表 */}
-        <div className="imgList" hidden={cutShow !== "cutShow1"}>
+        <div className='imgList' hidden={cutShow !== 'cutShow1'}>
           {results.list.length ? (
             results.list.map((v: any) => (
               <div
-                title={v.name}
+                title={v.name + ' ' + v.num}
                 onClick={() =>
                   history.push(
                     `/object/2/look?k=${pageNumRef.current}&d=${cutShowRef.current}&id=${v.id}`
                   )
                 }
                 key={v.id}
-                className="imgListRow"
+                className='imgListRow'
               >
-                <ImageLazy
-                  noLook={true}
-                  width={236}
-                  height={200}
-                  src={v.thumb}
-                />
-                <p>{v.name}</p>
+                <ImageLazy noLook={true} width={236} height={200} src={v.thumb} />
+                <p>
+                  {v.name} {v.num}
+                </p>
               </div>
             ))
           ) : (
-            <div className="imgListNone">
+            <div className='imgListNone'>
               <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
             </div>
           )}
@@ -393,18 +374,18 @@ export default function Object2() {
         </div>
 
         {/* 表格展示列表 */}
-        <div className="tableBox" hidden={cutShow !== "cutShow2"}>
+        <div className='tableBox' hidden={cutShow !== 'cutShow2'}>
           <Table
             scroll={{ y: 450 }}
             dataSource={results.list}
             columns={columns}
-            rowKey="id"
+            rowKey='id'
             pagination={false}
           />
         </div>
 
         {/* 从表格里面拆出来的分页 */}
-        <div className="pageBox" hidden={!results.total}>
+        <div className='pageBox' hidden={!results.total}>
           <Pagination
             showQuickJumper
             showSizeChanger
@@ -416,5 +397,5 @@ export default function Object2() {
         </div>
       </div>
     </div>
-  );
+  )
 }

+ 19 - 19
src/store/action/login.ts

@@ -1,48 +1,48 @@
 // import store, { AppDispatch } from ".."
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 用户登录接口
  */
 export const userLoginAPI = (data: any) => {
-  return http.post("admin/login", { ...data });
-};
+  return http.post('admin/login', { ...data })
+}
 
 /**
  * 修改密码接口
  */
 export const passWordEditAPI = (data: any) => {
-  return http.post("sys/user/updatePwd", { ...data });
-};
+  return http.post('sys/user/updatePwd', { ...data })
+}
 
 /**
  * 获取所有下拉列表
  */
-export const getSelectAllAPI = () => {
+export const getSelectAllAPI = (): any => {
   return async (dispatch: AppDispatch) => {
-    const res: any = await http.post("cms/dict/getTree", {});
-    const data: any = res.data;
-    const obj = {} as any;
+    const res: any = await http.post('cms/dict/getTree', {})
+    const data: any = res.data
+    const obj = {} as any
     data.forEach((v: any) => {
-      obj[v.name] = v.children;
-    });
+      obj[v.name] = v.children
+    })
 
     // console.log(123, obj);
-    dispatch({ type: "login/getSelectAll", payload: obj });
-  };
-};
+    dispatch({ type: 'login/getSelectAll', payload: obj })
+  }
+}
 
 /**
  * 首页的审核提醒
  */
 export const getHomeNumsAPI = () => {
-  return http.get("cms/report/remind");
-};
+  return http.get('cms/report/remind')
+}
 
 /**
  * 获取用户权限
  */
 export const getPowerInfoAPI = () => {
-  return http.get("sys/resource/getTreePermissions");
-};
+  return http.get('sys/resource/getTreePermissions')
+}

+ 67 - 67
src/store/action/object1.ts

@@ -1,151 +1,151 @@
-import { statusObj } from "@/utils/dataChange";
-import http from "@/utils/http";
-import { MessageFu } from "@/utils/message";
-import store, { AppDispatch } from "..";
+import { statusObj } from '@/utils/dataChange'
+import http from '@/utils/http'
+import { MessageFu } from '@/utils/message'
+import store, { AppDispatch } from '..'
 
 /**
  * 藏品登记页面点击新增
  */
 export const object1AddAPI = (data?: any) => {
-  return http.post("cms/register/save", { ...data });
-};
+  return http.post('cms/register/save', { ...data })
+}
 
 /**
  * 藏品登记页面上传封面图和附件
  */
 
 // 上传附件的进度条
-const UpAsyncLodingDom: any = document.querySelector("#UpAsyncLoding");
-const progressDom: any = document.querySelector("#progress");
+const UpAsyncLodingDom: any = document.querySelector('#UpAsyncLoding')
+const progressDom: any = document.querySelector('#progress')
 
 export const object1AddUpFileAPI = (data: any) => {
-  UpAsyncLodingDom.style.opacity = 1;
+  UpAsyncLodingDom.style.opacity = 1
 
-  return http.post("cms/register/goods/file/upload", data, {
+  return http.post('cms/register/goods/file/upload', data, {
     timeout: 30000,
     // 显示进度条
     onUploadProgress: (e: any) => {
-      const complete = (e.loaded / e.total) * 100 || 0;
-      progressDom.style.width = complete + "%";
-    },
-  });
-};
+      const complete = (e.loaded / e.total) * 100 || 0
+      progressDom.style.width = complete + '%'
+    }
+  })
+}
 
 /**
  * 里面的一条藏品添加
  */
-export const goodsSonAddAPI = (data: any, id: any) => {
+export const goodsSonAddAPI = (data: any, id: any): any => {
   return async (dispatch: AppDispatch) => {
-    const res: any = await http.post("cms/register/goods/save", data);
+    const res: any = await http.post('cms/register/goods/save', data)
 
     if (res.code === 0) {
-      const oldData = store.getState().loginStore.goodsTableList;
-      MessageFu.success("操作成功!");
-      let newData;
+      const oldData = store.getState().loginStore.goodsTableList
+      MessageFu.success('操作成功!')
+      let newData
       if (id) {
         // 是编辑 覆盖之前的数据
         newData = oldData.map((v: any) => {
-          if (v.id === id) return res.data;
-          else return v;
-        });
-      } else newData = [res.data, ...oldData]; // 是新增,在前面添加一条数据
-      dispatch({ type: "login/setGoodsSonList", payload: newData });
+          if (v.id === id) return res.data
+          else return v
+        })
+      } else newData = [res.data, ...oldData] // 是新增,在前面添加一条数据
+      dispatch({ type: 'login/setGoodsSonList', payload: newData })
     }
-  };
-};
+  }
+}
 
 /**
  * 获取藏品登记列表信息
  */
-export const getObject1List = (data: any) => {
+export const getObject1List = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/register/pageList", data);
-    const list = res.data.records;
+    const res: any = await http.post('cms/register/pageList', data)
+    const list = res.data.records
     list.forEach((v: any) => {
-      v.statusTxt = statusObj[v.status];
-    });
+      v.statusTxt = statusObj[v.status]
+    })
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "object1/getList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'object1/getList', payload: obj })
+  }
+}
 
 /**
  * 获取藏品登记列表顶部数字信息
  */
-export const getObject1ListNum = () => {
+export const getObject1ListNum = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get("cms/register/countByStatus");
+    const res: any = await http.get('cms/register/countByStatus')
 
     const data = [
-      { id: null, name: "全部", num: res.data.all ? res.data.all : 0 },
-      { id: 0, name: "待办理", num: res.data[0] ? res.data[0] : 0 },
-      { id: 1, name: "待审核", num: res.data[1] ? res.data[1] : 0 },
-      { id: 2, name: "审核不通过", num: res.data[2] ? res.data[2] : 0 },
-      { id: 3, name: "已完成", num: res.data[3] ? res.data[3] : 0 },
-    ];
-    dispatch({ type: "object1/getListNum", payload: data });
-  };
-};
+      { id: null, name: '全部', num: res.data.all ? res.data.all : 0 },
+      { id: 0, name: '待办理', num: res.data[0] ? res.data[0] : 0 },
+      { id: 1, name: '待审核', num: res.data[1] ? res.data[1] : 0 },
+      { id: 2, name: '审核不通过', num: res.data[2] ? res.data[2] : 0 },
+      { id: 3, name: '已完成', num: res.data[3] ? res.data[3] : 0 }
+    ]
+    dispatch({ type: 'object1/getListNum', payload: data })
+  }
+}
 
 /**
  * 删除外层表格数据
  */
 export const object1DelAPI = (id: number) => {
-  return http.get(`cms/register/remove/${id}`);
-};
+  return http.get(`cms/register/remove/${id}`)
+}
 
 /**
  * 通过id获取信息
  */
 export const object1infoOutAPI = (id: number) => {
-  return http.get(`cms/register/detail/${id}`);
-};
+  return http.get(`cms/register/detail/${id}`)
+}
 /**
  * 通过id获取表格信息
  */
 export const getObj1InfoTableAPI2 = (id: number) => {
-  return http.get(`cms/register/goods/list/${id}`);
-};
+  return http.get(`cms/register/goods/list/${id}`)
+}
 /**
  * 通过id获取表格信息
  */
-export const getObj1InfoTableAPI = (id: number) => {
+export const getObj1InfoTableAPI = (id: number): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get(`cms/register/goods/list/${id}`);
-    dispatch({ type: "login/setGoodsSonList", payload: res.data });
-  };
-};
+    const res: any = await http.get(`cms/register/goods/list/${id}`)
+    dispatch({ type: 'login/setGoodsSonList', payload: res.data })
+  }
+}
 
 /**
  * 删除里面的表格藏品 s
  */
 export const delInTablesAPI = (ids: string) => {
-  return http.get(`cms/register/goods/removes/${ids}`);
-};
+  return http.get(`cms/register/goods/removes/${ids}`)
+}
 
 /**
  * 删除最里面的附件或者封面图 s
  */
 export const delInfileAPI = (ids: string) => {
-  return http.get(`cms/register/goods/file/dels/${ids}`);
-};
+  return http.get(`cms/register/goods/file/dels/${ids}`)
+}
 
 /**
  * 通过id获取里面的藏品详情
  */
 export const getInfoInAPI = (id: number) => {
-  return http.get(`cms/register/goods/detail/${id}`);
-};
+  return http.get(`cms/register/goods/detail/${id}`)
+}
 
 /**
  * 审核藏品信息
  */
 export const auditObject1API = (data: any) => {
-  return http.post("cms/register/audit", data);
-};
+  return http.post('cms/register/audit', data)
+}

+ 26 - 26
src/store/action/object2.ts

@@ -1,58 +1,58 @@
-import { storageStatusObj } from "@/utils/dataChange";
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import { storageStatusObj } from '@/utils/dataChange'
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 获取藏品登记列表信息
  */
-export const getObject2List = (data: any) => {
+export const getObject2List = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/ledger/pageList", data);
-    const list = res.data.records;
+    const res: any = await http.post('cms/ledger/pageList', data)
+    const list = res.data.records
     list.forEach((v: any) => {
-      v.storageStatusTxt = storageStatusObj[v.storageStatus];
-    });
+      v.storageStatusTxt = storageStatusObj[v.storageStatus]
+    })
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "object2/getList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'object2/getList', payload: obj })
+  }
+}
 
 /**
  * 通过id获取藏品总账详情
  */
 export const getObj2InfoInAPI = (id: number) => {
-  return http.get(`cms/ledger/detail/${id}`);
-};
+  return http.get(`cms/ledger/detail/${id}`)
+}
 
 /**
  * 藏品总账里面修改藏品
  */
 export const editObj2GoodsAPI = (data: any) => {
-  return http.post("cms/edit/save", data);
-};
+  return http.post('cms/edit/save', data)
+}
 
 /**
  * 藏品总账里面的申请移库
  */
 export const editObj2StoresAPI = (data: any) => {
-  return http.post("cms/move/save", data);
-};
+  return http.post('cms/move/save', data)
+}
 
 /**
  * 藏品总账里面的操作记录
  */
-export const getObj2LogListAPI = (data: any) => {
+export const getObj2LogListAPI = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/ledger/order/pageList", data);
+    const res: any = await http.post('cms/ledger/order/pageList', data)
     const obj = {
       list: res.data.records,
-      total: res.data.total,
-    };
-    dispatch({ type: "object2/getLogList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'object2/getLogList', payload: obj })
+  }
+}

+ 36 - 37
src/store/action/object3.ts

@@ -1,81 +1,80 @@
-import { statusObj } from "@/utils/dataChange";
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import { statusObj } from '@/utils/dataChange'
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 获取藏品登记列表信息
  */
-export const getObject3List = (data: any) => {
+export const getObject3List = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/in/pageList", data);
-    const list = res.data.records;
+    const res: any = await http.post('cms/in/pageList', data)
+    const list = res.data.records
     list.forEach((v: any) => {
-      v.statusTxt = statusObj[v.status];
-    });
+      v.statusTxt = statusObj[v.status]
+    })
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "object3/getList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'object3/getList', payload: obj })
+  }
+}
 
 /**
  * 获取藏品登记列表顶部数字信息
  */
-export const getObject3ListNum = () => {
+export const getObject3ListNum = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get("cms/in/countByStatus");
+    const res: any = await http.get('cms/in/countByStatus')
 
     const data = [
-      { id: null, name: "全部", num: res.data.all ? res.data.all : 0 },
+      { id: null, name: '全部', num: res.data.all ? res.data.all : 0 },
       // { id: 0, name: "待办理", num: res.data[0] ? res.data[0] : 0 },
-      { id: 1, name: "待审核", num: res.data[1] ? res.data[1] : 0 },
-      { id: 2, name: "审核不通过", num: res.data[2] ? res.data[2] : 0 },
-      { id: 3, name: "已完成", num: res.data[3] ? res.data[3] : 0 },
-    ];
-    dispatch({ type: "object3/getListNum", payload: data });
-  };
-};
+      { id: 1, name: '待审核', num: res.data[1] ? res.data[1] : 0 },
+      { id: 2, name: '审核不通过', num: res.data[2] ? res.data[2] : 0 },
+      { id: 3, name: '已完成', num: res.data[3] ? res.data[3] : 0 }
+    ]
+    dispatch({ type: 'object3/getListNum', payload: data })
+  }
+}
 
 /**
  * 删除外层表格数据
  */
 export const object3DelAPI = (id: number) => {
-  return http.get(`cms/in/remove/${id}`);
-};
+  return http.get(`cms/in/remove/${id}`)
+}
 
 /**
  * 通过id获取信息
  */
 export const object3infoOutAPI = (id: number) => {
-  return http.get(`cms/in/detail/${id}`);
-};
+  return http.get(`cms/in/detail/${id}`)
+}
 
 /**
  * 进新增页面发送请求
  */
 export const object3AddAPI = (data?: any) => {
-  return http.post("cms/in/save", { ...data });
-};
+  return http.post('cms/in/save', { ...data })
+}
 
 /**
  * 点击新增或者编辑里面的添加按钮的所有藏品列表
  */
-export const getGoodsListAllAPI = (val: any) => {
+export const getGoodsListAllAPI = (val: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get(`cms/in/goods/list?searchKey=${val}`);
-    dispatch({ type: "object3/setGoodsListAll", payload: res.data });
-  };
-};
+    const res: any = await http.get(`cms/in/goods/list?searchKey=${val}`)
+    dispatch({ type: 'object3/setGoodsListAll', payload: res.data })
+  }
+}
 
 /**
  * 审核入库信息
  */
 export const auditObject3API = (data: any) => {
-  return http.post("cms/in/audit", data);
-};
-
+  return http.post('cms/in/audit', data)
+}

+ 39 - 39
src/store/action/object4.ts

@@ -1,88 +1,88 @@
-import { statusObjCK } from "@/utils/dataChange";
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import { statusObjCK } from '@/utils/dataChange'
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 获取藏品登记列表信息
  */
-export const getObject4List = (data: any) => {
+export const getObject4List = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/out/pageList", data);
-    const list = res.data.records;
+    const res: any = await http.post('cms/out/pageList', data)
+    const list = res.data.records
     list.forEach((v: any) => {
-      v.statusTxt = statusObjCK[v.status];
-    });
+      v.statusTxt = statusObjCK[v.status]
+    })
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "object4/getList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'object4/getList', payload: obj })
+  }
+}
 
 /**
  * 获取藏品登记列表顶部数字信息
  */
-export const getObject4ListNum = () => {
+export const getObject4ListNum = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get("cms/out/countByStatus");
+    const res: any = await http.get('cms/out/countByStatus')
 
     const data = [
-      { id: null, name: "全部", num: res.data.all ? res.data.all : 0 },
+      { id: null, name: '全部', num: res.data.all ? res.data.all : 0 },
       // { id: 0, name: "待办理", num: res.data[0] ? res.data[0] : 0 },
-      { id: 1, name: "待审核", num: res.data[1] ? res.data[1] : 0 },
-      { id: 2, name: "审核不通过", num: res.data[2] ? res.data[2] : 0 },
-      { id: 3, name: "待归还", num: res.data[3] ? res.data[3] : 0 },
-      { id: 4, name: "已归还", num: res.data[4] ? res.data[4] : 0 },
-    ];
-    dispatch({ type: "object4/getListNum", payload: data });
-  };
-};
+      { id: 1, name: '待审核', num: res.data[1] ? res.data[1] : 0 },
+      { id: 2, name: '审核不通过', num: res.data[2] ? res.data[2] : 0 },
+      { id: 3, name: '待归还', num: res.data[3] ? res.data[3] : 0 },
+      { id: 4, name: '已归还', num: res.data[4] ? res.data[4] : 0 }
+    ]
+    dispatch({ type: 'object4/getListNum', payload: data })
+  }
+}
 
 /**
  * 删除外层表格数据
  */
 export const object4DelAPI = (id: number) => {
-  return http.get(`cms/out/remove/${id}`);
-};
+  return http.get(`cms/out/remove/${id}`)
+}
 
 /**
  * 通过id获取信息
  */
 export const object4infoOutAPI = (id: number) => {
-  return http.get(`cms/out/detail/${id}`);
-};
+  return http.get(`cms/out/detail/${id}`)
+}
 
 /**
  * 进新增页面发送请求
  */
 export const object4AddAPI = (data?: any) => {
-  return http.post("cms/out/save", { ...data });
-};
+  return http.post('cms/out/save', { ...data })
+}
 
 /**
  * 点击新增或者编辑里面的添加按钮的所有藏品列表
  */
-export const getGoodsListAllAPI = (val: any) => {
+export const getGoodsListAllAPI = (val: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get(`cms/out/goods/list?searchKey=${val}`);
-    dispatch({ type: "object4/setGoodsListAll", payload: res.data });
-  };
-};
+    const res: any = await http.get(`cms/out/goods/list?searchKey=${val}`)
+    dispatch({ type: 'object4/setGoodsListAll', payload: res.data })
+  }
+}
 
 /**
  * 审核入库信息
  */
 export const auditObject4API = (data: any) => {
-  return http.post("cms/out/audit", data);
-};
+  return http.post('cms/out/audit', data)
+}
 
 /**
  * 出库查看页面的归还
  */
 export const returnObject4API = (data: any) => {
-  return http.post("cms/out/goodsReturn", data);
-};
+  return http.post('cms/out/goodsReturn', data)
+}

+ 30 - 33
src/store/action/object5.ts

@@ -1,65 +1,62 @@
-import { statusObj } from "@/utils/dataChange";
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import { statusObj } from '@/utils/dataChange'
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 获取藏品登记列表信息
  */
-export const getObject5List = (data: any) => {
+export const getObject5List = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/edit/pageList", data);
-    const list = res.data.records;
+    const res: any = await http.post('cms/edit/pageList', data)
+    const list = res.data.records
     list.forEach((v: any) => {
-      v.statusTxt = statusObj[v.status];
-    });
+      v.statusTxt = statusObj[v.status]
+    })
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "object5/getList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'object5/getList', payload: obj })
+  }
+}
 
 /**
  * 获取藏品登记列表顶部数字信息
  */
-export const getObject5ListNum = () => {
+export const getObject5ListNum = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get("cms/edit/countByStatus");
-    
+    const res: any = await http.get('cms/edit/countByStatus')
+
     const data = [
-      { id: null, name: "全部", num: res.data.all ? res.data.all : 0 },
+      { id: null, name: '全部', num: res.data.all ? res.data.all : 0 },
       // { id: 0, name: "待办理", num: res.data[0] ? res.data[0] : 0 },
-      { id: 1, name: "待审核", num: res.data[1] ? res.data[1] : 0 },
-      { id: 2, name: "审核不通过", num: res.data[2] ? res.data[2] : 0 },
-      { id: 3, name: "已完成", num: res.data[3] ? res.data[3] : 0 },
-    ];
-    dispatch({ type: "object5/getListNum", payload: data });
-  };
-};
+      { id: 1, name: '待审核', num: res.data[1] ? res.data[1] : 0 },
+      { id: 2, name: '审核不通过', num: res.data[2] ? res.data[2] : 0 },
+      { id: 3, name: '已完成', num: res.data[3] ? res.data[3] : 0 }
+    ]
+    dispatch({ type: 'object5/getListNum', payload: data })
+  }
+}
 
 /**
  * 删除外层表格数据
  */
 export const object5DelAPI = (id: number) => {
-  return http.get(`cms/edit/remove/${id}`);
-};
+  return http.get(`cms/edit/remove/${id}`)
+}
 
 /**
  * 通过id获取信息
  */
 export const object5infoOutAPI = (id: number) => {
-  return http.get(`cms/edit/detail/${id}`);
-};
-
-
+  return http.get(`cms/edit/detail/${id}`)
+}
 
 /**
  * 审核入库信息
  */
 export const auditObject5API = (data: any) => {
-  return http.post("cms/edit/audit", data);
-};
-
+  return http.post('cms/edit/audit', data)
+}

+ 36 - 37
src/store/action/object6.ts

@@ -1,81 +1,80 @@
-import { statusObj } from "@/utils/dataChange";
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import { statusObj } from '@/utils/dataChange'
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 获取藏品登记列表信息
  */
-export const getObject6List = (data: any) => {
+export const getObject6List = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/cancel/pageList", data);
-    const list = res.data.records;
+    const res: any = await http.post('cms/cancel/pageList', data)
+    const list = res.data.records
     list.forEach((v: any) => {
-      v.statusTxt = statusObj[v.status];
-    });
+      v.statusTxt = statusObj[v.status]
+    })
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "object6/getList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'object6/getList', payload: obj })
+  }
+}
 
 /**
  * 获取藏品登记列表顶部数字信息
  */
-export const getObject6ListNum = () => {
+export const getObject6ListNum = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get("cms/cancel/countByStatus");
+    const res: any = await http.get('cms/cancel/countByStatus')
 
     const data = [
-      { id: null, name: "全部", num: res.data.all ? res.data.all : 0 },
+      { id: null, name: '全部', num: res.data.all ? res.data.all : 0 },
       // { id: 0, name: "待办理", num: res.data[0] ? res.data[0] : 0 },
-      { id: 1, name: "待审核", num: res.data[1] ? res.data[1] : 0 },
-      { id: 2, name: "审核不通过", num: res.data[2] ? res.data[2] : 0 },
-      { id: 3, name: "已完成", num: res.data[3] ? res.data[3] : 0 },
-    ];
-    dispatch({ type: "object6/getListNum", payload: data });
-  };
-};
+      { id: 1, name: '待审核', num: res.data[1] ? res.data[1] : 0 },
+      { id: 2, name: '审核不通过', num: res.data[2] ? res.data[2] : 0 },
+      { id: 3, name: '已完成', num: res.data[3] ? res.data[3] : 0 }
+    ]
+    dispatch({ type: 'object6/getListNum', payload: data })
+  }
+}
 
 /**
  * 删除外层表格数据
  */
 export const object6DelAPI = (id: number) => {
-  return http.get(`cms/cancel/remove/${id}`);
-};
+  return http.get(`cms/cancel/remove/${id}`)
+}
 
 /**
  * 通过id获取信息
  */
 export const object6infoOutAPI = (id: number) => {
-  return http.get(`cms/cancel/detail/${id}`);
-};
+  return http.get(`cms/cancel/detail/${id}`)
+}
 
 /**
  * 进新增页面发送请求
  */
 export const object6AddAPI = (data?: any) => {
-  return http.post("cms/cancel/save", { ...data });
-};
+  return http.post('cms/cancel/save', { ...data })
+}
 
 /**
  * 点击新增或者编辑里面的添加按钮的所有藏品列表
  */
-export const getGoodsListAllAPI = (val: any) => {
+export const getGoodsListAllAPI = (val: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get(`cms/cancel/goods/list?searchKey=${val}`);
-    dispatch({ type: "object6/setGoodsListAll", payload: res.data });
-  };
-};
+    const res: any = await http.get(`cms/cancel/goods/list?searchKey=${val}`)
+    dispatch({ type: 'object6/setGoodsListAll', payload: res.data })
+  }
+}
 
 /**
  * 审核入库信息
  */
 export const auditObject6API = (data: any) => {
-  return http.post("cms/cancel/audit", data);
-};
-
+  return http.post('cms/cancel/audit', data)
+}

+ 22 - 22
src/store/action/stores1.ts

@@ -1,59 +1,59 @@
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 新建或编辑 库区  库房  货架
  */
-export const stores1AddAPI = (data: any) => {
-  return http.post("cms/storage/save", data);
-};
+export const stores1AddAPI = (data: any): any => {
+  return http.post('cms/storage/save', data)
+}
 
 /**
  * 获取库房列表
  */
-export const getStores1ListAPI = () => {
+export const getStores1ListAPI = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.get("cms/storage/getTree");
-    dispatch({ type: "stores1/getInfoList", payload: res.data });
-  };
-};
+    const res: any = await http.get('cms/storage/getTree')
+    dispatch({ type: 'stores1/getInfoList', payload: res.data })
+  }
+}
 
 /**
  * 删除
  */
 export const stores1DelAPI = (id: number) => {
-  return http.get(`cms/storage/remove/${id}`);
-};
+  return http.get(`cms/storage/remove/${id}`)
+}
 
 /**
  * 通过id获取详情
  */
 export const getStores1DetailAPI = (id: number) => {
-  return http.get(`cms/storage/detail/${id}`);
-};
+  return http.get(`cms/storage/detail/${id}`)
+}
 
 /**
  * 获取统计报表1
  */
 export const getStores2API1 = () => {
-  return http.get("cms/report/groupByGoodType");
-};
+  return http.get('cms/report/groupByGoodType')
+}
 /**
  * 获取统计报表2
  */
 export const getStores2API2 = () => {
-  return http.get("cms/report/goodsLevel");
-};
+  return http.get('cms/report/goodsLevel')
+}
 /**
  * 获取统计报表3
  */
 export const getStores2API3 = () => {
-  return http.get("cms/report/goodsSource");
-};
+  return http.get('cms/report/goodsSource')
+}
 /**
  * 获取统计报表4
  */
 export const getStores2API4 = () => {
-  return http.get("cms/report/goodsComplete");
-};
+  return http.get('cms/report/goodsComplete')
+}

+ 29 - 29
src/store/action/stores3.ts

@@ -1,62 +1,62 @@
-import { statusObj } from "@/utils/dataChange";
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import { statusObj } from '@/utils/dataChange'
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 获取藏品登记列表信息
  */
-export const getStores3List = (data: any) => {
+export const getStores3List = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("cms/move/pageList", data);
-    const list = res.data.records;
+    const res: any = await http.post('cms/move/pageList', data)
+    const list = res.data.records
     list.forEach((v: any) => {
-      v.statusTxt = statusObj[v.status];
-    });
+      v.statusTxt = statusObj[v.status]
+    })
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "stores3/getList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'stores3/getList', payload: obj })
+  }
+}
 
 /**
  * 获取藏品登记列表顶部数字信息
  */
-export const getStores3ListNum = () => {
+export const getStores3ListNum = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取统计数据
-    const res: any = await http.get("cms/move/countByStatus");
+    const res: any = await http.get('cms/move/countByStatus')
 
     const data = [
-      { id: null, name: "全部", num: res.data.all ? res.data.all : 0 },
+      { id: null, name: '全部', num: res.data.all ? res.data.all : 0 },
       // { id: 0, name: "待办理", num: res.data[0] ? res.data[0] : 0 },
-      { id: 1, name: "待审核", num: res.data[1] ? res.data[1] : 0 },
-      { id: 2, name: "审核不通过", num: res.data[2] ? res.data[2] : 0 },
-      { id: 3, name: "已完成", num: res.data[3] ? res.data[3] : 0 },
-    ];
-    dispatch({ type: "stores3/getListNum", payload: data });
-  };
-};
+      { id: 1, name: '待审核', num: res.data[1] ? res.data[1] : 0 },
+      { id: 2, name: '审核不通过', num: res.data[2] ? res.data[2] : 0 },
+      { id: 3, name: '已完成', num: res.data[3] ? res.data[3] : 0 }
+    ]
+    dispatch({ type: 'stores3/getListNum', payload: data })
+  }
+}
 
 /**
  * 删除外层表格数据
  */
 export const stores3DelAPI = (id: number) => {
-  return http.get(`cms/move/remove/${id}`);
-};
+  return http.get(`cms/move/remove/${id}`)
+}
 
 /**
  * 通过id获取信息
  */
 export const stores3infoOutAPI = (id: number) => {
-  return http.get(`cms/move/detail/${id}`);
-};
+  return http.get(`cms/move/detail/${id}`)
+}
 
 /**
  * 审核入库信息
  */
 export const auditStores3API = (data: any) => {
-  return http.post("cms/move/audit", data);
-};
+  return http.post('cms/move/audit', data)
+}

+ 49 - 49
src/store/action/system.ts

@@ -1,124 +1,124 @@
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 
 /**
  * 获取用户列表信息
  */
-export const getUserListAPI = (data: any) => {
+export const getUserListAPI = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("sys/user/list", data);
-    const list = res.data.records;
+    const res: any = await http.post('sys/user/list', data)
+    const list = res.data.records
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "system/getTableList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'system/getTableList', payload: obj })
+  }
+}
 
 /**
  * 获取系统日志列表
  */
-export const getLogListAPI = (data: any) => {
+export const getLogListAPI = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("sys/log/list", data);
-    const list = res.data.records;
+    const res: any = await http.post('sys/log/list', data)
+    const list = res.data.records
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "system/getTableList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'system/getTableList', payload: obj })
+  }
+}
 
 /**
  * 获取角色管理列表
  */
-export const getRoleListAPI = (data: any) => {
+export const getRoleListAPI = (data: any): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.post("sys/role/listCountPage", data);
-    const list = res.data.records;
+    const res: any = await http.post('sys/role/listCountPage', data)
+    const list = res.data.records
     const obj = {
       list,
-      total: res.data.total,
-    };
-    dispatch({ type: "system/getTableList", payload: obj });
-  };
-};
+      total: res.data.total
+    }
+    dispatch({ type: 'system/getTableList', payload: obj })
+  }
+}
 
 /**
  * 根据id获取角色详情
  */
 export const getRoleInfoAPI = (id: any) => {
-  return http.get(`sys/role/detail/${id}`);
-};
+  return http.get(`sys/role/detail/${id}`)
+}
 
 /**
  * 新增角色或者修改角色
  */
 export const addRoleAPI = (data: any) => {
-  return http.post("sys/role/save", data);
-};
+  return http.post('sys/role/save', data)
+}
 
 /**
  * 删除角色
  */
 export const delRoleAPI = (id: any) => {
-  return http.get(`sys/role/remove/${id}`);
-};
+  return http.get(`sys/role/remove/${id}`)
+}
 
 /**
  * 角色的启用和停用
  */
 export const roleEditStatusAPI = (id: any, isDisable: any) => {
-  return http.get(`sys/role/editStatus/${id}/${isDisable}`);
-};
+  return http.get(`sys/role/editStatus/${id}/${isDisable}`)
+}
 
 /**
  * 所有角色的下拉列表
  */
-export const userGetRoleAPI = () => {
+export const userGetRoleAPI = (): any => {
   return async (dispatch: AppDispatch) => {
     // 获取列表数据
-    const res: any = await http.get("sys/user/getRole");
-    dispatch({ type: "system/getRoleSelect", payload: res.data });
-  };
-};
+    const res: any = await http.get('sys/user/getRole')
+    dispatch({ type: 'system/getRoleSelect', payload: res.data })
+  }
+}
 
 /**
  * 新增用户或者修改用户
  */
 export const addUserAPI = (data: any) => {
-  return http.post("sys/user/save", data);
-};
+  return http.post('sys/user/save', data)
+}
 
 /**
  * 通过id获取用户详情
  */
 export const getUserInfoAPI = (id: number) => {
-  return http.get(`sys/user/detail/${id}`);
-};
+  return http.get(`sys/user/detail/${id}`)
+}
 
 /**
  * 通过id删除用户
  */
 export const delUserAPI = (ids: number) => {
-  return http.get(`sys/user/removes/${ids}`);
-};
+  return http.get(`sys/user/removes/${ids}`)
+}
 
 /**
  * 通过id重置用户密码
  */
 export const userResetPassAPI = (id: number) => {
-  return http.get(`sys/user/resetPass/${id}`);
-};
+  return http.get(`sys/user/resetPass/${id}`)
+}
 
 /**
  * 用户的启用和停用
  */
 export const userEditStatusAPI = (id: any, isDisable: any) => {
-  return http.get(`sys/user/editStatus/${id}/${isDisable}`);
-};
+  return http.get(`sys/user/editStatus/${id}/${isDisable}`)
+}