diff --git a/package.json b/package.json index 69b9506..9eb12cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "media_player_client", - "version": "1.4.18", + "version": "1.4.19", "description": "A Quasar Framework app", "productName": "MediaPlayerClient", "author": "fangxiang ", diff --git a/public/source_icon/clock.png b/public/source_icon/clock.png index 22ba914..78366fd 100644 Binary files a/public/source_icon/clock.png and b/public/source_icon/clock.png differ diff --git a/src/components/ModeTree.vue b/src/components/ModeTree.vue index e4f030b..57beadf 100644 --- a/src/components/ModeTree.vue +++ b/src/components/ModeTree.vue @@ -10,6 +10,10 @@ class="full-width" clickable :disable="!$store.state.power_state" + :draggable="prop.node.uuid != '' && $store.state.power_state" + @dragstart="(evt) => onDragStart(evt, prop.node)" + @dragover="(evt) => onDragOver(evt, prop.node)" + @drop="(evt) => onDrop(evt, prop.node)" @dblclick=" (evt) => { if (!$store.state.power_state) { @@ -36,6 +40,7 @@ > 0 && + group && + group.length > 0 + ) { + if (group == "true") { + const mode_group = GlobalData.getInstance().mode_groups.find( + (item) => item && (item as any).uuid == uuid + ); + if (mode_group) { + if (mode_group.parent_uuid == node.item_data.uuid) { + return; + } + + GlobalData.getInstance() + .getCurrentClient() + ?.editModeGroup( + mode_group.uuid, + mode_group.name, + node.item_data.uuid + ); + } else { + console.log("can't find mode group, uuid:" + uuid); + } + } else if (group == "false") { + const mode = GlobalData.getInstance().modes.find( + (item) => item && (item as any).uuid == uuid + ); + if (mode) { + if (mode.group_uuid == node.item_data.uuid) { + return; + } + GlobalData.getInstance() + .getCurrentClient() + ?.editMode( + mode.uuid, + mode.name, + mode.number, + node.item_data.uuid + ); + } else { + console.log("can't find mode, uuid:" + uuid); + } + } + } + } else { + console.log("type error"); + } + } + } + }, }; }, }); diff --git a/src/components/PlanTree.vue b/src/components/PlanTree.vue index 558fbaa..7da42a6 100644 --- a/src/components/PlanTree.vue +++ b/src/components/PlanTree.vue @@ -10,12 +10,17 @@ class="full-width" clickable :disable="!$store.state.power_state" + :draggable="prop.node.uuid != '' && $store.state.power_state" + @dragstart="(evt) => onDragStart(evt, prop.node)" + @dragover="(evt) => onDragOver(evt, prop.node)" + @drop="(evt) => onDrop(evt, prop.node)" @dblclick=" (evt) => !prop.node.is_group && runPlan(prop.node.item_data) " > 0 && + group && + group.length > 0 + ) { + if (group == "true") { + const plan_group = GlobalData.getInstance().plan_groups.find( + (item) => item && (item as any).uuid == uuid + ); + if (plan_group) { + if (plan_group.parent_uuid == node.item_data.uuid) { + return; + } + GlobalData.getInstance() + .getCurrentClient() + ?.editPlanGroup( + plan_group.uuid, + plan_group.name, + node.item_data.uuid + ); + } else { + console.log("can't find plan group, uuid:" + uuid); + } + } else if (group == "false") { + const plan = GlobalData.getInstance().plans.find( + (item) => item && (item as any).uuid == uuid + ); + if (plan) { + if (plan.group_uuid == node.item_data.uuid) { + return; + } + const entity = extend(false, plan) as PlanEntity; + entity.group_uuid = node.item_data.uuid; + GlobalData.getInstance() + .getCurrentClient() + ?.editPlan(entity); + } else { + console.log("can't find plan, uuid:" + uuid); + } + } + } + } else { + console.log("type error"); + } + } + } + }, }; }, }); diff --git a/src/components/PollingTree.vue b/src/components/PollingTree.vue index 6cee365..5ba92cc 100644 --- a/src/components/PollingTree.vue +++ b/src/components/PollingTree.vue @@ -19,6 +19,7 @@ > + -import { defineComponent, computed, onMounted, ref, nextTick } from "vue"; +import { defineComponent, computed, onMounted, ref } from "vue"; import { useStore } from "src/store"; -import { SignalSourceTreeItemEntity } from "src/entities/SignalSourceEntity"; +import { + SignalSourceEntity, + SignalSourceTreeItemEntity, +} from "src/entities/SignalSourceEntity"; import SignalSourceGroupDialog from "src/components/SignalSourceGroupDialog.vue"; import SignalSourceDialog from "src/components/SignalSourceDialog.vue"; import { Common } from "src/common/Common"; import GlobalData from "src/common/GlobalData"; -import { useQuasar } from "quasar"; +import { useQuasar, extend } from "quasar"; import { useI18n } from "vue-i18n"; import EventBus, { EventNamesDefine } from "src/common/EventBus"; import { Protocol } from "src/entities/WSProtocol"; @@ -229,11 +236,85 @@ export default defineComponent({ onDragStart(e: DragEvent, node: SignalSourceTreeItemEntity) { e.dataTransfer?.setData("uuid", node.uuid); e.dataTransfer?.setData("type", "signal_source"); + e.dataTransfer?.setData("group", node.is_group ? "true" : "false"); e.dataTransfer?.setData("node_object", JSON.stringify(node)); if (e.dataTransfer) { e.dataTransfer.dropEffect = "move"; } }, + onDragOver(e: DragEvent, node: SignalSourceTreeItemEntity) { + if (node && node.is_group && !node.item_data?.system_default) { + e.preventDefault(); + } + }, + onDrop(e: DragEvent, node: SignalSourceTreeItemEntity) { + if ( + node && + node.is_group && + node.item_data && + !node.item_data.system_default + ) { + if (e.dataTransfer) { + const type = e.dataTransfer.getData("type"); + if (type == "signal_source") { + const uuid = e.dataTransfer.getData("uuid"); + const group = e.dataTransfer.getData("group"); + if ( + typeof uuid == "string" && + type && + type.length > 0 && + group && + group.length > 0 + ) { + if (group == "true") { + const signal_source_group = + GlobalData.getInstance().signal_source_groups.find( + (item) => item && (item as any).uuid == uuid + ); + if (signal_source_group) { + if ( + signal_source_group.parent_uuid == node.item_data.uuid + ) { + return; + } + GlobalData.getInstance() + .getCurrentClient() + ?.editSignalSourceGroup( + signal_source_group.uuid, + signal_source_group.name, + node.item_data.uuid + ); + } else { + console.log("can't find signal source group, uuid:" + uuid); + } + } else if (group == "false") { + const signal_source = + GlobalData.getInstance().signal_source.find( + (item) => item && (item as any).uuid == uuid + ); + if (signal_source) { + if (signal_source.group_uuid == node.item_data.uuid) { + return; + } + const entity = extend( + false, + signal_source + ) as SignalSourceEntity; + entity.group_uuid = node.item_data.uuid; + GlobalData.getInstance() + .getCurrentClient() + ?.editSignalSource(entity); + } else { + console.log("can't find signal source, uuid:" + uuid); + } + } + } + } else { + console.log("type error"); + } + } + } + }, getItemIcon(item_type: string) { return Common.getSignalSourceIcon(item_type); }, diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index d61d535..cc4b549 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -295,4 +295,9 @@ export default { "open window": "Open Window", "close all windows": "Close All Windows", "select data(DBP) file": "Select Data(DBP) File", + "please check server state, or check server ip address!": + "Please Check Server State, Or Check Server Ip Address!", + "connect time out!": "Connect Time Out!", + "login fail!": "Login Fail!", + "unset power on start": "UnSet Power On Start", }; diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 4615811..208449e 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -1,5 +1,5 @@