|
@@ -1,12 +1,22 @@
|
|
|
-import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
+import React, {
|
|
|
+ useCallback,
|
|
|
+ useEffect,
|
|
|
+ useMemo,
|
|
|
+ useRef,
|
|
|
+ useState,
|
|
|
+} from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import { Button, Cascader, Input, Select, Table } from "antd";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
import { A3roomStatuType, A3selectType } from "./data";
|
|
|
-import { options3 } from "../A2Goods/data";
|
|
|
+import { options3, statusTxtObj, storageStatusTxtObj } from "../A2Goods/data";
|
|
|
import { API_roomTree } from "@/store/action/A4Roomset";
|
|
|
import { RootState } from "@/store";
|
|
|
import A3RoomStatu from "./A3RoomStatu";
|
|
|
+import { A3_APIgetList } from "@/store/action/A3Stock";
|
|
|
+import { A2tableType } from "@/types";
|
|
|
+import ImageLazy from "@/components/ImageLazy";
|
|
|
+import B1Look from "../B1Submit/B1Look";
|
|
|
function A3Stock() {
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
@@ -20,12 +30,24 @@ function A3Stock() {
|
|
|
// 筛选和分页
|
|
|
const [tableSelect, setTableSelect] = useState<A3selectType>({
|
|
|
searchKey: "",
|
|
|
- aaaa: "",
|
|
|
+ storageId: undefined,
|
|
|
storageStatus: "",
|
|
|
pageSize: 10,
|
|
|
pageNum: 1,
|
|
|
});
|
|
|
|
|
|
+ const getListFu = useCallback(async () => {
|
|
|
+ const obj = {
|
|
|
+ ...tableSelect,
|
|
|
+ storageId: tableSelect.storageId ? tableSelect.storageId[0] : null,
|
|
|
+ };
|
|
|
+ dispatch(A3_APIgetList(obj));
|
|
|
+ }, [dispatch, tableSelect]);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getListFu();
|
|
|
+ }, [getListFu]);
|
|
|
+
|
|
|
// 输入框的改变
|
|
|
const txtTimeRef = useRef(-1);
|
|
|
const txtChangeFu = useCallback(
|
|
@@ -45,7 +67,7 @@ function A3Stock() {
|
|
|
setInputKey(Date.now());
|
|
|
setTableSelect({
|
|
|
searchKey: "",
|
|
|
- aaaa: "",
|
|
|
+ storageId: undefined,
|
|
|
storageStatus: "",
|
|
|
pageSize: 10,
|
|
|
pageNum: 1,
|
|
@@ -55,6 +77,80 @@ function A3Stock() {
|
|
|
// 入库 出库 移库
|
|
|
const [roomStatu, setRoomStatu] = useState<A3roomStatuType>("");
|
|
|
|
|
|
+ const A3TableList = useSelector(
|
|
|
+ (state: RootState) => state.A3Stock.tableInfo
|
|
|
+ );
|
|
|
+
|
|
|
+ // 页码变化
|
|
|
+ const paginationChange = useCallback(
|
|
|
+ () => (pageNum: number, pageSize: number) => {
|
|
|
+ setTableSelect({ ...tableSelect, pageNum, pageSize });
|
|
|
+ },
|
|
|
+ [tableSelect]
|
|
|
+ );
|
|
|
+
|
|
|
+ const columns = useMemo(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ title: "库房名称",
|
|
|
+ dataIndex: "storageName",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "库房编号",
|
|
|
+ dataIndex: "storageNum",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "货架编号",
|
|
|
+ dataIndex: "rackNum",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "缩略图",
|
|
|
+ render: (item: A2tableType) => (
|
|
|
+ <div className="tableImgAuto">
|
|
|
+ <ImageLazy width={60} height={60} src={item.thumb} />
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "藏品编号",
|
|
|
+ dataIndex: "num",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "名称",
|
|
|
+ dataIndex: "name",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "级别",
|
|
|
+ render: (item: A2tableType) => item.dictLevel || "(空)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "藏品状态",
|
|
|
+ render: (item: A2tableType) =>
|
|
|
+ Reflect.get(statusTxtObj, item.status) || "(空)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "库存状态",
|
|
|
+ render: (item: A2tableType) =>
|
|
|
+ Reflect.get(storageStatusTxtObj, item.storageStatus) || "(空)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "入库时间",
|
|
|
+ dataIndex: "storageTime",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "操作",
|
|
|
+ render: (item: A2tableType) => (
|
|
|
+ <Button size="small" type="text" onClick={() => setLookId(item.id)}>
|
|
|
+ 查看
|
|
|
+ </Button>
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ // 点击表格的查看
|
|
|
+ const [lookId, setLookId] = useState(0);
|
|
|
+
|
|
|
return (
|
|
|
<div className={styles.A3Stock}>
|
|
|
<div className="pageTitle">库存清单</div>
|
|
@@ -86,7 +182,14 @@ function A3Stock() {
|
|
|
style={{ width: 160 }}
|
|
|
options={roomTree}
|
|
|
placeholder="全部"
|
|
|
- onChange={(e) => console.log(123, e)}
|
|
|
+ value={tableSelect.storageId}
|
|
|
+ onChange={(e) =>
|
|
|
+ setTableSelect({
|
|
|
+ ...tableSelect,
|
|
|
+ storageId: e as number[],
|
|
|
+ pageNum: 1,
|
|
|
+ })
|
|
|
+ }
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
@@ -120,9 +223,9 @@ function A3Stock() {
|
|
|
</div>
|
|
|
{/* 表格主体 */}
|
|
|
<div className="tableMain">
|
|
|
- {/* <Table
|
|
|
+ <Table
|
|
|
scroll={{ y: 625 }}
|
|
|
- dataSource={A2TableList.list}
|
|
|
+ dataSource={A3TableList.list}
|
|
|
columns={columns}
|
|
|
rowKey="id"
|
|
|
pagination={{
|
|
@@ -131,10 +234,10 @@ function A3Stock() {
|
|
|
showSizeChanger: true,
|
|
|
current: tableSelect.pageNum,
|
|
|
pageSize: tableSelect.pageSize,
|
|
|
- total: A2TableList.total,
|
|
|
+ total: A3TableList.total,
|
|
|
onChange: paginationChange(),
|
|
|
}}
|
|
|
- /> */}
|
|
|
+ />
|
|
|
</div>
|
|
|
|
|
|
{/* 点击入库 出库 移库 */}
|
|
@@ -146,6 +249,9 @@ function A3Stock() {
|
|
|
pageFlag={true}
|
|
|
/>
|
|
|
) : null}
|
|
|
+
|
|
|
+ {/* 点击表格的查看 */}
|
|
|
+ {lookId ? <B1Look goodsId={lookId} closeFu={() => setLookId(0)} /> : null}
|
|
|
</div>
|
|
|
);
|
|
|
}
|