|
@@ -17,7 +17,8 @@
|
|
|
@current-change="currentChange"
|
|
@current-change="currentChange"
|
|
|
@size-change="sizeChange"
|
|
@size-change="sizeChange"
|
|
|
@refresh-change="refreshChange"
|
|
@refresh-change="refreshChange"
|
|
|
- @on-load="onLoad">
|
|
|
|
|
|
|
+ @on-load="onLoad"
|
|
|
|
|
+ @tree-load="treeLoad">
|
|
|
<template slot="menuLeft">
|
|
<template slot="menuLeft">
|
|
|
<el-button type="danger"
|
|
<el-button type="danger"
|
|
|
size="small"
|
|
size="small"
|
|
@@ -46,7 +47,7 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import {
|
|
import {
|
|
|
- getList,
|
|
|
|
|
|
|
+ getLazyList,
|
|
|
remove,
|
|
remove,
|
|
|
update,
|
|
update,
|
|
|
add,
|
|
add,
|
|
@@ -63,13 +64,16 @@
|
|
|
selectionList: [],
|
|
selectionList: [],
|
|
|
query: {},
|
|
query: {},
|
|
|
loading: true,
|
|
loading: true,
|
|
|
|
|
+ parentId: 0,
|
|
|
page: {
|
|
page: {
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
currentPage: 1,
|
|
currentPage: 1,
|
|
|
- total: 0
|
|
|
|
|
|
|
+ total: 0,
|
|
|
},
|
|
},
|
|
|
option: {
|
|
option: {
|
|
|
|
|
+ lazy: true,
|
|
|
tip: false,
|
|
tip: false,
|
|
|
|
|
+ searchShow: false,
|
|
|
tree: true,
|
|
tree: true,
|
|
|
border: true,
|
|
border: true,
|
|
|
index: true,
|
|
index: true,
|
|
@@ -196,12 +200,22 @@
|
|
|
return ids.join(",");
|
|
return ids.join(",");
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ created() {
|
|
|
|
|
+ this.initData();
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ initData() {
|
|
|
|
|
+ getDeptTree().then(res => {
|
|
|
|
|
+ const data = res.data.data;
|
|
|
|
|
+ const index = this.$refs.crud.findColumnIndex("parentId");
|
|
|
|
|
+ this.option.column[index].dicData = data;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
handleAdd(row) {
|
|
handleAdd(row) {
|
|
|
this.$refs.crud.value.parentId = row.id;
|
|
this.$refs.crud.value.parentId = row.id;
|
|
|
this.$refs.crud.option.column.filter(item => {
|
|
this.$refs.crud.option.column.filter(item => {
|
|
|
if (item.prop === "parentId") {
|
|
if (item.prop === "parentId") {
|
|
|
- item.valueDefault = row.id;
|
|
|
|
|
|
|
+ item.value = row.id;
|
|
|
item.addDisabled = true;
|
|
item.addDisabled = true;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -274,12 +288,15 @@
|
|
|
},
|
|
},
|
|
|
searchReset() {
|
|
searchReset() {
|
|
|
this.query = {};
|
|
this.query = {};
|
|
|
|
|
+ this.parentId = 0;
|
|
|
this.onLoad(this.page);
|
|
this.onLoad(this.page);
|
|
|
},
|
|
},
|
|
|
- searchChange(params) {
|
|
|
|
|
|
|
+ searchChange(params, done) {
|
|
|
this.query = params;
|
|
this.query = params;
|
|
|
this.page.currentPage = 1;
|
|
this.page.currentPage = 1;
|
|
|
|
|
+ this.parentId = '';
|
|
|
this.onLoad(this.page, params);
|
|
this.onLoad(this.page, params);
|
|
|
|
|
+ done();
|
|
|
},
|
|
},
|
|
|
selectionChange(list) {
|
|
selectionChange(list) {
|
|
|
this.selectionList = list;
|
|
this.selectionList = list;
|
|
@@ -301,7 +318,7 @@
|
|
|
this.$refs.crud.value.addDisabled = false;
|
|
this.$refs.crud.value.addDisabled = false;
|
|
|
this.$refs.crud.option.column.filter(item => {
|
|
this.$refs.crud.option.column.filter(item => {
|
|
|
if (item.prop === "parentId") {
|
|
if (item.prop === "parentId") {
|
|
|
- item.valueDefault = "";
|
|
|
|
|
|
|
+ item.value = "";
|
|
|
item.addDisabled = false;
|
|
item.addDisabled = false;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -318,16 +335,17 @@
|
|
|
},
|
|
},
|
|
|
onLoad(page, params = {}) {
|
|
onLoad(page, params = {}) {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
|
|
|
|
|
|
+ getLazyList(this.parentId, Object.assign(params, this.query)).then(res => {
|
|
|
this.data = res.data.data;
|
|
this.data = res.data.data;
|
|
|
- getDeptTree().then(res => {
|
|
|
|
|
- const data = res.data.data;
|
|
|
|
|
- const index = this.$refs.crud.findColumnIndex("parentId");
|
|
|
|
|
- this.option.column[index].dicData = data;
|
|
|
|
|
- });
|
|
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
this.selectionClear();
|
|
this.selectionClear();
|
|
|
});
|
|
});
|
|
|
|
|
+ },
|
|
|
|
|
+ treeLoad(tree, treeNode, resolve) {
|
|
|
|
|
+ const parentId = tree.id;
|
|
|
|
|
+ getLazyList(parentId).then(res => {
|
|
|
|
|
+ resolve(res.data.data);
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|