| | |
| | | <el-col :span="8" style="height: 70vh;overflow: hidden;" v-if="companiesList.length != 1"> |
| | | <el-input v-model="search2" placeholder="输入关键字搜索" clearable size="small" @clear="searchFilter2" |
| | | @keyup.enter.native="searchFilter2" prefix-icon="el-icon-search" style="margin-bottom: 20px;width: 90%" /> |
| | | <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps" @node-click="nodeClick2" |
| | | <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps1" @node-click="nodeClick2" |
| | | style="height: calc(100% - 42px);" @node-expand="nodeOpen0" :filter-node-method="filterNode2" ref="tree2" |
| | | highlight-current> |
| | | </el-tree> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="employeeID" label="员工号"> |
| | | </el-table-column> |
| | | <el-table-column prop="nickName" label="员工姓名"> |
| | | <el-table-column prop="name" label="员工姓名"> |
| | | </el-table-column> |
| | | <el-table-column prop="department" label="部门" min-width="200"> |
| | | </el-table-column> |
| | |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | multipleSelection: [], |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非单个禁用 |
| | |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "label" |
| | | }, |
| | | defaultProps1: { |
| | | children: "children", |
| | | label: "companyName" |
| | | }, |
| | | // 用户导入参数 |
| | | upload: { |
| | |
| | | }, |
| | | // 多选框选中数据 |
| | | handleSelectionChange(selection) { |
| | | this.multipleSelection = selection; |
| | | this.ids = selection.map(item => item.userId); |
| | | this.single = selection.length != 1; |
| | | this.multiple = !selection.length; |
| | |
| | | } |
| | | }, |
| | | // 获取三方人员 |
| | | openthirdParty() { |
| | | async openthirdParty() { |
| | | try { |
| | | this.addthirdParty = true; |
| | | this.thirdPartyLoading = true; |
| | | selectCompaniesList().then(res => { |
| | | this.companiesList = this.HaveJson(res.data); |
| | | if (this.companiesList.length == 1) { |
| | | selectSimpleList({ companyId: this.companiesList[0].companyId }).then(res => { |
| | | this.thirdPartyLoading = false; |
| | | this.personListCopy = JSON.parse(JSON.stringify(res.data)) |
| | | this.personList = res.data |
| | | this.$refs.personTable.doLayout() |
| | | }) |
| | | } else { |
| | | |
| | | const companiesResponse = await selectCompaniesList(); |
| | | this.companiesList = this.HaveJson(companiesResponse.data); |
| | | |
| | | if (this.companiesList.length === 1) { |
| | | const personResponse = await selectSimpleList({ companyId: this.companiesList[0].companyId }); |
| | | this.personListCopy = JSON.parse(JSON.stringify(personResponse.data)); |
| | | this.personList = personResponse.data; |
| | | this.$refs.personTable.doLayout(); |
| | | } |
| | | |
| | | this.datathirdParty = this.tranListToTreeData(this.companiesList, "ROOT"); |
| | | console.log(' this.datathirdParty---', this.datathirdParty) |
| | | } catch (error) { |
| | | console.error("Error fetching third party data:", error); |
| | | } finally { |
| | | this.thirdPartyLoading = false; |
| | | } |
| | | this.datathirdParty = this.tranListToTreeData(res.data, "ROOT"); |
| | | }).catch(() => { |
| | | this.thirdPartyLoading = false; |
| | | }) |
| | | if (this.componentData.entity.roleId > 10000) this.$message.warning('由于未选中具体角色,新增用户将成为默认角色') |
| | | }, |
| | | tranListToTreeData(list, rootValue) { |
| | | const arr = []; |
| | | list.forEach((item) => { |
| | | return list.reduce((arr, item) => { |
| | | if (item.parentCompanyId === rootValue) { |
| | | const children = this.tranListToTreeData(list, item.companyId); |
| | | if (children.length) { |
| | |
| | | } |
| | | arr.push(item); |
| | | } |
| | | }); |
| | | return arr; |
| | | }, []); |
| | | }, |
| | | searchPerson() { |
| | | let arr = JSON.parse(JSON.stringify(this.personListCopy)) |
| | |
| | | } |
| | | }, |
| | | nodeOpen0(data, node, el) { |
| | | this.currentCompaniesList[node.level - nodeOpen01] = data.id |
| | | // this.currentCompaniesList[node.level - nodeOpen01] = data.id |
| | | }, |
| | | filterNode2(value, data) { |
| | | if (!value) return true; |
| | |
| | | addPersonUser({ |
| | | company: arr, |
| | | person: this.multipleSelection, |
| | | roleId: this.componentData.entity.roleId |
| | | // roleId: this.componentData.entity.roleId |
| | | }).then(res => { |
| | | this.$message.success('操作成功') |
| | | this.multipleSelection = [] |
| | | this.$refs.personTable.clearSelection() |
| | | this.addLoad = false |
| | | this.addthirdParty = false |
| | | this.userSearch2 = '' |
| | | this.getList() |
| | | }).catch(e => { |