zouyu
2026-04-20 df3902e7eae5dd38a2d47aa63e5f27131f701db9
src/views/performance/class/index.vue
@@ -41,8 +41,7 @@
            人员名称
            <span style="color:#ff4949">(人员数量:{{list.length}})</span>
          </div>
          <div class="content-user" :class="{ hoverType: currentUserIndex == index }" v-for="(item, index) in list"
            :key="'e' + index" v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null">
          <div class="content-user" v-for="(item, index) in list">
            <div class="user-pic">
              {{ item.userName ? item.userName.charAt(0) : "" }}
            </div>
@@ -55,13 +54,7 @@
                ">
                {{ item.userName }}
              </p>
              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;">
                <span>早:{{ item.monthlyAttendance.morningShift}},</span>
                <span>中:{{ item.monthlyAttendance.swingShift}},</span>
                <span>夜:{{ item.monthlyAttendance.nightShift}},</span>
                <span>休:{{ item.monthlyAttendance.holidayShift}},</span>
                <span>假:{{ item.monthlyAttendance.leaveShift}},</span>
                <span>差:0</span>
              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;" v-text="item.monthlyAttendanceStr">
              </p>
              <p style="margin-top: 4px; margin: 0">
                <span style="
@@ -69,7 +62,7 @@
                    font-size: 12px;
                    display: inline-block;
                    transform: scale(0.8) translateX(-10px);
                  ">合计出勤: </span><span style="font-size: 16px; color: #ff4902">{{item.monthlyAttendance.morningShift+item.monthlyAttendance.swingShift+item.monthlyAttendance.nightShift}}天</span>
                  ">合计出勤: </span><span style="font-size: 16px; color: #ff4902">{{item.monthlyAttendance.totalCount}}天</span>
              </p>
            </div>
          </div>
@@ -86,8 +79,7 @@
                </p>
              </div>
            </div>
            <div class="content-body" v-for="(item, index) in list" :key="'c' + index"
              v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null">
            <div class="content-body" v-for="(item, index) in list" :key="'c' + index">
              <div class="content-body-item" v-for="(m, i) in item.list" :key="'d' + i"
                :class="{ hoverType: currentUserIndex == index }">
                <el-dropdown trigger="click" placement="bottom" @command="(e) => handleCommand(e, m)"
@@ -115,8 +107,8 @@
            人员名称
            <span style="color:#ff4949">(人员数量:{{yearList.length}})</span>
          </div>
          <div class="content-user" :class="{ hoverType: currentUserIndex == index }" v-for="(item, index) in yearList"
            :key="'e' + index" v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null">
          <div class="content-user" v-for="(item, index) in yearList"
            :key="'e' + index">
            <div class="user-pic">
              {{ item.userName ? item.userName.charAt(0) : "" }}
            </div>
@@ -129,21 +121,14 @@
                ">
                {{ item.userName }}
              </p>
              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;">
                <span>早:{{ item.sidebarAnnualAttendance.morningShift}},</span>
                <span>中:{{ item.sidebarAnnualAttendance.swingShift}},</span>
                <span>夜:{{ item.sidebarAnnualAttendance.nightShift}},</span>
                <span>休:{{ item.sidebarAnnualAttendance.holidayShift}},</span>
                <span>假:{{ item.sidebarAnnualAttendance.leaveShift}},</span>
                <span>差:0</span>
              </p>
              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;" v-text="item.sidebarAnnualAttendanceStr"></p>
              <p style="margin-top: 4px; margin: 0">
                <span style="
                    color: #999999;
                    font-size: 12px;
                    display: inline-block;
                    transform: scale(0.8) translateX(-10px);
                  ">合计出勤: </span><span style="font-size: 16px; color: #ff4902">{{item.sidebarAnnualAttendance.morningShift+item.sidebarAnnualAttendance.swingShift+item.sidebarAnnualAttendance.nightShift}}天</span>
                  ">合计出勤: </span><span style="font-size: 16px; color: #ff4902">{{item.sidebarAnnualAttendance.totalCount}}天</span>
              </p>
            </div>
          </div>
@@ -158,21 +143,15 @@
                  <span class="month">{{ item }}月</span>
                </div>
              </div>
              <div class="content-body" v-for="(item, index) in yearList" :key="'c' + index"
                v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null" :style="`display: grid;
              <div class="content-body" v-for="(item, index) in yearList" :key="'c' + index" :style="`display: grid;
              grid-template-columns: repeat(${monthList.length}, 1fr);`">
                <div class="content-body-item" v-for="(m, i) in item.monthlyAttendance" :key="'d' + i"
                <div class="content-body-item" v-for="(m, i) in item.monthlyAttendances" :key="'d' + i"
                  :class="{ hoverType: currentUserIndex == index }">
                  <p style="color: rgb(153, 153, 153); font-size: 12px">
                    合计出勤:<span style="font-size: 14px; color: #000">{{m.morningShift+m.swingShift+m.nightShift}}</span>
                    合计出勤:<span style="font-size: 14px; color: #000">{{m.monthlyAttendance.totalCount}}</span>
                  </p>
                  <p style="color: rgb(153, 153, 153); font-size: 12px">
                    <span>早:{{ m.morningShift}},</span>
                    <span>中:{{ m.swingShift}},</span>
                    <span>夜:{{ m.nightShift}},</span>
                    <span>休:{{ m.holidayShift}},</span>
                    <span>假:{{ m.leaveShift}},</span>
                    <span>差:0</span>
                    <span>{{m.monthlyAttendanceStr}}</span>
                  </p>
                </div>
              </div>
@@ -265,9 +244,7 @@
          <span style="color: red; margin-right: 4px">*</span>人员名称:
        </div>
        <div class="search_input" style="width: calc(100% - 90px)">
          <el-select v-model="schedulingQuery.userId" popper-class="select-with-all" placeholder="请选择" style="width: 100%" multiple collapse-tags clearable>
<!--            <el-option v-for="item in personList" :key="item.id" :label="item.name" :value="item.id">-->
<!--            </el-option>-->
          <el-select v-model="schedulingQuery.userIdList" popper-class="select-with-all" placeholder="请选择" style="width: 100%" multiple collapse-tags clearable>
            <template slot="prefix">
              <el-button
                type="text"
@@ -284,7 +261,10 @@
              :key="item.id"
              :label="item.name"
              :value="item.id"
            />
            >
              <span style="float: left">{{ item.name }}</span>
              <span style="float: right; color: #8492a6; font-size: 13px">{{ item.account }}</span>
            </el-option>
          </el-select>
        </div>
      </div>
@@ -320,11 +300,12 @@
  exportFile,
  obtainItemParameterList,
  update,
  selectUserCondition,
  editAnnotationText,
  delAnnotationText
} from "@/api/performance/class";
import {selectUserListByPerformance} from '@/api/system/user'
import {getWorkMonth} from "@/utils/date";
import {transformExcel} from '@/utils/file'
export default {
  name: 'Class',
  data() {
@@ -394,7 +375,7 @@
      loading: false,
      schedulingQuery: {
        week: "",
        userId: [],
        userIdList: [],
        shift: "",
      },
      list: [],
@@ -418,7 +399,7 @@
  },
  computed:{
    isAllSelected() {
      return this.schedulingQuery.userId.length === this.personList.length && this.personList.length > 0;
      return this.schedulingQuery.userIdList.length === this.personList.length && this.personList.length > 0;
    },
  },
  watch: {
@@ -446,10 +427,10 @@
  methods: {
    handleSelectAll() {
      if (this.isAllSelected) {
        this.schedulingQuery.userId = [];
        this.schedulingQuery.userIdList = [];
      } else {
        // 只选中可用选项的value
        this.schedulingQuery.userId = this.personList.map(item => item.id);
        this.schedulingQuery.userIdList = this.personList.map(item => item.id);
      }
    },
    handleContextMenu(target,e) {
@@ -595,9 +576,6 @@
        this.yearList = res.data
      });
    },
    onMouseEnter(index) {
      this.currentUserIndex = index;
    },
    confirmScheduling() {
      if (!this.schedulingQuery.week) {
        this.$message.error("请选择周次");
@@ -611,8 +589,8 @@
        getYearAndMonthAndDays(new Date(time + 24 * 60 * 60 * 1000 * 5)) +
        " 00:00:00";
      if (
        !this.schedulingQuery.userId ||
        this.schedulingQuery.userId.length == 0
        !this.schedulingQuery.userIdList ||
        this.schedulingQuery.userIdList.length == 0
      ) {
        this.$message.error("请选择人员");
        return;
@@ -625,7 +603,7 @@
      add({
        startWeek,
        endWeek,
        userId: this.schedulingQuery.userId.join(","),
        userIdList: this.schedulingQuery.userIdList,
        shift: this.schedulingQuery.shift,
      })
        .then((res) => {
@@ -634,7 +612,7 @@
          this.schedulingVisible = false;
          this.schedulingQuery = {
            week: "",
            userId: [],
            userIdList: [],
            shift: "",
          };
          this.refresh();
@@ -746,21 +724,18 @@
        time,
        userName: this.query.userName,
        laboratory: this.query.laboratory,
        isMonth: this.query.month ? true : false,
        isMonth: !!this.query.month,
      })
        .then((res) => {
          this.$message.success("下载成功");
          this.downLoading = false;
          const blob = new Blob([res], {
            type: "application/force-download",
          });
          let fileName = "";
          let fileName = "中天耐丝质量部";
          if (this.query.month) {
            fileName = year + "-" + this.query.month + " 班次信息";
            fileName += this.query.month + "月班次信息";
          } else {
            fileName = year + " 班次汇总";
            fileName += year + "年班次汇总";
          }
          this.$download.saveAs(blob, fileName + ".xlsx");
          transformExcel(res, fileName + ".xlsx");
          this.$message.success("导出成功");
        })
        .catch((err) => {
          this.downLoading = false;
@@ -772,29 +747,16 @@
      });
    },
    obtainItemParameterList() {
      if (this.PROJECT == "检测中心") {
        this.laboratory = [
          {
            label: "通信产品实验室",
            value: "通信产品实验室",
          },
          {
            label: "电力产品实验室",
            value: "电力产品实验室",
          },
        ];
      } else {
        obtainItemParameterList().then((res) => {
          let data = [];
          res.data.forEach((a) => {
            data.push({
              label: a.laboratoryName,
              value: a.id,
            });
      obtainItemParameterList().then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
            label: a.laboratoryName,
            value: a.id,
          });
          this.laboratory = data;
        });
      }
        this.laboratory = data;
      });
    },
    handleCommand(e, m) {
      if (e != m.shift) {
@@ -808,16 +770,9 @@
      }
    },
    getUsers() {
      selectUserCondition({ type: 1 }).then((res) => {
        let arr = res.data;
        this.personList = arr;
      selectUserListByPerformance().then((res) => {
        this.personList = res.data;
      });
    },
    getDayByDic(e) {
      let obj = this.classType.find((m) => m.dictLabel == e);
      if (obj) {
        return obj.dictValue;
      }
    },
    getShiftByDic(e) {
      let obj = this.classType.find((m) => m.dictValue == e);