FormPanelController.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. Ext.define('saas.view.money.recBalance.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.money-recbalance-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. 'dbfindtrigger[name=rb_custname]':{
  8. beforerender:function(f){
  9. Ext.apply(f,{
  10. //数据接口
  11. dataUrl: '/api/document/customer/list',
  12. addXtype: 'document-customer-formpanel',
  13. addTitle: '客户资料',
  14. //赋值
  15. dbfinds:[{
  16. from: 'id', to: 'rb_custid'
  17. }, {
  18. from:'cu_code', to:'rb_custcode'
  19. },{
  20. from:'cu_name', to:'rb_custname'
  21. },{
  22. from:'cu_leftamount', to:'rb_rdamount'
  23. }],
  24. //联想设置
  25. dbtpls:[{
  26. field:'cu_code',width:100
  27. },{
  28. field:'cu_name',width:100
  29. },{
  30. field:'cu_leftamount',width:100
  31. }],
  32. defaultCondition: 'cu_statuscode="OPEN"',
  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. //放大镜窗口列表
  44. dbColumns:[{
  45. "text": "客户ID",
  46. "hidden": true,
  47. "dataIndex": "id",
  48. },{
  49. "text": "客户编号",
  50. "dataIndex": "cu_code",
  51. "width": 200,
  52. }, {
  53. "text": "客户名称",
  54. "dataIndex": "cu_name",
  55. "width": 200
  56. },{
  57. "text": "客户类型",
  58. "dataIndex": "cu_name",
  59. "width": 100
  60. },{
  61. "text": "业务员",
  62. "dataIndex": "cu_sellername",
  63. "width": 100
  64. },{
  65. "text": "应收款余额",
  66. "dataIndex": "cu_leftamount",
  67. "width": 100
  68. },{
  69. "text": "税率",
  70. "dataIndex": "cu_taxrate",
  71. "width": 100
  72. },{
  73. "text": "承付天数",
  74. "dataIndex": "cu_promisedays",
  75. "width": 100
  76. },{
  77. "text": "额度",
  78. "dataIndex": "cu_credit",
  79. "width": 100
  80. }]
  81. }) ;
  82. }
  83. },
  84. 'dbfindtrigger[name=rd_bankname]':{
  85. beforerender:function(f){
  86. Ext.apply(f,{
  87. //数据接口
  88. dataUrl: '/api/document/customer/list',
  89. addXtype: 'document-customer-formpanel',
  90. addTitle: '客户资料',
  91. //赋值
  92. dbfinds:[{
  93. from: 'id', to: 'rb_custid'
  94. }, {
  95. from:'cu_code', to:'rb_custcode'
  96. },{
  97. from:'cu_name', to:'rb_custname'
  98. }],
  99. //联想设置
  100. dbtpls:[{
  101. field:'cu_code',width:100
  102. },{
  103. field:'cu_name',width:100
  104. }],
  105. //联想查询条件
  106. defaultCondition: 'cu_statuscode="OPEN"',
  107. //放大镜窗口字段
  108. dbSearchFields:[{
  109. emptyText:'输入客户编号或名称',
  110. name : "cu_name",
  111. getCondition: function(v) {
  112. return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
  113. },
  114. fieldLabel : "客户名称",
  115. columnWidth : 0.25
  116. }],
  117. //放大镜窗口列表
  118. dbColumns:[{
  119. "text": "客户ID",
  120. "hidden": true,
  121. "dataIndex": "id",
  122. },{
  123. "text": "客户编号",
  124. "dataIndex": "cu_code",
  125. "width": 200,
  126. }, {
  127. "text": "客户名称",
  128. "dataIndex": "cu_name",
  129. "width": 200
  130. },{
  131. "text": "客户类型",
  132. "dataIndex": "cu_name",
  133. "width": 100
  134. },{
  135. "text": "业务员",
  136. "dataIndex": "cu_sellername",
  137. "width": 100
  138. },{
  139. "text": "税率",
  140. "dataIndex": "cu_taxrate",
  141. "width": 100
  142. },{
  143. "text": "承付天数",
  144. "dataIndex": "cu_promisedays",
  145. "width": 100
  146. },{
  147. "text": "额度",
  148. "dataIndex": "cu_credit",
  149. "width": 100
  150. }]
  151. }) ;
  152. }
  153. },
  154. 'dbfindtrigger[name=choseSource]': {
  155. beforerender: function (f) {
  156. Ext.apply(f, {
  157. dataUrl: '/api/money/subledger/list',
  158. addTitle: '源单资料',
  159. dbfinds: [{
  160. from: 'id',
  161. to: 'rbd_slid'
  162. }, {
  163. from: 'sl_code',
  164. to: 'rbd_slcode'
  165. },{
  166. from: 'sl_orderamount',
  167. to: 'rbd_amount'
  168. },{
  169. from: 'sl_yamount',
  170. to: 'rbd_havebalance'
  171. },{
  172. from: 'sl_namount',
  173. to: 'rbd_pbdamount'
  174. }],
  175. dbtpls: [{
  176. field: 'sl_code',
  177. width: 100
  178. }],
  179. defaultCondition: "sl_vendtid<>0 and sl_kind in ('期初余额','采购验收单','采购验退单') and sl_namount<>0",
  180. dbSearchFields:[{
  181. emptyText:'输入源单编号',
  182. xtype : "textfield",
  183. name : "search",
  184. getCondition: function(v) {
  185. return "(upper(sl_code) like '%"+v.toUpperCase()+"%')";
  186. },
  187. allowBlank : true,
  188. columnWidth : 0.25
  189. }],
  190. dbColumns:[{
  191. "text": "源单id",
  192. "hidden": true,
  193. "dataIndex": "id",
  194. "width": 100,
  195. "xtype": "numbercolumn"
  196. },{
  197. "text": "源单编号",
  198. "flex": 1,
  199. "dataIndex": "sl_code",
  200. "width": 100
  201. }, {
  202. "text": "单据金额",
  203. "flex": 1,
  204. "dataIndex": "sl_orderamount",
  205. "width": 100
  206. }, {
  207. "text": "已核销金额",
  208. "flex": 0,
  209. "dataIndex": "sl_yamount",
  210. "width": 200,
  211. "items": null
  212. }, {
  213. "text": "未核销金额",
  214. "flex": 1,
  215. "dataIndex": "sl_namount",
  216. "width": 100
  217. }]
  218. });
  219. }
  220. }
  221. });
  222. },
  223. addCombo:function(){
  224. var combo=this.ownerCmp;
  225. Ext.create('Ext.window.Window',{
  226. layout:'vbox',
  227. bodyPadding: 15,
  228. width:500,
  229. items:[{
  230. fieldLabel:'实际值',
  231. xtype:'textfield'
  232. },{
  233. fieldLabel:'显示值',
  234. xtype:'textfield'
  235. }],
  236. buttons:[{
  237. text:'确认',
  238. handler:function(b){
  239. combo.setValue('ok');
  240. b.up('window').close();
  241. }
  242. }],
  243. renderTo:this.ownerCmp.ownerCt.getEl()
  244. }).show();
  245. },
  246. turnIn: function() {
  247. var me = this,
  248. form = me.getView(),
  249. id = form.getForm().findField(form._idField);
  250. form.BaseUtil.request({
  251. url: form._turnInUrl+id.value,
  252. method: 'GET',
  253. })
  254. .then(function(localJson) {
  255. if(localJson.success){
  256. showToast('转单成功');
  257. }
  258. })
  259. .catch(function(res) {
  260. console.error(res);
  261. showToast('转单失败: ' + res.message);
  262. });
  263. }
  264. });