From 93d42b7082fcbe57902ae7d4d5c2bbb76a647f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Fri, 6 Aug 2021 18:24:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E8=B5=B7=E6=8A=A5=E4=BB=B7=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=90=9C=E7=B4=A2=E7=89=A9=E8=B5=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supplier/components/wyb-table/wyb-table.vue | 51 ++++++++++++++++++--- supplier/pages/offer/index.vue | 27 +++++++++-- 2 files changed, 68 insertions(+), 10 deletions(-) diff --git a/supplier/components/wyb-table/wyb-table.vue b/supplier/components/wyb-table/wyb-table.vue index 1011f82..d3bfbe5 100644 --- a/supplier/components/wyb-table/wyb-table.vue +++ b/supplier/components/wyb-table/wyb-table.vue @@ -95,7 +95,8 @@ - + position: hIndex === 0 && firstLineFixed ? 'sticky' : 'static', + ...content.searchStyle }"> { + this.$set(c_item, 'searchStyle', {}); + this.headers.map(h_item => { + if(h_item.search){ + let contentLine = c_item[h_item.key]; + if(val && contentLine.indexOf(val) >= 0){ + if(positionIndex == null){ + positionIndex = c_index; // 拿到第一个被匹配的table item + } + this.$set(c_item, 'searchStyle', {backgroundColor: '#ffdede'}); + } + } + }) + }) + // 处理匹配到item时滚动至第一个item + if(positionIndex != null){ + let tabView = document.querySelector('.wyb-table-scroll-view'); // 获取第一层大对象,table + let tabContent = tabView.querySelector('.wyb-table-content'); // 获取第二层,table的content部分 + let contentLine = tabContent.querySelector('.wyb-table-content-line-'+ positionIndex); // 获取第三层,获取内容列 + let tabViewTop = tabView.offsetTop; // table距离页面高度 + let offsetHeight = contentLine.offsetHeight; // table行高度 + let offsetTop = contentLine.offsetTop; // table行距离页面高度 + tabView.scrollTop = offsetTop - tabViewTop - offsetHeight; + }else if(val){ + this.$msg('该关键字没有搜索到物资哦') + } } }, mounted() { @@ -770,7 +807,6 @@ this.$set(item, 'checked', false) }) this.oContentsSort = this.contentsSort.slice() - console.log("this.sortCol", this.sortCol); if (this.sortCol.length !== 0) { this.sortActiveKey = this.sortCol[0].key uni.setStorageSync('lastSortActiveKey', this.sortActiveKey) @@ -790,13 +826,14 @@ let tabContent = tabView.querySelector('.wyb-table-content'); // 获取第二层,table的content部分 let contentLine = tabContent.querySelector('.wyb-table-content-line'); // 获取第三层,获取内容列 let contentItem = contentLine.querySelector('.wyb-table-content-item input'); // 获取第四层,内容单元格 - let offsetLeft = contentItem.offsetParent.offsetLeft - 90; + let offsetWidth = contentItem.offsetParent.offsetWidth; + let offsetLeft = contentItem.offsetParent.offsetLeft - offsetWidth - 20; timer = setInterval(function(){ - tabView.scrollLeft += 10; + tabView.scrollLeft += 2; if(tabView.scrollLeft >= offsetLeft){ clearInterval(timer); } - }, 10); + }, 2); }, 1000) } // #endif diff --git a/supplier/pages/offer/index.vue b/supplier/pages/offer/index.vue index bafe6ef..f1776da 100644 --- a/supplier/pages/offer/index.vue +++ b/supplier/pages/offer/index.vue @@ -43,13 +43,17 @@ - 报价明细 + + 报价明细 + + @@ -66,6 +70,7 @@