FormPanelController.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. Ext.define('saas.view.money.payBalance.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.money-paybalance-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. // 供应商名称
  8. 'dbfindtrigger[name=pb_vendname]':{
  9. beforerender: function (f) {
  10. Ext.apply(f, {
  11. dataUrl: '/api/document/vendor/list',
  12. addXtype: 'document-vendor-formpanel',
  13. addTitle: '供应商资料',
  14. dbfinds: [{
  15. from: 've_code',
  16. to: 'pd_vendcode'
  17. }, {
  18. from: 've_name',
  19. to: 'pb_vendname'
  20. },{
  21. from: 've_leftamount',
  22. to: 've_leftamount'
  23. }],
  24. dbtpls: [{
  25. field: 've_code',
  26. width: 100
  27. }, {
  28. field: 've_name',
  29. width: 100
  30. },{
  31. field:'ve_leftamount',
  32. width: 100
  33. }],
  34. defaultCondition: "ve_statuscode='OPEN'",
  35. dbSearchFields:[{
  36. emptyText:'输入供应商编号或名称',
  37. xtype : "textfield",
  38. name : "search",
  39. getCondition: function(v) {
  40. return "(upper(ve_code) like '%"+v.toUpperCase()+"%' or upper(ve_name) like '%"+v.toUpperCase()+"%')";
  41. },
  42. allowBlank : true,
  43. columnWidth : 0.25
  44. }],
  45. dbColumns:[{
  46. "text": "供应商ID",
  47. "hidden": true,
  48. "dataIndex": "id",
  49. "width": 100,
  50. "xtype": "numbercolumn"
  51. },{
  52. "text": "供应商编号",
  53. "flex": 1,
  54. "dataIndex": "ve_code",
  55. "width": 100
  56. }, {
  57. "text": "供应商名称",
  58. "flex": 1,
  59. "dataIndex": "ve_name",
  60. "width": 100
  61. }, {
  62. "text": "供应商类型",
  63. "flex": 0,
  64. "dataIndex": "ve_type",
  65. "width": 200,
  66. "items": null
  67. }, {
  68. "text": "税率",
  69. "flex": 1,
  70. "dataIndex": "ve_taxrate",
  71. "width": 100
  72. }, {
  73. "text":"应付款金额",
  74. "flex":1,
  75. "dataIndex":"ve_leftamount",
  76. "width":100
  77. },{
  78. "text": "承付天数",
  79. "flex": 1,
  80. "dataIndex": "ve_promisedays",
  81. "width": 100
  82. }, {
  83. "text": "纳税人识别号",
  84. "flex": 1,
  85. "dataIndex": "ve_bankaccount",
  86. "width": 100
  87. }, {
  88. "text": "开户银行",
  89. "flex": 1,
  90. "dataIndex": "ve_bankaccount",
  91. "width": 100
  92. }, {
  93. "text": "银行账户",
  94. "flex": 1,
  95. "dataIndex": "ve_bankcode",
  96. "width": 100
  97. }]
  98. });
  99. }
  100. },
  101. 'dbfindtrigger[name=choseSource]': {
  102. beforerender: function (f) {
  103. Ext.apply(f, {
  104. dataUrl: '/api/money/subledger/list',
  105. addTitle: '源单资料',
  106. dbfinds: [{
  107. from: 'id',
  108. to: 'pbd_slid'
  109. }, {
  110. from: 'sl_code',
  111. to: 'pbd_slcode'
  112. },{
  113. from: 'sl_orderamount',
  114. to: 'pbd_amount'
  115. },{
  116. from: 'sl_yamount',
  117. to: 'pb_havebalance'
  118. },{
  119. from: 'sl_namount',
  120. to: 'pb_pbdamount'
  121. }],
  122. dbtpls: [{
  123. field: 'sl_code',
  124. width: 100
  125. }],
  126. defaultCondition: "sl_vendtid<>0 and sl_kind in ('期初余额','采购验收单','采购验退单') and sl_namount<>0",
  127. dbSearchFields:[{
  128. emptyText:'输入源单编号',
  129. xtype : "textfield",
  130. name : "search",
  131. getCondition: function(v) {
  132. return "(upper(sl_code) like '%"+v.toUpperCase()+"%')";
  133. },
  134. allowBlank : true,
  135. columnWidth : 0.25
  136. }],
  137. dbColumns:[{
  138. "text": "源单id",
  139. "hidden": true,
  140. "dataIndex": "id",
  141. "width": 100,
  142. "xtype": "numbercolumn"
  143. },{
  144. "text": "源单编号",
  145. "flex": 1,
  146. "dataIndex": "sl_code",
  147. "width": 100
  148. }, {
  149. "text": "单据金额",
  150. "flex": 1,
  151. "dataIndex": "sl_orderamount",
  152. "width": 100
  153. }, {
  154. "text": "已核销金额",
  155. "flex": 0,
  156. "dataIndex": "sl_yamount",
  157. "width": 200,
  158. "items": null
  159. }, {
  160. "text": "未核销金额",
  161. "flex": 1,
  162. "dataIndex": "sl_namount",
  163. "width": 100
  164. }]
  165. });
  166. }
  167. }
  168. });
  169. },
  170. addCombo:function(){
  171. var combo=this.ownerCmp;
  172. Ext.create('Ext.window.Window',{
  173. layout:'vbox',
  174. bodyPadding: 15,
  175. width:500,
  176. items:[{
  177. fieldLabel:'实际值',
  178. xtype:'textfield'
  179. },{
  180. fieldLabel:'显示值',
  181. xtype:'textfield'
  182. }],
  183. buttons:[{
  184. text:'确认',
  185. handler:function(b){
  186. combo.setValue('ok');
  187. b.up('window').close();
  188. }
  189. }],
  190. renderTo:this.ownerCmp.ownerCt.getEl()
  191. }).show();
  192. },
  193. turnIn: function() {
  194. var me = this,
  195. form = me.getView(),
  196. id = form.getForm().findField(form._idField);
  197. form.BaseUtil.request({
  198. url: form._turnInUrl+id.value,
  199. method: 'GET',
  200. })
  201. .then(function(localJson) {
  202. if(localJson.success){
  203. showToast('转单成功');
  204. }
  205. })
  206. .catch(function(res) {
  207. console.error(res);
  208. showToast('转单失败: ' + res.message);
  209. });
  210. }
  211. });