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
6e9f37ae
Commit
6e9f37ae
authored
Mar 27, 2021
by
莫晓莉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
66
parent
02ab02eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
175 additions
and
0 deletions
+175
-0
src/views/dialogs-components/global/file-tree/index.js
+3
-0
src/views/dialogs-components/global/file-tree/main.vue
+172
-0
No files found.
src/views/dialogs-components/global/file-tree/index.js
0 → 100644
View file @
6e9f37ae
import
main
from
'./main.vue'
export
default
main
\ No newline at end of file
src/views/dialogs-components/global/file-tree/main.vue
0 → 100644
View file @
6e9f37ae
<
template
>
<div>
<!-- 浏览 -->
<el-dialog
title=
"文件夹浏览器"
:visible
.
sync=
"fileDialogVisible"
width=
"650px"
top=
"15%"
:close-on-click-modal=
"false"
:before-close=
"handleClose"
v-if=
"fileDialogVisible"
>
<!-- 文件夹区域start-->
<el-tree
:data=
"fileTreeList"
lazy
:load=
"loadDataTree"
:auto-expand-parent=
"true"
:default-expand-all=
"false"
node-key=
"id"
ref=
"tree"
:props=
"defaultProps"
:highlight-current=
"true"
@
node-click=
"handleNodeClick"
>
<span
class=
"custom-tree-node"
slot-scope=
"
{ node, data }">
<span
style=
"display: flex; align: center"
>
<div
:class=
"data.iconCls"
style=
"
display: inline-block;
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center;
"
width=
""
alt=
""
></div>
{{
node
.
label
}}
</span>
</span>
</el-tree>
<!-- 文件夹区域end -->
<!--
<el-select
v-model=
"allValue"
style=
"width: 100%"
>
<el-option
v-for=
"(item,index) in allTreeList"
:key=
"index"
:label=
"item.desc"
:value=
"item.type"
></el-option>
</el-select>
-->
<span
slot=
"footer"
class=
"dialog-footer"
style=
"display:flex;"
>
<el-select
v-model=
"allValue"
style=
"width: 100%;margin-right:15px;"
>
<el-option
v-for=
"(item,index) in allTreeList"
:key=
"index"
:label=
"item.desc"
:value=
"item.type"
></el-option>
</el-select>
<el-button
@
click=
"handleClose"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"confirmChoose()"
>
确 定
</el-button>
</span>
</el-dialog>
</div>
</
template
>
<
script
>
import
{
getFileexplorer
,
getFilextension
}
from
"@/api/kettle/file"
;
export
default
{
name
:
"file-tree"
,
data
()
{
return
{
allValue
:
''
,
allTreeList
:[],
//所有文件
defaultProps
:
{
label
:
"text"
,
children
:
"children"
,
},
checkedArr
:[],
fileTreeList
:[],
//文件树列表
fileTreeListResolve
:[],
//
curChooseNode
:
null
,
//当前选择的节点
}
},
props
:
{
fileDialogVisible
:
Boolean
,
excelForm
:
Object
,
formName
:
String
,
// listNames: Function, //父传过来的方法
},
created
()
{
this
.
getFilextension
();
//获取所有文件
},
methods
:
{
// 获取文件树
getFileTreeList
(
path
,
node
){
var
formData
=
new
FormData
();
formData
.
append
(
"path"
,
path
);
formData
.
append
(
"extension"
,
0
);
formData
.
append
(
"node"
,
node
);
getFileexplorer
(
formData
).
then
((
res
)
=>
{
if
(
res
)
{
if
(
path
==
''
){
console
.
log
(
'1111111111111111'
);
this
.
fileTreeList
=
res
;
}
else
{
console
.
log
(
'222222222222'
);
this
.
fileTreeListResolve
=
res
}
}
else
{
this
.
$message
.
error
(
res
.
errMsg
);
}
});
},
loadDataTree
(
node
,
resolve
)
{
console
.
log
(
"node===="
,
node
,
"resolve-----------"
,
resolve
);
if
(
node
.
level
===
0
)
{
var
par
=
''
;
this
.
getFileTreeList
(
par
,
'xnode-5140'
);
return
resolve
(
this
.
fileTreeList
);
}
else
{
var
path
=
node
.
data
.
id
;
var
node
=
node
.
data
.
id
;;
this
.
getFileTreeList
(
path
,
node
);
resolve
(
this
.
fileTreeListResolve
);
}
},
// 获取所有文件
getFilextension
(){
var
formData
=
new
FormData
();
formData
.
append
(
"query"
,
''
);
formData
.
append
(
"extension"
,
0
);
getFilextension
(
formData
).
then
((
res
)
=>
{
if
(
res
)
{
this
.
allTreeList
=
res
;
}
else
{
this
.
$message
.
error
(
res
.
errMsg
);
}
});
},
// 点击选择当前节点
handleNodeClick
(
data
,
node
){
console
.
log
(
'点击当前节点node==='
,
node
);
console
.
log
(
'点击当前节点data==='
,
data
);
// var arr=[{node:node}]
this
.
curChooseNode
=
node
;
// this.$emit("getSonValue", this.curChooseNode); //组件要传回父组件的值,关闭弹窗
},
confirmChoose
()
{
var
curName
=
this
.
formName
;
this
.
excelForm
[
curName
]
=
this
.
curChooseNode
.
data
.
id
;
this
.
$emit
(
"excelForm"
,
this
.
excelForm
);
this
.
$emit
(
"update:fileDialogVisible"
,
false
);
},
handleClose
()
{
this
.
$emit
(
"update:fileDialogVisible"
,
false
);
},
},
};
</
script
>
<
style
>
.type-checked
{
background-color
:
#8888ff
;
color
:
#fff
;
}
</
style
>
\ No newline at end of file
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