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