QueryPanel_bomexpand.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. Ext.define('saas.view.make.bomComposite.QueryPanel_bomexpand', {
  2. extend: 'Ext.tree.Panel',
  3. xtype: 'make-bomcomposite-querypanel-bomexpand',
  4. plugins: [
  5. 'gridexporter',
  6. ],
  7. rootVisible: false,
  8. bufferedRenderer: false,
  9. animate: true,
  10. hideRadio:false,
  11. _code:null,
  12. initComponent: function () {
  13. var me = this;
  14. Ext.apply(me, {
  15. columns: [{
  16. xtype: 'rownumberer',
  17. text: '序号',
  18. width: 50
  19. }, {
  20. text: '层级',
  21. dataIndex: 'bs_level',
  22. align: 'right',
  23. width: 50
  24. },{
  25. text: '母件编号',
  26. dataIndex: 'bs_mothercode',
  27. hidden: true
  28. }, {
  29. text: '母件名称',
  30. dataIndex: 'mo_proddetail',
  31. hidden: true
  32. }, {
  33. text: '母件规格',
  34. dataIndex: 'mo_prodspec',
  35. hidden: true
  36. }, {
  37. text: '物料编号',
  38. dataIndex: 'bs_soncode',
  39. xtype: 'treecolumn',
  40. width: 300
  41. }, {
  42. text: '物料名称',
  43. dataIndex: 'son_proddetail',
  44. width: 200
  45. }, {
  46. text: '物料规格',
  47. dataIndex: 'son_prodspec',
  48. width: 200
  49. }, {
  50. text: '单位',
  51. dataIndex: 'son_produnit',
  52. width: 60
  53. }, {
  54. text: '单位用量',
  55. dataIndex: 'bs_baseqty',
  56. width: 80,
  57. align: 'right'
  58. },{
  59. text: 'BOM序号',
  60. align: 'center',
  61. dataIndex: 'bs_bddetno'
  62. }, {
  63. text: '位号',
  64. dataIndex: 'bs_location',
  65. width: 150
  66. }, {
  67. text: '工作中心',
  68. dataIndex: 'bs_wcname'
  69. }, {
  70. text: '备注',
  71. dataIndex: 'bs_remark'
  72. }, {
  73. text: '型号',
  74. dataIndex: 'son_prodorispec',
  75. width: 200
  76. }, {
  77. text: '厂家/品牌',
  78. dataIndex: 'son_prodbrand'
  79. }],
  80. tbar: [{
  81. xtype: 'radiogroup',
  82. name: 'redio_bomexpand',
  83. width: 300,
  84. simpleValue: true,
  85. hidden:me.hideRadio,
  86. items: [
  87. { boxLabel: '多级展开', inputValue: '/api/make/bom/bomStruct/', checked: true },
  88. { boxLabel: '单级展开', inputValue: '/api/make/bom/bomStructOne/' }
  89. ],
  90. listeners:{
  91. change:function(){
  92. me.store.reload();
  93. }
  94. }
  95. }],
  96. store: {
  97. type: 'tree',
  98. model: 'make.model.make.BomExpand',
  99. proxy: {
  100. type: 'ajax',
  101. url: '/api/make/bom/bomStruct',
  102. timeout: 8000,
  103. actionMethods: {
  104. read: 'GET'
  105. },
  106. reader: {
  107. type: 'json'
  108. },
  109. listeners: {
  110. exception: function (proxy, response, operation, eOpts) {
  111. if (operation.success) {
  112. if (response.timedout) {
  113. saas.util.BaseUtil.showErrorToast('请求超时');
  114. }
  115. } else {
  116. if (response.timedout) {
  117. saas.util.BaseUtil.showErrorToast('请求超时');
  118. } else {
  119. console.error('exception: ', response);
  120. var message = response.responseJson ? (response.responseJson.message == null ? '没有数据' : response.responseJson.message) : '请求超时';
  121. saas.util.BaseUtil.showErrorToast('查询失败:' + message);
  122. }
  123. }
  124. }
  125. }
  126. },
  127. listeners: {
  128. beforeload: function (store, op) {
  129. if(me._code){
  130. //bom表单点击展开
  131. store.getProxy().url = '/api/make/bom/bomStruct/' + me._code;
  132. }else {
  133. if(me.ownerCt){
  134. var prCode = me.ownerCt.ownerCt.down('productDbfindTrigger').getRawValue();
  135. if(prCode){
  136. store.getProxy().url = me.down('radiogroup[name=redio_bomexpand]').lastValue + prCode;
  137. }else{
  138. return false;
  139. }
  140. }else{
  141. return false;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. });
  148. me.callParent(arguments);
  149. }
  150. });