浏览代码

青归柳叶新

lex-xin 4 年之前
父节点
当前提交
f8fdcbf72e
共有 1 个文件被更改,包括 17 次插入10 次删除
  1. 17 10
      src/views/categroyManager/insideSetting/staffManager.vue

+ 17 - 10
src/views/categroyManager/insideSetting/staffManager.vue

@@ -614,17 +614,24 @@ export default {
         let postDeptArr = []
         let postDeptArr = []
         if(data.postDeptIds) {
         if(data.postDeptIds) {
           const postDept = JSON.parse(data.postDeptIds) || []
           const postDept = JSON.parse(data.postDeptIds) || []
-          postDept.forEach(dept => {
-            let deptIds = dept.deptIds || []
-            let deptArr = []
-            deptIds.forEach(ds => {
-              deptArr.push(this.formatParentId(ds, this.deptList))
-            })
-            postDeptArr.push({
-              postId: dept.postId,
-              deptIds: deptArr
+          if(postDept.length > 0) {
+            postDept.forEach(dept => {
+              let deptIds = dept.deptIds || []
+              let deptArr = []
+              deptIds.forEach(ds => {
+                deptArr.push(this.formatParentId(ds, this.deptList))
+              })
+              postDeptArr.push({
+                postId: dept.postId,
+                deptIds: deptArr
+              })
             })
             })
-          })
+          } else {
+            postDeptArr = [{
+              postId: null,
+              deptIds: []
+            }]
+          }
         } else {
         } else {
           postDeptArr = [{
           postDeptArr = [{
             postId: null,
             postId: null,