index.jsx 4.29 KB
Newer Older
krysent's avatar
krysent committed
1 2 3 4 5
import React, { useEffect, useMemo, useRef, useState } from "react";
import { Dropdown, Menu, Button, Tooltip } from "antd";
import { ProTable } from "@ant-design/pro-table";
import { doFetch } from "@/utils/doFetch";
import Details from "@/components/Details";
krysent's avatar
krysent committed
6
import AutoTable from "@/components/AutoTable";
krysent's avatar
krysent committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
import getPrem from "@/utils/getPrem";
function Instore(props) {
  const [drawer, setdrawer] = useState({
    visible: false,
    dataSource: null,
    totalCard: null,
  });

  const extraAction = function (text, record, _, action) {
    return [
      getPrem("details", action, "查看", () => {
        doFetch({
          url: "/ngic-workmanship/wmsMaterieInventory/queryById",
          params: { id: record.id },
        }).then((res) => {
          if (res.code === "0000") {
            console.log(res);
            setdrawer((v) => ({
              ...v,
              dataSource: res?.data?.data,
              totalCard: [
krysent's avatar
krysent committed
28
                {
krysent's avatar
krysent committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
                  cardTitle: "库存信息",
                  itemData: [
                    {
                      title: "仓库编号",
                      key: "storeCode",
                    },
                    {
                      title: "仓库名称",
                      key: "storeName",
                    },
                    {
                      title: "库位名称",
                      key: "storePositionName",
                    },
                    {
                      title: "批次号",
                      key: "materieControlNo",
                    },
                    {
                      title: "供应商名称",
                      key: "supplierName",
                    },
                    {
                      title: "库存数量",
                      key: "stockNum",
                    },
                    {
                      title: "上架时间",
                      key: "upload_time",
                    },
                  ],
                },
              ],
              visible: true,
            }));
          }
        });
      }),
    ];
  };

  const columns = [
    {
      title: "仓库名称",
      dataIndex: "storeName",
      key: "storeName",
      search: false,
    },
    {
      title: "库位名称",
krysent's avatar
krysent committed
79 80
      dataIndex: "storePositionName",
      key: "storePositionName",
krysent's avatar
krysent committed
81 82 83 84
      search: false,
    },
    {
      title: "物料编码",
krysent's avatar
krysent committed
85 86
      dataIndex: "materieCode",
      key: "materieCode",
krysent's avatar
krysent committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
    },
    {
      title: "物料名称",
      dataIndex: "materieName",
      key: "materieName",
    },
    {
      title: "规格型号",
      dataIndex: "specificationModel",
      key: "specificationModel",
      search: false,
    },
    {
      title: "批次号",
      dataIndex: "materieControlNo",
      key: "materieControlNo",
    },
    {
      title: "库存数量",
      dataIndex: "stockNum",
      key: "stockNum",
      search: false,
    },
    {
      title: "可用数量",
      dataIndex: "usableNum",
      key: "usableNum",
      search: false,
    },
    {
      title: "库存单位",
krysent's avatar
krysent committed
118 119
      dataIndex: "productionUnitName",
      key: "productionUnitName",
krysent's avatar
krysent committed
120 121 122 123
      search: false,
    },
    {
      title: "片厚",
krysent's avatar
krysent committed
124 125
      dataIndex: "sheetThickness",
      key: "sheetThickness",
krysent's avatar
krysent committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
      search: false,
    },
    {
      title: "铁损",
      dataIndex: "ironLoss",
      search: false,
      key: "ironLoss",
    },
    {
      title: "宽度",
      dataIndex: "width",
      key: "width",
      search: false,
    },
    {
      title: "米数",
      dataIndex: "length",
      key: "length",
      search: false,
    },
krysent's avatar
krysent committed
146 147 148 149 150 151 152 153
    // {
    //   title: "库存信息",
    //   dataIndex: "option",
    //   key: "option",
    //   valueType: "option",
    //   width: 100,
    //   render: (text, row, _, action) => extraAction(text, row, _, action),
    // },
krysent's avatar
krysent committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
  ];

  return (
    <div>
      <AutoTable
        {...props}
        pageextra="none"
        path="/ngic-workmanship/wmsMaterieInventory/queryList"
        columns={columns}
      ></AutoTable>

      <Details
        title="库存信息"
        onClose={() => {
          setdrawer((v) => ({
            ...v,
            visible: false,
          }));
        }}
        footer={false}
        destroyOnClose={true}
        width={"100%"}
        {...drawer}
      ></Details>
    </div>
  );
}

export default Instore;