From 4e53a89b57ccfa5173f306fca9be50602549c319 Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Tue, 20 Aug 2024 11:04:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=90=9C=E7=B4=A2=E6=A0=8F=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-image-search-box.scss | 35 ++++++++++------ .../custom-image-search-box.tsx | 40 ++++++++++++++----- 2 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/custom-image-search-box/custom-image-search-box.scss b/src/custom-image-search-box/custom-image-search-box.scss index 29b9660..e269bc2 100644 --- a/src/custom-image-search-box/custom-image-search-box.scss +++ b/src/custom-image-search-box/custom-image-search-box.scss @@ -11,10 +11,21 @@ position: absolute; top: 0; left: 0; + @include when('has-img') { + .el-input__wrapper { + box-shadow: unset; - .el-input__wrapper { - box-shadow: unset; + &.is-focus { + box-shadow: unset; + } + + &:hover { + box-shadow: unset; + } + } + } + .el-input__wrapper { .el-input__suffix::before { position: absolute; top: 9px; @@ -26,25 +37,23 @@ background-color: #00e2f4; border-radius: 4px; } - - &.is-focus { - box-shadow: unset; - } - - &:hover { - box-shadow: unset; - } } + } @include e(search-icon) { + position: relative; color: #2ce8e1; cursor: pointer; + @include when('has-img') { + left: -6px; + opacity: 0; + } } } -.cockpit-large-screen{ - .ibiz-custom-image-search-box{ +.cockpit-large-screen { + .ibiz-custom-image-search-box { position: absolute; } -} \ No newline at end of file +} diff --git a/src/custom-image-search-box/custom-image-search-box.tsx b/src/custom-image-search-box/custom-image-search-box.tsx index 10f4418..ebf6bb4 100644 --- a/src/custom-image-search-box/custom-image-search-box.tsx +++ b/src/custom-image-search-box/custom-image-search-box.tsx @@ -11,20 +11,37 @@ export const CustomImageSearchBox = defineComponent({ name: 'CustomImageSearchBox', props: getRawProps(), emits: getEditorEmits(), - setup(props, { emit }) { + setup(props) { const ns = useNamespace('custom-image-search-box'); const c = props.controller; + // 搜索值 const searchValue = ref(''); + // 是否配置了图片 + const hasImg = ref(false); + + // 搜索 const onSearch = (): void => { - emit('customEvent', { tag: 'SEARCH', value: searchValue.value }); + if (props.controller.dashboard) { + const Dc = props.controller.dashboard; + const param: IData = { + name: props.controller.model.name, + value: searchValue.value, + }; + Dc.evt.emit('onCustomEvent', { data: [param] }); + } }; + if (c.model.sysImage?.rawContent) { + hasImg.value = true; + } + return { c, ns, searchValue, + hasImg, onSearch, }; }, @@ -37,19 +54,24 @@ export const CustomImageSearchBox = defineComponent({ this.readonly ? this.ns.m('readonly') : '', ]} > - + {this.hasImg && ( + + )} } -- Gitee From a34fc80d3b88318a6fa3c235132e4a394db7a837 Mon Sep 17 00:00:00 2001 From: jianglinjun Date: Tue, 20 Aug 2024 21:32:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A0=8F=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-image-search-box.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/custom-image-search-box/custom-image-search-box.tsx b/src/custom-image-search-box/custom-image-search-box.tsx index ebf6bb4..f3c2e9f 100644 --- a/src/custom-image-search-box/custom-image-search-box.tsx +++ b/src/custom-image-search-box/custom-image-search-box.tsx @@ -20,16 +20,14 @@ export const CustomImageSearchBox = defineComponent({ // 是否配置了图片 const hasImg = ref(false); - + // 搜索 const onSearch = (): void => { if (props.controller.dashboard) { const Dc = props.controller.dashboard; - const param: IData = { - name: props.controller.model.name, - value: searchValue.value, - }; - Dc.evt.emit('onCustomEvent', { data: [param] }); + if (Dc) { + Dc.refresh({ query: searchValue.value }); + } } }; -- Gitee