BasePanel.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. Ext.define('saas.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. deleteMoreMsg: '删除的物料将不能恢复,请确认是否删除?',
  7. deleteOneMsg: '删除的物料将不能恢复,请确认是否删除?',
  8. searchField:[{
  9. xtype : "textfield",
  10. name : "pr_code",
  11. width:300,
  12. emptyText:'输入物料编号、名称、型号或规格',
  13. getCondition: function (v) {
  14. return "(upper(CONCAT(pr_code,'#',pr_detail,'#',ifnull(pr_spec,''),'#',ifnull(pr_orispeccode,''))) like '%" + v.toUpperCase() + "%')";
  15. },
  16. },{
  17. editable:true,
  18. hiddenBtn:true,
  19. xtype : "remotecombo",
  20. storeUrl: '/api/document/producttype/getCombo',
  21. name : "pr_kind",
  22. emptyText : "物料类型",
  23. width:120
  24. }, {
  25. xtype : "textfield",
  26. name : "pr_brand",
  27. emptyText : "品牌",
  28. width:110
  29. }, {
  30. xtype: 'combobox',
  31. name: 'pr_statuscode',
  32. queryMode: 'local',
  33. displayField: 'pr_status',
  34. valueField: 'pr_statuscode',
  35. emptyText :'状态',
  36. width:110,
  37. editable:false,
  38. store: Ext.create('Ext.data.ArrayStore', {
  39. fields: ['pr_statuscode', 'pr_status'],
  40. data: [
  41. ["ALL", "全部"],
  42. ["ENABLE", "已启用"],
  43. ["BANNED", "已禁用"]
  44. ]
  45. }),
  46. getCondition: function(value) {
  47. if(value == 'ALL' || !value) {
  48. return '1=1';
  49. }else {
  50. return 'pr_statuscode=\'' + value + '\'';
  51. }
  52. }
  53. }],
  54. //字段属性
  55. caller:'Product',
  56. _formXtype:'document-product-formpanel',
  57. _title:'物料资料',
  58. _deleteUrl:'/api/document/product/delete',
  59. _batchOpenUrl:'/api/document/product/batchOpen',
  60. _batchCloseUrl:'/api/document/product/batchClose',
  61. _batchDeleteUrl:'/api/document/product/batchDelete',
  62. gridConfig: {
  63. idField: 'id',
  64. codeField: 'pr_code',
  65. statusCodeField:'pr_statuscode',
  66. dataUrl: '/api/document/product/list',
  67. caller: 'Product',
  68. columns : [{
  69. text : "id",
  70. width : 0,
  71. dataIndex : "id",
  72. xtype : "numbercolumn",
  73. },{
  74. text : "物料编号",
  75. dataIndex : "pr_code",
  76. width : 150.0
  77. }, {
  78. text : "类型",
  79. dataIndex : "pr_kind",
  80. width : 110.0
  81. }, {
  82. text : "物料名称",
  83. dataIndex : "pr_detail",
  84. width : 200.0
  85. }, {
  86. text : "型号",
  87. dataIndex : "pr_orispeccode",
  88. width : 150.0
  89. }, {
  90. text : "规格",
  91. dataIndex : "pr_spec",
  92. width : 150.0
  93. },{
  94. text : "品牌",
  95. dataIndex : "pr_brand",
  96. width : 110.0
  97. }, {
  98. text : "库存",
  99. dataIndex : "po_onhand",
  100. xtype: 'numbercolumn',
  101. width : 120.0,
  102. renderer : function(v) {
  103. var arr = (v + '.').split('.');
  104. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  105. var format = '0.' + xr.join();
  106. return Ext.util.Format.number(v, format);
  107. }
  108. },{
  109. text : "单位",
  110. dataIndex : "pr_unit",
  111. width : 80.0
  112. }, {
  113. text : "标准定价(元)",
  114. dataIndex : "pr_standardprice",
  115. xtype: 'numbercolumn',
  116. width : 130.0,
  117. renderer : function(v) {
  118. var arr = (v + '.').split('.');
  119. var xr = (new Array(arr[1].length > 8 ? 8 : arr[1].length)).fill('0');
  120. var format = '0,000.' + xr.join();
  121. return Ext.util.Format.number(v, format);
  122. }
  123. }, {
  124. text : "最新采购价(元)",
  125. dataIndex : "pr_purcprice",
  126. xtype: 'numbercolumn',
  127. width : 140.0,
  128. renderer : function(v) {
  129. var arr = (v + '.').split('.');
  130. var xr = (new Array(arr[1].length > 8 ? 8 : arr[1].length)).fill('0');
  131. var format = '0.' + xr.join();
  132. return Ext.util.Format.number(v, format);
  133. }
  134. }, {
  135. text : "最新售价(元)",
  136. dataIndex : "pr_saleprice",
  137. xtype: 'numbercolumn',
  138. width : 120.0,
  139. renderer : function(v) {
  140. var arr = (v + '.').split('.');
  141. var xr = (new Array(arr[1].length > 8 ? 8 : arr[1].length)).fill('0');
  142. var format = '0.' + xr.join();
  143. return Ext.util.Format.number(v, format);
  144. }
  145. }, {
  146. text : "备注",
  147. dataIndex : "pr_text1",
  148. width :250.0
  149. }, {
  150. text : "状态",
  151. dataIndex : "pr_status",
  152. width : 90.0
  153. }]
  154. },
  155. refresh:function(){
  156. this.items.items[0].store.load()
  157. }
  158. });