| | |
| | | :componentData="componentData" :key="upIndex" /> |
| | | </div> |
| | | </div> |
| | | <el-dialog title="架构新增" :visible.sync="addDia" width="400px"> |
| | | <el-dialog title="架构新增" :visible.sync="addDia0" width="400px"> |
| | | <div class="body"> |
| | | <el-row style="line-height: 50px;"> |
| | | <el-col :span="6" style="text-align: right;"> |
| | |
| | | </el-row> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addDia = false">取 消</el-button> |
| | | <el-button @click="addDia0 = false">取 消</el-button> |
| | | <el-button type="primary" @click="addStandardTree" :loading="addLoad">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | |
| | | clearable @blur="searchFilter2" @clear="searchFilter2" @keyup.enter.native="searchFilter2()"> |
| | | </el-input> |
| | | <el-tree :data="datathirdParty" node-key="id" :props="defaultProps" @node-click="nodeClick2" |
| | | style="height: calc(100% - 42px);" :filter-node-method="filterNode2" ref="tree2" highlight-current> |
| | | style="height: calc(100% - 42px);" |
| | | @node-expand="nodeOpen0" :filter-node-method="filterNode2" ref="tree2" highlight-current> |
| | | </el-tree> |
| | | </el-col> |
| | | <el-col :span="15" style="height: 70vh;padding-left: 8px;"> |
| | | <el-table height="70vh" border stripe :data="personList" v-loading="personLoad" ref="personTable" |
| | | <div class="search_thing" style="width: 360px;margin-bottom: 10px;"> |
| | | <div class="search_label" style="width: 140px;">员工号/员工姓名:</div> |
| | | <div class="search_input"> |
| | | <el-input |
| | | size="small" |
| | | placeholder="请输入工号/员工姓名" |
| | | @clear="searchPerson" |
| | | clearable |
| | | v-model="userSearch2" |
| | | @keyup.enter.native="searchPerson()"> |
| | | <i slot="suffix" class="el-input__icon el-icon-search" style="cursor: pointer;" @click="searchPerson"></i></el-input> |
| | | </div> |
| | | </div> |
| | | <el-table height="67vh" border stripe :data="personList" v-loading="personLoad" ref="personTable" |
| | | @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="50"> |
| | | </el-table-column> |
| | |
| | | expandedKeys: [], |
| | | addLoad: false, |
| | | personList: [], |
| | | personListCopy:[], |
| | | treeLoad: false, |
| | | personLoad: false, |
| | | search2: '', |
| | | multipleSelection: [] |
| | | multipleSelection: [], |
| | | companiesList:[], |
| | | currentCompaniesList: [], |
| | | userSearch2:'' |
| | | } |
| | | }, |
| | | // watch: { |
| | | // userSearch2(val){} |
| | | // }, |
| | | mounted() { |
| | | this.selectTreeList() |
| | | this.selectRole() |
| | |
| | | openthirdParty() { |
| | | this.addthirdParty = true; |
| | | this.$axios.get(this.$api.companies.selectCompaniesList).then(res => { |
| | | this.companiesList = JSON.parse(JSON.stringify(res.data)); |
| | | this.datathirdParty = [] |
| | | for (let ai = 0; ai < res.data.length; ai++) { |
| | | let a = res.data[ai] |
| | |
| | | this.addPower = add |
| | | }, |
| | | handleAdd() { |
| | | if (this.addOb.fatherId) { |
| | | if (this.addOb.fatherId||this.addOb.name=='全部') { |
| | | this.addDia0 = true; |
| | | } else { |
| | | this.$message.error('请选择一个架构层级') |
| | |
| | | }, |
| | | nodeOpen(data, node, el) { |
| | | $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder-opened') |
| | | }, |
| | | nodeOpen0(data, node, el){ |
| | | this.currentCompaniesList[node.level-1] = data.id |
| | | }, |
| | | nodeClose(data, node, el) { |
| | | $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder') |
| | |
| | | }) |
| | | }, |
| | | nodeClick2(ob, node, el) { |
| | | this.currentCompaniesList[node.level-1] = ob.id |
| | | if (ob.id !== 'SC21') { |
| | | this.personLoad = true |
| | | this.$axios.post(this.$api.companies.selectSimpleList, { |
| | | companyId: ob.id |
| | | }).then(res => { |
| | | this.personListCopy = JSON.parse(JSON.stringify(res.data)) |
| | | this.personList = res.data |
| | | this.personLoad = false |
| | | this.$refs.personTable.doLayout() |
| | |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val; |
| | | console.log(this.multipleSelection); |
| | | }, |
| | | addUser2(){ |
| | | if(this.multipleSelection.length === 0){ |
| | | return this.$message.error('请选择人员') |
| | | } |
| | | if(this.currentCompaniesList.length === 0){ |
| | | return this.$message.error('请选择组织') |
| | | } |
| | | for (let index = this.currentCompaniesList.length-1; index >1; index--) { |
| | | let obj = this.multipleSelection.find(a=>a.companyId==this.currentCompaniesList[index]) |
| | | if(!obj){ |
| | | this.currentCompaniesList.splice(index,1) |
| | | }else{ |
| | | return |
| | | } |
| | | } |
| | | let arr = [] |
| | | this.currentCompaniesList.forEach(b=>{ |
| | | this.companiesList.forEach(a=>{ |
| | | if(a.companyId===b){ |
| | | console.log(a) |
| | | } |
| | | }) |
| | | let obj = this.companiesList.find(a=>a.companyId==b) |
| | | arr.push(obj) |
| | | }) |
| | | this.addLoad = true |
| | | this.$axios.post(this.$api.companies.addPersonUser, { |
| | | company: arr, |
| | | person: this.multipleSelection |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | if (res.code === 201) { |
| | | this.addLoad = false |
| | | return |
| | | } |
| | | this.$message.success('操作成功') |
| | | this.refresh() |
| | | this.multipleSelection = [] |
| | | this.$refs.personTable.clearSelection() |
| | | this.addthirdParty = false |
| | | }).catch(e => { |
| | | this.addthirdParty = false |
| | | this.addLoad = false |
| | | }) |
| | | }, |
| | | searchPerson(){ |
| | | let arr = JSON.parse(JSON.stringify(this.personListCopy)) |
| | | this.personList = arr.filter(a=>{ |
| | | if(a.employeeID.includes(this.userSearch2)||a.name.includes(this.userSearch2)){ |
| | | return true |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |