FormPanelController.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Ext.define('saas.view.purchase.purchase.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.purchase-purchase-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. // 主表-供应商名称
  8. 'dbfindtrigger[name=pu_vendname]':{
  9. beforerender:function(f){
  10. Ext.apply(f,{
  11. //赋值
  12. dbfinds:[{
  13. from:'id',to:'pu_vendid',ignore:true
  14. },{
  15. from:'ve_code',to:'pu_vendcode'
  16. },{
  17. from:'ve_name',to:'pu_vendname'
  18. }],
  19. }) ;
  20. }
  21. },
  22. // 主表-采购员名称
  23. 'dbfindtrigger[name=pu_buyercode]':{
  24. beforerender:function(f){
  25. Ext.apply(f,{
  26. //赋值
  27. dbfinds:[{
  28. from:'id',to:'pu_buyerid',ignore:true
  29. },{
  30. from:'em_code',to:'pu_buyercode'
  31. },{
  32. from:'em_name',to:'pu_buyername'
  33. }]
  34. }) ;
  35. }
  36. },
  37. //从表多选放大镜赋值关系 以及 tpl模板
  38. 'multidbfindtrigger[name=pd_prodcode]':{
  39. beforerender:function(f){
  40. Ext.apply(f,{
  41. //放大镜赋值设置
  42. dbfinds:[{
  43. from:'id',to:'pd_prodid',ignore:true
  44. },{
  45. from:'pr_code',to:'pd_prodcode'
  46. },{
  47. from:'pr_detail',to:'pr_detail'
  48. },{
  49. from:'pr_spec',to:'pr_spec'
  50. },{
  51. from:'pr_purcprice',to:'pd_price'
  52. },{
  53. from:'pr_zxbzs',to:'pr_zxbzs'
  54. }],
  55. });
  56. }
  57. },
  58. });
  59. },
  60. turnIn: function() {
  61. var me = this,
  62. form = me.getView(),
  63. id = form.getForm().findField(form._idField);
  64. saas.util.BaseUtil.request({
  65. url: form._turnInUrl+'/'+id.value,
  66. method: 'POST',
  67. })
  68. .then(function(localJson) {
  69. if(localJson.success){
  70. var intValue = localJson.data.id,
  71. codeValue= localJson.data.code,
  72. name = localJson.data.name;
  73. saas.util.BaseUtil.openTab('purchase-purchasein-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  74. initId: intValue
  75. });
  76. saas.util.BaseUtil.showSuccessToast('转单成功');
  77. }
  78. })
  79. .catch(function(res) {
  80. console.error(res);
  81. saas.util.BaseUtil.showErrorToast('转单失败: ' + res.message);
  82. });
  83. }
  84. });