fix: 【设备管理-标签】修复输入0,无法在详情显示

This commit is contained in:
XieYongHong 2025-03-21 14:24:00 +08:00
parent 10f77f296b
commit 67da9dedf8
1 changed files with 13 additions and 5 deletions

View File

@ -87,24 +87,32 @@ const handleOk = async () => {
if (dataSource.value.length) { if (dataSource.value.length) {
loading.value = true loading.value = true
const list = (dataSource.value || []) 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) => { .map((i: any) => {
const { dataType, ...extra } = i; const { dataType, ...extra } = i;
if (extra.value === 0) {
extra.value = String(extra.value)
}
return { ...extra }; return { ...extra };
}); });
if (list.length) { if (list.length) {
// //
const resp = await saveTags(instanceStore.current?.id || '', list); const resp = await saveTags(instanceStore.current?.id || '', list).finally(()=>{
if (resp.status === 200) { loading.value = false
});
if (resp.success === 200) {
onlyMessage('操作成功!'); 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) { if (_list.length) {
// //
_list.map(async (item: any) => { _list.map(async (item: any) => {
if (item.id) { if (item.id) {
await delTags(instanceStore.current?.id || '', item.id); await delTags(instanceStore.current?.id || '', item.id).catch(()=>{
loading.value = false
});
} }
}); });
} }