fix: bug#17005、17056
* fix: 登录加密 * fix: 登录加密功能 * fix: 树样式错乱bug修改 * fix: bug#17059 * fix: bug#17128 * fix: 17131 * fix: bug#17122 * fix: bug#17156 * fix: 修改bug * fix: bug#17056 * fix: bug#17005 * fix: 修改bug
This commit is contained in:
parent
f41a209cd5
commit
c2d30f56a7
|
@ -8,10 +8,13 @@
|
||||||
<template #bodyCell="{ column, text, record, index }">
|
<template #bodyCell="{ column, text, record, index }">
|
||||||
<div>
|
<div>
|
||||||
<template
|
<template
|
||||||
v-if="['valueType', 'name'].includes(column.dataIndex)"
|
v-if="['name'].includes(column.dataIndex)"
|
||||||
>
|
>
|
||||||
<span>{{ text }}</span>
|
<span>{{ text }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="['valueType'].includes(column.dataIndex)">
|
||||||
|
<span>{{ text.type }}</span>
|
||||||
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<j-form-item
|
<j-form-item
|
||||||
:name="['dataSource', index, 'value']"
|
:name="['dataSource', index, 'value']"
|
||||||
|
@ -24,19 +27,19 @@
|
||||||
>
|
>
|
||||||
<ValueItem
|
<ValueItem
|
||||||
v-model:modelValue="record.value"
|
v-model:modelValue="record.value"
|
||||||
:itemType="record.type"
|
:itemType="record.valueType.type"
|
||||||
|
|
||||||
:options="
|
:options="
|
||||||
record.type === 'enum'
|
record.valueType.type === 'enum'
|
||||||
? (
|
? (
|
||||||
record?.dataType?.elements || []
|
record?.valueType?.elements || []
|
||||||
).map((item) => {
|
).map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.text,
|
label: item.text,
|
||||||
value: item.value,
|
value: item.value,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
: record.type === 'boolean'
|
: record.valueType.type === 'boolean'
|
||||||
? [
|
? [
|
||||||
{ label: '是', value: true },
|
{ label: '是', value: true },
|
||||||
{ label: '否', value: false },
|
{ label: '否', value: false },
|
||||||
|
@ -94,6 +97,7 @@ const formRef = ref<any>(null);
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
modelRef.dataSource = _props?.modelValue || []
|
modelRef.dataSource = _props?.modelValue || []
|
||||||
|
console.log(modelRef.dataSource);
|
||||||
})
|
})
|
||||||
|
|
||||||
const onSave = () =>
|
const onSave = () =>
|
||||||
|
|
|
@ -170,7 +170,7 @@ const funcChange = (val: string) => {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
value: undefined,
|
value: undefined,
|
||||||
valueType: item?.valueType?.type,
|
valueType: item?.valueType,
|
||||||
required: item?.expands?.required,
|
required: item?.expands?.required,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,7 +56,17 @@
|
||||||
{{ TypeStringMap[data.record.valueType?.type] }}
|
{{ TypeStringMap[data.record.valueType?.type] }}
|
||||||
</template>
|
</template>
|
||||||
<template #inputs="{ data }">
|
<template #inputs="{ data }">
|
||||||
<InputParams v-model:value="data.record.inputs" />
|
<j-tooltip
|
||||||
|
v-if="target === 'device' && productNoEdit.id?.includes?.(data.record.id)"
|
||||||
|
title="继承自产品物模型的数据不支持修改"
|
||||||
|
>
|
||||||
|
<!-- <ModelButton :disabled="true"/>-->
|
||||||
|
<j-button :disabled="true" type="link" style="padding-left: 0;">
|
||||||
|
<AIcon type="SettingOutlined" />
|
||||||
|
配置
|
||||||
|
</j-button>
|
||||||
|
</j-tooltip>
|
||||||
|
<InputParams v-else v-model:value="data.record.inputs" />
|
||||||
</template>
|
</template>
|
||||||
<template #output="{ data }">
|
<template #output="{ data }">
|
||||||
{{ data.record.output?.type }}
|
{{ data.record.output?.type }}
|
||||||
|
@ -71,7 +81,17 @@
|
||||||
{{ data.record.id && !data.record?.expands?.source ? '设备' : sourceMap?.[data.record?.expands?.source] || '' }}
|
{{ data.record.id && !data.record?.expands?.source ? '设备' : sourceMap?.[data.record?.expands?.source] || '' }}
|
||||||
</template>
|
</template>
|
||||||
<template #properties="{ data }">
|
<template #properties="{ data }">
|
||||||
<ConfigParams v-model:value="data.record.valueType" />
|
<j-tooltip
|
||||||
|
v-if="target === 'device' && productNoEdit.id?.includes?.(data.record.id)"
|
||||||
|
title="继承自产品物模型的数据不支持修改"
|
||||||
|
>
|
||||||
|
<!-- <ModelButton :disabled="true"/>-->
|
||||||
|
<j-button :disabled="true" type="link" style="padding-left: 0;">
|
||||||
|
<AIcon type="SettingOutlined" />
|
||||||
|
配置
|
||||||
|
</j-button>
|
||||||
|
</j-tooltip>
|
||||||
|
<ConfigParams v-else v-model:value="data.record.valueType" />
|
||||||
</template>
|
</template>
|
||||||
<template #outInput>
|
<template #outInput>
|
||||||
object
|
object
|
||||||
|
|
|
@ -198,6 +198,12 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
||||||
},
|
},
|
||||||
{ max: 64, message: '最多可输入64个字符' },
|
{ max: 64, message: '最多可输入64个字符' },
|
||||||
]
|
]
|
||||||
|
// rules:[{
|
||||||
|
// callback(rule:any,value: any, dataSource: any[]) {
|
||||||
|
// console.log(rule,value,dataSource,123)
|
||||||
|
// return value
|
||||||
|
// }
|
||||||
|
// }]
|
||||||
},
|
},
|
||||||
doubleClick(record) {
|
doubleClick(record) {
|
||||||
if (isExtendsProduct(record.id, productNoEdit?.value, 'name')) {
|
if (isExtendsProduct(record.id, productNoEdit?.value, 'name')) {
|
||||||
|
@ -343,9 +349,8 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
||||||
callback(rule:any,value: any, dataSource: any[]) {
|
callback(rule:any,value: any, dataSource: any[]) {
|
||||||
const field = rule.field.split('.')
|
const field = rule.field.split('.')
|
||||||
const fieldIndex = Number(field[1])
|
const fieldIndex = Number(field[1])
|
||||||
|
|
||||||
const values = dataSource.find((item, index) => index === fieldIndex)
|
const values = dataSource.find((item, index) => index === fieldIndex)
|
||||||
return validatorConfig(values.output)
|
return validatorConfig(values?.output)
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
v-if="type === 'array'"
|
v-if="type === 'array'"
|
||||||
v-model:value="_valueType.elementType"
|
v-model:value="_valueType.elementType"
|
||||||
:unitOptions="unitOptions"
|
:unitOptions="unitOptions"
|
||||||
placement="topRight"
|
placement="bottomRight"
|
||||||
@confirm="(data) => {valueChange(data, 'array')}"
|
@confirm="(data) => {valueChange(data, 'array')}"
|
||||||
/>
|
/>
|
||||||
<DataTableObject
|
<DataTableObject
|
||||||
v-else-if="type === 'object'"
|
v-else-if="type === 'object'"
|
||||||
:value="_valueType.properties"
|
:value="_valueType.properties"
|
||||||
placement="topRight"
|
placement="bottomRight"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
@confirm="(data) => {valueChange(data, 'object')}"
|
@confirm="(data) => {valueChange(data, 'object')}"
|
||||||
>
|
>
|
||||||
|
@ -25,28 +25,28 @@
|
||||||
<ConfigModal v-model:value="data.record.valueType" :showOther="false" />
|
<ConfigModal v-model:value="data.record.valueType" :showOther="false" />
|
||||||
</template>
|
</template>
|
||||||
</DataTableObject>
|
</DataTableObject>
|
||||||
<DataTableEnum v-else-if="type === 'enum'" v-model:value="_valueType" placement="topRight" @confirm="(data) => {valueChange(data, 'enum')}"/>
|
<DataTableEnum v-else-if="type === 'enum'" v-model:value="_valueType" placement="bottomRight" @confirm="(data) => {valueChange(data, 'enum')}"/>
|
||||||
<DataTableBoolean v-else-if="type === 'boolean'" v-model:value="_valueType" placement="topRight" @confirm="(data) => {valueChange(data, 'boolean')}" />
|
<DataTableBoolean v-else-if="type === 'boolean'" v-model:value="_valueType" placement="bottomRight" @confirm="(data) => {valueChange(data, 'boolean')}" />
|
||||||
<DataTableDouble
|
<DataTableDouble
|
||||||
v-else-if="['float', 'double'].includes(type)"
|
v-else-if="['float', 'double'].includes(type)"
|
||||||
:options="unitOptions"
|
:options="unitOptions"
|
||||||
v-model:value="_valueType"
|
v-model:value="_valueType"
|
||||||
placement="topRight"
|
placement="bottomRight"
|
||||||
@confirm="(data) => {valueChange(data, 'float')}"
|
@confirm="(data) => {valueChange(data, 'float')}"
|
||||||
/>
|
/>
|
||||||
<DataTableInteger
|
<DataTableInteger
|
||||||
v-else-if="['int', 'long'].includes(type)"
|
v-else-if="['int', 'long'].includes(type)"
|
||||||
:options="unitOptions"
|
:options="unitOptions"
|
||||||
v-model:value="_valueType.unit"
|
v-model:value="_valueType.unit"
|
||||||
placement="topRight"
|
placement="bottomRight"
|
||||||
@confirm="(data) => {valueChange(data, 'int')}"
|
@confirm="(data) => {valueChange(data, 'int')}"
|
||||||
/>
|
/>
|
||||||
<DataTableFile v-else-if="type === 'file'" v-model:value="_valueType.fileType" placement="topRight" @confirm="(data) => {valueChange(data, 'file')}"/>
|
<DataTableFile v-else-if="type === 'file'" v-model:value="_valueType.fileType" placement="bottomRight" @confirm="(data) => {valueChange(data, 'file')}"/>
|
||||||
<DataTableDate v-else-if="type === 'date'" v-model:value="_valueType.format" placement="topRight" @confirm="(data) => {valueChange(data, 'date')}"/>
|
<DataTableDate v-else-if="type === 'date'" v-model:value="_valueType.format" placement="bottomRight" @confirm="(data) => {valueChange(data, 'date')}"/>
|
||||||
<DataTableString
|
<DataTableString
|
||||||
v-else-if="['string', 'password'].includes(type)"
|
v-else-if="['string', 'password'].includes(type)"
|
||||||
v-model:value="_valueType.maxLength"
|
v-model:value="_valueType.maxLength"
|
||||||
placement="topRight"
|
placement="bottomRight"
|
||||||
@confirm="(data) => {valueChange(data, 'string')}"
|
@confirm="(data) => {valueChange(data, 'string')}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<DataTableObject v-model:value="value" :columns="columns" @confirm="confirm">
|
<DataTableObject v-model:value="value" :columns="columns" @confirm="confirm" placement="bottomRight">
|
||||||
<template #valueType="{ data }">
|
<template #valueType="{ data }">
|
||||||
<span>{{ TypeStringMap[data.record.valueType?.type] }}</span>
|
<span>{{ TypeStringMap[data.record.valueType?.type] }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<DataTableObject :value="value" :columns="columns" :onAdd="addItem" width="700px" @confirm="confirm">
|
<DataTableObject :value="value" :columns="columns" :onAdd="addItem" width="700px" @confirm="confirm" placement="bottomRight">
|
||||||
<template #valueType="{ data }">
|
<template #valueType="{ data }">
|
||||||
<span>{{ TypeStringMap[data.record.valueType?.type] }}</span>
|
<span>{{ TypeStringMap[data.record.valueType?.type] }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -5,13 +5,14 @@
|
||||||
</div>
|
</div>
|
||||||
<DataTableArray
|
<DataTableArray
|
||||||
v-if="type === 'array'"
|
v-if="type === 'array'"
|
||||||
|
placement="bottomRight"
|
||||||
v-model:value="data.elementType"
|
v-model:value="data.elementType"
|
||||||
@confirm="valueChange"
|
@confirm="valueChange"
|
||||||
/>
|
/>
|
||||||
<DataTableObject
|
<DataTableObject
|
||||||
v-else-if="type === 'object'"
|
v-else-if="type === 'object'"
|
||||||
v-model:value="data.properties"
|
v-model:value="data.properties"
|
||||||
placement="topRight"
|
placement="bottomRight"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
@confirm="valueChange"
|
@confirm="valueChange"
|
||||||
:onAdd="addItem"
|
:onAdd="addItem"
|
||||||
|
@ -23,24 +24,27 @@
|
||||||
<ConfigModal v-model:value="data.record.valueType" :showOther="false"/>
|
<ConfigModal v-model:value="data.record.valueType" :showOther="false"/>
|
||||||
</template>
|
</template>
|
||||||
</DataTableObject>
|
</DataTableObject>
|
||||||
<DataTableEnum v-else-if="type === 'enum'" v-model:value="data" @confirm="valueChange"/>
|
<DataTableEnum v-else-if="type === 'enum'" placement="bottomRight" v-model:value="data" @confirm="valueChange"/>
|
||||||
<DataTableBoolean v-else-if="type === 'boolean'" v-model:value="data" @confirm="valueChange"/>
|
<DataTableBoolean v-else-if="type === 'boolean'" placement="bottomRight" v-model:value="data" @confirm="valueChange"/>
|
||||||
<DataTableDouble
|
<DataTableDouble
|
||||||
v-else-if="['float', 'double'].includes(type)"
|
v-else-if="['float', 'double'].includes(type)"
|
||||||
|
placement="bottomRight"
|
||||||
:options="unitOptions"
|
:options="unitOptions"
|
||||||
v-model:value="data"
|
v-model:value="data"
|
||||||
@confirm="valueChange"
|
@confirm="valueChange"
|
||||||
/>
|
/>
|
||||||
<DataTableInteger
|
<DataTableInteger
|
||||||
|
placement="bottomRight"
|
||||||
v-else-if="['int', 'long'].includes(type)"
|
v-else-if="['int', 'long'].includes(type)"
|
||||||
:options="unitOptions"
|
:options="unitOptions"
|
||||||
v-model:value="data.unit"
|
v-model:value="data.unit"
|
||||||
@confirm="valueChange"
|
@confirm="valueChange"
|
||||||
/>
|
/>
|
||||||
<DataTableFile v-else-if="type === 'file'" v-model:value="data.fileType" @confirm="valueChange"/>
|
<DataTableFile v-else-if="type === 'file'" placement="bottomRight" v-model:value="data.fileType" @confirm="valueChange"/>
|
||||||
<DataTableDate v-else-if="type === 'date'" v-model:value="data.date" @confirm="valueChange"/>
|
<DataTableDate v-else-if="type === 'date'" placement="bottomRight" v-model:value="data.date" @confirm="valueChange"/>
|
||||||
<DataTableString
|
<DataTableString
|
||||||
v-else-if="['string', 'password'].includes(type)"
|
v-else-if="['string', 'password'].includes(type)"
|
||||||
|
placement="bottomRight"
|
||||||
v-model:value="data.maxLength"
|
v-model:value="data.maxLength"
|
||||||
@confirm="valueChange"
|
@confirm="valueChange"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<j-popconfirm-modal
|
<j-popconfirm-modal
|
||||||
body-style="padding-top:4px;width:600px;"
|
body-style="padding-top:4px;width:600px;"
|
||||||
placement="topRight"
|
placement="bottomRight"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:get-popup-container="(node) => fullRef || node"
|
:get-popup-container="(node) => fullRef || node"
|
||||||
@confirm="confirm"
|
@confirm="confirm"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
height: myValue === 'rule' ? '300px' : '80px',
|
height: myValue === 'rule' ? '300px' : '80px',
|
||||||
}"
|
}"
|
||||||
:get-popup-container="(node) => fullRef || node"
|
:get-popup-container="(node) => fullRef || node"
|
||||||
placement="topLeft"
|
placement="bottomRight"
|
||||||
@confirm="confirm"
|
@confirm="confirm"
|
||||||
@visibleChange="visibleChange"
|
@visibleChange="visibleChange"
|
||||||
>
|
>
|
||||||
|
@ -115,8 +115,9 @@ const disabled = computed(() => {
|
||||||
// if (props.target === 'device') {
|
// if (props.target === 'device') {
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return props.noEdit?.length
|
return props.noEdit?.length
|
||||||
? props.noEdit.includes(props.value._sortIndex)
|
? props.noEdit.includes(props.value.id) && props?.target === 'device'
|
||||||
: false;
|
: false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -257,14 +257,265 @@ const loadData = async () => {
|
||||||
};
|
};
|
||||||
loadData();
|
loadData();
|
||||||
|
|
||||||
|
// const propertiesSet = new Set(['id','name','expands','valueType']);
|
||||||
|
|
||||||
|
// const handleMadeDataNull = (data:any) =>{
|
||||||
|
// return data?.properties?.some?.((item:any,index:number)=>{
|
||||||
|
// if(!item?.id){
|
||||||
|
// onlyMessage(`属性定义第${index + 1}个数组中缺失id属性`,'error');
|
||||||
|
// return true
|
||||||
|
// }
|
||||||
|
// if(!item?.name){
|
||||||
|
// onlyMessage(`属性定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// if(!item?.expands?.source){
|
||||||
|
// onlyMessage(`属性定义第${index + 1}个数组中缺失expands.source属性`,'error');
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if((item?.expands?.source === 'device' || item?.expands?.source === 'rule') && !item?.expands?.type){
|
||||||
|
// onlyMessage(`属性定义第${index + 1}个数组中缺失type属性`,'error');
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }) || false
|
||||||
|
// }
|
||||||
|
const requiredCheck = (data:any) =>{
|
||||||
|
let check:boolean = false;
|
||||||
|
if(data?.properties && !check){
|
||||||
|
data.properties.some((item:any,index:number)=>{
|
||||||
|
if(!item?.id){
|
||||||
|
onlyMessage(`属性定义第${index + 1}个数组中缺失id属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.name){
|
||||||
|
onlyMessage(`属性定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.valueType?.type){
|
||||||
|
onlyMessage(`标签定义第${index + 1}个数组中缺失valueType.type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.expands?.source){
|
||||||
|
onlyMessage(`属性定义第${index + 1}个数组中缺失expands.source属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if((item?.expands?.source === 'device' || item?.expands?.source === 'rule') && !item?.expands?.type){
|
||||||
|
onlyMessage(`属性定义第${index + 1}个数组中缺失type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(data?.functions && !check){
|
||||||
|
data?.functions.forEach((item:any,index:number)=>{
|
||||||
|
if(!item?.id){
|
||||||
|
onlyMessage(`方法定义第${index + 1}个数组中缺失id属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.name){
|
||||||
|
onlyMessage(`方法定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.async && item?.async !== false){
|
||||||
|
onlyMessage(`方法定义第${index + 1}个数组中缺失async属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(data?.events && !check){
|
||||||
|
data?.events.forEach((item:any,index:number)=>{
|
||||||
|
if(!item?.id){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失id属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.name){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.async && item?.async !== false){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失async属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.valueType?.type){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.expands?.level){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失expands.level属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!check){
|
||||||
|
if(item?.valueType?.properties){
|
||||||
|
item?.valueType?.properties.forEach((i:any,number:number)=>{
|
||||||
|
if(!i?.id){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组第${number+1}项的id属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!i?.name){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组第${number+1}项的name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!i?.valueType?.type){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组第${number+1}项的valueType.type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(data?.tags && !check){
|
||||||
|
data?.tags.forEach((item:any,index:number)=>{
|
||||||
|
if(!item?.id){
|
||||||
|
onlyMessage(`标签定义第${index + 1}个数组中缺失id属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.name){
|
||||||
|
onlyMessage(`标签定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.valueType?.type){
|
||||||
|
onlyMessage(`标签定义第${index + 1}个数组中缺失valueType.type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.expands?.type){
|
||||||
|
onlyMessage(`标签定义第${index + 1}个数组中缺失expands.type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return check
|
||||||
|
}
|
||||||
|
|
||||||
|
const aliCheck = (data:any) => {
|
||||||
|
let check:boolean = false;
|
||||||
|
if(data?.properties && !check){
|
||||||
|
data.properties.some((item:any,index:number)=>{
|
||||||
|
if(!item?.identifier){
|
||||||
|
onlyMessage(`属性定义第${index + 1}个数组中缺失identifier属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.name){
|
||||||
|
onlyMessage(`属性定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.dataType?.type){
|
||||||
|
onlyMessage(`属性定义第${index + 1}个数组中缺失dataType.type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(data?.functions && !check){
|
||||||
|
data?.functions.forEach((item:any,index:number)=>{
|
||||||
|
if(!item?.identifier){
|
||||||
|
onlyMessage(`方法定义第${index + 1}个数组中缺失identifier属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.name){
|
||||||
|
onlyMessage(`方法定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.callType){
|
||||||
|
onlyMessage(`方法定义第${index + 1}个数组中缺失callType属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(data?.events && !check){
|
||||||
|
data?.events.forEach((item:any,index:number)=>{
|
||||||
|
if(!item?.identifier){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失identifier属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.name){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!item?.type){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!check){
|
||||||
|
if(item?.outputData){
|
||||||
|
item?.outputData?.forEach((i:any,number:number)=>{
|
||||||
|
if(!i?.identifier){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的id属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!i?.name){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的name属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!i?.dataType?.type){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的dataType.type属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(!i?.dataType?.specs){
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的dataType.specs属性`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组`,'error');
|
||||||
|
check = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return check
|
||||||
|
}
|
||||||
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
||||||
if(file.type === 'application/json') {
|
if(file.type === 'application/json') {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
reader.onload = (json) => {
|
reader.onload = (json) => {
|
||||||
if(json.target?.result){
|
if(json.target?.result){
|
||||||
onlyMessage('操作成功!')
|
const data = JSON.parse(json.target?.result);
|
||||||
formModel.import = json.target?.result;
|
|
||||||
|
let check = formModel.metadata === 'jetlinks' ? requiredCheck(data) : aliCheck(data)
|
||||||
|
if(!check){
|
||||||
|
onlyMessage('操作成功!')
|
||||||
|
formModel.import = json.target?.result;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
onlyMessage('文件内容不能为空', 'error')
|
onlyMessage('文件内容不能为空', 'error')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class='device-detail-metadata' style="position: relative;">
|
<div class='device-detail-metadata' style="position: relative;">
|
||||||
<!-- <div class="tips">-->
|
<!-- <div class="tips">-->
|
||||||
<!-- <j-tooltip :title="instanceStore.detail?.independentMetadata && type === 'device'-->
|
<!-- <j-tooltip :title="instanceStore.detail?.independentMetadata && type === 'device'-->
|
||||||
<!-- ? '该设备已脱离产品物模型,修改产品物模型对该设备无影响'-->
|
<!-- ? '该设备已脱离产品物模型,修改产品物模型对该设备无影响'-->
|
||||||
<!-- : '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'">-->
|
<!-- : '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'">-->
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
<!-- : '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'-->
|
<!-- : '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'-->
|
||||||
<!-- }}-->
|
<!-- }}-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </j-tooltip>-->
|
<!-- </j-tooltip> -->
|
||||||
<!-- </div>-->
|
<!-- </div> -->
|
||||||
<j-tabs class="metadataNav" :activeKey="tabActiveKey" destroyInactiveTabPane type="card" @change="tabsChange">
|
<j-tabs class="metadataNav" :activeKey="tabActiveKey" destroyInactiveTabPane type="card" @change="tabsChange">
|
||||||
<template #rightExtra>
|
<template #rightExtra>
|
||||||
<j-space>
|
<j-space>
|
||||||
|
@ -30,7 +30,9 @@
|
||||||
<PermissionButton :hasPermission="`${permission}:update`" @click="cat = true" key="tsl">物模型TSL</PermissionButton>
|
<PermissionButton :hasPermission="`${permission}:update`" @click="cat = true" key="tsl">物模型TSL</PermissionButton>
|
||||||
</j-space>
|
</j-space>
|
||||||
</template>
|
</template>
|
||||||
|
<template #centerExtra>
|
||||||
|
<span class="desc">设备会默认继承产品的物模型,继承的物模型不支持删改</span>
|
||||||
|
</template>
|
||||||
<j-tab-pane tab="属性定义" key="properties">
|
<j-tab-pane tab="属性定义" key="properties">
|
||||||
<BaseMetadata :target="type" type="properties" :permission="permission" />
|
<BaseMetadata :target="type" type="properties" :permission="permission" />
|
||||||
</j-tab-pane>
|
</j-tab-pane>
|
||||||
|
@ -79,7 +81,7 @@ provide('_metadataType', props.type)
|
||||||
|
|
||||||
const showReset = computed(() => {
|
const showReset = computed(() => {
|
||||||
if (props.type === 'device' && instanceStore.current.productMetadata) {
|
if (props.type === 'device' && instanceStore.current.productMetadata) {
|
||||||
console.log(instanceStore.current)
|
console.log(instanceStore.current,123)
|
||||||
const proMetadata = JSON.parse(instanceStore.current.productMetadata || '{}')
|
const proMetadata = JSON.parse(instanceStore.current.productMetadata || '{}')
|
||||||
const _metadata = JSON.parse(instanceStore.current.metadata || '{}')
|
const _metadata = JSON.parse(instanceStore.current.metadata || '{}')
|
||||||
return !isEqual(_metadata, proMetadata)
|
return !isEqual(_metadata, proMetadata)
|
||||||
|
@ -128,5 +130,12 @@ const tabsChange = (e: string) => {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.desc{
|
||||||
|
font-size: 13px;
|
||||||
|
color: rgba(0,0,0,.8);
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 12px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -64,7 +64,7 @@ const filterMenu = (permissions: string[], menus: any[], hasProtocol: boolean) =
|
||||||
return menus.filter((item) => {
|
return menus.filter((item) => {
|
||||||
let isShow = false;
|
let isShow = false;
|
||||||
if (item.showPage && item.showPage.length) {
|
if (item.showPage && item.showPage.length) {
|
||||||
isShow = item.showPage.every((pItem: any) => {
|
isShow = item.showPage.some((pItem: any) => {
|
||||||
return permissions.includes(pItem);
|
return permissions.includes(pItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,11 +50,11 @@
|
||||||
<AIcon type="EditOutlined" />
|
<AIcon type="EditOutlined" />
|
||||||
</j-button>
|
</j-button>
|
||||||
</j-tooltip>
|
</j-tooltip>
|
||||||
|
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
type="link"
|
type="link"
|
||||||
:hasPermission="`${permission}:add`"
|
:hasPermission="`${permission}:add`"
|
||||||
:tooltip="{ title: '新增子菜单' }"
|
:tooltip="{ title: '新增子菜单' }"
|
||||||
|
:disabled="slotProps.level >= 3"
|
||||||
@click="table.addChildren(slotProps)"
|
@click="table.addChildren(slotProps)"
|
||||||
>
|
>
|
||||||
<AIcon type="PlusCircleOutlined" />
|
<AIcon type="PlusCircleOutlined" />
|
||||||
|
|
Loading…
Reference in New Issue