添加更新模式窗口列表的功能

This commit is contained in:
fangxiang 2022-02-12 14:35:46 +08:00
parent a7950f1359
commit 0bf2dd23ca
4 changed files with 100 additions and 1 deletions

View File

@ -415,6 +415,16 @@ export default class ClientConnection {
} }
} }
public async updateModeWindowList(uuid: string) {
try {
return await this.doRpc<Protocol.UpdateModeWindowListResponseEntity>(
new Protocol.UpdateModeWindowListRequestEntity(0, uuid)
);
} catch (e) {
console.error(e);
}
}
public async deleteModeGroup(uuid: string) { public async deleteModeGroup(uuid: string) {
try { try {
return await this.doRpc<Protocol.DeleteModeGroupResponseEntity>( return await this.doRpc<Protocol.DeleteModeGroupResponseEntity>(

View File

@ -99,6 +99,21 @@
<q-item-section>{{ $t("edit") }}</q-item-section> <q-item-section>{{ $t("edit") }}</q-item-section>
</q-item> </q-item>
<q-item
clickable
v-ripple
v-close-popup
v-if="prop.node.item_data"
@click="updateToCurrentWindowList($event, prop.node)"
>
<q-item-section avatar
><q-icon name="refresh"
/></q-item-section>
<q-item-section>{{
$t("update to current window list")
}}</q-item-section>
</q-item>
<q-item <q-item
clickable clickable
v-ripple v-ripple
@ -133,7 +148,7 @@ import { Common } from "src/common/Common";
import GlobalData from "src/common/GlobalData"; import GlobalData from "src/common/GlobalData";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { ModeEntity } from "src/entities/ModeEntity"; import { ModeEntity, ModeTreeItemEntity } from "src/entities/ModeEntity";
import EventBus, { EventNamesDefine } from "src/common/EventBus"; import EventBus, { EventNamesDefine } from "src/common/EventBus";
import { NotifyMessage } from "src/common/ClientConnection"; import { NotifyMessage } from "src/common/ClientConnection";
import { Protocol } from "src/entities/WSProtocol"; import { Protocol } from "src/entities/WSProtocol";
@ -221,6 +236,51 @@ export default defineComponent({
timeout: 1500, timeout: 1500,
}); });
}, },
updateToCurrentWindowList(evt: MouseEvent, data: ModeTreeItemEntity) {
if (
data &&
data.item_data &&
data.item_data.uuid &&
data.item_data.uuid.trim() != ""
) {
const uuid = data.item_data.uuid;
$q.dialog({
title: $t.t("update to current window list"),
message:
$t.t(
"the list of previously saved window list is about to be overwritten"
) +
"," +
$t.t("are you sure about the update") +
"?",
cancel: true,
persistent: true,
}).onOk(async () => {
try {
const response = (await GlobalData.getInstance()
.getCurrentClient()
?.updateModeWindowList(
uuid
)) as Protocol.UpdateModeWindowListResponseEntity;
$q.notify({
color: response && response.success ? "positive" : "negative",
icon: response && response.success ? "done" : "warning",
message:
$t.t("update to current window list") +
(response && response.success
? $t.t("success")
: $t.t("fail")) +
"!",
position: "top",
timeout: 1500,
});
} catch (e) {
console.log(e);
}
});
}
},
}; };
}, },
}); });

View File

@ -139,6 +139,10 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "CallMode"; return Commands.PROTOCOL_PREFIX + "CallMode";
} }
public static get kRpcUpdateModeWindowList() {
return Commands.PROTOCOL_PREFIX + "RpcUpdateModeWindowList";
}
public static get kRpcAddPlanGroup() { public static get kRpcAddPlanGroup() {
return Commands.PROTOCOL_PREFIX + "RpcAddPlanGroup"; return Commands.PROTOCOL_PREFIX + "RpcAddPlanGroup";
} }
@ -310,6 +314,7 @@ export namespace Protocol {
Commands.kRpcAddMode, Commands.kRpcAddMode,
Commands.kRpcDeleteMode, Commands.kRpcDeleteMode,
Commands.kRpcEditMode, Commands.kRpcEditMode,
Commands.kRpcUpdateModeWindowList,
Commands.kRpcGetCurrentRunningPlan, Commands.kRpcGetCurrentRunningPlan,
Commands.kCurrentRunningPlanStateChanged, Commands.kCurrentRunningPlanStateChanged,
Commands.kRpcAddPlanGroup, Commands.kRpcAddPlanGroup,
@ -832,6 +837,26 @@ export namespace Protocol {
} }
} }
export class UpdateModeWindowListRequestEntity extends Protocol.PacketEntity {
uuid = "";
constructor(rcp_id?: number, uuid?: string) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcUpdateModeWindowList;
this.uuid = uuid ?? "";
}
}
export class UpdateModeWindowListResponseEntity extends Protocol.PacketEntity {
success = false;
constructor() {
super();
this.command = Protocol.Commands.kRpcUpdateModeWindowList;
}
}
export class DeleteModeGroupRequestEntity extends Protocol.PacketEntity { export class DeleteModeGroupRequestEntity extends Protocol.PacketEntity {
uuid = ""; uuid = "";

View File

@ -317,4 +317,8 @@ export default {
"lower window": "置底窗口", "lower window": "置底窗口",
"top window": "置顶窗口", "top window": "置顶窗口",
"index exised": "索引已经存在", "index exised": "索引已经存在",
"update to current window list": "更新窗口列表",
"the list of previously saved window list is about to be overwritten":
"之前保存的窗口列表将被覆盖",
"are you sure about the update": "确定更新吗",
}; };