diff --git a/jero-web/src/views/system/UserList.vue b/jero-web/src/views/system/UserList.vue index 2b15e877f..01b57c18c 100644 --- a/jero-web/src/views/system/UserList.vue +++ b/jero-web/src/views/system/UserList.vue @@ -129,8 +129,8 @@ - - + + @@ -286,6 +286,10 @@ this.rolevisible = val this.selectedRowKeys = [] }, + departmentvisibleMethods(val) { + this.departmentvisible = val + this.selectedRowKeys = [] + }, getAvatarView: function(avatar) { return getFileAccessHttpUrl(avatar) }, diff --git a/jero-web/src/views/system/modules/departmentAllocation.vue b/jero-web/src/views/system/modules/departmentAllocation.vue index 113a8e341..cab173a3d 100644 --- a/jero-web/src/views/system/modules/departmentAllocation.vue +++ b/jero-web/src/views/system/modules/departmentAllocation.vue @@ -11,25 +11,24 @@ > - - - - - - - - - - - - {{$t('choice')}} - - + + + @@ -38,7 +37,6 @@ {{ $t('cancel') }} {{ $t('determine') }} - @@ -47,15 +45,11 @@ import { putAction, postAction, getAction, deleteAction } from '@/api/manage' import axios from 'axios' import Vue from 'vue' import { ACCESS_TOKEN } from '@/store/mutation-types' -import moment from 'moment' -// import eventBUs from '../../common/event' -// 引入搜索部门弹出框的组件 -import departWindow from './DepartWindow' +import { queryDepartTreeList, searchByKeywords, deleteByDepartId } from '@/api/api' +import pick from 'lodash.pick' export default { name: 'diolagArea', - components: { - departWindow - }, + components: {}, data() { return { checkedDepartNameString: '', @@ -83,7 +77,11 @@ export default { confirmLoading: false, selectedRowKeys: [], roleList: [], - defaultValue: undefined + departTree: [], + allTreeKeys: [], + selectedKeys: [], + checkStrictly: true, + checkedKeys: [], } }, props: { @@ -95,15 +93,118 @@ export default { }, mounted() { this.loadData() + this.loadTree() }, methods: { - modalFormOk(val,vauel) { - // console.log('pppppp') - console.log(val) - console.log(vauel,'vauelvauel') + loadTree() { + var that = this + that.treeData = [] + that.departTree = [] + queryDepartTreeList().then((res) => { + if (res.success) { + //部门全选后,再添加部门,选中数量增多 + this.allTreeKeys = [] + // console.log(res.result.length,'res.result.length') + for (let i = 0; i < res.result.length; i++) { + let temp = res.result[i] + // console.log(i,'oo') + // console.log(temp,'temptemp') + that.treeData.push(temp) + that.departTree.push(temp) + // console.log(that.departTree,'that.departTreethat.departTree') + // that.setThisExpandedKeys(temp) + // that.getAllKeys(temp) + // console.log(temp.id) + } + this.loading = false + } + }) }, - onSearch() { - this.$refs.departWindow.add(this.checkedDepartKeys, this.userId) + setThisExpandedKeys(node) { + console.log(node,'setThisExpandedKeys') + if (node.children && node.children.length > 0) { + this.iExpandedKeys.push(node.key) + for (let a = 0; a < node.children.length; a++) { + this.setThisExpandedKeys(node.children[a]) + } + } + }, + getAllKeys(node) { + console.log('getAllKeys',node); + this.allTreeKeys.push(node.key) + if (node.children && node.children.length > 0) { + for (let a = 0; a < node.children.length; a++) { + this.getAllKeys(node.children[a]) + } + } + }, + onExpand(expandedKeys) { + console.log(expandedKeys,'expandedKeys') + this.iExpandedKeys = expandedKeys + }, + // 触发onSelect事件时,为部门树右侧的form表单赋值 + setValuesToForm(record) { + if (record.orgCategory == '1') { + this.orgCategoryDisabled = true + } else { + this.orgCategoryDisabled = false + } + this.$nextTick(() => { + this.form.getFieldDecorator('fax', { initialValue: '' }) + this.form.setFieldsValue(pick(record, 'departName', 'orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo')) + }) + }, + // 右键操作方法 + rightHandle(node) { + console.log(node) + this.dropTrigger = 'contextmenu' + console.log(node.node.eventKey) + this.rightClickSelectedKey = node.node.eventKey + this.rightClickSelectedOrgCode = node.node.dataRef.orgCode + }, + onCheck(checkedKeys,info) { + // console.log(checkedKeys,info) + this.hiding = false + if (this.checkStrictly) { + this.checkedKeys = checkedKeys.checked + } else { + this.checkedKeys = checkedKeys + } + }, + onSelect(selectedKeys, e) { + console.log(selectedKeys,e) + this.hiding = false + let record = e.node.dataRef + this.currSelected = Object.assign({}, record) + this.model = this.currSelected + this.selectedKeys = [record.key] + this.model.parentId = record.parentId + this.setValuesToForm(record) + this.recordTab = record + // this.$refs.departAuth.show(record.id) + // 传用户信息参数 + if (this.$refs.DeptUserInfo) { + this.$refs.DeptUserInfo.open(record) + } + }, + onSearch(value) { + let that = this + if (value) { + searchByKeywords({ keyWord: value }).then((res) => { + if (res.success) { + that.departTree = [] + for (let i = 0; i < res.result.length; i++) { + let temp = res.result[i] + that.departTree.push(temp) + } + } else { + that.$message.warning(res.message) + } + }) + } else { + that.loadTree() + } + }, loadData() { this.loading = true @@ -116,14 +217,14 @@ export default { }) }, handleCancel() { - this.$emit('areaVisibleTaskCutOffTimeflag', false) + this.$emit('departmentvisible', false) }, //保存 handleSubmit() { - let param = {ids: this.selectedRowKeysArray.join(','), selectedroles: `${this.selectedRole.join(',')}` } - postAction('/sys/user/setRole', param).then((res) => { + let param = {ids: this.selectedRowKeysArray.join(','), selecteddeparts: `${this.checkedKeys.join(',')}` } + postAction('/sys/user/setDepart', param).then((res) => { if (res.success) { - this.$emit('areaVisibleTaskCutOffTimeflag', false) + this.$emit('departmentvisible', false) this.$message.success(res.message) } else { this.$message.warning(res.message)