{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\views\\app\\selParticipants.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\views\\app\\selParticipants.vue","mtime":1667327529934},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\babel.config.js","mtime":1667327525434},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import _toConsumableArray from \"D:/jenkins/workspace/xq-web-fvue/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.function.name\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { Message } from 'element-ui';\nexport default {\n  data: function data() {\n    return {\n      checkAll: [],\n      checkedUser: [],\n      deptList: [],\n      userList: [],\n      childUserList: [],\n      totalUsers: [],\n      searchUsers: [],\n      users: [],\n      deptUsers: [],\n      isIndeterminate: [],\n      value: [],\n      isActive: [],\n      deptIdList: [],\n      childDept: [],\n      isActive2: false,\n      currentHandleCheckIndex: 0,\n      isSearch: false,\n      searchVal: '',\n      beforeCheckLength: 0,\n      beforeCheckList: [],\n      totalCheckedUsers: [],\n      beforeCheckedValue: []\n    };\n  },\n  beforeRouteEnter: function beforeRouteEnter(to, from, next) {\n    next(function (vm) {\n      // 通过 `vm` 访问组件实例,将值传入fromPath\n      vm.fromPath = from.path;\n\n      if (from.name == 'selDeptUsers') {\n        console.log(to); // let deptUsers = to.query.deptUsers\n\n        var deptUsers = JSON.parse(localStorage.getItem('deptUsers')); // console.log(deptUsers, 'deptUsers')\n        // let deptId = to.query.deptId\n\n        var deptId = JSON.parse(localStorage.getItem('deptId')); // if (deptUsers != undefined && deptId != undefined) {\n\n        if (true) {\n          //更新对于userid用户isChecked\n          vm.childUserList.forEach(function (u) {\n            deptUsers.forEach(function (du) {\n              if (u.userId == du.userId) {\n                u.isChecked = du.isChecked;\n              }\n            });\n          });\n          console.log(vm.childUserList, 'vm.childUserList'); //判断是否全选\n\n          var isCheckAll = deptUsers.filter(function (item) {\n            return item.isChecked == true;\n          }); // console.log(deptUsers.length,isCheckAll.length,'vm.value')\n\n          if (deptUsers.length == isCheckAll.length) {\n            vm.value.push(deptId); // console.log(vm.value,'vm.value')\n\n            vm.deptList.forEach(function (item) {\n              if (item.id == deptId) {\n                item.isChecked = true;\n              }\n            });\n            console.log(vm.deptList, 'vm.deptList');\n          } else {\n            var index = vm.value.indexOf(deptId);\n            if (index != -1) vm.value.splice(index, 1);\n          }\n        }\n\n        console.log(vm.userList, 'this.userList');\n      }\n    });\n  },\n  created: function created() {\n    var _this = this;\n\n    var userList = this.$route.query.userList;\n\n    if (userList == undefined) {\n      var deptUrl = \"http://183.230.176.125:8896/api/org/v1/org/getOrgListByDemId?demId=1258608622670319616\";\n      this.$http.get(deptUrl).then(function (res) {\n        console.log(res, 'res');\n\n        if (res.status == 200) {\n          var totalDeptList = res.data;\n          _this.deptList = totalDeptList;\n          totalDeptList.forEach(function (item) {\n            if (item.parentId != '0') {\n              item.isChecked = false;\n\n              _this.childDept.push(item);\n            }\n          });\n          var url = \"http://183.230.176.125:8896/api/user/v1/users/getOrgUserQuery\";\n\n          _this.$http.post(url, {\n            groupRelation: 'AND',\n            groupTree: {},\n            pageBean: {\n              page: 1,\n              pageSize: 100,\n              showTotal: true\n            },\n            params: {},\n            querys: [{\n              property: 'ORG_ID_',\n              value: totalDeptList[0].id,\n              group: 'orgTree',\n              relation: 'AND',\n              operation: 'IN'\n            }],\n            sorter: []\n          }).then(function (res) {\n            var userList = res.data.rows; // console.log(res, 'res')\n\n            if (res.status == 200) {\n              userList.forEach(function (item) {\n                item.isChecked = false; //  console.log(JSON.parse(totalDeptList[0]).id ,'totalDeptList[0].id')\n\n                _this.userList.push(item);\n\n                _this.totalUsers.push(item);\n              });\n\n              _this.childDept.forEach(function (item) {\n                // let dept = {\n                //   id: item.id,\n                //   fullname: item.name,\n                //   isChecked: false,\n                // }\n                // this.userList.push(dept)\n                _this.$http.post(url, {\n                  groupRelation: 'AND',\n                  groupTree: {},\n                  pageBean: {\n                    page: 1,\n                    pageSize: 100,\n                    showTotal: true\n                  },\n                  params: {},\n                  querys: [{\n                    property: 'ORG_ID_',\n                    value: item.id,\n                    group: 'orgTree',\n                    relation: 'AND',\n                    operation: 'IN'\n                  }],\n                  sorter: []\n                }).then(function (res) {\n                  var userList = res.data.rows;\n\n                  if (res.status == 200) {\n                    userList.forEach(function (item2) {\n                      item2.isChecked = false;\n                      item2.department = [item.id]; //  console.log(JSON.parse(totalDeptList[0]).id ,'totalDeptList[0].id')\n\n                      _this.childUserList.push(item2);\n\n                      _this.totalUsers.push(item2);\n                    }); // this.childUserList[index].forEach((e, i) => {\n                    //   this.users.push(e.name)\n                    // })\n                  } else {\n                    Message.error(res.data.errmsg);\n                  }\n                });\n              }); // this.childUserList[index].forEach((e, i) => {\n              //   this.users.push(e.name)\n              // })\n\n            } else {\n              Message.error(res.data.errmsg);\n            }\n          }); // console.log(this.deptList, 'this.deptList')\n\n\n          _this.childDept.forEach(function (item) {\n            _this.checkAll.push(false);\n\n            _this.isIndeterminate.push(false);\n\n            _this.deptIdList.push(item.id);\n          }); // let rootId = 1\n          // totalDeptList.forEach(e=>{\n          //   if(e.parentid == 0){\n          //     rootId = e.id\n          //   }\n          // })\n\n        }\n      });\n      console.log(this.userList, 'this.userList');\n    } else {\n      this.userList = userList;\n    } // this.userList.forEach(e => {\n    //   this.users.push(e.name)\n    // })\n\n\n    this.$bus.on('setAllUnCheck', function () {\n      _this.userList.forEach(function (item) {\n        item.isChecked = false;\n      });\n    });\n  },\n  methods: {\n    handleCheckedUserChange: function handleCheckedUserChange(value) {\n      var _this2 = this;\n\n      console.log(value, 'value');\n      var valueLength = value.length;\n      var beforeValueLength = this.beforeCheckedValue.length; //取消选择\n\n      if (valueLength < beforeValueLength) {\n        var cancelId = this.beforeCheckedValue[beforeValueLength - 1]; // 取消底部框名字\n\n        var isChildDeptUser = false;\n        this.childDept.forEach(function (e) {\n          if (e.id == cancelId) {\n            isChildDeptUser = true;\n          }\n        });\n\n        if (isChildDeptUser) {\n          // 取消的为子部门\n          this.childUserList.forEach(function (e, i) {\n            if (e.department.indexOf(cancelId) != -1) {\n              _this2.childUserList[i].isChecked = false;\n            }\n          });\n          console.log(this.childUserList, 'this.childUserList');\n        } else {\n          // 取消的为用户\n          this.userList.forEach(function (e, i) {\n            if (e.id == cancelId) {\n              _this2.userList[i].isChecked = false;\n            }\n          });\n        }\n      }\n\n      var deptIdList = this.deptList.filter(function (item) {\n        return item.id;\n      }); // console.log(deptIdList, 'deptIdList')\n      //判断部门下有无成员\n\n      if (deptIdList.indexOf(value[value.length - 1])) {\n        this.childDept.forEach(function (item) {\n          if (item.id == value[value.length - 1] && item.length == 0) {\n            Message('当前部门无成员');\n            value.pop();\n          }\n        });\n      } //全选部门成员\n\n\n      this.childDept.forEach(function (dept) {\n        if (dept.id == value[value.length - 1]) {\n          _this2.childUserList.forEach(function (user) {\n            if (user.department.indexOf(dept.id) != -1) {\n              user.isChecked = true;\n            }\n          });\n        }\n      }); // let currentNode = value[value.length - 1]\n      // this.userList[this.userList.indexOf(currentNode)].isChecked = true\n      // console.log(this.childUserList, 'childUserList')\n\n      this.beforeCheckedValue = value;\n      this.value = value;\n      this.totalCheckedUsers = [].concat(_toConsumableArray(this.userList.filter(function (item) {\n        return item.isChecked;\n      })), _toConsumableArray(this.childUserList.filter(function (item) {\n        return item.isChecked;\n      }))).reverse();\n      console.log(this.totalCheckedUsers, 'totalCheckedUsers');\n    },\n    handleCheckedSearchUserChange: function handleCheckedSearchUserChange(val) {\n      var lastId = val[val.length - 1];\n\n      if (this.beforeCheckLength < val.length) {\n        this.userList.forEach(function (item) {\n          if (lastId == item.id) {\n            item.isChecked = true;\n          }\n        });\n        this.childUserList.forEach(function (item) {\n          if (lastId == item.id) {\n            item.isChecked = true;\n          }\n        });\n      }\n\n      var lastId2 = this.beforeCheckList[this.beforeCheckList.length - 1];\n\n      if (this.beforeCheckLength > val.length) {\n        this.userList.forEach(function (item) {\n          if (lastId2 == item.id) {\n            item.isChecked = false;\n          }\n        });\n        this.childUserList.forEach(function (item) {\n          if (lastId2 == item.id) {\n            item.isChecked = false;\n          }\n        });\n      }\n\n      this.beforeCheckList = val;\n      this.beforeCheckLength = val.length;\n    },\n    handlerOk: function handlerOk() {\n      var _this3 = this;\n\n      var users = this.value;\n      users.forEach(function (user, index) {\n        if (_this3.deptIdList.indexOf(user) != -1) {\n          _this3.childUserList.forEach(function (item) {\n            if (item.department.indexOf(user)) {\n              item.isChecked = true;\n            }\n          });\n        }\n      });\n      var totalUsers = [];\n      var totalUsersName = [];\n      this.userList.forEach(function (item) {\n        if (item.isChecked) totalUsers.push(item.userId);\n        if (item.isChecked) totalUsersName.push(item.fullname);\n      });\n      this.childUserList.forEach(function (item) {\n        if (item.isChecked) totalUsers.push(item.userId);\n        if (item.isChecked) totalUsersName.push(item.fullname);\n      });\n      localStorage.setItem('selUsers', JSON.stringify(totalUsers));\n      this.$router.push({\n        name: 'order',\n        params: {\n          selUsers: JSON.stringify(totalUsers),\n          selUsersName: totalUsersName\n        }\n      });\n    },\n    changeActive: function changeActive(item) {// item.isActive = !item.isActive\n      // console.log(this.deptList, 'this.deptList')\n    },\n    toDeptUsersSelect: function toDeptUsersSelect(item) {\n      var isCheckAll = this.value.indexOf(item.id) != -1 ? true : false;\n      console.log(this.childUserList, 'this.childUserList');\n      var userList = [];\n      this.childUserList.forEach(function (child) {\n        if (child.department.indexOf(item.id) != -1) userList.push(child);\n      });\n\n      if (isCheckAll) {\n        userList.forEach(function (item) {\n          item.isChecked = true;\n        });\n      }\n\n      console.log(userList, 'JSON.stringify(userList)');\n      localStorage.setItem('deptUsers', JSON.stringify(userList));\n      this.$router.push({\n        name: 'selDeptUsers',\n        query: {\n          deptId: item.id,\n          isCheckAll: isCheckAll,\n          deptUsers: JSON.stringify(userList) || []\n        }\n      });\n    },\n    filterUserListByDeptid: function filterUserListByDeptid(id) {\n      var users = this.users;\n      var userList = this.userList; // let users2 = users.filter(i => {\n      //   if (filUserList.find(item => { return item.name == i }) != undefined) {\n      //     return true;\n      //   } else {\n      //     return false;\n      //   }\n      // })\n\n      return userList.filter(function (item) {\n        return item.department.indexOf(id) != -1;\n      });\n    },\n    totalNum: function totalNum() {\n      var checkedUserList = this.userList.filter(function (item) {\n        return item.isChecked == true;\n      });\n      var checkedChildDeptUserList = this.childUserList.filter(function (item) {\n        return item.isChecked == true;\n      });\n      return checkedUserList.length + checkedChildDeptUserList.length;\n    },\n    onSearch: function onSearch(val) {\n      var _this4 = this;\n\n      this.searchUsers = [];\n      this.totalUsers.forEach(function (e) {\n        if (e.fullname.indexOf(val) != -1) {\n          _this4.searchUsers.push(e);\n        }\n      });\n    },\n    onCancel: function onCancel() {\n      this.searchVal = '';\n      this.searchUsers = [];\n      this.$router.push({\n        path: '/order'\n      });\n    },\n    cancelCheckInbottom: function cancelCheckInbottom(item) {\n      var _this5 = this;\n\n      //取消的为子部门成员\n      this.value.forEach(function (e, i) {\n        if (item.department.indexOf(e.id) != -1) {\n          _this5.value[i].isChecked = false;\n        }\n      });\n      console.log(this.childDept, 'this.childDept');\n      var index = this.totalCheckedUsers.indexOf(item);\n      this.totalCheckedUsers.splice(index, 1);\n      var i = this.userList.indexOf(item);\n\n      if (i != -1) {\n        this.userList[i].isChecked = false;\n      } else {\n        i = this.childUserList.indexOf(item);\n        this.childUserList[i].isChecked = false;\n      }\n\n      var valIndex = this.value.indexOf(item.id);\n\n      if (valIndex == -1) {\n        this.$bus.emit('changeValue', item.id);\n      } else {\n        this.value.splice(valIndex, 1);\n      }\n    }\n  },\n  watch: {\n    deptList: {\n      immediate: true,\n      deep: true,\n      handler: function handler(newVal, oldVal) {}\n    },\n    userList: {\n      immediate: true,\n      deep: true,\n      handler: function handler(newVal, oldVal) {}\n    }\n  },\n  computed: {}\n};",null]}