FormPanelController.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. });
  105. }
  106. }
  107. });
  108. },
  109. onSave: function() {
  110. var me = this,
  111. form = me.getView(),
  112. viewModel = me.getViewModel(),
  113. store1 = viewModel.get('detail0').detailStore;
  114. var valid = form.isValid();
  115. if(!valid) {
  116. saas.util.BaseUtil.showErrorToast(form.invalidText);
  117. return false;
  118. }
  119. var sum_nowbalance = store1.sum('ord_nowbalance'); // 金额合计
  120. viewModel.set('or_amount',sum_nowbalance);
  121. me.save();
  122. },
  123. myInitCopyData: function(formData) {
  124. var main = formData.main;
  125. main.or_auditman = '';
  126. main.or_auditdate = null;
  127. return formData;
  128. }
  129. });