From 67da9dedf8e0da31922b071b446ff6f3420b03a3 Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Fri, 21 Mar 2025 14:24:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E3=80=90=E8=AE=BE=E5=A4=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E6=A0=87=E7=AD=BE=E3=80=91=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BE=93=E5=85=A50=EF=BC=8C=E6=97=A0=E6=B3=95=E5=9C=A8?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/Info/components/Tags/Save.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/views/device/Instance/Detail/Info/components/Tags/Save.vue b/src/views/device/Instance/Detail/Info/components/Tags/Save.vue index e8ff918a..74d2096e 100644 --- a/src/views/device/Instance/Detail/Info/components/Tags/Save.vue +++ b/src/views/device/Instance/Detail/Info/components/Tags/Save.vue @@ -87,24 +87,32 @@ const handleOk = async () => { if (dataSource.value.length) { loading.value = true const list = (dataSource.value || []) - .filter((item: any) => item?.key && item?.value) + .filter((item: any) => item?.key && (item?.value !== undefined && item?.value !== null)) .map((i: any) => { const { dataType, ...extra } = i; + if (extra.value === 0) { + extra.value = String(extra.value) + } + return { ...extra }; }); if (list.length) { // 填值 - const resp = await saveTags(instanceStore.current?.id || '', list); - if (resp.status === 200) { + const resp = await saveTags(instanceStore.current?.id || '', list).finally(()=>{ + loading.value = false + }); + if (resp.success === 200) { onlyMessage('操作成功!'); } } - const _list = (dataSource.value || []).filter((item: any) => item?.key && !item?.value); + const _list = (dataSource.value || []).filter((item: any) => item?.key && (item?.value === undefined || item?.value === null)); if (_list.length) { // 删除值 _list.map(async (item: any) => { if (item.id) { - await delTags(instanceStore.current?.id || '', item.id); + await delTags(instanceStore.current?.id || '', item.id).catch(()=>{ + loading.value = false + }); } }); }