From 10f77f296b8644616d59e2a53bfde7bccd6081d2 Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Tue, 11 Mar 2025 11:37:10 +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-=E8=BF=90=E8=A1=8C=E7=8A=B6=E6=80=81=E3=80=91?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=95=8C=E9=9D=A2=E5=8D=A1=E6=AD=BB=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instance/Detail/Running/Event/index.vue | 88 +++++++++++-------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/src/views/device/Instance/Detail/Running/Event/index.vue b/src/views/device/Instance/Detail/Running/Event/index.vue index 885b4d5c..950b377b 100644 --- a/src/views/device/Instance/Detail/Running/Event/index.vue +++ b/src/views/device/Instance/Detail/Running/Event/index.vue @@ -86,45 +86,61 @@ const _getEventList = (_params: any) => getEventList(instanceStore.current.id || '', events.data.id || '', _params); watchEffect(() => { - columns.value = [...defaultColumns]; - if (events.data?.valueType?.type === 'object') { - const eventProperties = cloneDeep(events.data.valueType?.properties || []) - eventProperties.reverse().map((i: any) => { - if (i.valueType?.type === 'object') { - objectKey.value.push({ - key:i.id, - dataIndex: `${i.id}_format` - }); - columns.value.splice(0, 0, { - key: i.id, - title: i.name, - dataIndex: `${i.id}_format`, - search: { - type: i?.valueType?.type || 'string', - rename: i.id, - }, - scopedSlots: true, - }); - } else { - columns.value.splice(0, 0, { - key: i.id, - title: i.name, - dataIndex: `${i.id}_format`, - search: { - type: i?.valueType?.type || 'string', - rename: i.id, - }, - ellipsis: true, - scopedSlots: true, - }); - } + columns.value = [...defaultColumns]; + if (events.data?.valueType?.type === 'object') { + const eventProperties = cloneDeep(events.data.valueType?.properties || []) + eventProperties.reverse().map((i: any) => { + if (['object', 'array'].includes(i.valueType?.type)) { + objectKey.value.push({ + key: i.id, + dataIndex: `${i.id}_format` }); - } else { columns.value.splice(0, 0, { - title: '数据', - dataIndex: 'value', + key: i.id, + title: i.name, + dataIndex: `${i.id}_format`, + search: { + type: 'string', + rename: i.id, + }, + scopedSlots: true, }); - } + } else { + const arr = i?.valueType?.type === 'boolean' ? [ + { + label: i?.valueType.falseText, + value: i?.valueType.falseValue + }, + { + label: i?.valueType.trueText, + value: i?.valueType.trueValue + }, + ] : (i?.valueType?.elements || []).map(item => { + return { + label: item.text, + value: item.value + } + }) + columns.value.splice(0, 0, { + key: i.id, + title: i.name, + dataIndex: `${i.id}_format`, + search: { + type: componentsType?.[i?.valueType?.type] || 'string', + rename: i.id, + options: arr + }, + ellipsis: true, + scopedSlots: true, + }); + } + }); + } else { + columns.value.splice(0, 0, { + title: '数据', + dataIndex: 'value', + }); + } }); const handleSearch = (_params: any) => {