完善优化

This commit is contained in:
KangKang0928 2024-08-23 16:29:43 +08:00
parent eb370cd4ed
commit b691702778
1 changed files with 31 additions and 15 deletions

View File

@ -110,31 +110,41 @@ export default {
} }
}); });
const findLabelsByCode = (tree, codes) => { const findLabelsByCode = (tree, codes) => {
const labels = []; //
// console.log("row.cityCodes",row.cityCodes); let paths = [];
//
if (codes == "0") { if (codes == "0") {
return "中国"; return ["中国"];
} }
function searchTree(node) {
// code codes label //
if (codes?.includes(node.code)) { function searchTree(node, currentPath) {
labels.push(node.name); //
currentPath.push(node.name);
// code codes
if (codes.includes(node.code)) {
paths.push([...currentPath]); //
} }
// //
if (node.children) { if (node.children) {
for (let child of node.children) { for (let child of node.children) {
searchTree(child); searchTree(child, currentPath);
} }
} }
//
currentPath.pop();
} }
// searchTree // searchTree
for (let node of tree) { for (let node of tree) {
searchTree(node); searchTree(node, []);
} }
return labels.join(","); //
return paths.map((path) =><p>{path.join("/")}</p>);
}; };
const appointMapper = { const appointMapper = {
@ -176,10 +186,16 @@ export default {
}; };
// //
const openPreview = (str) => { const openPreview = (str) => {
this.$confirm(str, "详情", { this.$confirm(
showCancelButton: false, <div style="max-height:50vh;overflow-y:auto;line-height:1.5rem;">
confirmButtonText:"好的" {str}
}); </div>,
"详情",
{
showCancelButton: false,
confirmButtonText: "好的",
}
);
}; };
return ( return (
<div class="mb-5"> <div class="mb-5">