|
@@ -58,7 +58,7 @@
|
|
|
ref="crud"
|
|
|
@selection-change="selectionChange"
|
|
|
:page.sync="page"
|
|
|
-
|
|
|
+ :table-loading="tabloading"
|
|
|
@on-load="onLoad"
|
|
|
>
|
|
|
|
|
@@ -82,7 +82,7 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
<template slot="menuLeft" slot-scope="{size}">
|
|
|
- <el-input placeholder="请输入你想搜索的表单名称" v-model="input3" :size="size" clearable>
|
|
|
+ <el-input placeholder="请输入你想搜索的表单名称" v-model="input3" :size="size" clearable @clear="clearinput">
|
|
|
<i class="el-icon-search" slot="append" @click="searchChange"></i>
|
|
|
</el-input>
|
|
|
</template>
|
|
@@ -247,6 +247,7 @@ export default {
|
|
|
},
|
|
|
search:{},
|
|
|
loading:false,
|
|
|
+ tabloading:false,
|
|
|
dialogVisible: false,
|
|
|
obj: {},
|
|
|
data: [],
|
|
@@ -439,106 +440,108 @@ export default {
|
|
|
|
|
|
async treeLoad1 () {
|
|
|
let id = 12345678910
|
|
|
+ this.loading=true
|
|
|
let das = await this.tabTypeLazyTree(id, this.projectid,this.page.current,this.page.size)
|
|
|
console.log(this.projectid,'projectid');
|
|
|
this.data=das.records
|
|
|
+ this.loading=false
|
|
|
// return resolve(das.records)
|
|
|
},
|
|
|
//#region 接口
|
|
|
async tabTypeLazyTree (parentId, projectId,current,size,titleName) {//清表树
|
|
|
console.log(parentId, projectId);
|
|
|
+ this.loading=true;
|
|
|
const { data: res } = await tabTypeLazyTree({ parentId, projectId,current,size,titleName })
|
|
|
- console.log(res);
|
|
|
+ this.loading=false;
|
|
|
if (res.code === 200) {
|
|
|
- return res.data
|
|
|
+ return res.data;
|
|
|
}
|
|
|
},
|
|
|
loadNode(node, resolve) {
|
|
|
const parentId = (node.level === 0) ? 12345678910 : node.data.id;
|
|
|
- tabTypeLazyTree({parentId,projectId:this.projectid,current:1,size:1000}).then(res => {
|
|
|
- resolve(res.data.data.records.map(item => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- leaf: !item.hasChildren
|
|
|
- }
|
|
|
- }))
|
|
|
- });
|
|
|
+ this.tabTypeLazyTree(parentId,this.projectid,this.page.current,this.page.size).then(res=>{
|
|
|
+ resolve(res.records.map(item=>{
|
|
|
+ return{
|
|
|
+ ...item,
|
|
|
+ leaf: !item.hasChildren
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ })
|
|
|
},
|
|
|
- searchChange(){
|
|
|
- if(this.treeId){
|
|
|
- this.tabTypeLazyTree(this.treeId, this.projectid,this.page.current,this.page.size,this.input3).then((res)=>{
|
|
|
- this.loadData=res.records
|
|
|
- this.page.total=res.total
|
|
|
-
|
|
|
- })
|
|
|
- }else{
|
|
|
- this.$message.warning("请选选择左侧节点");
|
|
|
- }
|
|
|
+ searchChange(){
|
|
|
+ if(this.treeId){
|
|
|
+ this.onLoad1()
|
|
|
+ }else{
|
|
|
+ this.$message.warning("请先选择左侧节点");
|
|
|
+ }
|
|
|
},
|
|
|
- onLoad(page){
|
|
|
- console.log(page,'page');
|
|
|
- console.log(this.projectid,'this.projectid');
|
|
|
- if(this.treeId){
|
|
|
- this.tabTypeLazyTree(this.treeId,this.projectid, page.currentPage,page.pageSize).then((res)=>{
|
|
|
- this.loadData=res.records
|
|
|
- this.page.total=res.total
|
|
|
- })
|
|
|
- }
|
|
|
+ clearinput(){
|
|
|
+ this.searchChange()
|
|
|
},
|
|
|
- // onLoad1(){
|
|
|
- // if(this.treeId){
|
|
|
- // this.tabTypeLazyTree(this.treeId,this.projectid, this.page.current,this.page.size).then((res)=>{
|
|
|
- // this.loadData=res.records
|
|
|
- // this.page.total=res.total
|
|
|
- // })
|
|
|
- // }
|
|
|
- // },
|
|
|
- //编辑后刷新
|
|
|
onLoad1(){
|
|
|
- // console.log(this.level,'1111111111');
|
|
|
- if(this.curNode.level===1&&this.curNode.data.hasChildren){
|
|
|
- this.tabTypeLazyTree(this.treeId,this.projectid, this.page.current,this.page.size).then((res)=>{
|
|
|
+
|
|
|
+ if(this.curTreeData.hasChildren){
|
|
|
+ this.tabloading=true;
|
|
|
+ this.tabTypeLazyTree(this.curTreeData.id, this.projectid, this.page.current,this.page.size,this.input3).then((res)=>{
|
|
|
+ console.log(res.records);
|
|
|
+ this.loadData=res.records;
|
|
|
+ this.page.total=res.total;
|
|
|
+ this.tabloading=false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(this.curTreeData.hasChildren===false&&this.curNode.level==2){
|
|
|
+ this.tabloading=true;
|
|
|
+ let arr=[]
|
|
|
+ arr.push(this.curTreeData)
|
|
|
+ this.loadData=arr
|
|
|
+ this.page.total=1
|
|
|
+ setTimeout(() => {
|
|
|
+ this.tabloading=false
|
|
|
+
|
|
|
+ }, 1000);
|
|
|
+ }else{
|
|
|
+ this.loadData=[]
|
|
|
+ this.page.total=0
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ onLoad(page){
|
|
|
+ if(this.treeId){
|
|
|
+ this.tabloading=true
|
|
|
+ this.tabTypeLazyTree(this.treeId,this.projectid, page.currentPage,page.pageSize,this.input3).then((res)=>{
|
|
|
this.loadData=res.records
|
|
|
this.page.total=res.total
|
|
|
+ this.tabloading=false
|
|
|
+
|
|
|
})
|
|
|
- }else{
|
|
|
- this.tabTypeLazyTree(this.treeId,this.projectid, this.page.current,this.page.size).then((res)=>{
|
|
|
- let faArr=res.records;
|
|
|
- this.loadData=faArr.filter((item)=>{
|
|
|
- if(item.id===this.treeId){
|
|
|
- return item
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
}
|
|
|
- // this.refreshTreeData()
|
|
|
- },
|
|
|
- resetChange(item){
|
|
|
- console.log(item);
|
|
|
- this.tabTypeLazyTree(this.treeId, this.projectid,this.page.current,this.page.size).then((res)=>{
|
|
|
- console.log(res.records);
|
|
|
- this.loadData=res.records;
|
|
|
- this.page.total=res.total
|
|
|
-
|
|
|
- })
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
nodeClick (data,node) {//外层树结构
|
|
|
console.log(data,node,'treedata');
|
|
|
this.curNode=node
|
|
|
this.treeId=data.id
|
|
|
this.curTreeData=data
|
|
|
if(data.hasChildren){
|
|
|
+ this.tabloading=true;
|
|
|
this.tabTypeLazyTree(data.id, this.projectid,this.page.current,this.page.size).then((res)=>{
|
|
|
console.log(res.records);
|
|
|
this.loadData=res.records;
|
|
|
- this.page.total=res.total
|
|
|
+ this.page.total=res.total;
|
|
|
+ this.tabloading=false;
|
|
|
})
|
|
|
}
|
|
|
if(data.hasChildren===false&&node.level==2){
|
|
|
+ this.tabloading=true;
|
|
|
let arr=[]
|
|
|
arr.push(data)
|
|
|
this.loadData=arr
|
|
|
this.page.total=1
|
|
|
+ setTimeout(() => {
|
|
|
+ this.tabloading=false
|
|
|
+
|
|
|
+ }, 1000);
|
|
|
}else{
|
|
|
this.loadData=[]
|
|
|
this.page.total=0
|