fix: 修改物模型导入BUG

This commit is contained in:
wangshuaiswim 2023-03-20 17:48:09 +08:00
parent 6485265e3d
commit d8bc599164
2 changed files with 4 additions and 4 deletions

View File

@ -116,14 +116,14 @@ const pagination = {
size: 'small',
} as TablePaginationConfig
const columns = computed(() => MetadataMapping.get(type)!.concat(actions))
const items = computed(() => JSON.parse((target === 'product' ? productStore.current?.metadata : instanceStore.current.metadata) || '{}') as MetadataItem[])
const items = computed(() => JSON.parse((target === 'product' ? productStore.current?.metadata : instanceStore.current.metadata) || '{}'))
const searchValue = ref<string>()
const handleSearch = (searchValue: string) => {
if (searchValue) {
const arr = items.value.filter(item => item.name!.indexOf(searchValue) > -1).sort((a, b) => b?.sortsIndex - a?.sortsIndex)
const arr = items.value[type].filter((item: MetadataItem) => item.name!.indexOf(searchValue) > -1).sort((a: MetadataItem, b: MetadataItem) => b?.sortsIndex - a?.sortsIndex)
data.value = arr
} else {
data.value = items.value
data.value = items.value[type]
}
}

View File

@ -40,7 +40,7 @@
</template>
</j-input>
</j-form-item>
<j-form-item v-bind="validateInfos.import" v-if="formModel.metadataType === 'script'">
<j-form-item v-bind="validateInfos.import" v-if="(type === 'device' || formModel.type === 'import') && formModel.metadataType === 'script'">
<template #label>
<j-space>
物模型