<script>
export default {
name: 'reqmdoctree',
data() {
return {
https:// 左侧搜索框内容
dirNameCn: '',
https:// 目录树选项
dirTreeOptions: undefined,
defaultProps: {
children: "children",
label: "label"
},
https:// 树形菜单中有无子节点
yesChild: undefined,
https:// 控制左侧新增提示信息框
show: 0,
https:// 查询需求文档信息参数
queryParams: {
docNo: undefined, https:// 文档编号
docNameEn: undefined, https:// 文档英文名称
dirNo: undefined,https:// 目录编号
current: 1, https:// 当前页数
size: 20 https:// 每页显示多少条
},
treeId: undefined,
}
},
methods: {
/** 查询需求目录下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.dirTreeOptions = response.data
})
},
https:// 搜索值为过滤函数
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
https:// 节点被点击时的回调函数
handleNodeClick(data) {
https:// console.log(data)
this.treeId = data.id
this.yesChild = data.children
this.queryParams.dirNo = data.id
this.getList()
},
https:// 树中三个点的事件
handleCommand(command) {
if (command == 'a') {
selectReqNo(this.treeId).then(response => {
this.uuid = response.msg
getObjTree(response.msg).then(response => {
this.form = response.data
this.open = true
this.title = '修改需求文档目录配置表'
})
})
}
if (command == 'b') {
if (this.yesChild != undefined) {
this.$notify.error({
title: '警告',
message: '此目录下还有别的文件夹'
})
} else {
selectReqNo(this.treeId).then(response => {
this.uuid = response.msg
this.$confirm('是否确认删除ID为' + this.uuid + '的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(()=>{
return delObjTree(this.uuid)
}).then(data => {
this.getTreeselect()
this.msgSuccess('删除成功')
}).catch(function() {
})
})
}
}
},
https:// 左侧新建目录/文件
addDial(node, data) {
https:// console.log(node, '---', data)
this.reset()
this.form.dirParentId = data.id
this.open = true
this.title = '添加需求文档目录配置表'
},
https:// 左侧鼠标悬浮展示图标
mouseenter(data){
this.$set(data, 'show', true)
},
https:// 左侧鼠标离开不展示图标
mouseleave(data){
this.$set(data, 'show', false)
},
https://打开新增资源弹窗 这里略......
}
}
</script>
说明:
参考文档:element UI、树形控件整合下拉选