Commit d2411fb2 authored by wuhao's avatar wuhao 🎯

asder

parent ec35a8d1
......@@ -61,7 +61,6 @@
"lodash": "^4.17.0",
"moment": "^2.29.1",
"omit.js": "^2.0.2",
"print-js": "^1.6.0",
"rc-menu": "^9.1.0",
"rc-util": "^5.16.0",
"react": "^17.0.0",
......@@ -71,6 +70,7 @@
"react-helmet-async": "^1.2.0",
"react-resizable": "^3.0.4",
"react-sortable-hoc": "^2.0.0",
"react-to-print": "^2.14.7",
"umi": "^3.5.0"
},
"devDependencies": {
......
......@@ -38,6 +38,8 @@ const Details = (props) => {
col,
bottomNode,
topNode,
printRef,
onloadeddata,
} = props;
const [pageData, cp] = useState({});
......@@ -61,6 +63,11 @@ const Details = (props) => {
}
}, []);
useEffect(()=>{
onloadeddata?.(pageData);
},[pageData])
const getCol = (itemcol) => {
if (itemcol) {
return itemcol;
......@@ -80,6 +87,7 @@ const Details = (props) => {
col,
rowKey,
expandable,
pagination
} = itemData,
value = pageData[key];
if (!type || type == "input") {
......@@ -139,13 +147,18 @@ const Details = (props) => {
);
} else if (type == "table") {
return (
value &&
<AutoTable
columns={columns || []}
path={path ? path : null}
bordered={false}
dataSource={path ? null : value}
rowKey={rowKey ?? "id"}
expandable={expandable ?? null}
expandable={expandable?{
...expandable,
defaultExpandedRowKeys:value?.map(it=>it.id)
}:null}
pagination={pagination}
></AutoTable>
);
} else if (type == "rate") {
......@@ -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 (
<div className={`${styles.bodyBox} detailCards`}>
<div className={`${styles.bodyBox} detailCards`} ref={printRef ?? ''}>
<style type="text/css" media="print">
{pageStyle}
</style>
<Spin spinning={false}>
{topNode && <div>{topNode}</div>}
{totalCard?.map((item, i) => {
......
......@@ -26,6 +26,9 @@ function DrawInitForm(props) {
col: props.col,
bottomNode: props.bottomNode,
topNode: props.topNode,
printRef: props.printRef,
onloadeddata:props.onloadeddata,
expandkeys:props.expandkeys
}
return (
<Drawer
......
......@@ -727,6 +727,7 @@ const one = {
},
],
expandable: {
defaultExpandAllRows: true,
expandedRowRender: record => <Table
style={{ marginLeft: 48 }}
columns={[
......@@ -746,7 +747,8 @@ const one = {
dataSource={record.downloadList}
pagination={false}
/>,
}
},
pagination: "false"
},
],
},
......@@ -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) => ({
totalCard: [
......
......@@ -10,8 +10,8 @@ import defaultFields from "./fields";
import { doFetch } from "@/utils/doFetch";
import DrawInitForm from "@/components/DrawInitForm";
import getPrem from '@/utils/getPrem';//权限判断fn
import { useReactToPrint } from 'react-to-print';
import { useCallback } from "react";
const keytoval = {
"one": 1,
"two": 2,
......@@ -67,7 +67,8 @@ function Instore(props) {
width: 1200
}),
actionRef = useRef(),
ChildRef = null;
ChildRef = null,
printRef = useRef();
//操作完成后刷新
function reload() {
......@@ -80,6 +81,11 @@ function Instore(props) {
}))
}
const handlePrint = useReactToPrint({
content: () => printRef.current,
});
const columns = useMemo(() => {
if (activeTabKey == "1") {
return [
......@@ -89,7 +95,7 @@ function Instore(props) {
"key": "materieInstoreNo",
"render": (dom, record) => {
return <a
onClick={() => {
onClick={async () => {
setdrawprops(s => ({
...s,
visible: true,
......@@ -99,8 +105,12 @@ function Instore(props) {
...defaultFields?.detail,
totalPath: "/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById",
totalParams: { id: record.id },
extra: (<Button>
printRef: printRef,
extra: (<Button
onClick={async () => {
handlePrint()
}}
>
打印
</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