Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ETL-admin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
莫晓莉
ETL-admin
Commits
9536dc92
Commit
9536dc92
authored
Jan 25, 2021
by
莫晓莉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
选择作业tree
parent
39dee39d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
213 additions
and
58 deletions
+213
-58
src/views/task/homework.vue
+118
-10
src/views/task/transform.vue
+95
-48
No files found.
src/views/task/homework.vue
View file @
9536dc92
...
...
@@ -302,7 +302,7 @@
:visible
.
sync=
"treeDialogVisible"
:before-close=
"closeTreeModal"
width=
"30%"
>
<el-tree
<
!-- <
el-tree
:data="jobTreeList"
:check-strictly="true"
:default-expand-all="false"
...
...
@@ -312,8 +312,28 @@
:default-checked-keys="[currenSelectNodeId]"
@check="getCheckedNodes"
:highlight-current="true"
show-checkbox> -->
<el-tree
:data=
"jobTreeList"
:auto-expand-parent=
"true"
:check-strictly=
"true"
:default-expand-all=
"false"
node-key=
"id"
ref=
"tree"
:props=
"defaultProps"
:default-checked-keys=
"[currenSelectNodeId]"
@
check-change=
"handleCheckChange"
:highlight-current=
"true"
show-checkbox
>
</el-tree>
<!-- </el-tree> -->
<span
class=
"custom-tree-node"
slot-scope=
"{node,data}"
>
<span>
<i
:class=
"data.icon"
></i>
{{ node.label }}
</span>
</span>
</el-tree>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"treeDialogVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"jobTreeConfirm()"
>
确 定
</el-button>
...
...
@@ -480,9 +500,8 @@ export default {
// }
],
defaultProps
:
{
label
:
'path'
,
children
:
'children'
,
label
:
'text'
,
children
:
'children'
,
},
currenSelectNodeId
:
''
,
//当前选择的作业的节点id
currenSelectNodePath
:
''
//当前选择的作业的节点路径
...
...
@@ -736,7 +755,69 @@ export default {
console
.
log
(
'获取转换树形列表'
,
res
);
if
(
res
.
success
){
this
.
jobTreeList
=
res
.
data
;
if
(
res
.
data
.
length
>
0
){
// 测试数据start-----------------
// this.jobTreeList=[
// {
// icon: 'el-icon-folder',
// path: 'f0',
// id: '1',
// parent: '0',
// lasted: false,
// text:"转换名称路径1"
// },
// {
// icon: 'el-icon-folder',
// path: 'f01',
// id: '2',
// parent: '1',
// lasted: true,
// text:"转换名称路径1"
// },
// {
// icon: 'el-icon-folder',
// path: 'f02',
// id: '3',
// parent: '1',
// lasted: false,
// text:"转换名称路径1"
// },
// {
// icon: 'el-icon-folder',
// path: 'f021',
// id: '6',
// parent: '3',
// lasted: false,
// text:"转换名称路径1"
// },
// {
// icon: 'el-icon-folder',
// path: 'f021',
// id: '7',
// parent: '6',
// lasted: true,
// text:"转换名称路径1"
// },
// {
// icon: 'el-icon-folder',
// path: 'f40',
// id: '4',
// parent: '0',
// lasted: false,
// text:"转换名称路径1"
// },
// {
// icon: 'el-icon-folder',
// path: 'f41',
// id: '5',
// parent: '4',
// lasted: true,
// text:"转换名称路径1"
// }
// ];
// console.log('获取转换树形列表测试数据',this.jobTreeList);
// 测试数据end--------------------------------
if
(
this
.
jobTreeList
.
length
>
0
){
this
.
treeRevert
(
this
.
jobTreeList
);
//数据转换
}
}
...
...
@@ -746,7 +827,7 @@ export default {
//打卡树形结构弹窗
openTreeModal
(){
this
.
getJobTree
();
if
(
this
.
formOne
.
repositoryId
){
if
(
this
.
formOne
.
repositoryId
){
if
(
this
.
jobTreeList
.
length
>
0
){
this
.
treeDialogVisible
=
!
this
.
treeDialogVisible
;
}
else
{
...
...
@@ -777,6 +858,7 @@ export default {
// let pid = cur.pid ? cur.pid : 0;
let
pid
=
cur
.
parent
?
cur
.
parent
:
0
;
let
parent
=
formatObj
[
pid
];
cur
.
disabled
=
!
cur
.
lasted
;
if
(
parent
)
{
parent
.
children
?
parent
.
children
.
push
(
cur
)
:
parent
.
children
=
[
cur
];
}
else
{
...
...
@@ -790,6 +872,27 @@ export default {
this
.
jobTreeList
=
formatArray
;
},
// handleCheckChange(data){
// console.log('选中节点信息===:',data);
// },
handleCheckChange
(
data
,
checked
){
if
(
checked
){
console
.
log
(
'选中节点信息1===:'
,
data
);
this
.
$refs
.
tree
.
setCheckedKeys
([
data
.
id
],
true
);
console
.
log
(
'选中后集合信息jobTreeList1=====:'
,
this
.
jobTreeList
);
this
.
currenSelectNodeId
=
data
.
id
;
//当前选择的作业的节点id
this
.
currenSelectNodePath
=
data
.
path
;
//当前选择的作业的节点路径
}
else
{
console
.
log
(
'选中节点信息2===:'
,
data
);
if
(
data
.
id
==
this
.
currenSelectNodeId
){
this
.
currenSelectNodeId
=
0
;
//当前选择的作业的节点id
this
.
currenSelectNodePath
=
''
;
//当前选择的作业的节点路径
}
// this.jobTreeList.id = null;
console
.
log
(
'选中后集合信息jobTreeList2=====:'
,
this
.
jobTreeList
);
}
},
// 选择会触发getname方法
...
...
@@ -820,9 +923,14 @@ export default {
},
//确认选择当前作业
jobTreeConfirm
(){
this
.
treeDialogVisible
=
false
;
this
.
formOne
.
path
=
this
.
currenSelectNodePath
;
this
.
currenSelectNodeId
=
this
.
currenSelectNodeId
;
if
(
this
.
currenSelectNodeId
){
this
.
treeDialogVisible
=
false
;
this
.
formOne
.
path
=
this
.
currenSelectNodePath
;
this
.
currenSelectNodeId
=
this
.
currenSelectNodeId
;
}
else
{
this
.
$message
.
error
(
"请选择作业!"
);
}
}
// 1、模态框操作----新增资源库转换
...
...
src/views/task/transform.vue
View file @
9536dc92
...
...
@@ -305,10 +305,16 @@
ref=
"tree"
:props=
"defaultProps"
:default-checked-keys=
"[currenSelectNodeId]"
@
check
=
"getCheckedNodes
"
@
check
-change=
"handleCheckChange
"
:highlight-current=
"true"
show-checkbox
>
</el-tree>
<!-- </el-tree> -->
<span
class=
"custom-tree-node"
slot-scope=
"{node,data}"
>
<span>
<i
:class=
"data.icon"
></i>
{{ node.label }}
</span>
</span>
</el-tree>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"treeDialogVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"jobTreeConfirm()"
>
确 定
</el-button>
...
...
@@ -413,52 +419,66 @@ export default {
},
fileList
:
[],
//上传的资源文件
// jobTreeList:[
// {
// path: 'f0',
// id: '1',
// parent: '0',
// lasted: false,
// },
// {
// path: 'f01',
// id: '2',
// parent: '1',
// lasted: true,
// },
// {
// path: 'f02',
// id: '3',
// parent: '1',
// lasted: true,
// },
// {
// path: 'f021',
// id: '6',
// parent: '3',
// lasted: false,
// },
// {
// path: 'f021',
// id: '7',
// parent: '6',
// lasted: false,
// },
// {
// path: 'f40',
// id: '4',
// parent: '0',
// lasted: false,
// },
// {
// path: 'f41',
// id: '5',
// parent: '4',
// lasted: true,
// }
// {
// icon: 'el-icon-folder',
// path: 'f0',
// id: '1',
// parent: '0',
// lasted: false,
// text:"转换名称路径1"
// },
// {
// icon: 'el-icon-folder',
// path: 'f01',
// id: '2',
// parent: '1',
// lasted: true,
// text:"转换名称路径2"
// },
// {
// icon: 'el-icon-folder',
// path: 'f02',
// id: '3',
// parent: '1',
// lasted: false,
// text:"转换名称路径3"
// },
// {
// icon: 'el-icon-folder',
// path: 'f021',
// id: '6',
// parent: '3',
// lasted: false,
// text:"转换名称路径4"
// },
// {
// icon: 'el-icon-folder',
// path: 'f021',
// id: '7',
// parent: '6',
// lasted: true,
// text:"转换名称路径5"
// },
// {
// icon: 'el-icon-folder',
// path: 'f40',
// id: '4',
// parent: '0',
// lasted: false,
// text:"转换名称路径6"
// },
// {
// icon: 'el-icon-folder',
// path: 'f41',
// id: '5',
// parent: '4',
// lasted: true,
// text:"转换名称路径7"
// }
// ],
jobTreeList
:[],
defaultProps
:
{
label
:
'
path
'
,
label
:
'
text
'
,
children
:
'children'
,
},
...
...
@@ -718,7 +738,9 @@ export default {
if
(
res
.
data
.
length
>
0
){
this
.
treeRevert
(
this
.
jobTreeList
);
//数据转换
}
}
}
this
.
treeRevert
(
this
.
jobTreeList
);
//数据转换
});
},
...
...
@@ -769,6 +791,7 @@ export default {
// let pid = cur.pid ? cur.pid : 0;
let
pid
=
cur
.
parent
?
cur
.
parent
:
0
;
let
parent
=
formatObj
[
pid
];
cur
.
disabled
=
!
cur
.
lasted
;
if
(
parent
)
{
parent
.
children
?
parent
.
children
.
push
(
cur
)
:
parent
.
children
=
[
cur
];
}
else
{
...
...
@@ -781,9 +804,29 @@ export default {
console
.
log
(
'树形数据============='
,
formatArray
);
this
.
jobTreeList
=
formatArray
;
},
handleCheckChange
(
data
,
checked
,
node
){
console
.
log
(
'节点是否选中:'
,
checked
);
if
(
checked
){
console
.
log
(
'选中节点信息1===:'
,
data
);
this
.
$refs
.
tree
.
setCheckedKeys
([
data
.
id
],
true
);
console
.
log
(
'选中后集合信息jobTreeList1=====:'
,
this
.
jobTreeList
);
this
.
currenSelectNodeId
=
data
.
id
;
//当前选择的作业的节点id
this
.
currenSelectNodePath
=
data
.
path
;
//当前选择的作业的节点路径
}
else
{
console
.
log
(
'选中节点信息2===:'
,
data
);
if
(
data
.
id
==
this
.
currenSelectNodeId
){
this
.
currenSelectNodeId
=
0
;
//当前选择的作业的节点id
this
.
currenSelectNodePath
=
''
;
//当前选择的作业的节点路径
}
console
.
log
(
'选中后集合信息jobTreeList2=====:'
,
this
.
jobTreeList
);
}
},
// nodeClick(data, checked){
// this.currenSelectNodeId=data.id;//当前选择的作业的节点id
// this.currenSelectNodePath=data.path;//当前选择的作业的节点路径
// this.$refs.tree.setCheckedKeys([data.id],true);
// },
// 选择会触发getname方法
getCheckedNodes
()
{
// 获取当节点的值
...
...
@@ -812,9 +855,13 @@ export default {
},
//确认选择当前作业
jobTreeConfirm
(){
if
(
this
.
currenSelectNodeId
){
this
.
treeDialogVisible
=
false
;
this
.
formOne
.
path
=
this
.
currenSelectNodePath
;
this
.
currenSelectNodeId
=
this
.
currenSelectNodeId
;
}
else
{
this
.
$message
.
error
(
"请选择作业!"
);
}
}
...
...
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