From ad14ce0242268a01d0ffdb89a7ddd0af75fd5af0 Mon Sep 17 00:00:00 2001 From: wangshuaiswim Date: Fri, 31 Mar 2023 16:06:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=89=A9=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=AF=BC=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Metadata/Base/Edit/ValueTypeForm.vue | 6 +++++ .../components/Metadata/Import/index.vue | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/views/device/components/Metadata/Base/Edit/ValueTypeForm.vue b/src/views/device/components/Metadata/Base/Edit/ValueTypeForm.vue index e8554b20..7f171f06 100644 --- a/src/views/device/components/Metadata/Base/Edit/ValueTypeForm.vue +++ b/src/views/device/components/Metadata/Base/Edit/ValueTypeForm.vue @@ -13,6 +13,9 @@ + + + @@ -159,6 +162,9 @@ const changeType = (val: SelectValue) => { if (['file'].includes(val as string)) { _value.value.fileType = _value.value.fileType || 'url' } + if (['date'].includes(val as string)) { + _value.value.format = _value.value.format || 'yyyy-MM-DD HH:mm:ss' + } emit('changeType', val as string) } diff --git a/src/views/device/components/Metadata/Import/index.vue b/src/views/device/components/Metadata/Import/index.vue index 99442a6f..f7cec186 100644 --- a/src/views/device/components/Metadata/Import/index.vue +++ b/src/views/device/components/Metadata/Import/index.vue @@ -49,7 +49,7 @@ - + @@ -206,14 +206,14 @@ const handleImport = async () => { loading.value = true const { id } = route.params || {} if (data.metadata === 'alink') { - const res = await convertMetadata('from', 'alink', data.import).catch(err => err) + const res = await convertMetadata('from', 'alink', JSON.parse(data.import)).catch(err => err) if (res.status === 200) { const metadata = operateLimits(res.result) let result; if (props?.type === 'device') { result = await saveMetadata(id as string, metadata).catch(err => err) } else { - result = await modify(id as string, { metadata: metadata }).catch(err => err) + result = await modify(id as string, { id, metadata: JSON.stringify(metadata) }).catch(err => err) } if (result.success) { message.success('导入成功') @@ -224,10 +224,11 @@ const handleImport = async () => { // message.error('物模型数据不正确!') return } + let resp if (props?.type === 'device') { - instanceStore.refresh(id as string) + await instanceStore.refresh(id as string) } else { - productStore.refresh(id as string) + await productStore.refresh(id as string) } metadataStore.set('importMetadata', true) // Store.set(SystemConst.GET_METADATA, true) @@ -258,21 +259,21 @@ const handleImport = async () => { loading.value = false if (resp.success) { if (props?.type === 'device') { - const detail = instanceStore.current - detail.metadata = JSON.stringify(paramsDevice) - instanceStore.setCurrent(detail) + // const detail = instanceStore.current + // detail.metadata = JSON.stringify(paramsDevice) + // instanceStore.setCurrent(detail) message.success('导入成功') } else { - const detail = productStore.current - detail.metadata = params.metadata - productStore.setCurrent(detail) + // const detail = productStore.current + // detail.metadata = params.metadata + // productStore.setCurrent(detail) message.success('导入成功') } } if (props?.type === 'device') { - instanceStore.refresh(id as string) + await instanceStore.refresh(id as string) } else { - productStore.refresh(id as string) + await productStore.refresh(id as string) } metadataStore.set('importMetadata', true) // Store.set(SystemConst.GET_METADATA, true)