From ef48e4b7a4d34e63ffd2cb23c406f4da6eb72ed7 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 14 五月 2024 13:42:26 +0800 Subject: [PATCH] 优化消息管理,标准库管理 --- src/components/view/b2-standard.vue | 57 +++++++++++-- src/view/notice.vue | 39 --------- src/components/do/b1-inspect-order-plan/Inspection.vue | 2 src/components/view/a5-laboratory-management.vue | 4 src/components/view/b3-classes.vue | 39 +++++++++ src/view/index.vue | 2 src/assets/api/controller.js | 1 src/components/view/index-index.vue | 21 ++++- src/components/view/notice-detail.vue | 20 ++-- 9 files changed, 118 insertions(+), 67 deletions(-) diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js index 7c20039..4ac4421 100644 --- a/src/assets/api/controller.js +++ b/src/assets/api/controller.js @@ -264,6 +264,7 @@ page:"/performanceShift/page",//缁╂晥绠$悊-鐝-鍒嗛〉鏌ヨ update:"/performanceShift/update",//缁╂晥绠$悊-鐝-鐝鐘舵�佷慨鏀� pageYear:"/performanceShift/pageYear",//缁╂晥绠$悊-鐝-骞翠唤鍒嗛〉鏌ヨ + export:"/performanceShift/export",//缁╂晥绠$悊-鐝-瀵煎嚭 } const auxiliaryWorkingHours = { diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue index b41f179..ca447d2 100644 --- a/src/components/do/b1-inspect-order-plan/Inspection.vue +++ b/src/components/do/b1-inspect-order-plan/Inspection.vue @@ -571,7 +571,7 @@ const mySet1 = new Set(); this.tableLists = this.currentSample.insProduct.filter(m => { let num0 = mySet1.size; - if (m.templateId != null) { + if (m.templateId != null&&m.template != null) { mySet1.add(JSON.stringify({ template: m.template, templateId: m.templateId diff --git a/src/components/view/a5-laboratory-management.vue b/src/components/view/a5-laboratory-management.vue index 82e8e6d..d3b1cb9 100644 --- a/src/components/view/a5-laboratory-management.vue +++ b/src/components/view/a5-laboratory-management.vue @@ -244,8 +244,8 @@ children:[] }, { - value:'棰濆绫诲瀷', - label:'棰濆绫诲瀷', + value:'鎶ュ憡绫诲瀷', + label:'鎶ュ憡绫诲瀷', children:null }, ], diff --git a/src/components/view/b2-standard.vue b/src/components/view/b2-standard.vue index 46dba57..76219ef 100644 --- a/src/components/view/b2-standard.vue +++ b/src/components/view/b2-standard.vue @@ -58,7 +58,7 @@ } .product_table .el-table { - height: 100%; + height: calc(100% - 35px) !important; } .sort { @@ -161,8 +161,9 @@ </el-table> </el-row> <el-row class="product_table" v-loading="tableLoad2"> - <el-table :data="productList" ref="productTable" style="width: 100%;" height="100%" tooltip-effect="dark" stripe - :fit="true" border @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" + <el-table :data="pagedData" ref="productTable" style="width: 100%;" height="100%" tooltip-effect="dark" stripe + :fit="true" border + @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" @select="upProductSelect" @select-all="handleAll"> <el-table-column type="selection" width="65"> </el-table-column> @@ -231,6 +232,14 @@ </template> </el-table-column> </el-table> + <el-pagination + style="position: absolute;right: 16px;bottom: 1px;" + @current-change="handleCurrentChange" + :current-page="currentPage" + :page-size="pageSize" + layout="total, prev, pager, next, jumper" + :total="total"> + </el-pagination> </el-row> </div> <el-dialog title="鍒嗙被娣诲姞" :visible.sync="addDia" width="400px"> @@ -428,7 +437,29 @@ sectionLoad: false, sectionRow: null, sectionList: [], - templateList: [] + templateList: [], + total:0, + pageSize:100, + currentPage:1, + } + }, + computed: { + pagedData() { + const start = (this.currentPage - 1) * this.pageSize; + const end = start + this.pageSize; + return this.productList.slice(start, end); + }, + }, + watch:{ + pagedData:{ + deep:true, + handler(val){ + setTimeout(() => { + val.forEach(a => { + if (a.state == 1) this.toggleSelection(a) + }) + }, 300) + } } }, mounted() { @@ -912,11 +943,12 @@ tree: this.selectTree }).then(res => { this.productList = res.data - setTimeout(() => { - this.productList.forEach(a => { - if (a.state == 1) this.toggleSelection(a) - }) - }, 300) + this.total = this.productList.length; + // setTimeout(() => { + // this.productList.forEach(a => { + // if (a.state == 1) this.toggleSelection(a) + // }) + // }, 300) this.tableLoad2 = false }) }, @@ -955,13 +987,13 @@ }, handleAll(e) { if (e.length > 0) { - this.productList.map(m => { + this.productList = this.productList.map(m => { m.state = 0 this.upProductSelect(null, m) return m }) } else { - this.productList.map(m => { + this.productList = this.productList.map(m => { m.state = 1 this.upProductSelect(null, m) return m @@ -1039,6 +1071,9 @@ this.templateList = res.data }) }, + handleCurrentChange(val) { + this.currentPage = val; + }, } } </script> diff --git a/src/components/view/b3-classes.vue b/src/components/view/b3-classes.vue index 0417519..61a4050 100644 --- a/src/components/view/b3-classes.vue +++ b/src/components/view/b3-classes.vue @@ -44,7 +44,7 @@ <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> </div> <div class="search_thing btns" style="padding-left: 30px;"> - <el-button size="small" type="primary" v-if="downPower">瀵� 鍑�</el-button> + <el-button size="small" type="primary" v-if="downPower" @click="handleDown" :loading="downLoading">瀵� 鍑�</el-button> <el-button size="small" type="primary" @click="schedulingVisible = true" v-if="addPower">鎺� 鐝�</el-button> </div> </div> @@ -286,7 +286,8 @@ pageLoading: false, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡 monthList:[], - yearList:[] + yearList:[], + downLoading:false, } }, watch: { @@ -516,6 +517,40 @@ this.refresh() }) }, + handleDown(){ + let year = this.query.year.getFullYear() + let time = ''; + if(this.query.month){ + let month = this.query.month>9?this.query.month:'0'+this.query.month + time = year+'-'+month+'-01 00:00:00' + }else{ + time = year+'-01-01 00:00:00' + } + this.downLoading = true + this.$axios.get(this.$api.performanceShift.export+`?time=${time}&userName=${this.query.userName}&laboratory=${this.query.laboratory}&isMonth=${this.query.month?true:false}`,{responseType: 'blob'}).then(res => { + this.$message.success('涓嬭浇鎴愬姛') + this.downLoading = false + const blob = new Blob([res], { + type: 'application/force-download' + }) + let fileName=""; + if(this.query.month){ + fileName = year +'-'+this.query.month+' 鐝淇℃伅' + }else{ + fileName = year+' 鐝姹囨��' + } + const filename = decodeURI(fileName+'.xlsx') + // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� + const elink = document.createElement('a') + elink.download = filename + elink.style.display = 'none' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click() + URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 + document.body.removeChild(elink) + }) + }, selectEnumByCategory() { this.$axios.post(this.$api.enums.selectEnumByCategory, { category: "鐝绫诲瀷" diff --git a/src/components/view/index-index.vue b/src/components/view/index-index.vue index d74400e..f1b2499 100644 --- a/src/components/view/index-index.vue +++ b/src/components/view/index-index.vue @@ -439,7 +439,8 @@ pageSize: 8, // 涓�椤�7鏉� total: null, listLoading: true, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue - finishLoding: false // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡 + finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡 + timer:null } }, watch:{ @@ -458,12 +459,20 @@ setInterval(() => { this.nowTime() }, 1000) - this.init(); this.weekdays = this.getWeekdaysForNextWeek() - this.getScheduleByMe() + this.init(); this.currentPage = 1; this.list = []; this.getList(); + this.getScheduleByMe() + this.timer&&clearInterval(this.timer) + this.timer = setInterval(() => { + this.init(); + this.currentPage = 1; + this.list = []; + this.getList(); + this.getScheduleByMe() + },1000*60*10) }, methods: { getList(){ @@ -623,10 +632,11 @@ let weekdays = []; for (let i = 0; i < 7; i++) { let date = new Date(); - date.setDate(date.getDate() + i); // 浠婂ぉ涔嬪悗鐨勬棩瀛� + date.setDate(date.getDate() - i); // 浠婂ぉ涔嬪悗鐨勬棩瀛� let day = date.getDay(); // 0-6 浠h〃鏄熸湡鏃ュ埌鏄熸湡鍏� weekdays.push(day); } + weekdays.reverse() weekdays = weekdays.map(m=>{ let day ='' switch (m) { @@ -691,5 +701,8 @@ }) }, }, + deactivated(){ + this.timer&&clearInterval(this.timer) + } } </script> diff --git a/src/components/view/notice-detail.vue b/src/components/view/notice-detail.vue index 0c67cb0..b1fd617 100644 --- a/src/components/view/notice-detail.vue +++ b/src/components/view/notice-detail.vue @@ -1,7 +1,7 @@ <template> <div class="notice-detail-page"> <div class="notice-detail-head"> - <h4 style="margin-bottom: 16px;">{{ noticeInfo.theme }} <el-tag style="margin-left: 10px;" :type="options.find(m=>m.value==noticeInfo.messageType).type" v-if="options.find(m=>m.value==noticeInfo.messageType)">{{ options.find(m=>m.value==noticeInfo.messageType).label }}</el-tag></h4> + <h4 style="margin-bottom: 16px;" v-if="noticeInfo.theme">{{ noticeInfo.theme }} <el-tag style="margin-left: 10px;" :type="options.find(m=>m.value==noticeInfo.messageType).type" v-if="options.find(m=>m.value==noticeInfo.messageType)">{{ options.find(m=>m.value==noticeInfo.messageType).label }}</el-tag></h4> <p style="font-size: 12px;color: #999;margin-bottom: 20px;"> <!-- <span>娑堟伅绫诲瀷锛氬鎵� </span> --> <span>鍙戦�佷汉锛歿{ noticeInfo.createUser }} </span> @@ -41,15 +41,11 @@ options:[] } }, - created(){ - this.noticeInfo = JSON.parse(sessionStorage.getItem("noticeInfo")); - }, mounted(){ - this.noticeInfo = JSON.parse(sessionStorage.getItem("noticeInfo")); + this.noticeInfo = JSON.parse(localStorage.getItem("noticeInfo")); this.$bus.$on("change", (msg) => { this.noticeInfo = JSON.parse(msg); - console.log(this.noticeInfo); - sessionStorage.setItem("noticeInfo", msg); + localStorage.setItem("noticeInfo", msg); }); this.getTypeDicts() }, @@ -69,7 +65,11 @@ <style scoped> .notice-detail-page{ height: calc(100% - 30px); + overflow-y: auto; padding: 16px 0; +} +.notice-detail-page::-webkit-scrollbar { + width: 0; } .notice-detail-head{ background: #fff; @@ -83,9 +83,9 @@ box-sizing: border-box; padding: 8px 20px 20px; background: rgba(0,0,0, 0.03); - box-shadow: 0 0 10px 10px #fff; + /* box-shadow: 0 0 10px 10px #fff; */ border-radius: 4px; - height: calc(100% - 192px - 22px); + min-height: calc(100% - 192px - 22px); } .notice-detail-head-content div{ border-radius: 8px; @@ -98,6 +98,6 @@ } .notice-content{ - height: 100%; + height: 600px; } </style> diff --git a/src/view/index.vue b/src/view/index.vue index 60b94d2..7a4697f 100644 --- a/src/view/index.vue +++ b/src/view/index.vue @@ -393,7 +393,7 @@ <el-button type="primary" @click="handleEdit">纭� 瀹�</el-button> </span> </el-dialog> - <notice ref="notice" /> + <notice ref="notice" @goNoticeDetail="checkForUnreadData()" /> </div> </template> diff --git a/src/view/notice.vue b/src/view/notice.vue index 4a10fef..a6391f9 100644 --- a/src/view/notice.vue +++ b/src/view/notice.vue @@ -37,7 +37,8 @@ <scroll-pagination @load="refresh" :finishLoding="finishLoding"> <div class="notice-content-item" v-for="(m,i) in list" :key="i"> <div class="btns" v-if="m"> - <el-dropdown style="margin-right: 20px;" trigger="click" @command="e=>handleDropdown(e,m)" v-if="m.messageType==2||m.messageType==3"> + <!-- v-if="m.messageType==2||m.messageType==3" --> + <el-dropdown style="margin-right: 20px;" trigger="click" @command="e=>handleDropdown(e,m)" v-if="false"> <span class="el-dropdown-link"> <span class="more" style="line-height: 26px;display: inline-block;">···</span> </span> @@ -192,6 +193,7 @@ this.list = []; this.currentPage = 1; this.refresh(); + this.$emit('goNoticeDetail') }) }, handleDropdown(e,row){ @@ -222,38 +224,6 @@ }) }).catch(() => {}) }, - // 婊氬姩瑙﹀簳鍔犺浇 - scrollFn() { - let clientHeight = document.documentElement.clientHeight - 18; //鍙鍖哄煙 - let scrollHeight = document.body.scrollHeight; // 婊氬姩鏂囨。楂樺害 - let scrollTop = parseInt(document.documentElement.scrollTop); // 宸叉粴鍔ㄧ殑楂樺害 - let height = 300; - if ( - scrollTop + clientHeight >= scrollHeight - height && - scrollHeight != 0 - ) { - if (!this.finishLoding&&this.currentPage*this.pageSize<this.total) { - this.currentPage = this.currentPage + 1; - this.refresh(); - } - } else { - return false; - } - }, - throttle(fn, wait) { - // 灏佽鍑芥暟杩涜鑺傛祦 - var timer = null; - return function () { - var context = this; - var args = arguments; - if (!timer) { - timer = setTimeout(function () { - fn.apply(context, args); - timer = null; - }, wait); - } - }; - }, handleType(){ this.list = []; this.currentPage = 1; @@ -274,9 +244,6 @@ this.refresh(); }) } - }, - destroyed() { - window.removeEventListener("scroll", this.throttle(), false); }, } </script> -- Gitblit v1.9.3