mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
弹框提交状态异常收口
设备激活码错误路径不再卡 loading;Provider 与固件弹框补 loading 兜底。
This commit is contained in:
parent
1722d89efa
commit
fe51ddf06c
5 changed files with 30 additions and 10 deletions
|
|
@ -67,19 +67,18 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
).fail(() => { this.loading = false; });
|
||||||
},
|
},
|
||||||
closeDialog() {
|
closeDialog() {
|
||||||
|
this.loading = false;
|
||||||
this.deviceCode = '';
|
this.deviceCode = '';
|
||||||
this.$emit('update:visible', false);
|
this.$emit('update:visible', false);
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
this.deviceCode = "";
|
this.closeDialog();
|
||||||
this.$emit('update:visible', false);
|
|
||||||
},
|
},
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.deviceCode = "";
|
this.closeDialog();
|
||||||
this.$emit('update:visible', false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,10 @@ export default {
|
||||||
this.saving = true
|
this.saving = true
|
||||||
// 提交成功后将关闭对话框的逻辑交给父组件处理
|
// 提交成功后将关闭对话框的逻辑交给父组件处理
|
||||||
this.$emit('submit', this.form)
|
this.$emit('submit', this.form)
|
||||||
|
// 兜底:父组件若未在回调内重置 saving,3 秒后强制释放加载状态
|
||||||
|
setTimeout(() => {
|
||||||
|
this.saving = false
|
||||||
|
}, 3000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,11 @@ export default {
|
||||||
this.resetForm();
|
this.resetForm();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 兜底:父组件若未在回调内清 saving,3 秒后强制释放加载状态
|
||||||
|
setTimeout(() => {
|
||||||
|
this.saving = false;
|
||||||
|
}, 3000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
</div>
|
</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" />
|
:firmware-types="firmwareTypes" @submit="handleSubmit" @cancel="dialogVisible = false" />
|
||||||
<el-footer>
|
<el-footer>
|
||||||
<version-footer />
|
<version-footer />
|
||||||
|
|
@ -210,6 +210,7 @@ export default {
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.$refs.firmwareDialog?.resetSaving();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Api.ota.saveOta(form, (res) => {
|
Api.ota.saveOta(form, (res) => {
|
||||||
|
|
@ -227,6 +228,7 @@ export default {
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.$refs.firmwareDialog?.resetSaving();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,6 @@ export default {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
handleSubmit({ form, done }) {
|
handleSubmit({ form, done }) {
|
||||||
this.loading = true;
|
|
||||||
if (form.id) {
|
if (form.id) {
|
||||||
Api.model.updateModelProvider(form, ({ data }) => {
|
Api.model.updateModelProvider(form, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
|
|
@ -264,7 +263,14 @@ export default {
|
||||||
message: this.$t('common.updateSuccess'),
|
message: this.$t('common.updateSuccess'),
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
|
this.dialogVisible = false;
|
||||||
|
} else {
|
||||||
|
this.$message.error({
|
||||||
|
message: data.msg || this.$t('common.updateFailure'),
|
||||||
|
showClose: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
done && done();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Api.model.addModelProvider(form, ({ data }) => {
|
Api.model.addModelProvider(form, ({ data }) => {
|
||||||
|
|
@ -275,12 +281,16 @@ export default {
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.total += 1;
|
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() {
|
deleteSelectedProviders() {
|
||||||
const selectedRows = this.providersList.filter(row => row.selected);
|
const selectedRows = this.providersList.filter(row => row.selected);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue