From 8aa50a7724ca20f45c8e0460ec940a00f1c07fcb Mon Sep 17 00:00:00 2001
From: zichen1019 <1510748736@qq.com>
Date: Wed, 25 Aug 2021 21:53:14 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=91=E5=AE=A4=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E5=90=8E=E6=8A=A5=E9=94=99=EF=BC=8C=E4=BB=A5=E5=8F=8A?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8A=E7=BA=A7=E7=A7=91=E5=AE=A4=E5=AD=97?=
=?UTF-8?q?=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/user/department.vue | 39 ++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/src/views/user/department.vue b/src/views/user/department.vue
index 0a5f5d9..0451d2f 100644
--- a/src/views/user/department.vue
+++ b/src/views/user/department.vue
@@ -84,6 +84,11 @@
+
+
+
+
+
@@ -134,15 +139,31 @@ export default {
multipleSelection: [],
isIndeterminate: true,
sbzlList: [],
- areas: []
+ areas: [],
+ departmentAll: []
+ }
+ },
+ computed: {
+ departments: function() {
+ return this.departmentAll.filter(row => row.id !== this.tempDepartment.id)
}
},
created() {
this.getList()
this.getSbzlList()
this.getArea()
+ this.getAllDepartment()
},
methods: {
+ getAllDepartment() {
+ this.api({
+ url: '/department/all',
+ method: 'get'
+ }).then(data => {
+ this.departmentAll = [{ id: 0, name: '顶级科室' }]
+ this.departmentAll = this.departmentAll.concat(data)
+ })
+ },
getSbzlList() {
this.api({
url: '/sedirectory/getList',
@@ -181,7 +202,9 @@ export default {
},
showCreate() {
this.leaders = this.$store.getters.allUser
- this.tempDepartment = {}
+ this.tempDepartment = {
+ parentId: 0
+ }
this.getUserListByDepartmentIdOrNull(0)
this.dialogStatus = 'create'
this.dialogFormVisible = true
@@ -189,9 +212,9 @@ export default {
showUpdate(item) {
this.leaders = this.$store.getters.allUser
this.tempDepartment = item
- this.tempDepartment.quhuadaima = item.quhuadaima.split(',')
- this.tempDepartment.shebeizhongleidaima = item.shebeizhongleidaima.split(',')
- this.tempDepartment.jianyanleibie = item.jianyanleibie.split(',')
+ this.tempDepartment.quhuadaima = item.quhuadaima && item.quhuadaima.split(',')
+ this.tempDepartment.shebeizhongleidaima = item.shebeizhongleidaima && item.shebeizhongleidaima.split(',')
+ this.tempDepartment.jianyanleibie = item.jianyanleibie && item.jianyanleibie.split(',')
this.getUserListByDepartmentIdOrNull(item.id)
this.getUserListByDepartmentId(item.id)
this.dialogStatus = 'update'
@@ -227,9 +250,9 @@ export default {
const form = {}
form.department = this.tempDepartment
form.userIds = this.departmentUserList
- form.department.quhuadaima = form.department.quhuadaima.toString()
- form.department.shebeizhongleidaima = form.department.shebeizhongleidaima.toString()
- form.department.jianyanleibie = form.department.jianyanleibie.toString()
+ form.department.quhuadaima = form.department.quhuadaima && form.department.quhuadaima.toString()
+ form.department.shebeizhongleidaima = form.department.shebeizhongleidaima && form.department.shebeizhongleidaima.toString()
+ form.department.jianyanleibie = form.department.jianyanleibie && form.department.jianyanleibie.toString()
this.$refs['tempDepartment'].validate(valid => {
if (valid) {
addDepartmentFn(form).then(() => {