修改设备信息的时间显示

This commit is contained in:
fangxiang 2022-03-03 16:36:47 +08:00
parent 2511d6ff9b
commit c2268af842
10 changed files with 63 additions and 28 deletions

View File

@ -768,13 +768,13 @@ export default class ClientConnection {
);
}
public async setPollingData(
public async setWindowPollingData(
window_id: number,
name: string,
datas?: StringKeyValueEntity[]
) {
return await this.doRpc<Protocol.SetPollingDataResponseEntity>(
new Protocol.SetPollingDataRequestEntity(window_id, name, datas)
return await this.doRpc<Protocol.SetWindowPollingDataResponseEntity>(
new Protocol.SetWindowPollingDataRequestEntity(window_id, name, datas)
);
}

View File

@ -182,7 +182,7 @@ export default defineComponent({
const tree: any | null = ref(null);
onMounted(async () => {
while (!tree.value.nodes.length) {
while (!tree.value?.nodes?.length) {
await Common.waitFor(100);
}
tree.value?.setExpanded("", true);

View File

@ -203,7 +203,7 @@ export default defineComponent({
const tree: any | null = ref(null);
onMounted(async () => {
while (!tree.value.nodes.length) {
while (!tree.value?.nodes?.length) {
await Common.waitFor(100);
}
tree.value?.setExpanded("", true);

View File

@ -148,7 +148,7 @@ export default defineComponent({
const polling_setting_dialog: Ref<any> = ref(null);
onMounted(async () => {
while (!tree.value.nodes.length) {
while (!tree.value?.nodes?.length) {
await Common.waitFor(100);
}
tree.value?.setExpanded("", true);

View File

@ -5,7 +5,7 @@
<q-item
class="full-width"
clickable
:draggable="!prop.node.is_group && !prop.node.local_file_flag"
:draggable="!prop.node.is_group"
@dragstart="(evt) => onDragStart(evt, prop.node)"
@click="
$store.commit(
@ -178,7 +178,7 @@ export default defineComponent({
const tree: any | null = ref(null);
onMounted(async () => {
while (!tree.value.nodes.length) {
while (!tree.value?.nodes?.length) {
await Common.waitFor(100);
}
tree.value?.setExpanded("", true);

View File

@ -308,8 +308,8 @@ export namespace Protocol {
public static get kStopPolling() {
return Commands.PROTOCOL_PREFIX + "StopPolling";
}
public static get kRpcSetPollingData() {
return Commands.PROTOCOL_PREFIX + "RpcSetPollingData";
public static get kRpcSetWindowPollingData() {
return Commands.PROTOCOL_PREFIX + "RpcSetWindowPollingData";
}
public static get kPollingStateChanged() {
return Commands.PROTOCOL_PREFIX + "PollingStateChanged";
@ -403,7 +403,7 @@ export namespace Protocol {
Commands.kPauseWindow,
Commands.kPlayWindow,
Commands.kPollingStateChanged,
Commands.kRpcSetPollingData,
Commands.kRpcSetWindowPollingData,
Commands.kStopPolling,
Commands.kStartPolling,
Commands.kPollingStateChanged,
@ -1751,7 +1751,7 @@ export namespace Protocol {
}
}
export class SetPollingDataRequestEntity extends Protocol.PacketEntity {
export class SetWindowPollingDataRequestEntity extends Protocol.PacketEntity {
datas: StringKeyValueEntity[] = [];
name: string;
window_id: number = 0;
@ -1763,7 +1763,7 @@ export namespace Protocol {
) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcSetPollingData;
this.command = Protocol.Commands.kRpcSetWindowPollingData;
if (Array.isArray(datas)) {
if (datas.length % 2) {
datas.splice(datas.length - 1, 1);
@ -1775,12 +1775,12 @@ export namespace Protocol {
}
}
export class SetPollingDataResponseEntity extends Protocol.PacketEntity {
export class SetWindowPollingDataResponseEntity extends Protocol.PacketEntity {
success = false;
constructor() {
super();
this.command = Protocol.Commands.kRpcSetPollingData;
this.command = Protocol.Commands.kRpcSetWindowPollingData;
}
}

View File

@ -345,4 +345,7 @@ export default {
"new polling": "新建轮询",
"add polling": "添加轮询",
"edit polling": "修改轮询",
HH: "时",
MM: "分",
SS: "秒",
};

View File

@ -219,9 +219,9 @@
<q-separator vertical inset />
<q-item>
<q-item-section avatar style="margin-right: 0px; padding-right: 0px"
><q-icon class="text-white" name="img:svgs/fan.svg"
/></q-item-section>
<q-item-section avatar style="margin-right: 0px; padding-right: 0px">
<q-icon class="text-white rotate" name="img:svgs/fan.svg" />
</q-item-section>
<q-item-section style="margin-left: -25px">
{{ $store.state.fan_temp.toFixed(1) }}
</q-item-section>
@ -238,6 +238,22 @@
<about-dialog ref="about_dialog" />
</template>
<style scoped>
@keyframes rotate {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
.rotate {
animation: rotate 1.5s linear infinite;
}
</style>
<script lang="ts">
import { defineComponent, ref, computed } from "vue";
import { useStore } from "src/store";
@ -291,6 +307,13 @@ export default defineComponent({
() => $store.state.current_running_plan.trim() != ""
);
const get_time_text = (s: number) => {
const hh = (s / 3600).toFixed(0);
const mm = ((s % 3600) / 60).toFixed(0);
const ss = ((s % 3600) % 60).toFixed(0);
return hh + $t.t("HH") + mm + $t.t("MM") + ss + $t.t("SS");
};
return {
show_advanced_menu,
plan_running,
@ -391,19 +414,19 @@ export default defineComponent({
${$t.t("device resolution")} : ${$store.state.device_screen_width}X${
$store.state.device_screen_height
}@${$store.state.device_screen_refresh_rate}<br />
${$t.t("system run time")} : ${system_run_time} ${$t.t("s")} <br />
${$t.t("system run time")} : ${get_time_text(system_run_time)} <br />
${$t.t("system idle rate")} : ${(
system_idle_time /
(system_run_time * 4)
).toFixed(2)} % <br />
(system_idle_time / (system_run_time * 4)) *
100
).toFixed(0)} % <br />
${$t.t("server run time")} : ${get_time_text(server_run_time)} <br />
${$t.t("server all run time")} : ${get_time_text(
server_all_run_time
)} <br />
${$t.t("current server system time")} : ${$date.formatDate(
new Date(current_system_time),
"YYYY-MM-DD HH:mm:ss"
)}<br />
${$t.t("server run time")} : ${server_run_time} ${$t.t("s")} <br />
${$t.t("server all run time")} : ${server_all_run_time} ${$t.t(
"s"
)} <br />
</div>`,
});
},

View File

@ -900,7 +900,7 @@ export default defineComponent({
try {
const resposne = await GlobalData.getInstance()
.getCurrentClient()
?.setPollingData(window_id, name, datas);
?.setWindowPollingData(window_id, name, datas);
if (resposne) {
if (resposne.success) {
$q.notify({

View File

@ -485,6 +485,9 @@ export default store(function (/* { ssrContext } */) {
const parent = playload.parent ?? "";
const is_group = playload.is_group ?? false;
let item_data = playload.item_data ?? new SignalSourceEntity();
if (item_data && item_data.local_file_flag) {
return;
}
let node = _TreeHelper.findNode(
state.signal_source_tree[0],
"uuid",
@ -569,9 +572,15 @@ export default store(function (/* { ssrContext } */) {
false,
item
);
if (
node_item &&
node_item.item_data &&
!node_item.item_data.local_file_flag
) {
parent.children.push(node_item);
}
}
}
};
const findGroupsByParent = (parent: string, array: any[]) => {