Browse Source

删除未及时刷新更改

kitchenmanage
zhaoy 7 months ago
parent
commit
d1357d61c2
1 changed files with 20 additions and 26 deletions
  1. +20
    -26
      src/pages/database/goods/newgoods/index.jsx

+ 20
- 26
src/pages/database/goods/newgoods/index.jsx View File

@@ -12,33 +12,7 @@ import {
gettree, gettree,
} from './service'; } from './service';


/**
* 删除节点
*
* @param selectedRows
*/

const handleRemove = async (selectedRows) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;

try {
await removeGoods(selectedRows.map((row) => row.id)).then((r) => {
hide();
if (r.data) {
message.success('删除成功,即将刷新');
} else {
message.error('删除失败,请重试');
}
});


return true;
} catch (error) {
hide();
message.error('删除失败,请重试');
return false;
}
};
const GoodsManage = () => { const GoodsManage = () => {
const [goodsTypes, setGoodsTypes] = useState([]); const [goodsTypes, setGoodsTypes] = useState([]);


@@ -239,6 +213,26 @@ const GoodsManage = () => {
], ],
}, },
]; ];

/**
* 删除节点
*
* @param selectedRows
*/
const handleRemove = async (selectedRows) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
await removeGoods(selectedRows.map((row) => row.id)).then((r) => {
if (r.data) {
message.success('删除成功');
actionRef.current.reload();
return true;
} else {
message.error('删除失败,请重试');
}
});

};
const props = { const props = {
beforeUpload: (file) => { beforeUpload: (file) => {
setLoading(true); setLoading(true);


Loading…
Cancel
Save