FormPanelController.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Ext.define('saas.view.money.othreceipts.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.money-othreceipts-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //放大镜赋值关系 以及 tpl模板
  8. 'customerDbfindTrigger[name=or_custname]': {
  9. beforerender: function (f) {
  10. Ext.apply(f, {
  11. dbColumns: [{
  12. conditionCode: 'id',
  13. text: "客户ID",
  14. dataIndex: "id",
  15. hidden:true,
  16. xtype: "",
  17. }, {
  18. conditionCode: 'cu_code',
  19. text: "客户编号",
  20. dataIndex: "cu_code",
  21. width: 150,
  22. xtype: "",
  23. }, {
  24. conditionCode: 'cu_name',
  25. text: "客户名称",
  26. dataIndex: "cu_name",
  27. width: 200,
  28. xtype: "",
  29. }, {
  30. conditionCode: 'cu_type',
  31. text: "客户类型",
  32. dataIndex: "cu_type",
  33. width: 110,
  34. xtype: "",
  35. }, {
  36. text: "业务员编号",
  37. dataIndex: "cu_sellercode",
  38. width:110
  39. }, {
  40. text: "业务员",
  41. dataIndex: "cu_sellername",
  42. width:110
  43. }, {
  44. text: "税率(%)",
  45. dataIndex: "cu_taxrate",
  46. xtype: 'numbercolumn',
  47. width:80,
  48. renderer: function(v, m, r) {
  49. return saas.util.BaseUtil.numberFormat(v, 2, false);
  50. }
  51. },{
  52. text: "应收款余额",
  53. dataIndex: "cu_leftamount",
  54. width:110,
  55. xtype: 'numbercolumn',
  56. renderer : function(v, m, r) {
  57. return saas.util.BaseUtil.numberFormat(v, 2, true);
  58. }
  59. }, {
  60. text: "结算天数",
  61. dataIndex: "cu_promisedays",
  62. width:110,
  63. xtype: 'numbercolumn',
  64. renderer: function(v, m, r) {
  65. return saas.util.BaseUtil.numberFormat(v, 0, false);
  66. }
  67. }, {
  68. text: "额度",
  69. dataIndex: "cu_credit",
  70. width:110,
  71. xtype: 'numbercolumn',
  72. }, {
  73. text: "客户地址",
  74. dataIndex: "ca_address",
  75. width: 250
  76. }],
  77. dbfinds: [{
  78. from: 'id',
  79. to: 'or_custid',ignore:true
  80. }, {
  81. from: 'cu_code',
  82. to: 'or_custcode'
  83. }, {
  84. from: 'cu_name',
  85. to: 'or_custname'
  86. }],
  87. });
  88. }
  89. },
  90. //放大镜赋值关系 以及 tpl模板
  91. 'bandinfoDbfindTrigger[name=or_bankname]': {
  92. beforerender: function (f) {
  93. Ext.apply(f, {
  94. dbfinds: [{
  95. from: 'bk_bankcode',
  96. to: 'or_bankcode'
  97. }, {
  98. from: 'bk_bankname',
  99. to: 'or_bankname'
  100. }, {
  101. from: 'id',
  102. to: 'or_bankid',ignore:true
  103. }, {
  104. from: 'bk_currency',
  105. to: 'or_currency'
  106. }, {
  107. from: 'cr_rate',
  108. to: 'or_rate'
  109. }],
  110. });
  111. }
  112. },
  113. // 'currencyDbfindTrigger[name=or_currency]':{
  114. // beforerender:function(f){
  115. // Ext.apply(f,{
  116. // dbfinds:[{
  117. // from:'cr_name',to:'or_currency'
  118. // },{
  119. // from:'cr_rate',to:'or_rate'
  120. // }],
  121. // }) ;
  122. // }
  123. // }
  124. });
  125. },
  126. onSave: function() {
  127. var me = this,
  128. form = me.getView(),
  129. viewModel = me.getViewModel(),
  130. store1 = viewModel.get('detail0').detailStore;
  131. var valid = form.isValid();
  132. if(!valid) {
  133. saas.util.BaseUtil.showErrorToast(form.invalidText);
  134. return false;
  135. }
  136. var sum_nowbalance = store1.sum('ord_nowbalance'); // 金额合计
  137. viewModel.set('or_amount',sum_nowbalance);
  138. me.save();
  139. },
  140. myInitCopyData: function(formData) {
  141. var main = formData.main;
  142. main.or_auditman = '';
  143. main.or_auditdate = null;
  144. return formData;
  145. }
  146. });