taskid:099 remark:"commit"
This commit is contained in:
@@ -5,7 +5,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;">
|
||||
@@ -562,6 +562,7 @@
|
||||
});
|
||||
opMap.value.fuc = (formData: any) => {
|
||||
formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
|
||||
debugger
|
||||
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
visible.value = false;
|
||||
@@ -665,14 +666,22 @@
|
||||
handle: (record: any) => {
|
||||
userAuthList.value.splice(0);
|
||||
setTimeout(() => {
|
||||
console.log(record.id);
|
||||
|
||||
http.post(carbonEmissionFactorLibrary.findById,{ id: record.id } ).then((res) => {
|
||||
formData.value = res.data;
|
||||
const measurementUnit = ref([])
|
||||
http.post(carbonEmissionFactorLibrary.getCarbonFactorTree,{}).then((res) => {
|
||||
measurementUnit.value = res.data
|
||||
http.post(carbonEmissionFactorLibrary.findById,{ id: record.id } ).then((res) => {
|
||||
if (res.data.emissionType) {
|
||||
let selectDevice = ref([Number(res.data.emissionType)]);
|
||||
findParentIds(measurementUnit.value, res.data.emissionType, selectDevice.value);
|
||||
res.data.emissionType = selectDevice
|
||||
}
|
||||
formData.value = res.data;
|
||||
});
|
||||
});
|
||||
}, 10);
|
||||
opMap.value.type = 'edit';
|
||||
opMap.value.fuc = (formData: any) => {
|
||||
formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
|
||||
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
visible.value = false;
|
||||
@@ -790,6 +799,27 @@
|
||||
// pagination: { defaultPageSize: 10 },
|
||||
rowKey: '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.id === Number(targetId))) {
|
||||
result.unshift(item.id); // 将当前节点的id添加到结果数组的最前面
|
||||
findParentIds(tree, item.id, result); // 递归查找父级节点的id
|
||||
break; // 找到后可以退出循环
|
||||
}else{
|
||||
for(let childsItem of item.children){
|
||||
if(childsItem.children && childsItem.children.length > 0){
|
||||
if (childsItem.children.some((child: any) => child.id === Number(targetId))) {
|
||||
result.unshift(childsItem.id); // 将当前节点的id添加到结果数组的最前面
|
||||
findParentIds(tree, childsItem.id, result); // 递归查找父级节点的id
|
||||
break; // 找到后可以退出循环
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 单位管理
|
||||
const unitExpandedKeys = ref<string[]>();
|
||||
@@ -977,6 +1007,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;
|
||||
}
|
||||
.treeRow {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
Reference in New Issue
Block a user