FormPanelController.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. Ext.define('saas.view.purchase.purchaseIn.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.purchase-purchasein-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. /**放大镜新增demo*/
  8. "field[name=combo]":{
  9. beforerender:function(f){
  10. f.addHandler=me.addCombo;
  11. }
  12. },
  13. //放大镜赋值关系 以及 tpl模板
  14. 'dbfindtrigger[name=pi_vendname]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. dbfinds:[{
  18. from:'id',to:'pi_vendid',ignore:true
  19. },{
  20. from:'ve_code',to:'pi_vendcode'
  21. },{
  22. from:'ve_name',to:'pi_vendname'
  23. }],
  24. }) ;
  25. }
  26. },
  27. //放大镜赋值关系 以及 tpl模板
  28. 'multidbfindtrigger[name=pd_prodcode]':{
  29. beforerender:function(f){
  30. Ext.apply(f,{
  31. dbfinds:[{
  32. from:'id',to:'pd_prodid',ignore:true
  33. },{
  34. from:'pr_code',to:'pd_prodcode'
  35. },{
  36. from:'pr_detail',to:'pr_detail'
  37. },{
  38. from:'pr_spec',to:'pr_spec'
  39. },{
  40. from:'pr_whid',to:'pd_whid'
  41. },{
  42. from:'pr_whcode',to:'pd_whcode'
  43. },{
  44. from:'pr_whname',to:'pd_whname'
  45. },{
  46. from:'pr_purcprice',to:'pd_orderprice'
  47. }],
  48. });
  49. }
  50. },
  51. //放大镜赋值关系 以及 tpl模板
  52. 'dbfindtrigger[name=pd_whname]':{
  53. beforerender:function(f){
  54. Ext.apply(f,{
  55. dbfinds:[{
  56. from:'id',to:'pd_whid',ignore:true
  57. },{
  58. from:'wh_code',to:'pd_whcode'
  59. },{
  60. from:'wh_description',to:'pd_whname'
  61. }],
  62. }) ;
  63. }
  64. }
  65. });
  66. },
  67. addCombo:function(){
  68. var combo=this.ownerCmp;
  69. Ext.create('Ext.window.Window',{
  70. layout:'vbox',
  71. bodyPadding: 15,
  72. width:500,
  73. items:[{
  74. fieldLabel:'实际值',
  75. xtype:'textfield'
  76. },{
  77. fieldLabel:'显示值',
  78. xtype:'textfield'
  79. }],
  80. buttons:[{
  81. text:'确认',
  82. handler:function(b){
  83. combo.setValue('ok');
  84. b.up('window').close();
  85. }
  86. }],
  87. renderTo:this.ownerCmp.ownerCt.getEl()
  88. }).show();
  89. },
  90. turnOut: function() {
  91. var me = this,
  92. form = me.getView(),
  93. id = form.getForm().findField(form._idField);
  94. saas.util.BaseUtil.request({
  95. url: form._turnOutUrl+id.value,
  96. method: 'POST',
  97. })
  98. .then(function(localJson) {
  99. if(localJson.success){
  100. var intValue = localJson.data.id,
  101. codeValue= localJson.data.code,
  102. name = localJson.data.name;
  103. saas.util.BaseUtil.openTab('purchase-purchaseout-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  104. initId: intValue
  105. });
  106. saas.util.BaseUtil.showSuccessToast('转单成功');
  107. }
  108. })
  109. .catch(function(res) {
  110. console.error(res);
  111. saas.util.BaseUtil.showErrorToast('转单失败: ' + res.message);
  112. });
  113. }
  114. });