Purchase.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /**
  2. * 客户采购单
  3. */
  4. Ext.define('saas.view.sale.b2b.Purchase', {
  5. extend: 'saas.view.core.base.BasePanel',
  6. xtype: 'sale-b2b-purchase',
  7. // controller: 'sale-b2b-purchase',
  8. // viewModel: 'sale-b2b-purchase',
  9. viewName: 'sale-b2b-purchase',
  10. // dataUrl: 'http://10.1.80.35:8560/api/sale/saledown/list',
  11. dataUrl: '/api/sale/saledown/list',
  12. initComponent: function() {
  13. var me = this;
  14. Ext.apply(this, {
  15. searchField: [{
  16. xtype: 'textfield',
  17. name: 'sa_custname',
  18. columnWidth: 0.15,
  19. emptyText:'请输入客户名称'
  20. }, {
  21. xtype: 'condatefield',
  22. name: 'createTime',
  23. fieldLabel: '日期',
  24. columnWidth: 0.5,
  25. labelWidth: 50,
  26. }, {
  27. xtype: 'textfield',
  28. name: 'sa_salecode',
  29. labelWidth: 0,
  30. columnWidth: 0.15,
  31. emptyText: '销售单号'
  32. }, {
  33. xtype: 'checkbox',
  34. name: 'sa_sendstatus',
  35. fieldLabel: '已结案',
  36. columnWidth: 0.1,
  37. labelWidth: 50,
  38. getCondition: function(v) {
  39. if(v) {
  40. return "sa_sendstatus='已关闭'";
  41. }else {
  42. return '1=1';
  43. }
  44. }
  45. }, {
  46. xtype: 'checkbox',
  47. name: 'sa_sendstatus',
  48. fieldLabel: '待出货',
  49. columnWidth: 0.1,
  50. labelWidth: 50,
  51. getCondition: function(v) {
  52. if(v) {
  53. return "sa_sendstatus='未出库'";
  54. }else {
  55. return '1=1';
  56. }
  57. }
  58. }],
  59. caller: null,
  60. _formXtype: null,
  61. _title: null,
  62. _deleteUrl: null,
  63. _batchOpenUrl: null,
  64. _batchCloseUrl: null,
  65. _batchDeleteUrl: null,
  66. gridConfig: {
  67. idField: null,
  68. codeField: null,
  69. statusCodeField: null,
  70. dataUrl: me.dataUrl,
  71. caller: null,
  72. rootProperty: 'data.list',
  73. totalProperty: 'data.total',
  74. actionColumn: [],
  75. selModel: {
  76. type: 'cellmodel'
  77. },
  78. hiddenTools: true,
  79. data: [{
  80. }],
  81. columns : [{
  82. text: 'ID',
  83. dataIndex: 'id',
  84. hidden: true,
  85. width: 100
  86. }, {
  87. text: '转单状态',
  88. dataIndex: 'sa_turnstatus',
  89. width: 100,
  90. textAlign: 'center'
  91. }, {
  92. text: '客户PO',
  93. dataIndex: 'sa_pocode',
  94. width: 160
  95. }, {
  96. text: '订单日期',
  97. xtype: 'datecolumn',
  98. dataIndex: 'createTime',
  99. width: 160,
  100. format: 'Y-m-d H:i:s'
  101. }, {
  102. text: '客户编号',
  103. dataIndex: 'sa_custcode',
  104. width: 120
  105. }, {
  106. text: '客户名称',
  107. dataIndex: 'sa_custname',
  108. width: 200
  109. }, {
  110. text: '销售单号',
  111. dataIndex: 'sa_salecode',
  112. width: 120
  113. }, {
  114. text: '出货状态',
  115. dataIndex: 'sa_sendstatus',
  116. textAlign: 'center'
  117. }, {
  118. text: '交货地址',
  119. dataIndex: 'sa_toplace',
  120. width: 250
  121. }],
  122. listeners: {
  123. itemclick: function(view, record, item, index, e, eOpts) {
  124. saas.util.BaseUtil.openTab('sale-b2b-purchasedetail', '客户采购单', 'sale-b2b-purchasedetail'+record.id, {
  125. initId: record.get('id')
  126. });
  127. }
  128. }
  129. },
  130. });
  131. this.callParent(arguments);
  132. },
  133. /**
  134. * 处理部分字段值
  135. */
  136. getConditionValue: function (field, value) {
  137. var me = this,
  138. xtypes = field.getXTypes().split('/'),
  139. conditionValue;
  140. if (me.isContainsAny(xtypes, ['datefield'])) {
  141. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  142. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  143. var from = value.from,
  144. to = value.to;
  145. conditionValue = from + ',' + to;
  146. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  147. var from = value.from,
  148. to = value.to;
  149. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
  150. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  151. conditionValue = value;
  152. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  153. conditionValue = value;
  154. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  155. conditionValue = value.map ? value.map(function (v) {
  156. return v.value;
  157. }).join(',') : '';
  158. } else {
  159. conditionValue = value;
  160. }
  161. return conditionValue;
  162. }
  163. });