import { Component, OnInit } from '@angular/core'; import { UserData } from '../../providers/user-data'; import { commonService } from '../../providers/common.service' @Component({ selector: 'app-warehouse-manage-pending', templateUrl: './warehouse-manage-pending.page.html', styleUrls: ['./warehouse-manage-pending.page.scss'], }) export class WarehouseManagePendingPage implements OnInit { warehouseManageLists = []; current = 1; size = 10; constructor( public commonService: commonService, public userData: UserData) { } scanCode: string; pId = '' sscId = '' ngOnInit() { } ionViewDidEnter() { this.getList(); } showFullScreenImage(data) { this.commonService.fullScreenImg(data) } doRefresh(event) { this.getList(); event.target.complete() // 告诉ion-refresher 更新数据 } async loadData(event) { this.size += 10 this.getList() event.target.complete(); if (this.warehouseManageLists.length < this.size) { event.target.disabled = true; } } async getList() { const data = await this.userData.getWarehouseManagePendingList(this.current, this.size); this.warehouseManageLists = data; for (const i of this.warehouseManageLists) { i.lendName = i.lend ? '已借出' : '未借出'; i.statusName = i.active ? '正常' : '已销毁'; if (i.pictures && i.pictures.length !== 0) { i.imgsrc = i.pictures[0].smallPicture; } // 控制货号高亮显示 i.showColor = i.checkboxcount/i.contractBoxs>=0.8?'success':i.checkboxcount/i.contractBoxs<=0.5?'danger':'' } } async prepareGoods(sscId, pid) { await this.userData.prepareGoods(sscId, pid); this.getList(); } }