Commit d609bd33 by 莫晓莉

树形菜单

parent e05bc478
......@@ -55,5 +55,15 @@ export function uploadRepositoryFile(data) {
method: 'post'
})
}
//获取作业的树形菜单
export function getJobTree(data) {
return request({
url: 'kettle/repository/getJobTree?repositoryId='+data,
data,
method: 'post'
})
}
......@@ -69,7 +69,7 @@ export function stop(data) {
//获取转换的树形菜单
export function getTransTree(data) {
return request({
url: 'kettle/repository/getTransTree',
url: 'kettle/repository/getTransTree?repositoryId='+data,
data,
method: 'post'
})
......
......@@ -118,7 +118,7 @@
</el-select>
</el-form-item>
<el-form-item label="作业:" >
<el-input @click.native="treeModal" :disabled="true" placeholder="请选择作业" v-model="currenSelectNodePath" class="input-length"></el-input>
<el-input @click.native="openTreeModal" :disabled="true" placeholder="请选择作业" v-model="currenSelectNodePath" class="input-length"></el-input>
</el-form-item>
<el-form-item label="作业名称:" prop="name">
<el-input placeholder="请输入作业名称" v-model="formOne.name" class="input-length"></el-input>
......@@ -300,7 +300,7 @@
<el-dialog
title="请选择作业"
:visible.sync="treeDialogVisible"
:before-close="jobTreeConfirm"
:before-close="closeTreeModal"
width="30%">
<el-tree
:data="jobTreeList"
......@@ -334,6 +334,7 @@ import {
start,//开始作业
stop,//停止作业
uploadRepositoryFile,//上传资源文件
getJobTree,//获取作业树形菜单
} from "@/api/task/homework";
import {
......@@ -435,48 +436,48 @@ 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,
}
// {
// 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,
// }
],
defaultProps: {
label: 'path',
......@@ -492,7 +493,7 @@ export default {
this.getList();//获取数据库资源库列表
this.getKettleQuartzList();//获取策略配置列表
this.setHeaders();
this.treeRevert(this.jobTreeList);
// this.treeRevert(this.jobTreeList);
},
methods: {
......@@ -593,11 +594,11 @@ export default {
}
},
// 树形结构弹窗
treeModal(){
this.treeDialogVisible = !this.treeDialogVisible;
console.log('打开作业弹窗显示当前选择的作业id---',this.currenSelectNodeId);
this.$refs.tree.setCheckedKeys([]);
},
// treeModal(){
// this.treeDialogVisible = !this.treeDialogVisible;
// console.log('打开作业弹窗显示当前选择的作业id---',this.currenSelectNodeId);
// this.$refs.tree.setCheckedKeys([]);
// },
//获取数据库资源库列表
getList() {
......@@ -726,6 +727,46 @@ export default {
this.pageInfo.page = e;
this.getKettleJobList();
},
//获取转换树形列表
getJobTree(){
getJobTree(this.formOne.repositoryId).then((res) => {
console.log('获取转换树形列表',res);
if(res.success){
this.jobTreeList = res.data;
if(res.data.length>0){
this.treeRevert(this.jobTreeList);//数据转换
}
}
});
},
//打卡树形结构弹窗
openTreeModal(){
this.getJobTree();
if(this.formOne.repositoryId){
if( this.jobTreeList.length>0){
this.treeDialogVisible = !this.treeDialogVisible;
}else{
this.$message.success("暂无数据!");
}
}else{
this.$message.error("请先选择资源库!");
}
},
//关闭树形结构弹窗
closeTreeModal(){
this.treeDialogVisible = !this.treeDialogVisible;
console.log('打开作业弹窗显示当前选择的作业id---',this.currenSelectNodeId);
this.$refs.tree.setCheckedKeys([]);
},
//数据转换
treeRevert(arrayList){
let formatObj = arrayList.reduce((pre, cur) => {
return {...pre, [cur['id']]: cur}
......
......@@ -111,7 +111,7 @@
</el-select>
</el-form-item>
<el-form-item label="转换:">
<el-input @click.native="treeModal" :disabled="true" placeholder="请选择作业" v-model="currenSelectNodePath" class="input-length"></el-input>
<el-input @click.native="openTreeModal" :disabled="true" placeholder="请选择作业" v-model="currenSelectNodePath" class="input-length"></el-input>
</el-form-item>
<el-form-item label="转换名称:" prop="name">
<el-input placeholder="请输入转换名称" v-model="formOne.name" class="input-length"></el-input>
......@@ -295,7 +295,7 @@
<el-dialog
title="请选择作业"
:visible.sync="treeDialogVisible"
:before-close="jobTreeConfirm"
:before-close="closeTreeModal"
width="30%">
<el-tree
:data="jobTreeList"
......@@ -471,7 +471,7 @@ export default {
this.getList();//获取数据库资源库列表
this.getKettleQuartzList();//获取策略配置列表
this.setHeaders();
this.getTransTree();//获取转换树形菜单
// this.getTransTree();//获取转换树形菜单
// this.treeRevert(this.jobTreeList);
},
......@@ -709,9 +709,9 @@ export default {
// "errCode": 0,
// "errMsg": "string",
// "success": true
//获取转换树形列表
getTransTree(){
getTransTree().then((res) => {
getTransTree(this.formOne.repositoryId).then((res) => {
console.log('获取转换树形列表',res);
if(res.success){
this.jobTreeList = res.data;
......@@ -722,11 +722,30 @@ export default {
});
},
// 树形结构弹窗
treeModal(){
//打卡树形结构弹窗
openTreeModal(){
this.getTransTree();
if(this.formOne.repositoryId){
if( this.jobTreeList.length>0){
this.treeDialogVisible = !this.treeDialogVisible;
}else{
this.$message.success("暂无数据!");
}
// console.log('打开作业弹窗显示当前选择的作业id---',this.currenSelectNodeId);
// this.$refs.tree.setCheckedKeys([]);
// this.getTransTree();
}else{
this.$message.error("请先选择资源库!");
}
},
//关闭树形结构弹窗
closeTreeModal(){
this.treeDialogVisible = !this.treeDialogVisible;
console.log('打开作业弹窗显示当前选择的作业id---',this.currenSelectNodeId);
this.$refs.tree.setCheckedKeys([]);
},
// 上传资源文件成功
uplodSuccess(response, file, fileList) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment