+
{{ deviceStore.currentModel?.name }}
@@ -145,6 +147,7 @@ const espLoaderTerminal = {
const loading = ref(false);
const loadingTip = ref('');
const selectedModel = ref(-1);
+const isSelectedCustomModel = ref(false);
const deviceName: Ref
= ref('');
const deviceVersion: Ref = ref('');
@@ -307,9 +310,26 @@ const burnFirmware = async (isCustom = false) => {
const handleSelectedModel = (index: number) => {
selectedModel.value = index;
+ isSelectedCustomModel.value = false;
+}
+
+const handleSelectedCustomModel = () => {
+ selectedModel.value = -1;
+ isSelectedCustomModel.value = true;
}
const handleUpload = async () => {
+ if (isSelectedCustomModel.value) {
+ Message.info('The device is running the current model');
+ return
+ }
+ if (selectedModel.value > -1) {
+ const model = deviceStore.models[selectedModel.value];
+ if (model.uuid === deviceStore.currentModel?.uuid) {
+ Message.info('The device is running the current model');
+ return
+ }
+ }
try {
burnFirmware()
} catch (error) {
@@ -433,6 +453,20 @@ watch(
handelRefresh(val);
}
);
+
+watch(
+ () => deviceStore.currentModel,
+ (currentModel) => {
+ if (currentModel?.isCustom) {
+ isSelectedCustomModel.value = currentModel?.isCustom
+ } else {
+ const index = deviceStore.models.findIndex((model) => {
+ return model.uuid === currentModel?.uuid
+ })
+ selectedModel.value = index
+ }
+ }
+);