FormPanelController.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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: 'pb_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. 'multidbfindtrigger[name=pbd_slcode]': {
  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_vendid<>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. 'dbfindtrigger[name=pd_bankname]':{
  156. beforerender: function (f) {
  157. Ext.apply(f, {
  158. dataUrl: '/api/document/bankinformation/list',
  159. // addXtype: 'document-banksubledger-formpanel',
  160. addTitle: '账户资料',
  161. dbfinds: [{
  162. from: 'id',
  163. to: 'pd_bankid'
  164. }, {
  165. from: 'bk_bankcode',
  166. to: 'pd_bankcode'
  167. },{
  168. from: 'bk_bankname',
  169. to: 'pd_bankname'
  170. }],
  171. dbtpls: [{
  172. field: 'bk_bankcode',
  173. width: 100
  174. }, {
  175. field: 'bk_bankname',
  176. width: 100
  177. }],
  178. defaultCondition: "1=1",
  179. dbSearchFields:[{
  180. emptyText:'输入账户名称或者编号',
  181. xtype : "textfield",
  182. name : "search",
  183. getCondition: function(v) {
  184. return "(upper(bk_bankcode) like '%"+v.toUpperCase()+"%' or upper(bk_bankname) like '%"+v.toUpperCase()+"%')";
  185. },
  186. allowBlank : true,
  187. columnWidth : 0.25
  188. }],
  189. dbColumns:[{
  190. "text": "账户id",
  191. "hidden": true,
  192. "dataIndex": "id",
  193. "width": 0,
  194. "xtype": "numbercolumn"
  195. },{
  196. "text": "账户编号",
  197. "flex": 1,
  198. "dataIndex": "bk_bankcode",
  199. "width": 100
  200. }, {
  201. "text": "账户名称",
  202. "flex": 1,
  203. "dataIndex": "bk_bankname",
  204. "width": 100
  205. }]
  206. });
  207. }
  208. }
  209. });
  210. },
  211. addCombo:function(){
  212. var combo=this.ownerCmp;
  213. Ext.create('Ext.window.Window',{
  214. layout:'vbox',
  215. bodyPadding: 15,
  216. width:500,
  217. items:[{
  218. fieldLabel:'实际值',
  219. xtype:'textfield'
  220. },{
  221. fieldLabel:'显示值',
  222. xtype:'textfield'
  223. }],
  224. buttons:[{
  225. text:'确认',
  226. handler:function(b){
  227. combo.setValue('ok');
  228. b.up('window').close();
  229. }
  230. }],
  231. renderTo:this.ownerCmp.ownerCt.getEl()
  232. }).show();
  233. },
  234. turnIn: function() {
  235. var me = this,
  236. form = me.getView(),
  237. id = form.getForm().findField(form._idField);
  238. form.BaseUtil.request({
  239. url: form._turnInUrl+id.value,
  240. method: 'GET',
  241. })
  242. .then(function(localJson) {
  243. if(localJson.success){
  244. showToast('转单成功');
  245. }
  246. })
  247. .catch(function(res) {
  248. console.error(res);
  249. showToast('转单失败: ' + res.message);
  250. });
  251. }
  252. });