FormPanelController.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. //联想设置
  23. dbtpls:[{
  24. field:'cu_code',width:100
  25. },{
  26. field:'cu_name',width:100
  27. }],
  28. defaultCondition: 'cu_statuscode="OPEN"',
  29. //放大镜窗口字段
  30. dbSearchFields:[{
  31. emptyText:'输入客户编号或名称',
  32. name : "cu_name",
  33. getCondition: function(v) {
  34. return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
  35. },
  36. fieldLabel : "客户名称",
  37. columnWidth : 0.25
  38. }],
  39. //放大镜窗口列表
  40. dbColumns:[{
  41. "text": "ID",
  42. "flex": 0,
  43. "dataIndex": "id",
  44. "width": 0,
  45. "xtype": "",
  46. "items": null
  47. },{
  48. "text": "供应商编号",
  49. "flex": 1,
  50. "dataIndex": "cu_code",
  51. "width": 100,
  52. "xtype": "",
  53. "items": null
  54. }, {
  55. "text": "供应商名称",
  56. "flex": 1,
  57. "dataIndex": "cu_name",
  58. "xtype": "",
  59. "items": null
  60. }]
  61. }) ;
  62. }
  63. },
  64. 'dbfindtrigger[name=rd_bankname]':{
  65. beforerender:function(f){
  66. Ext.apply(f,{
  67. //数据接口
  68. dataUrl: '/api/document/customer/list',
  69. addXtype: 'document-customer-formpanel',
  70. addTitle: '客户资料',
  71. //赋值
  72. dbfinds:[{
  73. from: 'id', to: 'rb_custid'
  74. }, {
  75. from:'cu_code', to:'rb_custcode'
  76. },{
  77. from:'cu_name', to:'rb_custname'
  78. }],
  79. //联想设置
  80. dbtpls:[{
  81. field:'cu_code',width:100
  82. },{
  83. field:'cu_name',width:100
  84. }],
  85. //联想查询条件
  86. defaultCondition: 'cu_statuscode="OPEN"',
  87. //放大镜窗口字段
  88. dbSearchFields:[{
  89. emptyText:'输入客户编号或名称',
  90. name : "cu_name",
  91. getCondition: function(v) {
  92. return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
  93. },
  94. fieldLabel : "客户名称",
  95. columnWidth : 0.25
  96. }],
  97. //放大镜窗口列表
  98. dbColumns:[{
  99. "text": "ID",
  100. "flex": 0,
  101. "dataIndex": "id",
  102. "width": 0,
  103. "xtype": "",
  104. "items": null
  105. },{
  106. "text": "供应商编号",
  107. "flex": 1,
  108. "dataIndex": "cu_code",
  109. "width": 100,
  110. "xtype": "",
  111. "items": null
  112. }, {
  113. "text": "供应商名称",
  114. "flex": 1,
  115. "dataIndex": "cu_name",
  116. "xtype": "",
  117. "items": null
  118. }]
  119. }) ;
  120. }
  121. },
  122. });
  123. },
  124. addCombo:function(){
  125. var combo=this.ownerCmp;
  126. Ext.create('Ext.window.Window',{
  127. layout:'vbox',
  128. bodyPadding: 15,
  129. width:500,
  130. items:[{
  131. fieldLabel:'实际值',
  132. xtype:'textfield'
  133. },{
  134. fieldLabel:'显示值',
  135. xtype:'textfield'
  136. }],
  137. buttons:[{
  138. text:'确认',
  139. handler:function(b){
  140. combo.setValue('ok');
  141. b.up('window').close();
  142. }
  143. }],
  144. renderTo:this.ownerCmp.ownerCt.getEl()
  145. }).show();
  146. },
  147. turnIn: function() {
  148. var me = this,
  149. form = me.getView(),
  150. id = form.getForm().findField(form._idField);
  151. form.BaseUtil.request({
  152. url: form._turnInUrl+id.value,
  153. method: 'GET',
  154. })
  155. .then(function(localJson) {
  156. if(localJson.success){
  157. showToast('转单成功');
  158. }
  159. })
  160. .catch(function(res) {
  161. console.error(res);
  162. showToast('转单失败: ' + res.message);
  163. });
  164. }
  165. });