warehouse-manage-pending.page.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Component, OnInit } from '@angular/core';
  2. import { UserData } from '../../providers/user-data';
  3. import { commonService } from '../../providers/common.service'
  4. @Component({
  5. selector: 'app-warehouse-manage-pending',
  6. templateUrl: './warehouse-manage-pending.page.html',
  7. styleUrls: ['./warehouse-manage-pending.page.scss'],
  8. })
  9. export class WarehouseManagePendingPage implements OnInit {
  10. warehouseManageLists = [];
  11. current = 1;
  12. size = 10;
  13. constructor(
  14. public commonService: commonService,
  15. public userData: UserData) { }
  16. scanCode: string;
  17. pId = ''
  18. sscId = ''
  19. ngOnInit() {
  20. }
  21. ionViewDidEnter() {
  22. this.getList();
  23. }
  24. showFullScreenImage(data) {
  25. this.commonService.fullScreenImg(data)
  26. }
  27. doRefresh(event) {
  28. this.getList();
  29. event.target.complete()
  30. // 告诉ion-refresher 更新数据
  31. }
  32. async loadData(event) {
  33. this.size += 10
  34. this.getList()
  35. event.target.complete();
  36. if (this.warehouseManageLists.length < this.size) {
  37. event.target.disabled = true;
  38. }
  39. }
  40. async getList() {
  41. const data = await this.userData.getWarehouseManagePendingList(this.current, this.size);
  42. this.warehouseManageLists = data;
  43. for (const i of this.warehouseManageLists) {
  44. i.lendName = i.lend ? '已借出' : '未借出';
  45. i.statusName = i.active ? '正常' : '已销毁';
  46. if (i.pictures && i.pictures.length !== 0) {
  47. i.imgsrc = i.pictures[0].smallPicture;
  48. }
  49. // 控制货号高亮显示
  50. i.showColor = i.checkboxcount/i.contractBoxs>=0.8?'success':i.checkboxcount/i.contractBoxs<=0.5?'danger':''
  51. }
  52. }
  53. async prepareGoods(sscId, pid) {
  54. await this.userData.prepareGoods(sscId, pid);
  55. this.getList();
  56. }
  57. }