Commit 8da80395 authored by krysent's avatar krysent

new

parent 777f6d43
......@@ -6,7 +6,7 @@ import proxy from "./proxy";
import routes from "./routes";
const { REACT_APP_ENV } = process.env;
export default defineConfig({
outputPath: 'wms',
outputPath: "sr",
hash: true,
antd: {},
dva: {
......@@ -56,6 +56,7 @@ export default defineConfig({
nodeModulesTransform: {
type: "all",
},
headScripts: [`alert(0)`, { src: "/LodopFuncs.js", defer: true }],
//mfsu: {},
//webpack5: {}
});
......@@ -11,7 +11,8 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/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,
pathRewrite: {
"^/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) => {
}
const result = await doFetch({ url: path, params: newparams });
//分页结果
let data = result?.data?.page?.list,
let data = result?.data?.page?.records,
success = true,
total = result?.data?.page?.total;
//不带分页获取结果
......
......@@ -3,7 +3,7 @@ import {
UserOutlined,
LoginOutlined,
ArrowRightOutlined,
CloseOutlined
CloseOutlined,
} from "@ant-design/icons";
import { Alert, message, Tabs, Row, Col, Button, Input } from "antd";
import React, { useState, useRef } from "react";
......@@ -15,7 +15,7 @@ import {
LoginForm,
ProFormTreeSelect,
ProFormSelect,
ProFormTextArea
ProFormTextArea,
} from "@ant-design/pro-form";
import { Link, history, FormattedMessage, useModel } from "umi";
import { fakeAccountLogin, saveForRegister } from "@/services/login";
......@@ -36,8 +36,8 @@ import {
roleSelectRegister,
} from "@/services/system";
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;
......@@ -109,16 +109,13 @@ const Login = () => {
}
};
const handleSubmit = async (values) => {
if (tabkey == "1") {
await handleLogin(values)
await handleLogin(values);
} else {
await handleReg(values)
}
await handleReg(values);
}
};
return (
<Row className={styles.container}>
......@@ -133,16 +130,24 @@ const Login = () => {
<div className="cover">
<img alt="logo" src={require("@/assets/logo_white.png")} />
</div>
{
visible && <div className={styles.search}>
<h2 style={{ fontSize: 16, borderBottom: "6px solid #eee", marginBottom: 12, paddingBottom: 12 }} className="spread">
<a>
查询注册进度
</a>
<CloseOutlined style={{ color: "red" }} onClick={() => {
setvisible(false)
}}>
</CloseOutlined>
{visible && (
<div className={styles.search}>
<h2
style={{
fontSize: 16,
borderBottom: "6px solid #eee",
marginBottom: 12,
paddingBottom: 12,
}}
className="spread"
>
<a>查询注册进度</a>
<CloseOutlined
style={{ color: "red" }}
onClick={() => {
setvisible(false);
}}
></CloseOutlined>
</h2>
<Search
placeholder="请输入用户名"
......@@ -166,129 +171,139 @@ const Login = () => {
<ProDescriptions
columns={[
{
"title": "用户名",
"dataIndex": "accountName",
"key": "accountName"
title: "用户名",
dataIndex: "accountName",
key: "accountName",
},
{
"title": "姓名",
"dataIndex": "userName",
"key": "userName"
title: "姓名",
dataIndex: "userName",
key: "userName",
},
{
"title": "联系电话",
"dataIndex": "telephone",
"key": "telephone"
title: "联系电话",
dataIndex: "telephone",
key: "telephone",
},
{
"title": "工厂",
"dataIndex": "factoryName",
"key": "factoryName"
title: "工厂",
dataIndex: "factoryName",
key: "factoryName",
},
{
"title": "组织",
"dataIndex": "departmentName",
"key": "departmentName"
title: "组织",
dataIndex: "departmentName",
key: "departmentName",
},
{
"title": "负责仓库",
"dataIndex": "chargeStoreName",
"key": "chargeStoreName"
title: "负责仓库",
dataIndex: "chargeStoreName",
key: "chargeStoreName",
},
{
"title": "角色",
"dataIndex": "roleName",
"key": "roleName"
title: "角色",
dataIndex: "roleName",
key: "roleName",
},
{
"title": "直属领导",
"dataIndex": "parentName",
"key": "parentName"
title: "直属领导",
dataIndex: "parentName",
key: "parentName",
},
{
"title": "邮箱",
"dataIndex": "mailNo",
"key": "mailNo"
title: "邮箱",
dataIndex: "mailNo",
key: "mailNo",
},
{
"title": "审批结果",
"dataIndex": "auditResultName",
"key": "auditResultName"
title: "审批结果",
dataIndex: "auditResultName",
key: "auditResultName",
},
{
"title": "审批意见",
"dataIndex": "auditOpinion",
"key": "auditOpinion"
title: "审批意见",
dataIndex: "auditOpinion",
key: "auditOpinion",
},
{
"title": "审批状态",
"dataIndex": "statusName",
"key": "statusName"
title: "审批状态",
dataIndex: "statusName",
key: "statusName",
},
{
"title": "备注",
"dataIndex": "remark",
"key": "remark"
title: "备注",
dataIndex: "remark",
key: "remark",
},
{
"title": "申请时间",
"dataIndex": "applyTime",
"key": "applyTime"
title: "申请时间",
dataIndex: "applyTime",
key: "applyTime",
},
{
"title": "审批时间",
"dataIndex": "auditTime",
"key": "auditTime"
title: "审批时间",
dataIndex: "auditTime",
key: "auditTime",
},
{
"title": "审批人",
"dataIndex": "auditUserName",
"key": "auditUserName"
}
title: "审批人",
dataIndex: "auditUserName",
key: "auditUserName",
},
]}
column={1}
dataSource={data}
></ProDescriptions>
</div>
}
)}
</div>
</Col>
<Col {...cols} onClick={() => {
setvisible(false)
}}>
<div className="logincontent" style={{ width: "100%", height: "100%", display: "flex", flexDirection: "column" }}>
<Col
{...cols}
onClick={() => {
setvisible(false);
}}
>
<div
className="logincontent"
style={{
width: "100%",
height: "100%",
display: "flex",
flexDirection: "column",
}}
>
<div className={styles.content}>
<LoginForm
submitter={{
render: (props) => {
return <Button
return (
<Button
{...props}
style={{ width: "100%" }}
type="primary"
size="large"
icon={tabkey === "1" ? <LoginOutlined /> : <ArrowRightOutlined />}
icon={
tabkey === "1" ? (
<LoginOutlined />
) : (
<ArrowRightOutlined />
)
}
onClick={async () => {
let values = await formRef.current.validateFields()
let values = await formRef.current.validateFields();
await handleSubmit(values);
}}
>
{tabkey === "1" ? "登录" : "注册"}
</Button>
}
);
},
}}
onValuesChange={async (values) => {
if (Object.keys(values)[0] == "factoryIdList") {
formRef.current.setFieldsValue({ storeIdList: [] });
}
}}
title={<span style={{ color: "#fff" }}>WMS</span>}
subTitle={
......@@ -302,7 +317,10 @@ const Login = () => {
onFinish={async (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}
>
<Tabs
......@@ -310,10 +328,17 @@ const Login = () => {
activeKey={tabkey}
onChange={settabkey}
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();
setvisible(true)
}}>查询注册进度</a>}
setvisible(true);
}}
>
查询注册进度
</a>
}
>
<TabPane tab="登录" key="1">
{tabkey == "1" && (
......@@ -322,7 +347,9 @@ const Login = () => {
name="userName"
fieldProps={{
size: "large",
prefix: <UserOutlined className={styles.prefixIcon} />,
prefix: (
<UserOutlined className={styles.prefixIcon} />
),
}}
placeholder="用户名"
rules={[
......@@ -336,7 +363,9 @@ const Login = () => {
name="password"
fieldProps={{
size: "large",
prefix: <LockOutlined className={styles.prefixIcon} />,
prefix: (
<LockOutlined className={styles.prefixIcon} />
),
}}
placeholder="密码"
rules={[
......@@ -356,8 +385,8 @@ const Login = () => {
<ProFormText
fieldProps={{
style: {
height: 32
}
height: 32,
},
}}
name="accountName"
label={<b>用户名</b>}
......@@ -375,8 +404,8 @@ const Login = () => {
<ProFormText
fieldProps={{
style: {
height: 32
}
height: 32,
},
}}
name="userName"
label={<b>姓名</b>}
......@@ -394,8 +423,8 @@ const Login = () => {
<ProFormText
fieldProps={{
style: {
height: 32
}
height: 32,
},
}}
name="telephone"
label={<b>联系电话</b>}
......@@ -406,7 +435,8 @@ const Login = () => {
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: "手机号格式错误!",
},
]}
......@@ -422,18 +452,18 @@ const Login = () => {
fieldNames: {
label: "title",
value: "key",
children: "children"
}
children: "children",
},
}}
request={async () => {
let res = await departmentTree({});
return res?.data?.dataList ?? []
return res?.data?.dataList ?? [];
}}
rules={[
{
required: true,
message: "请选择组织!",
}
},
]}
/>
</Col>
......@@ -442,28 +472,28 @@ const Login = () => {
<ProFormSelect
fieldProps={{
mode: "multiple",
maxTagCount: 1
maxTagCount: 1,
}}
name="factoryIdList"
label={<b>工厂</b>}
placeholder="请选择工厂"
request={async () => {
let res = await factorySelectRegister({});
return res?.data?.dataList ?? []
return res?.data?.dataList ?? [];
}}
rules={[
{
required: true,
message: "请选择工厂!",
}
},
]}
/>
</Col>
<Col span={8}>
<ProFormDependency name={["factoryIdList"]}>
{
({ factoryIdList }) => {
return <ProFormSelect
{({ factoryIdList }) => {
return (
<ProFormSelect
fieldProps={{
mode: "multiple",
maxTagCount: 1,
......@@ -474,19 +504,17 @@ const Login = () => {
params={{ factoryIdList }}
request={async (params) => {
let res = await storeselectionBoxAll(params);
return res?.data?.dataList ?? []
return res?.data?.dataList ?? [];
}}
rules={[
{
required: false,
message: "请选择负责仓库!",
}
},
]}
/>
}
}
);
}}
</ProFormDependency>
</Col>
......@@ -494,20 +522,20 @@ const Login = () => {
<ProFormSelect
fieldProps={{
mode: "multiple",
maxTagCount: 1
maxTagCount: 1,
}}
name="roleIdList"
label={<b>角色配置</b>}
placeholder="请选择角色配置"
request={async () => {
let res = await roleSelectRegister({});
return res?.data?.dataList ?? []
return res?.data?.dataList ?? [];
}}
rules={[
{
required: false,
message: "请选择角色配置!",
}
},
]}
/>
</Col>
......@@ -519,13 +547,13 @@ const Login = () => {
placeholder="请选择直属领导"
request={async () => {
let res = await allUserSelect({});
return res?.data?.dataList ?? []
return res?.data?.dataList ?? [];
}}
rules={[
{
required: false,
message: "请选择直属领导!",
}
},
]}
/>
</Col>
......@@ -533,8 +561,8 @@ const Login = () => {
<ProFormText
fieldProps={{
style: {
height: 32
}
height: 32,
},
}}
name="mailNo"
label={<b>邮箱</b>}
......@@ -543,7 +571,7 @@ const Login = () => {
{
required: false,
message: "请输入邮箱!",
}
},
]}
/>
</Col>
......@@ -555,13 +583,13 @@ const Login = () => {
placeholder="请输入备注"
request={async () => {
let res = await allUserSelect({});
return res?.data?.dataList ?? []
return res?.data?.dataList ?? [];
}}
rules={[
{
required: false,
message: "请输入备注!",
}
},
]}
/>
</Col>
......@@ -586,10 +614,16 @@ const Login = () => {
</Link> */}
</div>
</LoginForm>
<Button
onClick={() => {
start();
}}
>
start
</Button>
</div>
<Footer></Footer>
</div>
</Col>
</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