Vue.component('person-panel', {
template: '
',
props: ["activetemplate"],
data: function() {
return {
filter: "",
pagesize: 20,
pageNo: 1,
throttled: null,
items: []
}
},
created: function() {
var vm = this
EventBus.$on('refresh-person-panel',function() {
vm.throttledTempList()
})
},
mounted: function() {
var vm = this
var el = vm.$refs.innerPanel
$(el).height($(window).height() - 140)
window.addEventListener('resize', _.debounce(function() {
$(el).height($(window).height() - 140)
}, 300))
el.onscroll = function() {
var scrollHeight = el.scrollHeight;
var scrollTop = el.scrollTop;
var clientHeight = el.clientHeight;
if (scrollHeight - clientHeight == scrollTop) {
vm.guidanceTempList()
}
};
vm.guidanceTempList()
},
methods: {
debounceTempList: _.debounce(function() {
var vm = this
vm.pageNo = 1
vm.items = []
this.guidanceTempList()
}, 500, false),
guidanceTempList: function() {
var vm = this
guidanceAPI.guidanceTempList( {
type: 2, //模板类型 1:系统 2:自定义 为空:所有
pageNo: vm.pageNo,
pageSize: vm.pagesize,
filter: vm.filter
}).then(function(res) {
if(res.data && res.data.length) {
vm.pageNo++;
vm.items = vm.items.concat(res.data)
}
})
},
showDetail: function(o) {
var vm = this
EventBus.$emit('active-template', o)
var query = {
modelCode: o.code,
patient: storage.patient||"",
timestemp: $.now()
}
vm.$router.push({path:'/person-edit-panel',query:query})
}
}
})