ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
Source/plt-web/plt-web-ui/src/views/system/department/index.vue
@@ -15,21 +15,46 @@
      @current-row-change="handleCurrentRowChange"
    >
      <template slot="menu" slot-scope="{row,size,type}">
        <el-button icon="el-icon-circle-plus-outline" size="small" type="text" @click="handleAdd()">新增子级</el-button>
        <el-button v-if="row.ALLDept !== 'ALLDept'" icon="el-icon-edit" size="small" type="text"
                   @click="editBtnClick(row)">编辑
        <el-button v-if="permissionList.departmentAddChildrenBtn" size="small"
                   type="text" @click="handleAdd()">
          <icon-show :name="permissionList.departmentAddChildrenBtn.source"></icon-show>
          新增子级
        </el-button>
        <el-button v-if="row.ALLDept !== 'ALLDept'" icon="el-icon-delete" size="small" type="text"
                   @click="rowDeleteHandler(row)">删除
        <el-button v-if="row.ALLDept !== 'ALLDept' && permissionList.editBtn" size="small"
                   type="text"
                   @click="editBtnClick(row)">
          <icon-show :name="permissionList.editBtn.source"></icon-show>
          编辑
        </el-button>
        <el-button v-if="row.ALLDept !== 'ALLDept' && permissionList.delBtn" size="small"
                   type="text"
                   @click="rowDeleteHandler(row)">
          <icon-show :name="permissionList.delBtn.source"></icon-show>
          删除
        </el-button>
      </template>
      <template slot="menuLeft" slot-scope="scope">
        <el-button icon="el-icon-school" plain size="small" type="primary" @click="assignMembersHandler">分配成员
        <el-button v-if="permissionList.assignMembersBtn" class="button-custom-icon" plain size="small" type="primary"
                   @click="assignMembersHandler">
          <icon-show :name="permissionList.assignMembersBtn.source"></icon-show>
          分配成员
        </el-button>
        <el-button icon="el-icon-user" plain size="small" type="primary" @click="statisticsHandler">统计</el-button>
        <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadHandler">导入部门</el-button>
        <el-button icon="el-icon-download" plain size="small" type="primary" @click="downLoadHandler">下载导入模板</el-button>
        <el-button v-if="permissionList.statisticsBtn" class="button-custom-icon" plain size="small" type="primary"
                   @click="statisticsHandler">
          <icon-show :name="permissionList.statisticsBtn.source"></icon-show>
          统计
        </el-button>
        <el-button v-if="permissionList.importDepartmentBtn" class="button-custom-icon" plain size="small" type="primary"
                   @click="upLoadHandler">
          <icon-show :name="permissionList.importDepartmentBtn.source"></icon-show>
          导入部门
        </el-button>
        <el-button v-if="permissionList.downloadImportTemplateBtn" class="button-custom-icon" plain size="small"
                   type="primary" @click="downLoadHandler">
          <icon-show :name="permissionList.downloadImportTemplateBtn.source"></icon-show>
          下载导入模板
        </el-button>
      </template>
    </avue-crud>
@@ -85,6 +110,7 @@
import basicOption from '@/util/basic-option';
import {column} from './option'
import func from "@/util/func";
import {mapGetters} from "vuex";
export default {
  name: "departmentManage",
@@ -95,15 +121,15 @@
        ...basicOption,
        rowKey: 'oid',
        rowParentKey: 'parentId',
        expandRowKeys:[],
        expandRowKeys: [],
        selection: false,
        addBtn: false,
        editBtn: false,
        delBtn: false,
        gridBtn: false,
        menuWidth:280,
        menuWidth: 280,
        highlightCurrentRow: true,
        calcHeight: -60,
        calcHeight: -50,
        column: column
      },
      tableLoading: false,
@@ -117,9 +143,9 @@
        selection: false,
        refreshBtn: false,
        addBtn: false,
        header :false,
        header: false,
        menu: false,
        calcHeight:80,
        calcHeight: 80,
        column: [
          {
            label: '部门',
@@ -152,12 +178,26 @@
      fileUrl: 'api/departmentQueryController/importDept',
    }
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false),
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        assignMembersBtn: this.vaildData(this.permission[this.$route.query.id].ASSIGN, false),
        departmentAddChildrenBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOAD, false),
        importDepartmentBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
        statisticsBtn: this.vaildData(this.permission[this.$route.query.id].STATISTICS, false),
      };
    },
  },
  methods: {
    // 表格初始化请求
    getTableList() {
      refTree({queryAllLevel: true, 'extandParamsMap[showAllDepartmentNode]': true}).then(res => {
        this.tableData = this.departDtaFormAtter(res.data.treeData);
        this.option.expandRowKeys=[res.data.treeData[0].oid];
        this.option.expandRowKeys = [res.data.treeData[0].oid];
      })
    },
@@ -166,7 +206,7 @@
      return items.map(item => {
        // 转换当前节点的属性
        const formList = {
          expanded:item.expanded,
          expanded: item.expanded,
          oid: item.oid,
          id: item.attributes.id,
          name: item.attributes.name,
@@ -330,19 +370,17 @@
          this.rightTransferData = byRoleRes.data.data.map(item => item.oid);
          this.$refs.transfer.visible = true;
        }
      }).catch(err => {
        console.error(err);
      });
    },
    // 分配成员穿梭框回填
    departTransferSend(row) {
      let params = {
        userOids: row.join(','),
        userOIds: row.join(','),
        deptId: this.departCurrenRow.oid
      }
      saveUsersDepts(params).then(res => {
        console.log(res);
        //console.log(res);
        this.$message.success(res.data.obj);
        this.getTableList();
      }).catch(err => {
@@ -355,9 +393,7 @@
      download().then(res => {
        func.downloadFileByBlobHandler(res);
        this.$message.success('下载成功')
      }).catch(err => {
        this.$message.error(err);
      })
      });
    },
    // 导入部门