import React, { useEffect, useRef, useReducer, useState, useMemo } from "react";
import {
Button,
Tooltip,
Row,
Divider,
Drawer,
Modal,
Space,
message,
} from "antd";
import AutoTable from "@/components/AutoTable";
import { useRequest } from "umi";
import { getColumns } from "./fields.js";
import { doFetch } from "@/utils/doFetch";
import InitForm from "@/components/NewInitForm";
import { start } from "@/utils/printHandle.js";
import { ExclamationCircleFilled } from "@ant-design/icons";
const { confirm } = Modal;
const Station = (props) => {
let actionRef = useRef(),
formRef = useRef(),
ChildRef = null;
function reload() {
actionRef?.current?.reload();
ChildRef?.onRefresh();
}
const { run, loading } = useRequest(doFetch, {
manual: true,
formatResult: (res) => res,
onSuccess: (result, params) => {
if (result.code == "0000") {
reload();
dispatch({ type: "close" });
}
},
}),
columns = [
{
title: "物料编码",
dataIndex: "materieCode",
key: "materieCode",
},
{
title: "物料名称",
dataIndex: "materieName",
key: "materieName",
},
{
title: "规格型号",
dataIndex: "specificationModel",
key: "specificationModel",
},
{
title: "数量",
dataIndex: "weight",
key: "weight",
search: false,
},
{
title: "批次号",
dataIndex: "materieControlNo",
key: "materieControlNo",
},
{
title: "供应商",
dataIndex: "supplierName",
key: "supplierName",
search: false,
},
{
title: "宽度",
dataIndex: "width",
key: "width",
search: false,
},
{
title: "片厚",
dataIndex: "sheetThickness",
key: "sheetThickness",
search: false,
},
{
title: "铁损",
dataIndex: "ironLoss",
key: "ironLoss",
search: false,
},
{
title: "单边厚度",
dataIndex: "unilateralThickness",
key: "unilateralThickness",
search: false,
},
{
title: "创建人",
dataIndex: "createUserName",
key: "createUserName",
search: false,
},
{
title: "单据日期",
dataIndex: "orderDate",
key: "orderDate",
search: false,
},
];
const [drawer, setDrawer] = useState({
visible: false,
});
const [selectIds, setselectIds] = useState([]);
const formFields = useMemo(() => {
return getColumns(setDrawer, formRef);
});
const saveAndPrint = () => {
confirm({
title: `当前已完成信息填写,是否保存并立即打印?`,
icon: