PurchaseDetail.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. Ext.define('saas.view.sale.b2b.PurchaseDetail', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'sale-b2b-purchasedetail',
  4. controller: 'sale-b2b-purchasedetail',
  5. viewModel: 'sale-b2b-purchasedetail',
  6. viewName: 'sale-b2b-purchasedetail',
  7. //字段属性
  8. _title: '客户采购单',
  9. _idField: 'id',
  10. _codeField: 'sa_code',
  11. _statusField: null,
  12. _statusCodeField: null,
  13. _auditmanField: 'sa_auditman',
  14. _auditdateField: 'sa_auditdate',
  15. _relationColumn: 'sd_puid',
  16. // _readUrl: 'http://10.1.80.35:8560/api/sale/saledown/read',
  17. _readUrl: '/api/sale/saledown/read',
  18. // _saveUrl: 'http://10.1.80.35:8560/api/sale/saledown/update',
  19. _saveUrl: '/api/sale/saledown/update',
  20. // _toSaleUrl: 'http://10.1.80.35:8560/api/sale/saledown/toSale',
  21. _toSaleUrl: '/api/sale/saledown/toSale',
  22. initId: 0,
  23. codeInHeader: false,
  24. initComponent: function () {
  25. Ext.apply(this, {
  26. defaultItems: [{
  27. xtype: 'textfield',
  28. name: 'sa_pocode',
  29. fieldLabel: '客户PO',
  30. readOnly: true
  31. }, {
  32. xtype: "datefield",
  33. name: "createTime",
  34. fieldLabel: "单据日期",
  35. readOnly: true
  36. }, {
  37. xtype: 'condbfindtrigger',
  38. fieldLabel: '币别汇率',
  39. allowBlank: false,
  40. readOnly: true,
  41. dbType: 'currencyDbfindTrigger',
  42. dbfinds: [{
  43. from: 'cr_name', to: 'sa_currency'
  44. }, {
  45. from: 'cr_rate', to: 'sa_rate'
  46. }],
  47. mainFieldConfig: {
  48. readOnly: true,
  49. defaultReadOnly: true,
  50. },
  51. supFieldConfig: {
  52. xtype: 'numberfield',
  53. readOnly: true,
  54. defaultReadOnly: true,
  55. defaultValue: 1,
  56. decimalPrecision: 6,
  57. vtype: 'positiveNumber'
  58. }
  59. }, {
  60. name: "sa_turnstatus",
  61. xtype: "textfield",
  62. fieldLabel: "转单状态",
  63. readOnly: true
  64. }, {
  65. xtype: 'textfield',
  66. name: 'sa_custname',
  67. fieldLabel: '客户名称',
  68. columnWidth: 0.5,
  69. readOnly: true
  70. }, {
  71. xtype: 'textfield',
  72. name: 'sa_toplace',
  73. fieldLabel: '交货地址',
  74. columnWidth: 0.5,
  75. readOnly: true
  76. }, {
  77. name: "detailGridField",
  78. xtype: "detailGridField",
  79. detnoColumn: 'sd_detno',
  80. storeModel: 'saas.model.sale.b2b.PurchaseDetail',
  81. deleteDetailUrl: '/api/sale/sale/deleteDetail',
  82. allowEmpty: true,
  83. columns: [{
  84. text: 'id',
  85. dataIndex: 'id',
  86. hidden: true,
  87. }, {
  88. text: '物料id',
  89. dataIndex: 'sd_prodid',
  90. hidden: true
  91. }, {
  92. text: "物料编号",
  93. width: 150.0,
  94. dataIndex: "sd_prodcode",
  95. allowBlank: false,
  96. editor: {
  97. displayField: "display",
  98. editable: true,
  99. format: "",
  100. hideTrigger: false,
  101. maxLength: 100.0,
  102. minValue: null,
  103. positiveNum: false,
  104. queryMode: "local",
  105. store: null,
  106. valueField: "value",
  107. xtype: "productDbfindTrigger",
  108. dbfinds: [{
  109. from: 'pr_code', to: 'sd_prodcode'
  110. }, {
  111. from: 'pr_detail', to: 'sd_proddetail'
  112. }, {
  113. from: 'pr_spec', to: 'sd_prodspec'
  114. },{
  115. from: 'pr_brand', to: 'sd_prodbrand'
  116. },{
  117. from: 'pr_orispeccode', to: 'sd_orispeccode'
  118. },{
  119. from: 'id', to: 'sd_prodid'
  120. }]
  121. }
  122. }, {
  123. text: "物料名称",
  124. width: 150.0,
  125. dataIndex: "sd_proddetail"
  126. }, {
  127. text: "品牌",
  128. width: 100.0,
  129. dataIndex: "sd_prodbrand"
  130. }, {
  131. text: "型号",
  132. width: 200.0,
  133. dataIndex: "sd_orispeccode",
  134. ignore: true
  135. }, {
  136. text: "规格",
  137. width: 200,
  138. dataIndex: "sd_prodspec"
  139. }, {
  140. text: '客户料号',
  141. width: 120,
  142. dataIndex: 'sd_custprodcode',
  143. }, {
  144. text: '客户型号',
  145. width: 120,
  146. dataIndex: 'sd_custorispeccode',
  147. }, {
  148. text: '客户规格',
  149. dataIndex: 'sd_custprodspec',
  150. width: 120
  151. }, {
  152. text: "数量",
  153. dataIndex: "sd_qty",
  154. width: 110.0,
  155. xtype: 'numbercolumn',
  156. allowBlank: false,
  157. renderer: function(v, m, r) {
  158. return saas.util.BaseUtil.numberFormat(v, 3, false);
  159. },
  160. summaryType: 'sum',
  161. summaryRenderer: function(v, d, f, m) {
  162. return saas.util.BaseUtil.numberFormat(v, 3, false);
  163. }
  164. }, {
  165. text: "单位",
  166. width: 65.0,
  167. dataIndex: "sd_produnit",
  168. ignore: true,
  169. renderer: function (v, m, r) {
  170. if (!v) {
  171. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  172. }
  173. return v;
  174. }
  175. }, {
  176. text: "含税单价(元)",
  177. xtype: 'numbercolumn',
  178. dataIndex: "sd_price",
  179. width: 120,
  180. renderer: function(v, m, r) {
  181. return saas.util.BaseUtil.numberFormat(v, 4, true);
  182. },
  183. listeners: {
  184. edit: function (value, grid) {
  185. var r = grid.getSelection()[0],
  186. sd_taxrate = r.get('sd_taxrate');
  187. var v = value / (1 + sd_taxrate / 100);
  188. r.set('sd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
  189. }
  190. }
  191. }, {
  192. text: "税率(%)",
  193. xtype: 'numbercolumn',
  194. dataIndex: "sd_taxrate",
  195. width: 80,
  196. renderer: function(v, m, r) {
  197. return saas.util.BaseUtil.numberFormat(v, 2, false);
  198. }
  199. }, {
  200. text: "价税合计(元)",
  201. xtype: 'numbercolumn',
  202. dataIndex: "sd_total",
  203. width: 120,
  204. renderer: function(v, m, r) {
  205. return saas.util.BaseUtil.numberFormat(v, 2, true);
  206. },
  207. summaryType: 'sum',
  208. summaryRenderer: function(v, d, f, m) {
  209. return saas.util.BaseUtil.numberFormat(v, 2, true);
  210. }
  211. }, {
  212. text: "交货日期",
  213. dataIndex: "sd_delivery",
  214. width: 110.0,
  215. xtype: 'datecolumn',
  216. }, {
  217. text: "备注",
  218. dataIndex: "sd_remark",
  219. width: 250,
  220. items: null,
  221. }]
  222. }],
  223. toolBtns: [{
  224. xtype: 'button',
  225. text: '转销售',
  226. handler: 'turnSale',
  227. }, {
  228. xtype: 'button',
  229. text: '更新',
  230. handler: 'onSave',
  231. }]
  232. });
  233. this.callParent();
  234. },
  235. });