Commit 7275ba80 authored by wuhao's avatar wuhao 🎯

sdasere

parent 91478e68
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
"lodash": "^4.17.0", "lodash": "^4.17.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"omit.js": "^2.0.2", "omit.js": "^2.0.2",
"qrcode.react": "^3.1.0",
"rc-menu": "^9.1.0", "rc-menu": "^9.1.0",
"rc-util": "^5.16.0", "rc-util": "^5.16.0",
"react": "^17.0.0", "react": "^17.0.0",
......
import React, { useEffect, useRef, useState, useMemo } from "react"; import React, { useEffect, useRef, useState, memo } from "react";
import { ProTable } from "@ant-design/pro-components"; import { ProTable } from "@ant-design/pro-components";
import Resizecell from "./Resizecell"; import Resizecell from "./Resizecell";
import { Tooltip } from "antd"; import { Tooltip } from "antd";
...@@ -311,4 +311,4 @@ const Mtable = (props) => { ...@@ -311,4 +311,4 @@ const Mtable = (props) => {
); );
}; };
export default Mtable; export default memo(Mtable);
import React, { useState, useEffect, memo } from "react"; import React, { useState, useEffect, memo } from "react";
import { import {
Table, Table,
Divider, Divider,
Card, Card,
Button, Button,
Typography, Typography,
Spin, Spin,
Row, Row,
Col, Col,
Tooltip, Tooltip,
Rate, Rate,
Image, Image,
message, message,
Section Section,
} from "antd"; } from "antd";
import { doFetch, postFetch } from "@/utils/doFetch"; import { doFetch, postFetch } from "@/utils/doFetch";
import AutoTable from "@/components/Tableform"; import AutoTable from "@/components/Tableform";
import { useModel } from 'umi' import { useModel } from "umi";
import styles from "./index.less"; import styles from "./index.less";
import PrintProvider, { Print, NoPrint } from 'react-easy-print'; import PrintProvider, { Print, NoPrint } from "react-easy-print";
const Details = (props) => { const Details = (props) => {
/** /**
* dataSource: 整个页面的数据,Object * dataSource: 整个页面的数据,Object
* totalPath: 整个详情页的接口,String * totalPath: 整个详情页的接口,String
* totalParams: 整个详情页接口的参数 * totalParams: 整个详情页接口的参数
* totalCard: 整个页面的模块,Array * totalCard: 整个页面的模块,Array
* col: 列数 * col: 列数
* *
* totalCard中的每一项变量:cardTitle每一个模块的标题;itemData每一个模块的数据信息(Array) * totalCard中的每一项变量:cardTitle每一个模块的标题;itemData每一个模块的数据信息(Array)
* itemData中的每一项变量:key所对应的字段;title每一项label标题;type每一项的类型(file,img,textarea,table,不填默认就是普通的展示类型);col每一项的占比;columns表格类型所用;path当类型为表格时,若该表格是单独查询出来的可以填入path;urlName 当传入文件为url为字符串时 * itemData中的每一项变量:key所对应的字段;title每一项label标题;type每一项的类型(file,img,textarea,table,不填默认就是普通的展示类型);col每一项的占比;columns表格类型所用;path当类型为表格时,若该表格是单独查询出来的可以填入path;urlName 当传入文件为url为字符串时
* *
*/ */
const { const {
totalPath = "", totalPath = "",
dataSource, dataSource,
totalCard, totalCard,
totalParams, totalParams,
col, col,
bottomNode, bottomNode,
topNode, topNode,
printRef, printRef,
onloadeddata, onloadeddata,
reload reload,
} = props; } = props;
const [pageData, cp] = useState({}); const [pageData, cp] = useState({});
const { initialState, setInitialState } = useModel("@@initialState"); const { initialState, setInitialState } = useModel("@@initialState");
useEffect(() => { useEffect(() => {
if (dataSource) { if (dataSource) {
cp(dataSource); cp(dataSource);
} else if (!dataSource && !Array.isArray(totalPath)) { } else if (!dataSource && !Array.isArray(totalPath)) {
doFetch({ doFetch({
url: totalPath, url: totalPath,
params: totalParams ? { ...totalParams } : {}, params: totalParams ? { ...totalParams } : {},
}).then((res) => { }).then((res) => {
if (res.code == "0000") { if (res.code == "0000") {
if (!res.data) { if (!res.data) {
return; return;
} }
cp(res?.data?.data); cp(res?.data?.data);
}
});
} }
}, []); });
}
useEffect(() => { }, []);
onloadeddata?.(pageData);
}, [pageData])
useEffect(() => {
onloadeddata?.(pageData);
}, [pageData]);
const getCol = (itemcol) => { const getCol = (itemcol) => {
if (itemcol) { if (itemcol) {
return itemcol; return itemcol;
} else { } else {
return col ? col : { xs: 24, sm: 24, md: 12, lg: 8, xl: 8, xxl: 6 }; return col ? col : { xs: 24, sm: 24, md: 12, lg: 8, xl: 8, xxl: 6 };
} }
}; };
//获取每一项 //获取每一项
const getItem = (itemData) => { const getItem = (itemData) => {
const { const {
type, type,
key, key,
title, title,
columns, columns,
path, path,
urlName, urlName,
col, col,
rowKey, rowKey,
expandable, expandable,
pagination pagination,
} = itemData, rowSelection,
value = pageData[key]; } = itemData,
if (!type || type == "input") { value = pageData[key];
return value == 0 || value ? ( if (!type || type == "input") {
<Tooltip title={`${title}:${value}`}> return value == 0 || value ? (
<pre className={col ? "" : styles.one}>{value}</pre> <Tooltip title={`${title}:${value}`}>
</Tooltip> <pre className={col ? "" : styles.one}>{value}</pre>
</Tooltip>
) : (
<div>-</div>
);
} else if (type == "file") {
return (
<div style={{ display: "flex", flexFlow: "row wrap", width: "100%" }}>
{value && typeof value == "string" ? (
<a
href={value}
download={value}
style={{ margin: "0 10px 0 0", display: "block" }}
>
{urlName ? urlName : "下载"}
</a>
) : value && Array.isArray(value) && value?.length ? (
value?.map((el) => {
return (
<a
key={el.url}
href={el.url}
download={el.name}
style={{ margin: "0 10px 0 0", display: "block" }}
>
{el.name}
</a>
);
})
) : (
"-"
)}
</div>
);
} else if (type == "img") {
return (
<div style={{ display: "flex", flexFlow: "row wrap" }}>
{value ? (
Array.isArray(value) && value.length > 0 ? (
value?.map((el) => {
return (
<Image
style={{ margin: "0 10px 0 0" }}
src={el?.url}
width={30}
height={30}
key={el?.uid}
></Image>
);
})
) : ( ) : (
<div>-</div> <Image
); style={{ margin: "0 10px 0 0" }}
} else if (type == "file") { src={value}
return ( width={itemData.width ?? 30}
<div style={{ display: "flex", flexFlow: "row wrap", width: "100%" }}> height={itemData.height ?? 30}
{value && typeof value == "string" ? ( ></Image>
<a )
href={value} ) : (
download={value} "-"
style={{ margin: "0 10px 0 0", display: "block" }} )}
> </div>
{urlName ? urlName : "下载"} );
</a> } else if (type == "table") {
) : value && Array.isArray(value) && value?.length ? ( return (
value?.map((el) => { value && (
return ( <AutoTable
<a columns={columns || []}
key={el.url} path={path ? path : null}
href={el.url} bordered={false}
download={el.name} dataSource={path ? null : value}
style={{ margin: "0 10px 0 0", display: "block" }} rowKey={rowKey ?? "id"}
> expandable={
{el.name} expandable
</a> ? {
); ...expandable,
}) defaultExpandedRowKeys: value?.map((it) => it.id),
) : ( }
"-" : null
)} }
</div> pagination={pagination}
); rowSelection={rowSelection}
} else if (type == "img") { ></AutoTable>
return ( )
<div style={{ display: "flex", flexFlow: "row wrap" }}> );
{ } else if (type == "rate") {
value ? return (
Array.isArray(value) && value.length > 0 ? <Rate
value?.map(el => { bordered={false}
return <Image style={{ margin: '0 10px 0 0' }} src={el?.url} width={30} height={30} key={el?.uid}></Image> className={"simple"}
}) style={{ width: "100%" }}
: disabled={itemData.disabled}
<Image style={{ margin: '0 10px 0 0' }} src={value} width={itemData.width ?? 30} height={itemData.height ?? 30}></Image> allowHalf={itemData.allowHalf ? itemData.allowHalf : false}
: value={value || 0}
"-" />
} );
</div> }
); };
} else if (type == "table") {
return (
value &&
<AutoTable
columns={columns || []}
path={path ? path : null}
bordered={false}
dataSource={path ? null : value}
rowKey={rowKey ?? "id"}
expandable={expandable ? {
...expandable,
defaultExpandedRowKeys: value?.map(it => it.id)
} : null}
pagination={pagination}
></AutoTable>
);
} else if (type == "rate") {
return (
<Rate
bordered={false}
className={"simple"}
style={{ width: "100%" }}
disabled={itemData.disabled}
allowHalf={itemData.allowHalf ? itemData.allowHalf : false}
value={value || 0}
/>
);
}
};
const pageStyle = ` const pageStyle = `
@media all { @media all {
.page-break { .page-break {
display: none; display: none;
...@@ -205,68 +224,80 @@ const Details = (props) => { ...@@ -205,68 +224,80 @@ const Details = (props) => {
} }
`; `;
return ( return (
<PrintProvider> <PrintProvider>
<div className={`${styles.bodyBox} detailCards`} ref={printRef ?? null}> <div className={`${styles.bodyBox} detailCards`} ref={printRef ?? null}>
<style type="text/css" media="print"> <style type="text/css" media="print">
{pageStyle} {pageStyle}
</style> </style>
<Spin spinning={false}> <Spin spinning={false}>
{topNode && <div>{topNode}</div>} {topNode && <div>{topNode}</div>}
{totalCard?.map((item, i) => { {totalCard?.map((item, i) => {
let Container = item?.noPrint ? NoPrint : Print; let Container = item?.noPrint ? NoPrint : Print;
return ( return (
<Container force={true}> <Container force={true}>
<Card <Card
key={i} key={i}
title={item.cardTitle} title={item.cardTitle}
bordered={false} bordered={false}
style={{ marginBottom: 16 }} style={{ marginBottom: 16 }}
bodyStyle={{ padding: "16px 10px" }} bodyStyle={{ padding: "16px 10px" }}
extra={item?.extra ? <Button type="primary" onClick={() => { extra={
doFetch({ url: item.extrapath, params: initialState[item.extrakey] }).then(res => { item.extraContent ? (
if (res.code == "0000") { item.extraContent
if (reload) { ) : item?.extra ? (
reload && reload() <Button
} else { type="primary"
message.success("操作成功"); onClick={() => {
} doFetch({
url: item.extrapath,
} params: initialState[item.extrakey],
}) }).then((res) => {
}}>保存</Button> : null} if (res.code == "0000") {
> if (reload) {
<Row gutter={[12, 12]}> reload && reload();
{item?.itemData?.map((it, j) => { } else {
return ( message.success("操作成功");
<Col key={j} {...getCol(it.col)}> }
<div style={{ width: "100%", display: "flex" }}> }
<div });
style={{ }}
flexShrink: 0, >
display: `${it.title ? "block" : "none"}`, 保存
textAlign: "right", </Button>
width: 126, ) : null
}} }
> >
{it.title} <Row gutter={[12, 12]}>
</div> {item?.itemData?.map((it, j) => {
{getItem(it)} return (
</div> <Col key={j} {...getCol(it.col)}>
</Col> <div style={{ width: "100%", display: "flex" }}>
); <div
})} style={{
</Row> flexShrink: 0,
</Card> display: `${it.title ? "block" : "none"}`,
</Container> textAlign: "right",
); width: 126,
}}
>
{it.title}
</div>
{getItem(it)}
</div>
</Col>
);
})} })}
{bottomNode && <div>{bottomNode}</div>} </Row>
</Spin> </Card>
</div> </Container>
</PrintProvider> );
})}
); {bottomNode && <div>{bottomNode}</div>}
</Spin>
</div>
</PrintProvider>
);
}; };
export default memo(Details); export default memo(Details);
import React, {
useState,
useImperativeHandle,
forwardRef,
useRef,
} from "react";
import styles from "./index.less";
import { QRCodeSVG } from "qrcode.react";
let PrintQrCode = forwardRef(({ selectedItems }, ref) => {
let printRef = useRef();
useImperativeHandle(ref, () => ({
dom: printRef,
}));
return (
<div className={styles.qrcode} ref={printRef}>
{selectedItems.map((item, i) => {
return (
<div key={item.id}>
<ul>
<li>
<p>
<b>物料编码: </b> <span>{item.materieCode}</span>
</p>
<p>
<b>物料名称: </b> <span>{item.materieName}</span>
</p>
<p>
<b>批次号/SN号: </b> <span>{item.materieControlNo}</span>
</p>
<p>
<b>供应商: </b> <span>{item.supplierName}</span>
</p>
</li>
<li>
<QRCodeSVG value={item.id} size={350}></QRCodeSVG>
</li>
</ul>
</div>
);
})}
</div>
);
});
export { PrintQrCode };
.qrcode{
position: fixed;
width: 1000px;
z-index: 999999;
left: 0;
top: 0;
display: block;
ul{
display: flex;
height: 500px;
border: 4px solid #dadada;
background-color: #ffffff;
box-sizing: border-box;
margin: 0;
padding: 0;
list-style: none;
>li:first-child{
flex: 1;
padding: 50px 0;
display: flex;
flex-direction: column;
font-size: 36px;
padding-left: 24px;
justify-content: space-between;
p{
margin: 0;
}
}
>li:last-child{
width: 400px;
height: 400px;
padding: 75px 50px 50px 0;
}
}
}
\ No newline at end of file
...@@ -256,45 +256,6 @@ const one = { ...@@ -256,45 +256,6 @@ const one = {
}, },
], ],
rowKey: "id", rowKey: "id",
},
"materialLists": {
value: [],
title: "物料信息",
type: "checktable",
col: { span: 24 },
name: ["materialLists"],
required: false,
path:"/ngic-workmanship/wmsMaterieInstore/queryList",
columns: [
{
"title": <span>物料编码-名称 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "materieId",
"key": "materieId",
"valueType": "select",
"width": 300,
"selectedRender":"InputNumber"
},
{
"title": "批次号/SN号",
"dataIndex": "materieControlNo",
"key": "materieControlNo"
},
{
"title": <span>入库数量 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "instroeNum",
"key": "instroeNum",
},
{
"title": "库存单位",
"dataIndex": "productionUnitName",
"key": "productionUnitName",
"readonly": 'productionUnitName',
"width": 88
},
],
rowKey: "id",
rowName:"materieInstoreNo",
pagination:true
} }
}, },
two = { two = {
...@@ -721,7 +682,7 @@ const one = { ...@@ -721,7 +682,7 @@ const one = {
rowKey: "id", rowKey: "id",
} }
}, },
detail = { detail = (setselected, dom) => ({
totalCard: [ totalCard: [
//物料详情 //物料详情
{ {
...@@ -761,11 +722,11 @@ const one = { ...@@ -761,11 +722,11 @@ const one = {
{ {
title: "备注", title: "备注",
key: "remark", key: "remark",
noshow:"100%", noshow: "100%",
}, },
{ {
title: "工单二维码", title: "工单二维码",
noshow:true, noshow: true,
key: "qrCodeUrl", key: "qrCodeUrl",
type: "img", type: "img",
width: 100, width: 100,
...@@ -775,6 +736,7 @@ const one = { ...@@ -775,6 +736,7 @@ const one = {
}, },
{ {
cardTitle: "物料信息列表", cardTitle: "物料信息列表",
extraContent: dom,
itemData: [ itemData: [
{ {
key: "materialList", key: "materialList",
...@@ -857,7 +819,12 @@ const one = { ...@@ -857,7 +819,12 @@ const one = {
/>, />,
}, },
pagination: "false", pagination: "false",
rowKey: "id" rowKey: "id",
rowSelection: {
onChange: (selectedRowKeys, selectedRows) => {
setselected(selectedRows)
},
}
}, },
], ],
}, },
...@@ -978,7 +945,7 @@ const one = { ...@@ -978,7 +945,7 @@ const one = {
], ],
}, },
] ]
}, doinsert = (fid, storeId) => ({ }), doinsert = (fid, storeId) => ({
totalCard: [ totalCard: [
//物料详情 //物料详情
{ {
......
...@@ -8,6 +8,7 @@ import getPrem from "@/utils/getPrem"; //权限判断fn ...@@ -8,6 +8,7 @@ import getPrem from "@/utils/getPrem"; //权限判断fn
import { useReactToPrint } from "react-to-print"; import { useReactToPrint } from "react-to-print";
import { useModel } from "umi"; import { useModel } from "umi";
import PrintDom from "./printdom"; import PrintDom from "./printdom";
import { PrintQrCode } from "@/components/PrintCode";
const keytoval = { const keytoval = {
one: 1, one: 1,
...@@ -43,6 +44,8 @@ const keytoval = { ...@@ -43,6 +44,8 @@ const keytoval = {
function Instore(props) { function Instore(props) {
const { initialState, setInitialState } = useModel("@@initialState"); const { initialState, setInitialState } = useModel("@@initialState");
const [activeTabKey, onTabChange] = useState("1"); const [activeTabKey, onTabChange] = useState("1");
const [selectKeys, setSelectKeys] = useState([]);
let [drawprops, setdrawprops] = useState({ let [drawprops, setdrawprops] = useState({
title: "", title: "",
visible: false, visible: false,
...@@ -58,7 +61,8 @@ function Instore(props) { ...@@ -58,7 +61,8 @@ function Instore(props) {
}), }),
actionRef = useRef(), actionRef = useRef(),
ChildRef = null, ChildRef = null,
printRef = useRef(); printRef = useRef(),
mutiPrintRef = useRef();
//操作完成后刷新 //操作完成后刷新
function reload() { function reload() {
...@@ -76,6 +80,29 @@ function Instore(props) { ...@@ -76,6 +80,29 @@ function Instore(props) {
content: () => printRef.current.dom.current, content: () => printRef.current.dom.current,
}); });
const mutiPrint = useReactToPrint({
content: () => mutiPrintRef.current.dom.current,
});
const PrintButton = (
<Button
disabled={!selectKeys.length}
onClick={() => {
mutiPrint();
}}
>
打印
</Button>
);
useEffect(() => {
const detail = defaultFields.detail(setSelectKeys, PrintButton);
setdrawprops((s) => ({
...s,
...detail,
}));
}, [selectKeys]);
const columns = useMemo(() => { const columns = useMemo(() => {
if (activeTabKey == "1") { if (activeTabKey == "1") {
return [ return [
...@@ -87,13 +114,17 @@ function Instore(props) { ...@@ -87,13 +114,17 @@ function Instore(props) {
return ( return (
<a <a
onClick={async () => { onClick={async () => {
const detail = defaultFields.detail(
setSelectKeys,
PrintButton
);
setdrawprops((s) => ({ setdrawprops((s) => ({
...s, ...s,
visible: true, visible: true,
//查看详情 props //查看详情 props
val: "detail", val: "detail",
title: `查看详情`, title: `查看详情`,
...defaultFields?.detail, ...detail,
totalPath: totalPath:
"/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById", "/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById",
totalParams: { id: record.id }, totalParams: { id: record.id },
...@@ -144,7 +175,7 @@ function Instore(props) { ...@@ -144,7 +175,7 @@ function Instore(props) {
key: "storeId", key: "storeId",
fieldProps: { fieldProps: {
allowClear: true, allowClear: true,
showSearch: true showSearch: true,
}, },
options: { options: {
database: () => database: () =>
...@@ -280,7 +311,7 @@ function Instore(props) { ...@@ -280,7 +311,7 @@ function Instore(props) {
totalPath: totalPath:
"/ngic-workmanship/wmsMaterieInstoreHis/getInStoreInfoById", "/ngic-workmanship/wmsMaterieInstoreHis/getInStoreInfoById",
totalParams: { id: record.id }, totalParams: { id: record.id },
extra:null extra: null,
})); }));
}} }}
> >
...@@ -319,7 +350,7 @@ function Instore(props) { ...@@ -319,7 +350,7 @@ function Instore(props) {
key: "storeId", key: "storeId",
fieldProps: { fieldProps: {
allowClear: true, allowClear: true,
showSearch: true showSearch: true,
}, },
options: { options: {
database: () => database: () =>
...@@ -437,6 +468,11 @@ function Instore(props) { ...@@ -437,6 +468,11 @@ function Instore(props) {
<div style={{ display: "none" }}> <div style={{ display: "none" }}>
<PrintDom ref={printRef} {...drawprops} /> <PrintDom ref={printRef} {...drawprops} />
</div> </div>
<div style={{ display: "none" }}>
<PrintQrCode ref={mutiPrintRef} selectedItems={selectKeys} />
</div>
<AutoTable <AutoTable
{...tableprops} {...tableprops}
actionRef={actionRef} actionRef={actionRef}
......
...@@ -47,12 +47,12 @@ const EditUpload = ({ record, fid, storeId }) => { ...@@ -47,12 +47,12 @@ const EditUpload = ({ record, fid, storeId }) => {
linkconfig={{ linkconfig={{
urlchangeval: { urlchangeval: {
database: (params) => doFetch({ url: "/ngic-workmanship/wmsMaterieStore/queryStoreOne", params }), database: (params) => doFetch({ url: "/ngic-workmanship/wmsMaterieStore/queryStoreOne", params }),
params: { "storePositionId": "linked",materieControlNo:"linked"}, params: { "storePositionId": "linked", materieControlNo: "linked" },
effectresult: { effectresult: {
"supplierNo": "supplierNo", "supplierNo": "supplierNo",
"supplierName": "supplierName", "supplierName": "supplierName",
"stockNum": "stroeNum", "stockNum": "stroeNum",
"materieControlNo":"materieControlNo" "materieControlNo": "materieControlNo"
} }
} }
}} }}
...@@ -65,13 +65,13 @@ const EditUpload = ({ record, fid, storeId }) => { ...@@ -65,13 +65,13 @@ const EditUpload = ({ record, fid, storeId }) => {
search: false, search: false,
valueType: "select", valueType: "select",
request: async (params) => { request: async (params) => {
let res = await doFetch({ url: "/ngic-auth/sysStorePosition/queryByStoreId/selection", params:{storeId:params.storeId} }); let res = await doFetch({ url: "/ngic-auth/sysStorePosition/queryByStoreId/selection", params: { storeId: params.storeId } });
return res?.data?.dataList return res?.data?.dataList
}, },
editable: (text, record, index) => { editable: (text, record, index) => {
return !record.materieOutstoreDetailId return !record.materieOutstoreDetailId
}, },
params:{storeId: storeId}, params: { storeId: storeId },
"formItemProps": () => { "formItemProps": () => {
return { return {
rules: [{ required: true, message: '此项为必填项' }], rules: [{ required: true, message: '此项为必填项' }],
...@@ -85,16 +85,16 @@ const EditUpload = ({ record, fid, storeId }) => { ...@@ -85,16 +85,16 @@ const EditUpload = ({ record, fid, storeId }) => {
search: false, search: false,
valueType: "select", valueType: "select",
request: async (params) => { request: async (params) => {
let res = await doFetch({ url: "/ngic-workmanship/wmsMaterieStore/queryPCList", params:{materieId:params.materieId,storePositionId:params.storePositionId}}); let res = await doFetch({ url: "/ngic-workmanship/wmsMaterieStore/queryPCList", params: { materieId: params.materieId, storePositionId: params.storePositionId } });
return res?.data?.dataList return res?.data?.dataList
}, },
editable: (text, record, index) => { editable: (text, record, index) => {
return !record.materieOutstoreDetailId return !record.materieOutstoreDetailId
}, },
params:(row)=>{ params: (row) => {
return {materieId:record.materieId,storePositionId:row.storePositionId} return { materieId: record.materieId, storePositionId: row.storePositionId }
}, },
width:200 width: 200
}, },
{ {
title: "下架数量", title: "下架数量",
...@@ -181,7 +181,7 @@ const one = { ...@@ -181,7 +181,7 @@ const one = {
database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }), database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }),
params: {} params: {}
}, },
"linked":true "linked": true
}, },
"businessNo": { "businessNo": {
"value": null, "value": null,
...@@ -214,7 +214,7 @@ const one = { ...@@ -214,7 +214,7 @@ const one = {
linkconfig: { linkconfig: {
urlchangeval: {//根据url接口 改变某个value urlchangeval: {//根据url接口 改变某个value
database: (params) => doFetch({ url: "/ngic-workmanship/wmsMaterieStockStore/queryStoreOne", params }), database: (params) => doFetch({ url: "/ngic-workmanship/wmsMaterieStockStore/queryStoreOne", params }),
params: { "materieId": "linked"}, params: { "materieId": "linked" },
effectresult: { effectresult: {
"productionUnit": "productionUnit",//key 为列表更新值 value为response 返回值 "productionUnit": "productionUnit",//key 为列表更新值 value为response 返回值
"productionUnitName": "productionUnitName", "productionUnitName": "productionUnitName",
...@@ -242,7 +242,7 @@ const one = { ...@@ -242,7 +242,7 @@ const one = {
rules: [{ required: true, message: '此项为必填项' }], rules: [{ required: true, message: '此项为必填项' }],
}; };
}, },
editable:true editable: true
}, },
{ {
"title": <span>出库数量 <b style={{ color: "red" }}>*</b></span>, "title": <span>出库数量 <b style={{ color: "red" }}>*</b></span>,
...@@ -254,7 +254,7 @@ const one = { ...@@ -254,7 +254,7 @@ const one = {
}; };
}, },
valueType: "digit", valueType: "digit",
editable:true editable: true
}, },
{ {
"title": "可用库存", "title": "可用库存",
...@@ -645,7 +645,7 @@ const one = { ...@@ -645,7 +645,7 @@ const one = {
rowKey: "id", rowKey: "id",
} }
}, },
detail = { detail = (setselected, dom) => ({
totalCard: [ totalCard: [
//物料详情 //物料详情
{ {
...@@ -686,13 +686,13 @@ const one = { ...@@ -686,13 +686,13 @@ const one = {
{ {
title: "备注", title: "备注",
key: "remark", key: "remark",
noshow:"100%", noshow: "100%",
}, },
{ {
title: "工单二维码", title: "工单二维码",
key: "qrCodeUrl", key: "qrCodeUrl",
type: "img", type: "img",
noshow:true, noshow: true,
width: 100, width: 100,
height: 100 height: 100
}, },
...@@ -700,6 +700,7 @@ const one = { ...@@ -700,6 +700,7 @@ const one = {
}, },
{ {
cardTitle: "物料信息列表", cardTitle: "物料信息列表",
extraContent: dom,
itemData: [ itemData: [
{ {
key: "materialList", key: "materialList",
...@@ -734,6 +735,8 @@ const one = { ...@@ -734,6 +735,8 @@ const one = {
search: false, search: false,
}, },
], ],
pagination: "false",
rowKey: "id",
expandable: { expandable: {
expandedRowRender: record => <Table expandedRowRender: record => <Table
style={{ marginLeft: 48 }} style={{ marginLeft: 48 }}
...@@ -775,6 +778,11 @@ const one = { ...@@ -775,6 +778,11 @@ const one = {
dataSource={record.downloadList} dataSource={record.downloadList}
pagination={false} pagination={false}
/>, />,
},
rowSelection: {
onChange: (selectedRowKeys, selectedRows) => {
setselected(selectedRows)
},
} }
}, },
], ],
...@@ -891,7 +899,7 @@ const one = { ...@@ -891,7 +899,7 @@ const one = {
], ],
}, },
] ]
}, }),
dooutside = (fid, storeId) => ({ dooutside = (fid, storeId) => ({
totalCard: [ totalCard: [
//物料详情 //物料详情
......
...@@ -8,6 +8,7 @@ import getPrem from "@/utils/getPrem"; //权限判断fn ...@@ -8,6 +8,7 @@ import getPrem from "@/utils/getPrem"; //权限判断fn
import { useReactToPrint } from "react-to-print"; import { useReactToPrint } from "react-to-print";
import { useModel } from "umi"; import { useModel } from "umi";
import PrintDom from "./printdom"; import PrintDom from "./printdom";
import { PrintQrCode } from "@/components/PrintCode";
const keytoval = { const keytoval = {
one: 1, one: 1,
...@@ -43,6 +44,8 @@ const keytoval = { ...@@ -43,6 +44,8 @@ const keytoval = {
function Outstore(props) { function Outstore(props) {
const { initialState, setInitialState } = useModel("@@initialState"); const { initialState, setInitialState } = useModel("@@initialState");
const [activeTabKey, onTabChange] = useState("1"); const [activeTabKey, onTabChange] = useState("1");
const [selectKeys, setSelectKeys] = useState([]);
let [drawprops, setdrawprops] = useState({ let [drawprops, setdrawprops] = useState({
title: "", title: "",
visible: false, visible: false,
...@@ -58,7 +61,8 @@ function Outstore(props) { ...@@ -58,7 +61,8 @@ function Outstore(props) {
}), }),
actionRef = useRef(), actionRef = useRef(),
ChildRef = null, ChildRef = null,
printRef = useRef(); printRef = useRef(),
mutiPrintRef = useRef();
//操作完成后刷新 //操作完成后刷新
function reload() { function reload() {
...@@ -76,6 +80,28 @@ function Outstore(props) { ...@@ -76,6 +80,28 @@ function Outstore(props) {
content: () => printRef.current.dom.current, content: () => printRef.current.dom.current,
}); });
const mutiPrint = useReactToPrint({
content: () => mutiPrintRef.current.dom.current,
});
const PrintButton = (
<Button
disabled={!selectKeys.length}
onClick={() => {
mutiPrint();
}}
>
打印
</Button>
);
useEffect(() => {
const detail = defaultFields.detail(setSelectKeys, PrintButton);
setdrawprops((s) => ({
...s,
...detail,
}));
}, [selectKeys]);
const columns = useMemo(() => { const columns = useMemo(() => {
if (activeTabKey == "1") { if (activeTabKey == "1") {
return [ return [
...@@ -87,13 +113,17 @@ function Outstore(props) { ...@@ -87,13 +113,17 @@ function Outstore(props) {
return ( return (
<a <a
onClick={() => { onClick={() => {
const detail = defaultFields.detail(
setSelectKeys,
PrintButton
);
setdrawprops((s) => ({ setdrawprops((s) => ({
...s, ...s,
visible: true, visible: true,
//查看详情 props //查看详情 props
val: "detail", val: "detail",
title: `查看详情`, title: `查看详情`,
...defaultFields?.detail, ...detail,
totalPath: totalPath:
"/ngic-workmanship/wmsMaterieOutstore/getOutStoreInfoById", "/ngic-workmanship/wmsMaterieOutstore/getOutStoreInfoById",
totalParams: { id: record.id }, totalParams: { id: record.id },
...@@ -144,7 +174,7 @@ function Outstore(props) { ...@@ -144,7 +174,7 @@ function Outstore(props) {
key: "storeId", key: "storeId",
fieldProps: { fieldProps: {
allowClear: true, allowClear: true,
showSearch: true showSearch: true,
}, },
options: { options: {
database: () => database: () =>
...@@ -321,10 +351,14 @@ function Outstore(props) { ...@@ -321,10 +351,14 @@ function Outstore(props) {
key: "storeId", key: "storeId",
fieldProps: { fieldProps: {
allowClear: true, allowClear: true,
showSearch: true showSearch: true,
}, },
options: { options: {
database: () =>doFetch({url: "/ngic-auth/sysStore/selectionBox",params: { factoryIdList: [] }}), database: () =>
doFetch({
url: "/ngic-auth/sysStore/selectionBox",
params: { factoryIdList: [] },
}),
params: {}, params: {},
}, },
valueType: "select", valueType: "select",
...@@ -432,9 +466,12 @@ function Outstore(props) { ...@@ -432,9 +466,12 @@ function Outstore(props) {
return ( return (
<div> <div>
<div style={{ display: "none" }}> <div style={{ display: "none" }}>
<PrintDom ref={printRef} {...drawprops} /> <PrintDom ref={printRef} {...drawprops} />
</div> </div>
<div style={{ display: "none" }}>
<PrintQrCode ref={mutiPrintRef} selectedItems={selectKeys} />
</div>
<AutoTable <AutoTable
{...tableprops} {...tableprops}
actionRef={actionRef} actionRef={actionRef}
...@@ -502,7 +539,7 @@ function Outstore(props) { ...@@ -502,7 +539,7 @@ function Outstore(props) {
fieldProps: { fieldProps: {
allowClear: true, allowClear: true,
showSearch: true, showSearch: true,
options options,
}, },
formItemProps: () => { formItemProps: () => {
return { return {
......
import React, { useState, useRef, useReducer } from "react"; import React, { useState, useRef, useReducer } from "react";
import { Button, Tooltip, Row, Divider } from "antd"; import { Button, Tooltip, Row, Divider } from "antd";
import AutoTable from "@/components/AutoTable"; import AutoTable from "@/components/Tableform";
import getPrem from "@/utils/getPrem"; //权限判断fn import getPrem from "@/utils/getPrem"; //权限判断fn
import { useRequest } from "umi"; import { useRequest } from "umi";
import defaultFields from "./fieldstore"; import defaultFields from "./fieldstore";
...@@ -10,6 +10,40 @@ import { ProDescriptions } from '@ant-design/pro-components'; ...@@ -10,6 +10,40 @@ import { ProDescriptions } from '@ant-design/pro-components';
import JsBarcode from 'jsbarcode' import JsBarcode from 'jsbarcode'
import { useReactToPrint } from 'react-to-print'; import { useReactToPrint } from 'react-to-print';
import PrintProvider, { Print, NoPrint } from 'react-easy-print'; import PrintProvider, { Print, NoPrint } from 'react-easy-print';
const pageStyle = `
@media all {
.page-break {
display: none;
}
}
@media print {
html, body {
height: initial !important;
overflow: initial !important;
-webkit-print-color-adjust: exact;
}
}
@media print {
.page-break {
margin-top:0;
display: block;
page-break-before: auto;
}
}
@media print {
.page-noprint {
display: none !important;
}
}
@page {
size: auto;
margin: 0px;
}
`;
const initState = { const initState = {
...@@ -174,8 +208,9 @@ const StoreApp = (props) => { ...@@ -174,8 +208,9 @@ const StoreApp = (props) => {
setTimeout(async () => { setTimeout(async () => {
await Promise.all(selectedRowKeys.map(async (it) => { await Promise.all(selectedRowKeys.map(async (it) => {
await JsBarcode("#s" + it.id, it.id, { await JsBarcode("#s" + it.id, it.id, {
width: 2, width: 4,
height: 100, height: 200,
fontSize: 36,
}); });
})) }))
}, 600) }, 600)
...@@ -243,7 +278,11 @@ const StoreApp = (props) => { ...@@ -243,7 +278,11 @@ const StoreApp = (props) => {
actionRef={actionRef} actionRef={actionRef}
onRef={(node) => (ChildRef = node)} onRef={(node) => (ChildRef = node)}
extraparams={{ storeId: props?.curitem?.id ?? "0" }} extraparams={{ storeId: props?.curitem?.id ?? "0" }}
rowSelection={{
onChange: (selectedRowKeys, selectedRows) => {
setselectedRowKeys(selectedRows)
},
}}
></AutoTable> ></AutoTable>
<DrawInitForm <DrawInitForm
visible={false} visible={false}
...@@ -262,18 +301,21 @@ const StoreApp = (props) => { ...@@ -262,18 +301,21 @@ const StoreApp = (props) => {
submitting={loading || !vs} submitting={loading || !vs}
width={"60%"} width={"60%"}
val={iftype.val} val={iftype.val}
width={iftype.val == "only" ? 380 : 600} width={iftype.val == "only" ? 690 : 600}
extra={iftype.val == "only" ? <Button extra={iftype.val == "only" ? <Button
onClick={handlePrint} onClick={handlePrint}
>打印</Button> : null} >打印</Button> : null}
> >
<PrintProvider> <PrintProvider>
<style type="text/css" media="print">
{pageStyle}
</style>
<div ref={printRef}> <div ref={printRef}>
{ {
selectedRowKeys.map((it,i) => { selectedRowKeys.map((it, i) => {
return <div key={i}> return <div key={i}>
<NoPrint> <NoPrint>
<span>{it.storePositionName}</span> <span className="page-noprint">{it.storePositionName}</span>
</NoPrint> </NoPrint>
<svg id={"s" + it.id} /> <svg id={"s" + it.id} />
<span className="page-break"></span> <span className="page-break"></span>
......
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