/**
 * author: dabao
 */
var VUE = null
window.addEventListener("load", function() {
	VUE = new Vue({
		el: '#app',
		data() {
			return {
				value: '',
				list: [],
				loading: false,
				finished: false,
				page: 0,
				size: 10,
				total: 0
			}
		},
		mounted() {
			this.getList()
		},
		methods: {
			detail(item){
				gemhoUtil.navigatePage('./yh-list-detail.html?companyId='+localStorage.getItem('companyId')+'&hdId='+item.hdId+'&type=detail')
			},
			edit(item){
				gemhoUtil.navigatePage('./yh-list-detail.html?companyId='+localStorage.getItem('companyId')+'&hdId='+item.hdId+'&type=edit')
			},
			getList(){
				http.get('/api/thHiddenDanger',{
					page: this.page++,// 每次请求增加下一页
					size: this.size,
					companyId: localStorage.getItem('companyId'),
					county: localStorage.getItem('appCounty'),
					sort: 'hdId,desc',
				}).then((res)=>{
					
					this.loading = false; // 加载状态结束
					this.list.push(...res.content);
					this.total = res.totalElements
					
					if(this.page*this.size >= this.total){
						 this.finished = true; // 下滑不在刷新数据
					}
				})
				
			}
		},
	});
});