invoice-manage-purchase.component.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import { Component, OnInit, ViewChild } from '@angular/core';
  2. import { _HttpClient, ModalHelper } from '@delon/theme';
  3. import { STColumn, STComponent } from '@delon/abc';
  4. import { SFSchema } from '@delon/form';
  5. import { InvoiceManagePurchase } from 'app/entity/invoice-management/invoice-manage-purchase';
  6. import { InvoiceManagePurchaseService } from 'app/services/invoice-management/invoice-manage-purchase.service';
  7. import { NzDrawerService, NzNotificationService } from 'ng-zorro-antd';
  8. import { InvoiceManagementInvoiceManagePurchaseAddComponent } from './add/add.component';
  9. import { I18NService } from '@core';
  10. import { InvoiceManagementInvoiceManagePurchaseUpdateComponent } from './update/update.component';
  11. import { InvoiceManagementInvoiceManagePurchaseViewComponent } from './view/view.component';
  12. @Component({
  13. selector: 'app-invoice-management-invoice-manage-purchase',
  14. templateUrl: './invoice-manage-purchase.component.html',
  15. })
  16. export class InvoiceManagementInvoiceManagePurchaseComponent implements OnInit {
  17. constructor(
  18. private invoiceManagePurchaseService: InvoiceManagePurchaseService,
  19. private nzDrawerService:NzDrawerService,
  20. private i18NService:I18NService,
  21. private nzNotificationService:NzNotificationService
  22. ) {}
  23. ngOnInit() {
  24. this.getList()
  25. }
  26. listOfData = [];
  27. invoiceManagePurchase: InvoiceManagePurchase = {}; //对象
  28. page = {
  29. total: 0,
  30. current: 0,
  31. }; //页码
  32. isSpinning = false;
  33. //按页码显示数据
  34. pageIndexChange(event) {
  35. this.invoiceManagePurchase.pageNo = event; //当前页码
  36. this.getList();
  37. }
  38. /**
  39. * 查询数据表
  40. */
  41. getList() {
  42. this.isSpinning = true;
  43. this.invoiceManagePurchase.pkOrg = sessionStorage.getItem('pkOrg'); //组织
  44. this.invoiceManagePurchase.type = '1'; //采购发票
  45. this.invoiceManagePurchaseService.getList(this.invoiceManagePurchase).then(response => {
  46. this.listOfData = response.result.records;
  47. this.isSpinning = false;
  48. });
  49. }
  50. /**
  51. * 新增按钮
  52. */
  53. add() {
  54. const drawerRef = this.nzDrawerService.create<InvoiceManagementInvoiceManagePurchaseAddComponent, { quotationId: string }, string>({
  55. nzTitle: this.i18NService.fanyi("button.add"),//新增标题
  56. nzContent: InvoiceManagementInvoiceManagePurchaseAddComponent,
  57. nzWidth: window.innerWidth,
  58. nzBodyStyle: { height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom': '53px' }
  59. // nzContentParams: {
  60. // //模板id
  61. // quotationId: item.id
  62. // }
  63. });
  64. //关闭抽屉的回调
  65. drawerRef.afterClose.subscribe((isRefresh) => {
  66. if (isRefresh) {//刷新list列表
  67. this.getList();
  68. }
  69. });
  70. }
  71. /**
  72. * 修改按钮
  73. * @param data 修改对象
  74. */
  75. update(data) {
  76. const drawerRef = this.nzDrawerService.create<InvoiceManagementInvoiceManagePurchaseUpdateComponent, { id: string }, string>({
  77. nzTitle: this.i18NService.fanyi("table.update"),//新增标题
  78. nzContent: InvoiceManagementInvoiceManagePurchaseUpdateComponent,
  79. nzWidth: window.innerWidth,
  80. nzBodyStyle: { height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom': '53px' },
  81. nzContentParams: {
  82. //模板id
  83. id: data.id
  84. }
  85. });
  86. //关闭抽屉的回调
  87. drawerRef.afterClose.subscribe((isRefresh) => {
  88. if (isRefresh) {//刷新list列表
  89. this.getList();
  90. }
  91. });
  92. }
  93. /**
  94. * 详情按钮
  95. * @param data 详情对象
  96. */
  97. view(data) {
  98. const drawerRef = this.nzDrawerService.create<InvoiceManagementInvoiceManagePurchaseViewComponent, { id: string }, string>({
  99. nzTitle: this.i18NService.fanyi("table.view"),//详情标题
  100. nzContent: InvoiceManagementInvoiceManagePurchaseViewComponent,
  101. nzWidth: window.innerWidth,
  102. nzBodyStyle: { height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom': '53px' },
  103. nzContentParams: {
  104. //模板id
  105. id: data.id
  106. }
  107. });
  108. }
  109. delete(id) {
  110. let invoiceManagePurchase=new InvoiceManagePurchase();
  111. invoiceManagePurchase.id=id;
  112. this.invoiceManagePurchaseService.delete(invoiceManagePurchase).then((response)=>{
  113. if (response.success) {
  114. //删除成功
  115. this.nzNotificationService.success(this.i18NService.fanyi('successful.deletion'), '');
  116. this.getList();
  117. } else {
  118. //删除失败
  119. this.nzNotificationService.error(this.i18NService.fanyi('delete.failed'), '');
  120. }
  121. })
  122. }
  123. /**
  124. * 查询按钮
  125. */
  126. query() {
  127. this.invoiceManagePurchase.pageNo = 1;
  128. this.getList();
  129. }
  130. }