RecDataList.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /**
  2. * 应收对账单
  3. */
  4. Ext.define('saas.view.sale.b2b.RecDataList', {
  5. extend: 'saas.view.core.base.BasePanel',
  6. xtype: 'sale-b2b-recdatalist',
  7. viewName: 'sale-b2b-recdatalist',
  8. // dataUrl: 'http://10.1.80.35:8560/api/sale/saledown/list',
  9. dataUrl: '/api/sale/b2b/apCheck/customer',
  10. initComponent: function() {
  11. var me = this;
  12. Ext.apply(this, {
  13. searchField: [{
  14. name:'ar_customer',
  15. xtype: 'textfield',
  16. emptyText: '请输入客户名称'
  17. }, {
  18. name:'ar_date',
  19. xtype: 'condatefield',
  20. fieldLabel: '日期',
  21. columnWidth: 0.5,
  22. value:2
  23. }],
  24. toolButtons:[{
  25. ignore: true,
  26. style:'text-align: center;',
  27. xtype:'displayfield',
  28. value:'<a href=\"javascript:saas.util.BaseUtil.openTab(\'sale-b2b-reconciliation-datalist\',\'对账列表\',\'maintab-query-salereconciliation\')\">对账详情</a>'
  29. }],
  30. gridConfig: {
  31. features : [Ext.create('Ext.grid.feature.Grouping',{
  32. collapsible:false,
  33. showSummaryRow: false,
  34. groupHeaderTpl: '客户名称 : {name} (共:{rows.length}条)'
  35. })],
  36. listeners:{
  37. boxready:function(){
  38. this.store.group('custName', 'ASC');
  39. }
  40. },
  41. idField: null,
  42. codeField: null,
  43. statusCodeField: null,
  44. dataUrl: me.dataUrl,
  45. caller: null,
  46. rootProperty: 'data.content',
  47. totalProperty: 'data.totalElement',
  48. actionColumn: [],
  49. selModel: {
  50. type: 'cellmodel'
  51. },
  52. hiddenTools: true,
  53. data: [],
  54. columns : [{
  55. text:'apId',
  56. dataIndex:'apId',
  57. hidden:true
  58. },{
  59. text: '客户名称',
  60. dataIndex: 'custName',
  61. hidden:true
  62. }, {
  63. text: 'UU',
  64. dataIndex: 'custUU',
  65. hidden:true
  66. },{
  67. text: '币别',
  68. dataIndex: 'currency',
  69. }, {
  70. text: '本期应收',
  71. xtype:'numbercolumn',
  72. dataIndex: 'thisPeriodAmount',
  73. renderer: function (v, m, r) {
  74. return saas.util.BaseUtil.numberFormat(v, 2, false);
  75. }
  76. }, {
  77. text: '本期发货',
  78. xtype:'numbercolumn',
  79. dataIndex: 'thisPeriodSendQty',
  80. renderer: function (v, m, r) {
  81. return saas.util.BaseUtil.numberFormat(v, 2, false);
  82. }
  83. }, {
  84. text: '本期未对账',
  85. xtype:'numbercolumn',
  86. dataIndex: 'thisPeriodTodoAmount',
  87. renderer: function (v, m, r) {
  88. return saas.util.BaseUtil.numberFormat(v, 2, false);
  89. }
  90. }, {
  91. text: '本期已对账',
  92. xtype:'numbercolumn',
  93. dataIndex: 'thisPeriodDoneAmount',
  94. renderer: function (v, m, r) {
  95. return saas.util.BaseUtil.numberFormat(v, 2, false);
  96. }
  97. }, {
  98. text: '本期已收',
  99. xtype:'numbercolumn',
  100. dataIndex: 'thisPeriodReceipt',
  101. renderer: function (v, m, r) {
  102. return saas.util.BaseUtil.numberFormat(v, 2, false);
  103. }
  104. }, {
  105. text: '应收总额',
  106. xtype:'numbercolumn',
  107. dataIndex: 'totalAmount',
  108. renderer: function (v, m, r) {
  109. return saas.util.BaseUtil.numberFormat(v, 2, false);
  110. }
  111. }, {
  112. text: '操作',
  113. dataIndex: 'op',
  114. ignore: true,
  115. renderer: function(v,m,r) {
  116. return '<span style="color: blue;">明细</span>';
  117. },
  118. listeners: {
  119. click: function(tableView, td, row, col, e, record, tr) {
  120. var idValue = record.get('apId'),
  121. id = 'sale-b2b-recformpanel-formpanel-' + idValue;
  122. var ar_date = tableView.ownerCt.ownerCt.down('[name=ar_date]');
  123. saas.util.BaseUtil.openTab('sale-b2b-recformpanel-formpanel', "应收对账单", id, {
  124. currency:record.get('currency'),
  125. customerUU:record.get('custUU'),
  126. suuorname:record.get('custName'),
  127. fromDate:new Date(ar_date.value.from).getTime(),
  128. endDate:new Date(ar_date.value.to).getTime()
  129. });
  130. }
  131. }
  132. }]
  133. }
  134. });
  135. me.callParent(arguments);
  136. },
  137. /**
  138. * 处理部分字段值
  139. */
  140. getConditionValue: function (field, value) {
  141. var me = this,
  142. xtypes = field.getXTypes().split('/'),
  143. conditionValue;
  144. if (me.isContainsAny(xtypes, ['datefield'])) {
  145. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  146. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  147. var from = value.from,
  148. to = value.to;
  149. conditionValue = from + ',' + to;
  150. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  151. var from = new Date(value.from).getTime(),
  152. to = new Date(value.to).getTime();
  153. conditionValue = {
  154. from: from,
  155. to: to
  156. };
  157. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  158. conditionValue = value;
  159. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  160. conditionValue = value;
  161. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  162. conditionValue = value.map ? value.map(function (v) {
  163. return v.value;
  164. }).join(',') : '';
  165. } else {
  166. conditionValue = value;
  167. }
  168. return conditionValue;
  169. },
  170. getExtraParams: function(store, op, condition) {
  171. var ar_customer = this.down('[name=ar_customer]');
  172. var searchFilter = {}
  173. for(var i = 0; i < condition.length; i++) {
  174. var con = condition[i];
  175. if(con.type == 'date') {
  176. searchFilter.fromDate = con.value.from;
  177. searchFilter.endDate = con.value.to;
  178. }
  179. }
  180. var obj = {
  181. count:op.config.limit,
  182. page:op.config.page,
  183. searchFilter:JSON.stringify(searchFilter)
  184. };
  185. if(ar_customer.value&&ar_customer.value!=""){
  186. obj.keyword = ar_customer.value
  187. }
  188. return obj;
  189. }
  190. });