scorpioyq 2 tahun lalu
induk
melakukan
a56514bd7f
1 mengubah file dengan 9 tambahan dan 1 penghapusan
  1. 9 1
      src/views/user/manage.vue

+ 9 - 1
src/views/user/manage.vue

@@ -294,6 +294,12 @@ export default {
             this.userInfoForm.roleIds = temp
           }
         })
+        this.deptList.find(e => {
+          const dp = this.form.deptId.split(',').find(sub => sub === e.id)
+          if (dp) {
+            this.userInfoForm.deptId = dp
+          }
+        })
         // this.form.deptId.split(',').forEach(ele => {
         //   const tmp = this.deptList.findIndex(sub => sub.id === ele)
         //   console.log(tmp)
@@ -359,7 +365,9 @@ export default {
     },
     roleSave() {
       let data = this.userInfoForm
-      data.deptIds = data.deptIds.join(',')
+      if (data.deptIds.length > 0) {
+        data.deptIds = data.deptIds.join(',')
+      }
       this.$api.role.roleSave(data).then(res => {
         if (res.code === 200) {
           this.showEdit = false