Commit 4eaefc8e authored by 沈翠玲's avatar 沈翠玲

修复不能滚动的问题

parent 418a8e19
......@@ -1948,7 +1948,7 @@ export default {
})
.then((res) => {
if (res.code === 200) {
let currentIndex = 0
let currentIndex = -1
this.$refs['zbtable'].bodyScrollTop = 0
// 过滤可加工数量为0的数据
this.tableData = res.rows.map((item, index) => {
......@@ -1966,23 +1966,37 @@ export default {
if (this.tableData.length > 0) {
this.curTaskInfo = this.tableData[0];
this.getMaterialUsageRecordList();
if (currentIndex > -1) {
this.$nextTick(()=>{
const query = uni.createSelectorQuery().in(this)
query
.select('#tableBody')
.boundingClientRect()
query.select('#tableBody .item-tr')
query.selectAll('#tableBody .item-tr')
.boundingClientRect()
query.exec(res => {
const data1 = res[0]
const height = res[1] ? res[1].height : 80.8
const currentIndexPlus = currentIndex + 1
const scrollTop = ((height * currentIndexPlus) > data1.height) ? (height * currentIndexPlus) : 0
let scrollTop = 0
// const currentIndexPlus = currentIndex + 1
let sumheight = 0
if (res[1] && Array.isArray(res[1]) && res[1].length > 0) {
res[1].forEach((item, index) => {
if (index < currentIndex) {
sumheight += item.height
}
})
scrollTop = (sumheight > data1.height) ? sumheight : (res[1][currentIndex].height + sumheight) > data1.height ? sumheight : 0
} else {
const height = 80.8
scrollTop = ((height * currentIndex) > data1.height) ? (height * currentIndex) : 0
}
this.$refs['zbtable'].bodyScrollTop = scrollTop
})
})
}
}
}
}).catch(e=>{
console.log('eee', e)
})
......
......@@ -66,7 +66,7 @@
<view class="btnbox">
<u-button type="success" v-if="isEdit" size="medium" @click="handleAddFirstEdit">新增</u-button>
</view>
<view class="line-content-item">
<scroll-view scroll-y="true" show-scrollbar="true" class="line-content-item">
<uni-table ref="qcLineTable" class="line-table" border stripe :loading="loading" emptyText="未查询到数据">
<uni-tr>
<uni-th width="100px" align="center">质检项目</uni-th>
......@@ -101,7 +101,7 @@
</uni-td> -->
</uni-tr>
</uni-table>
</view>
</scroll-view>
<u-modal
title="选择人员"
@confirm="userDetermine()"
......
......@@ -124,7 +124,7 @@
<view class="btnbox">
<u-button v-if="btnType === 'firstEdit'" type="success" size="medium" @click="handleAddFirstEdit">新增</u-button>
</view>
<view class="line-content-item">
<scroll-view scroll-y="true" show-scrollbar="true" class="line-content-item">
<uni-table ref="qcLineTable" class="line-table" border stripe :loading="loading" emptyText="未查询到数据">
<uni-tr>
<uni-th width="100px" align="center">质检项目</uni-th>
......@@ -153,8 +153,8 @@
</uni-td>
</uni-tr>
</uni-table>
</view>
<!-- </scroll-view> -->
<!-- </view> -->
</scroll-view>
</u-modal>
<u-modal
title="选择人员"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment