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

修复不能滚动的问题

parent 418a8e19
...@@ -1948,7 +1948,7 @@ export default { ...@@ -1948,7 +1948,7 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
let currentIndex = 0 let currentIndex = -1
this.$refs['zbtable'].bodyScrollTop = 0 this.$refs['zbtable'].bodyScrollTop = 0
// 过滤可加工数量为0的数据 // 过滤可加工数量为0的数据
this.tableData = res.rows.map((item, index) => { this.tableData = res.rows.map((item, index) => {
...@@ -1966,21 +1966,35 @@ export default { ...@@ -1966,21 +1966,35 @@ export default {
if (this.tableData.length > 0) { if (this.tableData.length > 0) {
this.curTaskInfo = this.tableData[0]; this.curTaskInfo = this.tableData[0];
this.getMaterialUsageRecordList(); this.getMaterialUsageRecordList();
this.$nextTick(()=>{ if (currentIndex > -1) {
const query = uni.createSelectorQuery().in(this) this.$nextTick(()=>{
query const query = uni.createSelectorQuery().in(this)
.select('#tableBody') query
.boundingClientRect() .select('#tableBody')
query.select('#tableBody .item-tr') .boundingClientRect()
.boundingClientRect() query.selectAll('#tableBody .item-tr')
query.exec(res => { .boundingClientRect()
const data1 = res[0] query.exec(res => {
const height = res[1] ? res[1].height : 80.8 const data1 = res[0]
const currentIndexPlus = currentIndex + 1 let scrollTop = 0
const scrollTop = ((height * currentIndexPlus) > data1.height) ? (height * currentIndexPlus) : 0 // const currentIndexPlus = currentIndex + 1
this.$refs['zbtable'].bodyScrollTop = scrollTop 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=>{ }).catch(e=>{
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<view class="btnbox"> <view class="btnbox">
<u-button type="success" v-if="isEdit" size="medium" @click="handleAddFirstEdit">新增</u-button> <u-button type="success" v-if="isEdit" size="medium" @click="handleAddFirstEdit">新增</u-button>
</view> </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-table ref="qcLineTable" class="line-table" border stripe :loading="loading" emptyText="未查询到数据">
<uni-tr> <uni-tr>
<uni-th width="100px" align="center">质检项目</uni-th> <uni-th width="100px" align="center">质检项目</uni-th>
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
</uni-td> --> </uni-td> -->
</uni-tr> </uni-tr>
</uni-table> </uni-table>
</view> </scroll-view>
<u-modal <u-modal
title="选择人员" title="选择人员"
@confirm="userDetermine()" @confirm="userDetermine()"
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<view class="btnbox"> <view class="btnbox">
<u-button v-if="btnType === 'firstEdit'" type="success" size="medium" @click="handleAddFirstEdit">新增</u-button> <u-button v-if="btnType === 'firstEdit'" type="success" size="medium" @click="handleAddFirstEdit">新增</u-button>
</view> </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-table ref="qcLineTable" class="line-table" border stripe :loading="loading" emptyText="未查询到数据">
<uni-tr> <uni-tr>
<uni-th width="100px" align="center">质检项目</uni-th> <uni-th width="100px" align="center">质检项目</uni-th>
...@@ -153,8 +153,8 @@ ...@@ -153,8 +153,8 @@
</uni-td> </uni-td>
</uni-tr> </uni-tr>
</uni-table> </uni-table>
</view> <!-- </view> -->
<!-- </scroll-view> --> </scroll-view>
</u-modal> </u-modal>
<u-modal <u-modal
title="选择人员" 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