Parcourir la source

🐛馆藏编辑时间修改

shaogen1995 il y a 2 ans
Parent
commit
f74cc4e634
1 fichiers modifiés avec 5 ajouts et 33 suppressions
  1. 5 33
      src/pages/Goods/index.tsx

+ 5 - 33
src/pages/Goods/index.tsx

@@ -1,23 +1,11 @@
 import ImageLazy from "@/components/ImageLazy";
 import { RootState } from "@/store";
 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 { typeChangeObj } from "@/utils/changeData";
 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, {
   useCallback,
   useEffect,
@@ -177,16 +165,6 @@ function Goods() {
     [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(
     async (id: number) => {
@@ -272,14 +250,8 @@ function Goods() {
       },
       {
         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 (
     <div className={styles.Goods}>