FormPanelController.js 6.2 KB

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