关于页面添加复位按钮
This commit is contained in:
parent
6e829b06c6
commit
83c60a2c61
|
@ -932,6 +932,12 @@ export default class ClientConnection {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public restoreDevice(delete_upload: boolean = false) {
|
||||||
|
this.ws?.send(
|
||||||
|
JSON.stringify(new Protocol.RestoreDeviceRequestEntity(delete_upload))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public restartDevice(delay_ms?: number) {
|
public restartDevice(delay_ms?: number) {
|
||||||
this.ws?.send(
|
this.ws?.send(
|
||||||
JSON.stringify(new Protocol.RestartDeviceRequestEntity(delay_ms))
|
JSON.stringify(new Protocol.RestartDeviceRequestEntity(delay_ms))
|
||||||
|
|
|
@ -92,7 +92,13 @@
|
||||||
</q-item>
|
</q-item>
|
||||||
</div>
|
</div>
|
||||||
<q-item>
|
<q-item>
|
||||||
<q-item-section></q-item-section>
|
<q-btn
|
||||||
|
@click="onRestore"
|
||||||
|
outline
|
||||||
|
:label="$t('restore')"
|
||||||
|
color="primary"
|
||||||
|
no-caps
|
||||||
|
/>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<div class="fit text-right">
|
<div class="fit text-right">
|
||||||
{{ product_name }}
|
{{ product_name }}
|
||||||
|
@ -186,6 +192,51 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
},
|
},
|
||||||
|
onRestore() {
|
||||||
|
$q.dialog({
|
||||||
|
title: $t.t("restore"),
|
||||||
|
message: $t.t(
|
||||||
|
"are you sure to restore factory settings? the configuration parameters, signal source, mode, and plan will be deleted!"
|
||||||
|
),
|
||||||
|
options: {
|
||||||
|
type: "checkbox",
|
||||||
|
model: [],
|
||||||
|
// inline: true
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: $t.t("delete upload files ."),
|
||||||
|
value: "delete_upload",
|
||||||
|
color: "secondary",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
ok: {
|
||||||
|
label: $t.t("ok"),
|
||||||
|
noCaps: true,
|
||||||
|
flat: true,
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
label: $t.t("cancel"),
|
||||||
|
noCaps: true,
|
||||||
|
flat: true,
|
||||||
|
},
|
||||||
|
persistent: true,
|
||||||
|
}).onOk((data) => {
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
const delete_upload = data.length != 0;
|
||||||
|
GlobalData.getInstance()
|
||||||
|
.getCurrentClient()
|
||||||
|
?.restoreDevice(delete_upload);
|
||||||
|
$q.notify({
|
||||||
|
color: "positive",
|
||||||
|
icon: "done",
|
||||||
|
message: $t.t("send restore command success!"),
|
||||||
|
position: "top",
|
||||||
|
timeout: 1500,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -2936,4 +2936,18 @@ export namespace Protocol {
|
||||||
|
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class RestoreDeviceRequestEntity extends PacketEntity {
|
||||||
|
timestamp = Date.now();
|
||||||
|
|
||||||
|
delete_upload_dates = false;
|
||||||
|
constructor(delete_upload_dates = false, rpc_id = 0) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
super.command = Commands.kRestoreDevice;
|
||||||
|
super.flag = PacketEntity.FLAG_REQUEST;
|
||||||
|
super.rpc_id = rpc_id;
|
||||||
|
this.delete_upload_dates = delete_upload_dates;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,4 +352,10 @@ export default {
|
||||||
"The detected version does not match, please download the new version!":
|
"The detected version does not match, please download the new version!":
|
||||||
"The detected version does not match, please download the new version!",
|
"The detected version does not match, please download the new version!",
|
||||||
"full screen": "Full Screen",
|
"full screen": "Full Screen",
|
||||||
|
"i have known": "I Have Known",
|
||||||
|
restore: "Restore",
|
||||||
|
"send restore command success!": "Send Restore Command Success!",
|
||||||
|
"delete upload files .": "Delete Upload Files .",
|
||||||
|
"are you sure to restore factory settings? the configuration parameters, signal source, mode, and plan will be deleted!":
|
||||||
|
"Are You Sure to Restore Factory Settings? The Configuration Parameters, Signal, Signal Loop, Mode And Mode Plan Will Be Deleted!",
|
||||||
};
|
};
|
||||||
|
|
|
@ -630,4 +630,8 @@ export default {
|
||||||
"检测到的版本不匹配,请下载新版本!",
|
"检测到的版本不匹配,请下载新版本!",
|
||||||
ok: "确定",
|
ok: "确定",
|
||||||
cancel: "取消",
|
cancel: "取消",
|
||||||
|
"send restore command success!": "发送复位指令成功!",
|
||||||
|
"delete upload files .": "删除上传的文件",
|
||||||
|
"are you sure to restore factory settings? the configuration parameters, signal source, mode, and plan will be deleted!":
|
||||||
|
"确定复位吗? 系统配置、信号源、轮询、模式、语言数据将被删除!",
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue