弹框提交状态异常收口

设备激活码错误路径不再卡 loading;Provider 与固件弹框补 loading 兜底。
This commit is contained in:
hrz 2026-10-06 23:24:07 +08:00
parent 1722d89efa
commit fe51ddf06c
5 changed files with 30 additions and 10 deletions

View file

@ -67,19 +67,18 @@ export default {
});
}
}
);
).fail(() => { this.loading = false; });
},
closeDialog() {
this.loading = false;
this.deviceCode = '';
this.$emit('update:visible', false);
},
cancel() {
this.deviceCode = "";
this.$emit('update:visible', false);
this.closeDialog();
},
handleClose() {
this.deviceCode = "";
this.$emit('update:visible', false);
this.closeDialog();
}
}
}

View file

@ -111,6 +111,10 @@ export default {
this.saving = true
// 提交成功后将关闭对话框的逻辑交给父组件处理
this.$emit('submit', this.form)
// 兜底:父组件若未在回调内重置 saving,3 秒后强制释放加载状态
setTimeout(() => {
this.saving = false
}, 3000)
}
})
},

View file

@ -309,6 +309,11 @@ export default {
this.resetForm();
}
});
// 兜底:父组件若未在回调内清 saving,3 秒后强制释放加载状态
setTimeout(() => {
this.saving = false;
}, 3000);
}
});
},

View file

@ -68,7 +68,7 @@
</div>
<!-- 新增/编辑固件对话框 -->
<firmware-dialog :title="dialogTitle" :visible.sync="dialogVisible" :form="firmwareForm"
<firmware-dialog ref="firmwareDialog" :title="dialogTitle" :visible.sync="dialogVisible" :form="firmwareForm"
:firmware-types="firmwareTypes" @submit="handleSubmit" @cancel="dialogVisible = false" />
<el-footer>
<version-footer />
@ -210,6 +210,7 @@ export default {
showClose: true
});
}
this.$refs.firmwareDialog?.resetSaving();
});
} else {
Api.ota.saveOta(form, (res) => {
@ -227,6 +228,7 @@ export default {
showClose: true
});
}
this.$refs.firmwareDialog?.resetSaving();
});
}
},

View file

@ -255,7 +255,6 @@ export default {
this.dialogVisible = true;
},
handleSubmit({ form, done }) {
this.loading = true;
if (form.id) {
Api.model.updateModelProvider(form, ({ data }) => {
if (data.code === 0) {
@ -264,7 +263,14 @@ export default {
message: this.$t('common.updateSuccess'),
showClose: true
});
this.dialogVisible = false;
} else {
this.$message.error({
message: data.msg || this.$t('common.updateFailure'),
showClose: true
});
}
done && done();
});
} else {
Api.model.addModelProvider(form, ({ data }) => {
@ -275,12 +281,16 @@ export default {
showClose: true
});
this.total += 1;
this.dialogVisible = false;
} else {
this.$message.error({
message: data.msg || this.$t('common.addFailure'),
showClose: true
});
}
done && done();
});
}
this.loading = false;
this.dialogVisible = false;
done && done();
},
deleteSelectedProviders() {
const selectedRows = this.providersList.filter(row => row.selected);