FormPanelController.js 15 KB

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