spring
2025-02-18 5b0b688ff9f1bdf08ef651718708aa42d1b2477b
src/views/performance/class/index.vue
@@ -67,15 +67,14 @@
        <el-button
          size="small"
          type="primary"
          v-if="listPower"
          v-if="checkPermi(['performance:class:time'])"
          @click="configTime"
          :loading="downLoading"
          >时间配置</el-button
        >
        <el-button
          size="small"
          type="primary"
          v-if="downPower"
          v-if="checkPermi(['performance:class:down'])"
          @click="handleDown"
          :loading="downLoading"
          >导 出</el-button
@@ -84,7 +83,7 @@
          size="small"
          type="primary"
          @click="schedulingVisible = true"
          v-if="addPower"
          v-if="checkPermi(['performance:class:add'])"
          >排 班</el-button
        >
      </div>
@@ -106,9 +105,18 @@
            v-on:mouseenter="onMouseEnter(index)"
            v-on:mouseleave="currentUserIndex = null"
          >
            <div class="user-pic">{{ item.name.charAt(0) }}</div>
            <div class="user-pic">
              {{ item.name ? item.name.charAt(0) : "" }}
            </div>
            <div class="user-info">
              <p style="font-size: 14px; color: #3a7bfa; line-height: 24px">
              <p
                style="
                  font-size: 14px;
                  color: #3a7bfa;
                  line-height: 24px;
                  margin: 0;
                "
              >
                {{ item.name }}
              </p>
              <p
@@ -119,13 +127,14 @@
                  white-space: nowrap;
                  width: 150px;
                  overflow-x: show;
                  margin: 0;
                "
              >
                早:{{ item.day0 }},中:{{ item.day1 }},夜:{{ item.day2 }},休:{{
                  item.day3
                }},假:{{ item.day4 }},差:{{ item.day6 }}
              </p>
              <p style="margin-top: 4px">
              <p style="margin-top: 4px; margin: 0">
                <span
                  style="
                    color: #999999;
@@ -158,7 +167,7 @@
              >
                <span
                  class="month"
                  style="position: absolute; top: 4px"
                  style="position: absolute; top: 0px"
                  v-if="item.week == '周日'"
                  >{{ item.weekNum }}周</span
                >
@@ -185,7 +194,7 @@
                  trigger="click"
                  placement="bottom"
                  @command="(e) => handleCommand(e, m)"
                  :disabled="!upPower"
                  :disabled="!checkPermi(['performance:class:edit'])"
                  style="width: 100%; height: 100%; cursor: pointer"
                >
                  <div
@@ -212,8 +221,8 @@
                    <el-dropdown-item
                      v-for="(n, j) in classType"
                      :key="'h' + j"
                      :command="n.value"
                      >{{ n.label }}</el-dropdown-item
                      :command="n.dictValue"
                      >{{ n.dictLabel }}</el-dropdown-item
                    >
                  </el-dropdown-menu>
                </el-dropdown>
@@ -242,9 +251,18 @@
            v-on:mouseenter="onMouseEnter(index)"
            v-on:mouseleave="currentUserIndex = null"
          >
            <div class="user-pic">{{ item.name.charAt(0) }}</div>
            <div class="user-pic">
              {{ item.name ? item.name.charAt(0) : "" }}
            </div>
            <div class="user-info">
              <p style="font-size: 14px; color: #3a7bfa; line-height: 24px">
              <p
                style="
                  font-size: 14px;
                  color: #3a7bfa;
                  line-height: 24px;
                  margin: 0;
                "
              >
                {{ item.name }}
              </p>
              <p
@@ -255,13 +273,14 @@
                  white-space: nowrap;
                  width: 150px;
                  overflow-x: show;
                  margin: 0;
                "
              >
                早:{{ item.day0 }},中:{{ item.day1 }},夜:{{ item.day2 }},休:{{
                  item.day3
                }},假:{{ item.day4 }},差:{{ item.day6 }}
              </p>
              <p style="margin-top: 4px">
              <p style="margin-top: 4px; margin: 0">
                <span
                  style="
                    color: #999999;
@@ -358,9 +377,9 @@
                >
                  <el-option
                    v-for="obj in timeTypeList"
                    :key="obj.value"
                    :label="obj.label"
                    :value="obj.value"
                    :key="obj.dictValue"
                    :label="obj.dictLabel"
                    :value="obj.dictValue"
                  >
                  </el-option>
                </el-select>
@@ -492,9 +511,9 @@
          >
            <el-option
              v-for="item in classType"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            >
            </el-option>
          </el-select>
@@ -523,14 +542,11 @@
  exportFile,
  obtainItemParameterList,
  update,
  selectUserList,
  selectUserCondition,
} from "@/api/performance/class";
export default {
  data() {
    return {
      addPower: true,
      upPower: true,
      downPower: true,
      query: {
        userName: "",
        laboratory: "",
@@ -613,7 +629,6 @@
      configTimeVisibleLoading: false, // 时间配置弹框loading
      timeTypeList: [],
      timeQuery: [],
      listPower: false,
    };
  },
  watch: {
@@ -652,7 +667,7 @@
      this.monthList.push(i);
    }
    this.monthList.reverse();
    this.getPower();
    // this.getPower();
  },
  methods: {
    refresh() {
@@ -797,31 +812,6 @@
        });
      });
    },
    getPower() {
      let power = JSON.parse(sessionStorage.getItem("power"));
      let add = false;
      let up = false;
      let down = false;
      let listPower = false;
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == "performanceShiftUpdate") {
          up = true;
        }
        if (power[i].menuMethod == "delDeviceParameter") {
          down = true;
        }
        if (power[i].menuMethod == "performanceShiftAdd") {
          add = true;
        }
        if (power[i].menuMethod == "shiftTimeList") {
          listPower = true;
        }
      }
      this.addPower = add;
      this.upPower = up;
      this.downPower = down;
      this.listPower = listPower;
    },
    onMouseEnter(index) {
      this.currentUserIndex = index;
    },
@@ -854,7 +844,8 @@
        endWeek,
        userId: this.schedulingQuery.userId.join(","),
        shift: this.schedulingQuery.shift,
      }).then((res) => {
      })
        .then((res) => {
        this.loading = false;
        if (res.code == 201) return;
        this.$message.success("操作成功");
@@ -865,6 +856,9 @@
          shift: "",
        };
        this.refresh();
        })
        .catch((err) => {
          this.loading = false;
      });
    },
    configTime() {
@@ -883,10 +877,10 @@
            res.data.forEach((item) => {
              item.isEdit = false;
              const index = this.timeTypeList.findIndex(
                (val) => val.value === item.shift
                (val) => val.dictValue === item.shift
              );
              if (index > -1) {
                item.type = this.timeTypeList[index].label;
                item.type = this.timeTypeList[index].dictLabel;
              }
            });
            this.timeQuery = res.data;
@@ -909,10 +903,10 @@
    saveEdit(item, index) {
      if (item.shift) {
        const index = this.timeTypeList.findIndex(
          (val) => val.value === item.shift
          (val) => val.dictValue === item.shift
        );
        if (index > -1) {
          item.type = this.timeTypeList[index].label;
          item.type = this.timeTypeList[index].dictLabel;
        }
      }
      delete item.orderBy;
@@ -975,7 +969,8 @@
        userName: this.query.userName,
        laboratory: this.query.laboratory,
        isMonth: this.query.month ? true : false,
      }).then((res) => {
      })
        .then((res) => {
        this.$message.success("下载成功");
        this.downLoading = false;
        const blob = new Blob([res], {
@@ -988,6 +983,9 @@
          fileName = year + " 班次汇总";
        }
        this.$download.saveAs(blob, fileName + ".xlsx");
        })
        .catch((err) => {
          this.downLoading = false;
      });
    },
    selectEnumByCategory() {
@@ -1033,63 +1031,35 @@
      }
    },
    getUsers() {
      selectUserList({
        current: -1,
        size: -1,
      }).then((res) => {
      selectUserCondition().then((res) => {
        if (res.code === 201) {
          return;
        }
        let arr = res.data.body.records;
        let arr = res.data;
        this.personList = arr;
      });
    },
    getDayByDic(e) {
      let obj = this.classType.find((m) => m.label == e);
      let obj = this.classType.find((m) => m.dictLabel == e);
      if (obj) {
        return obj.value;
        return obj.dictValue;
      }
    },
    getShiftByDic(e) {
      let obj = this.classType.find((m) => m.value == e);
      let obj = this.classType.find((m) => m.dictValue == e);
      if (obj) {
        return obj.label;
        return obj.dictLabel;
      }
      return "无";
    },
    scrollInit() {
      // 获取要绑定事件的元素
      const nav = document.getElementById("nav");
      var flag; // 鼠标按下
      var downX; // 鼠标点击的x下标
      var scrollLeft; // 当前元素滚动条的偏移量
      nav.addEventListener("mousedown", function (event) {
        flag = true;
        downX = event.clientX; // 获取到点击的x下标
        scrollLeft = this.scrollLeft; // 获取当前元素滚动条的偏移量
      });
      nav.addEventListener("mousemove", function (event) {
        if (flag) {
          // 判断是否是鼠标按下滚动元素区域
          var moveX = event.clientX; // 获取移动的x轴
          var scrollX = moveX - downX; // 当前移动的x轴下标减去刚点击下去的x轴下标得到鼠标滑动距离
          this.scrollLeft = scrollLeft - scrollX; // 鼠标按下的滚动条偏移量减去当前鼠标的滑动距离
        }
      });
      // 鼠标抬起停止拖动
      nav.addEventListener("mouseup", function () {
        flag = false;
      });
      // 鼠标离开元素停止拖动
      nav.addEventListener("mouseleave", function (event) {
        flag = false;
      });
    },
  },
};
</script>
<style scoped>
.class-page {
  padding: 10px;
}
.form_title {
  height: 36px;
  display: flex;
@@ -1127,7 +1097,7 @@
}
.center {
  width: 100%;
  height: calc(100% - 100px);
  height: calc(100vh - 220px);
  background-color: #fff;
  overflow-y: auto;
  display: flex;
@@ -1161,8 +1131,8 @@
  min-height: calc(100% - 10px); /* 视口高度 */
}
.content-title {
  height: 52px;
  line-height: 52px;
  height: 58px;
  line-height: 58px;
  border-bottom: 1px solid #eeeeee;
}
.content-title-right {
@@ -1194,6 +1164,7 @@
.content-title-item .day {
  font-size: 14px;
  color: #333333;
  margin-right: 4px;
}
.content-title-item .week {
  font-size: 12px;