修改设备信息的时间显示

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, window_id: number,
name: string, name: string,
datas?: StringKeyValueEntity[] datas?: StringKeyValueEntity[]
) { ) {
return await this.doRpc<Protocol.SetPollingDataResponseEntity>( return await this.doRpc<Protocol.SetWindowPollingDataResponseEntity>(
new Protocol.SetPollingDataRequestEntity(window_id, name, datas) new Protocol.SetWindowPollingDataRequestEntity(window_id, name, datas)
); );
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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