parent
251c7b982b
commit
e3cc42c747
|
@ -125,8 +125,9 @@
|
||||||
:id="data.record.id"
|
:id="data.record.id"
|
||||||
:disabled="target === 'device' && productNoEdit.id?.includes?.(data.record.id)"
|
:disabled="target === 'device' && productNoEdit.id?.includes?.(data.record.id)"
|
||||||
:record="data.record"
|
:record="data.record"
|
||||||
:type="data.record.valueType.type"
|
:type="type === 'properties' ? data.record.valueType?.type : 'object'"
|
||||||
:has-permission="`${permission}:update`"
|
:has-permission="`${permission}:update`"
|
||||||
|
:medataType="type"
|
||||||
:tooltip="target === 'device' && productNoEdit.id?.includes?.(data.record.id) ? {
|
:tooltip="target === 'device' && productNoEdit.id?.includes?.(data.record.id) ? {
|
||||||
title: '继承自产品物模型的数据不支持删除',
|
title: '继承自产品物模型的数据不支持删除',
|
||||||
} : undefined"
|
} : undefined"
|
||||||
|
|
|
@ -277,6 +277,23 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '其它配置',
|
||||||
|
dataIndex: 'other',
|
||||||
|
width: 100,
|
||||||
|
control(newValue, oldValue) {
|
||||||
|
if (!oldValue) {
|
||||||
|
return true
|
||||||
|
} else if (newValue && oldValue) {
|
||||||
|
// 仅留下存储和指标值
|
||||||
|
const keys = ['source', 'type', 'virtualRule', 'required']
|
||||||
|
const newObj = omit(cloneDeep(newValue.expands), keys)
|
||||||
|
const oldObj = omit(cloneDeep(oldValue.expands), keys)
|
||||||
|
return JSON.stringify(newObj) !== JSON.stringify(oldObj)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '说明',
|
title: '说明',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
|
@ -379,6 +396,23 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '其它配置',
|
||||||
|
dataIndex: 'other',
|
||||||
|
width: 100,
|
||||||
|
control(newValue, oldValue) {
|
||||||
|
if (!oldValue) {
|
||||||
|
return true
|
||||||
|
} else if (newValue && oldValue) {
|
||||||
|
// 仅留下存储和指标值
|
||||||
|
const keys = ['source', 'type', 'virtualRule', 'required']
|
||||||
|
const newObj = omit(cloneDeep(newValue.expands), keys)
|
||||||
|
const oldObj = omit(cloneDeep(oldValue.expands), keys)
|
||||||
|
return JSON.stringify(newObj) !== JSON.stringify(oldObj)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '说明',
|
title: '说明',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
|
|
|
@ -131,6 +131,10 @@ const props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
medataType: {
|
||||||
|
type: String,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
hasPermission: String,
|
hasPermission: String,
|
||||||
tooltip: Object,
|
tooltip: Object,
|
||||||
});
|
});
|
||||||
|
@ -189,10 +193,20 @@ const columns = ref([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const getType = () => {
|
||||||
|
const _typeMap = {
|
||||||
|
'propertys': 'property',
|
||||||
|
'functions': 'function',
|
||||||
|
'events': 'event',
|
||||||
|
'tags': 'tag',
|
||||||
|
}
|
||||||
|
|
||||||
|
return _typeMap[props.type] || 'property'
|
||||||
|
}
|
||||||
|
|
||||||
const getConfig = async () => {
|
const getConfig = async () => {
|
||||||
const id =
|
const id =
|
||||||
type === 'product' ? productStore.current?.id : deviceStore.current.id;
|
type === 'product' ? productStore.current?.id : deviceStore.current.id;
|
||||||
console.log(props.id, id, props);
|
|
||||||
|
|
||||||
if (!props.id || !id || !props.type) return;
|
if (!props.id || !id || !props.type) return;
|
||||||
|
|
||||||
|
@ -212,7 +226,7 @@ const getConfig = async () => {
|
||||||
deviceId: id,
|
deviceId: id,
|
||||||
metadata: {
|
metadata: {
|
||||||
id: props.id,
|
id: props.id,
|
||||||
type: 'property',
|
type: getType(),
|
||||||
dataType: props.type,
|
dataType: props.type,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -267,6 +281,7 @@ const confirm = () => {
|
||||||
|
|
||||||
const visibleChange = (e: boolean) => {
|
const visibleChange = (e: boolean) => {
|
||||||
visible.value = e;
|
visible.value = e;
|
||||||
|
console.log('visibleChange',e)
|
||||||
if (e) {
|
if (e) {
|
||||||
configValue.value = omit(props.value, [
|
configValue.value = omit(props.value, [
|
||||||
'source',
|
'source',
|
||||||
|
|
|
@ -135,7 +135,7 @@ const hideVirtualRule = (metadata: string) => {
|
||||||
const _metadata = JSON.parse(metadata || '{}')
|
const _metadata = JSON.parse(metadata || '{}')
|
||||||
if (_metadata.properties) {
|
if (_metadata.properties) {
|
||||||
_metadata.properties = _metadata.properties.map((item: any) => {
|
_metadata.properties = _metadata.properties.map((item: any) => {
|
||||||
if (item.expands.virtualRule) {
|
if (item.expands?.virtualRule) {
|
||||||
item.expands = cloneDeep(omit(item.expands, ['virtualRule']))
|
item.expands = cloneDeep(omit(item.expands, ['virtualRule']))
|
||||||
}
|
}
|
||||||
return item
|
return item
|
||||||
|
@ -193,4 +193,4 @@ watch(() => metadata.value, () => {
|
||||||
height: 670px;
|
height: 670px;
|
||||||
width: 650px;
|
width: 650px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue