bomEcndetailWin.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. Ext.define('make.view.make.bom.bomEcndetailWin', {
  2. extend: 'Ext.window.Window',
  3. xtype: 'make-bom-bomecndetailwin',
  4. cls: 'x-window-dbfind',
  5. initId: null,
  6. scrollable: true,
  7. initComponent: function () {
  8. var me = this;
  9. Ext.apply(me, {
  10. items: [{
  11. xtype: 'grid',
  12. cls: 'core-base-gridpanel',
  13. scrollable: true,
  14. plugins: [{
  15. ptype: 'gridexporter',
  16. }, {
  17. ptype: 'menuclipboard'
  18. }],
  19. tbar: ['->', {
  20. xtype: 'button',
  21. text: '导出',
  22. handler: function () {
  23. var grid = this.ownerCt.ownerCt;
  24. var cfg = {
  25. type: 'xlsx',
  26. title: 'BOM变更记录',
  27. fileName: 'BOM变更记录' + Ext.Date.format(new Date(), 'Y-m-d_H-i-s') + '.xlsx'
  28. };
  29. grid.setLoading(true);
  30. grid.saveDocumentAs(cfg);
  31. Ext.defer(function () {
  32. grid.setLoading(false);
  33. }, 2000);
  34. }
  35. }],
  36. columns: [{
  37. text: 'id',
  38. dataIndex: 'id',
  39. hidden: true,
  40. xtype: 'numbercolumn'
  41. }, {
  42. text: '操作人员',
  43. dataIndex: 'creatorName',
  44. align: 'center',
  45. width: 120
  46. }, {
  47. text: '操作时间',
  48. dataIndex: 'createTime',
  49. align: 'center',
  50. xtype: 'datecolumn',
  51. width: 150,
  52. renderer: function (v, m, r) {
  53. return Ext.Date.format(new Date(v), 'Y-m-d H:i:s');
  54. }
  55. }, {
  56. text: '操作类型',
  57. dataIndex: 'ed_type',
  58. align: 'center',
  59. width: 100
  60. }, {
  61. text: '行号',
  62. dataIndex: 'ed_bddetno',
  63. align: 'center',
  64. width: 60
  65. }, {
  66. text: '修改内容',
  67. dataIndex: 'ed_history',
  68. flex: 1,
  69. }],
  70. store: Ext.create('Ext.data.Store', {
  71. field: ['id', 'creatorName', 'ed_type', 'ed_bddetno', 'reched_soncodeeck'],
  72. autoLoad: true,
  73. data: [],
  74. })
  75. }]
  76. })
  77. me.setData(me.initId);
  78. me.callParent();
  79. },
  80. setData: function (initId) {
  81. var me = this;
  82. saas.util.BaseUtil.request({
  83. url: '/api/make/ecndetail/listByEd_boid',
  84. method: 'GET',
  85. params: {
  86. ed_boid: initId
  87. }
  88. })
  89. .then(function (localJson) {
  90. var data = localJson.data;
  91. var grid = me.down('[xtype="grid"]');
  92. grid.store.loadData(data);
  93. })
  94. .catch(function (e) {
  95. saas.util.BaseUtil.showErrorToast('查询失败: ' + e.message);
  96. });
  97. }
  98. });