信号源、模式、预案增加父节点修改接口

This commit is contained in:
fangxiang 2022-07-12 19:06:03 +08:00
parent 5ee06b380c
commit a26ed41c34
14 changed files with 356 additions and 50 deletions

View File

@ -1,6 +1,6 @@
{
"name": "media_player_client",
"version": "1.4.17",
"version": "1.4.18",
"description": "A Quasar Framework app",
"productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>",

View File

@ -251,10 +251,19 @@ export default class ClientConnection {
}
}
public async editSignalSourceGroup(uuid: string, name: string) {
public async editSignalSourceGroup(
uuid: string,
name: string,
parent_uuid: string
) {
try {
return await this.doRpc<Protocol.EditSignalSourceGroupResponseEntity>(
new Protocol.EditSignalSourceGroupRequestEntity(0, uuid, name)
new Protocol.EditSignalSourceGroupRequestEntity(
0,
uuid,
name,
parent_uuid
)
);
} catch (e) {
console.error(e);
@ -321,10 +330,10 @@ export default class ClientConnection {
}
}
public async editPlanGroup(uuid: string, name: string) {
public async editPlanGroup(uuid: string, name: string, parent_uuid: string) {
try {
return await this.doRpc<Protocol.EditPlanGroupResponseEntity>(
new Protocol.EditPlanGroupRequestEntity(0, uuid, name)
new Protocol.EditPlanGroupRequestEntity(0, uuid, name, parent_uuid)
);
} catch (e) {
console.error(e);
@ -455,10 +464,10 @@ export default class ClientConnection {
}
}
public async editModeGroup(uuid: string, name: string) {
public async editModeGroup(uuid: string, name: string, parent_uuid: string) {
try {
return await this.doRpc<Protocol.EditModeGroupResponseEntity>(
new Protocol.EditModeGroupRequestEntity(0, uuid, name)
new Protocol.EditModeGroupRequestEntity(0, uuid, name, parent_uuid)
);
} catch (e) {
console.error(e);
@ -495,10 +504,15 @@ export default class ClientConnection {
}
}
public async editMode(uuid?: string, name?: string, index?: number) {
public async editMode(
uuid?: string,
name?: string,
index?: number,
group_uuid?: string
) {
try {
return await this.doRpc<Protocol.EditModeResponseEntity>(
new Protocol.EditModeRequestEntity(0, name, uuid, index)
new Protocol.EditModeRequestEntity(0, name, uuid, index, group_uuid)
);
} catch (e) {
console.error(e);

View File

@ -54,6 +54,16 @@ export default class GlobalData {
clients: Map<string, ClientConnection> = new Map<string, ClientConnection>();
_signal_source_groups: any[] = [];
public get signal_source_groups() {
return this._signal_source_groups;
}
public set signal_source_groups(signal_source_groups: any[]) {
this._signal_source_groups = signal_source_groups;
}
_signal_sources: SignalSourceEntity[] = [];
public get signal_source() {
@ -64,6 +74,16 @@ export default class GlobalData {
this._signal_sources = sources;
}
_mode_groups: any[] = [];
public get mode_groups() {
return this._mode_groups;
}
public set mode_groups(mode_groups: any[]) {
this._mode_groups = mode_groups;
}
_modes: ModeEntity[] = [];
public get modes() {
@ -74,6 +94,16 @@ export default class GlobalData {
this._modes = modes;
}
_plan_groups: any[] = [];
public get plan_groups() {
return this._plan_groups;
}
public set plan_groups(plan_groups: any[]) {
this._plan_groups = plan_groups;
}
_plans: PlanEntity[] = [];
public get plans() {

View File

@ -51,6 +51,8 @@ export default class Initializer {
value: response.signal_sources,
});
GlobalData.getInstance().signal_source = response.signal_sources;
GlobalData.getInstance().signal_source_groups =
response.signal_source_groups;
}
} catch (e) {
console.error(e);
@ -73,6 +75,7 @@ export default class Initializer {
});
GlobalData.getInstance().modes = response.modes;
GlobalData.getInstance().mode_groups = response.mode_groups;
}
} catch (e) {
console.error(e);
@ -93,6 +96,7 @@ export default class Initializer {
value: response.plans,
});
GlobalData.getInstance().plans = response.plans;
GlobalData.getInstance().plan_groups = response.plan_groups;
}
} catch (e) {
console.error(e);

View File

@ -174,17 +174,37 @@ export default class RemoteDataExangeProcesser {
let pos = GlobalData.getInstance().modes.findIndex(
(element) => element && element.uuid == temp.mode.uuid
);
let refresh_flag = false;
if (pos != -1) {
refresh_flag =
GlobalData.getInstance().modes[pos].group_uuid !=
temp.mode.group_uuid;
GlobalData.getInstance().modes[pos] = temp.mode;
}
$store.commit("setArrayValue", {
name: "modes",
value: GlobalData.getInstance().modes,
});
$store.commit("setModeTreeItem", {
is_group: false,
item_data: temp.mode,
});
if (refresh_flag) {
$store.commit("buildModeTree", {
options: {
$t,
$store,
$q,
},
response: {
mode_groups: GlobalData.getInstance().mode_groups,
modes: GlobalData.getInstance().modes,
},
});
} else {
$store.commit("setModeTreeItem", {
is_group: false,
item_data: temp.mode,
});
}
}
}
break;
@ -194,6 +214,12 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.ModeGroupAddNotifyEntity;
if (temp) {
GlobalData.getInstance().mode_groups.push(temp.mode_group);
$store.commit("setArrayValue", {
name: "mode_groups",
value: GlobalData.getInstance().mode_groups,
});
$store.commit("addModeTreeItem", {
parent: temp.mode_group.parent_uuid,
is_group: true,
@ -208,6 +234,16 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.ModeGroupDeleteNotifyEntity;
if (temp) {
let pos = GlobalData.getInstance().mode_groups.findIndex(
(element) => element && element.uuid == temp.uuid
);
if (pos != -1) {
GlobalData.getInstance().mode_groups.splice(pos, 1);
}
$store.commit("setArrayValue", {
name: "mode_groups",
value: GlobalData.getInstance().mode_groups,
});
$store.commit("deleteModeTreeItem", {
is_group: true,
uuid: temp.uuid,
@ -221,10 +257,40 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.ModeGroupEditNotifyEntity;
if (temp) {
$store.commit("setModeTreeItem", {
is_group: true,
item_data: temp.mode_group,
let pos = GlobalData.getInstance().mode_groups.findIndex(
(element) => element && element.uuid == temp.mode_group.uuid
);
let refresh_flag = false;
if (pos != -1) {
refresh_flag =
GlobalData.getInstance().mode_groups[pos].parent_uuid !=
temp.mode_group.parent_uuid;
GlobalData.getInstance().mode_groups[pos] = temp.mode_group;
}
$store.commit("setArrayValue", {
name: "mode_groups",
value: GlobalData.getInstance().mode_groups,
});
if (refresh_flag) {
$store.commit("buildModeTree", {
options: {
$t,
$store,
$q,
},
response: {
mode_groups: GlobalData.getInstance().mode_groups,
modes: GlobalData.getInstance().modes,
},
});
} else {
$store.commit("setModeTreeItem", {
is_group: true,
item_data: temp.mode_group,
});
}
}
}
break;
@ -279,17 +345,35 @@ export default class RemoteDataExangeProcesser {
let pos = GlobalData.getInstance().plans.findIndex(
(element) => element && element.uuid == temp.plan.uuid
);
let refresh_flag = false;
if (pos != -1) {
refresh_flag =
GlobalData.getInstance().plans[pos].group_uuid !=
temp.plan.group_uuid;
GlobalData.getInstance().plans[pos] = temp.plan;
}
$store.commit("setArrayValue", {
name: "plans",
value: GlobalData.getInstance().plans,
});
$store.commit("setPlanTreeItem", {
is_group: false,
item_data: temp.plan,
});
if (refresh_flag) {
$store.commit("buildPlanTree", {
options: {
$t,
$store,
$q,
},
response: {
plan_groups: GlobalData.getInstance().plan_groups,
plans: GlobalData.getInstance().plans,
},
});
} else {
$store.commit("setPlanTreeItem", {
is_group: false,
item_data: temp.plan,
});
}
}
}
break;
@ -299,6 +383,11 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.PlanGroupAddNotifyEntity;
if (temp) {
GlobalData.getInstance().plan_groups.push(temp.plan_group);
$store.commit("setArrayValue", {
name: "plan_groups",
value: GlobalData.getInstance().plan_groups,
});
$store.commit("addPlanTreeItem", {
parent: temp.plan_group.parent_uuid,
is_group: true,
@ -313,6 +402,16 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.PlanGroupDeleteNotifyEntity;
if (temp) {
let pos = GlobalData.getInstance().plan_groups.findIndex(
(element) => element && element.uuid == temp.uuid
);
if (pos != -1) {
GlobalData.getInstance().plan_groups.splice(pos, 1);
}
$store.commit("setArrayValue", {
name: "plan_groups",
value: GlobalData.getInstance().plan_groups,
});
$store.commit("deletePlanTreeItem", {
is_group: true,
uuid: temp.uuid,
@ -326,10 +425,38 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.PlanGroupEditNotifyEntity;
if (temp) {
$store.commit("setPlanTreeItem", {
is_group: true,
item_data: temp.plan_group,
let pos = GlobalData.getInstance().plan_groups.findIndex(
(element) => element && element.uuid == temp.plan_group.uuid
);
let refresh_flag = false;
if (pos != -1) {
refresh_flag =
GlobalData.getInstance().plan_groups[pos].parent_uuid !=
temp.plan_group.parent_uuid;
GlobalData.getInstance().plan_groups[pos] = temp.plan_group;
}
$store.commit("setArrayValue", {
name: "plan_groups",
value: GlobalData.getInstance().plan_groups,
});
if (refresh_flag) {
$store.commit("buildPlanTree", {
options: {
$t,
$store,
$q,
},
response: {
plan_groups: GlobalData.getInstance().plan_groups,
plans: GlobalData.getInstance().plans,
},
});
} else {
$store.commit("setPlanTreeItem", {
is_group: true,
item_data: temp.plan_group,
});
}
}
}
break;
@ -491,7 +618,12 @@ export default class RemoteDataExangeProcesser {
let pos = GlobalData.getInstance().signal_source.findIndex(
(element) => element && element.uuid == temp.signal_source.uuid
);
let refresh_flag = false;
if (pos != -1) {
refresh_flag =
GlobalData.getInstance().signal_source[pos].group_uuid !=
temp.signal_source.group_uuid;
GlobalData.getInstance().signal_source[pos] =
temp.signal_source;
}
@ -499,10 +631,25 @@ export default class RemoteDataExangeProcesser {
name: "signal_sources",
value: GlobalData.getInstance().signal_source,
});
$store.commit("setSignalSourceTreeItem", {
is_group: false,
item_data: temp.signal_source,
});
if (refresh_flag) {
$store.commit("buildSignalSourceTree", {
options: {
$t,
$store,
$q,
},
response: {
signal_source_groups:
GlobalData.getInstance().signal_source_groups,
signal_sources: GlobalData.getInstance().signal_source,
},
});
} else {
$store.commit("setSignalSourceTreeItem", {
is_group: false,
item_data: temp.signal_source,
});
}
}
}
break;
@ -512,6 +659,13 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.SignalSourceGroupAddNotifyEntity;
if (temp) {
GlobalData.getInstance().signal_source_groups.push(
temp.signal_source_group
);
$store.commit("setArrayValue", {
name: "signal_source_groups",
value: GlobalData.getInstance().signal_source_groups,
});
$store.commit("addSignalSourceTreeItem", {
parent: temp.signal_source_group.parent_uuid,
is_group: true,
@ -526,6 +680,16 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.SignalSourceGroupDeleteNotifyEntity;
if (temp) {
let pos = GlobalData.getInstance().signal_source_groups.findIndex(
(element) => element && element.uuid == temp.uuid
);
if (pos != -1) {
GlobalData.getInstance().signal_source_groups.splice(pos, 1);
}
$store.commit("setArrayValue", {
name: "signal_source_groups",
value: GlobalData.getInstance().signal_source_groups,
});
$store.commit("deleteSignalSourceTreeItem", {
is_group: true,
uuid: temp.uuid,
@ -539,10 +703,43 @@ export default class RemoteDataExangeProcesser {
notify.data
) as Protocol.SignalSourceGroupEditNotifyEntity;
if (temp) {
$store.commit("setSignalSourceTreeItem", {
is_group: true,
item_data: temp.signal_source_group,
let pos = GlobalData.getInstance().signal_source_groups.findIndex(
(element) =>
element && element.uuid == temp.signal_source_group.uuid
);
let refresh_flag = false;
if (pos != -1) {
refresh_flag =
GlobalData.getInstance().signal_source_groups[pos]
.parent_uuid != temp.signal_source_group.parent_uuid;
GlobalData.getInstance().signal_source_groups[pos] =
temp.signal_source_group;
}
$store.commit("setArrayValue", {
name: "signal_source_groups",
value: GlobalData.getInstance().signal_source_groups,
});
if (refresh_flag) {
$store.commit("buildSignalSourceTree", {
options: {
$t,
$store,
$q,
},
response: {
signal_source_groups:
GlobalData.getInstance().signal_source_groups,
signal_sources: GlobalData.getInstance().signal_source,
},
});
} else {
$store.commit("setSignalSourceTreeItem", {
is_group: true,
item_data: temp.signal_source_group,
});
}
}
}
break;

View File

@ -245,7 +245,7 @@ export default defineComponent({
const requestEditMode = async () => {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.editMode(uuid.value, name.value ?? "", index.value);
?.editMode(uuid.value, name.value ?? "", index.value, selected.value);
if (response) {
$q.notify({
color: response.success ? "positive" : "negative",

View File

@ -46,10 +46,10 @@
<q-card-section style="max-height: 50vh; width: 45vw" class="scroll">
<q-list>
<q-item v-if="type != 2">
<q-item v-if="/*type != 2*/ true">
<q-item-label>{{ $t("parent group") }}:</q-item-label>
</q-item>
<q-item v-if="type != 2" class="q-pa-none q-ma-none">
<q-item v-if="/*type != 2*/ true" class="q-pa-none q-ma-none">
<q-item-section style="padding-right: 10px">
<q-tree
ref="tree"
@ -215,7 +215,7 @@ export default defineComponent({
const requestEditModeGroup = async () => {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.editModeGroup(uuid.value, name.value ?? "");
?.editModeGroup(uuid.value, name.value ?? "", selected.value ?? "");
if (response) {
$q.notify({
color: response.success ? "positive" : "negative",
@ -244,7 +244,15 @@ export default defineComponent({
if (type.value == 2) {
name.value = options.data?.name ?? null;
}
selected.value = options.data?.uuid ?? null;
const mode_item_data_ = GlobalData.getInstance().mode_groups.find(
(e) => e && e.uuid == options.data?.uuid
);
if (mode_item_data_) {
selected.value = mode_item_data_.parent_uuid;
} else {
selected.value = "";
}
uuid.value = options.data?.uuid ?? null;
}
show_dialog.value = true;

View File

@ -15,6 +15,9 @@
if (!$store.state.power_state) {
return;
}
if (prop.node.is_group) {
return;
}
if (
$store.state.current_running_plan.trim() == '' &&
!prop.node.is_group

View File

@ -443,7 +443,7 @@ export default defineComponent({
align: "left",
name: "uuid",
required: true,
label: $t.t("signal source"),
label: $t.t("mode"),
field: "uuid",
sortable: false,
},

View File

@ -46,10 +46,10 @@
<q-card-section style="max-height: 50vh; width: 45vw" class="scroll">
<q-list>
<q-item v-if="type != 2">
<q-item v-if="/*type != 2*/ true">
<q-item-label>{{ $t("parent group") }}:</q-item-label>
</q-item>
<q-item v-if="type != 2" class="q-pa-none q-ma-none">
<q-item v-if="/*type != 2*/ true" class="q-pa-none q-ma-none">
<q-item-section style="padding-right: 10px">
<q-tree
ref="tree"
@ -215,7 +215,7 @@ export default defineComponent({
const requestEditPlanGroup = async () => {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.editPlanGroup(uuid.value, name.value ?? "");
?.editPlanGroup(uuid.value, name.value ?? "", selected.value ?? "");
if (response) {
$q.notify({
color: response.success ? "positive" : "negative",
@ -244,7 +244,14 @@ export default defineComponent({
if (type.value == 2) {
name.value = options.data?.name ?? null;
}
selected.value = options.data?.uuid ?? null;
const plan_item_data_ = GlobalData.getInstance().plan_groups.find(
(e) => e && e.uuid == options.data?.uuid
);
if (plan_item_data_) {
selected.value = plan_item_data_.parent_uuid;
} else {
selected.value = "";
}
uuid.value = options.data?.uuid ?? null;
}
show_dialog.value = true;

View File

@ -46,10 +46,10 @@
<q-card-section style="max-height: 50vh; width: 45vw" class="scroll">
<q-list>
<q-item v-if="type != 2">
<q-item v-if="/*type != 2*/ true">
<q-item-label>{{ $t("parent group") }}:</q-item-label>
</q-item>
<q-item v-if="type != 2" class="q-pa-none q-ma-none">
<q-item v-if="/*type != 2*/ true" class="q-pa-none q-ma-none">
<q-item-section style="padding-right: 10px">
<q-tree
ref="tree"

View File

@ -46,10 +46,10 @@
<q-card-section style="max-height: 50vh; width: 45vw" class="scroll">
<q-list>
<q-item v-if="type != 2">
<q-item v-if="/*type != 2*/ true">
<q-item-label>{{ $t("parent group") }}:</q-item-label>
</q-item>
<q-item v-if="type != 2" class="q-pa-none q-ma-none">
<q-item v-if="/*type != 2*/ true" class="q-pa-none q-ma-none">
<q-item-section style="padding-right: 10px">
<q-tree
ref="tree"
@ -215,7 +215,11 @@ export default defineComponent({
const requestEditSignalSourceGroup = async () => {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.editSignalSourceGroup(uuid.value, name.value ?? "");
?.editSignalSourceGroup(
uuid.value,
name.value ?? "",
selected.value ?? ""
);
if (response) {
$q.notify({
color: response.success ? "positive" : "negative",
@ -244,7 +248,16 @@ export default defineComponent({
if (type.value == 2) {
name.value = options.data?.name ?? null;
}
selected.value = options.data?.uuid ?? null;
const signal_item_data_ =
GlobalData.getInstance().signal_source_groups.find(
(e) => e && e.uuid == options.data?.uuid
);
if (signal_item_data_) {
selected.value = signal_item_data_.parent_uuid;
} else {
selected.value = "";
}
uuid.value = options.data?.uuid ?? null;
}
show_dialog.value = true;

View File

@ -889,13 +889,20 @@ export namespace Protocol {
export class EditSignalSourceGroupRequestEntity extends Protocol.PacketEntity {
uuid = "";
name = "";
parent_uuid = "";
constructor(rcp_id?: number, uuid?: string, name?: string) {
constructor(
rcp_id?: number,
uuid?: string,
name?: string,
parent_uuid?: string
) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcEditSignalSourceGroup;
this.uuid = uuid ?? "";
this.name = name ?? "";
this.parent_uuid = parent_uuid ?? "";
}
}
@ -994,6 +1001,7 @@ export namespace Protocol {
export class SignalSourceGroupEntity extends Protocol.PacketEntity {
parent_uuid: string = "";
name: string = "";
uuid: string = "";
system_default: boolean = false;
}
@ -1048,13 +1056,20 @@ export namespace Protocol {
export class EditModeGroupRequestEntity extends Protocol.PacketEntity {
uuid = "";
name = "";
parent_uuid = "";
constructor(rcp_id?: number, uuid?: string, name?: string) {
constructor(
rcp_id?: number,
uuid?: string,
name?: string,
parent_uuid?: string
) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcEditModeGroup;
this.uuid = uuid ?? "";
this.name = name ?? "";
this.parent_uuid = parent_uuid ?? "";
}
}
@ -1139,11 +1154,14 @@ export namespace Protocol {
name: string;
uuid: string;
number: number;
group_uuid: string;
constructor(
rcp_id?: number,
name?: string,
uuid?: string,
number?: number
number?: number,
group_uuid?: string
) {
super();
this.rpc_id = rcp_id ?? 0;
@ -1151,6 +1169,7 @@ export namespace Protocol {
this.name = name ?? "";
this.uuid = uuid ?? "";
this.number = number ?? 0;
this.group_uuid = group_uuid ?? "";
}
}
@ -1196,6 +1215,7 @@ export namespace Protocol {
export class ModeGroupEntity extends Protocol.PacketEntity {
parent_uuid: string = "";
name: string = "";
uuid: string = "";
}
export class ModeAddNotifyEntity extends Protocol.PacketEntity {
@ -1247,13 +1267,20 @@ export namespace Protocol {
export class EditPlanGroupRequestEntity extends Protocol.PacketEntity {
uuid = "";
name = "";
parent_uuid = "";
constructor(rcp_id?: number, uuid?: string, name?: string) {
constructor(
rcp_id?: number,
uuid?: string,
name?: string,
parent_uuid?: string
) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcEditPlanGroup;
this.uuid = uuid ?? "";
this.name = name ?? "";
this.parent_uuid = parent_uuid ?? "";
}
}
@ -1461,6 +1488,7 @@ export namespace Protocol {
export class PlanGroupEntity extends Protocol.PacketEntity {
parent_uuid: string = "";
name: string = "";
uuid: string = "";
}
export class RunPlanRequestEntity extends Protocol.PacketEntity {

View File

@ -288,4 +288,6 @@ export default {
click: "Click",
"lossless ": "Lossless ",
"picture quality": "Picture Quality",
"open left tool bar": "Open Left Tool Bar",
"open right tool bar": "Open Right Tool Bar",
};