From 44285c5d62f62055fe554c402d64f62935e50bf5 Mon Sep 17 00:00:00 2001 From: "X.Mo" Date: Tue, 16 Apr 2024 11:10:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=99=A8=E5=8D=95=E9=80=89=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E9=80=89=E6=8B=A9=E5=90=8E=E6=97=A0=E6=B3=95=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ma-resource/index.vue | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/ma-resource/index.vue b/src/components/ma-resource/index.vue index aaa0e495..1387c362 100644 --- a/src/components/ma-resource/index.vue +++ b/src/components/ma-resource/index.vue @@ -94,6 +94,7 @@ import uploadConfig from '@/config/upload' import MaTreeSlider from '@cps/ma-treeSlider/index.vue' import commonApi from '@/api/common' + import { xor } from 'lodash' import tool from '@/utils/tool' import { useI18n } from 'vue-i18n' import { Message } from '@arco-design/web-vue' @@ -162,13 +163,9 @@ const selectFile = (item, index) => { - if ( ! props.multiple && selecteds.value ) { - if (props.onlyData && item.url != selecteds.value) return - if (! props.onlyData && item.id != selecteds.value.id) return - } - const children = rl.value.children const className = 'item rounded-sm' + if (! /^(http|https)/g.test(item.url)) { item.url = tool.attachUrl(item.url, getStoreMode(item.storage_mode)) } @@ -176,18 +173,20 @@ children[index].className = className if (props.multiple) { selecteds.value.map((file, idx) => { - if (props.onlyData && file == item.url) selecteds.value.splice(idx, 1) - if (! props.onlyData && file.id == item.id) selecteds.value.splice(idx, 1) + selecteds.value.splice(idx, 1) }) } else { selecteds.value = '' } } else { - children[index].className = className + ' active' if (props.multiple) { + children[index].className = className + ' active' selecteds.value.push(props.onlyData ? item[props.returnType] : item) } else { - selecteds.value = props.onlyData ? item[props.returnType] : item + if (document.querySelectorAll('.item.active').length < 1) { + children[index].className = className + ' active' + selecteds.value = props.onlyData ? item[props.returnType] : item + } } } }