FormPanelController.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. Ext.define('make.view.osmake.osMakeCheckIn.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.osmake-osmakecheckin-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //放大镜赋值关系 以及 tpl模板
  8. 'dbfindtrigger[name=pi_vendname]':{
  9. beforerender:function(f){
  10. Ext.apply(f,{
  11. dbfinds:[{
  12. from:'id',to:'pi_vendid',ignore:true
  13. },{
  14. from:'ve_code',to:'pi_vendcode'
  15. },{
  16. from:'ve_name',to:'pi_vendname'
  17. },{
  18. from:'ve_buyerid',to:'pi_buyerid'
  19. },{
  20. from:'ve_buyercode',to:'pi_buyercode'
  21. },{
  22. from:'ve_buyername',to:'pi_buyername'
  23. },{
  24. from:'ve_currency',to:'pi_currency'
  25. },{
  26. from:'cr_rate',to:'pi_rate'
  27. },{
  28. from:'vc_name',to:'pi_contact'
  29. },{
  30. from:'vc_tel',to:'pi_tel'
  31. },{
  32. from:'ve_paymentsid',to:'pi_paymentsid'
  33. },{
  34. from:'ve_paymentscode',to:'pi_paymentscode'
  35. },{
  36. from:'ve_payments',to:'pi_payments'
  37. },{
  38. from:'ve_taxrate',to:'pi_taxrate'
  39. }],
  40. }) ;
  41. }
  42. },
  43. 'osMakeMainMultiDbfindTrigger[name=pd_ordercode]':{
  44. beforerender: function (f) {
  45. Ext.apply(f, {
  46. defaultCondition: "ma_statuscode = 'AUDITED' and ma_tasktype = 'OS' AND ma_vendcode IS NOT NULL AND MA_QTY - IFNULL(MA_MADEQTY,0) > 0"
  47. });
  48. }
  49. },
  50. //从表多选放大镜赋值关系 以及 tpl模板
  51. 'multidbfindtrigger[name=pd_prodcode]':{
  52. beforerender:function(f){
  53. Ext.apply(f,{
  54. //放大镜赋值设置
  55. dbfinds:[{
  56. from:'id',to:'pd_prodid',ignore:true
  57. },{
  58. from:'pr_code',to:'pd_prodcode'
  59. },{
  60. from:'pr_detail',to:'pr_detail'
  61. },{
  62. from:'pr_spec',to:'pr_spec'
  63. },{
  64. from: 'pr_brand', to: 'pr_brand'
  65. },{
  66. from: 'pr_orispeccode', to: 'pr_orispeccode'
  67. },{
  68. from: 'pr_unit', to: 'pr_unit'
  69. }, {
  70. from:'pr_purcprice',to:'pd_lastprice'
  71. },{
  72. from:'pr_zxbzs',to:'pr_zxbzs'
  73. }],
  74. });
  75. }
  76. },
  77. 'multidbfindtrigger[name=pr_detail]': {
  78. beforerender: function (f) {
  79. Ext.apply(f, {
  80. dbfinds:[{
  81. from:'id',to:'pd_prodid',ignore:true
  82. },{
  83. from:'pr_code',to:'pd_prodcode'
  84. },{
  85. from:'pr_detail',to:'pr_detail'
  86. },{
  87. from:'pr_spec',to:'pr_spec'
  88. },{
  89. from: 'pr_brand', to: 'pr_brand'
  90. },{
  91. from: 'pr_orispeccode', to: 'pr_orispeccode'
  92. },{
  93. from: 'pr_unit', to: 'pr_unit'
  94. }, {
  95. from:'pr_purcprice',to:'pd_lastprice'
  96. },{
  97. from:'pr_zxbzs',to:'pr_zxbzs'
  98. }],
  99. });
  100. }
  101. },//放大镜赋值关系 以及 tpl模板
  102. 'dbfindtrigger[name=pd_whname]':{
  103. beforerender:function(f){
  104. Ext.apply(f,{
  105. dbfinds:[{
  106. from:'id',to:'pd_whid',ignore:true
  107. },{
  108. from:'wh_code',to:'pd_whcode'
  109. },{
  110. from:'wh_description',to:'pd_whname'
  111. }],
  112. }) ;
  113. }
  114. }
  115. });
  116. },
  117. /**
  118. * 生成外协验退单
  119. */
  120. turnOsMakeInBack: function(){
  121. var me = this,
  122. form = me.getView(),
  123. id = form.getForm().findField(form._idField);
  124. form.setLoading(true);
  125. saas.util.BaseUtil.request({
  126. url: form._turnOsMakeInBackUrl + '/' + id.value,
  127. method: 'POST',
  128. })
  129. .then(function (localJson) {
  130. form.setLoading(false);
  131. if (localJson.success) {
  132. var intValue = localJson.data.id,
  133. codeValue = localJson.data.code,
  134. name ='外协验退';
  135. saas.util.BaseUtil.openTab('osmake-osmakecheckreturn-formpanel', name + "(" + codeValue + ")", codeValue + intValue, {
  136. initId: intValue
  137. });
  138. saas.util.BaseUtil.showSuccessToast('转单成功');
  139. saas.util.FormUtil.loadData(form);
  140. }
  141. })
  142. .catch(function (e) {
  143. form.setLoading(false);
  144. saas.util.BaseUtil.showErrorToast('转单失败: ' + e.message);
  145. });
  146. },
  147. });