/* 出库单管理 * @Author: Li Hanlin * @Date: 2023-12-21 11:10:07 * @Last Modified by: Li Hanlin * @Last Modified time: 2023-12-21 16:28:23 */ import React, { useState, useEffect, useMemo, useRef } from "react"; import DrawerPro from "@/components/DrawerPro"; import AutoTable from "@/components/AutoTable"; import PremButton from "@/components/PremButton"; import useKeepAlive from "@/components/useKeepAlive"; import getcolumns from "./columns"; import { useRequest } from "ahooks"; import { doFetch } from "@/utils/doFetch"; import { message } from "antd"; import DetailPro from "@/components/DetailPro"; function User() { let actionRef = useRef(); const [drawer, setdrawer] = useState({ open: false, }), [activeTabKey, setactiveTabKey] = useState("1"); const { run, loading, runAsync } = useRequest(doFetch, { manual: true, onSuccess: (res, params) => { if (res?.code == "0000") { reload(); } }, }); const columns = useMemo(() => { let defcolumn = getcolumns(setdrawer).filter( (it) => it.key == activeTabKey )[0]?.columns; let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0] ?.pathconfig ?? {}; return defcolumn; }, [activeTabKey]); const tabList = useMemo(() => { return getcolumns(); }, [activeTabKey]); const pathconfig = useMemo(() => { let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0] ?.pathconfig ?? {}; return defpath; }, [activeTabKey]); const rightExtra = (text, row, _, action) => { return [ { await runAsync({ url: "/ta_wms_auth/sysUser/deleteById", params: { id: row.id }, }); }, }} btn={{ size: "small", danger: true, }} > 关单 , ]; }; function reload() { actionRef?.current?.reload(); setdrawer((s) => ({ ...s, open: false, })); } return (
{ setdrawer((s) => ({ ...s, open: true, title: "新增", val: "add", item: {}, detailpath: "", })); }, }, }} tabList={tabList} activeTabKey={activeTabKey} onTabChange={(key) => { setactiveTabKey(key); }} /> { setdrawer((s) => ({ ...s, open: false, })); }} onFinish={async (vals) => { let newfields = JSON.parse(JSON.stringify(vals)); await runAsync({ url: "/ta_wms_auth/sysUser/save", params: { ...newfields, id: drawer?.val === "edit" ? drawer?.item?.id : "", }, }); }} {...drawer} > { return ( {row?.materialNo}-{row?.materialName} ); }, }, { title: "出库数量", dataIndex: "storeNum", key: "storeNum", }, { title: "库存单位", dataIndex: "productionUnitName", key: "productionUnitName", }, { title: "未下架数量", dataIndex: "noStoreNum", key: "noStoreNum", }, ]} expandable={{ expandedRowRender: (record) => ( { return ( {row?.supplierNo}-{row?.supplierName} ); }, }, { title: "计划数量", dataIndex: "planStoreNum", key: "planStoreNum", }, { title: "下架数量", dataIndex: "storeNum", key: "storeNum", }, { title: "状态", dataIndex: "statusName", key: "statusName", }, ]} dataSource={record?.taskMaterialOutstoreDetails ?? []} /> ), rowExpandable: (record) => record.name !== "Not Expandable", }} dataSource={drawer?.detailData?.taskMaterialDetails ?? []} actionRef={actionRef} pagination={false} />
); } export default useKeepAlive(User);