From 7b83732170c8d97a24045c872f37a8c9708de27a Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Mon, 27 Mar 2023 20:30:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BE=B9=E7=BC=98=E7=BD=91=E5=85=B3?= =?UTF-8?q?=E5=92=8C=E8=AE=BE=E5=A4=87=E8=AF=8A=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Diagnose/Status/ManualInspection.tsx | 2 +- .../Instance/Detail/Diagnose/Status/index.tsx | 4 +-- src/views/device/Instance/Detail/index.vue | 3 +-- src/views/device/Instance/index.vue | 23 +++++++++++------ src/views/edge/Device/index.vue | 21 +++++++++++++--- .../Save/action/Device/device/Device.vue | 11 ++++---- .../Scene/Save/action/Notify/NotifyConfig.vue | 25 +++++++++++-------- .../Save/action/Notify/NotifyTemplate.vue | 24 ++++++++++-------- 8 files changed, 72 insertions(+), 41 deletions(-) diff --git a/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx index 06a8bf29..7b0f847c 100644 --- a/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx +++ b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx @@ -218,7 +218,7 @@ const ManualInspection = defineComponent({ if (data.type === 'device') { instanceStore.tabActiveKey = 'Info' } else if (data.type === 'product') { - menuStory.jumpPage('device/Product/Detail', { id: data.productId, tab: 'access' }); + menuStory.jumpPage('device/Product/Detail', { id: data.productId, tab: 'Device' }); } else { menuStory.jumpPage('link/AccessConfig/Detail', { id: data.configuration?.id }); } diff --git a/src/views/device/Instance/Detail/Diagnose/Status/index.tsx b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx index c81a20e6..aee75d84 100644 --- a/src/views/device/Instance/Detail/Diagnose/Status/index.tsx +++ b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx @@ -891,7 +891,7 @@ const Status = defineComponent({ name: `产品-${item?.name}`, desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败', data: { ...item }, - configuration, + configuration: _configuration, productId: unref(device).productId, }); }} @@ -1052,7 +1052,7 @@ const Status = defineComponent({ name: `设备-${item?.name}`, desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败', data: { ...item }, - configuration, + configuration: _configuration, productId: unref(device).productId, }); }} diff --git a/src/views/device/Instance/Detail/index.vue b/src/views/device/Instance/Detail/index.vue index b03f9e92..84a0344a 100644 --- a/src/views/device/Instance/Detail/index.vue +++ b/src/views/device/Instance/Detail/index.vue @@ -270,13 +270,12 @@ const getDetailFn = async () => { getStatus(String(_id)); list.value = [...initList]; getDetail(); - instanceStore.tabActiveKey = routerParams.params.value.tab || 'Info'; } + instanceStore.tabActiveKey = routerParams.params.value.tab || 'Info'; } onMounted(() => { getDetailFn() - instanceStore.tabActiveKey = routerParams.params.value.tab || 'Info'; }); const onBack = () => { diff --git a/src/views/device/Instance/index.vue b/src/views/device/Instance/index.vue index 081bc2a8..b1628251 100644 --- a/src/views/device/Instance/index.vue +++ b/src/views/device/Instance/index.vue @@ -325,6 +325,20 @@ const isCheck = ref(false); const routerParams = useRouterParams() const menuStory = useMenuStore(); +const transformData = (arr: any[]): any[] => { + if(Array.isArray(arr) && arr.length){ + return (arr || []).map((item: any) => { + return { + ...item, + id: `classifiedId is ${item.id}`, + children: transformData(item.children) + } + }) + } else { + return [] + } +} + const columns = [ { title: 'ID', @@ -398,10 +412,11 @@ const columns = [ hideInTable: true, search: { type: 'treeSelect', + rename: 'productId$product-info', options: () => new Promise((resolve) => { queryTree({ paging: false }).then((resp: any) => { - resolve(resp.result); + resolve(transformData(resp.result)); }); }), }, @@ -423,12 +438,6 @@ const columns = [ ...item, value: `accessProvider is ${item.id}` }))) - // resolve( - // resp.result.map((item: any) => ({ - // label: item.name, - // value: `accessProvider is ${item.id}`, - // })), - // ); }); }), }, diff --git a/src/views/edge/Device/index.vue b/src/views/edge/Device/index.vue index 116442f4..177bf623 100644 --- a/src/views/edge/Device/index.vue +++ b/src/views/edge/Device/index.vue @@ -191,6 +191,20 @@ const importVisible = ref(false); const visible = ref(false); const current = ref>({}); +const transformData = (arr: any[]): any[] => { + if(Array.isArray(arr) && arr.length){ + return (arr || []).map((item: any) => { + return { + ...item, + id: `classifiedId is ${item.id}`, + children: transformData(item.children) + } + }) + } else { + return [] + } +} + const columns = [ { title: 'ID', @@ -216,6 +230,7 @@ const columns = [ key: 'productName', search: { type: 'select', + rename: 'productId', options: () => new Promise((resolve) => { queryNoPagingPost({ paging: false }).then((resp: any) => { @@ -253,8 +268,8 @@ const columns = [ }, }, { - key: 'classifiedId', - dataIndex: 'classifiedId', + key: 'productId$product-info', + dataIndex: 'productId$product-info', title: '产品分类', hideInTable: true, search: { @@ -262,7 +277,7 @@ const columns = [ options: () => new Promise((resolve) => { queryTree({ paging: false }).then((resp: any) => { - resolve(resp.result); + resolve(transformData(resp.result)); }); }), }, diff --git a/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue b/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue index a4d72697..eeb7c287 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue @@ -171,11 +171,12 @@ const handleClick = (_detail: any) => { } }; -watch(() => props.value, async (newVal) => { - if(newVal[0]?.value){ - const { result } = await detail(newVal[0]?.value) - emit('update:value', [{ value: result?.id, name: result?.name }]); - emit('change', result); +watch(() => props.value?.[0]?.value, (newVal) => { + console.log(newVal, '123') + if(newVal){ + detail(newVal[0]?.value).then(resp => { + emit('change', resp.result); + }) } }, { deep: true, diff --git a/src/views/rule-engine/Scene/Save/action/Notify/NotifyConfig.vue b/src/views/rule-engine/Scene/Save/action/Notify/NotifyConfig.vue index 400070dc..b4126942 100644 --- a/src/views/rule-engine/Scene/Save/action/Notify/NotifyConfig.vue +++ b/src/views/rule-engine/Scene/Save/action/Notify/NotifyConfig.vue @@ -4,7 +4,7 @@ type="simple" target="action-notice-config" @search="handleSearch" - class="search" + class="action-search" />
{ }; const handleClick = (dt: any) => { - _selectedRowKeys.value = [dt.id]; - emit('update:value', dt.id); - emit('change', { provider: dt?.provider }); + if (_selectedRowKeys.value.includes(dt.id)) { + _selectedRowKeys.value = []; + emit('update:value', undefined); + emit('change', { provider: undefined }); + } else { + _selectedRowKeys.value = [dt.id]; + emit('update:value', dt.id); + emit('change', { provider: dt?.provider }); + } }; watch( @@ -176,11 +181,9 @@ watch( ); -