fix: 【设备管理-标签】修复输入0,无法在详情显示
This commit is contained in:
parent
10f77f296b
commit
67da9dedf8
|
@ -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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue