BasePanel.js 5.1 KB

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