BasePanel.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. Ext.define('saas.view.document.custaramount.BasePanel', {
  2. extend: 'saas.view.core.base.BasePanel',
  3. xtype: 'document-custaramount-basepanel',
  4. controller: 'document-custaramount-basepanel',
  5. viewModel: 'document-custaramount-basepanel',
  6. viewName: 'document-custaramount-basepanel',
  7. deleteMoreMsg: '删除的客户期初将不能恢复,请确认是否删除?',
  8. deleteOneMsg: '删除的客户期初将不能恢复,请确认是否删除?',
  9. initComponent: function () {
  10. Ext.apply(this, {
  11. searchField: [{
  12. xtype: "textfield",
  13. name: "ca_custcode",
  14. columnWidth: 0.2,
  15. emptyText: '请输入客户编号或名称',
  16. getCondition: function (v) {
  17. return "(upper(CONCAT(ca_custcode,'#',ca_custname)) like '%" + v.toUpperCase() + "%' )";
  18. }
  19. },{
  20. margin:'0 15 0 10',
  21. xtype: "textfield",
  22. name: "ca_currency",
  23. columnWidth: 0.15,
  24. emptyText: '请输入币别名称'
  25. }],
  26. //字段属性
  27. caller: 'CustAramount',
  28. _formXtype: 'document-custaramount-formpanel',
  29. _title: '客户期初',
  30. _deleteUrl: '/api/document/custaramount/delete',
  31. _batchDeleteUrl: '/api/document/custaramount/batchDelete',
  32. gridConfig: {
  33. idField: 'id',
  34. codeField: 've_code',
  35. statusCodeField: 've_statuscode',
  36. dataUrl: '/api/document/custaramount/list',
  37. caller: 'custaramount',
  38. turnAdd:function(form){
  39. this.dialog = form.ownerCt.add({
  40. xtype: 'document-custaramount-addwindow',
  41. bind: {
  42. title: '新增客户期初'
  43. },
  44. _parent:form.items.items[0],
  45. record:null,
  46. session: true
  47. });
  48. this.dialog.show();
  49. },
  50. onItemClick: function(form, grid, record,a,index,c) {
  51. var classList = c.target.classList;
  52. if(classList.contains('fa-pencil')){
  53. var config = {};
  54. config.initId = record.get('id');
  55. this.dialog = form.ownerCt.add({
  56. xtype: 'document-custaramount-window',
  57. bind: {
  58. title: '修改客户期初'
  59. },
  60. _parent:form.items.items[0],
  61. record:record,
  62. session: true
  63. });
  64. this.dialog.show();
  65. }else if(classList.contains('fa-trash-o')){
  66. //删除
  67. var id = record.get('id');
  68. if(id){
  69. saas.util.BaseUtil.showConfirm('警告', form.deleteOneMsg)
  70. .then(function(yes) {
  71. if(yes == 'yes') {
  72. saas.util.BaseUtil.request({
  73. url: form._deleteUrl+'/'+id,
  74. method: 'POST',
  75. })
  76. .then(function(localJson) {
  77. if(localJson.success){
  78. //解析参数
  79. saas.util.BaseUtil.showSuccessToast('删除成功');
  80. grid.store.load();
  81. }
  82. })
  83. .catch(function(e) {
  84. saas.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
  85. });
  86. }
  87. });
  88. }
  89. }
  90. },
  91. columns: [{
  92. text: "id",
  93. hidden: true,
  94. dataIndex: "id",
  95. xtype: "numbercolumn",
  96. },{
  97. text: "客户id",
  98. hidden: true,
  99. dataIndex: "ca_custid",
  100. xtype: "numbercolumn",
  101. }, {
  102. text: "客户编号",
  103. width: 150.0,
  104. dataIndex: "ca_custcode"
  105. }, {
  106. text: "客户名称",
  107. width: 150.0,
  108. dataIndex: "ca_custname"
  109. }, {
  110. text: '币别',
  111. dataIndex: 'ca_currency',
  112. align: 'center',
  113. width: 65
  114. }, {
  115. xtype:'datecolumn',
  116. text: '期初日期',
  117. format:'Y-m-d',
  118. dataIndex: 'ca_begindate',
  119. width: 110
  120. },{
  121. text: "期初应收",
  122. xtype: 'numbercolumn',
  123. dataIndex: "ca_beginaramount",
  124. width: 110.0,
  125. renderer: function(v, m, r) {
  126. return saas.util.BaseUtil.numberFormat(v, 2, false);
  127. }
  128. },{
  129. text: "期初预收",
  130. xtype: 'numbercolumn',
  131. dataIndex: "ca_beginprerecamount",
  132. width: 110.0,
  133. renderer: function(v, m, r) {
  134. return saas.util.BaseUtil.numberFormat(v, 2, false);
  135. }
  136. },{
  137. hidden:true,
  138. text: "应收金额",
  139. xtype: 'numbercolumn',
  140. dataIndex: "ca_recamount",
  141. width: 110.0,
  142. renderer: function(v, m, r) {
  143. return saas.util.BaseUtil.numberFormat(v, 2, false);
  144. }
  145. },{
  146. hidden:true,
  147. text: "预收金额",
  148. xtype: 'numbercolumn',
  149. dataIndex: "ca_preamount",
  150. width: 110.0,
  151. renderer: function(v, m, r) {
  152. return saas.util.BaseUtil.numberFormat(v, 2, false);
  153. }
  154. },{
  155. hidden:true,
  156. text: "应收余额",
  157. xtype: 'numbercolumn',
  158. dataIndex: "ca_leftamount",
  159. width: 110.0,
  160. renderer: function(v, m, r) {
  161. return saas.util.BaseUtil.numberFormat(v, 2, false);
  162. }
  163. }]
  164. },
  165. });
  166. this.callParent(arguments);
  167. },
  168. refresh: function () {
  169. this.items.items[0].store.load()
  170. }
  171. });