gaoluyang
2025-04-01 7416c05b25af0dd89f84de823073113f80993796
人员获取第三方人员-页面bug修改
已修改2个文件
56 ■■■■■ 文件已修改
src/api/system/user.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/user/index.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/user.js
@@ -155,7 +155,7 @@
  return request({
    url: "/companies/addPersonUser",
    method: "post",
    params: data,
    data: data,
  });
}
// 获取角色
src/views/system/user/index.vue
@@ -213,7 +213,7 @@
          <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>
@@ -231,7 +231,7 @@
              </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>
@@ -294,6 +294,7 @@
    return {
      // 遮罩层
      loading: true,
      multipleSelection: [],
      // 选中数组
      ids: [],
      // 非单个禁用
@@ -329,6 +330,10 @@
      defaultProps: {
        children: "children",
        label: "label"
      },
      defaultProps1: {
        children: "children",
        label: "companyName"
      },
      // 用户导入参数
      upload: {
@@ -542,6 +547,7 @@
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.multipleSelection = selection;
      this.ids = selection.map(item => item.userId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
@@ -560,30 +566,31 @@
      }
    },
    // 获取三方人员
    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) {
@@ -591,8 +598,8 @@
          }
          arr.push(item);
        }
      });
      return arr;
      }, []);
    },
    searchPerson() {
      let arr = JSON.parse(JSON.stringify(this.personListCopy))
@@ -624,7 +631,7 @@
      }
    },
    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;
@@ -652,12 +659,13 @@
      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 => {