Browse Source

sample

master
pengjun 2 years ago
parent
commit
ad507f4560
  1. 32
      src/views/diagnosis/diagnosis.vue

32
src/views/diagnosis/diagnosis.vue

@ -214,6 +214,7 @@ export default {
data() { data() {
return { return {
query:{ query:{
triggerScroll:0, //
itemTypeFlag:true, // itemTypeFlag:true, //
itemTypeId:'', itemTypeId:'',
keyWords:'', keyWords:'',
@ -302,6 +303,7 @@ export default {
// //
refreshItemTypeId(itemTypeId){ refreshItemTypeId(itemTypeId){
this.query.itemTypeId = itemTypeId this.query.itemTypeId = itemTypeId
this.query.triggerScroll++
}, },
// //
@ -352,7 +354,8 @@ export default {
lfind = arrayExistObj(this.tableData, 'id', v.id) lfind = arrayExistObj(this.tableData, 'id', v.id)
if (lfind > -1) { if (lfind > -1) {
this.$refs['elTable'].setCurrentRow(this.tableData[lfind]) this.$refs['elTable'].setCurrentRow(this.tableData[lfind])
this.rowClick(this.tableData[lfind])
this.rowClick(this.tableData[lfind])
this.scrollToRow(lfind)
} }
} }
//console.log('v,query.diagnosis',v,this.query.diagnosis) //console.log('v,query.diagnosis',v,this.query.diagnosis)
@ -364,6 +367,23 @@ export default {
this.$refs['elSelectKeyWords'].focus(); //total asbItemId this.$refs['elSelectKeyWords'].focus(); //total asbItemId
}); });
}, },
// 1
triggerScroll(){
if(!this.query.itemTypeId) return
let lfind = arrayExistObj(this.tableData,'itemTypeId',this.query.itemTypeId)
if(lfind > -1){
this.scrollToRow(lfind)
}
},
scrollToRow(rowNum){
let dom = this.$refs['elTable'].bodyWrapper
this.$nextTick(() =>{
let tableHeight = this.window.pageHeight < 600 ? 200 : Math.floor((this.window.pageHeight - 200) / 2)
let rowHeight = 36.96
dom.scrollTo(0, rowHeight * rowNum - tableHeight*rowNum/(2*this.tableData.length) )
})
},
// //
@ -547,6 +567,16 @@ export default {
// } // }
// } // }
// }, // },
"query.triggerScroll":{
immediate: true, //
deep: true, //
handler(newVal,oldVal){
// console.log('watch:patientRegisterNo:',newVal,oldVal)
if(newVal != oldVal){
this.triggerScroll();
}
}
},
}, },
}; };
</script> </script>

Loading…
Cancel
Save