BasePanel.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. Ext.define('make.view.document.product.BasePanel', {
  2. extend: 'saas.view.core.base.BasePanel',
  3. xtype: 'document-product-basepanel',
  4. controller: 'document-product-basepanel',
  5. viewModel: 'document-product-basepanel',
  6. viewName: 'document-product-basepanel',
  7. deleteMoreMsg: '删除的物料将不能恢复,请确认是否删除?',
  8. deleteOneMsg: '删除的物料将不能恢复,请确认是否删除?',
  9. initComponent: function () {
  10. Ext.apply(this, {
  11. searchField: [{
  12. xtype: "textfield",
  13. name: "pr_code",
  14. width: 300,
  15. emptyText: '输入物料编号、名称、型号或厂家/品牌',
  16. getCondition: function (v) {
  17. return "(upper(CONCAT(pr_code,'#',pr_detail,'#',ifnull(pr_orispeccode,''),'#',ifnull(pr_brand,''))) like '%" + v.toUpperCase() + "%' )";
  18. },
  19. }, {
  20. editable: true,
  21. hiddenBtn: true,
  22. xtype: "remotecombo",
  23. storeUrl: '/api/document/producttype/getCombo',
  24. name: "pr_kind",
  25. fieldLabel: '物料类型',
  26. emptyText: '全部',
  27. }, {
  28. xtype: 'combobox',
  29. name: 'pr_statuscode',
  30. queryMode: 'local',
  31. displayField: 'pr_status',
  32. valueField: 'pr_statuscode',
  33. fieldLabel: '状态',
  34. emptyText: '全部',
  35. editable: false,
  36. defaultValue: 'ENABLE',
  37. store: Ext.create('Ext.data.ArrayStore', {
  38. fields: ['pr_statuscode', 'pr_status'],
  39. data: [
  40. ["ALL", "全部"],
  41. ["ENABLE", "已启用"],
  42. ["BANNED", "已禁用"]
  43. ]
  44. }),
  45. getCondition: function (value) {
  46. if (value == 'ALL' || !value) {
  47. return '1=1';
  48. } else {
  49. return 'pr_statuscode=\'' + value + '\'';
  50. }
  51. }
  52. },{
  53. xtype: 'multicombo',
  54. name: 'pr_manutype',
  55. fieldLabel: '生产类型',
  56. allowBlank: true,
  57. columnWidth: 0.2,
  58. datas: [
  59. ["MAKE", "自制"],
  60. ["OSMAKE", "委外"],
  61. ["PURCHASE", "外购"]
  62. ]
  63. }],
  64. //字段属性
  65. caller: 'Product',
  66. makeImpCaller:'Product_Make',
  67. _formXtype: 'document-product-formpanel',
  68. _title: '物料资料',
  69. _deleteUrl: '/api/document/product/delete',
  70. _batchOpenUrl: '/api/document/product/batchOpen',
  71. _batchCloseUrl: '/api/document/product/batchClose',
  72. _batchDeleteUrl: '/api/document/product/batchDelete',
  73. gridConfig: {
  74. idField: 'id',
  75. codeField: 'pr_code',
  76. statusCodeField: 'pr_statuscode',
  77. dataUrl: '/api/document/product/list',
  78. caller: 'Product',
  79. columns: [{
  80. text: "id",
  81. width: 0,
  82. dataIndex: "id",
  83. xtype: "numbercolumn",
  84. }, {
  85. text: "物料编号",
  86. dataIndex: "pr_code",
  87. width: 150.0,
  88. listeners: {
  89. click: function(tableView, td, rowIdx, colIdx, e, model, tr) {
  90. var data = model.data;
  91. saas.util.BaseUtil.openTab('document-product-formpanel', '产品资料'+"("+data.pr_code+")" , data.id, {
  92. initId: data.id
  93. });
  94. }
  95. },
  96. renderer:function(v,m){
  97. return '<span style="color:#3E80F6;cursor:pointer;">'+v+'</span>';
  98. }
  99. }, {
  100. text: "厂家/品牌",
  101. dataIndex: "pr_brand",
  102. width: 100.0
  103. }, {
  104. text: "物料名称",
  105. dataIndex: "pr_detail",
  106. width: 150.0
  107. }, {
  108. text: "型号",
  109. dataIndex: "pr_orispeccode",
  110. width: 200.0,
  111. renderer: saas.util.RenderUtil['renderer_prod']
  112. }, {
  113. text: "规格",
  114. dataIndex: "pr_spec",
  115. width: 200.0
  116. }, {
  117. text: "物料类型",
  118. dataIndex: "pr_kind",
  119. width: 100
  120. }, {
  121. text: "库存",
  122. dataIndex: "po_onhand",
  123. xtype: 'numbercolumn',
  124. width: 100.0,
  125. renderer: function (v, m, r) {
  126. return saas.util.BaseUtil.numberFormat(v, 6, true);
  127. }
  128. }, {
  129. text: "单位",
  130. dataIndex: "pr_unit",
  131. width: 65.0
  132. }, {
  133. text: "生产类型",
  134. dataIndex: "pr_manutype",
  135. width: 100,
  136. renderer: function (val) {
  137. if(val == 'MAKE'){
  138. return '自制';
  139. }else if(val == 'OSMAKE'){
  140. return '委外';
  141. }else{
  142. return '外购';
  143. }
  144. },
  145. }, {
  146. text: "物料类别",
  147. dataIndex: "pr_serial",
  148. width: 100
  149. }, {
  150. text: "标准损耗(%)",
  151. dataIndex: "pr_lossrate",
  152. width: 110
  153. }, {
  154. text: "标准售价(元)",
  155. dataIndex: "pr_standardprice",
  156. xtype: 'numbercolumn',
  157. width: 110.0,
  158. renderer: function (v, m, r) {
  159. return saas.util.BaseUtil.numberFormat(v, 4, true);
  160. }
  161. }, {
  162. text: "最新购价(元)",
  163. dataIndex: "pr_purcprice",
  164. xtype: 'numbercolumn',
  165. width: 110.0,
  166. renderer: function (v, m, r) {
  167. return saas.util.BaseUtil.numberFormat(v, 4, true);
  168. }
  169. }, {
  170. text: "最新售价(元)",
  171. dataIndex: "pr_saleprice",
  172. xtype: 'numbercolumn',
  173. width: 110.0,
  174. renderer: function (v, m, r) {
  175. return saas.util.BaseUtil.numberFormat(v, 4, true);
  176. }
  177. }, {
  178. text: "备注",
  179. dataIndex: "pr_text1",
  180. width: 250.0
  181. }, {
  182. text: "状态",
  183. dataIndex: "pr_status",
  184. align: 'center',
  185. width: 80.0
  186. }]
  187. },
  188. });
  189. this.callParent(arguments);
  190. },
  191. refresh: function () {
  192. this.items.items[0].store.load()
  193. }
  194. });