From d40e875d8e025fd09566e919306f5b05755c25cb Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期六, 11 五月 2024 14:51:17 +0800 Subject: [PATCH] x优化班次 --- src/components/tool/scroll-paging.vue | 49 +++++++++++++++--------- src/main.js | 4 +- src/components/do/b3-work-time-management/work-time-management.vue | 2 src/components/view/b3-classes.vue | 53 +++++++++++++------------- 4 files changed, 61 insertions(+), 47 deletions(-) diff --git a/src/components/do/b3-work-time-management/work-time-management.vue b/src/components/do/b3-work-time-management/work-time-management.vue index 0024274..cb657d0 100644 --- a/src/components/do/b3-work-time-management/work-time-management.vue +++ b/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="骞翠唤:"> diff --git a/src/components/tool/scroll-paging.vue b/src/components/tool/scroll-paging.vue index c60265f..41b2e10 100644 --- a/src/components/tool/scroll-paging.vue +++ b/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> diff --git a/src/components/view/b3-classes.vue b/src/components/view/b3-classes.vue index 6628607..2d9ffd5 100644 --- a/src/components/view/b3-classes.vue +++ b/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; diff --git a/src/main.js b/src/main.js index e0e4031..f149db9 100644 --- a/src/main.js +++ b/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';//娴嬭瘯鏈� //鑳滀簯鏈嶅姟鍣� -- Gitblit v1.9.3