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) {
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
});
}
});
}