Commit 5f64d2dc authored by krysent's avatar krysent

jicheng

parent 777f6d43
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
export default { export default {
dev: { dev: {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/** // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/wms/": { "/wmspro/": {
// 要代理的地址 // 要代理的地址
target: "http://192.168.40.18/wms/", //39:28040 18/wms/ target: "http://192.168.40.203:8000", //39:28040 18/wms/
// target: "http://192.168.40.18/wms/", //39:28040 18/wms/
// target: "http://192.168.40.18/wms/", //39:28040 18/wms/
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
"^/wms": "", "^/wmspro": "",
}, },
}, },
"/staticfile/": { "/staticfile/": {
......
...@@ -24,7 +24,7 @@ export async function getInitialState() { ...@@ -24,7 +24,7 @@ export async function getInitialState() {
const msg = await queryCurrentUser(); const msg = await queryCurrentUser();
return msg.data; return msg.data;
} catch (error) { } catch (error) {
history.push(loginPath); // history.push(loginPath);
} }
return undefined; return undefined;
}; // 如果是登录页面,不执行 }; // 如果是登录页面,不执行
...@@ -51,7 +51,7 @@ export async function getInitialState() { ...@@ -51,7 +51,7 @@ export async function getInitialState() {
settings: defaultSettings, settings: defaultSettings,
newMenu: menuData, newMenu: menuData,
getmenuData, getmenuData,
collapsed: false collapsed: false,
}; };
} }
return { return {
...@@ -59,7 +59,7 @@ export async function getInitialState() { ...@@ -59,7 +59,7 @@ export async function getInitialState() {
settings: defaultSettings, settings: defaultSettings,
getmenuData, getmenuData,
collapsed: false, collapsed: false,
tagList: [] tagList: [],
}; };
} // ProLayout 支持的api https://procomponents.ant.design/components/layout } // ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout = async (props) => { export const layout = async (props) => {
...@@ -74,25 +74,36 @@ export const layout = async (props) => { ...@@ -74,25 +74,36 @@ export const layout = async (props) => {
}, },
collapsed: initialState.collapsed, collapsed: initialState.collapsed,
onCollapse: (cols) => { onCollapse: (cols) => {
setInitialState(s => ({ ...s, collapsed: cols })) setInitialState((s) => ({ ...s, collapsed: cols }));
}, },
onPageChange: () => { onPageChange: async () => {
// const { location } = history; // 如果没有登录,重定向到 login
// if (location.pathname != "/user/logon") {
// if (
// (!initialState?.currentUser && location.pathname !== loginPath) ||
// !token
// ) {
// setInitialState((s) => {
// return { ...s, currentUser: undefined, newMenu: [] };
// });
// history.replace(loginPath);
// }
// }
// if (location.pathname == loginPath) {
// setInitialState((s) => {
// return { ...s, currentUser: undefined, newMenu: [] };
// });
// }
const { location } = history; // 如果没有登录,重定向到 login const { location } = history; // 如果没有登录,重定向到 login
if (location.pathname != "/user/logon") { let Token = localStorage.getItem("TOKEN_MES");
if ( if (!initialState?.currentUser && location.pathname !== loginPath) {
(!initialState?.currentUser && location.pathname !== loginPath) || let userInfo = await initialState.fetchUserInfo();
!token let menuData = await initialState.getmenuData();
) { setInitialState((s) => ({
setInitialState((s) => { ...s,
return { ...s, currentUser: undefined, newMenu: [] }; currentUser: userInfo?.data,
}); newMenu: menuData,
history.replace(loginPath); }));
}
}
if (location.pathname == loginPath) {
setInitialState((s) => {
return { ...s, currentUser: undefined, newMenu: [] };
});
} }
}, },
contentStyle: { contentStyle: {
...@@ -138,7 +149,6 @@ export const layout = async (props) => { ...@@ -138,7 +149,6 @@ export const layout = async (props) => {
} }
}, },
// 自定义 403 页面 // 自定义 403 页面
// unAccessible: <div>unAccessible</div>, // unAccessible: <div>unAccessible</div>,
// 增加一个 loading 的状态 // 增加一个 loading 的状态
......
import React, { useState, useEffect } from "react";
import { AutoComplete ,Input } from "antd";
import { doFetch } from "@/utils/doFetch";
import { useRequest } from "ahooks";
export default (item) => {
const { requestOptions ,name,value,onChange } = item;
const [options, setoptions] = useState([]);
const [username, setusername] = useState();
// const [value, setvalue] = useState();
const { data, run, runAsync } = useRequest(
async () => {
let res = await doFetch({
url: requestOptions?.url ?? "",
// params: { [requestOptions.params]: username },
params: requestOptions.params && { [requestOptions.params]: username },
});
return res?.data?.dataList;
},
{
manual: true,
debounceWait: 300,
}
);
useEffect(() => {
runAsync()
.then((data) => {
const options = data?.map((it) => ({
...it,
label: `${it?.username}-${it?.fullName}-${it?.phone}-${it?.mailbox}`,
value: `${it?.username}-${it?.fullName}-${it?.phone}-${it?.mailbox}`,
}));
setoptions(options);
})
.catch((error) => {
console.log(error);
});
}, [username]);
const onChangeHandle = (val) => {
setusername(val)
onChange(val)
// setvalue(val);
};
const selectValue = (val) => {
onChange(val)
};
return (
<AutoComplete
allowClear
placeholder={item.title}
disabled={item.disabled}
options={options}
onChange={onChangeHandle}
onSelect={selectValue}
value={value}
/>
);
};
...@@ -28,6 +28,7 @@ import Editor from "../Editor"; ...@@ -28,6 +28,7 @@ import Editor from "../Editor";
import mockfile from "./mockfile.js"; import mockfile from "./mockfile.js";
import zhCN from "antd/lib/locale/zh_CN"; import zhCN from "antd/lib/locale/zh_CN";
import Diyrule from "../Diyrule"; import Diyrule from "../Diyrule";
import Autocomplete from "../Autocomplete";
moment.locale("zh-cn"); moment.locale("zh-cn");
const { TreeNode } = TreeSelect; const { TreeNode } = TreeSelect;
...@@ -729,6 +730,25 @@ let InitForm = ({ ...@@ -729,6 +730,25 @@ let InitForm = ({
</Form.Item> </Form.Item>
</Col> </Col>
) : null; ) : null;
}else if (item.type == "autocompleteinput") {
return !extraprops.hides ? (
<Col key={i} {...getCol(item.col)}>
<Form.Item
style={{}}
label={item.title}
name={item.name[0]}
rules={[
{
required: item.required,
message: `请输入${item.title}`,
},
]}
>
<Autocomplete {...item} />
{/* <span style={{position:'relative',fontSize:"12px",color:'#c0c0c0c0'}}>登录账号为"用户名",登录密码为IoT设置的密码</span> */}
</Form.Item>
</Col>
) : null;
} else if (item.type == "textarea") { } else if (item.type == "textarea") {
return !extraprops.hides ? ( return !extraprops.hides ? (
<Col key={i} {...getCol(item.col)}> <Col key={i} {...getCol(item.col)}>
......
import React, { useCallback, useState, useMemo } from "react"; import React, { useCallback, useState, useMemo } from "react";
import { LogoutOutlined, LockOutlined } from "@ant-design/icons"; import {
import { Menu, Spin, Form, Modal, message, Avatar } from "antd"; LogoutOutlined,
import { history, useModel, useRequest } from "umi"; LockOutlined,
import { stringify } from "querystring"; UserOutlined,
DownOutlined,
} from "@ant-design/icons";
import { Menu, Spin, Form, Modal, message, Select } from "antd";
import { history, useModel } from "umi";
import { useRequest } from "ahooks";
import HeaderDropdown from "../HeaderDropdown"; import HeaderDropdown from "../HeaderDropdown";
import styles from "./index.less"; import styles from "./index.less";
import { fakeAccountLoginOut, changePwd } from "@/services/login"; import { fakeAccountLoginOut, changePwd } from "@/services/login";
...@@ -13,17 +18,19 @@ import ECB from "crypto-js/mode-ecb"; ...@@ -13,17 +18,19 @@ import ECB from "crypto-js/mode-ecb";
import Pkcs7 from "crypto-js/pad-pkcs7"; import Pkcs7 from "crypto-js/pad-pkcs7";
import Utf8 from "crypto-js/enc-utf8"; import Utf8 from "crypto-js/enc-utf8";
import moment from "moment"; import moment from "moment";
const { Option } = Select;
/** /**
* 退出登录,并且将当前的 url 保存 * 退出登录,并且将当前的 url 保存
*/ */
const loginOut = async () => { const loginOut = async () => {
await fakeAccountLoginOut(); const { logoutRedirectUrl } = await fakeAccountLoginOut();
const { query = {} } = history.location;
const { redirect } = query; // Note: There may be security issues, please note
const { query = {} } = history.location;
const { redirect } = query; // Note: There may be security issues, please not
if (window.location.pathname !== "/user/login" && !redirect) { if (window.location.pathname !== "/user/login" && !redirect) {
localStorage.clear(); localStorage.clear();
history.replace("/user/login"); // history.replace("/user/login");
window.location.replace(logoutRedirectUrl);
} }
}; };
...@@ -33,7 +40,6 @@ const AvatarDropdown = ({ menu }) => { ...@@ -33,7 +40,6 @@ const AvatarDropdown = ({ menu }) => {
[formRef] = Form.useForm(), [formRef] = Form.useForm(),
{ run, loading } = useRequest(doFetch, { { run, loading } = useRequest(doFetch, {
manual: true, manual: true,
formatResult: (res) => res,
onSuccess: (result, params) => { onSuccess: (result, params) => {
if (result.code == "0000") { if (result.code == "0000") {
cv(false); cv(false);
...@@ -47,6 +53,13 @@ const AvatarDropdown = ({ menu }) => { ...@@ -47,6 +53,13 @@ const AvatarDropdown = ({ menu }) => {
}); });
} }
}, },
}),
getUserApp = useRequest(async () => {
let res = await doFetch({
url: "/ngic-auth/sysUser/userApp/selection",
params: {},
});
return res?.data ?? {};
}); });
const fields = useMemo(() => { const fields = useMemo(() => {
return { return {
...@@ -160,7 +173,7 @@ const AvatarDropdown = ({ menu }) => { ...@@ -160,7 +173,7 @@ const AvatarDropdown = ({ menu }) => {
</Menu> </Menu>
); );
return ( return (
<div> <div className="center">
<Modal <Modal
title="修改密码" title="修改密码"
visible={visible} visible={visible}
...@@ -175,21 +188,57 @@ const AvatarDropdown = ({ menu }) => { ...@@ -175,21 +188,57 @@ const AvatarDropdown = ({ menu }) => {
formRef={formRef} formRef={formRef}
fields={fields} fields={fields}
col={{ span: 24 }} col={{ span: 24 }}
onChange={(changedValues, allValues) => { }} onChange={(changedValues, allValues) => {}}
submitData={(values, fn) => { submitData={(values, fn) => {
saveData(values, fn); saveData(values, fn);
}} }}
submitting={loading || !visible} submitting={loading || !visible}
> ></InitForm>
</InitForm>
</Modal> </Modal>
<Select
style={{
width: 200,
}}
onChange={(value) => {
window.open(value, "_self");
}}
value={
getUserApp?.data?.dataList?.filter(
(it) => it.appId == getUserApp?.data?.appId
)?.[0]?.value
}
tagRender={(props) => {}}
>
{getUserApp?.data?.dataList?.map((it) => {
return (
<Option value={it.value} label={it.label} key={it.value}>
<div style={{ display: "flex", alignItems: "center" }}>
{it?.appImgList?.length > 0 && (
<img
src={it?.appImgList?.[0]?.url}
style={{
width: 26,
height: 26,
objectFit: "cover",
marginRight: 6,
}}
/>
)}
<span>{it.label}</span>
</div>
</Option>
);
})}
</Select>
<HeaderDropdown overlay={menuHeaderDropdown}> <HeaderDropdown overlay={menuHeaderDropdown}>
<span className={`${styles.action} ${styles.account}`}> <span className={`${styles.action} ${styles.account}`}>
<Avatar style={{marginRight:12,backgroundColor:"#1890ff"}}>{currentUser.userName.substr(0,1)}</Avatar> <UserOutlined
style={{ color: "#57b9c6", fontSize: 20, margin: "0 4px" }}
/>
<span className={`${styles.name} anticon`}> <span className={`${styles.name} anticon`}>
{currentUser.userName} {currentUser.userName}
</span> </span>
<DownOutlined style={{ fontSize: 14, marginLeft: 4 }} />
</span> </span>
</HeaderDropdown> </HeaderDropdown>
</div> </div>
......
...@@ -9,27 +9,37 @@ import { ...@@ -9,27 +9,37 @@ import {
} from "@/services/system"; } from "@/services/system";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
export default { export default {
// accountName: {
// value: null,
// type: "input",
// title: "用户名",
// name: ["accountName"],
// required: true,
// },
// userName: {
// value: null,
// type: "input",
// title: "姓名",
// name: ["userName"],
// required: true,
// },
accountName: { accountName: {
value: null, type: "autocompleteinput",
type: "input", title: "用户名-姓名-联系电话-邮箱",
title: "用户名",
name: ["accountName"], name: ["accountName"],
required: true, required: true,
}, requestOptions: {
userName: { url: "/ngic-auth/sysUser/queryLikeIotUsername",
value: null, params: "userName",
type: "input", },
title: "姓名", },
name: ["userName"], // telephone: {
required: true, // value: null,
}, // type: "input",
telephone: { // title: "联系电话",
value: null, // name: ["telephone"],
type: "input", // required: false,
title: "联系电话", // },
name: ["telephone"],
required: false,
},
departmentId: { departmentId: {
value: null, value: null,
type: "treeselect", type: "treeselect",
...@@ -63,10 +73,14 @@ export default { ...@@ -63,10 +73,14 @@ export default {
required: false, required: false,
belinked: { belinked: {
options: { options: {
database: (params) => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { ...params } }), database: (params) =>
doFetch({
url: "/wmspro/ngic-auth/sysStore/selectionBox",
params: { ...params },
}),
params: { params: {
factoryIdList: "linked" factoryIdList: "linked",
} },
}, },
}, },
multiple: true, multiple: true,
...@@ -98,16 +112,16 @@ export default { ...@@ -98,16 +112,16 @@ export default {
}, },
}, },
}, },
mailNo: { // mailNo: {
value: null, // value: null,
type: "input", // type: "input",
title: "邮箱", // title: "邮箱",
name: ["mailNo"], // name: ["mailNo"],
required: false, // required: false,
col: { // col: {
span: 12, // span: 12,
}, // },
}, // },
remark: { remark: {
value: null, value: null,
type: "textarea", type: "textarea",
......
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
UserOutlined, UserOutlined,
LoginOutlined, LoginOutlined,
ArrowRightOutlined, ArrowRightOutlined,
CloseOutlined CloseOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
import { Alert, message, Tabs, Row, Col, Button, Input } from "antd"; import { Alert, message, Tabs, Row, Col, Button, Input } from "antd";
import React, { useState, useRef } from "react"; import React, { useState, useRef } from "react";
...@@ -15,7 +15,7 @@ import { ...@@ -15,7 +15,7 @@ import {
LoginForm, LoginForm,
ProFormTreeSelect, ProFormTreeSelect,
ProFormSelect, ProFormSelect,
ProFormTextArea ProFormTextArea,
} from "@ant-design/pro-form"; } from "@ant-design/pro-form";
import { Link, history, FormattedMessage, useModel } from "umi"; import { Link, history, FormattedMessage, useModel } from "umi";
import { fakeAccountLogin, saveForRegister } from "@/services/login"; import { fakeAccountLogin, saveForRegister } from "@/services/login";
...@@ -36,8 +36,7 @@ import { ...@@ -36,8 +36,7 @@ import {
roleSelectRegister, roleSelectRegister,
} from "@/services/system"; } from "@/services/system";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import { ProDescriptions } from '@ant-design/pro-components'; import { ProDescriptions } from "@ant-design/pro-components";
const { Search } = Input; const { Search } = Input;
...@@ -65,35 +64,54 @@ const Login = () => { ...@@ -65,35 +64,54 @@ const Login = () => {
//登录 //登录
const handleLogin = async (values) => { const handleLogin = async (values) => {
let timestamp = moment().valueOf().toString() + "acb"; // let timestamp = moment().valueOf().toString() + "acb";
let newtimestamp = AES.encrypt(timestamp, Utf8.parse("NANGAODEAESKEY--"), { // let newtimestamp = AES.encrypt(timestamp, Utf8.parse("NANGAODEAESKEY--"), {
mode: ECB, // mode: ECB,
padding: Pkcs7, // padding: Pkcs7,
}).toString(); // }).toString();
let password = AES.encrypt(values.password, Utf8.parse(timestamp), { // let password = AES.encrypt(values.password, Utf8.parse(timestamp), {
mode: ECB, // mode: ECB,
padding: Pkcs7, // padding: Pkcs7,
}).toString(); // }).toString();
const postdata = { // const postdata = {
accountName: values.userName, // accountName: values.userName,
password: password, // password: password,
encryptKey: newtimestamp, // encryptKey: newtimestamp,
}; // };
try { try {
// 登录 // 登录
const res = await fakeAccountLogin({ ...postdata }); // const res = await fakeAccountLogin({ ...postdata });
if (res.code === "0000") { const res = await doFetch({
let token = res?.data?.token; url: `/token/oauth/token?grant_type=password&client_id=NGWMS3&client_secret=wms_Nangao@2022&username=${values.userName}&password=${values.password}`,
});
if (res.access_token) {
let token = res?.access_token;
localStorage.setItem("TOKEN_MES", token); localStorage.setItem("TOKEN_MES", token);
await fetchUserInfo(); await fetchUserInfo();
message.success("🎉 🎉 🎉 登录成功!"); message.success("🎉 🎉 🎉 登录成功!");
/** 此方法会跳转到 redirect 参数所在的位置 */ /** 此方法会跳转到 redirect 参数所在的位置 */
console.log(history);
if (!history) return; if (!history) return;
const { query } = history.location; // const { query } = history.location;
const { redirect } = query; // const { redirect } = query;
history.push(redirect || "/"); history.push("/");
return; // return;
} }
// 旧的登录
// if (res.code === "0000") {
// let token = res?.data?.token;
// localStorage.setItem("TOKEN_MES", token);
// await fetchUserInfo();
// message.success("🎉 🎉 🎉 登录成功!");
// /** 此方法会跳转到 redirect 参数所在的位置 */
// console.log(history);
// if (!history) return;
// const { query } = history.location;
// const { redirect } = query;
// history.push(redirect || "/");
// return;
// }
} catch (error) { } catch (error) {
message.error(res.msg); message.error(res.msg);
} }
...@@ -109,16 +127,13 @@ const Login = () => { ...@@ -109,16 +127,13 @@ const Login = () => {
} }
}; };
const handleSubmit = async (values) => { const handleSubmit = async (values) => {
if (tabkey == "1") { if (tabkey == "1") {
await handleLogin(values) await handleLogin(values);
} else { } else {
await handleReg(values) await handleReg(values);
}
} }
};
return ( return (
<Row className={styles.container}> <Row className={styles.container}>
...@@ -133,16 +148,24 @@ const Login = () => { ...@@ -133,16 +148,24 @@ const Login = () => {
<div className="cover"> <div className="cover">
<img alt="logo" src={require("@/assets/logo_white.png")} /> <img alt="logo" src={require("@/assets/logo_white.png")} />
</div> </div>
{ {visible && (
visible && <div className={styles.search}> <div className={styles.search}>
<h2 style={{ fontSize: 16, borderBottom: "6px solid #eee", marginBottom: 12, paddingBottom: 12 }} className="spread"> <h2
<a> style={{
查询注册进度 fontSize: 16,
</a> borderBottom: "6px solid #eee",
<CloseOutlined style={{ color: "red" }} onClick={() => { marginBottom: 12,
setvisible(false) paddingBottom: 12,
}}> }}
</CloseOutlined> className="spread"
>
<a>查询注册进度</a>
<CloseOutlined
style={{ color: "red" }}
onClick={() => {
setvisible(false);
}}
></CloseOutlined>
</h2> </h2>
<Search <Search
placeholder="请输入用户名" placeholder="请输入用户名"
...@@ -166,129 +189,139 @@ const Login = () => { ...@@ -166,129 +189,139 @@ const Login = () => {
<ProDescriptions <ProDescriptions
columns={[ columns={[
{ {
"title": "用户名", title: "用户名",
"dataIndex": "accountName", dataIndex: "accountName",
"key": "accountName" key: "accountName",
}, },
{ {
"title": "姓名", title: "姓名",
"dataIndex": "userName", dataIndex: "userName",
"key": "userName" key: "userName",
}, },
{ {
"title": "联系电话", title: "联系电话",
"dataIndex": "telephone", dataIndex: "telephone",
"key": "telephone" key: "telephone",
}, },
{ {
"title": "工厂", title: "工厂",
"dataIndex": "factoryName", dataIndex: "factoryName",
"key": "factoryName" key: "factoryName",
}, },
{ {
"title": "组织", title: "组织",
"dataIndex": "departmentName", dataIndex: "departmentName",
"key": "departmentName" key: "departmentName",
}, },
{ {
"title": "负责仓库", title: "负责仓库",
"dataIndex": "chargeStoreName", dataIndex: "chargeStoreName",
"key": "chargeStoreName" key: "chargeStoreName",
}, },
{ {
"title": "角色", title: "角色",
"dataIndex": "roleName", dataIndex: "roleName",
"key": "roleName" key: "roleName",
}, },
{ {
"title": "直属领导", title: "直属领导",
"dataIndex": "parentName", dataIndex: "parentName",
"key": "parentName" key: "parentName",
}, },
{ {
"title": "邮箱", title: "邮箱",
"dataIndex": "mailNo", dataIndex: "mailNo",
"key": "mailNo" key: "mailNo",
}, },
{ {
"title": "审批结果", title: "审批结果",
"dataIndex": "auditResultName", dataIndex: "auditResultName",
"key": "auditResultName" key: "auditResultName",
}, },
{ {
"title": "审批意见", title: "审批意见",
"dataIndex": "auditOpinion", dataIndex: "auditOpinion",
"key": "auditOpinion" key: "auditOpinion",
}, },
{ {
"title": "审批状态", title: "审批状态",
"dataIndex": "statusName", dataIndex: "statusName",
"key": "statusName" key: "statusName",
}, },
{ {
"title": "备注", title: "备注",
"dataIndex": "remark", dataIndex: "remark",
"key": "remark" key: "remark",
}, },
{ {
"title": "申请时间", title: "申请时间",
"dataIndex": "applyTime", dataIndex: "applyTime",
"key": "applyTime" key: "applyTime",
}, },
{ {
"title": "审批时间", title: "审批时间",
"dataIndex": "auditTime", dataIndex: "auditTime",
"key": "auditTime" key: "auditTime",
}, },
{ {
"title": "审批人", title: "审批人",
"dataIndex": "auditUserName", dataIndex: "auditUserName",
"key": "auditUserName" key: "auditUserName",
} },
]} ]}
column={1} column={1}
dataSource={data} dataSource={data}
></ProDescriptions> ></ProDescriptions>
</div> </div>
)}
}
</div> </div>
</Col> </Col>
<Col {...cols} onClick={() => { <Col
setvisible(false) {...cols}
onClick={() => {
}}> setvisible(false);
<div className="logincontent" style={{ width: "100%", height: "100%", display: "flex", flexDirection: "column" }}> }}
>
<div
className="logincontent"
style={{
width: "100%",
height: "100%",
display: "flex",
flexDirection: "column",
}}
>
<div className={styles.content}> <div className={styles.content}>
<LoginForm <LoginForm
submitter={{ submitter={{
render: (props) => { render: (props) => {
return <Button return (
<Button
{...props} {...props}
style={{ width: "100%" }} style={{ width: "100%" }}
type="primary" type="primary"
size="large" size="large"
icon={tabkey === "1" ? <LoginOutlined /> : <ArrowRightOutlined />} icon={
tabkey === "1" ? (
<LoginOutlined />
) : (
<ArrowRightOutlined />
)
}
onClick={async () => { onClick={async () => {
let values = await formRef.current.validateFields() let values = await formRef.current.validateFields();
await handleSubmit(values); await handleSubmit(values);
}} }}
> >
{tabkey === "1" ? "登录" : "注册"} {tabkey === "1" ? "登录" : "注册"}
</Button> </Button>
} );
},
}} }}
onValuesChange={async (values) => { onValuesChange={async (values) => {
if (Object.keys(values)[0] == "factoryIdList") { if (Object.keys(values)[0] == "factoryIdList") {
formRef.current.setFieldsValue({ storeIdList: [] }); formRef.current.setFieldsValue({ storeIdList: [] });
} }
}} }}
title={<span style={{ color: "#fff" }}>WMS</span>} title={<span style={{ color: "#fff" }}>WMS</span>}
subTitle={ subTitle={
...@@ -302,7 +335,10 @@ const Login = () => { ...@@ -302,7 +335,10 @@ const Login = () => {
onFinish={async (values) => { onFinish={async (values) => {
await handleSubmit(values); await handleSubmit(values);
}} }}
style={{ width: tabkey == "2" ? 560 : 328, marginLeft: tabkey == "2" ? -116 : 0 }}//样式适配 style={{
width: tabkey == "2" ? 560 : 328,
marginLeft: tabkey == "2" ? -116 : 0,
}} //样式适配
formRef={formRef} formRef={formRef}
> >
<Tabs <Tabs
...@@ -310,10 +346,17 @@ const Login = () => { ...@@ -310,10 +346,17 @@ const Login = () => {
activeKey={tabkey} activeKey={tabkey}
onChange={settabkey} onChange={settabkey}
tabBarStyle={{ color: "#fff" }} tabBarStyle={{ color: "#fff" }}
tabBarExtraContent={<a style={{ color: "rgba(255,255,255,0.6)" }} onClick={(e) => { tabBarExtraContent={
<a
style={{ color: "rgba(255,255,255,0.6)" }}
onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
setvisible(true) setvisible(true);
}}>查询注册进度</a>} }}
>
查询注册进度
</a>
}
> >
<TabPane tab="登录" key="1"> <TabPane tab="登录" key="1">
{tabkey == "1" && ( {tabkey == "1" && (
...@@ -322,7 +365,9 @@ const Login = () => { ...@@ -322,7 +365,9 @@ const Login = () => {
name="userName" name="userName"
fieldProps={{ fieldProps={{
size: "large", size: "large",
prefix: <UserOutlined className={styles.prefixIcon} />, prefix: (
<UserOutlined className={styles.prefixIcon} />
),
}} }}
placeholder="用户名" placeholder="用户名"
rules={[ rules={[
...@@ -336,7 +381,9 @@ const Login = () => { ...@@ -336,7 +381,9 @@ const Login = () => {
name="password" name="password"
fieldProps={{ fieldProps={{
size: "large", size: "large",
prefix: <LockOutlined className={styles.prefixIcon} />, prefix: (
<LockOutlined className={styles.prefixIcon} />
),
}} }}
placeholder="密码" placeholder="密码"
rules={[ rules={[
...@@ -356,8 +403,8 @@ const Login = () => { ...@@ -356,8 +403,8 @@ const Login = () => {
<ProFormText <ProFormText
fieldProps={{ fieldProps={{
style: { style: {
height: 32 height: 32,
} },
}} }}
name="accountName" name="accountName"
label={<b>用户名</b>} label={<b>用户名</b>}
...@@ -375,8 +422,8 @@ const Login = () => { ...@@ -375,8 +422,8 @@ const Login = () => {
<ProFormText <ProFormText
fieldProps={{ fieldProps={{
style: { style: {
height: 32 height: 32,
} },
}} }}
name="userName" name="userName"
label={<b>姓名</b>} label={<b>姓名</b>}
...@@ -394,8 +441,8 @@ const Login = () => { ...@@ -394,8 +441,8 @@ const Login = () => {
<ProFormText <ProFormText
fieldProps={{ fieldProps={{
style: { style: {
height: 32 height: 32,
} },
}} }}
name="telephone" name="telephone"
label={<b>联系电话</b>} label={<b>联系电话</b>}
...@@ -406,7 +453,8 @@ const Login = () => { ...@@ -406,7 +453,8 @@ const Login = () => {
message: "请输入联系电话!", message: "请输入联系电话!",
}, },
{ {
pattern: /^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/, pattern:
/^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/,
message: "手机号格式错误!", message: "手机号格式错误!",
}, },
]} ]}
...@@ -422,18 +470,18 @@ const Login = () => { ...@@ -422,18 +470,18 @@ const Login = () => {
fieldNames: { fieldNames: {
label: "title", label: "title",
value: "key", value: "key",
children: "children" children: "children",
} },
}} }}
request={async () => { request={async () => {
let res = await departmentTree({}); let res = await departmentTree({});
return res?.data?.dataList ?? [] return res?.data?.dataList ?? [];
}} }}
rules={[ rules={[
{ {
required: true, required: true,
message: "请选择组织!", message: "请选择组织!",
} },
]} ]}
/> />
</Col> </Col>
...@@ -442,28 +490,28 @@ const Login = () => { ...@@ -442,28 +490,28 @@ const Login = () => {
<ProFormSelect <ProFormSelect
fieldProps={{ fieldProps={{
mode: "multiple", mode: "multiple",
maxTagCount: 1 maxTagCount: 1,
}} }}
name="factoryIdList" name="factoryIdList"
label={<b>工厂</b>} label={<b>工厂</b>}
placeholder="请选择工厂" placeholder="请选择工厂"
request={async () => { request={async () => {
let res = await factorySelectRegister({}); let res = await factorySelectRegister({});
return res?.data?.dataList ?? [] return res?.data?.dataList ?? [];
}} }}
rules={[ rules={[
{ {
required: true, required: true,
message: "请选择工厂!", message: "请选择工厂!",
} },
]} ]}
/> />
</Col> </Col>
<Col span={8}> <Col span={8}>
<ProFormDependency name={["factoryIdList"]}> <ProFormDependency name={["factoryIdList"]}>
{ {({ factoryIdList }) => {
({ factoryIdList }) => { return (
return <ProFormSelect <ProFormSelect
fieldProps={{ fieldProps={{
mode: "multiple", mode: "multiple",
maxTagCount: 1, maxTagCount: 1,
...@@ -474,19 +522,17 @@ const Login = () => { ...@@ -474,19 +522,17 @@ const Login = () => {
params={{ factoryIdList }} params={{ factoryIdList }}
request={async (params) => { request={async (params) => {
let res = await storeselectionBoxAll(params); let res = await storeselectionBoxAll(params);
return res?.data?.dataList ?? [] return res?.data?.dataList ?? [];
}} }}
rules={[ rules={[
{ {
required: false, required: false,
message: "请选择负责仓库!", message: "请选择负责仓库!",
} },
]} ]}
/> />
} );
} }}
</ProFormDependency> </ProFormDependency>
</Col> </Col>
...@@ -494,20 +540,20 @@ const Login = () => { ...@@ -494,20 +540,20 @@ const Login = () => {
<ProFormSelect <ProFormSelect
fieldProps={{ fieldProps={{
mode: "multiple", mode: "multiple",
maxTagCount: 1 maxTagCount: 1,
}} }}
name="roleIdList" name="roleIdList"
label={<b>角色配置</b>} label={<b>角色配置</b>}
placeholder="请选择角色配置" placeholder="请选择角色配置"
request={async () => { request={async () => {
let res = await roleSelectRegister({}); let res = await roleSelectRegister({});
return res?.data?.dataList ?? [] return res?.data?.dataList ?? [];
}} }}
rules={[ rules={[
{ {
required: false, required: false,
message: "请选择角色配置!", message: "请选择角色配置!",
} },
]} ]}
/> />
</Col> </Col>
...@@ -519,13 +565,13 @@ const Login = () => { ...@@ -519,13 +565,13 @@ const Login = () => {
placeholder="请选择直属领导" placeholder="请选择直属领导"
request={async () => { request={async () => {
let res = await allUserSelect({}); let res = await allUserSelect({});
return res?.data?.dataList ?? [] return res?.data?.dataList ?? [];
}} }}
rules={[ rules={[
{ {
required: false, required: false,
message: "请选择直属领导!", message: "请选择直属领导!",
} },
]} ]}
/> />
</Col> </Col>
...@@ -533,8 +579,8 @@ const Login = () => { ...@@ -533,8 +579,8 @@ const Login = () => {
<ProFormText <ProFormText
fieldProps={{ fieldProps={{
style: { style: {
height: 32 height: 32,
} },
}} }}
name="mailNo" name="mailNo"
label={<b>邮箱</b>} label={<b>邮箱</b>}
...@@ -543,7 +589,7 @@ const Login = () => { ...@@ -543,7 +589,7 @@ const Login = () => {
{ {
required: false, required: false,
message: "请输入邮箱!", message: "请输入邮箱!",
} },
]} ]}
/> />
</Col> </Col>
...@@ -555,13 +601,13 @@ const Login = () => { ...@@ -555,13 +601,13 @@ const Login = () => {
placeholder="请输入备注" placeholder="请输入备注"
request={async () => { request={async () => {
let res = await allUserSelect({}); let res = await allUserSelect({});
return res?.data?.dataList ?? [] return res?.data?.dataList ?? [];
}} }}
rules={[ rules={[
{ {
required: false, required: false,
message: "请输入备注!", message: "请输入备注!",
} },
]} ]}
/> />
</Col> </Col>
...@@ -589,7 +635,6 @@ const Login = () => { ...@@ -589,7 +635,6 @@ const Login = () => {
</div> </div>
<Footer></Footer> <Footer></Footer>
</div> </div>
</Col> </Col>
</Row> </Row>
); );
......
...@@ -10,7 +10,7 @@ export async function fakeAccountLogin(params) { ...@@ -10,7 +10,7 @@ export async function fakeAccountLogin(params) {
//登出 //登出
export async function fakeAccountLoginOut(params) { export async function fakeAccountLoginOut(params) {
return request(`/wms/ngic-auth/sysAccount/logout`, { return request(`/mespro/logout`, {
method: "POST", method: "POST",
body: params, body: params,
}); });
...@@ -27,15 +27,23 @@ export async function saveForRegister(params) { ...@@ -27,15 +27,23 @@ export async function saveForRegister(params) {
//个人信息 //个人信息
export async function queryCurrentUser(params) { export async function queryCurrentUser(params) {
return request("/wms/ngic-auth/sysUser/query", { return request("/wmspro/ngic-auth/sysUser/me", {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
// //获取菜单/权限/菜单/公司类型
// export async function getMenu(params) {
// return request(`/wms/ngic-auth/sysPermission/queryMenu`, {
// method: "POST",
// data: params,
// });
// }
//获取菜单/权限/菜单/公司类型 //获取菜单/权限/菜单/公司类型
export async function getMenu(params) { export async function getMenu(params) {
return request(`/wms/ngic-auth/sysPermission/queryMenu`, { return request(`/wmspro/ngic-auth/sysPermission/queryMenu`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -43,7 +51,7 @@ export async function getMenu(params) { ...@@ -43,7 +51,7 @@ export async function getMenu(params) {
/*---------------菜单收藏-------------------*/ /*---------------菜单收藏-------------------*/
export async function collectPerms(params) { export async function collectPerms(params) {
return request(`/wms/ngic-auth/sysUserPermission/collectPerm`, { return request(`/wmspro/ngic-auth/sysUserPermission/collectPerm`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -51,14 +59,14 @@ export async function collectPerms(params) { ...@@ -51,14 +59,14 @@ export async function collectPerms(params) {
/*---------------取消菜单收藏-------------------*/ /*---------------取消菜单收藏-------------------*/
export async function cancelCollectPerms(params) { export async function cancelCollectPerms(params) {
return request(`/wms/ngic-auth/sysUserPermission/cancelCollectPerm`, { return request(`/wmspro/ngic-auth/sysUserPermission/cancelCollectPerm`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
/*---------------菜单历史记录-------------------*/ /*---------------菜单历史记录-------------------*/
export async function mtosave(params) { export async function mtosave(params) {
return request(`/wms/ngic-auth/sysUserVisitPermission/save`, { return request(`/wmspro/ngic-auth/sysUserVisitPermission/save`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
......
...@@ -2,21 +2,21 @@ import request from "@/utils/request"; ...@@ -2,21 +2,21 @@ import request from "@/utils/request";
//工厂下拉框 //工厂下拉框
export async function factorySelect(params) { export async function factorySelect(params) {
return request(`/wms/ngic-auth/sysFactory/selectionBox`, { return request(`/wmspro/ngic-auth/sysFactory/selectionBox`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//查询个人所属工厂下拉框 //查询个人所属工厂下拉框
export async function factorySelectByuser(params) { export async function factorySelectByuser(params) {
return request(`/wms/ngic-auth/sysFactory/selectionBoxU`, { return request(`/wmspro/ngic-auth/sysFactory/selectionBoxU`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//查询工厂下拉框---注册 //查询工厂下拉框---注册
export async function factorySelectRegister(params) { export async function factorySelectRegister(params) {
return request(`/wms/ngic-auth/sysFactory/selectionBoxAll`, { return request(`/wmspro/ngic-auth/sysFactory/selectionBoxAll`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -24,28 +24,28 @@ export async function factorySelectRegister(params) { ...@@ -24,28 +24,28 @@ export async function factorySelectRegister(params) {
//全部车间下拉框 //全部车间下拉框
export async function shopSelect(params) { export async function shopSelect(params) {
return request(`/wms/ngic-auth/sysShop/selectionBox`, { return request(`/wmspro/ngic-auth/sysShop/selectionBox`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//仓库下拉 //仓库下拉
export async function storeselectionBoxAll(params) { export async function storeselectionBoxAll(params) {
return request(`/wms/ngic-auth/sysStore/selectionBox`, { return request(`/wmspro/ngic-auth/sysStore/selectionBox`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//根据工厂id查询车间下拉 //根据工厂id查询车间下拉
export async function storeselectionBox(params) { export async function storeselectionBox(params) {
return request(`/wms/ngic-auth/sysStore/selectionBox`, { return request(`/wmspro/ngic-auth/sysStore/selectionBox`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//全部组织下拉 //全部组织下拉
export async function allDepartment(params) { export async function allDepartment(params) {
return request(`/wms/ngic-auth/sysDepartment/query/selectbox/depart`, { return request(`/wmspro/ngic-auth/sysDepartment/query/selectbox/depart`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -53,77 +53,77 @@ export async function allDepartment(params) { ...@@ -53,77 +53,77 @@ export async function allDepartment(params) {
//根据工厂id查询车间下拉 //根据工厂id查询车间下拉
export async function shopSelectByFactory(params) { export async function shopSelectByFactory(params) {
return request(`/wms/ngic-auth/sysShop/query/selectbox/factory`, { return request(`/wmspro/ngic-auth/sysShop/query/selectbox/factory`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//根据车间id查询产线下拉 //根据车间id查询产线下拉
export async function productionLineSelectByShop(params) { export async function productionLineSelectByShop(params) {
return request(`/wms/ngic-auth/sysProductionLine/query/selectbox/shopId`, { return request(`/wmspro/ngic-auth/sysProductionLine/query/selectbox/shopId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//根据车间id集合查询产线下拉 //根据车间id集合查询产线下拉
export async function productionLineSelectByShops(params) { export async function productionLineSelectByShops(params) {
return request(`/wms/ngic-auth/sysProductionLine/query/selectbox/shopIds`, { return request(`/wmspro/ngic-auth/sysProductionLine/query/selectbox/shopIds`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//根据车间id查询工段下拉 //根据车间id查询工段下拉
export async function sectionSelectByShop(params) { export async function sectionSelectByShop(params) {
return request(`/wms/ngic-auth/sysSection/query/selectbox/shopId`, { return request(`/wmspro/ngic-auth/sysSection/query/selectbox/shopId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//根据车间id集合查询工段下拉 //根据车间id集合查询工段下拉
export async function sectionSelectByShops(params) { export async function sectionSelectByShops(params) {
return request(`/wms/ngic-auth/sysSection/query/selectbox/shopIds`, { return request(`/wmspro/ngic-auth/sysSection/query/selectbox/shopIds`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//授权前查询权限树 //授权前查询权限树
export async function roleTree(params) { export async function roleTree(params) {
return request(`/wms/ngic-auth/sysRolePermission/queryAll`, { return request(`/wmspro/ngic-auth/sysRolePermission/queryAll`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//角色下权限数据 //角色下权限数据
export async function adminDataqueryAll(params) { export async function adminDataqueryAll(params) {
return request(`/wms/ngic-auth/sysRoleDataPermission/queryAll`, { return request(`/wmspro/ngic-auth/sysRoleDataPermission/queryAll`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//不包含自己在内的全部用户下拉框 //不包含自己在内的全部用户下拉框
export async function userSelect(params) { export async function userSelect(params) {
return request(`/wms/ngic-auth/sysUser/queryParentSelectionByUserId`, { return request(`/wmspro/ngic-auth/sysUser/queryParentSelectionByUserId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//全部用户下拉框 //全部用户下拉框
export async function allUserSelect(params) { export async function allUserSelect(params) {
return request(`/wms/ngic-auth/sysUser/query/selectbox/company`, { return request(`/wmspro/ngic-auth/sysUser/query/selectbox/company`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//根据工厂id查询树结构 //根据工厂id查询树结构
export async function departmentTree(params) { export async function departmentTree(params) {
return request(`/wms/ngic-auth/sysDepartment/query/tree`, { return request(`/wmspro/ngic-auth/sysDepartment/query/tree`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//查询角色下拉框 //查询角色下拉框
export async function roleSelect(params) { export async function roleSelect(params) {
return request(`/wms/ngic-auth/sysRole/queryAllSelectList`, { return request(`/wmspro/ngic-auth/sysRole/queryAllSelectList`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -131,14 +131,14 @@ export async function roleSelect(params) { ...@@ -131,14 +131,14 @@ export async function roleSelect(params) {
//查询角色下拉框---注册 //查询角色下拉框---注册
export async function roleSelectRegister(params) { export async function roleSelectRegister(params) {
return request(`/wms/ngic-auth/sysRole/queryAllSelectByComId`, { return request(`/wmspro/ngic-auth/sysRole/queryAllSelectByComId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//查询全部编号类型下拉框(登录人公司) //查询全部编号类型下拉框(登录人公司)
export async function bmNoRule(params) { export async function bmNoRule(params) {
return request(`/wms/ngic-base-business/bmNoRule/querySelect`, { return request(`/wmspro/ngic-base-business/bmNoRule/querySelect`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -146,7 +146,7 @@ export async function bmNoRule(params) { ...@@ -146,7 +146,7 @@ export async function bmNoRule(params) {
//根据物料查询产线下拉框 //根据物料查询产线下拉框
export async function productionLineSelectByMaterieId(params) { export async function productionLineSelectByMaterieId(params) {
return request(`/wms/ngic-auth/sysProductionLine/query/selectbox/materieId`, { return request(`/wmspro/ngic-auth/sysProductionLine/query/selectbox/materieId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -154,7 +154,7 @@ export async function productionLineSelectByMaterieId(params) { ...@@ -154,7 +154,7 @@ export async function productionLineSelectByMaterieId(params) {
//根据物料查询班组下拉框 //根据物料查询班组下拉框
export async function groupSelectByMaterieId(params) { export async function groupSelectByMaterieId(params) {
return request(`/wms/ngic-auth/sysGroup/query/selectbox/materieId`, { return request(`/wmspro/ngic-auth/sysGroup/query/selectbox/materieId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -162,7 +162,7 @@ export async function groupSelectByMaterieId(params) { ...@@ -162,7 +162,7 @@ export async function groupSelectByMaterieId(params) {
//根据物料查询班次下拉框 //根据物料查询班次下拉框
export async function shiftSelectByMaterieId(params) { export async function shiftSelectByMaterieId(params) {
return request(`/wms/ngic-auth/sysShift/query/selectbox/materieId`, { return request(`/wmspro/ngic-auth/sysShift/query/selectbox/materieId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
...@@ -170,21 +170,21 @@ export async function shiftSelectByMaterieId(params) { ...@@ -170,21 +170,21 @@ export async function shiftSelectByMaterieId(params) {
//根据车间id查询班次下拉框 //根据车间id查询班次下拉框
export async function shiftSelectByShopId(params) { export async function shiftSelectByShopId(params) {
return request(`/wms/ngic-auth/sysShift/query/selectbox/shopId`, { return request(`/wmspro/ngic-auth/sysShift/query/selectbox/shopId`, {
method: "POST", method: "POST",
data: params, data: params,
}); });
} }
//角色下拉框 //角色下拉框
export async function roleList(params) { export async function roleList(params) {
return request(`/wms/ngic-auth/sysRole/queryAllSelectList`, { return request(`/wmspro/ngic-auth/sysRole/queryAllSelectList`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
} }
//集团下拉框 //集团下拉框
export async function factory(params) { export async function factory(params) {
return request(`/wms/ngic-auth/sysDepartment/query/selectbox/factory`, { return request(`/wmspro/ngic-auth/sysDepartment/query/selectbox/factory`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -193,21 +193,21 @@ export async function factory(params) { ...@@ -193,21 +193,21 @@ export async function factory(params) {
// 4 : // 4 :
//集团下拉框 //集团下拉框
export async function zuzhi(params) { export async function zuzhi(params) {
return request(`/wms/ngic-auth/sysDepartment/query/tree`, { return request(`/wmspro/ngic-auth/sysDepartment/query/tree`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
} }
//集团下拉框 //集团下拉框
export async function depart(params) { export async function depart(params) {
return request(`/wms/ngic-auth/sysDepartment/query/selectbox/depart`, { return request(`/wmspro/ngic-auth/sysDepartment/query/selectbox/depart`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
} }
//集团下拉框 //集团下拉框
export async function selectionBoxAll(params) { export async function selectionBoxAll(params) {
return request(`/wms/ngic-auth/sysStore/selectionBoxAll`, { return request(`/wmspro/ngic-auth/sysStore/selectionBoxAll`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -216,21 +216,21 @@ export async function selectionBoxAll(params) { ...@@ -216,21 +216,21 @@ export async function selectionBoxAll(params) {
//下拉框---当前公司下 //下拉框---当前公司下
export async function currentUserList(params) { export async function currentUserList(params) {
return request(`/wms/ngic-auth/sysUser/query/selectbox/current/company`, { return request(`/wmspro/ngic-auth/sysUser/query/selectbox/current/company`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
} }
//当前公司所有工厂下拉 //当前公司所有工厂下拉
export async function allShop(params) { export async function allShop(params) {
return request(`/wms/ngic-auth/sysShop/query/selectbox/current/company`, { return request(`/wmspro/ngic-auth/sysShop/query/selectbox/current/company`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
} }
//当前公司所有车间下拉 //当前公司所有车间下拉
export async function allSection(params) { export async function allSection(params) {
return request(`/wms/ngic-auth/sysSection/query/selectbox`, { return request(`/wmspro/ngic-auth/sysSection/query/selectbox`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -238,7 +238,7 @@ export async function allSection(params) { ...@@ -238,7 +238,7 @@ export async function allSection(params) {
//查询全部编号类型下拉框(登录人公司) //查询全部编号类型下拉框(登录人公司)
export async function bmNoTypeadd(params) { export async function bmNoTypeadd(params) {
return request(`/wms/ngic-base-business/bmNoType/querySelect`, { return request(`/wmspro/ngic-base-business/bmNoType/querySelect`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -246,7 +246,7 @@ export async function bmNoTypeadd(params) { ...@@ -246,7 +246,7 @@ export async function bmNoTypeadd(params) {
//查询全部编号类型下拉框(登录人公司) //查询全部编号类型下拉框(登录人公司)
export async function bmNoType(params) { export async function bmNoType(params) {
return request(`/wms/ngic-base-business/bmNoType/queryAllSelect`, { return request(`/wmspro/ngic-base-business/bmNoType/queryAllSelect`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
......
...@@ -11,7 +11,7 @@ export async function doFetch({ url, params }) { ...@@ -11,7 +11,7 @@ export async function doFetch({ url, params }) {
if(!url){ if(!url){
return return
} }
return request("/wms" + url, { return request("/wmspro" + url, {
method: "POST", method: "POST",
data: params, data: params,
}); });
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
import { extend } from "umi-request"; import { extend } from "umi-request";
import { message, notification, Modal } from "antd"; import { message, notification, Modal } from "antd";
import { history } from "umi"; import { history } from "umi";
const { NODE_ENV } = process.env;
const baseUrl = NODE_ENV == "development" ? "/wmspro" : "";
const codeMessage = { const codeMessage = {
200: "服务器成功返回请求的数据。", 200: "服务器成功返回请求的数据。",
201: "新建或修改数据成功。", 201: "新建或修改数据成功。",
...@@ -61,28 +62,67 @@ const request = extend({ ...@@ -61,28 +62,67 @@ const request = extend({
// request拦截器, 改变url 或 options. // request拦截器, 改变url 或 options.
request.interceptors.request.use(async (url, options) => { request.interceptors.request.use(async (url, options) => {
let token = let token = localStorage.getItem("TOKEN_MES") ?? "",
localStorage.getItem("TOKEN_MES") ?? "9410b3f7de5d63f2be42d80ec8241d2d"; headers = {};
if (token) {
const headers = if (NODE_ENV == "development" && token) {
headers =
options.type == "form" options.type == "form"
? { ? {
token: token, Authorization: "Bearer " + token,
} }
: { : {
"Content-Type": "application/json", "Content-Type": "application/json",
Accept: "application/json", Accept: "application/json",
token: token, Authorization: "Bearer " + token,
}; };
return { } else {
url: url, headers =
options: { ...options, headers: headers }, options.type == "form"
? {}
: {
"Content-Type": "application/json",
Accept: "application/json",
}; };
} }
return {
url: baseUrl + url,
options: { ...options, headers },
};
}); });
// response拦截器, 处理response // response拦截器, 处理response
request.interceptors.response.use(async (response, options) => { request.interceptors.response.use(async (response, options) => {
if (response && response.status) {
const errorText = codeMessage[response.status] || response.statusText;
const { status, url } = response;
if (
response?.url.indexOf("api/user_token") == -1 &&
Object.keys(codeMessage).indexOf(String(response.status)) > -1
) {
notification.error({
// message: `请求错误 ${status}: ${url}`,
description: errorText,
});
}
if (status == "401") {
clearCookie();
}
if (status == "401" || status == "302" || status == "400") {
if (NODE_ENV == "development") {
} else {
window.location.href = "/";
}
}
} else if (!response) {
if (response?.url.indexOf("api/user_token") == -1) {
notification.error({
description: "您的网络发生异常,无法连接服务器",
message: "网络异常",
});
}
}
if (options.responseType == "blob") { if (options.responseType == "blob") {
const data = await response.clone().blob(); const data = await response.clone().blob();
let blobUrl = window.URL.createObjectURL(data); let blobUrl = window.URL.createObjectURL(data);
...@@ -102,6 +142,7 @@ request.interceptors.response.use(async (response, options) => { ...@@ -102,6 +142,7 @@ request.interceptors.response.use(async (response, options) => {
} else { } else {
const data = await response.clone().json(); const data = await response.clone().json();
// 详情返回的response处理 // 详情返回的response处理
if (data?.code != "0000") { if (data?.code != "0000") {
message.destroy(); message.destroy();
message.warn(data?.msg); message.warn(data?.msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment