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

医生操作action 添加loading状态

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