FormPanelController.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. Ext.define('saas.view.money.othspendings.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.money-othspendings-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //放大镜赋值关系 以及 tpl模板
  8. 'vendorDbfindTrigger[name=os_vendname]': {
  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) {
  49. return Ext.util.Format.number(v, '0');
  50. }
  51. },{
  52. text: "应收款余额",
  53. dataIndex: "cu_leftamount",
  54. width:110,
  55. xtype: 'numbercolumn',
  56. renderer : function(v) {
  57. if(!v) {
  58. return 0;
  59. }
  60. var arr = (v + '.').split('.');
  61. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  62. var format = '0.' + xr.join();
  63. return Ext.util.Format.number(v, format);
  64. }
  65. }, {
  66. text: "结算天数",
  67. dataIndex: "cu_promisedays",
  68. width:110,
  69. xtype: 'numbercolumn',
  70. renderer: function (v) {
  71. return Ext.util.Format.number(v, '0');
  72. }
  73. }, {
  74. text: "额度",
  75. dataIndex: "cu_credit",
  76. width:110,
  77. xtype: 'numbercolumn',
  78. }, {
  79. text: "客户地址",
  80. dataIndex: "ca_address",
  81. width: 250
  82. }],
  83. dbfinds: [{
  84. from: 'id',
  85. to: 'os_vendid',
  86. ignore:true
  87. }, {
  88. from: 've_code',
  89. to: 'os_vendcode'
  90. }, {
  91. from: 've_name',
  92. to: 'os_vendname'
  93. }],
  94. });
  95. }
  96. },
  97. //放大镜赋值关系 以及 tpl模板
  98. 'bandinfoDbfindTrigger[name=os_bankname]': {
  99. beforerender: function (f) {
  100. Ext.apply(f, {
  101. dbfinds: [{
  102. from: 'bk_bankcode',
  103. to: 'os_bankcode'
  104. }, {
  105. from: 'bk_bankname',
  106. to: 'os_bankname'
  107. }, {
  108. from: 'id',
  109. to: 'os_bankid',ignore:true
  110. }],
  111. });
  112. }
  113. }
  114. });
  115. },
  116. onSave: function() {
  117. var me = this,
  118. form = me.getView(),
  119. viewModel = me.getViewModel(),
  120. store1 = viewModel.get('detail0').detailStore;
  121. var valid = form.isValid();
  122. if(!valid) {
  123. saas.util.BaseUtil.showErrorToast(form.invalidText);
  124. return false;
  125. }
  126. var sum_nowbalance = store1.sum('osd_nowbalance'); // 金额合计
  127. viewModel.set('os_amount',sum_nowbalance);
  128. me.save();
  129. },
  130. myInitCopyData: function(formData) {
  131. var main = formData.main;
  132. main.os_auditman = '';
  133. main.os_auditdate = null;
  134. return formData;
  135. }
  136. });