FormPanelController.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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. from:'sl_date',
  183. to:'rbd_sldate'
  184. },{
  185. from:'sl_kind',
  186. to:'rbd_slkind'
  187. }],
  188. dbtpls: [{
  189. field: 'sl_code',
  190. width: 100
  191. }],
  192. defaultCondition: "sl_custid<>0 and sl_kind in ('期初余额','出货单','销售退货单') and sl_namount<>0",
  193. dbSearchFields:[{
  194. emptyText:'输入源单编号',
  195. xtype : "textfield",
  196. name : "search",
  197. getCondition: function(v) {
  198. return "(upper(sl_code) like '%"+v.toUpperCase()+"%')";
  199. },
  200. allowBlank : true,
  201. columnWidth : 0.25
  202. }],
  203. dbColumns:[{
  204. "text": "源单id",
  205. "hidden": true,
  206. "dataIndex": "id",
  207. "width": 100,
  208. "xtype": "numbercolumn"
  209. },{
  210. "text": "源单编号",
  211. "flex": 1,
  212. "dataIndex": "sl_code",
  213. "width": 100
  214. }, {
  215. "text": "源单类型",
  216. "flex": 1,
  217. "dataIndex": "sl_kind",
  218. "width": 100
  219. },{
  220. "text": "单据金额",
  221. "flex": 1,
  222. "dataIndex": "sl_orderamount",
  223. "width": 100,
  224. align:'right'
  225. }, {
  226. "text": "已核销金额",
  227. "flex": 0,
  228. "dataIndex": "sl_yamount",
  229. "width": 200,
  230. "items": null,
  231. align:'right'
  232. }, {
  233. "text": "未核销金额",
  234. "flex": 1,
  235. "dataIndex": "sl_namount",
  236. "width": 100,
  237. align:'right'
  238. },{
  239. "text": "单据日期",
  240. "flex": 1,
  241. "dataIndex": "sl_date",
  242. "width": 100,
  243. align:'right'
  244. }]
  245. });
  246. }
  247. },
  248. 'dbfindtrigger[name=rd_bankname]':{
  249. beforerender: function (f) {
  250. Ext.apply(f, {
  251. dataUrl: '/api/document/bankinformation/list',
  252. // addXtype: 'document-banksubledger-formpanel',
  253. addTitle: '账户资料',
  254. dbfinds: [{
  255. from: 'id',
  256. to: 'rd_bankid'
  257. }, {
  258. from: 'bk_bankcode',
  259. to: 'rd_bankcode'
  260. },{
  261. from: 'bk_bankname',
  262. to: 'rd_bankname'
  263. }],
  264. dbtpls: [{
  265. field: 'bk_bankcode',
  266. width: 100
  267. }, {
  268. field: 'bk_bankname',
  269. width: 100
  270. }],
  271. defaultCondition: "1=1",
  272. dbSearchFields:[{
  273. emptyText:'输入账户名称或者编号',
  274. xtype : "textfield",
  275. name : "search",
  276. getCondition: function(v) {
  277. return "(upper(bk_bankcode) like '%"+v.toUpperCase()+"%' or upper(bk_bankname) like '%"+v.toUpperCase()+"%')";
  278. },
  279. allowBlank : true,
  280. columnWidth : 0.25
  281. }],
  282. dbColumns:[{
  283. "text": "账户id",
  284. "hidden": true,
  285. "dataIndex": "id",
  286. "width": 0,
  287. "xtype": "numbercolumn"
  288. },{
  289. "text": "账户编号",
  290. "flex": 1,
  291. "dataIndex": "bk_bankcode",
  292. "width": 100
  293. }, {
  294. "text": "账户名称",
  295. "flex": 1,
  296. "dataIndex": "bk_bankname",
  297. "width": 100
  298. }]
  299. });
  300. }
  301. }
  302. });
  303. },
  304. addCombo:function(){
  305. var combo=this.ownerCmp;
  306. Ext.create('Ext.window.Window',{
  307. layout:'vbox',
  308. bodyPadding: 15,
  309. width:500,
  310. items:[{
  311. fieldLabel:'实际值',
  312. xtype:'textfield'
  313. },{
  314. fieldLabel:'显示值',
  315. xtype:'textfield'
  316. }],
  317. buttons:[{
  318. text:'确认',
  319. handler:function(b){
  320. combo.setValue('ok');
  321. b.up('window').close();
  322. }
  323. }],
  324. renderTo:this.ownerCmp.ownerCt.getEl()
  325. }).show();
  326. },
  327. turnIn: function() {
  328. var me = this,
  329. form = me.getView(),
  330. id = form.getForm().findField(form._idField);
  331. form.BaseUtil.request({
  332. url: form._turnInUrl+id.value,
  333. method: 'GET',
  334. })
  335. .then(function(localJson) {
  336. if(localJson.success){
  337. showToast('转单成功');
  338. }
  339. })
  340. .catch(function(res) {
  341. console.error(res);
  342. showToast('转单失败: ' + res.message);
  343. });
  344. }
  345. });