<template>
  <div class="content-box">
    <div class="left">
      <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
      <span
        class="cameratxt"
        @click="getList(1)"
        :class="themeIndex == 1 ? 'is_active' : ''"
        >时段设置</span
      >
      <span
        class="cameratxt"
        @click="getList(2)"
        :class="themeIndex == 2 ? 'is_active' : ''"
        >排班设置</span
      >
    </div>
    <div v-if="themeIndex == 1" v-loading="loading1">
      <div class="middle">
        <!-- 按钮列表 -->
        <div class="gongneng" style="margin-top: 20px">
          <el-button
            type="primary"
            color="rgba(111, 182, 184, 1)"
            @click="addlist"
            ><img
              src="@/assets/add.png"
              style="width: 14px; height: 14px; margin-right: 4px"
              alt=""
            /><span>添加时段</span></el-button
          >
        </div>
      </div>
      <div class="footer">
        <el-table
          :row-class-name="tableRowClassName"
          :data="tableData.list"
          style="width: 100%"
          :header-cell-style="{
            background: 'rgba(240, 243, 247, 1)',
            height: '50px',
            border: 0,
          }"
        >
          <!-- <el-table-column align="center" type="selection" width="80" /> -->
          <el-table-column
            width="150"
            align="center "
            type="index"
            label="序号"
          />
          <el-table-column align="center" prop="name" label="名称" />
          <el-table-column align="center" prop="color" label="颜色">
            <template #default="scope">
              <el-button :color="scope.row.color" :link="false"
                >&nbsp;&nbsp;&nbsp;</el-button
              >
            </template>
          </el-table-column>
          <el-table-column align="center" label="起止时间">
            <template #default="{ row }">
              <span>{{ row.startTime + "~" + row.endTime }}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="isDutys" label="是否值班" />
          <el-table-column align="center" label="操作" width="220">
            <template #default="scope">
              <div class="edit">
                <div class="look" @click="editTime(scope.row)">编辑</div>
                <el-popconfirm
                  width="220"
                  confirm-button-text="确认"
                  cancel-button-text="取消"
                  :icon="InfoFilled"
                  icon-color="#f89626"
                  title="是否删除?"
                  @confirm="delTime(scope.row)"
                  @cancel="cencelTime"
                >
                  <template #reference>
                    <div class="look">删除</div>
                  </template>
                </el-popconfirm>
              </div>
            </template>
          </el-table-column>
        </el-table>

        <!-- 添加时段弹窗 -->
        <el-dialog
          class="addStaff"
          v-model="addDialogVisible"
          :close-on-click-modal="false"
          :close-on-press-escape="false"
          :title="dialongTitle"
          align-center
          width="609"
          :before-close="cancelAdd"
        >
          <el-form
            ref="ruleFormRef"
            :model="ruleForm"
            :rules="rules"
            label-width="100px"
            class="demo-ruleForm"
            :size="formSize"
            label-position="left"
            status-icon
          >
            <el-form-item label="班次名称 :" prop="name">
              <el-input
                clearable
                v-model="ruleForm.name"
                placeholder="请输入班次名称"
              />
            </el-form-item>
            <el-form-item label="颜色 :" prop="color">
              <div class="colorSelect">
                <ul>
                  <li
                    :class="i.flag == 1 ? 'li_active' : ''"
                    v-for="i in ruleFormColor.list"
                  >
                    <div
                      class="item"
                      :class="`item${i.id}`"
                      @click="selectColor(i)"
                    >
                      <img
                        v-if="i.id == colorInd"
                        src="@/assets/colorSelect.png"
                        alt=""
                      />
                    </div>
                  </li>
                </ul>
              </div>
            </el-form-item>
            <el-form-item label="时间 :" prop="snTime">
              <div>
                <el-time-picker
                  v-model="ruleForm.snTime"
                  type="daterange"
                  range-separator="-"
                  start-placeholder="起始时间"
                  end-placeholder="结束时间"
                  format="HH:mm"
                  value-format="HH:mm"
                  :prefix-icon="Calendar"
                  is-range
                  placeholder="请选择日期"
                />
              </div>
            </el-form-item>
            <el-form-item label="非工作时间 :" prop="noworkTime">
              <div
                class="noworkTime"
                v-for="(item, index) in ruleForm.noworkTime"
              >
                <el-time-picker
                  v-model="item.time"
                  type="daterange"
                  range-separator="-"
                  start-placeholder="起始时间"
                  end-placeholder="结束时间"
                  format="HH:mm"
                  value-format="HH:mm"
                  :prefix-icon="Calendar"
                  is-range
                  placeholder="请选择日期"
                />
                <img
                  @click="delNotWork(index)"
                  v-if="ruleForm.noworkTime.length != 1"
                  src="@/assets/noworkTime.png"
                  alt=""
                />
                <img
                  @click="addNotWork"
                  v-if="index == ruleForm.noworkTime.length - 1"
                  src="@/assets/workTime.png"
                  alt=""
                />
              </div>
            </el-form-item>
            <el-form-item
              label="是否值班 :"
              prop="isDuty"
              style="
                padding-bottom: 40px;
                border-bottom: 1px solid rgba(230, 230, 230, 1);
              "
            >
              <el-switch
                v-model="ruleForm.isDuty"
                class="ml-2"
                style="--el-switch-on-color: rgba(111, 182, 184, 1)"
              />
            </el-form-item>
            <el-form-item class="options">
              <el-button
                color="rgba(111, 182, 184, 1)"
                class="queding"
                type="primary"
                @click="submitAdd(ruleFormRef)"
              >
                确定
              </el-button>
              <el-button class="congzhi" @click="cancelAdd(ruleFormRef)"
                >取消</el-button
              >
            </el-form-item>
          </el-form>
        </el-dialog>
      </div>

      <!-- 分页组件 -->
      <div class="pageSize">
        <span></span>
        <el-pagination
          background
          :current-page="currentPage"
          :page-size="pageSize"
          layout="total, prev, pager, next, jumper, slot"
          :total="total"
          @update:current-page="handleCurrentChange"
        />
      </div>
    </div>
    <div v-else-if="themeIndex == 2" v-loading="loading2">
      <div class="middle">
        <div class="filter">
          <div class="condition">
            <span>创建时间 : </span>
            <el-date-picker
              v-model="searchInput.createTime"
              type="daterange"
              range-separator="-"
              start-placeholder="起始时间"
              end-placeholder="结束时间"
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD"
              :prefix-icon="Calendar"
              placeholder="请选择日期"
            />
          </div>
          <el-button
            style="margin-left: 20px"
            color="rgba(111, 182, 184, 1)"
            type="primary"
            class="search"
            @click="searchBtn"
            ><el-icon>
              <Search />
            </el-icon>
            <span>查询</span></el-button
          >
        </div>
        <!-- 按钮列表 -->
        <div class="gongneng">
          <!-- <el-button
            type="primary"
            color="rgba(111, 182, 184, 1)"
            @click="addStaff"
            ><img
              src="@/assets/add.png"
              style="width: 14px; height: 14px; margin-right: 4px"
              alt=""
            /><span>添加人员</span></el-button
          > -->
          <el-button
            type="primary"
            color="rgba(111, 182, 184, 1)"
            @click="importTemp"
            ><span>导入模板下载</span></el-button
          >
          <el-button
            color="rgba(111, 182, 184, 1)"
            class="import"
            type="primary"
            @click="importFile"
            ><img
              src="@/assets/toLead.png"
              style="width: 24px; height: 22px"
              alt=""
            />
            <span>导入</span></el-button
          >
          <el-button
            color="rgba(111, 182, 184, 1)"
            class="import"
            type="primary"
            @click="importExcel"
            ><img
              src="@/assets/import.png"
              style="width: 14px; height: 14px; margin-right: 4px"
              alt=""
            />
            <span>导出</span></el-button
          >
        </div>
      </div>
      <div class="footer">
        <el-table
          :row-class-name="tableRowClassName"
          class="footers"
          :data="tableData.list"
          style="width: 100%"
          :header-cell-style="{
            background: 'rgba(240, 243, 247, 1)',
            height: '50px',
            border: 0,
          }"
        >
          <!-- <el-table-column align="center" type="selection" width="80" /> -->
          <el-table-column
            prop="schoolName"
            align="center"
            width="120"
            fixed="left"
            label="校区"
          />
          <el-table-column
            fixed="left"
            prop="userName"
            align="center"
            label="人员"
          >
          </el-table-column>
          <el-table-column align="center" label="日期">
            <el-table-column
              width="300"
              prop="date"
              align="center"
              v-for="(i, index) in dates.list"
              :label="i.weekStr + '(' + i.dateStr + ')'"
            >
              <template #default="{ row }">
                <!-- <span>{{ row.classSettings[index] }}</span> -->
                <!-- <span>{{ index }}</span> -->
                <div class="word">
                  <div class="classItem" v-if="row.classSettings[index].id">
                    <div
                      class="del"
                      v-for="item in row.classSettings[index].shifts"
                    >
                      <el-button
                        :link="false"
                        :color="item.color"
                        :dark="true"
                        >{{ item.name }}</el-button
                      >
                      <div
                        class="classX"
                        @click="delClass(row.classSettings[index], item)"
                      >
                        <img src="@/assets/classX.png" alt="" />
                      </div>
                    </div>
                    <div
                      class="bottom"
                      @click="editClass(row.classSettings[index])"
                    >
                      <img src="@/assets/bottom.png" alt="" />
                    </div>
                  </div>
                  <div class="word" v-else>
                    <span @click="addClass(row.classSettings[index])"
                      >添加班次</span
                    >
                  </div>
                </div>
              </template>
            </el-table-column>
            <!-- <el-table-column prop="date" align="center" label="周二(07.08)">
              <div class="word">
                <span @click="addClass">添加班次</span>
              </div>
            </el-table-column> -->
          </el-table-column>
        </el-table>
        <!-- 添加人员弹窗 -->
        <!-- <el-dialog
          class="addStaff2"
          v-model="addStaffVisible"
          :close-on-click-modal="false"
          :close-on-press-escape="false"
          title="添加人员"
          align-center
          width="1009"
          :before-close="addStaffClose"
        >
          <div class="middle">
            <div class="filter">
              <div class="condition">
                <span>校区 : </span>
                <el-select
                  v-model="addStaffSearch.schoolId"
                  class="m-2"
                  placeholder="请选择身份"
                >
                  <el-option label="车队长" value="车队长" />
                  <el-option label="司机" value="司机" />
                </el-select>
              </div>
              <div class="condition">
                <span>电话 : </span>
                <el-input
                  clearable
                  v-model="addStaffSearch.phone"
                  class="w-50 m-2"
                  placeholder="请输入电话号码"
                  style="width: 150px"
                />
              </div>
              <div class="condition">
                <span>关联报修类型 : </span>
                <el-select
                  v-model="addStaffSearch.type"
                  class="m-2"
                  placeholder="请选择身份"
                >
                  <el-option label="车队长" value="车队长" />
                  <el-option label="司机" value="司机" />
                </el-select>
              </div>
            </div>
          </div>
          <div class="footer">
            <el-table
              :row-class-name="tableRowClassName"
              :data="addStaffList.list"
              @selection-change="handleSelectionChange3"
              style="width: 100%"
              :header-cell-style="{
                background: 'rgba(240, 243, 247, 1)',
                height: '50px',
                border: 0,
              }"
            >
              <el-table-column align="center" type="selection" width="80" />
              <el-table-column
                width="150"
                align="center "
                prop="schoolName"
                label="校区"
              />
              <el-table-column align="center" prop="userName" label="姓名" />
              <el-table-column align="center" prop="userPhone" label="电话" />
              <el-table-column align="center" prop="car_number" label="状态" />
              <el-table-column align="center" prop="teamName" label="维修班" />
              <el-table-column
                align="center"
                prop="car_number"
                label="关联报修类型"
                width="180"
                show-overflow-tooltip
              >
                <template #default="{ row }">
                  {{ row.articleName }}
                </template>
              </el-table-column>
              <el-table-column type="selection" width="80" />
            </el-table>
            <div class="pageSize">
              <span></span>
              <el-pagination
                background
                :current-page="currentPage3"
                :page-size="pageSize3"
                layout="total, prev, pager, next, jumper, slot"
                :total="total3"
                @update:current-page="handleCurrentChange3"
              />
            </div>
          </div>
          <div class="options">
            <el-button
              color="rgba(111, 182, 184, 1)"
              class="queding"
              type="primary"
              @click="submitAdd(ruleFormRef)"
            >
              确定
            </el-button>
            <el-button class="congzhi" @click="addStaffClose(ruleFormRef)"
              >取消</el-button
            >
          </div>
        </el-dialog> -->
        <!-- 添加班次弹窗 -->
        <el-dialog
          class="addClass"
          v-model="addClassVisible"
          :close-on-click-modal="false"
          :close-on-press-escape="false"
          :title="addClassTitle"
          align-center
          width="409"
          :before-close="addClassClose"
        >
          <el-form
            ref="ruleFormClassRef"
            :model="ruleFormClass"
            :rules="classRules"
            class="demo-ruleForm"
            :size="formSize"
            label-position="left"
            status-icon
          >
            <el-form-item label="" prop="shiftIds">
              <el-tree
                :data="addClassList"
                :props="{ label: 'name', children: 'children', value: 'id' }"
                node-key="id"
                show-checkbox
                ref="articleIdsRef"
                @check-change="handleArticleIds"
              />
              <!-- <el-checkbox-group
                v-model="checkedCities"
                @change="handleCheckedCitiesChange"
              >
                <el-checkbox
                  v-for="item in addClassList"
                  :key="item.id"
                  :label="item.name"
                  >{{ item.name }}</el-checkbox
                >
              </el-checkbox-group> -->
            </el-form-item>

            <el-form-item class="options">
              <el-button
                color="rgba(111, 182, 184, 1)"
                class="queding"
                type="primary"
                @click="addClassSubmit(ruleFormClassRef)"
              >
                确定
              </el-button>
              <el-button
                class="congzhi"
                @click="addClassClose(ruleFormClassRef)"
                >取消</el-button
              >
            </el-form-item>
          </el-form>
        </el-dialog>
        <!-- 导入弹窗 -->
        <el-dialog
          class="importXlsx"
          v-model="importXlsx"
          :close-on-click-modal="false"
          :close-on-press-escape="false"
          title="导入文件"
          align-center
          width="409"
          :before-close="closeXlsx"
        >
          <el-upload
            class="avatar-uploader"
            action=""
            ref="upload"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            :on-change="handleChange"
            :http-request="handleUpload"
            :before-upload="beforeAvatarUpload"
            :auto-upload="false"
            :limit="1"
            :on-exceed="handleExceed"
          >
            <template #trigger>
              <el-button
                type="primary"
                color="rgba(111, 182, 184, 1)"
                @click="updateImg"
              >
                <img
                  src="@/assets/toLead.png"
                  style="width: 24px; height: 22px"
                  alt=""
                />
                <span style="color: #fff">导入文件</span></el-button
              >
            </template>
            <!-- <template #tip>
              <div class="el-upload__tip">
                （注：图片大小不超过10M，建议按3:2比例）
              </div>
            </template> -->
          </el-upload>
          <div class="options">
            <el-button
              color="rgba(111, 182, 184, 1)"
              class="queding"
              type="primary"
              @click="importSuc()"
            >
              确定
            </el-button>
            <el-button class="congzhi" @click="closeXlsx()">取消</el-button>
          </div>
        </el-dialog>
      </div>

      <!-- 分页组件 -->
      <div class="pageSize">
        <span></span>
        <el-pagination
          background
          :current-page="currentPage2"
          :page-size="pageSize2"
          layout="total, prev, pager, next, jumper, slot"
          :total="total2"
          @update:current-page="handleCurrentChange2"
        />
      </div>
    </div>
  </div>
</template>

<script setup>
import {
  ref,
  watch,
  reactive,
  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, { fill } from "lodash";
import axios from "axios";
import { useStore } from "vuex";
const store = useStore();
const api = ref("");
const router = useRouter();
// 表格数据
const tableData = reactive({ list: [] }); // 表格数据
const dates = reactive({ list: [] }); // 日期数据
const schoolId = ref(""); // 判断是否为超级管理员账号

const themeIndex = ref(2); // 切换 耗材管理 和 耗材记录
const loading1 = ref(false);
const loading2 = ref(false);

// 添加时段 弹窗数据 (------------------------------------)
const dialongTitle = ref("添加时段"); // 弹窗标题

const searchInput = reactive({
  createTime: "",
}); // 搜索按钮数据
const currentPage = ref(1); // 当前页
const pageSize = ref(10);
const total = ref(); // 当前总数
const selectData = reactive({ list: [] }); // 多选框选择的数据

const addDialogVisible = ref(false); // 控制添加员工弹窗
const colorInd = ref(); // 添加时段中默认选中1中颜色
const ruleFormColor = reactive({
  list: [
    { color: "#F07459", id: 1, flag: 0 },
    { color: "#DE6868", id: 2, flag: 0 },
    { color: "#5AE090", id: 3, flag: 0 },
    { color: "#679EE6", id: 4, flag: 0 },
    { color: "#F0AA65", id: 5, flag: 0 },
    { color: "#F0D375", id: 6, flag: 0 },
    { color: "#67D6CF", id: 7, flag: 0 },
    { color: "#CC82D9", id: 8, flag: 0 },
  ],
}); // 颜色数据
const ruleFormRef = ref();
const ruleForm = reactive({
  name: "",
  snTime: "",
  color: "",
  isDuty: "",
  noworkTime: [{ time: ["00:00", "12:00"] }],
  id: "",
});

// 表单验证
const rules = reactive({
  // serial: [{ required: true, message: "序列号不能为空", trigger: "blur" }],
  name: [{ required: true, message: "班次名称不能为空", trigger: "blur" }],
  color: [
    {
      required: true,
      message: "请选择一个颜色",
      trigger: "blur",
    },
  ],
  snTime: [{ required: true, message: "请选择时间", trigger: "blur" }],
  noworkTime: [
    { required: true, message: "非工作时间不能为空", trigger: "blur" },
  ],
  // isDuty: [{ required: true, message: "值班", trigger: "blur" }],
});

// 添加班次  弹窗数据 （---------------------------）
const addClassVisible = ref(false); // 控制添加班次弹窗
const addClassTitle = ref("添加班次");
const addClassList = ref([]); // 添加时段数据选择列表 如：["日常班次", "周末班次"]
const checkedCities = ref([]); // 选中的时段列表
const articleIdsRef = ref(); // 选中时段ref
const addStaffVisible = ref(false); // 控制添加人员弹窗
const formSize = ref("default");

// 排班设置页面（---------------------------------------------）
const upload = ref(); // 导入按钮ref
const fileXlsx = ref(); // 导入的文件file
const importXlsx = ref(false); // 导入弹窗
const ruleFormClassRef = ref();
// 添加班次数据
const ruleFormClass = reactive({
  shiftIds: [],
  id: "",
  startDate: "",
  userId: "",
});
// 表单验证
const classRules = reactive({
  shiftIds: [{ required: true, message: "至少选择一个班次", trigger: "blur" }],
});
// // 添加人员中搜索数据
// const addStaffSearch = reactive({
//   schoolId: "",
//   phone: "",
//   type: "",
// });
const addStaffList = reactive({ list: [] }); // 添加人员中的 表格数据

const currentPage2 = ref(1); // 当前页
const pageSize2 = ref(6);
const total2 = ref(30); // 当前总数

// const currentPage3 = ref(1); // 当前页
// const pageSize3 = ref(8);
// const total3 = ref(30); // 当前总数

watch(
  () => searchInput.createTime,
  (newVal, oldVal) => {
    console.log("监听时间:", newVal);
    if (newVal == null) {
      searchBtn();
    }
  }
);

// 查看耗材列表
const getList = async (flag) => {
  if (flag == 1) {
    loading1.value = true;
    themeIndex.value = 1;
    let data = {
      currentPage: currentPage.value,
      pageCount: pageSize.value,
      // name: "时段设置",
    };
    let res = await axios({
      method: "get",
      url: api.value + "/repairShiftSettings/queryPageRepairShiftSettings",
      headers: {
        token: sessionStorage.getItem("token"),
        user_head: sessionStorage.getItem("userhead"),
      },
      params: data,
    });
    console.log(res, "时段设置");
    if (res.data.code == 200) {
      res.data.data.list.forEach((item) => {
        if (item.isDuty == 1) {
          item.isDutys = "是";
        } else {
          item.isDutys = "否";
        }
      });
      tableData.list = res.data.data.list;
      total.value = res.data.data.totalCount;
      loading1.value = false;
    } else {
      loading1.value = false;
      ElMessage({
        type: "error",
        showClose: true,
        message: res.data.message,
        center: true,
      });
      if (res.data.code == 570) {
        sessionStorage.removeItem("token");
        router.push({
          path: `/login`,
        });
      }
    }
  } else if (flag == 2) {
    loading2.value = true;
    themeIndex.value = 2;
    let data = {
      currentPage: currentPage2.value,
      pageCount: pageSize2.value,
      // startTime: searchInput.createTime[0],
      // endTime: searchInput.createTime[1],
    };
    if (searchInput.createTime) {
      data.startTime = searchInput.createTime[0];
      data.endTime = searchInput.createTime[1];
    }
    let res = await axios({
      method: "get",
      url: api.value + "/repairClassesSettings/queryPageRepairClassesSettings",
      headers: {
        token: sessionStorage.getItem("token"),
        user_head: sessionStorage.getItem("userhead"),
      },
      params: data,
    });
    console.log(res, "排班设置");
    if (res.data.code == 200) {
      tableData.list = res.data.data.pageDatas.list;
      dates.list = res.data.data.dates;
      total2.value = res.data.data.pageDatas.totalCount;
      loading2.value = false;
    } else {
      loading2.value = false;
      ElMessage({
        type: "error",
        showClose: true,
        message: res.data.message,
        center: true,
      });
    }
  }
};

//（添加时段--------------------------------------）
const addlist = () => {
  addDialogVisible.value = true;
  dialongTitle.value = "添加时段";
  colorInd.value = 0;
  ruleForm.name = "";
  ruleForm.snTime = "";
  ruleForm.isDuty = false;
  ruleForm.color = "";
  ruleForm.noworkTime = [{ time: ["00:00", "12:00"] }];
  ruleForm.id = "";
  ruleFormColor.list.forEach((item) => {
    item.flag = 0;
    tableData.list.forEach((i) => {
      if (i.color == item.color) {
        console.log(item.color, "已选择的");
        item.flag = 1;
      }
    });
  });
};
//添加时段-编辑时段
const editTime = (row) => {
  addDialogVisible.value = true;
  dialongTitle.value = "编辑时段";
  ruleFormColor.list.forEach((item) => {
    item.flag = 0;
    tableData.list.forEach((i) => {
      if (i.color == item.color && i.color != row.color) {
        console.log(item.color, "已选择的");
        item.flag = 1;
      }
    });
  });
  console.log(row);
  ruleForm.id = row.id;
  ruleFormColor.list.forEach((item) => {
    if (item.color == row.color) {
      colorInd.value = item.id;
    }
  });
  ruleForm.color = ruleFormColor.list[colorInd.value - 1].color;
  if (row.isDuty == 1) {
    ruleForm.isDuty = true;
  } else {
    ruleForm.isDuty = false;
  }
  ruleForm.snTime = [row.startTime, row.endTime];
  ruleForm.name = row.name;
  ruleForm.noworkTime = [];
  row.notWorkTime.split(",").forEach((item) => {
    ruleForm.noworkTime.push({ time: item.split("-") });
  });
};
// 选择颜色
const selectColor = (i) => {
  // console.log(i);
  if (i.flag) {
    ElMessage({
      type: "warning",
      showClose: true,
      message: "当前颜色已被占用",
      center: true,
    });
  } else {
    colorInd.value = i.id;
    ruleForm.color = i.color;
  }
};
// 添加时段-添加非工作时间
const addNotWork = () => {
  ruleForm.noworkTime.push({ time: [] });
  console.log(ruleForm.noworkTime);
};
// 添加时段-减掉非工作时间
const delNotWork = (i) => {
  console.log(ruleForm.noworkTime);
  ruleForm.noworkTime = ruleForm.noworkTime.filter((item, index) => {
    return i != index;
  });
};
// 添加时段-确认添加时段
const submitAdd = async (formEl) => {
  if (!formEl) return;
  await formEl.validate(async (valid, fields) => {
    if (valid) {
      if (dialongTitle.value == "添加时段") {
        let isDuty;
        if (ruleForm.isDuty) {
          isDuty = 1;
        } else {
          isDuty = 0;
        }
        let noWork = [];
        ruleForm.noworkTime.forEach((item) => {
          if (item.time) {
            let time = item.time[0] + "-" + item.time[1];
            noWork.push(time);
          }
        });
        console.log(noWork, "非工作时间数组");
        let data = {
          name: ruleForm.name,
          startTime: ruleForm.snTime[0],
          endTime: ruleForm.snTime[1],
          color: ruleForm.color,
          isDuty: isDuty,
          notWorkTime: noWork,
        };
        // let res = await admin.adminAdd(data);
        let res = await axios({
          method: "post",
          url: api.value + "/repairShiftSettings/insertRepairShiftSettings",
          headers: {
            token: sessionStorage.getItem("token"),
            user_head: sessionStorage.getItem("userhead"),
          },
          data: data,
        });
        console.log(res, "添加时段");
        if (res.data.code == 200) {
          getList(themeIndex.value);
          ElMessage({
            type: "success",
            showClose: true,
            message: res.data.message,
            center: true,
          });

          addDialogVisible.value = false;
          colorInd.value = 0;
          ruleFormRef.value.resetFields();
        } else {
          ElMessage({
            type: "error",
            showClose: true,
            message: res.data.message,
            center: true,
          });
        }
      } else {
        let isDuty;
        if (ruleForm.isDuty) {
          isDuty = 1;
        } else {
          isDuty = 0;
        }
        let noWork = [];
        ruleForm.noworkTime.forEach((item) => {
          if (item.time) {
            let time = item.time[0] + "-" + item.time[1];
            noWork.push(time);
          }
        });
        let data = {
          name: ruleForm.name,
          startTime: ruleForm.snTime[0],
          endTime: ruleForm.snTime[1],
          color: ruleForm.color,
          isDuty: isDuty,
          notWorkTime: noWork,
          id: ruleForm.id,
        };
        let res = await axios({
          method: "post",
          url: api.value + "/repairShiftSettings/updateRepairShiftSettingsById",
          headers: {
            token: sessionStorage.getItem("token"),
            user_head: sessionStorage.getItem("userhead"),
          },
          data: data,
        });
        console.log(res, "编辑时段");
        if (res.data.code == 200) {
          getList(themeIndex.value);
          ElMessage({
            type: "success",
            showClose: true,
            message: res.data.message,
            center: true,
          });
          addDialogVisible.value = false;
          colorInd.value = 0;
          ruleFormRef.value.resetFields();
        } else {
          ElMessage({
            type: "error",
            showClose: true,
            message: res.data.message,
            center: true,
          });
        }
      }
      let data = {
        currentPage: currentPage.value,
        pageCount: pageSize.value,
        // name: "时段设置",
      };
      let res = await axios({
        method: "get",
        url: api.value + "/repairShiftSettings/queryPageRepairShiftSettings",
        headers: {
          token: sessionStorage.getItem("token"),
          user_head: sessionStorage.getItem("userhead"),
        },
        params: data,
      });
      console.log(res, "添加时段选择数据");
      addClassList.value = res.data.data.list;
    } else {
      console.log("error submit!", fields);
    }
  });
};

// 添加时段-取消添加时段
const cancelAdd = () => {
  addDialogVisible.value = false;
  colorInd.value = 0;
  ruleFormRef.value.resetFields();
};
//添加时段-删除时段按钮
const delTime = async (row) => {
  let data = { id: row.id };
  let res = await axios({
    method: "get",
    url: api.value + "/repairShiftSettings/deleteRepairShiftSettingsById",
    headers: {
      token: sessionStorage.getItem("token"),
      user_head: sessionStorage.getItem("userhead"),
    },
    params: data,
  });
  console.log(res, "删除时段");
  if (res.data.code == 200) {
    if (tableData.list.length == 1 && currentPage.value != 1) {
      currentPage.value = currentPage.value - 1;
    }
    getList(themeIndex.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 cencelTime = () => {
  ElMessage({
    type: "info",
    showClose: true,
    message: "取消删除",
    center: true,
  });
};
// 排班管理 （----------------------------------------------）
// 排班查询
const searchBtn = () => {
  getList(themeIndex.value);
};
// 添加班次弹窗
const addClass = (row) => {
  addClassTitle.value = "添加班次";
  addClassVisible.value = true;
  ruleFormClass.startDate = row.startDate;
  ruleFormClass.userId = row.userId;
  ruleFormClass.shiftIds = [];
  articleIdsRef.value.setCheckedKeys([]);
  console.log(row);
};
const editClass = (row) => {
  addClassTitle.value = "编辑班次";
  addClassVisible.value = true;
  ruleFormClass.startDate = row.startDate;
  ruleFormClass.userId = row.userId;
  ruleFormClass.id = row.id;
  nextTick(() => {
    articleIdsRef.value.setCheckedKeys(row.shiftIds);
  });
  console.log(row);
};
// 关闭班次弹窗
const addClassClose = () => {
  addClassVisible.value = false;
  ruleFormClassRef.value.resetFields();
};
// 确定添加班次
const addClassSubmit = async (formEl) => {
  if (!formEl) return;
  await formEl.validate(async (valid, fields) => {
    if (valid) {
      if (addClassTitle.value == "添加班次") {
        let data = {
          userId: ruleFormClass.userId,
          startDate: ruleFormClass.startDate,
          shiftIds: ruleFormClass.shiftIds,
        };
        // let res = await admin.adminAdd(data);
        let res = await axios({
          method: "post",
          url: api.value + "/repairClassesSettings/insertRepairClassesSettings",
          headers: {
            token: sessionStorage.getItem("token"),
            user_head: sessionStorage.getItem("userhead"),
          },
          data: data,
        });
        console.log(res, "添加班次");
        if (res.data.code == 200) {
          addClassVisible.value = false;
          getList(themeIndex.value);
          ElMessage({
            type: "success",
            showClose: true,
            message: res.data.message,
            center: true,
          });
        } else {
          ElMessage({
            type: "error",
            showClose: true,
            message: res.data.message,
            center: true,
          });
        }
      } else {
        let data = {
          userId: ruleFormClass.userId,
          startDate: ruleFormClass.startDate,
          shiftIds: ruleFormClass.shiftIds,
          id: ruleFormClass.id,
        };
        let res = await axios({
          method: "post",
          url:
            api.value +
            "/repairClassesSettings/updateRepairClassesSettingsById",
          headers: {
            token: sessionStorage.getItem("token"),
            user_head: sessionStorage.getItem("userhead"),
          },
          data: data,
        });
        console.log(res, "编辑班次");
        if (res.data.code == 200) {
          addClassVisible.value = false;
          getList(themeIndex.value);
          ElMessage({
            type: "success",
            showClose: true,
            message: res.data.message,
            center: true,
          });
        } else {
          ElMessage({
            type: "error",
            showClose: true,
            message: res.data.message,
            center: true,
          });
        }
      }
    } else {
      console.log("error submit!", fields);
    }
  });
};
// 删除班次
const delClass = async (row, item) => {
  console.log(row, item);

  if (row.shiftIds.length > 1) {
    ruleFormClass.startDate = row.startDate;
    ruleFormClass.userId = row.userId;
    addClassList.value.forEach((i) => {
      if (i.name == item.name) {
        ruleFormClass.shiftIds = row.shiftIds.filter((ii) => {
          return ii != i.id;
        });
      }
    });

    ruleFormClass.id = row.id;
    let data = {
      userId: ruleFormClass.userId,
      startDate: ruleFormClass.startDate,
      shiftIds: ruleFormClass.shiftIds,
      id: ruleFormClass.id,
    };
    let res = await axios({
      method: "post",
      url: api.value + "/repairClassesSettings/updateRepairClassesSettingsById",
      headers: {
        token: sessionStorage.getItem("token"),
        user_head: sessionStorage.getItem("userhead"),
      },
      data: data,
    });
    console.log(res, "删除班次");
    if (res.data.code == 200) {
      addClassVisible.value = false;
      getList(themeIndex.value);
      ElMessage({
        type: "success",
        showClose: true,
        message: "删除成功",
        center: true,
      });
    } else {
      ElMessage({
        type: "error",
        showClose: true,
        message: res.data.message,
        center: true,
      });
    }
  } else {
    ruleFormClass.id = row.id;
    let data = {
      id: ruleFormClass.id,
    };
    let res = await axios({
      method: "get",
      url: api.value + "/repairClassesSettings/deleteRepairClassesSettingsById",
      headers: {
        token: sessionStorage.getItem("token"),
        user_head: sessionStorage.getItem("userhead"),
      },
      params: data,
    });
    console.log(res, "删除班次");
    if (res.data.code == 200) {
      addClassVisible.value = false;
      getList(themeIndex.value);
      ElMessage({
        type: "success",
        showClose: true,
        message: "删除成功",
        center: true,
      });
    } else {
      ElMessage({
        type: "error",
        showClose: true,
        message: res.data.message,
        center: true,
      });
    }
  }
};
// // 添加人员
// const addStaff = async () => {
//   addStaffVisible.value = true;
//   //  报修类型接口
//   let data = {
//     schoolId: 1,
//   };
//   let res = await axios({
//     method: "get",
//     url: api.value + "/repairArticleType/queryRepairArticleType",
//     headers: {
//       token: sessionStorage.getItem("token"),
//       user_head: sessionStorage.getItem("userhead"),
//     },
//     params: data,
//   });
//   console.log(res, "报修类型接口");

//   let datas = {
//     currentPage: 1,
//     pageCount: 8,
//   };
//   let ress = await axios({
//     method: "get",
//     url: api.value + "/repairUser/queryPageRepairUser",
//     headers: {
//       token: sessionStorage.getItem("token"),
//       user_head: sessionStorage.getItem("userhead"),
//     },
//     params: datas,
//   });
//   console.log(ress, "员工列表");
//   if (ress.data.code == 200) {
//     ress.data.data.list.forEach((item) => {
//       // 楼栋关联字段
//       if (item.articleNames) {
//         item.articleName = item.articleNames.join(",");
//       } else {
//         item.articleName = "暂无关联";
//       }
//     });
//     addStaffList.list = ress.data.data.list;
//     total3.value = ress.data.data.totalCount;
//   } else {
//     ElMessage({
//       type: "error",
//       showClose: true,
//       message: res.data.message,
//       center: true,
//     });
//   }
// };
// 关闭添加人员弹窗
const addStaffClose = () => {
  addStaffVisible.value = false;
};

// // 表格selection中的多选功能
const handleArticleIds = (data, checked, indeterminate) => {
  console.log(data, checked, indeterminate);
  // let keys = articleIdsRef.value.getCheckedNodes();
  let keys = articleIdsRef.value.getCheckedKeys();
  console.log(keys);
  ruleFormClass.shiftIds = keys;
};
// const handleCheckedCitiesChange = (value) => {
//   console.log(value);
// };

// 多选框功能
const handleSelectionChange3 = (val) => {
  console.log(val);
  selectData.list = val;
};
// 导入弹窗
const importFile = () => {
  importXlsx.value = true;
};
const closeXlsx = () => {
  importXlsx.value = false;
  upload.value.clearFiles();
  fileXlsx.value = "";
};
// 导出模板
const importTemp = async () => {
  let res = await axios({
    method: "get",
    url: api.value + "/repairClassesSettings/downloadRepairClassesSettingExcel",
    headers: {
      token: sessionStorage.getItem("token"),
      user_head: sessionStorage.getItem("userhead"),
    },
    responseType: "blob",
  });
  console.log(res, "导出模板");
  if (res.status == 200) {
    let name = `排班导入模板`;
    var content = res.data;
    var data = new Blob([content]);
    var downloadUrl = window.URL.createObjectURL(data);
    var anchor = document.createElement("a");
    anchor.href = downloadUrl;
    anchor.download = name + ".xlsx";
    anchor.click();
    window.URL.revokeObjectURL(data);
    ElMessage({
      type: "success",
      showClose: true,
      message: "导出成功",
      center: true,
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: "导出失败",
      center: true,
    });
  }
};
// 添导入文件功能
const handleChange = (file, fileLists) => {
  console.log(file, "file11111");
  // let formData = new FormData(); //声明一个FormDate对象
  // formData.append("formFile", file.raw);
  // fileXlsx.value = formData;
  fileXlsx.value = file.raw;
};
// 可以获取文件参数(封面图上传图片)
const handleUpload = (file) => {
  console.log(file, "file22222");
};
// 移出文件
const handleRemove = (uploadFile, uploadFiles) => {
  console.log(uploadFile, uploadFiles);
  fileXlsx.value = "";
};
// 限制上传图片的大小类型
const beforeAvatarUpload = (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 > 10) {
  //   ElMessage.error("图片的大小不能超过10MB!");
  //   return false;
  // }
  return true;
};
// 上传文件时多次上传会替换前一个文件
const handleExceed = (files) => {
  console.log(files, "替换文件");

  upload.value.clearFiles();
  const file = files[0];
  upload.value.handleStart(file);

  // let formData = new FormData(); //声明一个FormDate对象
  // formData.append("formFile", files.raw);
  // fileXlsx.value = formData;
  fileXlsx.value = files.raw;
};
// 确定导入文件
const importSuc = async () => {
  console.log("确定导入");

  let data = new FormData(); //声明一个FormDate对象
  data.set("file", fileXlsx.value);

  let res = await axios({
    method: "post",
    url: api.value + "/repairClassesSettings/importRepairClassesSettingExcel",
    headers: {
      token: sessionStorage.getItem("token"),
      user_head: sessionStorage.getItem("userhead"),
      "Content-Type": "multipart/form-data;charset=UTF-8",
    },
    data: data,
  });
  console.log(res);
  if (res.data.code == 200) {
    getList();
    ElMessage({
      type: "success",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
};
//导出功能
const importExcel = async () => {
  let datas = {
    account: localStorage.getItem("user"),
    startTime: searchInput.createTime[0],
    endTime: searchInput.createTime[1],
  };
  let res = await axios({
    method: "get",
    url: api.value + "/repairClassesSettings/downloadRepairClassesExcel",
    headers: {
      token: sessionStorage.getItem("token"),
      user_head: sessionStorage.getItem("userhead"),
    },
    params: datas,
    responseType: "blob",
  });
  console.log(res, "导出排班");
  if (res.status == 200) {
    let name = `排班管理`;
    var content = res.data;
    var data = new Blob([content]);
    var downloadUrl = window.URL.createObjectURL(data);
    var anchor = document.createElement("a");
    anchor.href = downloadUrl;
    anchor.download = name + ".xlsx";
    anchor.click();
    window.URL.revokeObjectURL(data);
    ElMessage({
      type: "success",
      showClose: true,
      message: "导出成功",
      center: true,
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: "导出失败",
      center: true,
    });
  }
};
// 表格斑马纹颜色修改
const tableRowClassName = ({ row, rowIndex }) => {
  if (rowIndex % 2 === 0) {
    return "even";
  } else if (rowIndex % 2 !== 0) {
    return "odd";
  }
  return "";
};
// 时段设置分页
const handleCurrentChange = (value) => {
  // console.log(value);
  currentPage.value = value;
  getList(themeIndex.value);
};
//  时段管理分页
const handleCurrentChange2 = (value) => {
  // console.log(value);
  currentPage2.value = value;
  getList(themeIndex.value);
};
// const handleCurrentChange3 = (value) => {
//   // console.log(value);
//   currentPage3.value = value;
//   getList(themeIndex.value);
// };

onBeforeMount(async () => {
  api.value = store.state.user.api;
  schoolId.value = sessionStorage.getItem("schoolId");
  getList(themeIndex.value);
  let data = {
    currentPage: currentPage.value,
    pageCount: pageSize.value,
    // name: "时段设置",
  };
  let res = await axios({
    method: "get",
    url: api.value + "/repairShiftSettings/queryPageRepairShiftSettings",
    headers: {
      token: sessionStorage.getItem("token"),
      user_head: sessionStorage.getItem("userhead"),
    },
    params: data,
  });
  console.log(res, "添加时段选择数据");
  addClassList.value = res.data.data.list;
});
onUnmounted(() => {});
</script>

<style scoped lang="scss">
.content-box {
  width: 97.5%;
  height: 89%;
  margin: 20px auto;
  background-color: #fff;
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0px 3px 10px rgba(213, 228, 252, 1);

  .left {
    // width: calc(100wh - 40px);
    display: flex;
    align-items: center;
    height: 60px;
    margin: 0 30px;
    border-bottom: 1px solid #ccc;
    color: rgb(0, 0, 0);
    font-size: 18px;
    font-weight: 600;
    user-select: none;

    span {
      height: 60px;
      line-height: 60px;
      margin-right: 20px;
      cursor: pointer;
    }

    .is_active {
      color: rgba(111, 182, 184, 1);
    }
  }

  .middle {
    width: 96%;
    margin: 0 auto;

    color: #000;

    // border-bottom: 1px solid rgb(231, 231, 231);
    .filter {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      margin: 10px 0 0 0;

      .search {
        color: #fff;
      }

      .condition {
        display: flex;
        align-items: center;
        margin: 10px 30px 10px 0;

        :deep(.el-input .el-input__inner) {
          font-size: 16px;
        }

        span {
          margin: 0 10px 0 0;
        }
      }
    }

    .gongneng {
      margin: 10px 0 15px 0;
      display: flex;

      .avatar-uploader {
        margin: 0 10px;

        :deep(.el-upload-list) {
          display: none;
        }
      }

      span {
        color: #fff;
      }
    }

    :deep(.cont) {
      width: 60%;
      margin: 20px auto;
    }

    :deep(.download) {
      display: flex;
      align-items: center;
      margin: 10px;
    }

    :deep(.download span) {
      font-size: 16px;
      margin-left: 20px;
    }

    :deep(.cont .el-button) {
      margin-left: 60px;
      margin-bottom: 30px;
    }

    :deep(.cont .accomplish) {
      width: 100%;
      display: flex;
      justify-content: center;
    }

    :deep(.cont .accomplish .el-button) {
      width: 50%;
      margin: 0;
    }
  }

  .footer {
    width: 96%;
    height: 550px;
    margin: 10px auto 30px;

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

      :deep(.el-table__header-wrapper) {
        background-color: #000;
        font-size: 16px;

        tr {
          color: #000;
        }
      }

      :deep(.el-table__row) {
        height: 50px;
        font-size: 16px;
        color: #000;
      }

      :deep(.el-table__row):nth-child(2n) {
        .el-table-fixed-column--left {
          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);
      }

      :deep(.edit) {
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(111, 182, 184, 1);
      }

      :deep(.look) {
        padding: 0 10px;
        cursor: pointer;
      }

      :deep(.look):hover {
        color: red;
      }

      .el-table__row {
        //添加班次 周一到周日样式
        .word {
          color: rgba(111, 182, 184, 1);
          cursor: pointer;

          .classItem {
            display: flex;
            justify-content: center;
            align-items: center;

            .del {
              display: flex;
              justify-content: center;
              align-items: center;
              margin-left: 5px;
            }

            .el-button {
              color: #fff;
            }

            .classX {
              width: 25px;
              height: 25px;

              img {
                width: 25px;
                height: 25px;
                margin-left: 2px;
              }
            }

            .bottom {
              img {
                width: 15px;
                height: 8px;
                margin-left: 10px;
              }
            }
          }
        }

        .word span:hover {
          color: red;
        }
      }
    }

    // 添加时段弹窗样式
    :deep(.addStaff) {
      //   height: 420px;
      border-radius: 11px;
      user-select: none;

      .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: 30px 20px 10px 20px;

        .el-input {
          width: 200px;
        }

        .el-form-item__content {
          // 非工作时间样式
          .noworkTime {
            display: flex;
            align-items: center;
            margin-bottom: 3px;

            img {
              width: 20px;
              height: 20px;
              margin-left: 10px;
              display: inline-block;
              cursor: pointer;
            }
          }

          .colorSelect {
            width: 200px;

            ul {
              list-style: none;
              display: flex;
              flex-wrap: wrap;
              padding: 0;
              margin: 0;

              li {
                border: 1px solid transparent;
                margin: 4px 10px 0px 0;
                border-radius: 5px;

                .item {
                  width: 35px;
                  height: 22px;
                  border-radius: 5px;
                  background: #000;
                  cursor: pointer;
                  margin: 1px;

                  img {
                    width: 12px;
                    height: 12px;
                    position: relative;
                    right: -22px;
                  }
                }

                .item1 {
                  background-color: rgba(240, 116, 89, 1);
                }

                .item2 {
                  background-color: rgb(187, 99, 99, 1);
                }

                .item3 {
                  background-color: rgba(90, 224, 144, 1);
                }

                .item4 {
                  background-color: rgba(103, 158, 230, 1);
                }

                .item5 {
                  background-color: rgba(240, 170, 101, 1);
                }

                .item6 {
                  background-color: rgba(240, 211, 117, 1);
                }

                .item7 {
                  background-color: rgba(103, 214, 207, 1);
                }

                .item8 {
                  background-color: rgba(204, 130, 217, 1);
                }
              }

              // li:hover {
              //   border: 1px solid rgba(30, 125, 251, 1);
              // }
              .li_active {
                border: 1px solid rgba(30, 125, 251, 1);
              }
            }
          }

          .el-checkbox-group {
            display: flex;
            flex-direction: column;
          }
        }

        .checkbox {
          .el-form-item__content {
            display: flex;
            flex-direction: column;
            align-items: flex-start;

            .noworkTime {
              border: 1px solid red;

              img {
                width: 16px;
                height: 16px;
                display: inline-block;
              }
            }

            .el-checkbox-group {
              display: flex;
              flex-direction: column;
            }
          }
        }

        .options {
          .el-form-item__content {
            .queding {
              margin-left: 20px;
              color: #fff;
            }

            display: flex;
            flex-direction: row-reverse;
          }
        }
      }
    }

    // 添加员工弹窗样式
    :deep(.addStaff2) {
      //   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 20px 10px 20px;

        .middle {
          width: 100%;
        }

        .footer {
          width: 100%;
          margin: 10px auto;

          .el-table--fit {
            height: 450px;

            .el-table__header {
              th:last-child {
                .cell {
                  display: flex;
                  justify-content: center;
                }
              }
            }

            .el-table__row {
              .cell {
                display: flex;
                justify-content: center;
              }
            }
          }

          .pageSize {
            margin: 0;
            padding: 20px 0;
            border-bottom: 1px solid #ccc;
          }
        }

        .options {
          margin: 15px 0 10px 0;

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

          display: flex;
          flex-direction: row-reverse;
        }
      }
    }

    // 添加员工弹窗样式
    :deep(.addClass) {
      //   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 20px 10px 20px;

        .el-input {
          width: 200px;
        }

        .el-form {
          .el-form-item__content {
            margin-left: 22px !important;
          }
        }

        .el-form-item__content {
          // 非工作时间样式

          .noworkTime {
            display: flex;
            align-items: center;

            img {
              width: 20px;
              height: 20px;
              margin-left: 10px;
              display: inline-block;
              cursor: pointer;
            }
          }

          .colorSelect {
            width: 200px;

            ul {
              list-style: none;
              display: flex;
              flex-wrap: wrap;
              padding: 0;
              margin: 0;

              li {
                border: 1px solid transparent;
                margin: 4px 10px 0px 0;
                border-radius: 5px;

                .item {
                  width: 35px;
                  height: 22px;
                  border-radius: 5px;
                  background: #000;
                  cursor: pointer;
                  margin: 1px;

                  img {
                    width: 12px;
                    height: 12px;
                    position: relative;
                    right: -22px;
                  }
                }

                .item1 {
                  background-color: rgba(240, 116, 89, 1);
                }

                .item2 {
                  background-color: rgb(187, 99, 99, 1);
                }

                .item3 {
                  background-color: rgba(90, 224, 144, 1);
                }

                .item4 {
                  background-color: rgba(103, 158, 230, 1);
                }

                .item5 {
                  background-color: rgba(240, 170, 101, 1);
                }

                .item6 {
                  background-color: rgba(240, 211, 117, 1);
                }

                .item7 {
                  background-color: rgba(103, 214, 207, 1);
                }

                .item8 {
                  background-color: rgba(204, 130, 217, 1);
                }
              }

              li:hover {
                border: 1px solid rgba(30, 125, 251, 1);
              }
            }
          }

          .el-checkbox-group {
            display: flex;
            flex-direction: column;
          }
        }

        .checkbox {
          .el-form-item__content {
            display: flex;
            flex-direction: column;
            align-items: flex-start;

            .noworkTime {
              border: 1px solid red;

              img {
                width: 16px;
                height: 16px;
                display: inline-block;
              }
            }

            .el-checkbox-group {
              display: flex;
              flex-direction: column;
            }
          }
        }

        .options {
          .el-form-item__content {
            .queding {
              margin-left: 20px;
              color: #fff;
            }

            display: flex;
            flex-direction: row-reverse;
          }
        }
      }
    }

    // 导入弹窗样式
    :deep(.importXlsx) {
      //   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 20px 10px 20px;

        .options {
          margin: 15px 0;

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

          display: flex;
          flex-direction: row-reverse;
        }
      }
    }
  }

  .footers {
    :deep(.el-table__row) {
      height: 50px;
      font-size: 16px;
      color: #000;

      td:nth-of-type(n + 3) {
        .cell {
          display: flex;
          justify-content: right;

          .word {
            width: 280px;

            .classItem {
              justify-content: left;
              flex-wrap: wrap;

              .del {
                margin: 4px 3px;
              }
            }
          }
        }
      }
    }
  }

  .pageSize {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 30px;

    span {
      color: #000;
    }

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

      :deep(.el-pagination__goto) {
        color: #000;
      }

      :deep(.el-pagination__classifier) {
        color: #000;
      }

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

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

      :deep(.el-pager li.is-active) {
        background-color: rgba(111, 182, 184, 1);
      }

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

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

.el-input {
  width: 192px;
}
</style>
