fix: prevent disk monitor action overlap

This commit is contained in:
2026-04-22 22:27:11 +08:00
parent eb384e8eef
commit 63433f7f01

View File

@@ -12,7 +12,7 @@
<DiskMonitorPolicyForm <DiskMonitorPolicyForm
v-model="policyForm" v-model="policyForm"
:disabled="loading.init" :disabled="formBusy"
:save-loading="loading.save" :save-loading="loading.save"
:run-loading="loading.run" :run-loading="loading.run"
@save="handleSave" @save="handleSave"
@@ -22,7 +22,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive, ref } from 'vue' import { computed, onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { import {
@@ -51,6 +51,7 @@ const loading = reactive({
run: false, run: false,
jobs: false jobs: false
}) })
const formBusy = computed(() => loading.init || loading.save || loading.run)
const handleBack = async () => { const handleBack = async () => {
await router.push('/systemMonitor') await router.push('/systemMonitor')
@@ -90,6 +91,8 @@ const loadPageData = async () => {
} }
const handleSave = async () => { const handleSave = async () => {
if (formBusy.value) return
const errorMessage = validatePolicy(policyForm.value) const errorMessage = validatePolicy(policyForm.value)
if (errorMessage) { if (errorMessage) {
ElMessage.warning(errorMessage) ElMessage.warning(errorMessage)
@@ -111,6 +114,8 @@ const handleSave = async () => {
} }
const handleRun = async () => { const handleRun = async () => {
if (formBusy.value) return
loading.run = true loading.run = true
try { try {
await runDiskMonitorJob({ await runDiskMonitorJob({