FormPanelController.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. align:'right'
  69. },{
  70. "text": "税率",
  71. "dataIndex": "cu_taxrate",
  72. "width": 100,
  73. align:'right'
  74. },{
  75. "text": "承付天数",
  76. "dataIndex": "cu_promisedays",
  77. "width": 100,
  78. align:'right'
  79. },{
  80. "text": "额度",
  81. "dataIndex": "cu_credit",
  82. "width": 100,
  83. align:'right'
  84. }]
  85. }) ;
  86. }
  87. },
  88. 'dbfindtrigger[name=rd_bankname]':{
  89. beforerender:function(f){
  90. Ext.apply(f,{
  91. //数据接口
  92. dataUrl: '/api/document/customer/list',
  93. addXtype: 'document-customer-formpanel',
  94. addTitle: '客户资料',
  95. //赋值
  96. dbfinds:[{
  97. from: 'id', to: 'rb_custid'
  98. }, {
  99. from:'cu_code', to:'rb_custcode'
  100. },{
  101. from:'cu_name', to:'rb_custname'
  102. }],
  103. //联想设置
  104. dbtpls:[{
  105. field:'cu_code',width:100
  106. },{
  107. field:'cu_name',width:100
  108. }],
  109. //联想查询条件
  110. defaultCondition: 'cu_statuscode="OPEN"',
  111. //放大镜窗口字段
  112. dbSearchFields:[{
  113. emptyText:'输入客户编号或名称',
  114. name : "cu_name",
  115. getCondition: function(v) {
  116. return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
  117. },
  118. fieldLabel : "客户名称",
  119. columnWidth : 0.25
  120. }],
  121. //放大镜窗口列表
  122. dbColumns:[{
  123. "text": "客户ID",
  124. "hidden": true,
  125. "dataIndex": "id",
  126. },{
  127. "text": "客户编号",
  128. "dataIndex": "cu_code",
  129. "width": 200,
  130. }, {
  131. "text": "客户名称",
  132. "dataIndex": "cu_name",
  133. "width": 200
  134. },{
  135. "text": "客户类型",
  136. "dataIndex": "cu_name",
  137. "width": 100
  138. },{
  139. "text": "业务员",
  140. "dataIndex": "cu_sellername",
  141. "width": 100
  142. },{
  143. "text": "税率",
  144. "dataIndex": "cu_taxrate",
  145. "width": 100,
  146. align:'right'
  147. },{
  148. "text": "承付天数",
  149. "dataIndex": "cu_promisedays",
  150. "width": 100,
  151. align:'right'
  152. },{
  153. "text": "额度",
  154. "dataIndex": "cu_credit",
  155. "width": 100,
  156. align:'right'
  157. }]
  158. }) ;
  159. }
  160. },
  161. 'multidbfindtrigger[name=rbd_slcode]': {
  162. beforerender: function (f) {
  163. Ext.apply(f, {
  164. dataUrl: '/api/money/subledger/list',
  165. addTitle: '源单资料',
  166. dbfinds: [{
  167. from: 'id',
  168. to: 'rbd_slid'
  169. }, {
  170. from: 'sl_code',
  171. to: 'rbd_slcode'
  172. },{
  173. from: 'sl_orderamount',
  174. to: 'rbd_amount'
  175. },{
  176. from: 'sl_yamount',
  177. to: 'rbd_havebalance'
  178. },{
  179. from: 'sl_namount',
  180. to: 'rbd_pbdamount'
  181. }],
  182. dbtpls: [{
  183. field: 'sl_code',
  184. width: 100
  185. }],
  186. defaultCondition: "sl_vendid<>0 and sl_kind in ('期初余额','出货单','销售退货单') and sl_namount<>0",
  187. dbSearchFields:[{
  188. emptyText:'输入源单编号',
  189. xtype : "textfield",
  190. name : "search",
  191. getCondition: function(v) {
  192. return "(upper(sl_code) like '%"+v.toUpperCase()+"%')";
  193. },
  194. allowBlank : true,
  195. columnWidth : 0.25
  196. }],
  197. dbColumns:[{
  198. "text": "源单id",
  199. "hidden": true,
  200. "dataIndex": "id",
  201. "width": 100,
  202. "xtype": "numbercolumn"
  203. },{
  204. "text": "源单编号",
  205. "flex": 1,
  206. "dataIndex": "sl_code",
  207. "width": 100
  208. }, {
  209. "text": "单据金额",
  210. "flex": 1,
  211. "dataIndex": "sl_orderamount",
  212. "width": 100,
  213. align:'right'
  214. }, {
  215. "text": "已核销金额",
  216. "flex": 0,
  217. "dataIndex": "sl_yamount",
  218. "width": 200,
  219. "items": null,
  220. align:'right'
  221. }, {
  222. "text": "未核销金额",
  223. "flex": 1,
  224. "dataIndex": "sl_namount",
  225. "width": 100,
  226. align:'right'
  227. }]
  228. });
  229. }
  230. },
  231. 'dbfindtrigger[name=rd_bankname]':{
  232. beforerender: function (f) {
  233. Ext.apply(f, {
  234. dataUrl: '/api/document/bankinformation/list',
  235. // addXtype: 'document-banksubledger-formpanel',
  236. addTitle: '账户资料',
  237. dbfinds: [{
  238. from: 'id',
  239. to: 'rd_bankid'
  240. }, {
  241. from: 'bk_bankcode',
  242. to: 'rd_bankcode'
  243. },{
  244. from: 'bk_bankname',
  245. to: 'rd_bankname'
  246. }],
  247. dbtpls: [{
  248. field: 'bk_bankcode',
  249. width: 100
  250. }, {
  251. field: 'bk_bankname',
  252. width: 100
  253. }],
  254. defaultCondition: "1=1",
  255. dbSearchFields:[{
  256. emptyText:'输入账户名称或者编号',
  257. xtype : "textfield",
  258. name : "search",
  259. getCondition: function(v) {
  260. return "(upper(bk_bankcode) like '%"+v.toUpperCase()+"%' or upper(bk_bankname) like '%"+v.toUpperCase()+"%')";
  261. },
  262. allowBlank : true,
  263. columnWidth : 0.25
  264. }],
  265. dbColumns:[{
  266. "text": "账户id",
  267. "hidden": true,
  268. "dataIndex": "id",
  269. "width": 0,
  270. "xtype": "numbercolumn"
  271. },{
  272. "text": "账户编号",
  273. "flex": 1,
  274. "dataIndex": "bk_bankcode",
  275. "width": 100
  276. }, {
  277. "text": "账户名称",
  278. "flex": 1,
  279. "dataIndex": "bk_bankname",
  280. "width": 100
  281. }]
  282. });
  283. }
  284. }
  285. });
  286. },
  287. addCombo:function(){
  288. var combo=this.ownerCmp;
  289. Ext.create('Ext.window.Window',{
  290. layout:'vbox',
  291. bodyPadding: 15,
  292. width:500,
  293. items:[{
  294. fieldLabel:'实际值',
  295. xtype:'textfield'
  296. },{
  297. fieldLabel:'显示值',
  298. xtype:'textfield'
  299. }],
  300. buttons:[{
  301. text:'确认',
  302. handler:function(b){
  303. combo.setValue('ok');
  304. b.up('window').close();
  305. }
  306. }],
  307. renderTo:this.ownerCmp.ownerCt.getEl()
  308. }).show();
  309. },
  310. turnIn: function() {
  311. var me = this,
  312. form = me.getView(),
  313. id = form.getForm().findField(form._idField);
  314. form.BaseUtil.request({
  315. url: form._turnInUrl+id.value,
  316. method: 'GET',
  317. })
  318. .then(function(localJson) {
  319. if(localJson.success){
  320. showToast('转单成功');
  321. }
  322. })
  323. .catch(function(res) {
  324. console.error(res);
  325. showToast('转单失败: ' + res.message);
  326. });
  327. }
  328. });