<template>
  <div class="content-box">
    <!-- 左边树状结构区域 -->
    <el-card class="box_left">
      <el-tree
        :data="dataSource"
        node-key="id"
        default-expand-all
        highlight-current
        :props="{ label: 'name', children: 'authorListGroups' }"
        :expand-on-click-node="false"
        @node-click="handleNodeClick"
      >
        <template #default="{ node, data }">
          <div class="left_tree">
            <component
              :is="node.level === 1 ? 'FolderOpened' : 'Document'"
              style="width: 15px; height: 15px"
            />
            <div
              class="tree_text"
              :class="data.id == authorGroupId ? 'tree_click' : ''"
            >
              {{ data.name }}
            </div>

            <el-dropdown trigger="click" class="tree_more">
              <div v-if="node.level === 1">
                <el-icon><MoreFilled /></el-icon>
              </div>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item>新建下级管理组</el-dropdown-item>
                  <el-dropdown-item>修改管理组</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </template>
      </el-tree>
    </el-card>

    <!-- 右边主体内容区域 -->
    <el-card class="box_right">
      <!-- 标题区域 -->
      <template #header>
        <div class="right_header">{{ headerValue }}</div>
      </template>

      <!-- 内容区域 -->
      <div class="right_body">
        <!-- 管理员区域 -->
        <div class="body_box">
          <div class="box_left">管理员：</div>
          <div class="box_center">
            <el-tag
              class="tag"
              closable
              v-for="(item, index) in tagList"
              :key="item.id"
            >
              {{ item.name }}
            </el-tag>
          </div>
          <div class="box_right">
            <!-- <img src="./images/code.png" /> -->
            <span class="btn" @click="AddMemberClick">添加管理员</span>
            <span class="btn" @click="batchAddMemberClick">批量添加</span>
          </div>
        </div>

        <!-- 管理组权限区域 -->
        <div class="body_box">
          <div class="box_left">管理组权限：</div>
          <div class="box_center">具备全部权限</div>
          <div class="box_right">
            <span
              style="display: inline-block; cursor: pointer"
              @click="managementClick"
              >修改</span
            >
          </div>
        </div>
        <!-- 应用权限区域 -->
        <div class="body_box">
          <div class="box_left">菜单权限：</div>
          <div class="box_center">
            <el-tag
              class="tag"
              closable
              v-for="(item, index) in menuList"
              :key="index"
            >
              {{ item.name }}
            </el-tag>
          </div>
          <div class="box_right">
            <span
              style="display: inline-block; cursor: pointer"
              @click="treMemberClick"
              >修改</span
            >
          </div>
        </div>
        <!-- 应用权限区域 -->
        <div class="body_box">
          <div class="box_left">应用权限：</div>
          <div class="box_center">
            <el-tag
              class="tag"
              closable
              v-for="(item, index) in appList"
              :key="index"
            >
              {{ item.name }}
            </el-tag>
          </div>
          <div class="box_right">
            <span
              style="display: inline-block; cursor: pointer"
              @click="handleEditApp"
              >修改</span
            >
          </div>
        </div>
      </div>
    </el-card>

    <!-- 编辑应用权限弹窗 -->
    <el-dialog
      class="appPop"
      v-model="appPop"
      title="编辑应用权限"
      width="800"
      align-center
      :close-on-click-modal="false"
    >
      <div class="pop_app">
        <el-table
          ref="editApply"
          :row-class-name="tableRowClassName"
          :data="editAppPop"
          :header-cell-style="{
            background: 'rgba(240, 243, 247, 1)',
            height: '50px',
          }"
          @selection-change="editApplyHandleSelectionChange"
        >
          <el-table-column
            width="160"
            align="center"
            type="index"
            label="序号"
          />
          <el-table-column align="center" prop="name" label="应用" />
          <el-table-column align="center" type="selection" width="150" />
        </el-table>
      </div>
      <template #footer>
        <el-button type="primary"> 保存 </el-button>
      </template>
    </el-dialog>

    <!-- 编辑管理组权限弹窗 -->
    <el-dialog
      class="management"
      v-model="managementVis"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="编辑管理组权限"
      align-center
      width="800"
      :before-close="cancelManagement"
    >
      <!-- <div class="searchInp">
        <el-input
          :clearable="true"
          @clear="searchBtn"
          v-model="freezeListSel"
          placeholder="请输入关键字"
        >
          <template #prefix>
            <el-icon class="el-input__icon"><search /></el-icon>
          </template>
        </el-input>
        <el-button
          color="rgba(0, 97, 255, 1)"
          type="primary"
          class="search"
          @click="searchBtn"
        >
          查询</el-button
        >
      </div> -->
      <div class="footer">
        <el-table
          :data="managementData.list"
          style="width: 100%"
          :header-cell-style="{
            background: 'rgba(240, 243, 247, 1)',
            height: '50px',
            border: 0,
          }"
        >
          <el-table-column align="center " prop="cardNo" label="学号" />
          <el-table-column align="center" prop="name" label="姓名" />
          <el-table-column align="center" prop="lookRoles" label="查看权限">
            <template #default="scope">
              <div class="selBM" @click="editLookMemberClick(scope.row, 1)">
                选择部门
              </div>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="roles" label="管理权限">
            <template #default="scope">
              <div class="selBM" @click="editLookMemberClick(scope.row, 2)">
                选择部门
              </div>
            </template>
          </el-table-column>
          <!-- <el-table-column align="center" prop="roles" label="菜单权限">
            <template #default="scope">
              <div class="selBM" @click="treMemberClick(scope.row)">
                选择菜单权限
              </div>
            </template>
          </el-table-column> -->
          <el-table-column align="center" label="操作" width="140">
            <template #default="scope">
              <!-- <span class="defrost" v-if="editShow" @click="confirmEdit(1)"
                >取消</span
              >
              <span class="defrost" v-if="editShow" @click="confirmEdit(2)"
                >保存</span
              > -->
              <span class="defrost" @click="editDepartmentClick(scope.row)"
                >编辑</span
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-dialog>

    <!-- 编辑管理组弹窗里面的编辑部门权限按钮 -->
    <el-dialog
      class="moveMemberDialog"
      v-model="editDepartmentVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="编辑"
      align-center
      width="650"
      :before-close="cancelEditDepartment"
    >
      <div class="move">
        <div class="moveLeft">
          <el-input
            v-model="editMemberInput"
            :clearable="true"
            @clear="editManagementList"
            @input="editManagementList"
            placeholder="请输入部门"
            class="searchTree"
            style="width: 260px"
          >
            <template #prefix>
              <el-icon class="el-input__icon"><search /></el-icon>
            </template>
          </el-input>
          <el-tree
            ref="editMemberTree"
            :data="departmentTreeData"
            node-key="id"
            default-expand-all
            :expand-on-click-node="false"
            show-checkbox
            check-strictly
            @check="editMemberCheckChange"
          >
            <template #default="{ node, data }">
              <span class="custom-tree-node">
                <div class="title">
                  <img src="@/assets/images/folder.png" alt="" />
                  <!-- <img src="@/assets/images/document.png" alt="" /> -->
                  <span>{{ data.name }}</span>
                </div>
              </span>
            </template>
          </el-tree>
        </div>
        <div class="moveRight">
          <div class="sel">已选择 :</div>
          <ul
            class="infinite-list"
            style="overflow: auto"
            infinite-scroll-immediate="false"
          >
            <li
              v-for="(i, index) in lookEditMemberData"
              :key="index"
              class="infinite-list-item"
            >
              <span style="margin-left: 19px">{{ i.name }}</span>
              <el-icon @click="cancelEditMemberTreeSel(i)">
                <Close />
              </el-icon>
              <!-- <i class="el-icon-close" @click="cancelCheck(i)"></i> -->
            </li>
          </ul>
        </div>
      </div>
      <div class="options">
        <el-button
          color="rgba(41, 109, 227, 1)"
          class="queding"
          type="primary"
          @click="confirmEditMember"
        >
          确认
        </el-button>
        <el-button @click="cancelEditMember">取消</el-button>
      </div>
    </el-dialog>

    <!-- 请选择查看部门 -->
    <el-dialog
      class="moveMemberDialog"
      v-model="editMemberVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :title="editDepartmentTitle"
      align-center
      width="650"
      :before-close="cancelEditMember"
    >
      <div class="move">
        <div class="moveLeft">
          <el-input
            v-model="editMemberInput"
            :clearable="true"
            @clear="editManagementList"
            @input="editManagementList"
            placeholder="请输入部门"
            class="searchTree"
            style="width: 260px"
          >
            <template #prefix>
              <el-icon class="el-input__icon"><search /></el-icon>
            </template>
          </el-input>
          <el-tree
            ref="editMemberTree"
            :data="departmentTreeData"
            node-key="id"
            default-expand-all
            :expand-on-click-node="false"
            show-checkbox
            check-strictly
            @check="editMemberCheckChange"
          >
            <template #default="{ node, data }">
              <span class="custom-tree-node">
                <div class="title">
                  <img src="@/assets/images/folder.png" alt="" />
                  <!-- <img src="@/assets/images/document.png" alt="" /> -->
                  <span>{{ data.name }}</span>
                </div>
              </span>
            </template>
          </el-tree>
        </div>
        <div class="moveRight">
          <div class="sel">已选择 :</div>
          <ul
            class="infinite-list"
            style="overflow: auto"
            infinite-scroll-immediate="false"
          >
            <li
              v-for="(i, index) in lookEditMemberData"
              :key="index"
              class="infinite-list-item"
            >
              <span style="margin-left: 19px">{{ i.name }}</span>
              <el-icon @click="cancelEditMemberTreeSel(i)">
                <Close />
              </el-icon>
              <!-- <i class="el-icon-close" @click="cancelCheck(i)"></i> -->
            </li>
          </ul>
        </div>
      </div>
      <div class="options">
        <el-button
          color="rgba(41, 109, 227, 1)"
          class="queding"
          type="primary"
          @click="confirmEditMember"
        >
          确认
        </el-button>
        <el-button @click="cancelEditMember">取消</el-button>
      </div>
    </el-dialog>

    <!-- 菜单权限按钮 -->
    <el-dialog
      class="pushSetDialog"
      v-model="treListVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="菜单权限设置"
      align-center
      width="700"
      :before-close="cancelTreList"
    >
      <div class="tree_pushSet">
        <div class="trees">
          <div class="tree">
            <div class="tree-left">
              <span>{{ treListLiCount.length }} / {{ dataLength }}</span>
              <!-- <el-input
                style="margin-left: 5px"
                v-model.trim="pushSetInput"
                placeholder="输入名字查询"
                @input="pushData"
                :clearable="true"
              /> -->
            </div>
            <el-tree
              :data="treListData"
              show-checkbox
              node-key="id"
              ref="treListTree"
              :props="{ label: id, children: children }"
              @check="checkTreList"
            >
              <template #default="{ node, data }">
                <span class="custom-tree-node">
                  <span>{{ data.name }}</span>
                  <!-- <span>
                      <a @click="append(data)"> Append </a>
                      <a style="margin-left: 8px" @click="remove(node, data)">
                        Delete
                      </a>
                    </span> -->
                </span>
              </template>
            </el-tree>
          </div>
          <div class="tree">
            <div class="tree-left">
              <span>已选 {{ treListLiCount.length }}</span>
            </div>
            <ul
              class="infinite-list"
              style="overflow: auto"
              infinite-scroll-immediate="false"
            >
              <li
                v-for="(i, index) in treListLiCount"
                :key="index"
                class="infinite-list-item"
              >
                <span style="margin-left: 19px">{{ i.name }} </span>
                <el-icon @click="cancelLiCheck(i)">
                  <Close />
                </el-icon>
              </li>
            </ul>
          </div>
        </div>
        <div class="options">
          <el-button
            color="rgba(0, 97, 255, 1)"
            class="queding"
            type="primary"
            @click="affirmTreList"
          >
            确认
          </el-button>
          <el-button @click="cancelTreList">取消</el-button>
        </div>
      </div>
    </el-dialog>

    <!-- 批量添加 -->
    <el-dialog
      class="AddMember"
      v-model="addMemberVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="批量添加"
      align-center
      width="900"
      :before-close="cancelAddMember"
    >
      <div class="addMember">
        <div class="content">
          <div class="form">
            <el-upload
              style="width: 500px"
              class="upload-demo"
              drag
              action="#"
              multiple
              :on-preview="handlePreview2"
              :on-remove="handleRemove2"
              :on-change="handleChange2"
              :http-request="handleUpload2"
              :before-upload="beforeAvatarUpload2"
            >
              <el-icon class="el-icon--upload"><upload-filled /></el-icon>
              <div class="el-upload__text">
                <span style="font-size: 20px">点击上传或拖拽文件</span><br /><em
                  >务必按照我们的标准模板填写信息</em
                >
              </div>
              <!-- <template #tip>
              <div class="el-upload__tip">
                jpg/png files with a size less than 500kb
              </div>
            </template> -->
            </el-upload>
            <div class="startImport">
              <el-button
                type="primary"
                color="rgba(0, 97, 255, 1)"
                @click="addClick"
                plain
                >开始导入</el-button
              >
              <span class="downLoad">下载模板</span>
            </div>
            <div class="footer">
              <el-table
                :row-class-name="tableRowClassName"
                :data="addBatchData.list"
                @selection-change="handleSelectionChange"
                :header-cell-style="{
                  background: 'rgba(240, 243, 247, 1)',
                  height: '45px',
                  border: 0,
                }"
              >
                <el-table-column
                  align="center "
                  prop="userName"
                  label="操作管理员"
                />
                <el-table-column
                  align="center"
                  prop="time"
                  width="200"
                  label="设置时间"
                />
                <el-table-column
                  align="center"
                  prop="status"
                  label="设置成功"
                />
                <el-table-column
                  align="center"
                  prop="userPhone"
                  label="设置失败"
                />
                <el-table-column align="center" label="失败列表" width="200">
                  <template #default="scope">
                    <div class="edit">
                      <div class="look" @click="lookClick(scope.row)">
                        点击查看
                      </div>
                      <!-- <el-popconfirm
                      width="220"
                      confirm-button-text="确认"
                      cancel-button-text="取消"
                      :icon="InfoFilled"
                      icon-color="#f89626"
                      title="是否删除此房型?"
                      @confirm="del(scope.row)"
                      @cancel="cancelEvent"
                    >
                      <template #reference>
                        <div class="del">删除</div>
                      </template>
                    </el-popconfirm> -->
                    </div>
                  </template>
                </el-table-column>
              </el-table>
              <div class="pageSize">
                <span></span>
                <el-pagination
                  background
                  :current-page="addBatch_currentPage"
                  :page-size="addBatch_pageSize"
                  layout="total, prev, pager, next, jumper, slot"
                  :total="addBatch_total"
                  @update:current-page="handleAddBatch"
                />
              </div>
            </div>
          </div>
        </div>
      </div>
    </el-dialog>

    <!-- 添加管理员按钮 -->
    <el-dialog
      class="addManagerDialog"
      v-model="addManagerVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="菜单权限设置"
      align-center
      width="700"
      :before-close="cancelAddManager"
    >
      <div class="tree_pushSet">
        <div class="trees">
          <div class="tree">
            <div class="tree-left">
              <span style="display: inline-block; margin-right: 10px"
                >{{ addManagerLiCount.length }} / {{ addManagerTotal }}</span
              >
              <el-input
                style="margin-left: 5px; width: 180px"
                v-model.trim="addManagerInput"
                placeholder="输入名字查询"
                :clearable="true"
                @change="addManagerList"
              />
              <!-- @input="pushData" -->
            </div>
            <el-tree
              :data="addManagerData"
              show-checkbox
              class="pushSetTree"
              node-key="id"
              ref="addManagerTree"
              :props="{ label: id, children: children }"
              @check="checkAddManager"
              :default-checked-keys="defaultAddManager"
            >
              <template #default="{ node, data }">
                <span class="custom-tree-node">
                  <span>{{ data.name }}</span>
                  <!-- <span>
                      <a @click="append(data)"> Append </a>
                      <a style="margin-left: 8px" @click="remove(node, data)">
                        Delete
                      </a>
                    </span> -->
                </span>
              </template>
            </el-tree>
          </div>
          <div class="tree">
            <div class="tree-left">
              <span style="display: inline-block; margin-right: 10px"
                >已选 {{ addManagerLiCount.length }}</span
              >
            </div>
            <ul
              class="infinite-list"
              style="overflow: auto"
              infinite-scroll-immediate="false"
            >
              <li
                v-for="(i, index) in addManagerLiCount"
                :key="index"
                class="infinite-list-item"
              >
                <span style="margin-left: 19px">{{ i.name }} </span>
                <el-icon @click="cancelAddManagerLiCheck(i)">
                  <Close />
                </el-icon>
              </li>
            </ul>
          </div>
        </div>
        <div class="options">
          <el-button
            color="rgba(0, 97, 255, 1)"
            class="queding"
            type="primary"
            @click="affirmAddManager"
          >
            确认
          </el-button>
          <el-button @click="cancelAddManager">取消</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script setup>
import {
  ref,
  reactive,
  watch,
  nextTick,
  onBeforeMount,
  onUnmounted,
} from "vue";
import { useRouter } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
import { Calendar } from "@element-plus/icons-vue";
import vidiconsApi from "@/api/vidicons.js";
import { dayjs } from "element-plus";
import lodash from "lodash";
import axios from "axios";
import { useStore } from "vuex";
const store = useStore();
const api = ref("");
const router = useRouter();

// 树状结构数据
const dataSource = ref([
  {
    id: 1,
    label: "超级管理员",
    icon: "FolderOpened",
    children: [
      {
        id: "1-1",
        label: "普通管理员",
      },
      {
        id: "1-2",
        label: "财务管理员",
      },
      {
        id: "1-3",
        label: "学工处",
      },
      {
        id: "1-4",
        label: "招就处",
      },
    ],
  },
]);
const authorGroupParentId = ref(0); // 父id
const authorGroupId = ref(0); // id
const headerValue = ref("超级管理员"); // 当前身份

// 人员列表
const tagList = ref(["张三", "李四", "王五", "伍六七"]);
const tagListAuth = ref(); // 每个人员对应的权限数组(重组的)

// 菜单列表
const menuList = ref([]);

// 应用列表
const appList = ref([
  {
    name: "缴费大厅",
    checked: true,
  },
  {
    name: "学生轨迹",
    checked: true,
  },
  {
    name: "通讯录",
    checked: true,
  },
]);

// 编辑应用权限 (----------------------------------------------------------------)
const appPop = ref(false);
const editAppPop = ref([]); // 全部应用列表
const editApply = ref(); // 全部应用表格ref
const editApplySelect = ref(); // 编辑中选择多选数据

// 编辑管理组权限弹窗（------------------------------------------------------------------）
const managementVis = ref(false);
const managementData = reactive({
  list: [
    { studentId: "254125", name: "张三", lookRoles: "", roles: "" },
    { studentId: "254125", name: "李四", lookRoles: "", roles: "" },
    { studentId: "254125", name: "张明", lookRoles: "", roles: "" },
  ],
});
const editShow = ref(false); // 点击编辑时出现选择部门按钮

// 菜单权限弹窗(----------------------------------------------------)
const treListVisible = ref(false);
// 选择菜单权限
const treListTree = ref(); // ref
const treListData = ref([]);

const dataLength = ref(); // 菜单全部数据
const treListLiCount = ref([]); // 右边li展示的菜单数据
// const defaultTreList = ref([]); // 默认勾选中的菜单

// 请选择部门弹窗数据(------------------------------------）
const editMemberVisible = ref(false);
const editMemberTree = ref(); // 部门树形ref
const editMemberInput = ref(); // 部门搜索
const departmentTreeData = ref([]); // 部门数据
// const editMemberUserId = ref(); // 用户id
const editDepartmentTitle = ref();
const lookEditMemberData = ref(); // 查看部门权限
// const useEditMemberData = ref(); // 查看部门权限

// 批量添加 (---------------------------------------------------------------------)
const addMemberVisible = ref(false);
const addBatchShow = ref(false);
const addBatchData = reactive({
  list: [
    {
      userName: "张三",
      status: "已处理",
      time: "2023-12-02 11:05:30",
    },
    {
      userName: "王卿",
      status: "已处理",
      time: "2023-12-02 11:05:30",
    },
    {
      userName: "李明",
      status: "已处理",
      time: "2023-12-02 11:05:30",
    },
    {
      userName: "涂涂",
      status: "已处理",
      time: "2023-12-02 11:05:30",
    },
    {
      userName: "小红",
      status: "已处理",
      time: "2023-12-02 11:05:30",
    },
    {
      userName: "小明",
      status: "已处理",
      time: "2023-12-02 11:05:30",
    },
    {
      userName: "例子",
      status: "已处理",
      time: "2023-12-02 11:05:30",
    },
  ],
});
const addBatch_currentPage = ref(1); // 当前页
const addBatch_pageSize = ref(7);
const addBatch_total = ref(8); // 当前总数
// const appList = ref(["缴费大厅", "学生轨迹", "通讯录"]);

// 添加管理员弹窗(----------------------------------------------------)
const addManagerVisible = ref(false);
// 选择管理员
const addManagerTree = ref(); // ref
const addManagerData = ref([]); // 管理员全部数据

const addManagerCurrentPage = ref(1);
const addManagerPageCount = ref(20);
const addManagerTotal = ref(); // 所有管理员数量
const addManagerCount = ref(); // 所有管理员页数
const addManagerInput = ref(); // 名字查询
const addManagerLiCount = ref([]); // 右边li展示的管理员
const defaultAddManager = ref([]); // 默认勾选中的管理员

// 获取树形权限数据
const getList = async () => {
  let data = {
    authorGroupId: authorGroupParentId.value,
    // managerId: sessionStorage.getItem("token"),
  };
  let res = await axios({
    method: "post",
    url: api.value + "/wanzai/api/smartAuthorGroup/querySmartAuthorGroup",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    params: data,
  });
  console.log(res, "树形权限数据");
  if (res.data.code == 200) {
    dataSource.value = res.data.data;
    authorGroupParentId.value = res.data.data[0].parentId;
    authorGroupId.value = res.data.data[0].id;

    tagList.value = JSON.parse(res.data.data[0].userId).data; // 管理人员
    menuList.value = JSON.parse(res.data.data[0].applyId).data; //菜单权限
    appList.value = JSON.parse(res.data.data[0].applyId).data; //应用权限
    // console.log(tagList.value, appList.value);
    // ElMessage({
    //   type: "success",
    //   showClose: true,
    //   message: res.data.message,
    //   center: true,
    // });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }

  let arr = [];
  tagList.value.forEach((item) => {
    arr.push(item.id);
  });
  console.log(arr);

  const formData = new FormData();
  formData.append("userId", arr.join(","));
  let ress = await axios({
    method: "post",
    url: api.value + "/wanzai/api/smartAuthorGroup/queryUserAuthor",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    data: formData,
  });
  console.log(ress, "所有用户权限");
  if (ress.data.code == 200) {
    tagListAuth.value = []; // 用户权限重组参数
    tagList.value.forEach((i) => {
      let dataArr = {
        userId: i.id,
        department_view: "",
        department_manage: "",
        deleted: 0,
      };
      tagListAuth.value.push(dataArr);
    });
    console.log(tagListAuth.value);
    ress.data.data.forEach((item) => {
      tagListAuth.value.forEach((i) => {
        if (item.userId == i.userId) {
          let manageArr = [];
          item.departmentManageAuthor.forEach((d) => {
            manageArr.push(d.id);
          });
          i.department_manage = manageArr.join(",");

          let viewArr = [];
          item.departmentViewAuthor.forEach((d) => {
            viewArr.push(d.id);
          });
          i.department_view = viewArr.join(",");
        }
      });
    });
    console.log(tagListAuth.value, "组合的权限数据");
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: ress.data.message,
      center: true,
    });
  }
};

// 点击树状结构每一个节点触发的回调
const handleNodeClick = async (data) => {
  headerValue.value = data.name;
  authorGroupParentId.value = data.parentId;
  authorGroupId.value = data.id;

  let datas = {
    authorGroupId: authorGroupParentId.value,
    // managerId: sessionStorage.getItem("token"),
  };
  let res = await axios({
    method: "post",
    url: api.value + "/wanzai/api/smartAuthorGroup/querySmartAuthorGroup",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    params: datas,
  });
  console.log(res, "点击时的树形权限数据");
  if (res.data.code == 200) {
    console.log(res.data.data);
    tagList.value = JSON.parse(res.data.data[0].userId).data; // 管理人员
    appList.value = JSON.parse(res.data.data[0].applyId).data; //应用权限
    console.log(tagList.value, appList.value);
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
  console.log(data);
};

// 点击修改应用权限按钮回调 （-------------------------------------------------------）
const handleEditApp = async () => {
  appPop.value = true;
  let data = {
    currentPage: 1,
    pageCount: 1000,
    // managerId: sessionStorage.getItem("token"),
  };
  let res = await axios({
    method: "get",
    url: api.value + "/wanzai/api/smartApply/queryPageSmartApply",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    params: data,
  });
  console.log(res, "应用管理分页数据");
  if (res.data.code == 200) {
    editAppPop.value = res.data.data.list;
    editApplySelect.value = [];
    editAppPop.value.forEach((item) => {
      appList.value.forEach((i) => {
        if (item.id == i.id) {
          editApplySelect.value.push(item);
          nextTick(() => {
            editApply.value.toggleRowSelection(item, undefined);
          });
        }
      });
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
};
// 编辑中选择多选功能
const editApplyHandleSelectionChange = (val) => {
  console.log(val);
  editApplySelect.value = val;
};

// 编辑管理组权限 (-----------------------------------------------------)
const managementClick = async () => {
  managementVis.value = true;
  managementData.list = tagList.value; // 管理组权限
  editManagementList();
};
const editManagementList = async () => {
  let data = {
    name: editMemberInput.value,
  };
  let res = await axios({
    method: "get",
    url: api.value + "/wanzai/api/smartDepartment/queryDepartmentTree",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    params: data,
  });
  console.log(res, "部门树形数据");
  if (res.data.code == 200) {
    departmentTreeData.value = res.data.data;
    // ElMessage({
    //   type: "success",
    //   showClose: true,
    //   message: res.data.message,
    //   center: true,
    // });
  } else {
    loading.value = false;
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
};
const confirmEdit = (flag) => {
  if (flag == 1) {
    editShow.value = false;
  } else if (flag == 2) {
    editShow.value = false;
  }
};
const cancelManagement = () => {
  managementVis.value = false;
};
// 点击编辑时出现选择部门按钮 (--------------------------------------------)
const editDepartmentClick = () => {
  editDepartmentVisible.value = true;
};

// 点击选择菜单权限 (----------------------------------------------)
const treMemberClick = async (row) => {
  treListVisible.value = true;
  treListLiCount.value = [];
  let data = {
    currentPage: 1,
    pageCount: 1000,
    // managerId: sessionStorage.getItem("token"),
  };
  let res = await axios({
    method: "get",
    url: api.value + "/wanzai/api/smartMenu/queryPageSmartMenu",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    params: data,
  });
  console.log(res, "菜单管理分页数据");
  if (res.data.code == 200) {
    treListData.value = res.data.data.list;
    dataLength.value = res.data.data.totalCount;
    nextTick(() => {
      treListTree.value.setCheckedNodes(menuList.value);
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
};
// 勾选人员
const checkTreList = (data, nodes) => {
  // console.log(nodes);
  treListLiCount.value = [];
  // 选中勾选的房间赋值给count
  nodes.checkedNodes.forEach((item, index) => {
    if (!item.children) {
      // console.log(item);
      treListLiCount.value.push(item);
    }
  });
  console.log(treListLiCount.value);
};
// 右边叉掉推送人员
const cancelLiCheck = (i) => {
  // console.log(i);
  treListLiCount.value = treListLiCount.value.filter((item) => {
    return item.id != i.id;
  });
  treListTree.value.setCheckedNodes(treListLiCount.value);
};

// 确认按钮
const affirmTreList = async () => {
  // if (pushSetLiCount.value.length >= 1) {
  //   let data = { ids: [] };
  //   pushSetLiCount.value.forEach((item) => {
  //     data.ids.push(item.id);
  //   });
  //   let res = await axios({
  //     method: "post",
  //     url: api.value + "/wanzai/api/smartWarning/warningSavePush",
  //     headers: {},
  //     data: data,
  //   });
  //   console.log(res, "确认推送");
  //   if (res.data.code == 200) {
  //   treListVisible.value = false;
  // treListTree.value.setCheckedNodes([]);
  // treListLiCount.value = [];
  //     ElMessage({
  //       type: "success",
  //       showClose: true,
  //       message: res.data.message,
  //       center: true,
  //     });
  //   } else {
  //     ElMessage({
  //       type: "error",
  //       showClose: true,
  //       message: res.data.message,
  //       center: true,
  //     });
  //   }
  // }
};
const cancelTreList = () => {
  treListVisible.value = false;
  treListLiCount.value = [];
  treListTree.value.setCheckedNodes([]);
};
// 选择查看部门弹窗 (----------------------------------------------)
const editLookMemberClick = async (row, flag) => {
  editMemberVisible.value = true;
  if (flag == 1) {
    editDepartmentTitle.value = "查看部门权限";
  } else if (flag == 2) {
    editDepartmentTitle.value = "管理部门权限";
  }
  const formData = new FormData();
  formData.append("userId", row.id);
  let res = await axios({
    method: "post",
    url: api.value + "/wanzai/api/smartAuthorGroup/queryUserAuthor",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    data: formData,
  });
  console.log(res, "管理人员权限");
  if (res.data.code == 200) {
    if (flag == 1) {
      // 查看部门权限数据
      res.data.data.forEach((item) => {
        if (item.userId == row.id) {
          lookEditMemberData.value = item.departmentViewAuthor;
        }
      });
    } else if (flag == 2) {
      // 管理部门权限数据
      res.data.data.forEach((item) => {
        if (item.userId == row.id) {
          lookEditMemberData.value = item.departmentManageAuthor;
        }
      });
    }
    nextTick(() => {
      editMemberTree.value.setCheckedNodes(lookEditMemberData.value);
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
};
// 确定查看部门选择
const confirmEditMember = (flag) => {};
const cancelEditMember = () => {
  editMemberVisible.value = false;
  editMemberTree.value.setCheckedKeys([]);
  lookEditMemberData.value = []; // 查看部门数据置空
  // useEditMemberData.value = []; // 使用部门数据置空
};
// 勾选查看部门
const editMemberCheckChange = (data, nodes) => {
  // console.log(nodes.checkedNodes, "勾选部门");
  lookEditMemberData.value = [];
  // 选中勾选的房间赋值给count
  nodes.checkedNodes.forEach((item, index) => {
    // console.log(item);
    lookEditMemberData.value.push(item);
  });
  console.log(lookEditMemberData.value);
};
// 取消勾选
const cancelEditMemberTreeSel = (i) => {
  console.log(i);
  lookEditMemberData.value = lookEditMemberData.value.filter((item) => {
    return item.id != i.id;
  });
  let arr = [];
  lookEditMemberData.value.forEach((item) => {
    arr.push(item.id);
  });
  editMemberTree.value.setCheckedKeys(arr);
};

// 批量添加 (------------------------------------------------)
const batchAddMemberClick = () => {
  addMemberVisible.value = true;
};
const cancelAddMember = () => {
  addMemberVisible.value = false;
};

// 点击添加管理员弹窗 (----------------------------------------------)
const AddMemberClick = async () => {
  addManagerVisible.value = true;
  addManagerList(); // 加载全部人员数据
  addManagerScroll(); // 滚动加载管理员
};
// 管理人员全部数据
const addManagerList = async () => {
  addManagerCurrentPage.value = 1;
  addManagerLiCount.value = tagList.value;
  let data = {
    name: addManagerInput.value,
    currentPage: addManagerCurrentPage.value,
    pageCount: addManagerPageCount.value,
    departmentId: 1, // 部门id
  };
  let res = await axios({
    method: "get",
    url: api.value + "/wanzai/api/smartWarning/warningUserList",
    headers: {},
    params: data,
  });
  console.log(res, "管理员全部数据");
  if (res.data.code == 200) {
    addManagerData.value = res.data.data.list;
    addManagerTotal.value = res.data.data.totalCount;
    addManagerCount.value = res.data.data.totalPage;

    defaultAddManager.value = []; // 默认勾选中的管理员
    addManagerLiCount.value.forEach((item) => {
      defaultAddManager.value.push(item.id);
    });
    // if (pushSetDatas.value && pushSetLiCount.value) {
    //   nextTick(() => {
    //     addManagerTree.value.setCheckedNodes(pushSetLiCount.value);
    //   });
    // }
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
};
// 推送人滚动加载数据
const addManagerScroll = () => {
  nextTick(() => {
    const domElementNode = document.querySelector(".pushSetTree");
    console.log(domElementNode);

    // 注册下拉滚动事件;
    if (domElementNode) {
      domElementNode.addEventListener("scroll", async () => {
        const isBottom =
          domElementNode.scrollHeight - domElementNode.scrollTop <=
          domElementNode.clientHeight;
        if (isBottom) {
          // console.log("触底了");
          // console.log(addManagerCurrentPage.value, addManagerTotal.value);
          if (addManagerCurrentPage.value < addManagerCount.value) {
            addManagerCurrentPage.value++;
            let data = {
              name: addManagerInput.value,
              currentPage: addManagerCurrentPage.value,
              pageCount: addManagerPageCount.value,
              departmentId: 1, // 部门id
            };
            let res = await axios({
              method: "get",
              url: api.value + "/wanzai/api/smartWarning/warningUserList",
              headers: {},
              params: data,
            });
            console.log(res, "管理员人员滚动数据");
            if (res.data.code == 200) {
              addManagerData.value = [
                ...addManagerData.value,
                ...res.data.data.list,
              ];
              defaultAddManager.value = []; // 默认勾选中的管理员
              addManagerLiCount.value.forEach((item) => {
                defaultAddManager.value.push(item.id);
              });
              nextTick(() => {});
            } else {
              ElMessage({
                type: "error",
                showClose: true,
                message: res.data.message,
                center: true,
              });
            }
          } else {
            console.log("数据全部加载完成");
          }
        }
      });
    }
  });
};
// 勾选管理员
const checkAddManager = (data, nodes) => {
  // console.log(nodes);
  addManagerLiCount.value = [];
  // 选中勾选的管理员赋值给count
  nodes.checkedNodes.forEach((item, index) => {
    // console.log(item);
    addManagerLiCount.value.push(item);
  });
  console.log(addManagerLiCount.value);
};
// 右边叉掉管理员
const cancelAddManagerLiCheck = (i) => {
  // console.log(i);
  addManagerLiCount.value = addManagerLiCount.value.filter((item) => {
    return item.id != i.id;
  });
  addManagerTree.value.setCheckedNodes(addManagerLiCount.value);
};

// 确认按钮
const affirmAddManager = async () => {
  // if (pushSetLiCount.value.length >= 1) {
  //   let data = { ids: [] };
  //   pushSetLiCount.value.forEach((item) => {
  //     data.ids.push(item.id);
  //   });
  //   let res = await axios({
  //     method: "post",
  //     url: api.value + "/wanzai/api/smartWarning/warningSavePush",
  //     headers: {},
  //     data: data,
  //   });
  //   console.log(res, "确认推送");
  //   if (res.data.code == 200) {
  //   treListVisible.value = false;
  // addManagerTree.value.setCheckedNodes([]);
  // addManagerLiCount.value = [];
  //     ElMessage({
  //       type: "success",
  //       showClose: true,
  //       message: res.data.message,
  //       center: true,
  //     });
  //   } else {
  //     ElMessage({
  //       type: "error",
  //       showClose: true,
  //       message: res.data.message,
  //       center: true,
  //     });
  //   }
  // }
};
const cancelAddManager = () => {
  addManagerVisible.value = false;
  addManagerLiCount.value = [];
  defaultAddManager.value = [];
  addManagerTree.value.setCheckedNodes([]);
};

// 移出照片
const handleRemove2 = (uploadFile, uploadFiles) => {
  // console.log(uploadFile.uid, uploadFiles);
  // fileList.list = fileList.list.filter((item) => {
  //   return item.uid != uploadFile.uid;
  // });
  // ruleForm.fileListJson = fileList.list;
};
// 点击图片的查看按钮
const handlePreview2 = (file) => {
  // imgUrl.value = file.url;
  // imgVisible.value = true;
  console.log(file);
};
// 限制上传图片的大小
const beforeAvatarUpload2 = (rawFile) => {
  console.log(rawFile.type, "文件类型");
  if (
    rawFile.type !==
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  ) {
    ElMessage.error("文件格式必须为xlsx格式!");
    return false;
  } else if (rawFile.size / 1024 / 1024 > 100) {
    ElMessage.error("图片的大小不能超过100MB!");
    return false;
  }
  return true;
};
// 添加照片时往fileList列表中添加图片信息
const handleChange2 = async (file, fileLists) => {
  console.log(file, "1111");
  // fileList.list.push(file);
};
// 可以获取图片参数
const handleUpload2 = async (file) => {
  // if (fileList.list.length >= 6) {
  //   ElMessage.error("最多可上传6张图片!");
  //   return false;
  // }
  console.log(file, "22222222");
  // let data = new FormData();
  // data.set("files", file.file);
  // let res = await axios({
  //   method: "post",
  //   url: api.value + "/file/cos/upload",
  //   headers: {},
  //   data: data,
  // });
  // console.log(res, "图片上传成功详情图");
  // if (res.data.code == 1) {
  //   // res.data.data.uid = file.file.uid;
  //   // console.log([res.data.data]);
  //   let arr = {
  //     uid: file.file.uid,
  //     url: res.data.data,
  //   };

  //   fileList.list = fileList.list.concat([arr]);
  //   ruleForm.fileListJson = fileList.list;
  // }
};
// 分页
const handleAddBatch = (value) => {
  // console.log(value);
  addBatch_currentPage.value = value;
};

// 表格斑马纹颜色修改
const tableRowClassName = ({ row, rowIndex }) => {
  if (rowIndex % 2 === 0) {
    return "even";
  } else if (rowIndex % 2 !== 0) {
    return "odd";
  }
  return "";
};
onBeforeMount(async () => {
  api.value = store.state.user.api;

  getList();
});
</script>

<style scoped lang="scss">
.content-box {
  min-width: 1000px;
  width: calc(100vw - 260px);
  height: calc(100vh - 105px);
  margin: 20px auto;
  // background-color: #fff;
  color: #fff;
  display: flex;
  // box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);

  .box_left {
    width: 247px;
    height: 100%;

    ::v-deep(.el-card__body) {
      padding: 10px;
      height: calc(100% - 20px);
      overflow: auto;
    }

    .left_tree {
      display: flex;
      align-items: center;
      width: 100%;
      font-size: 14px;
      font-weight: bold;

      .tree_text {
        margin-left: 6px;
      }
      .tree_click {
        color: #0061ff;
      }

      .tree_more {
        margin-left: auto;
      }
    }
  }

  .box_right {
    margin-left: 15px;
    // width: 1415px;
    flex: 1;
    height: 100%;

    ::v-deep(.el-card__header),
    ::v-deep(.el-card__body) {
      padding: 0;
    }

    .right_header {
      padding-left: 34px;
      display: flex;
      align-items: center;
      height: 65px;
      font-size: 24px;
      font-weight: bold;
    }
    :deep(.el-card__body) {
      height: calc(100% - 66px);
      overflow: auto;
    }
    .right_body {
      .body_box {
        display: flex;
        align-items: center;
        margin-left: 115px;
        padding: 10px 92px 10px 0;
        box-sizing: border-box;
        min-height: 122px;
        font-size: 16px;
        border-bottom: 1px solid #e6e6e6;

        .box_left {
          width: 130px;
          font-weight: bold;
        }

        .box_center {
          flex: 1;
          display: flex;
          flex-wrap: wrap;
          align-items: center;
          color: #999999;

          .tag {
            margin-top: 5px;
            margin-bottom: 5px;
            margin-right: 16px;
          }
        }

        .box_right {
          display: flex;
          align-items: center;
          flex-direction: row-reverse;
          width: 220px;
          color: #0061ff;
          // cursor: pointer;
          .btn {
            margin-left: 15px;
          }
          img {
            margin-left: 6px;
            width: 24px;
            height: 24px;
          }
        }
      }
    }
  }

  .pop_app {
    height: 500px;
    font-size: 16px;

    .app_header {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      padding-right: 45px;
      height: 50px;
      border-radius: 5px;
      font-weight: bold;
      color: #000;
      background-color: #f0f3f7;
    }

    .app_list {
      height: 450px;
      overflow-y: auto;
      .app_box {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 50px 0 18px;
        height: 65px;
        color: #000;
        border-bottom: 1px solid #dfe2e6;
      }
    }
  }
  // 编辑应用权限弹窗
  :deep(.appPop) {
    //   height: 420px;
    border-radius: 11px;
    .el-dialog__header {
      border-radius: 11px 11px 0 0;
      background: rgba(237, 241, 245, 1);
      font-weight: 600;
      margin: 0;
      .el-dialog__headerbtn {
        outline: none;
      }
    }
    .el-dialog__body {
      padding: 20px 30px 10px 30px;

      .options {
        margin: 80px 20px 20px 0;
        width: 100%;
        display: flex;
        flex-direction: row-reverse;
        .queding {
          color: #fff;
          margin-left: 15px;
        }
      }
    }
  }

  // 编辑管理组权限弹窗
  :deep(.management) {
    //   height: 420px;
    border-radius: 11px;
    .el-dialog__header {
      border-radius: 11px 11px 0 0;
      background: rgba(237, 241, 245, 1);
      font-weight: 600;
      margin: 0;
      .el-dialog__headerbtn {
        outline: none;
      }
    }
    .el-dialog__body {
      padding: 20px 30px 10px 30px;
      .searchInp {
        margin: 0 0 20px 0;
        display: flex;
        justify-content: space-between;
        .search {
          margin-left: 15px;
        }
      }
      .footer {
        width: 100%;
        height: 550px;
        margin: 10px auto 30px;

        .el-table--fit {
          height: 100%;

          .el-table__header-wrapper {
            background-color: #000;
            font-size: 14px;

            tr {
              // color: #000;
            }
          }

          .el-table__row {
            height: 50px;
            font-size: 14px;
            // color: #000;
            &:hover {
              td {
                background-color: rgba(223, 236, 254, 1);
              }
            }
          }

          .el-table__row td {
            padding: 0;
            border: 0;
            border-bottom: 1px solid rgba(230, 230, 230, 1);
            .cell {
              display: flex;
              justify-content: center;
              .selBM {
                width: 100px;
                height: 32px;
                line-height: 32px;
                cursor: pointer;
                border-radius: 5px;
                background-color: rgba(235, 242, 255, 1);
                color: rgba(0, 97, 255, 1);
              }
            }
          }

          .el-button--primary {
            margin-left: 5px;
          }

          .el-table__body .even {
            background-color: #fff;
          }

          .el-table__body .odd {
            background-color: rgba(240, 243, 247, 1);
          }

          .defrost {
            padding: 0 10px;
            color: rgba(30, 125, 251, 1);
            cursor: pointer;
          }
        }
      }
    }
  }

  // 请选择部门
  :deep(.moveMemberDialog) {
    // height: 600px;
    overflow: hidden;
    border-radius: 11px;

    .el-dialog__header {
      border-radius: 11px 11px 0 0;
      background: rgba(245, 249, 255, 1);
      font-weight: 600;
      height: 60px;
      padding: 0 20px;
      line-height: 60px;
      margin: 0;
      border-bottom: 1px solid rgba(230, 230, 230, 1);

      .el-dialog__headerbtn {
        outline: none;
      }
    }

    .el-dialog__body {
      padding: 0px 20px 20px 20px;
      height: 550px;
      // display: flex;
      // flex-direction: column-reverse;
      .move {
        display: flex;
        .moveLeft {
          width: 280px;
          height: 96%;
          margin: 20px 20px 0 0;
          border-radius: 8px;
          .searchTree {
            width: 220px;
            margin-bottom: 8px;
            .el-input__wrapper {
              background-color: rgba(230, 230, 230, 1);
            }
          }
          // box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
          .el-tree {
            height: 430px;
            // border: 1px solid red;
            overflow: auto;
          }
          .el-tree-node__content {
            .custom-tree-node {
              flex: 1;
              display: flex;
              align-items: center;
              justify-content: space-between;
              font-size: 14px;
              padding-right: 8px;
              .title {
                display: flex;
                align-items: center;
              }
              img {
                width: 1.2em;
                height: 1.2em;
                margin: 0 5px 0 0;
              }
            }
          }
        }
        .moveRight {
          margin: 20px 0 0 0;
          flex: 1;
          .sel {
            margin-bottom: 10px;
          }
          ul {
            // width: 316px;
            height: 95%;
            list-style: none;
            padding: 0;
            margin: 0;
            border-left: 1px solid rgba(230, 230, 230, 1);
            box-sizing: border-box;
            overflow: auto;

            li {
              display: flex;
              justify-content: space-between;
              padding-right: 17px;
              align-items: center;
              margin-top: 5px;

              .el-icon-close {
                cursor: pointer;
                width: 10px;
                height: 10px;
              }
            }
          }
        }
      }
      .options {
        margin: 15px 0;
        display: flex;
        flex-direction: row-reverse;
        .queding {
          margin-left: 20px;
        }
      }

      .option {
        display: flex;
        flex-direction: row-reverse;
        align-items: center;
        margin: 10px 0;

        .queding {
          margin-left: 20px;
        }
      }
    }
  }

  // 菜单权限按钮
  :deep(.pushSetDialog) {
    //   height: 420px;
    border-radius: 11px;
    .el-dialog__header {
      border-radius: 11px 11px 0 0;
      background: rgba(237, 241, 245, 1);
      font-weight: 600;
      margin: 0;
      .el-dialog__headerbtn {
        outline: none;
      }
    }
    .el-dialog__body {
      padding: 0 30px 10px 30px;
      .trees {
        display: flex;
        justify-content: center;
        padding: 25px 0;
        // border-bottom: 1px solid rgba(204, 204, 204, 1);
      }

      .tree {
        .tree-left {
          width: 316px;
          height: 44px;
          padding: 0 10px;
          background: rgba(240, 243, 247, 1);
          border: 1px solid rgba(230, 230, 230, 1);
          box-sizing: border-box;
          display: flex;
          align-items: center;
          justify-content: space-between;
          flex-direction: row-reverse;
        }
      }

      .el-tree {
        width: 316px;
        height: 324px;
        border: 1px solid rgba(230, 230, 230, 1);
        box-sizing: border-box;
        padding-left: 9px;
        overflow: auto;
        .el-tree-node {
          &:nth-child(1) {
            margin-top: 10px;
          }
          margin-bottom: 10px;
          .el-tree-node__content {
            .el-icon {
              display: none;
            }
          }
        }
      }

      ul {
        width: 316px;
        height: 324px;
        list-style: none;
        padding: 0;
        margin: 0;
        border: 1px solid rgba(230, 230, 230, 1);
        box-sizing: border-box;
        overflow: auto;

        li {
          display: flex;
          justify-content: space-between;
          padding-right: 17px;
          align-items: center;
          margin-top: 5px;

          .el-icon-close {
            cursor: pointer;
            width: 10px;
            height: 10px;
          }
        }
      }

      .options {
        width: 100%;
        display: flex;
        flex-direction: row-reverse;
        padding: 16px 0;

        .queding {
          margin-left: 20px;
          color: #fff;
        }
      }
    }
  }

  // 批量添加
  :deep(.AddMember) {
    border-radius: 11px;
    .el-dialog__header {
      border-radius: 11px 11px 0 0;
      background: rgba(237, 241, 245, 1);
      font-weight: 600;
      margin: 0;
      .el-dialog__headerbtn {
        outline: none;
      }
    }
    .el-dialog__body {
      padding: 20px 0;
      .addMember {
        width: 100%;
        // box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);

        .content {
          padding: 0 30px;
          margin: 10px 0 0 0;
          .form {
            // height: 98%;
            // overflow: auto;
            .startImport {
              .el-button {
                width: 500px;
                height: 35px;
              }
              .downLoad {
                color: rgba(0, 97, 255, 1);
                font-size: 14px;
                margin-left: 15px;
                cursor: pointer;
              }
            }
            .tableTitle {
              font-size: 14px;
              margin-top: 10px;
            }
            .footer {
              width: 99%;
              margin: 10px auto 15px;

              .el-table--fit {
                height: 100%;

                .el-table__header-wrapper {
                  background-color: #000;
                  font-size: 14px;

                  tr {
                    // color: #000;
                  }
                }

                .el-table__row {
                  height: 45px;
                  font-size: 14px;
                  // color: #000;
                  &:hover {
                    td {
                      background-color: rgba(223, 236, 254, 1);
                    }
                  }
                }

                :deep(.el-table__row):nth-child(2n) {
                  .el-table-fixed-column--right {
                    background-color: rgba(240, 243, 247, 1);
                  }
                }

                :deep(.el-table__row td) {
                  padding: 0;
                  border: 0;
                }

                .el-button--primary {
                  margin-left: 5px;
                }

                :deep(.el-table__body .even) {
                  background-color: #fff;
                }

                :deep(.el-table__body .odd) {
                  background-color: rgba(240, 243, 247, 1);
                }

                .look {
                  padding: 0 10px;
                  cursor: pointer;
                  color: rgba(30, 125, 251, 1);
                }
              }
              .pageSize {
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin: 20px 30px 0;

                span {
                  color: #000;
                }

                .el-pagination {
                  // width: 1600px;
                  .el-pagination__total {
                    color: #000;
                  }

                  .el-pagination__goto {
                    color: #000;
                  }

                  .el-pagination__classifier {
                    color: #000;
                  }
                  .el-input__wrapper {
                    border: 1px solid rgba(0, 0, 0, 1);
                    border-radius: 5px;
                    box-shadow: none;
                  }

                  .el-pager li {
                    margin: 0 5px;
                    border: 1px solid rgba(0, 0, 0, 1);
                    border-radius: 5px;
                    background-color: transparent;
                  }

                  .el-pager li.is-active {
                    // background-color: rgba(0, 97, 255, 0.8);
                    border: 1px solid rgba(0, 97, 255, 1);
                    color: rgba(0, 97, 255, 1);
                  }

                  .btn-prev {
                    margin-right: 5px;
                    border: 1px solid rgba(0, 0, 0, 1);
                    border-radius: 5px;
                    background-color: transparent;
                  }

                  .btn-next {
                    margin-left: 5px;
                    border: 1px solid rgba(0, 0, 0, 1);
                    border-radius: 5px;
                    background-color: transparent;
                  }
                }
              }
            }
          }
          // 整个滚动条
          .form::-webkit-scrollbar-track {
            background-color: #daeeff;
          }
          // 滚动条的滚动区域（轨道）
          .form::-webkit-scrollbar {
            background-color: #0888f8;
            height: 3px;
            width: 4px;
          }
          // 滚动条的可拖拽部分（滑块）
          // .form::-webkit-scrollbar-thumb {
          //   background: #57b2ff;
          //   border-radius: 4px;
          //   height: 3px;
          //   width: 4px;
          // }
        }
      }
    }
  }

  // 添加管理按钮
  :deep(.addManagerDialog) {
    //   height: 420px;
    border-radius: 11px;
    .el-dialog__header {
      border-radius: 11px 11px 0 0;
      background: rgba(237, 241, 245, 1);
      font-weight: 600;
      margin: 0;
      .el-dialog__headerbtn {
        outline: none;
      }
    }
    .el-dialog__body {
      padding: 0 30px 10px 30px;
      .trees {
        display: flex;
        justify-content: center;
        padding: 25px 0;
        // border-bottom: 1px solid rgba(204, 204, 204, 1);
      }

      .tree {
        .tree-left {
          width: 316px;
          height: 44px;
          background: rgba(240, 243, 247, 1);
          border: 1px solid rgba(230, 230, 230, 1);
          box-sizing: border-box;
          display: flex;
          align-items: center;
          justify-content: space-between;
          flex-direction: row-reverse;
        }
      }

      .el-tree {
        width: 316px;
        height: 324px;
        border: 1px solid rgba(230, 230, 230, 1);
        box-sizing: border-box;
        padding-left: 9px;
        overflow: auto;
        .el-tree-node {
          &:nth-child(1) {
            margin-top: 10px;
          }
          margin-bottom: 10px;
          .el-tree-node__content {
            .el-icon {
              display: none;
            }
          }
        }
      }

      ul {
        width: 316px;
        height: 324px;
        list-style: none;
        padding: 0;
        margin: 0;
        border: 1px solid rgba(230, 230, 230, 1);
        box-sizing: border-box;
        overflow: auto;

        li {
          display: flex;
          justify-content: space-between;
          padding-right: 17px;
          align-items: center;
          margin-top: 5px;

          .el-icon-close {
            cursor: pointer;
            width: 10px;
            height: 10px;
          }
        }
      }

      .options {
        width: 100%;
        display: flex;
        flex-direction: row-reverse;
        padding: 16px 0;

        .queding {
          margin-left: 20px;
          color: #fff;
        }
      }
    }
  }
}
</style>
