FormPanelController.js 8.7 KB

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