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:
qiaochuLei 2023-08-11 09:36:00 +08:00 committed by GitHub
parent f41a209cd5
commit c2d30f56a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 332 additions and 38 deletions

View File

@ -8,10 +8,13 @@
<template #bodyCell="{ column, text, record, index }">
<div>
<template
v-if="['valueType', 'name'].includes(column.dataIndex)"
v-if="['name'].includes(column.dataIndex)"
>
<span>{{ text }}</span>
</template>
<template v-else-if="['valueType'].includes(column.dataIndex)">
<span>{{ text.type }}</span>
</template>
<template v-else>
<j-form-item
:name="['dataSource', index, 'value']"
@ -24,19 +27,19 @@
>
<ValueItem
v-model:modelValue="record.value"
:itemType="record.type"
:itemType="record.valueType.type"
:options="
record.type === 'enum'
record.valueType.type === 'enum'
? (
record?.dataType?.elements || []
record?.valueType?.elements || []
).map((item) => {
return {
label: item.text,
value: item.value,
};
})
: record.type === 'boolean'
: record.valueType.type === 'boolean'
? [
{ label: '是', value: true },
{ label: '否', value: false },
@ -94,6 +97,7 @@ const formRef = ref<any>(null);
watchEffect(() => {
modelRef.dataSource = _props?.modelValue || []
console.log(modelRef.dataSource);
})
const onSave = () =>

View File

@ -170,7 +170,7 @@ const funcChange = (val: string) => {
id: item.id,
name: item.name,
value: undefined,
valueType: item?.valueType?.type,
valueType: item?.valueType,
required: item?.expands?.required,
};
});

View File

@ -56,7 +56,17 @@
{{ TypeStringMap[data.record.valueType?.type] }}
</template>
<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 #output="{ data }">
{{ data.record.output?.type }}
@ -71,7 +81,17 @@
{{ data.record.id && !data.record?.expands?.source ? '设备' : sourceMap?.[data.record?.expands?.source] || '' }}
</template>
<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 #outInput>
object

View File

@ -198,6 +198,12 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
},
{ max: 64, message: '最多可输入64个字符' },
]
// rules:[{
// callback(rule:any,value: any, dataSource: any[]) {
// console.log(rule,value,dataSource,123)
// return value
// }
// }]
},
doubleClick(record) {
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[]) {
const field = rule.field.split('.')
const fieldIndex = Number(field[1])
const values = dataSource.find((item, index) => index === fieldIndex)
return validatorConfig(values.output)
return validatorConfig(values?.output)
}
}]
},

View File

@ -7,13 +7,13 @@
v-if="type === 'array'"
v-model:value="_valueType.elementType"
:unitOptions="unitOptions"
placement="topRight"
placement="bottomRight"
@confirm="(data) => {valueChange(data, 'array')}"
/>
<DataTableObject
v-else-if="type === 'object'"
:value="_valueType.properties"
placement="topRight"
placement="bottomRight"
:columns="columns"
@confirm="(data) => {valueChange(data, 'object')}"
>
@ -25,28 +25,28 @@
<ConfigModal v-model:value="data.record.valueType" :showOther="false" />
</template>
</DataTableObject>
<DataTableEnum v-else-if="type === 'enum'" v-model:value="_valueType" placement="topRight" @confirm="(data) => {valueChange(data, 'enum')}"/>
<DataTableBoolean v-else-if="type === 'boolean'" v-model:value="_valueType" placement="topRight" @confirm="(data) => {valueChange(data, 'boolean')}" />
<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="bottomRight" @confirm="(data) => {valueChange(data, 'boolean')}" />
<DataTableDouble
v-else-if="['float', 'double'].includes(type)"
:options="unitOptions"
v-model:value="_valueType"
placement="topRight"
placement="bottomRight"
@confirm="(data) => {valueChange(data, 'float')}"
/>
<DataTableInteger
v-else-if="['int', 'long'].includes(type)"
:options="unitOptions"
v-model:value="_valueType.unit"
placement="topRight"
placement="bottomRight"
@confirm="(data) => {valueChange(data, 'int')}"
/>
<DataTableFile v-else-if="type === 'file'" v-model:value="_valueType.fileType" placement="topRight" @confirm="(data) => {valueChange(data, 'file')}"/>
<DataTableDate v-else-if="type === 'date'" v-model:value="_valueType.format" placement="topRight" @confirm="(data) => {valueChange(data, 'date')}"/>
<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="bottomRight" @confirm="(data) => {valueChange(data, 'date')}"/>
<DataTableString
v-else-if="['string', 'password'].includes(type)"
v-model:value="_valueType.maxLength"
placement="topRight"
placement="bottomRight"
@confirm="(data) => {valueChange(data, 'string')}"
/>
</div>

View File

@ -1,5 +1,5 @@
<template>
<DataTableObject v-model:value="value" :columns="columns" @confirm="confirm">
<DataTableObject v-model:value="value" :columns="columns" @confirm="confirm" placement="bottomRight">
<template #valueType="{ data }">
<span>{{ TypeStringMap[data.record.valueType?.type] }}</span>
</template>

View File

@ -1,5 +1,5 @@
<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 }">
<span>{{ TypeStringMap[data.record.valueType?.type] }}</span>
</template>

View File

@ -5,13 +5,14 @@
</div>
<DataTableArray
v-if="type === 'array'"
placement="bottomRight"
v-model:value="data.elementType"
@confirm="valueChange"
/>
<DataTableObject
v-else-if="type === 'object'"
v-model:value="data.properties"
placement="topRight"
placement="bottomRight"
:columns="columns"
@confirm="valueChange"
:onAdd="addItem"
@ -23,24 +24,27 @@
<ConfigModal v-model:value="data.record.valueType" :showOther="false"/>
</template>
</DataTableObject>
<DataTableEnum v-else-if="type === 'enum'" v-model:value="data" @confirm="valueChange"/>
<DataTableBoolean v-else-if="type === 'boolean'" 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'" placement="bottomRight" v-model:value="data" @confirm="valueChange"/>
<DataTableDouble
v-else-if="['float', 'double'].includes(type)"
placement="bottomRight"
:options="unitOptions"
v-model:value="data"
@confirm="valueChange"
/>
<DataTableInteger
placement="bottomRight"
v-else-if="['int', 'long'].includes(type)"
:options="unitOptions"
v-model:value="data.unit"
@confirm="valueChange"
/>
<DataTableFile v-else-if="type === 'file'" v-model:value="data.fileType" @confirm="valueChange"/>
<DataTableDate v-else-if="type === 'date'" v-model:value="data.date" @confirm="valueChange"/>
<DataTableFile v-else-if="type === 'file'" placement="bottomRight" v-model:value="data.fileType" @confirm="valueChange"/>
<DataTableDate v-else-if="type === 'date'" placement="bottomRight" v-model:value="data.date" @confirm="valueChange"/>
<DataTableString
v-else-if="['string', 'password'].includes(type)"
placement="bottomRight"
v-model:value="data.maxLength"
@confirm="valueChange"
/>

View File

@ -1,7 +1,7 @@
<template>
<j-popconfirm-modal
body-style="padding-top:4px;width:600px;"
placement="topRight"
placement="bottomRight"
:disabled="disabled"
:get-popup-container="(node) => fullRef || node"
@confirm="confirm"

View File

@ -16,7 +16,7 @@
height: myValue === 'rule' ? '300px' : '80px',
}"
:get-popup-container="(node) => fullRef || node"
placement="topLeft"
placement="bottomRight"
@confirm="confirm"
@visibleChange="visibleChange"
>
@ -115,8 +115,9 @@ const disabled = computed(() => {
// if (props.target === 'device') {
// return true;
// }
return props.noEdit?.length
? props.noEdit.includes(props.value._sortIndex)
? props.noEdit.includes(props.value.id) && props?.target === 'device'
: false;
});

View File

@ -257,14 +257,265 @@ const loadData = async () => {
};
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) => {
if(file.type === 'application/json') {
const reader = new FileReader();
reader.readAsText(file);
reader.onload = (json) => {
if(json.target?.result){
const data = JSON.parse(json.target?.result);
let check = formModel.metadata === 'jetlinks' ? requiredCheck(data) : aliCheck(data)
if(!check){
onlyMessage('操作成功!')
formModel.import = json.target?.result;
}
} else {
onlyMessage('文件内容不能为空', 'error')
}

View File

@ -1,6 +1,6 @@
<template>
<div class='device-detail-metadata' style="position: relative;">
<!-- <div class="tips">-->
<!-- <div class="tips">-->
<!-- <j-tooltip :title="instanceStore.detail?.independentMetadata && type === 'device'-->
<!-- ? '该设备已脱离产品物模型,修改产品物模型对该设备无影响'-->
<!-- : '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'">-->
@ -12,8 +12,8 @@
<!-- : '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'-->
<!-- }}-->
<!-- </div>-->
<!-- </j-tooltip>-->
<!-- </div>-->
<!-- </j-tooltip> -->
<!-- </div> -->
<j-tabs class="metadataNav" :activeKey="tabActiveKey" destroyInactiveTabPane type="card" @change="tabsChange">
<template #rightExtra>
<j-space>
@ -30,7 +30,9 @@
<PermissionButton :hasPermission="`${permission}:update`" @click="cat = true" key="tsl">物模型TSL</PermissionButton>
</j-space>
</template>
<template #centerExtra>
<span class="desc">设备会默认继承产品的物模型继承的物模型不支持删改</span>
</template>
<j-tab-pane tab="属性定义" key="properties">
<BaseMetadata :target="type" type="properties" :permission="permission" />
</j-tab-pane>
@ -79,7 +81,7 @@ provide('_metadataType', props.type)
const showReset = computed(() => {
if (props.type === 'device' && instanceStore.current.productMetadata) {
console.log(instanceStore.current)
console.log(instanceStore.current,123)
const proMetadata = JSON.parse(instanceStore.current.productMetadata || '{}')
const _metadata = JSON.parse(instanceStore.current.metadata || '{}')
return !isEqual(_metadata, proMetadata)
@ -128,5 +130,12 @@ const tabsChange = (e: string) => {
padding: 0;
}
}
.desc{
font-size: 13px;
color: rgba(0,0,0,.8);
display: inline-block;
margin-top: 12px;
margin-left: 5px;
}
}
</style>

View File

@ -64,7 +64,7 @@ const filterMenu = (permissions: string[], menus: any[], hasProtocol: boolean) =
return menus.filter((item) => {
let isShow = false;
if (item.showPage && item.showPage.length) {
isShow = item.showPage.every((pItem: any) => {
isShow = item.showPage.some((pItem: any) => {
return permissions.includes(pItem);
});
}

View File

@ -50,11 +50,11 @@
<AIcon type="EditOutlined" />
</j-button>
</j-tooltip>
<PermissionButton
type="link"
:hasPermission="`${permission}:add`"
:tooltip="{ title: '新增子菜单' }"
:disabled="slotProps.level >= 3"
@click="table.addChildren(slotProps)"
>
<AIcon type="PlusCircleOutlined" />