Commit d47f220e authored by tianhongyang's avatar tianhongyang

企业详情页面 样式异常调整

parent 808fe2e7
...@@ -629,59 +629,91 @@ export function queryConditionFiltering(params) { ...@@ -629,59 +629,91 @@ export function queryConditionFiltering(params) {
* @param {Array<object>} selectList * @param {Array<object>} selectList
* @returns * @returns
*/ */
export function getTreeSelectAreaList(selectList) { export function getTreeSelectAreaList(node, tree) {
console.log(selectList);
try { try {
if (Object.prototype.toString.call(selectList) != "[object Array]") throw new Error("传入参数不是一个数组"); if (Object.prototype.toString.call(node) != "[object Object]") throw new Error("传入参数不是一个对象");
if (!selectList?.length) return [];
// 处理成原始数据
const _temp = selectList.map(item => {
return JSON.parse(JSON.stringify({
label: item.label,
value: item.value,
level: item.level,
parent: item?.parent ? {
label: item?.parent?.label,
value: item?.parent?.value,
level: item?.parent.level,
} : null
}));
});
// 创建映射
const selectMap = {};
const _result = []; const _result = [];
// 不是顶级目标 const _tempTree = JSON.parse(JSON.stringify(tree));
const _childResult = [];
// 多树形结构
if (Object.prototype.toString.call(_tempTree) == "[object Array]") {
if (_tempTree.length) {
for (const iterator of _tempTree) {
const nodeAncestors = findNodeAndAncestors(iterator, node.value, "value");
// 查找到
if (nodeAncestors) {
console.log(nodeAncestors);
}
}
}
}
_temp.forEach(item => { // 单树形结构
selectMap[item.value] = item; } catch (error) {
}); console.log(error);
}
}
_temp.forEach(item => { /**
const parent = selectMap[item?.parent?.value]; * 根据节点信息 找到当前节点到祖先辈组成的树形结构
// 存在父节点,添加到父节点的chidren * @param {*} tree
if (parent) { * @param {*} targetId
parent.children ? parent.children.push(item) : (parent.children = []).push(item); * @returns
parent.childCount = parent.children.length; */
} else { export function findNodeAndAncestors(tree, targetId, idKey = "id", directAncestorsOnly = true) {
// 有父级 但是没有选择父级节点 if (tree[idKey] === targetId) {
if (item?.parent?.value) { // 找到目标节点,directAncestorsOnly 只找直系节点的情况下 如果是根节点(没有parent父级),返回节点本身不带子节点,否则返回节点的树形结构
_childResult.push(item); return directAncestorsOnly && !tree.parent ? { ...tree, children: [] } : tree;
}
if (tree?.children?.length) {
for (const child of tree.children) {
const result = findNodeAndAncestors(child, targetId, idKey, directAncestorsOnly);
if (result) {
// 如果找到目标节点,将该节点加入祖先辈的树形结构中
if (directAncestorsOnly) {
return {
...tree,
children: [result]
};
} else { } else {
_result.push(item); return {
...tree,
children: tree?.children?.map(c => (c[idKey] === result[idKey] ? result : c))
};
} }
} }
}); }
}
console.log(selectMap); // 如果未找到目标节点,返回null
return null;
}
return _result; /**
} catch (error) { * 根据节点唯一标识查找节点信息
console.log(error); * @param {*} tree
* @param {*} targetId
* @param {*} idKes
*/
export function findNodeFromTree(tree, targetId, idKes = "id") {
if (tree[idKes] == targetId) {
return tree;
} }
if (tree?.children?.length) {
for (const child of tree.children) {
// 递归到孙子集查找
const result = findNodeFromTree(child, targetId);
if (result) {
// 如果找到目标节点,返回目标节点
return result;
}
}
}
return null;
} }
// 甲方详情左侧菜单映射 // 甲方详情左侧菜单映射
......
...@@ -258,8 +258,13 @@ export default { ...@@ -258,8 +258,13 @@ export default {
} }
}, },
handleChange(params) { handleChange(params) {
const tree = this.$refs?.areaTree?.getCheckedNodes(); const selectNode = this.$refs?.areaTree?.getCheckedNodes();
console.log(getTreeSelectAreaList(tree), "filter"); if (selectNode?.length) {
const result = selectNode.map(item => {
return getTreeSelectAreaList(item, this.areaDataList);
});
console.log(result);
}
} }
}, },
} }
......
...@@ -411,9 +411,6 @@ export default { ...@@ -411,9 +411,6 @@ export default {
.details-of-party { .details-of-party {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute;
top: 0;
left: 0;
margin: 0px; margin: 0px;
padding: 16px 24px; padding: 16px 24px;
box-sizing: border-box; box-sizing: border-box;
...@@ -425,18 +422,29 @@ export default { ...@@ -425,18 +422,29 @@ export default {
} }
::v-deep .part-main { ::v-deep .part-main {
height: calc(100% - 56px - 12px); height: calc(100% - 68px);
overflow-y: hidden;
overflow-x: hidden;
.part-right { .part-right {
margin-left: 160px; margin-left: 160px;
width: calc(100% - 160px); width: calc(100% - 160px);
overflow: auto; overflow: hidden;
}
}
.part-common-container-style { .part-common-container-style {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: auto;
.app-container {
position: relative;
width: auto;
height: auto;
overflow: initial;
box-sizing: border-box;
}
}
}
} }
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment