电能质量字典界面

This commit is contained in:
sjl
2024-11-06 08:45:51 +08:00
parent 29bc14d3e1
commit 51f408ce7a
4 changed files with 92 additions and 46 deletions

View File

@@ -69,6 +69,10 @@
search: {
el: 'input',
},
render: (scope) => {
const codes = scope.row.otherName;
return codes || '/';
}
},
{
prop: 'showName',
@@ -77,56 +81,95 @@
search: {
el: 'input',
},
render: (scope) => {
const codes = scope.row.showName;
return codes || '/';
}
},
{
prop: 'phase',
label: '相别',
width: 180,
enum: dictStore.getDictData('High_Cate'),
fieldNames: { label: 'name', value: 'code' },
},
{
prop: 'phase',
prop: 'unit',
label: '单位',
width: 180,
render: (scope) => {
const codes = scope.row.unit;
return codes || '/';
}
},
{
prop: 'type',
label: '指标数据类型',
width: 180,
render: (scope) => {
const codes = scope.row.type;
return codes || '/';
}
},
{
prop: 'harmStart',
label: '数据谐波次数',
width: 180,
render: (scope) => {
return scope.row.harmStart
return (scope.row.harmStart && scope.row.harmEnd)
? `${scope.row.harmStart}-${scope.row.harmEnd}`
: '/'; // 如果 harmStart 为空,返回 \
: '/'; // 如果 harmStart 或 harmEnd 为空,返回 '/'
},
},
{
prop: 'statMethod',
label: '数据统计类型',
width: 180,
render: (row) => {
const methods = row.statMethod || []; // 确保statMethod存在
if (methods.length === 0) {
return '/'; // 空值时显示/
} else if (methods.length > 2) {
return methods.join(', '); // 超过两个用逗号分隔
} else {
return methods.join(' '); // 少于等于两个时用空格分隔
width: 250,
enum: dictStore.getDictData('Event_Type'),
fieldNames: { label: 'name', value: 'code' },
render: (scope) => {
// 假设 statMethod 是一个数组,包含多个 'code' 值
const codes = scope.row.statMethod; // 获取当前行的 statMethod 字段
//console.log('codes',codes)
if (!codes) {
return '/'; // 如果 statMethod 为 undefined 或 null返回 '/'
}
},
// 确保 codes 是一个字符串
const codeString = Array.isArray(codes) ? codes.join(',') : codes;
const codeArray = codeString.split(',');
if (codeArray.length > 1) {
// 查找与每个 code 值匹配的 name然后拼接成逗号分割的字符串
//console.log('codeArray',codeArray)
const names = codeArray.map(code => {
const dictItem = dictStore.getDictData('Event_Type').find(item => item.code === code);
return dictItem ? dictItem.name : ''; // 如果找到匹配的项,返回对应的 name
});
//console.log('names',names)
return names.join(', '); // 用逗号连接所有的 name
}
// 查找单个 code 对应的 name
const dictItem = dictStore.getDictData('Event_Type').find(item => item.code === codeArray[0]);
return dictItem ? dictItem.name : ''; // 如果找到匹配的项,返回对应的 name
},
},
{
prop: 'classId',
label: '数据表表名',
width: 180,
enum: dictStore.getDictData('High_Cate'),
fieldNames: { label: 'name', value: 'code' },
},
{
prop: 'resourcesId',
label: '报表数据来源',
width: 180,
enum: dictStore.getDictData('Dev_Series'),
fieldNames: { label: 'name', value: 'code' },
render: (scope) => {
const codes = scope.row.resourcesId;
return codes || '/';
}
},
{
prop: 'operation',