Commit a7f1072e authored by 武广's avatar 武广

fix: 修改状态刷新列表

parent c7caca16
...@@ -14,18 +14,8 @@ export default () => { ...@@ -14,18 +14,8 @@ export default () => {
const [pageNo, setPageNo] = useState(1); const [pageNo, setPageNo] = useState(1);
const [totalNum, setTotalNum] = useState(0); const [totalNum, setTotalNum] = useState(0);
const [pageSize, setPageSize] = useState(20); const [pageSize, setPageSize] = useState(20);
const table = useRef();
const refSearch = useRef(); const refSearch = useRef();
const divDom = 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 = () => { const onCreate = () => {
setStoreInfo({}); setStoreInfo({});
setVisible(true); setVisible(true);
...@@ -106,12 +96,19 @@ export default () => { ...@@ -106,12 +96,19 @@ export default () => {
}; };
const closeModal = isReload => { const closeModal = isReload => {
if (isReload) { if (isReload) {
// eslint-disable-next-line no-unused-expressions
onSearch(refSearch.current?.getFieldValue?.() || {}); onSearch(refSearch.current?.getFieldValue?.() || {});
} }
setStoreInfo({}); setStoreInfo({});
setVisible(false); 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 = () => { const onReset = () => {
if (refSearch.current && refSearch.current.resetFields) { if (refSearch.current && refSearch.current.resetFields) {
...@@ -281,14 +278,11 @@ export default () => { ...@@ -281,14 +278,11 @@ export default () => {
</div> </div>
<Table <Table
dataSource={dataList} dataSource={dataList}
ref={table}
bordered bordered
columns={columns} columns={columns}
rowKey={record => record.id} rowKey={record => record.id}
pagination={false} pagination={false}
// className={styles.tabletop}
scroll={{ x: '100%' }} scroll={{ x: '100%' }}
// rowSelection={rowSelection}
/> />
{dataList && dataList.length && ( {dataList && dataList.length && (
<div className={style.pageBox}> <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