FormPanelController.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. Ext.define('make.view.make.bom.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.make-bom-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //从表多选放大镜赋值关系 以及 tpl模板
  8. 'dbfindtrigger[name=bo_mothercode]': {
  9. beforerender: function (f) {
  10. Ext.apply(f, {
  11. //放大镜赋值设置
  12. dbfinds: [{
  13. from: 'id', to: 'bo_motherid', ignore: true
  14. }, {
  15. from: 'pr_code', to: 'bo_mothercode'
  16. }, {
  17. from: 'pr_detail', to: 'bo_mothername'
  18. }, {
  19. from: 'pr_spec', to: 'pr_spec'
  20. }, {
  21. from: 'pr_brand', to: 'pr_brand'
  22. }, {
  23. from: 'pr_orispeccode', to: 'pr_orispeccode'
  24. }, {
  25. from: 'pr_unit', to: 'pr_unit'
  26. }],
  27. });
  28. }
  29. },
  30. 'multidbfindtrigger[name=bd_soncode]': {
  31. beforerender: function (f) {
  32. Ext.apply(f, {
  33. //放大镜赋值设置
  34. dbfinds: [{
  35. from: 'id', to: 'bd_sonid', ignore: true
  36. }, {
  37. from: 'pr_code', to: 'bd_soncode'
  38. }, {
  39. from: 'pr_detail', to: 'pr_detail'
  40. }, {
  41. from: 'pr_spec', to: 'pr_spec'
  42. }, {
  43. from: 'pr_brand', to: 'pr_brand'
  44. }, {
  45. from: 'pr_orispeccode', to: 'pr_orispeccode'
  46. }, {
  47. from: 'pr_unit', to: 'pr_unit'
  48. }, {
  49. from: 'pr_lossrate', to: 'pr_lossrate'
  50. }],
  51. });
  52. }
  53. },
  54. 'multidbfindtrigger[name=pr_detail]': {
  55. beforerender: function (f) {
  56. Ext.apply(f, {
  57. dbfinds: [{
  58. from: 'id', to: 'pd_prodid', ignore: true
  59. }, {
  60. from: 'pr_code', to: 'pd_prodcode'
  61. }, {
  62. from: 'pr_detail', to: 'pr_detail'
  63. }, {
  64. from: 'pr_spec', to: 'pr_spec'
  65. }, {
  66. from: 'pr_brand', to: 'pr_brand'
  67. }, {
  68. from: 'pr_orispeccode', to: 'pr_orispeccode'
  69. }, {
  70. from: 'pr_unit', to: 'pr_unit'
  71. }, {
  72. from: 'pr_purcprice', to: 'pd_lastprice'
  73. }, {
  74. from: 'pr_zxbzs', to: 'pr_zxbzs'
  75. }],
  76. });
  77. }
  78. }
  79. });
  80. },
  81. /**
  82. * 修改BOM明细
  83. */
  84. modifyBomDetail: function (button) {
  85. //需要先选中行
  86. var me = this,
  87. form = me.getView(),
  88. grid = form.down('detailGridField'),
  89. record = grid.selModel.getLastSelected(),
  90. vm = form.getViewModel();
  91. if (null == record || record.get('bd_id')) {
  92. saas.util.BaseUtil.showErrorToast('请先选择明细行');
  93. } else {
  94. me.materialDialog = form.add({
  95. xtype: 'make-bom-modifybomdetailwin',
  96. _parent: form,
  97. });
  98. me.materialDialog.getViewModel().set('form', {
  99. id: record.get('id'),
  100. bd_detno: record.get('bd_detno'),
  101. bd_sonid: record.get('bd_sonid'),
  102. bd_soncode: record.get('bd_soncode'),
  103. bd_baseqty: record.get('bd_baseqty'),
  104. bd_location: record.get('bd_location'),
  105. bd_remark: record.get('bd_remark'),
  106. companyId: record.get('companyId'),
  107. creatorId: record.get('creatorId'),
  108. pr_detail: record.get('pr_detail'),
  109. pr_orispeccode: record.get('pr_orispeccode'),
  110. pr_brand: record.get('pr_brand'),
  111. pr_spec: record.get('pr_spec')
  112. });
  113. me.materialDialog.getViewModel().set('bo_id', vm.get('id'));
  114. me.materialDialog.getViewModel().set('bo_mothercode', vm.get('bo_mothercode'));
  115. me.materialDialog.show();
  116. }
  117. },
  118. modifyBomDetail2: function (v, rowIndex, q, fn, eOpts, record, dom) {
  119. var me = this,
  120. view = this.getView(),
  121. vm = view.getViewModel();
  122. if (vm && vm.get('bo_statuscode') == 'AUDITED') {
  123. me.materialDialog = view.add({
  124. xtype: 'make-bom-modifybomdetailwin',
  125. _parent: view,
  126. });
  127. me.materialDialog.getViewModel().set('form', {
  128. id: record.get('id'),
  129. bd_detno: record.get('bd_detno'),
  130. bd_sonid: record.get('bd_sonid'),
  131. bd_soncode: record.get('bd_soncode'),
  132. bd_baseqty: record.get('bd_baseqty'),
  133. bd_location: record.get('bd_location'),
  134. bd_remark: record.get('bd_remark'),
  135. companyId: record.get('companyId'),
  136. creatorId: record.get('creatorId'),
  137. pr_detail: record.get('pr_detail'),
  138. pr_orispeccode: record.get('pr_orispeccode'),
  139. pr_brand: record.get('pr_brand'),
  140. pr_spec: record.get('pr_spec')
  141. });
  142. me.materialDialog.getViewModel().set('bo_id', vm.get('id'));
  143. me.materialDialog.getViewModel().set('bo_mothercode', vm.get('bo_mothercode'));
  144. me.materialDialog.show();
  145. } else {
  146. return false
  147. }
  148. },
  149. bomStruct: function () {
  150. var me = this,
  151. form = me.getView(),
  152. vm = form.getViewModel(),
  153. prodcode = vm.get('bo_mothercode');
  154. me.bomStructDialog = form.add(
  155. Ext.create('Ext.window.Window', {
  156. modal: true,
  157. cls: 'x-window-dbfind',
  158. height: form.getHeight() * 0.8,
  159. width: form.getWidth() * 0.8,
  160. title: 'BOM多级展开',
  161. constrain: true,
  162. closable: true,
  163. resizable: false,
  164. layout: 'fit',
  165. items: [{
  166. xtype: 'make-bomcomposite-querypanel-bomexpand',
  167. _code: prodcode,
  168. hideRadio: true
  169. }]
  170. })
  171. ),
  172. me.bomStructDialog.show();
  173. }
  174. });