From 62ff5a6f6e4d7e3f7fc70c4e27187a6cb328a21f Mon Sep 17 00:00:00 2001 From: chendingwei <1170506816@qq.com> Date: Thu, 15 Dec 2022 11:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E3=80=81=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + src/utils/popup.ts | 97 ++++++++++++ src/views/page/Aside/cameraRightMenu.vue | 82 ++++++++++ src/views/page/aside/cameraLeftMenu.vue | 22 ++- src/views/page/cameraCenter.vue | 185 ++++++++++------------- 5 files changed, 281 insertions(+), 106 deletions(-) create mode 100644 src/utils/popup.ts create mode 100644 src/views/page/Aside/cameraRightMenu.vue diff --git a/components.d.ts b/components.d.ts index ee82309..3f8a8c5 100644 --- a/components.d.ts +++ b/components.d.ts @@ -11,6 +11,7 @@ declare module '@vue/runtime-core' { AMenu: typeof import('ant-design-vue/es')['Menu'] AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] ATree: typeof import('ant-design-vue/es')['Tree'] + Model: typeof import('./src/components/model.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] } diff --git a/src/utils/popup.ts b/src/utils/popup.ts new file mode 100644 index 0000000..6740734 --- /dev/null +++ b/src/utils/popup.ts @@ -0,0 +1,97 @@ +import { Button, notification } from "ant-design-vue"; +import { CloseSquareTwoTone } from "@ant-design/icons-vue"; +import { h, VNode } from "vue"; +/** + * 消息弹窗组件 Notification + * @param {string} title 标题 + * @param {string} content 内容 + * @param {string} id 唯一标识 + * @param {number} duration 持续时间: 默认不关闭(单位:秒) + * @param {string} btnAText 按钮1 名称 + * @param {string} btnBText 按钮2 名称 + * @param {Event} btnAEvent 按钮1 事件 + * @param {Event} btnBEvent 按钮2 事件 + */ +export default function popup( + title = "标题", + content: VNode[] | string = "请输入内容", + id = "", + duration = 0, + btnAText = "", btnBText = "", + btnAEvent = () => {/* do nothing.*/ }, + btnBEvent = () => {/* do nothing.*/ } +): void { + const key = id === "" ? `id-${Date.now()}` : id; + notification.open({ + key, + duration: duration, + message: h( + "h2", + { + style: { color: "#fff", + textAlign: "center" + }, + }, + title + ), + description: h( + "div", + { + style: { color: "#fff" }, + }, + content + ), + placement: 'topLeft', + style: { + width: "540px", + // height: "600px", + // marginLeft: `-200px`, + /**right导致页面重排,不流畅,但目前mac和Windows通过效果 + */ + top: "50%", + left: `50%`, + transform: 'translate(-50%,-50%)', + backgroundColor: "rgba(0 ,64 ,64 , 0.8)", + userSelect: "none", + //boxShadow: "inset 0 0 15px 4px #56ffff", + // boxShadow: "inset 0 0 4px 2px #56ffff", + borderRadius:"5px", + border:"2px solid #56ffff88", + color: "white", + position: 'fixed', + }, + btn: h("div", null, [ + btnAText == "" ? null : h( + Button, + { + type: "primary", + size: "small", + danger: true, + onClick: btnAEvent, + }, + btnAText + ), + btnBText == "" ? null : h( + Button, + { + type: "primary", + size: "small", + style: { + marginLeft: "7px", + }, + danger: true, + onClick: btnBEvent, + }, + btnBText + ), + ]), + closeIcon: h(CloseSquareTwoTone, { + style: { + display:"none" + }, + }) , + onClose: () => { + notification.close(key); + }, + }); +} diff --git a/src/views/page/Aside/cameraRightMenu.vue b/src/views/page/Aside/cameraRightMenu.vue new file mode 100644 index 0000000..3af8189 --- /dev/null +++ b/src/views/page/Aside/cameraRightMenu.vue @@ -0,0 +1,82 @@ + + + + + \ No newline at end of file diff --git a/src/views/page/aside/cameraLeftMenu.vue b/src/views/page/aside/cameraLeftMenu.vue index efa5655..7b16830 100644 --- a/src/views/page/aside/cameraLeftMenu.vue +++ b/src/views/page/aside/cameraLeftMenu.vue @@ -18,8 +18,9 @@ {{ title }} @@ -53,6 +54,20 @@ const treeData = ref([ ]); const onContextMenuClick = (treeKey: string, menuKey: string) => { console.log(`treeKey: ${treeKey}, menuKey: ${menuKey}`); + //防止添加多个key值,再次点击不能关闭。数组去重 + if(menuKey=="open"){ + let arr=[...expandedKeys.value] + arr.push(treeKey) + arr=[...new Set(arr)] + expandedKeys.value=arr + }else if(menuKey=="close"){ + expandedKeys.value=expandedKeys.value.filter((item:any)=>{ + return item != treeKey + }) + }else if(menuKey=="delete"){ + + } + }; let searchStr = ref(''); const expandedKeys = ref([]); @@ -60,6 +75,7 @@ const expandedKeys = ref([]); onMounted(() => { loadTreeData() }) +//模糊查询 watch(searchStr, (newVal, oldVal) => { let expandedKeyArr: any[] = [] if (newVal.length == 0) return @@ -74,11 +90,13 @@ watch(searchStr, (newVal, oldVal) => { }); expandedKeys.value = expandedKeyArr }) +// 选中相机 function selectCamera(e: any) { if (e.length && !isNaN(parseInt(e[0]))) { piniaStore.updateCurSelectKey(e[0].toString()) } } +//模糊查询递归 function searchFn(newVal: string, arr: any[]): any { let expandedKeyArr: any[] = [] arr.forEach(element => { diff --git a/src/views/page/cameraCenter.vue b/src/views/page/cameraCenter.vue index 621ff9a..bca4591 100644 --- a/src/views/page/cameraCenter.vue +++ b/src/views/page/cameraCenter.vue @@ -9,54 +9,50 @@
-
- - - {{ item.name }} -
+ +
+ + + {{ item.name }} +
+ +
+
1
+
-
-
-
标签标志
-
-
-
截图
-
-
-
录像
-
-
-
3D缩放
-
-
-
设备标记
-
-
-
工具箱
-
-
+ + +