Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
a8362b93
Commit
a8362b93
authored
Oct 18, 2023
by
“yiyousong”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 修改站点管理区域树
parent
f58bd4e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
26 deletions
+58
-26
base-manager-ui/admin/src/components/sitetree/index.vue
base-manager-ui/admin/src/components/sitetree/index.vue
+52
-25
base-manager-ui/admin/src/services/basicsetApi.js
base-manager-ui/admin/src/services/basicsetApi.js
+2
-1
base-manager-ui/admin/src/services/basicsetFun.js
base-manager-ui/admin/src/services/basicsetFun.js
+4
-0
No files found.
base-manager-ui/admin/src/components/sitetree/index.vue
View file @
a8362b93
...
...
@@ -3,7 +3,6 @@
<!--
<span
style=
"font-weight: 600"
>
站点结构
</span>
-->
<div
class=
"box"
>
<a-tree
:load-data=
"onLoadData"
:tree-data=
"treeData"
:expandedKeys.sync=
"expandedKeys"
:replaceFields=
"
{ title: 'label', key: 'id' }"
...
...
@@ -18,6 +17,7 @@
// api
import
{
getListByParentId
,
authAreaTree
,
// areaList,
// getSiteList
}
from
"
@/services/basicsetFun
"
;
...
...
@@ -32,39 +32,66 @@ export default {
},
created
()
{
this
.
getAreaList
();
this
.
authAreaTree
();
this
.
getTopArea
();
},
methods
:
{
// 获取区域
async
getAreaList
()
{
editLeaf
(
arr
)
{
return
arr
.
map
((
v
)
=>
{
if
(
v
.
children
&&
v
.
children
.
length
>
0
)
{
this
.
editLeaf
(
v
.
children
);
}
else
{
v
.
isLeaf
=
true
;
}
return
v
;
});
},
// 获取个人区域数据
async
authAreaTree
()
{
let
res
=
await
authAreaTree
();
if
(
res
.
data
.
code
==
1
)
{
let
{
data
}
=
res
.
data
.
data
;
if
(
data
.
length
)
{
let
firstData
=
data
[
0
];
if
(
firstData
.
areaLevel
>
2
||
data
.
length
>
1
)
{
let
TopParent
=
await
this
.
getTopArea
();
TopParent
.
selectable
=
false
;
TopParent
.
children
=
this
.
editLeaf
(
data
);
this
.
treeData
=
[
TopParent
];
}
else
{
this
.
treeData
=
this
.
editLeaf
(
data
);
}
this
.
expandedKeys
=
[
this
.
treeData
[
0
].
id
];
}
}
},
// 获取顶层区域
async
getTopArea
()
{
let
res
=
await
getListByParentId
({
parentId
:
0
});
const
{
data
,
code
}
=
res
.
data
;
if
(
code
===
1
)
{
this
.
treeData
=
data
.
data
;
// let obj = {
// dataRef: {
// id: data.data[0].id,
// },
// };
// this.onLoadData(obj);
this
.
expandedKeys
=
[
data
.
data
[
0
].
id
];
return
data
.
data
[
0
];
}
else
{
return
{};
}
},
// 异步获取子区域
onLoadData
(
treeNode
)
{
return
new
Promise
((
resolve
)
=>
{
getListByParentId
({
parentId
:
treeNode
.
dataRef
.
id
,
}).
then
((
res
)
=>
{
const
{
data
}
=
res
.
data
;
treeNode
.
dataRef
.
children
=
data
.
data
;
this
.
treeData
=
[...
this
.
treeData
];
resolve
();
});
});
},
//
onLoadData(treeNode) {
//
return new Promise((resolve) => {
//
getListByParentId({
//
parentId: treeNode.dataRef.id,
//
}).then((res) => {
//
const { data } = res.data;
//
treeNode.dataRef.children = data.data;
//
this.treeData = [...this.treeData];
//
resolve();
//
});
//
});
//
},
// 选中区域
onSelect
(
num
,
node
)
{
if
(
num
&&
node
.
selectedNodes
.
length
>
0
)
{
...
...
@@ -94,4 +121,4 @@ export default {
overflow-y: auto;
}
}
</
style
>
\ No newline at end of file
</
style
>
base-manager-ui/admin/src/services/basicsetApi.js
View file @
a8362b93
...
...
@@ -30,7 +30,8 @@ module.exports = {
treeselect
:
`
${
BASE_URL
}
/base/area/treeselect`
,
save
:
`
${
BASE_URL
}
/base/area/save`
,
delete
:
`
${
BASE_URL
}
/base/area/delete`
,
init
:
`
${
BASE_URL
}
/base/base/area/genSubAreaByAreaName `
,
init
:
`
${
BASE_URL
}
/base/area/genSubAreaByAreaName`
,
authAreaTree
:
`
${
BASE_URL
}
/base/area/authAreaTree`
,
},
// 站点
site
:
{
...
...
base-manager-ui/admin/src/services/basicsetFun.js
View file @
a8362b93
...
...
@@ -19,6 +19,10 @@ export async function getListByParentId(data) {
export
async
function
treeselect
(
data
)
{
return
request
(
area
.
treeselect
,
METHOD
.
POST
,
data
);
}
// 查看个人区域列表
export
async
function
authAreaTree
(
data
)
{
return
request
(
area
.
authAreaTree
,
METHOD
.
POST
,
data
);
}
// 查看站点列表
export
async
function
getSiteList
(
data
)
{
return
request
(
site
.
list
,
METHOD
.
POST
,
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment