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 @@