parent
251c7b982b
commit
e3cc42c747
|
@ -125,8 +125,9 @@
|
|||
:id="data.record.id"
|
||||
:disabled="target === 'device' && productNoEdit.id?.includes?.(data.record.id)"
|
||||
:record="data.record"
|
||||
:type="data.record.valueType.type"
|
||||
:type="type === 'properties' ? data.record.valueType?.type : 'object'"
|
||||
:has-permission="`${permission}:update`"
|
||||
:medataType="type"
|
||||
:tooltip="target === 'device' && productNoEdit.id?.includes?.(data.record.id) ? {
|
||||
title: '继承自产品物模型的数据不支持删除',
|
||||
} : undefined"
|
||||
|
|
|
@ -277,6 +277,23 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
|||
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: '说明',
|
||||
dataIndex: 'description',
|
||||
|
@ -379,6 +396,23 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
|||
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: '说明',
|
||||
dataIndex: 'description',
|
||||
|
|
|
@ -131,6 +131,10 @@ const props = defineProps({
|
|||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
medataType: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
hasPermission: String,
|
||||
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 id =
|
||||
type === 'product' ? productStore.current?.id : deviceStore.current.id;
|
||||
console.log(props.id, id, props);
|
||||
|
||||
if (!props.id || !id || !props.type) return;
|
||||
|
||||
|
@ -212,7 +226,7 @@ const getConfig = async () => {
|
|||
deviceId: id,
|
||||
metadata: {
|
||||
id: props.id,
|
||||
type: 'property',
|
||||
type: getType(),
|
||||
dataType: props.type,
|
||||
},
|
||||
};
|
||||
|
@ -267,6 +281,7 @@ const confirm = () => {
|
|||
|
||||
const visibleChange = (e: boolean) => {
|
||||
visible.value = e;
|
||||
console.log('visibleChange',e)
|
||||
if (e) {
|
||||
configValue.value = omit(props.value, [
|
||||
'source',
|
||||
|
|
|
@ -135,7 +135,7 @@ const hideVirtualRule = (metadata: string) => {
|
|||
const _metadata = JSON.parse(metadata || '{}')
|
||||
if (_metadata.properties) {
|
||||
_metadata.properties = _metadata.properties.map((item: any) => {
|
||||
if (item.expands.virtualRule) {
|
||||
if (item.expands?.virtualRule) {
|
||||
item.expands = cloneDeep(omit(item.expands, ['virtualRule']))
|
||||
}
|
||||
return item
|
||||
|
@ -193,4 +193,4 @@ watch(() => metadata.value, () => {
|
|||
height: 670px;
|
||||
width: 650px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue