FormPanelController.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. Ext.define('saas.view.money.payBalance.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.money-paybalance-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. });
  64. },
  65. addCombo:function(){
  66. var combo=this.ownerCmp;
  67. Ext.create('Ext.window.Window',{
  68. layout:'vbox',
  69. bodyPadding: 15,
  70. width:500,
  71. items:[{
  72. fieldLabel:'实际值',
  73. xtype:'textfield'
  74. },{
  75. fieldLabel:'显示值',
  76. xtype:'textfield'
  77. }],
  78. buttons:[{
  79. text:'确认',
  80. handler:function(b){
  81. combo.setValue('ok');
  82. b.up('window').close();
  83. }
  84. }],
  85. renderTo:this.ownerCmp.ownerCt.getEl()
  86. }).show();
  87. },
  88. turnIn: function() {
  89. var me = this,
  90. form = me.getView(),
  91. id = form.getForm().findField(form._idField);
  92. form.BaseUtil.request({
  93. url: form._turnInUrl+id.value,
  94. method: 'GET',
  95. })
  96. .then(function(localJson) {
  97. if(localJson.success){
  98. showToast('转单成功');
  99. }
  100. })
  101. .catch(function(res) {
  102. console.error(res);
  103. showToast('转单失败: ' + res.message);
  104. });
  105. }
  106. });