fix dept tree

This commit is contained in:
smallwei 2019-02-15 15:19:23 +08:00
parent d0c6870478
commit e855fc1ef6
3 changed files with 23 additions and 3 deletions

View File

@ -48,3 +48,10 @@ export const getDept = (id) => {
} }
}) })
} }
export const getDeptTree = () => {
return request({
url: 'api/blade-system/dept/tree',
method: 'get'
})
}

View File

@ -33,7 +33,14 @@
</template> </template>
<script> <script>
import { getList, remove, update, add, getDept } from "@/api/system/dept"; import {
getList,
remove,
update,
add,
getDept,
getDeptTree
} from "@/api/system/dept";
export default { export default {
data() { data() {
return { return {
@ -64,7 +71,7 @@ export default {
{ {
label: "上级部门", label: "上级部门",
prop: "parentId", prop: "parentId",
dicUrl: "api/blade-system/dept/tree", dicData: [],
type: "tree", type: "tree",
hide: true, hide: true,
props: { props: {
@ -171,6 +178,11 @@ export default {
getList(page.currentPage, page.pageSize, params).then(res => { getList(page.currentPage, page.pageSize, params).then(res => {
const data = res.data.data; const data = res.data.data;
this.data = data; this.data = data;
getDeptTree().then(res => {
const data = res.data.data;
const index = this.$refs.crud.findColumnIndex("parentId");
this.option.column[index].dicData = data;
});
}); });
} }
} }

View File

@ -183,7 +183,8 @@ export default {
this.data = data; this.data = data;
getDictTree().then(res => { getDictTree().then(res => {
const data = res.data.data; const data = res.data.data;
this.option.column[2].dicData = data; const index = this.$refs.crud.findColumnIndex("parentId");
this.option.column[index].dicData = data;
}); });
}); });
} }