qushaowei
2023-10-17 05170ec3d816960d4f8a38ec8d202cefe73b4179
src/views/system/DepartList.vue
@@ -1,31 +1,75 @@
<template xmlns:background-color="http://www.w3.org/1999/xhtml">
  <a-row :gutter="10">
    <a-col :md="12" :sm="24">
    <a-col
      :md="12"
      :sm="24"
    >
      <a-card :bordered="false">
        <!-- 按钮操作区域 -->
        <a-row style="margin-left: 14px">
          <a-button @click="handleAdd(1)" type="primary">添加部门</a-button>
          <a-button @click="handleAdd(2)" type="primary">添加下级</a-button>
          <a-button type="primary" icon="download" @click="handleExportXls('部门信息')">导出</a-button>
          <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
            <a-button type="primary" icon="import">导入</a-button>
          <a-button
            @click="handleAdd(1)"
            type="primary"
          >添加部门</a-button>
          <a-button
            @click="handleAdd(2)"
            type="primary"
          >添加下级</a-button>
          <a-button
            type="primary"
            icon="download"
            @click="handleExportXls('部门信息')"
          >导出</a-button>
          <a-upload
            name="file"
            :showUploadList="false"
            :multiple="false"
            :headers="tokenHeader"
            :action="importExcelUrl"
            @change="handleImportExcel"
          >
            <a-button
              type="primary"
              icon="import"
            >导入</a-button>
          </a-upload>
          <a-button title="删除多条数据" @click="batchDel" type="default">批量删除</a-button>
          <a-button
            title="删除多条数据"
            @click="batchDel"
            type="default"
          >批量删除</a-button>
          <!--<a-button @click="refresh" type="default" icon="reload" :loading="loading">刷新</a-button>-->
        </a-row>
        <div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px">
          <a-alert type="info" :showIcon="true">
          <a-alert
            type="info"
            :showIcon="true"
          >
            <div slot="message">
              当前选择:<span v-if="this.currSelected.title">{{ getCurrSelectedTitle() }}</span>
              <a v-if="this.currSelected.title" style="margin-left: 10px" @click="onClearSelected">取消选择</a>
              <a
                v-if="this.currSelected.title"
                style="margin-left: 10px"
                @click="onClearSelected"
              >取消选择</a>
            </div>
          </a-alert>
          <a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入部门名称"/>
          <a-input-search
            @search="onSearch"
            style="width:100%;margin-top: 10px"
            placeholder="请输入部门名称"
          />
          <!-- 树-->
          <a-col :md="10" :sm="24">
          <a-col
            :md="10"
            :sm="24"
          >
            <template>
              <a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">
              <a-dropdown
                :trigger="[this.dropTrigger]"
                @visibleChange="dropStatus"
              >
               <span style="user-select: none">
            <a-tree
              checkable
@@ -39,13 +83,23 @@
              :checkStrictly="checkStrictly"
              :expandedKeys="iExpandedKeys"
              :autoExpandParent="autoExpandParent"
              @expand="onExpand"/>
                    @expand="onExpand"
                  />
                </span>
                <!--新增右键点击事件,和增加添加和删除功能-->
                <a-menu slot="overlay">
                  <a-menu-item @click="handleAdd(3)" key="1">添加</a-menu-item>
                  <a-menu-item @click="handleDelete" key="2">删除</a-menu-item>
                  <a-menu-item @click="closeDrop" key="3">取消</a-menu-item>
                  <a-menu-item
                    @click="handleAdd(3)"
                    key="1"
                  >添加</a-menu-item>
                  <a-menu-item
                    @click="handleDelete"
                    key="2"
                  >删除</a-menu-item>
                  <a-menu-item
                    @click="closeDrop"
                    key="3"
                  >取消</a-menu-item>
                </a-menu>
              </a-dropdown>
            </template>
@@ -54,14 +108,35 @@
      </a-card>
      <!---- author:os_chengtgen -- date:20190827 --  for:切换父子勾选模式 =======------>
      <div class="drawer-bootom-button">
        <a-dropdown :trigger="['click']" placement="topCenter">
        <a-dropdown
          :trigger="['click']"
          placement="topCenter"
        >
          <a-menu slot="overlay">
            <a-menu-item key="1" @click="switchCheckStrictly(1)">父子关联</a-menu-item>
            <a-menu-item key="2" @click="switchCheckStrictly(2)">取消关联</a-menu-item>
            <a-menu-item key="3" @click="checkALL">全部勾选</a-menu-item>
            <a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>
            <a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>
            <a-menu-item key="6" @click="closeAll">合并所有</a-menu-item>
            <a-menu-item
              key="1"
              @click="switchCheckStrictly(1)"
            >父子关联</a-menu-item>
            <a-menu-item
              key="2"
              @click="switchCheckStrictly(2)"
            >取消关联</a-menu-item>
            <a-menu-item
              key="3"
              @click="checkALL"
            >全部勾选</a-menu-item>
            <a-menu-item
              key="4"
              @click="cancelCheckALL"
            >取消全选</a-menu-item>
            <a-menu-item
              key="5"
              @click="expandAll"
            >展开所有</a-menu-item>
            <a-menu-item
              key="6"
              @click="closeAll"
            >合并所有</a-menu-item>
          </a-menu>
          <a-button>
            树操作 <a-icon type="up" />
@@ -70,34 +145,105 @@
      </div>
      <!---- author:os_chengtgen -- date:20190827 --  for:切换父子勾选模式 =======------>
    </a-col>
    <a-col :md="12" :sm="24">
    <a-col
      :md="12"
      :sm="24"
    >
      <a-tabs defaultActiveKey="1">
        <a-tab-pane tab="基本信息" key="1" >
          <a-card :bordered="false" v-if="selectedKeys.length>0">
            <a-form-model ref="form" :model="model" :rules="validatorRules">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="departName" label="机构名称">
                <a-input placeholder="请输入机构/部门名称" v-model="model.departName" />
        <a-tab-pane
          tab="基本信息"
          key="1"
        >
          <a-card
            :bordered="false"
            v-if="selectedKeys.length>0"
          >
            <a-form-model
              ref="form"
              :model="model"
              :rules="validatorRules"
            >
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                prop="departName"
                label="机构名称"
              >
                <a-input
                  placeholder="请输入机构/部门名称"
                  v-model="model.departName"
                />
              </a-form-model-item>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="使用部门编码"
                prop="useDepartNum"
              >
                <a-input
                  id="useDepartNum"
                  placeholder="请输入使用部门编码"
                  v-model="model.useDepartNum"
                />
              </a-form-model-item>
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="维修部门编码"
                prop="repairDepartNum"
              >
                <a-input
                  id="repairDepartNum"
                  placeholder="请输入维修部门编码"
                  v-model="model.repairDepartNum"
                />
              </a-form-model-item>
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="上级部门"
              >
                <a-tree-select
                  style="width:100%"
                  :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
                  :treeData="treeData"
                  :disabled="disable"
                  v-model="model.parentId"
                  placeholder="无">
                  placeholder="无"
                >
                </a-tree-select>
              </a-form-model-item>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="排序">
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="排序"
              >
                <a-input-number v-model="model.departOrder" />
              </a-form-model-item>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="备注">
                <a-textarea placeholder="请输入备注" v-model="model.memo"/>
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="备注"
              >
                <a-textarea
                  placeholder="请输入备注"
                  v-model="model.memo"
                />
              </a-form-model-item>
            </a-form-model>
            <div class="anty-form-btn">
              <a-button @click="emptyCurrForm" type="default" htmlType="button" icon="sync">重置</a-button>
              <a-button @click="submitCurrForm" type="primary" htmlType="button" icon="form">保存</a-button>
              <a-button
                @click="emptyCurrForm"
                type="default"
                htmlType="button"
                icon="sync"
              >重置</a-button>
              <a-button
                @click="submitCurrForm"
                type="primary"
                htmlType="button"
                icon="form"
              >保存</a-button>
            </div>
          </a-card>
          <a-card v-else >
@@ -106,17 +252,38 @@
            </a-empty>
          </a-card>
        </a-tab-pane>
        <a-tab-pane tab="部门权限" key="2" forceRender>
        <a-tab-pane
          tab="部门权限"
          key="2"
          forceRender
        >
          <!--<depart-auth-modal ref="departAuth"/>-->
          <depart-m-auth-modal ref="departMAuth"></depart-m-auth-modal>
        </a-tab-pane>
        <a-tab-pane v-if="isDepartType == 0" tab="设备列表" key="3" forceRender>
        <a-tab-pane
          v-if="isDepartType == 0"
          tab="设备列表"
          key="3"
          forceRender
        >
          <depart-auth-modal ref="departAuth"/>
        </a-tab-pane>
        <a-tab-pane
          v-if="isDepartType == 0"
          tab="班组列表"
          key="4"
          forceRender
        >
          <depart-team ref="departTeam" />
        </a-tab-pane>
      </a-tabs>
    </a-col>
    <depart-modal ref="departModal" @ok="loadTree"></depart-modal>
    <depart-modal
      ref="departModal"
      @ok="loadTree"
    ></depart-modal>
  </a-row>
</template>
<script>
@@ -128,6 +295,7 @@
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import DepartAuthModal from './modules/DepartList/DepartAuthModal'
  import DepartMAuthModal from './modules/DepartAuthModal'
import DepartTeam from './modules/DepartList/DepartTeam'
  // 表头
  const columns = [
@@ -175,7 +343,8 @@
      DepartAuthModal,
      DepartModal,
      DepartMModal,
      DepartMAuthModal
    DepartMAuthModal,
    DepartTeam
    },
    data() {
      return {
@@ -408,6 +577,7 @@
        this.setValuesToForm(record)
        if(this.isDepartType == 0){
          this.$refs.departAuth.show(record.id);
        this.$refs.departTeam.show(record.id);
        }
        this.$refs.departMAuth.show(record.id)
@@ -431,7 +601,7 @@
        this.selectedKeys = []
        if(this.isDepartType == 0){
          this.$refs.departAuth.departId = ''
        this.$refs.departTeam.departId = ''
        }
        this.$refs.departMAuth.departId = ''
      },
@@ -610,7 +780,7 @@
  }
  .anty-node-layout .ant-layout-header {
    padding-right: 0
  padding-right: 0;
  }
  .header {
@@ -618,21 +788,21 @@
  }
  .header button {
    margin: 0 3px
  margin: 0 3px;
  }
  .ant-modal-cust-warp {
    height: 100%
  height: 100%;
  }
  .ant-modal-cust-warp .ant-modal-body {
    height: calc(100% - 110px) !important;
    overflow-y: auto
  overflow-y: auto;
  }
  .ant-modal-cust-warp .ant-modal-content {
    height: 90% !important;
    overflow-y: hidden
  overflow-y: hidden;
  }
  #app .desktop {
@@ -641,7 +811,7 @@
  /** Button按钮间距 */
  .ant-btn {
    margin-left: 3px
  margin-left: 3px;
  }
  .drawer-bootom-button {