FormPanelController.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. "dataIndex": "ve_code",
  54. "width": 200
  55. }, {
  56. "text": "供应商名称",
  57. "dataIndex": "ve_name",
  58. "width": 200
  59. }, {
  60. "text": "供应商类型",
  61. "dataIndex": "ve_type",
  62. "width": 180,
  63. "items": null
  64. }, {
  65. "text": "税率",
  66. "dataIndex": "ve_taxrate",
  67. "width": 100
  68. }, {
  69. "text": "承付天数",
  70. "dataIndex": "ve_promisedays",
  71. "width": 100
  72. }, {
  73. "text": "纳税人识别号",
  74. "dataIndex": "ve_bankaccount",
  75. "width": 150
  76. }, {
  77. "text": "开户银行",
  78. "dataIndex": "ve_bankaccount",
  79. "width": 100
  80. }, {
  81. "text": "银行账户",
  82. "dataIndex": "ve_bankcode",
  83. "width": 100
  84. }]
  85. });
  86. }
  87. },
  88. 'dbfindtrigger[name=choseSource]': {
  89. beforerender: function (f) {
  90. Ext.apply(f, {
  91. dataUrl: '/api/money/subledger/list',
  92. addTitle: '源单资料',
  93. dbfinds: [{
  94. from: 'id',
  95. to: 'pbd_slid'
  96. }, {
  97. from: 'sl_code',
  98. to: 'pbd_slcode'
  99. },{
  100. from: 'sl_orderamount',
  101. to: 'pbd_amount'
  102. },{
  103. from: 'sl_yamount',
  104. to: 'pb_havebalance'
  105. },{
  106. from: 'sl_namount',
  107. to: 'pb_pbdamount'
  108. }],
  109. dbtpls: [{
  110. field: 'sl_code',
  111. width: 100
  112. }],
  113. defaultCondition: "sl_vendtid<>0 and sl_kind in ('期初余额','采购验收单','采购验退单') and sl_namount<>0",
  114. dbSearchFields:[{
  115. emptyText:'输入源单编号',
  116. xtype : "textfield",
  117. name : "search",
  118. getCondition: function(v) {
  119. return "(upper(sl_code) like '%"+v.toUpperCase()+"%')";
  120. },
  121. allowBlank : true,
  122. columnWidth : 0.25
  123. }],
  124. dbColumns:[{
  125. "text": "源单id",
  126. "hidden": true,
  127. "dataIndex": "id",
  128. "width": 100,
  129. "xtype": "numbercolumn"
  130. },{
  131. "text": "源单编号",
  132. "flex": 1,
  133. "dataIndex": "sl_code",
  134. "width": 100
  135. }, {
  136. "text": "单据金额",
  137. "flex": 1,
  138. "dataIndex": "sl_orderamount",
  139. "width": 100
  140. }, {
  141. "text": "已核销金额",
  142. "flex": 0,
  143. "dataIndex": "sl_yamount",
  144. "width": 200,
  145. "items": null
  146. }, {
  147. "text": "未核销金额",
  148. "flex": 1,
  149. "dataIndex": "sl_namount",
  150. "width": 100
  151. }]
  152. });
  153. }
  154. }
  155. });
  156. },
  157. addCombo:function(){
  158. var combo=this.ownerCmp;
  159. Ext.create('Ext.window.Window',{
  160. layout:'vbox',
  161. bodyPadding: 15,
  162. width:500,
  163. items:[{
  164. fieldLabel:'实际值',
  165. xtype:'textfield'
  166. },{
  167. fieldLabel:'显示值',
  168. xtype:'textfield'
  169. }],
  170. buttons:[{
  171. text:'确认',
  172. handler:function(b){
  173. combo.setValue('ok');
  174. b.up('window').close();
  175. }
  176. }],
  177. renderTo:this.ownerCmp.ownerCt.getEl()
  178. }).show();
  179. },
  180. turnIn: function() {
  181. var me = this,
  182. form = me.getView(),
  183. id = form.getForm().findField(form._idField);
  184. form.BaseUtil.request({
  185. url: form._turnInUrl+id.value,
  186. method: 'GET',
  187. })
  188. .then(function(localJson) {
  189. if(localJson.success){
  190. showToast('转单成功');
  191. }
  192. })
  193. .catch(function(res) {
  194. console.error(res);
  195. showToast('转单失败: ' + res.message);
  196. });
  197. }
  198. });