+ class="widget-box">
+ :default-expanded-keys="['00000000-0000-0001-0000-000000000000']"
+ @node-click="deptTreeClick"
+ />
-
-
+
+
+
+
+
+
+
+
+ check-strictly class="tree"/>
-
+
-
- 确 定
-
@@ -64,9 +86,11 @@
import {
GetDeptTree,
DeleteDept,
+ DeptList,
GetDeptDetail,
AddDept,
UpdateDept,
+ getObj,
} from '@/api/system/dept';
import {
@@ -77,15 +101,11 @@ export default {
name: 'Dept',
data() {
return {
-
+ deptoptions: [],
+ status: 'create',
deptList: null,
unitList: null,
- temp: {
- id: '',
- deptname: '',
- rank: '',
- isdeleted: false,
- },
+ temp: null,
defaultProps: {
children: 'children',
label: 'nodeName',
@@ -94,12 +114,23 @@ export default {
},
created() {
+ getObj().then((res) => {
+ this.temp = res.data
+ })
+ DeptList().then((res) => {
+ this.deptoptions = res.data.list;
+ })
this.fetchDept()
this.fetchUnit()
},
methods: {
-
+ clearObj() {
+ Object.keys(this.temp).forEach((key) => {
+ this.temp[key] = ''
+ })
+ this.status = 'create'
+ },
fetchDept() {
GetDeptTree().then((response) => {
this.deptList = response.data;
@@ -111,15 +142,19 @@ export default {
this.unitList = response.data;
});
},
+ deptTreeClick(obj) {
+ this.status = 'update'
+ this.Edit(obj.id)
+ },
- Delete(id) {
+ Delete() {
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
- DeleteDept(id).then(() => {
+ DeleteDept(this.temp.id).then(() => {
this.fetchDept()
})
})
@@ -129,17 +164,28 @@ export default {
this.temp = response.data;
});
},
- create() {
- AddDept(this.temp).then(() => {
- this.fetchDept();
- });
- },
- update() {
- UpdateDept(this.temp).then(() => {
- this.fetchDept();
- });
+ save() {
+ if (this.status === 'create') {
+ AddDept(this.temp).then(() => {
+ this.fetchDept();
+ })
+ } else {
+ UpdateDept(this.temp).then(() => {
+ this.fetchDept();
+ })
+ }
},
},
};
+
+
diff --git a/src/views/system/users.vue b/src/views/system/users.vue
index 4539ce8..3b7afad 100644
--- a/src/views/system/users.vue
+++ b/src/views/system/users.vue
@@ -128,10 +128,12 @@