taskid:099 remark:"commit"

This commit is contained in:
fks-xuxinyue
2024-07-19 15:13:46 +08:00
parent ecdcd900d3
commit 9bd82ebbee
6 changed files with 560 additions and 44 deletions

View File

@@ -363,9 +363,11 @@
getDictList()
visible.value = true
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
// if(res.data.unit){
// res.data.unit = res.data.unit.split(',')
// }
if (res.data.unit) {
let selectDevice = ref([Number(res.data.unit)]);
findParentIds(measurementUnit.value, res.data.unit, selectDevice.value);
res.data.unit = selectDevice
}
formState.value = res.data
});
},
@@ -398,6 +400,18 @@
},
rowKey: 'id',
});
// 定义一个递归函数来查找每一级的id 设备类型回显 层级方法
function findParentIds(tree: any, targetId: number, result: any) {
for (let item of tree) {
if (item.children && item.children.length > 0) {
if (item.children.some((child: any) => child.value === targetId)) {
result.unshift(item.value); // 将当前节点的id添加到结果数组的最前面
findParentIds(tree, item.value, result); // 递归查找父级节点的id
break; // 找到后可以退出循环
}
}
}
}
// 获取表格数据
const getTableList = () => {
fetch(energyConsumption.pageList , queryParams.value).then((res) => {
@@ -473,6 +487,7 @@
label: child.cnValue
})) : []
}));
debugger
});
// 获取自动采集节点的数据
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => {

View File

@@ -3,7 +3,7 @@
<div class="left">
<div class="top">
<a-form style="width: 100%;margin: 0 auto;">
<div class="ns-form-title"><span>因子分类</span></div>
<div class="ns-form-title"><div class="title">因子分类</div></div>
<div style="padding: 0 16px !important;width: 100%;">
<a-row>
<a-col :span="24" style="margin-bottom: 16px;">
@@ -507,6 +507,26 @@
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
.title{
text-align: left;
height: 32px;
line-height: 32px;
font-weight: bold;
user-select: text;
position: relative;
padding-left: 9px;
}
.title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 13px;
width: 3px;
border-radius: 1px;
background-color: #2778FF;
}
::v-deep .ant-table-title{
display: flex;
height: 100%;