FormPanelController.js 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. Ext.define('make.view.osmake.reconciliation.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.osmake-reconciliation-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. 'multidbfindtrigger[name = ad_inoutno]': {
  8. beforerender: function (f) {
  9. Ext.apply(f, {
  10. defaultCondition: "pi_statuscode = 'AUDITED' and pi_class in ('PURCIN','OSMAKEIN','OSMAKEINBACK','PURCOUT') and IFNULL(Apcheckstatus,' ') != '已转对账' and IFNULL(Apcheckstatus,' ') != '已对账' and pd_status = 99",
  11. defaultQueryField: 'pi_inoutno',
  12. dbfinds: [{
  13. from: 'pi_inoutno', to: 'ad_inoutno'
  14. }, {
  15. from: 'pd_id', to: 'ad_pdid'
  16. }, {
  17. from: 'pd_ordercode', to: 'ad_pucode'
  18. }, {
  19. from: 'pd_pdno', to: 'ad_pdno'
  20. }, {
  21. from: 'pr_detail', to: 'pr_detail'
  22. }, {
  23. from: 'pr_orispeccode', to: 'pr_orispeccode'
  24. }, {
  25. from: 'pd_qty', to: 'ad_b2bqty'
  26. }, {
  27. from: 'pd_orderprice', to: 'ad_price'
  28. }, {
  29. from: 'pd_ordertotal', to: 'ad_ordertotal'
  30. }, {
  31. from: 'pd_prodcode', to: 'ad_prodcode'
  32. }, {
  33. from: 'pr_brand', to: 'pr_brand'
  34. }, {
  35. from: 'pr_spec', to: 'pr_spec'
  36. }, {
  37. from: 'pd_remark', to: 'ard_remark'
  38. }],
  39. });
  40. },
  41. beforetriggerclick: function (f) {
  42. var view = this.view,
  43. vendnameValue = view.ownerCt.down('[name="ac_vendname"]').value,
  44. veidValue = view.ownerCt.down('[name="ac_vendid"]').value,
  45. defaultCondition = "pi_statuscode = 'AUDITED' and pi_class in ('PURCIN','PURCOUT','OSMAKEIN','OSMAKEINBACK') and IFNULL(Apcheckstatus,' ') != '已转对账' and IFNULL(Apcheckstatus,' ') != '已对账' and pd_status = 99",
  46. ar_cuidValue = view.ownerCt.down('[name="ac_vendid"]').value;
  47. f.defaultCondition = defaultCondition;
  48. if (vendnameValue) {
  49. if (veidValue != '' && veidValue > 0) {
  50. defaultCondition = "pi_statuscode = 'AUDITED' and pi_class in ('OSMAKEIN','OSMAKEINBACK') and IFNULL(Apcheckstatus,' ') != '已转对账' and IFNULL(Apcheckstatus,' ') != '已对账' and pd_status = 99 AND pi_vendid = " + veidValue;
  51. } else if (ar_cuidValue == '' || ar_cuidValue == 0) {
  52. defaultCondition = "pi_statuscode = 'AUDITED' and pi_class in ('OSMAKEIN','OSMAKEINBACK') and IFNULL(Apcheckstatus,' ') != '已转对账' and IFNULL(Apcheckstatus,' ') != '已对账' and pd_status = 99";
  53. }
  54. f.defaultCondition = defaultCondition ;
  55. }
  56. }
  57. }
  58. });
  59. },
  60. agree:function(){
  61. var me = this;
  62. var url = '/api/money/apcheck/agree/';
  63. me.sendUrl(url)
  64. },
  65. disagree:function(){
  66. var me = this;
  67. var url = '/api/money/apcheck/reject/';
  68. me.sendUrl(url)
  69. },
  70. sendUrl:function(url){
  71. var me = this;
  72. var view = me.getView();
  73. var id = me.getViewModel().getData().id;
  74. view.setLoading(true);
  75. saas.util.BaseUtil.request({
  76. url: url + id,
  77. params: '',
  78. method: 'POST',
  79. })
  80. .then(function() {
  81. view.setLoading(false);
  82. //解析参数
  83. saas.util.BaseUtil.showSuccessToast('操作成功');
  84. me.refresh()
  85. })
  86. .catch(function(e) {
  87. //失败
  88. saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
  89. });
  90. }
  91. });