fix: 兼容物模型映射

This commit is contained in:
XieYongHong 2023-07-19 11:19:34 +08:00
parent e3ef99cbe1
commit 1d238367be
3 changed files with 10 additions and 25 deletions

View File

@ -51,9 +51,6 @@
<template #valueType="{ data }">
{{ TypeStringMap[data.record.valueType?.type] }}
</template>
<template #expands="{ data }">
{{ sourceMap?.[data.record?.expands?.source] || '' }}
</template>
<template #inputs="{ data }">
<InputParams v-model:value="data.record.inputs" />
</template>
@ -66,6 +63,9 @@
<template #expands="{ data }" v-if="type === 'events'">
{{ levelMap?.[data.record.expands?.level] || '-' }}
</template>
<template v-else-if="type === 'properties'" #expands="{ data }">
{{ data.record.id && !data.record?.expands?.source ? '设备' : sourceMap?.[data.record?.expands?.source] || '' }}
</template>
<template #properties="{ data }">
<ConfigParams v-model:value="data.record.valueType" />
</template>
@ -80,7 +80,7 @@
<template #other="{ data }">
<j-tooltip
v-if="target === 'device' && productNoEdit.id?.includes?.(data.record._sortIndex)"
title="继承自产品物模型的数据不支持删除"
title="继承自产品物模型的数据不支持修改"
>
<!-- <ModelButton :disabled="true"/>-->
<j-button :disabled="true" type="link" style="padding-left: 0;">

View File

@ -416,7 +416,7 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
name: Source,
props: {
noEdit: noEdit?.value?.source || [],
target: target
target: target,
}
},
doubleClick(record){
@ -434,7 +434,6 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
rules: target !== 'device' ? [
{
callback: async (rule: any, value: any, dataSource: any[]) => {
console.log('value', value)
const field = rule.field.split('.')
const fieldIndex = Number(field[1])
@ -455,24 +454,6 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
return Promise.reject('请选择属性来源');
}
// if (value.source) {
// if(value.source !== 'rule') {
// if(value.type?.length) {
// return Promise.resolve();
// } else {
// return Promise.reject('请选择读写类型');
// }
// } else {
// if(value.virtualRule?.script) {
// return Promise.resolve();
// }else {
// return Promise.reject('请配置规则');
// }
// }
// } else {
// return Promise.reject('请选择属性来源');
// }
// }
},
]: []
},

View File

@ -28,7 +28,7 @@
</div>
</j-scrollbar>
</template>
<j-button :disabled="!myValue" type="link" style="padding: 4px 8px">
<j-button style="padding: 4px 8px" type="link">
<AIcon type="EditOutlined" />
</j-button>
</j-popconfirm-modal>
@ -146,7 +146,11 @@ const confirm = async () => {
watch(
() => props.value,
() => {
if (props.value.id && !props.value?.expands?.source) {
myValue.value = 'device';
} else {
myValue.value = props.value?.expands?.source || '';
}
type.value = props.value?.expands?.type || [];
},
{ immediate: true },