Commit d2411fb2 authored by wuhao's avatar wuhao 🎯

asder

parent ec35a8d1
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
"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",
"print-js": "^1.6.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",
...@@ -71,6 +70,7 @@ ...@@ -71,6 +70,7 @@
"react-helmet-async": "^1.2.0", "react-helmet-async": "^1.2.0",
"react-resizable": "^3.0.4", "react-resizable": "^3.0.4",
"react-sortable-hoc": "^2.0.0", "react-sortable-hoc": "^2.0.0",
"react-to-print": "^2.14.7",
"umi": "^3.5.0" "umi": "^3.5.0"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -38,6 +38,8 @@ const Details = (props) => { ...@@ -38,6 +38,8 @@ const Details = (props) => {
col, col,
bottomNode, bottomNode,
topNode, topNode,
printRef,
onloadeddata,
} = props; } = props;
const [pageData, cp] = useState({}); const [pageData, cp] = useState({});
...@@ -61,6 +63,11 @@ const Details = (props) => { ...@@ -61,6 +63,11 @@ const Details = (props) => {
} }
}, []); }, []);
useEffect(()=>{
onloadeddata?.(pageData);
},[pageData])
const getCol = (itemcol) => { const getCol = (itemcol) => {
if (itemcol) { if (itemcol) {
return itemcol; return itemcol;
...@@ -80,6 +87,7 @@ const Details = (props) => { ...@@ -80,6 +87,7 @@ const Details = (props) => {
col, col,
rowKey, rowKey,
expandable, expandable,
pagination
} = itemData, } = itemData,
value = pageData[key]; value = pageData[key];
if (!type || type == "input") { if (!type || type == "input") {
...@@ -139,13 +147,18 @@ const Details = (props) => { ...@@ -139,13 +147,18 @@ const Details = (props) => {
); );
} else if (type == "table") { } else if (type == "table") {
return ( return (
value &&
<AutoTable <AutoTable
columns={columns || []} columns={columns || []}
path={path ? path : null} path={path ? path : null}
bordered={false} bordered={false}
dataSource={path ? null : value} dataSource={path ? null : value}
rowKey={rowKey ?? "id"} rowKey={rowKey ?? "id"}
expandable={expandable ?? null} expandable={expandable?{
...expandable,
defaultExpandedRowKeys:value?.map(it=>it.id)
}:null}
pagination={pagination}
></AutoTable> ></AutoTable>
); );
} else if (type == "rate") { } else if (type == "rate") {
...@@ -162,9 +175,40 @@ const Details = (props) => { ...@@ -162,9 +175,40 @@ const Details = (props) => {
} }
}; };
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: 2rem;
display: block;
page-break-before: auto;
}
}
@page {
size: auto;
margin: 20mm;
}
`;
return ( return (
<div className={`${styles.bodyBox} detailCards`}> <div className={`${styles.bodyBox} detailCards`} ref={printRef ?? ''}>
<style type="text/css" media="print">
{pageStyle}
</style>
<Spin spinning={false}> <Spin spinning={false}>
{topNode && <div>{topNode}</div>} {topNode && <div>{topNode}</div>}
{totalCard?.map((item, i) => { {totalCard?.map((item, i) => {
......
...@@ -26,6 +26,9 @@ function DrawInitForm(props) { ...@@ -26,6 +26,9 @@ function DrawInitForm(props) {
col: props.col, col: props.col,
bottomNode: props.bottomNode, bottomNode: props.bottomNode,
topNode: props.topNode, topNode: props.topNode,
printRef: props.printRef,
onloadeddata:props.onloadeddata,
expandkeys:props.expandkeys
} }
return ( return (
<Drawer <Drawer
......
...@@ -727,6 +727,7 @@ const one = { ...@@ -727,6 +727,7 @@ const one = {
}, },
], ],
expandable: { expandable: {
defaultExpandAllRows: true,
expandedRowRender: record => <Table expandedRowRender: record => <Table
style={{ marginLeft: 48 }} style={{ marginLeft: 48 }}
columns={[ columns={[
...@@ -746,7 +747,8 @@ const one = { ...@@ -746,7 +747,8 @@ const one = {
dataSource={record.downloadList} dataSource={record.downloadList}
pagination={false} pagination={false}
/>, />,
} },
pagination: "false"
}, },
], ],
}, },
...@@ -763,6 +765,98 @@ const one = { ...@@ -763,6 +765,98 @@ const one = {
} }
], ],
}, },
{
cardTitle: "上架明细",
itemData: [
{
key: "materialUploadList",
type: "table",
col: { span: 24 },
columns: [
{
title: "物料编码 - 名称",
dataIndex: "materieName",
key: "materieName",
search: false,
render: (dom, row) => {
return (row.materieCode ?? '') + " - " + (row.materieName ?? '')
}
},
{
title: "供应商编号 - 名称",
dataIndex: "supplierNo",
key: "supplierNo",
search: false,
render: (dom, row) => {
return (row.supplierNo ?? '') + " - " + (row.supplierName ?? '')
}
},
{
title: "批次号/SN号",
dataIndex: "materieControlNo",
key: "materieControlNo",
search: false,
},
{
title: "入库数量",
dataIndex: "instroeNum",
key: "instroeNum",
search: false,
},
{
title: "单位",
dataIndex: "productionUnitName",
key: "productionUnitName",
search: false,
},
],
expandable: {
defaultExpandAllRows: true,
expandedRowRender: record => <Table
style={{ marginLeft: 48 }}
columns={[
{
title: "库位名称",
dataIndex: "storeName",
key: "storeName",
search: false,
},
{
title: "上架数量",
dataIndex: "instroeNum",
key: "instroeNum",
search: false,
}
,
{
title: "备注",
dataIndex: "remark",
key: "remark",
search: false,
}
,
{
title: "操作人",
dataIndex: "uploadUserName",
key: "uploadUserName",
search: false,
}
,
{
title: "操作时间",
dataIndex: "uploadTime",
key: "uploadTime",
search: false,
}
]}
dataSource={record.downloadList}
pagination={false}
/>,
},
pagination: "false"
},
],
},
] ]
}, doinsert = (fid) => ({ }, doinsert = (fid) => ({
totalCard: [ totalCard: [
......
...@@ -10,8 +10,8 @@ import defaultFields from "./fields"; ...@@ -10,8 +10,8 @@ import defaultFields from "./fields";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import DrawInitForm from "@/components/DrawInitForm"; import DrawInitForm from "@/components/DrawInitForm";
import getPrem from '@/utils/getPrem';//权限判断fn import getPrem from '@/utils/getPrem';//权限判断fn
import { useReactToPrint } from 'react-to-print';
import { useCallback } from "react";
const keytoval = { const keytoval = {
"one": 1, "one": 1,
"two": 2, "two": 2,
...@@ -67,7 +67,8 @@ function Instore(props) { ...@@ -67,7 +67,8 @@ function Instore(props) {
width: 1200 width: 1200
}), }),
actionRef = useRef(), actionRef = useRef(),
ChildRef = null; ChildRef = null,
printRef = useRef();
//操作完成后刷新 //操作完成后刷新
function reload() { function reload() {
...@@ -80,6 +81,11 @@ function Instore(props) { ...@@ -80,6 +81,11 @@ function Instore(props) {
})) }))
} }
const handlePrint = useReactToPrint({
content: () => printRef.current,
});
const columns = useMemo(() => { const columns = useMemo(() => {
if (activeTabKey == "1") { if (activeTabKey == "1") {
return [ return [
...@@ -89,7 +95,7 @@ function Instore(props) { ...@@ -89,7 +95,7 @@ function Instore(props) {
"key": "materieInstoreNo", "key": "materieInstoreNo",
"render": (dom, record) => { "render": (dom, record) => {
return <a return <a
onClick={() => { onClick={async () => {
setdrawprops(s => ({ setdrawprops(s => ({
...s, ...s,
visible: true, visible: true,
...@@ -99,8 +105,12 @@ function Instore(props) { ...@@ -99,8 +105,12 @@ function Instore(props) {
...defaultFields?.detail, ...defaultFields?.detail,
totalPath: "/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById", totalPath: "/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById",
totalParams: { id: record.id }, totalParams: { id: record.id },
extra: (<Button> printRef: printRef,
extra: (<Button
onClick={async () => {
handlePrint()
}}
>
打印 打印
</Button>) </Button>)
})) }))
......
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