|
@@ -1,23 +1,11 @@
|
|
|
import ImageLazy from "@/components/ImageLazy";
|
|
import ImageLazy from "@/components/ImageLazy";
|
|
|
import { RootState } from "@/store";
|
|
import { RootState } from "@/store";
|
|
|
import { getExhibitListAPI } from "@/store/action/exhibit";
|
|
import { getExhibitListAPI } from "@/store/action/exhibit";
|
|
|
-import {
|
|
|
|
|
- getGoodsList,
|
|
|
|
|
- goodsDisplayAPI,
|
|
|
|
|
- goodsRemoveAPI,
|
|
|
|
|
-} from "@/store/action/goods";
|
|
|
|
|
|
|
+import { getGoodsList, goodsRemoveAPI } from "@/store/action/goods";
|
|
|
import { GoodsTableSearch } from "@/types";
|
|
import { GoodsTableSearch } from "@/types";
|
|
|
import { typeChangeObj } from "@/utils/changeData";
|
|
import { typeChangeObj } from "@/utils/changeData";
|
|
|
import { MessageFu } from "@/utils/message";
|
|
import { MessageFu } from "@/utils/message";
|
|
|
-import {
|
|
|
|
|
- Input,
|
|
|
|
|
- Select,
|
|
|
|
|
- DatePicker,
|
|
|
|
|
- Button,
|
|
|
|
|
- Table,
|
|
|
|
|
- Switch,
|
|
|
|
|
- Popconfirm,
|
|
|
|
|
-} from "antd";
|
|
|
|
|
|
|
+import { Input, Select, DatePicker, Button, Table, Popconfirm } from "antd";
|
|
|
import React, {
|
|
import React, {
|
|
|
useCallback,
|
|
useCallback,
|
|
|
useEffect,
|
|
useEffect,
|
|
@@ -177,16 +165,6 @@ function Goods() {
|
|
|
[tableSelect]
|
|
[tableSelect]
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- // 切换表格中的启用停用状态
|
|
|
|
|
- const isEnabledClickFu = useCallback(
|
|
|
|
|
- async (val: boolean, id: number) => {
|
|
|
|
|
- const isDisable = val ? 1 : 0;
|
|
|
|
|
- const res: any = await goodsDisplayAPI(id, isDisable);
|
|
|
|
|
- if (res.code === 0) getList();
|
|
|
|
|
- },
|
|
|
|
|
- [getList]
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
// 点击删除
|
|
// 点击删除
|
|
|
const delTableFu = useCallback(
|
|
const delTableFu = useCallback(
|
|
|
async (id: number) => {
|
|
async (id: number) => {
|
|
@@ -272,14 +250,8 @@ function Goods() {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: "展示状态",
|
|
title: "展示状态",
|
|
|
- render: (item: GoodsTableSearch) => (
|
|
|
|
|
- <Switch
|
|
|
|
|
- checkedChildren="启用"
|
|
|
|
|
- unCheckedChildren="停用"
|
|
|
|
|
- checked={item.display === 1}
|
|
|
|
|
- onChange={(val) => isEnabledClickFu(val, item.id!)}
|
|
|
|
|
- />
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ render: (item: GoodsTableSearch) =>
|
|
|
|
|
+ item.display === 1 ? "展示" : "不展示",
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
{
|
|
{
|
|
@@ -307,7 +279,7 @@ function Goods() {
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
- }, [delTableFu, isEnabledClickFu, openEditPageFu]);
|
|
|
|
|
|
|
+ }, [delTableFu, openEditPageFu]);
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.Goods}>
|
|
<div className={styles.Goods}>
|