licp
2024-05-11 d40e875d8e025fd09566e919306f5b05755c25cb
x优化班次
已修改4个文件
108 ■■■■■ 文件已修改
src/components/do/b3-work-time-management/work-time-management.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/tool/scroll-paging.vue 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b3-classes.vue 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b3-work-time-management/work-time-management.vue
@@ -84,7 +84,7 @@
            <el-form-item label="录入时间:">
              <el-radio-group v-model="formData.value0" size="small">
                <el-radio :label="0">今天</el-radio>
                <el-radio :label="1">明天</el-radio>
                <el-radio :label="1">昨天</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="年份:">
src/components/tool/scroll-paging.vue
@@ -1,5 +1,5 @@
<template>
  <div class="scroll-pagination"  ref="content" @scroll="scrollFn">
  <div class="scroll-pagination"  ref="content" @scroll="onScroll">
    <slot></slot>
    <el-button
        v-if="isLoding"
@@ -30,13 +30,19 @@
      isLoding: false,
    }
  },
  created(){
    // 防抖
    this.onScroll = this.debounce(this.scrollFn,2000);
    // 节流
    // this.onScroll = this.throttle(this.scrollFn,1000);
  },
  mounted(){
    window.addEventListener("scroll", this.throttle(this.scrollFn, 20000));
  },
  methods: {
    onScroll(){},
    scrollFn() {
      let content = this.$refs.content
      if (content.scrollTop + content.clientHeight >= content.scrollHeight) {
      if (content.scrollTop + content.clientHeight+1 >= content.scrollHeight) {
        if(!this.finishLoding){
          this.loadMore()
        }else{
@@ -47,30 +53,37 @@
    loadMore(){
      if (this.isLoding) return
      this.isLoding = true
      // Simulate loading data (replace with your own API call)
      setTimeout(() => {
        this.$emit('load')
        this.isLoding = false
      }, 1000)
    },
    throttle(fn, wait) {
      // 封装函数进行节流
      var timer = null;
    debounce(func, delay) {
      let timer = null;
      return function () {
        var context = this;
        var args = arguments;
        if (!timer) {
          timer = setTimeout(function () {
            fn.apply(context, args);
            timer = null;
          }, wait);
        if (timer) {
          clearTimeout(timer);
          timer = null;
        }
        timer = setTimeout(() => {
          func(...arguments);
        }, delay);
      };
    },
  },
  destroyed() {
    window.removeEventListener("scroll", this.throttle(), false);
  },
    throttle(func, delay) {
      let time = null;
      return function () {
        let args = Array.from(arguments);
        if (time === null) {
          time = setTimeout(() => {
            func(...args);
            clearTimeout(time);
            time = null;
          }, delay);
        }
      };
    }
  }
}
</script>
src/components/view/b3-classes.vue
@@ -10,6 +10,7 @@
          size="small"
          format="yyyy"
          placeholder="选择年"
          @change="refreshTable()"
          style="width: 140px;"
          :clearable="false">
        </el-date-picker>
@@ -18,7 +19,8 @@
        clearable
        placeholder="选择月"
        style="width: 140px;margin-left: 16px;"
        size="small">
        size="small"
        @change="refreshTable()">
          <el-option
            v-for="item in monthOptions"
            :key="item.value"
@@ -26,8 +28,8 @@
            :value="item.value">
          </el-option>
        </el-select>
        <el-input v-model="query.userName" placeholder="请输入人员名称" size="small" style="width: 140px;margin: 0 16px;" clearable ></el-input>
        <el-select v-model="query.laboratory" placeholder="请选择实验室" style="width: 140px;" size="small" clearable >
        <el-input v-model="query.userName" placeholder="请输入人员名称" size="small" style="width: 140px;margin: 0 16px;" clearable @keyup.enter.native="refreshTable()"></el-input>
        <el-select v-model="query.laboratory" placeholder="请选择实验室" style="width: 140px;" size="small" clearable @change="refreshTable()">
          <el-option
            v-for="item in laboratory"
            :key="item.value"
@@ -47,7 +49,7 @@
    </div>
  </div>
  <div class="center" v-loading="pageLoading">
    <scroll-pagination @load="init" :finishLoding="finishLoding" v-show="query.month&&list.length>0">
    <scroll-pagination @load="init" :finishLoding="finishLoding" v-show="query.month&&list.length>0" style="height: 100%;" :key="'123'">
      <div class="clearfix">
        <div class="fixed-left">
          <div class="content-title" style="padding-left: 16px;box-sizing: border-box;">
@@ -99,7 +101,7 @@
        </div>
      </div>
    </scroll-pagination>
    <scroll-pagination @load="initYear" :finishLoding="finishLoding" v-show="!query.month&&list.length>0" style="width: 100%;">
    <scroll-pagination @load="initYear" :finishLoding="finishLoding" v-show="!query.month&&yearList.length>0" style="width: 100%;" :key="'111'">
      <div class="clearfix year-table">
      <div class="fixed-left">
        <div class="content-title" style="padding-left: 16px;box-sizing: border-box;">
@@ -146,23 +148,23 @@
      </div>
    </div>
    </scroll-pagination>
    <span style="color:#909399;font-size:14px;position: absolute;left:50%;top: 50%;transform: translate(-59%,-50%);" v-if="list.length==0">暂无数据</span>
    <span style="color:#909399;font-size:14px;position: absolute;left:50%;top: 50%;transform: translate(-59%,-50%);" v-if="(query.month&&list.length==0)||(!query.month&&yearList.length==0)">暂无数据</span>
  </div>
  <el-dialog title="排班" :visible.sync="schedulingVisible" width="400px">
    <div class="search_thing">
      <div class="search_label" style="width:90px">周次:</div>
      <div class="search_input">
      <div class="search_label" style="width:90px"><span style="color: red;margin-right: 4px;">*</span>周次:</div>
      <div class="search_input" style="width: calc(100% - 90px);">
        <el-date-picker
          v-model="schedulingQuery.week"
          type="week"
          format="yyyy 第 WW 周"
          placeholder="选择周次" style="width: 203px;">
          placeholder="选择周次" style="width: 100%">
        </el-date-picker>
      </div>
    </div>
    <div class="search_thing">
      <div class="search_label" style="width:90px">人员名称:</div>
      <div class="search_input">
      <div class="search_label" style="width:90px"><span style="color: red;margin-right: 4px;">*</span>人员名称:</div>
      <div class="search_input" style="width: calc(100% - 90px);">
        <el-select v-model="schedulingQuery.userId" placeholder="请选择" style="width: 100%;" multiple clearable collapse-tags >
          <el-option
            v-for="item in personList"
@@ -174,8 +176,8 @@
      </div>
    </div>
    <div class="search_thing">
      <div class="search_label" style="width:90px">班次:</div>
      <div class="search_input">
      <div class="search_label" style="width:90px"><span style="color: red;margin-right: 4px;">*</span>班次:</div>
      <div class="search_input" style="width: calc(100% - 90px);">
        <el-select v-model="schedulingQuery.shift" placeholder="请选择" style="width: 100%;">
          <el-option
            v-for="item in classType"
@@ -301,13 +303,13 @@
    //   }
    //   this.monthList.reverse()
    // },
    'query.month'(val){
      if(!val){
        this.currentPage = 1;
        this.yearList = []
        this.initYear()
      }
    }
    // 'query.month'(val){
    //   if(!val){
    //     this.currentPage = 1;
    //     this.yearList = []
    //     this.initYear()
    //   }
    // }
  },
  mounted(){
    this.selectEnumByCategory()
@@ -343,12 +345,12 @@
      }
    },
    refreshTable(){
      this.list = [];
      this.yearList = []
      this.currentPage = 1
      if(this.query.month){
        this.list = [];
        this.init()
      }else{
        this.yearList = []
        this.initYear()
      }
    },
@@ -430,7 +432,6 @@
              let obj = {}
              for (let key in item.month[m]) {
                let type = this.getDayByDic(key)
                console.log(type)
                if(type!=undefined||type!=null){
                  obj[`day${type}`] = item.month[m][key]
                }
@@ -619,17 +620,17 @@
}
.center {
  width: 100%;
  height: calc(100% - 40px );
  height: calc(100% - 50px );
  background-color: #fff;
  overflow-y: auto;
  display: flex;
}
>>>.scroll-pagination{
  overflow-y: scroll;
  scrollbar-width: none; /* 对于 Firefox 和 IE 的兼容写法 */
  scrollbar-width: none;
}
>>>.scroll-pagination::-webkit-scrollbar {
  display: none; /* 对于 Chrome, Safari 和 Opera 的写法 */
  display: none;
}
.fixed-left {
  float: left;
src/main.js
@@ -14,8 +14,8 @@
//本地
Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
// const javaApi = 'http://192.168.11.200:8001';//李
// const javaApi = 'http://192.168.11.249:8001';//张
const javaApi = 'http://172.20.10.3:8001';//姜
const javaApi = 'http://10.20.102.168:8001';//张
// const javaApi = 'http://172.20.10.3:8001';//姜
// const javaApi = 'http://192.168.11.2:8001';//柴
// const javaApi = 'http://114.132.189.42:1234';//测试服
//胜云服务器