BasePanel.js 5.1 KB

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