Commit 8da80395 authored by krysent's avatar krysent

new

parent 777f6d43
...@@ -6,7 +6,7 @@ import proxy from "./proxy"; ...@@ -6,7 +6,7 @@ import proxy from "./proxy";
import routes from "./routes"; import routes from "./routes";
const { REACT_APP_ENV } = process.env; const { REACT_APP_ENV } = process.env;
export default defineConfig({ export default defineConfig({
outputPath: 'wms', outputPath: "sr",
hash: true, hash: true,
antd: {}, antd: {},
dva: { dva: {
...@@ -56,6 +56,7 @@ export default defineConfig({ ...@@ -56,6 +56,7 @@ export default defineConfig({
nodeModulesTransform: { nodeModulesTransform: {
type: "all", type: "all",
}, },
headScripts: [`alert(0)`, { src: "/LodopFuncs.js", defer: true }],
//mfsu: {}, //mfsu: {},
//webpack5: {} //webpack5: {}
}); });
...@@ -11,7 +11,8 @@ export default { ...@@ -11,7 +11,8 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/** // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/wms/": { "/wms/": {
// 要代理的地址 // 要代理的地址
target: "http://192.168.40.18/wms/", //39:28040 18/wms/ // target: "http://192.168.40.18/wms/", //39:28040 18/wms/
target: "http://192.168.40.203:28040", //39:28040 18/wms/
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
"^/wms": "", "^/wms": "",
......
//用双端口加载主JS文件Lodop.js(或CLodopfuncs.js兼容老版本)以防其中某端口被占:
var MainJS = "CLodopfuncs.js",
URL_WS1 = "ws://localhost:8000/" + MainJS, //ws用8000/18000
URL_WS2 = "ws://localhost:18000/" + MainJS,
URL_HTTP1 = "http://localhost:8000/" + MainJS, //http用8000/18000
URL_HTTP2 = "http://localhost:18000/" + MainJS,
URL_HTTP3 = "https://localhost.lodop.net:8443/" + MainJS; //https用8000/8443
//==检查加载成功与否,如没成功则用http(s)再试==
//==低版本CLODOP6.561/Lodop7.043及前)用本方法==
function checkOrTryHttp() {
if (window.getCLodop) return true;
var head =
document.head ||
document.getElementsByTagName("head")[0] ||
document.documentElement;
var JS1 = document.createElement("script"),
JS2 = document.createElement("script"),
JS3 = document.createElement("script");
JS1.src = URL_HTTP1;
JS2.src = URL_HTTP2;
JS3.src = URL_HTTP3;
JS1.onerror = function (e) {
if (window.location.protocol !== "https:")
head.insertBefore(JS2, head.firstChild);
else head.insertBefore(JS3, head.firstChild);
};
JS2.onerror = JS3.onerror = function () {
var JSelf = document.createElement("script");
JSelf.src = "/" + MainJS; //JSelf让其它电脑通过本机打印(仅适用CLodop自带例子)
document.head.insertBefore(JSelf, document.head.firstChild);
};
head.insertBefore(JS1, head.firstChild);
}
//==加载Lodop对象的主过程:==
(function loadCLodop() {
if (!window.WebSocket && window.MozWebSocket)
window.WebSocket = window.MozWebSocket;
//ws方式速度快(小于200ms)且可避免CORS错误,但要求Lodop版本足够新:
try {
var WSK1 = new WebSocket(URL_WS1);
WSK1.onopen = function (e) {
setTimeout("checkOrTryHttp()", 200);
};
WSK1.onmessage = function (e) {
if (!window.getCLodop) eval(e.data);
};
WSK1.onerror = function (e) {
var WSK2 = new WebSocket(URL_WS2);
WSK2.onopen = function (e) {
setTimeout("checkOrTryHttp()", 200);
};
WSK2.onmessage = function (e) {
if (!window.getCLodop) eval(e.data);
};
WSK2.onerror = function (e) {
checkOrTryHttp();
};
};
} catch (e) {
checkOrTryHttp();
}
})();
//==获取LODOP对象的主过程:==
function getLodop(oOBJECT, oEMBED) {
var LODOP;
try {
LODOP = window.getCLodop();
if (!LODOP && document.readyState !== "complete") {
alert("C-Lodop没准备好,请稍后再试!");
return;
}
//清理原例子内的object或embed元素,避免乱提示:
if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED);
if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT);
return LODOP;
} catch (err) {
alert("getLodop出错:" + err);
}
}
/*
* 佛曰:
* 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱
* 酒醒只在网上坐,酒醉还来网下眠
* 酒醉酒醒日复日,网上网下年复年
* 但愿老死电脑间,不愿鞠躬老板前
* 奔驰宝马贵者趣,公交自行程序员
* 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员?
*/
...@@ -46,7 +46,7 @@ const Mtable = (props) => { ...@@ -46,7 +46,7 @@ const Mtable = (props) => {
} }
const result = await doFetch({ url: path, params: newparams }); const result = await doFetch({ url: path, params: newparams });
//分页结果 //分页结果
let data = result?.data?.page?.list, let data = result?.data?.page?.records,
success = true, success = true,
total = result?.data?.page?.total; total = result?.data?.page?.total;
//不带分页获取结果 //不带分页获取结果
......
...@@ -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,8 @@ import { ...@@ -36,8 +36,8 @@ 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";
import { start } from "@/utils/printHandle.js";
const { Search } = Input; const { Search } = Input;
...@@ -109,16 +109,13 @@ const Login = () => { ...@@ -109,16 +109,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 +130,24 @@ const Login = () => { ...@@ -133,16 +130,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 +171,139 @@ const Login = () => { ...@@ -166,129 +171,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 +317,10 @@ const Login = () => { ...@@ -302,7 +317,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 +328,17 @@ const Login = () => { ...@@ -310,10 +328,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 +347,9 @@ const Login = () => { ...@@ -322,7 +347,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 +363,9 @@ const Login = () => { ...@@ -336,7 +363,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 +385,8 @@ const Login = () => { ...@@ -356,8 +385,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 +404,8 @@ const Login = () => { ...@@ -375,8 +404,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 +423,8 @@ const Login = () => { ...@@ -394,8 +423,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 +435,8 @@ const Login = () => { ...@@ -406,7 +435,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 +452,18 @@ const Login = () => { ...@@ -422,18 +452,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 +472,28 @@ const Login = () => { ...@@ -442,28 +472,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 +504,17 @@ const Login = () => { ...@@ -474,19 +504,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 +522,20 @@ const Login = () => { ...@@ -494,20 +522,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 +547,13 @@ const Login = () => { ...@@ -519,13 +547,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 +561,8 @@ const Login = () => { ...@@ -533,8 +561,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 +571,7 @@ const Login = () => { ...@@ -543,7 +571,7 @@ const Login = () => {
{ {
required: false, required: false,
message: "请输入邮箱!", message: "请输入邮箱!",
} },
]} ]}
/> />
</Col> </Col>
...@@ -555,13 +583,13 @@ const Login = () => { ...@@ -555,13 +583,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>
...@@ -586,10 +614,16 @@ const Login = () => { ...@@ -586,10 +614,16 @@ const Login = () => {
</Link> */} </Link> */}
</div> </div>
</LoginForm> </LoginForm>
<Button
onClick={() => {
start();
}}
>
start
</Button>
</div> </div>
<Footer></Footer> <Footer></Footer>
</div> </div>
</Col> </Col>
</Row> </Row>
); );
......
import src from "../../public/ewm.png";
export const str = `<table
border="1"
width="100%"
height="100%"
style="border-collapse: collapse; border: solid 1px"
bordercolor="#000000"
cellpadding="0"
>
<tr>
<td colspan="6">卷料名称:剪切后硅钢片</td>
</tr>
<tr>
<td colspan="6">卷料编码:PDC010100093</td>
</tr>
<tr>
<td colspan="3">牌号:070片</td>
<td colspan="3">母卷编号:20SQC</td>
</tr>
<tr>
<td colspan="3">厂家:江苏南高</td>
<td colspan="3">母卷重量:100KG</td>
</tr>
<tr>
<td colspan="2" rowspan='4'><img src=${src} width='80%' /></td>
<td colspan="4">单边卷料厚度:200mm</td>
</tr>
<tr>
<td colspan="2">铁损:0.68w/kg</td>
<td colspan="2">批次:20230412</td>
</tr>
<tr>
<td colspan="2">宽度:188mm</td>
<td colspan="2">片厚:0.2mm</td>
</tr>
<tr>
<td colspan="2">重量:631KG</td>
<td colspan="2">米数2292M</td>
</tr>
<tr>
<td colspan="6">条码:1BR157846039401296</td>
</tr>
</table>`;
import { str } from '@/utils/mymodelhtml.js'
export function start() {
if (!getLodop) {
alert("系统检测当前环境未安装相关插件,请先安装C-Lodop插件!");
return;
}
let LODOP = getLodop();
LODOP.PRINT_INIT("task1");
LODOP.ADD_PRINT_HTM(0,0,"100%","100%",str);
LODOP.SET_PRINT_PAGESIZE(0, 800, 600, "");
LODOP.PREVIEW();
// LODOP.PRINT();
}
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