Commit a7f1072e authored by 武广's avatar 武广

fix: 修改状态刷新列表

parent c7caca16
......@@ -14,18 +14,8 @@ export default () => {
const [pageNo, setPageNo] = useState(1);
const [totalNum, setTotalNum] = useState(0);
const [pageSize, setPageSize] = useState(20);
const table = useRef();
const refSearch = useRef();
const divDom = useRef();
const onEnableState = async ({ id, state }) => {
const enable = +state === 1 ? 0 : 1;
const res = await apiEnableStore({ id, state: enable });
if (res === '0000') {
notification.success({ message: `已${state ? '禁用' : '启用'}` });
// eslint-disable-next-line no-unused-expressions
table.current?.reload?.();
}
};
const onCreate = () => {
setStoreInfo({});
setVisible(true);
......@@ -106,12 +96,19 @@ export default () => {
};
const closeModal = isReload => {
if (isReload) {
// eslint-disable-next-line no-unused-expressions
onSearch(refSearch.current?.getFieldValue?.() || {});
}
setStoreInfo({});
setVisible(false);
};
const onEnableState = async ({ id, state }) => {
const enable = +state === 1 ? 0 : 1;
const res = await apiEnableStore({ id, state: enable });
if (res === '0000') {
notification.success({ message: `已${state ? '禁用' : '启用'}` });
onSearch(refSearch.current?.getFieldValue?.() || {});
}
};
const onReset = () => {
if (refSearch.current && refSearch.current.resetFields) {
......@@ -281,14 +278,11 @@ export default () => {
</div>
<Table
dataSource={dataList}
ref={table}
bordered
columns={columns}
rowKey={record => record.id}
pagination={false}
// className={styles.tabletop}
scroll={{ x: '100%' }}
// rowSelection={rowSelection}
/>
{dataList && dataList.length && (
<div className={style.pageBox}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment