fix: 系统重置操作等待遮罩
This commit is contained in:
@@ -32,6 +32,7 @@ export function bootloaderReset() {
|
||||
return request({
|
||||
url: `/bootloader`,
|
||||
method: 'delete',
|
||||
timeout: 180_000
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,12 @@ const { t } = useI18n();
|
||||
|
||||
type StateType = {
|
||||
visible: boolean;
|
||||
confirmLoading: boolean;
|
||||
count: number;
|
||||
timer: any;
|
||||
};
|
||||
|
||||
let state: StateType = reactive({
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
count: 10,
|
||||
timer: null,
|
||||
});
|
||||
@@ -38,23 +36,18 @@ function fnModalVisible() {
|
||||
/**对话框提交确认 */
|
||||
function fnModalOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
state.confirmLoading = true;
|
||||
bootloaderReset()
|
||||
.then(res => {
|
||||
state.confirmLoading = false;
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
fnModalCancel();
|
||||
lockedStore.fnLock('reload');
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
clearInterval(state.timer);
|
||||
state.timer = null;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
});
|
||||
lockedStore.fnLock('reset');
|
||||
bootloaderReset().then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
fnModalCancel();
|
||||
lockedStore.fnLock('reload');
|
||||
} else {
|
||||
lockedStore.fnLock('none');
|
||||
message.error(res.msg, 3);
|
||||
clearInterval(state.timer);
|
||||
state.timer = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**对话框取消操作 */
|
||||
@@ -80,7 +73,7 @@ function fnModalCancel() {
|
||||
:ok-text="
|
||||
state.count > 0 ? `${t('common.ok')} ${state.count}` : t('common.ok')
|
||||
"
|
||||
:confirmLoading="state.count > 0 || state.confirmLoading"
|
||||
:confirmLoading="state.count > 0"
|
||||
@ok="fnModalOk()"
|
||||
@cancel="fnModalCancel()"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user