测点:添加显示字段

物模型:修改数据类型显示逻辑
This commit is contained in:
高云鹏 2024-10-18 17:39:39 +08:00
parent 3fd9992364
commit e44300d782
2 changed files with 177 additions and 14 deletions

View File

@ -197,15 +197,13 @@
<el-option label="离散量" :value="140"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="ModelAttributeFieldsEnums['dataType']" prop="dataType">
<el-select
:disabled="!attributeForm.attributeType || attributeForm.attributeType === 140"
v-model="attributeForm.dataType"
:placeholder="'请选择' + ModelAttributeFieldsEnums['dataType']"
>
<el-option v-for="v in attributeFormDataTypeOptions" :key="v.value" :label="v.value" :value="v.value"></el-option>
</el-select>
</el-form-item>
<template v-if="attributeForm.attributeType !== 140">
<el-form-item :label="ModelAttributeFieldsEnums['dataType']" prop="dataType">
<el-select v-model="attributeForm.dataType" :placeholder="'请选择' + ModelAttributeFieldsEnums['dataType']">
<el-option v-for="v in attributeFormDataTypeOptions" :key="v.value" :label="v.value" :value="v.value"></el-option>
</el-select>
</el-form-item>
</template>
</div>
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
@ -659,7 +657,7 @@ const attributeForm = ref<AddModelAttributeType & UpdateModelAttributeType>(JSON
const attributeTypeChange = (value: ModelAttributeType) => {
if (value === 140) {
attributeForm.value.dataType = ''
}else{
} else {
attributeForm.value.dataType = 'float'
}
}

View File

@ -23,6 +23,50 @@ export const excelDefaultConfig: any = {
label: '寄存器地址',
code: 'col4',
},
{
label: '上界',
code: 'upBound',
},
{
label: '下界',
code: 'lowBound'
},
{
label: '基值',
code: 'base',
default: 0
},
{
label: '系数',
code: 'coef',
default: 1
},
{
label: '限值1',
code: 'limit1Enable',
default: 0
},
{
label: '限值1下限',
code: 'limit1Low'
},
{
label: '限值1上限',
code: 'limit1High'
},
{
label: '限值2',
code: 'limit2Enable',
default: 0
},
{
label: '限值2上限',
code: 'limit2High'
},
{
label: '限值2下限',
code: 'limit2Low'
}
],
R0C4: ['03', '04'],
R0C5: [
@ -191,6 +235,46 @@ export const excelDefaultConfig: any = {
label: '寄存器地址',
code: 'col4',
},
{
label: '上界',
code: 'upBound',
},
{
label: '下界',
code: 'lowBound'
},
{
label: '基值',
code: 'base'
},
{
label: '系数',
code: 'coef'
},
{
label: '限值1',
code: 'limit1Enable'
},
{
label: '限值1下限',
code: 'limit1Low'
},
{
label: '限值1上限',
code: 'limit1High'
},
{
label: '限值2',
code: 'limit2Enable'
},
{
label: '限值2上限',
code: 'limit2High'
},
{
label: '限值2下限',
code: 'limit2Low'
}
],
R0C4: ['03', '04'],
R0C5: [
@ -347,6 +431,46 @@ export const excelDefaultConfig: any = {
label: '信息体地址',
code: 'ioa',
},
{
label: '上界',
code: 'upBound',
},
{
label: '下界',
code: 'lowBound'
},
{
label: '基值',
code: 'base'
},
{
label: '系数',
code: 'coef'
},
{
label: '限值1',
code: 'limit1Enable'
},
{
label: '限值1下限',
code: 'limit1Low'
},
{
label: '限值1上限',
code: 'limit1High'
},
{
label: '限值2',
code: 'limit2Enable'
},
{
label: '限值2上限',
code: 'limit2High'
},
{
label: '限值2下限',
code: 'limit2Low'
}
],
},
//遥控147 CONTROL
@ -400,6 +524,46 @@ export const excelDefaultConfig: any = {
label: '是否转发',
code: 'ts',
},
{
label: '上界',
code: 'upBound',
},
{
label: '下界',
code: 'lowBound'
},
{
label: '基值',
code: 'base'
},
{
label: '系数',
code: 'coef'
},
{
label: '限值1',
code: 'limit1Enable'
},
{
label: '限值1下限',
code: 'limit1Low'
},
{
label: '限值1上限',
code: 'limit1High'
},
{
label: '限值2',
code: 'limit2Enable'
},
{
label: '限值2上限',
code: 'limit2High'
},
{
label: '限值2下限',
code: 'limit2Low'
}
],
R0C4: ['否--0', '是--1']
},
@ -497,7 +661,7 @@ const createHeaderData = (protocol: string | number) => {
s: '1',
custom: 'equipmentName',
},
1:{
1: {
v: '设备编码',
s: '1',
custom: 'equipmentCode',
@ -507,7 +671,7 @@ const createHeaderData = (protocol: string | number) => {
s: '1',
custom: 'name',
},
3:{
3: {
v: '属性编码',
s: '1',
custom: 'code',
@ -537,6 +701,7 @@ export const setExcelNameToLinkId = (id: string) => {
*/
export const createWookbookData = (protocol: number, linkId: string, data: any = {}) => {
const headerData = createHeaderData(protocol)
const sheetData: any = {}
//#region
Object.keys(headerData).forEach((item) => {
@ -652,8 +817,6 @@ export const createSheetData = (data: any, protocol: string | number) => {
})
const result: any = {}
data[item].forEach((obj: any, index: number) => {
console.log(obj)
const params = obj.params && obj.params !== '' ? JSON.parse(obj.params) : {}
obj = { ...obj, ...params }
const row = index + 1
@ -674,5 +837,7 @@ export const createSheetData = (data: any, protocol: string | number) => {
})
resultData[item] = result
})
return resultData
}