FormPanelController.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. align:'right'
  89. }, {
  90. "text": "承付天数",
  91. "flex": 1,
  92. "dataIndex": "cu_promisedays",
  93. "width": 100,
  94. align:'right'
  95. }, {
  96. "text": "额度",
  97. "flex": 1,
  98. "dataIndex": "cu_credit",
  99. "width": 100,
  100. align:'right'
  101. }, {
  102. "text": "客户地址",
  103. "flex": 1,
  104. "dataIndex": "ca_address",
  105. "width": 250
  106. }]
  107. });
  108. }
  109. },
  110. //放大镜赋值关系 以及 tpl模板
  111. 'dbfindtrigger[name=or_bankname]': {
  112. beforerender: function (f) {
  113. Ext.apply(f, {
  114. dataUrl: '/api/document/bankinformation/list',
  115. addTitle: '账户资料',
  116. dbfinds: [{
  117. from: 'bk_bankcode',
  118. to: 'or_bankcode'
  119. }, {
  120. from: 'bk_bankname',
  121. to: 'or_bankname'
  122. }, {
  123. from: 'id',
  124. to: 'or_bankid'
  125. }],
  126. // defaultCondition: "bk_statuscode='OPEN'",
  127. dbtpls: [{
  128. field: 'bk_bankcode',
  129. width: 100
  130. }, {
  131. field: 'bk_bankname',
  132. width: 100
  133. }],
  134. dbSearchFields: [{
  135. emptyText: '输入银行账户编号或名称',
  136. xtype: "textfield",
  137. name: "search",
  138. getCondition: function (v) {
  139. return "(upper(bk_bankcode) like '%"+v.toUpperCase()+"%' or upper(bk_bankname) like '%"+v.toUpperCase()+"%')";
  140. },
  141. allowBlank: true,
  142. columnWidth: 0.25
  143. }],
  144. dbColumns: [{
  145. "text": "账户ID",
  146. "flex": 0,
  147. "dataIndex": "id",
  148. "width": 0,
  149. "xtype": ""
  150. }, {
  151. "text": "账户编号",
  152. "flex": 1,
  153. "dataIndex": "bk_bankcode",
  154. "width": 120,
  155. "xtype": ""
  156. }, {
  157. "text": "账户名称",
  158. "flex": 1,
  159. "dataIndex": "bk_bankname",
  160. "width": 150,
  161. "xtype": ""
  162. }, {
  163. "text": "账户类型",
  164. "flex": 1,
  165. "dataIndex": "bk_type",
  166. "width": 120,
  167. "xtype": ""
  168. }, {
  169. "text": "账户余额",
  170. "flex": 1,
  171. "dataIndex": "bk_thisamount",
  172. "width": 120,
  173. "xtype": ""
  174. }, {
  175. "text": "建帐日期",
  176. "flex": 1,
  177. "dataIndex": "bk_date",
  178. "width": 120,
  179. "xtype": "datecolumn"
  180. }]
  181. });
  182. }
  183. }
  184. });
  185. },
  186. onSave: function() {
  187. var me = this,
  188. form = me.getView(),
  189. viewModel = me.getViewModel(),
  190. store1 = viewModel.get('detail0').detailStore;
  191. var valid = form.isValid();
  192. if(!valid) {
  193. showToast(form.invalidText);
  194. return false;
  195. }
  196. var sum_nowbalance = store1.sum('ord_nowbalance'); // 金额合计
  197. viewModel.set('or_amount',sum_nowbalance);
  198. me.save();
  199. }
  200. });