提交 7cb5a337 authored 作者: leon's avatar leon

医生操作action 添加loading状态

上级 1f874be7
...@@ -98,6 +98,10 @@ ...@@ -98,6 +98,10 @@
getDetail(); getDetail();
}); });
const setLoading = (flag: boolean) => {
data.isOver = !flag;
};
const reload = () => { const reload = () => {
data.isOver = false; data.isOver = false;
data.detail = {}; data.detail = {};
...@@ -118,17 +122,26 @@ ...@@ -118,17 +122,26 @@
}); });
}; };
const handleDelete = () => { const handleDelete = () => {
DoctorApi.remove(data.detail.id).then((_) => { setLoading(true);
DoctorApi.remove(data.detail.id)
.then((_) => {
router.back(); router.back();
})
.catch(() => {
setLoading(false);
}); });
}; };
const handleVerify = (status: string) => { const handleVerify = (status: string) => {
DoctorApi.batchVerify(getVerifyParams(data.detail, status)).then((_) => { setLoading(true);
DoctorApi.batchVerify(getVerifyParams(data.detail, status))
.then((_) => {
reload(); reload();
})
.catch(() => {
setLoading(false);
}); });
}; };
const displayProps: ComputedRef<Array<any>> = computed(() => { const displayProps: ComputedRef<Array<any>> = computed(() => {
if (!data.isOver) return {}; if (!data.isOver) return {};
const display: any = descriptionColumns.map(({ title, dataIndex = '', customRender }) => ({ const display: any = descriptionColumns.map(({ title, dataIndex = '', customRender }) => ({
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
const userStore = useUserStore(); const userStore = useUserStore();
const [registerDrawer, { openDrawer }] = useDrawer(); const [registerDrawer, { openDrawer }] = useDrawer();
const [registerTable, { reload }] = useTable({ const [registerTable, { reload, setLoading }] = useTable({
title: '医生管理', title: '医生管理',
api: (params) => DoctorApi.search(handleParams(params)), api: (params) => DoctorApi.search(handleParams(params)),
columns, columns,
...@@ -206,8 +206,13 @@ ...@@ -206,8 +206,13 @@
}; };
const handleVerify = (record: Recordable, status: string) => { const handleVerify = (record: Recordable, status: string) => {
DoctorApi.batchVerify(getVerifyParams(record, status)).then((_) => { setLoading(true);
DoctorApi.batchVerify(getVerifyParams(record, status))
.then((_) => {
reload(); reload();
})
.catch(() => {
setLoading(false);
}); });
}; };
...@@ -216,8 +221,13 @@ ...@@ -216,8 +221,13 @@
idList: checkedKeys.value, idList: checkedKeys.value,
status: StatusValEnum.PASSED, status: StatusValEnum.PASSED,
}; };
DoctorApi.batchVerify(params).then((_) => { setLoading(true);
DoctorApi.batchVerify(params)
.then((_) => {
reload(); reload();
})
.catch(() => {
setLoading(false);
}); });
}; };
...@@ -229,14 +239,24 @@ ...@@ -229,14 +239,24 @@
}; };
const handleDelete = (record: Recordable) => { const handleDelete = (record: Recordable) => {
DoctorApi.remove(record.id).then((_) => { setLoading(true);
DoctorApi.remove(record.id)
.then((_) => {
reload(); reload();
})
.catch(() => {
setLoading(false);
}); });
}; };
const handleBatchDelete = () => { const handleBatchDelete = () => {
DoctorApi.batchRemove(checkedKeys.value).then((_) => { setLoading(true);
DoctorApi.batchRemove(checkedKeys.value)
.then((_) => {
reload(); reload();
})
.catch(() => {
setLoading(false);
}); });
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论