PurchaseDetail.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. supFieldConfig: {
  48. xtype: 'numberfield',
  49. readOnly: false,
  50. defaultReadOnly: false,
  51. defaultValue: 1,
  52. decimalPrecision: 6,
  53. vtype: 'positiveNumber'
  54. }
  55. }, {
  56. name: "sa_status",
  57. xtype: "textfield",
  58. fieldLabel: "单据状态",
  59. readOnly: true
  60. }, {
  61. xtype: 'textfield',
  62. name: 'sa_custname',
  63. fieldLabel: '客户名称',
  64. columnWidth: 0.5,
  65. readOnly: true
  66. }, {
  67. xtype: 'textfield',
  68. name: 'sa_toplace',
  69. fieldLabel: '交货地址',
  70. columnWidth: 0.5,
  71. readOnly: true
  72. }, {
  73. name: "detailGridField",
  74. xtype: "detailGridField",
  75. detnoColumn: 'sd_detno',
  76. storeModel: 'saas.model.sale.b2b.PurchaseDetail',
  77. deleteDetailUrl: '/api/sale/sale/deleteDetail',
  78. allowEmpty: true,
  79. columns: [{
  80. text: 'id',
  81. dataIndex: 'id',
  82. hidden: true,
  83. }, {
  84. text: '物料id',
  85. dataIndex: 'sd_prodid',
  86. hidden: true
  87. }, {
  88. text: "物料编号",
  89. width: 150.0,
  90. dataIndex: "sd_prodcode",
  91. allowBlank: false,
  92. editor: {
  93. displayField: "display",
  94. editable: true,
  95. format: "",
  96. hideTrigger: false,
  97. maxLength: 100.0,
  98. minValue: null,
  99. positiveNum: false,
  100. queryMode: "local",
  101. store: null,
  102. valueField: "value",
  103. xtype: "productDbfindTrigger",
  104. dbfinds: [{
  105. from: 'pr_code', to: 'sd_prodcode'
  106. }, {
  107. from: 'pr_detail', to: 'sd_proddetail'
  108. }, {
  109. from: 'pr_spec', to: 'sd_prodspec'
  110. },{
  111. from: 'pr_brand', to: 'sd_prodbrand'
  112. },{
  113. from: 'pr_orispeccode', to: 'sd_orispeccode'
  114. },{
  115. from: 'id', to: 'sd_prodid'
  116. }]
  117. }
  118. }, {
  119. text: "物料名称",
  120. width: 150.0,
  121. dataIndex: "sd_proddetail"
  122. }, {
  123. text: "品牌",
  124. width: 100.0,
  125. dataIndex: "sd_prodbrand"
  126. }, {
  127. text: "型号",
  128. width: 200.0,
  129. dataIndex: "sd_orispeccode",
  130. ignore: true
  131. }, {
  132. text: "规格",
  133. width: 200,
  134. dataIndex: "sd_prodspec"
  135. }, {
  136. text: '客户料号',
  137. width: 120,
  138. dataIndex: 'sd_custprodcode',
  139. }, {
  140. text: '客户型号',
  141. width: 120,
  142. dataIndex: 'sd_custorispeccode',
  143. }, {
  144. text: '客户规格',
  145. dataIndex: 'sd_custprodspec',
  146. width: 120
  147. }, {
  148. text: "数量",
  149. dataIndex: "sd_qty",
  150. width: 110.0,
  151. xtype: 'numbercolumn',
  152. allowBlank: false,
  153. renderer: function(v, m, r) {
  154. return saas.util.BaseUtil.numberFormat(v, 3, false);
  155. },
  156. summaryType: 'sum',
  157. summaryRenderer: function(v, d, f, m) {
  158. return saas.util.BaseUtil.numberFormat(v, 3, false);
  159. }
  160. }, {
  161. text: "单位",
  162. width: 65.0,
  163. dataIndex: "sd_produnit",
  164. ignore: true,
  165. renderer: function (v, m, r) {
  166. if (!v) {
  167. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  168. }
  169. return v;
  170. }
  171. }, {
  172. text: "含税单价(元)",
  173. xtype: 'numbercolumn',
  174. dataIndex: "sd_price",
  175. width: 120,
  176. renderer: function(v, m, r) {
  177. return saas.util.BaseUtil.numberFormat(v, 4, true);
  178. },
  179. listeners: {
  180. edit: function (value, grid) {
  181. var r = grid.getSelection()[0],
  182. sd_taxrate = r.get('sd_taxrate');
  183. var v = value / (1 + sd_taxrate / 100);
  184. r.set('sd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
  185. }
  186. }
  187. }, {
  188. text: "税率(%)",
  189. xtype: 'numbercolumn',
  190. dataIndex: "sd_taxrate",
  191. width: 80,
  192. renderer: function(v, m, r) {
  193. return saas.util.BaseUtil.numberFormat(v, 2, false);
  194. }
  195. }, {
  196. text: "价税合计(元)",
  197. xtype: 'numbercolumn',
  198. dataIndex: "sd_total",
  199. width: 120,
  200. renderer: function(v, m, r) {
  201. return saas.util.BaseUtil.numberFormat(v, 2, true);
  202. },
  203. summaryType: 'sum',
  204. summaryRenderer: function(v, d, f, m) {
  205. return saas.util.BaseUtil.numberFormat(v, 2, true);
  206. }
  207. }, {
  208. text: "交货日期",
  209. dataIndex: "sd_delivery",
  210. width: 110.0,
  211. xtype: 'datecolumn',
  212. }, {
  213. text: "备注",
  214. dataIndex: "sd_remark",
  215. width: 250,
  216. items: null,
  217. }]
  218. }],
  219. toolBtns: [{
  220. xtype: 'button',
  221. text: '转销售',
  222. handler: 'turnSale',
  223. }, {
  224. xtype: 'button',
  225. text: '更新',
  226. handler: 'onSave',
  227. }]
  228. });
  229. this.callParent();
  230. },
  231. });