FormPanelController.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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. 'multidbfindtrigger[name=rbd_slcode]': {
  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_vendid<>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. 'dbfindtrigger[name=rd_bankname]':{
  222. beforerender: function (f) {
  223. Ext.apply(f, {
  224. dataUrl: '/api/document/bankinformation/list',
  225. // addXtype: 'document-banksubledger-formpanel',
  226. addTitle: '账户资料',
  227. dbfinds: [{
  228. from: 'id',
  229. to: 'rd_bankid'
  230. }, {
  231. from: 'bk_bankcode',
  232. to: 'rd_bankcode'
  233. },{
  234. from: 'bk_bankname',
  235. to: 'rd_bankname'
  236. }],
  237. dbtpls: [{
  238. field: 'bk_bankcode',
  239. width: 100
  240. }, {
  241. field: 'bk_bankname',
  242. width: 100
  243. }],
  244. defaultCondition: "1=1",
  245. dbSearchFields:[{
  246. emptyText:'输入账户名称或者编号',
  247. xtype : "textfield",
  248. name : "search",
  249. getCondition: function(v) {
  250. return "(upper(bk_bankcode) like '%"+v.toUpperCase()+"%' or upper(bk_bankname) like '%"+v.toUpperCase()+"%')";
  251. },
  252. allowBlank : true,
  253. columnWidth : 0.25
  254. }],
  255. dbColumns:[{
  256. "text": "账户id",
  257. "hidden": true,
  258. "dataIndex": "id",
  259. "width": 0,
  260. "xtype": "numbercolumn"
  261. },{
  262. "text": "账户编号",
  263. "flex": 1,
  264. "dataIndex": "bk_bankcode",
  265. "width": 100
  266. }, {
  267. "text": "账户名称",
  268. "flex": 1,
  269. "dataIndex": "bk_bankname",
  270. "width": 100
  271. }]
  272. });
  273. }
  274. }
  275. });
  276. },
  277. addCombo:function(){
  278. var combo=this.ownerCmp;
  279. Ext.create('Ext.window.Window',{
  280. layout:'vbox',
  281. bodyPadding: 15,
  282. width:500,
  283. items:[{
  284. fieldLabel:'实际值',
  285. xtype:'textfield'
  286. },{
  287. fieldLabel:'显示值',
  288. xtype:'textfield'
  289. }],
  290. buttons:[{
  291. text:'确认',
  292. handler:function(b){
  293. combo.setValue('ok');
  294. b.up('window').close();
  295. }
  296. }],
  297. renderTo:this.ownerCmp.ownerCt.getEl()
  298. }).show();
  299. },
  300. turnIn: function() {
  301. var me = this,
  302. form = me.getView(),
  303. id = form.getForm().findField(form._idField);
  304. form.BaseUtil.request({
  305. url: form._turnInUrl+id.value,
  306. method: 'GET',
  307. })
  308. .then(function(localJson) {
  309. if(localJson.success){
  310. showToast('转单成功');
  311. }
  312. })
  313. .catch(function(res) {
  314. console.error(res);
  315. showToast('转单失败: ' + res.message);
  316. });
  317. }
  318. });