FormPanelController.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. Ext.define('saas.view.money.othreceipts.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.money-othreceipts-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //放大镜赋值关系 以及 tpl模板
  8. 'dbfindtrigger[name=or_custname]': {
  9. beforerender: function (f) {
  10. Ext.apply(f, {
  11. dataUrl: '/api/document/customer/dbfind',
  12. addXtype: 'document-customer-formpanel',
  13. addTitle: '客户资料',
  14. defaultCondition: "cu_statuscode='OPEN'",
  15. dbfinds: [{
  16. from: 'id',
  17. to: 'or_custid'
  18. }, {
  19. from: 'cu_code',
  20. to: 'or_custcode'
  21. }, {
  22. from: 'cu_name',
  23. to: 'or_custname'
  24. }],
  25. dbtpls: [{
  26. field: 'cu_code',
  27. width: 100
  28. }, {
  29. field: 'cu_name',
  30. width: 100
  31. }],
  32. dbSearchFields: [{
  33. emptyText: '输入客户编号或客户名称',
  34. xtype: "textfield",
  35. name: "search",
  36. getCondition: function (v) {
  37. return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
  38. },
  39. allowBlank: true,
  40. columnWidth: 0.25
  41. }],
  42. dbColumns: [{
  43. conditionCode: 'id',
  44. "text": "客户ID",
  45. "flex": 0,
  46. "dataIndex": "id",
  47. "width": 0,
  48. "xtype": "",
  49. "items": null
  50. }, {
  51. conditionCode: 'cu_code',
  52. "text": "客户编号",
  53. "flex": 1,
  54. "dataIndex": "cu_code",
  55. "width": 100,
  56. "xtype": "",
  57. "items": null
  58. }, {
  59. conditionCode: 'cu_name',
  60. "text": "客户名称",
  61. "flex": 1,
  62. "dataIndex": "cu_name",
  63. "xtype": "",
  64. "items": null
  65. }, {
  66. conditionCode: 'cu_type',
  67. "text": "客户类型",
  68. "flex": 1,
  69. "dataIndex": "cu_type",
  70. "width": 200,
  71. "xtype": "",
  72. "items": null
  73. }, {
  74. "text": "业务员编号",
  75. "flex": 1,
  76. "dataIndex": "cu_sellercode",
  77. "width": 100
  78. }, {
  79. "text": "业务员",
  80. "flex": 1,
  81. "dataIndex": "cu_sellername",
  82. "width": 100
  83. }, {
  84. "text": "税率",
  85. "flex": 1,
  86. "dataIndex": "cu_taxrate",
  87. "width": 100,
  88. xtype: 'numbercolumn',
  89. align:'end'
  90. }, {
  91. "text": "承付天数",
  92. "flex": 1,
  93. "dataIndex": "cu_promisedays",
  94. "width": 100,
  95. xtype: 'numbercolumn',
  96. align:'end',
  97. renderer : function(v) {
  98. return Ext.util.Format.number(v, '0');
  99. }
  100. }, {
  101. "text": "额度",
  102. "flex": 1,
  103. "dataIndex": "cu_credit",
  104. "width": 100,
  105. xtype: 'numbercolumn',
  106. align:'end'
  107. }, {
  108. "text": "客户地址",
  109. "flex": 1,
  110. "dataIndex": "ca_address",
  111. "width": 250
  112. }]
  113. });
  114. }
  115. },
  116. //放大镜赋值关系 以及 tpl模板
  117. 'dbfindtrigger[name=or_bankname]': {
  118. beforerender: function (f) {
  119. Ext.apply(f, {
  120. dataUrl: '/api/document/bankinformation/list',
  121. addXtype: 'other-bankinformation',
  122. addTitle: '资金账户',
  123. dbfinds: [{
  124. from: 'bk_bankcode',
  125. to: 'or_bankcode'
  126. }, {
  127. from: 'bk_bankname',
  128. to: 'or_bankname'
  129. }, {
  130. from: 'id',
  131. to: 'or_bankid'
  132. }],
  133. // defaultCondition: "bk_statuscode='OPEN'",
  134. dbtpls: [{
  135. field: 'bk_bankcode',
  136. width: 100
  137. }, {
  138. field: 'bk_bankname',
  139. width: 100
  140. }],
  141. dbSearchFields: [{
  142. emptyText: '查找资金账户',
  143. xtype: "textfield",
  144. name: "search",
  145. getCondition: function (v) {
  146. return "(upper(bk_bankcode) like '%"+v.toUpperCase()+"%' or upper(bk_bankname) like '%"+v.toUpperCase()+"%')";
  147. },
  148. allowBlank: true,
  149. columnWidth: 0.25
  150. }],
  151. dbColumns: [{
  152. "text": "账户ID",
  153. "flex": 0,
  154. "dataIndex": "id",
  155. "width": 0,
  156. "xtype": ""
  157. }, {
  158. "text": "资金账户",
  159. "flex": 1,
  160. "dataIndex": "bk_bankcode",
  161. "width": 120,
  162. "xtype": ""
  163. }, {
  164. "text": "账户名称",
  165. "flex": 1,
  166. "dataIndex": "bk_bankname",
  167. "width": 150,
  168. "xtype": ""
  169. }, {
  170. "text": "账户类别",
  171. "flex": 1,
  172. "dataIndex": "bk_type",
  173. "width": 120,
  174. "xtype": ""
  175. }, {
  176. "text": "账户余额",
  177. "flex": 1,
  178. "dataIndex": "bk_thisamount",
  179. "width": 120,
  180. xtype: 'numbercolumn',
  181. }, {
  182. "text": "建帐日期",
  183. "flex": 1,
  184. "dataIndex": "bk_date",
  185. "width": 120,
  186. "xtype": "datecolumn"
  187. }]
  188. });
  189. }
  190. }
  191. });
  192. },
  193. onSave: function() {
  194. var me = this,
  195. form = me.getView(),
  196. viewModel = me.getViewModel(),
  197. store1 = viewModel.get('detail0').detailStore;
  198. var valid = form.isValid();
  199. if(!valid) {
  200. showToast(form.invalidText);
  201. return false;
  202. }
  203. var sum_nowbalance = store1.sum('ord_nowbalance'); // 金额合计
  204. viewModel.set('or_amount',sum_nowbalance);
  205. me.save();
  206. }
  207. });