fix: 修复设备-物模型中展示其它配置
This commit is contained in:
parent
457a097ac3
commit
c669985f54
|
@ -202,3 +202,13 @@ export const getMetadataConfig = (params: {
|
|||
dataType: string;
|
||||
};
|
||||
}) => server.get<Record<any, any>[]>(`/device/product/${params.deviceId}/config-metadata/${params.metadata.type}/${params.metadata.id}/${params.metadata.dataType}`)
|
||||
|
||||
export const getMetadataDeviceConfig = (params: {
|
||||
deviceId: string;
|
||||
metadata: {
|
||||
type: MetadataType | 'property';
|
||||
id: string;
|
||||
dataType: string;
|
||||
};
|
||||
}) => server.get<Record<any, any>[]>(`/device/instance/${params.deviceId}/config-metadata/${params.metadata.type}/${params.metadata.id}/${params.metadata.dataType}`)
|
||||
|
||||
|
|
|
@ -64,7 +64,8 @@ import { PropType } from 'vue';
|
|||
import ExpandsForm from './ExpandsForm.vue';
|
||||
import ValueTypeForm from './ValueTypeForm.vue'
|
||||
import { useProductStore } from '@/store/product';
|
||||
import { getMetadataConfig } from '@/api/device/product'
|
||||
import { useInstanceStore } from'@/store/instance'
|
||||
import { getMetadataConfig, getMetadataDeviceConfig } from '@/api/device/product'
|
||||
import JsonParam from '@/components/Metadata/JsonParam/index.vue'
|
||||
import { EventLevel, ExpandsTypeList } from '@/views/device/data';
|
||||
import { useMetadataStore } from '@/store/metadata';
|
||||
|
@ -97,22 +98,24 @@ if (props.modelType === 'events' || props.modelType === 'tags') {
|
|||
}
|
||||
|
||||
const productStore = useProductStore()
|
||||
const deviceStore = useInstanceStore()
|
||||
|
||||
const config = ref<Record<any, any>[]>([])
|
||||
const asyncOtherConfig = debounce(async () => {
|
||||
if (props.type !== 'product') return
|
||||
|
||||
const { valueType, id } = props.value
|
||||
const { type } = valueType || {}
|
||||
const productId = productStore.current?.id
|
||||
const productId = props.type === 'product' ? productStore.current?.id : deviceStore.current.id
|
||||
if (!productId || !id || !type) return
|
||||
const resp = await getMetadataConfig({
|
||||
const params: any = {
|
||||
deviceId: productId,
|
||||
metadata: {
|
||||
id,
|
||||
type: 'property',
|
||||
dataType: type,
|
||||
},
|
||||
})
|
||||
}
|
||||
const resp = props.type === 'product' ? await getMetadataConfig(params) : await getMetadataDeviceConfig(params)
|
||||
if (resp.status === 200) {
|
||||
config.value = resp.result
|
||||
}
|
||||
|
|
|
@ -3823,10 +3823,10 @@ jetlinks-store@^0.0.3:
|
|||
resolved "https://registry.npmjs.org/jetlinks-store/-/jetlinks-store-0.0.3.tgz"
|
||||
integrity sha512-AZf/soh1hmmwjBZ00fr1emuMEydeReaI6IBTGByQYhTmK1Zd5pQAxC7WLek2snRAn/HHDgJfVz2hjditKThl6Q==
|
||||
|
||||
jetlinks-ui-components@^1.0.16:
|
||||
version "1.0.16"
|
||||
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.16.tgz#bdb65385a30a121065322e5156c13080c8328080"
|
||||
integrity sha512-R3oE8tpXW4oaNSCeGXRK++paNJiHYDO89Id3YqzIVX6/bWMItOWrEU6JT4iPA9uYkPTfsYHxnG5qZRloLnpiZw==
|
||||
jetlinks-ui-components@^1.0.18:
|
||||
version "1.0.20"
|
||||
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.20.tgz#ca8df39e35e99cf0e124029609a8fc25f7f97b24"
|
||||
integrity sha512-McGHwvkwEKrb1Bp9EZzpQN3YQe790fkO0Z03pGsil+bZrZ7xqiEywESZtW3MIIRWo/6u+zwNQr4L4/ohvXRCpA==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
|
|
Loading…
Reference in New Issue