RecDataList.js 7.4 KB

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