信号源、模式、预案增加父节点修改接口
This commit is contained in:
parent
5ee06b380c
commit
a26ed41c34
@ -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>",
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
|
@ -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", {
|
||||