/**
 * 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: {
			add(){
				gemhoUtil.navigatePage('./dw-list-detail.html?type=add')
			},
			detail(item){
				gemhoUtil.navigatePage('./dw-list-detail.html?dwId='+item.id+'&type=detail')
			},
			edit(item){
				gemhoUtil.navigatePage('./dw-list-detail.html?dwId='+item.id+'&type=edit')
			},
			getList(){
				http.get('/api/dangerJobReport/page',{
					page: this.page++,// 每次请求增加下一页
					size: this.size,
					// companyId: localStorage.getItem('companyId'),
					county: localStorage.getItem('appCounty'),
					sort: 'id,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; // 下滑不在刷新数据
					}
				})
				
			}
		},
	});
});