FormPanel.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. Ext.define('saas.view.purchase.purchaseOut.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'purchase-purchaseout-formpanel',
  4. controller: 'purchase-purchaseout-formpanel',
  5. viewModel: 'purchase-purchaseout-formpanel',
  6. viewName: 'purchase-purchaseout-formpanel',
  7. caller: 'PurchaseOut',
  8. //字段属性
  9. _title: '采购验退单',
  10. _idField: 'id',
  11. _codeField: 'pi_inoutno',
  12. _statusField: 'pi_status',
  13. _statusCodeField: 'pi_statuscode',
  14. _auditmanField: 'pi_auditman',
  15. _auditdateField: 'pi_auditdate',
  16. _relationColumn: 'pd_piid',
  17. _readUrl: '/api/purchase/prodinout/read',
  18. _saveUrl: '/api/purchase/prodinout/save',
  19. _auditUrl: '/api/purchase/prodinout/audit',
  20. _unAuditUrl: '/api/purchase/prodinout/unAudit',
  21. _deleteUrl: '/api/purchase/prodinout/delete',
  22. initId: 0,
  23. toolBtns: [],
  24. initComponent: function () {
  25. Ext.apply(this, {
  26. defaultItems: [{
  27. xtype: 'hidden',
  28. name: 'id',
  29. fieldLabel: 'id',
  30. allowBlank: true,
  31. columnWidth: 0
  32. }, {
  33. xtype: 'hidden',
  34. name: 'pi_ioid',
  35. fieldLabel: 'pi_ioid'
  36. }, {
  37. xtype: "hidden",
  38. name: "pi_class",
  39. fieldLabel: "单据类型",
  40. readOnly: true,
  41. allowBlank: true,
  42. columnWidth: 0.25
  43. }, {
  44. xtype: "hidden",
  45. name: "pi_vendid",
  46. fieldLabel: "供应商ID",
  47. allowBlank: true,
  48. hidden: true,
  49. columnWidth: 0.0
  50. }, {
  51. xtype: 'hidden',
  52. name: 'pi_vendcode',
  53. fieldLabel: '供应商编号'
  54. }, {
  55. xtype: 'vendorDbfindTrigger',
  56. name: 'pi_vendname',
  57. fieldLabel: '供应商名称',
  58. allowBlank: false,
  59. columnWidth: 0.5
  60. }, {
  61. xtype: "datefield",
  62. name: "pi_date",
  63. fieldLabel: "单据日期",
  64. allowBlank: false,
  65. columnWidth: 0.25,
  66. defaultValue: new Date()
  67. }, {
  68. xtype: 'condbfindtrigger',
  69. fieldLabel: '币别汇率',
  70. allowBlank: false,
  71. dbType: 'currencyDbfindTrigger',
  72. dbfinds: [{
  73. from: 'cr_name', to: 'pi_currency'
  74. }, {
  75. from: 'cr_rate', to: 'pi_rate'
  76. }],
  77. // defaultValue: {
  78. // pi_currency: this.getViewModel().get('defaultCurrency'),
  79. // pi_rate: 1
  80. // },
  81. supFieldConfig: {
  82. xtype: 'numberfield',
  83. readOnly: false,
  84. defaultReadOnly: false,
  85. defaultValue: 1,
  86. decimalPrecision: 6,
  87. vtype: 'positiveNumber',
  88. listeners: {
  89. change: function(f, v) {
  90. var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
  91. f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
  92. }
  93. }
  94. }
  95. }, {
  96. xtype: "hidden",
  97. name: "pi_puid",
  98. fieldLabel: "采购单id",
  99. allowBlank: true,
  100. columnWidth: 0.25
  101. }, {
  102. xtype: "hidden",
  103. name: "pi_pucode",
  104. fieldLabel: "采购单号",
  105. allowBlank: true,
  106. columnWidth: 0.25
  107. }, {
  108. name: "detailGridField",
  109. xtype: "detailGridField",
  110. storeModel: 'saas.model.purchase.ProdOutDetail',
  111. deleteDetailUrl: '/api/purchase/prodinout/deleteDetail',
  112. detnoColumn: 'pd_pdno',
  113. columns: [{
  114. text: "id",
  115. dataIndex: "id",
  116. xtype: "numbercolumn",
  117. hidden: true
  118. }, {
  119. text: "物料id",
  120. dataIndex: "pd_prodid",
  121. xtype: "numbercolumn",
  122. hidden: true
  123. }, {
  124. text: "物料编号",
  125. width: 150.0,
  126. dataIndex: "pd_prodcode",
  127. xtype: "",
  128. items: null,
  129. allowBlank: false,
  130. editor: {
  131. displayField: "display",
  132. editable: true,
  133. format: "",
  134. hideTrigger: false,
  135. maxLength: 100.0,
  136. minValue: null,
  137. positiveNum: false,
  138. queryMode: "local",
  139. store: null,
  140. valueField: "value",
  141. xtype: "productMultiDbfindTrigger"
  142. }
  143. }, {
  144. text: 'model映射需要',
  145. dataIndex: 'productDTO',
  146. hidden: true,
  147. }, {
  148. text: "品牌",
  149. width: 100.0,
  150. dataIndex: "pr_brand",
  151. ignore: true,
  152. renderer: function (v, m, r) {
  153. if (!v) {
  154. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  155. }
  156. return v;
  157. }
  158. }, {
  159. text: "物料名称",
  160. width: 150.0,
  161. dataIndex: "pr_detail",
  162. ignore: true,
  163. renderer: function (v, m, r) {
  164. if (!v) {
  165. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  166. }
  167. return v;
  168. }
  169. }, {
  170. text: "型号",
  171. width: 200.0,
  172. dataIndex: "pr_orispeccode",
  173. ignore: true,
  174. renderer: function (v, m, r) {
  175. if (!v) {
  176. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  177. }
  178. return v;
  179. }
  180. }, {
  181. text: "规格",
  182. width: 200,
  183. dataIndex: "pr_spec",
  184. ignore: true,
  185. renderer: function (v, m, r) {
  186. if (!v) {
  187. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  188. }
  189. return v;
  190. }
  191. }, {
  192. text: "仓库id",
  193. dataIndex: "pd_whid",
  194. xtype: "numbercolumn",
  195. hidden: true
  196. }, {
  197. text: "仓库编号",
  198. dataIndex: "pd_whcode",
  199. hidden: true
  200. }, {
  201. text: "仓库",
  202. dataIndex: "pd_whname",
  203. width: 110.0,
  204. allowBlank: false,
  205. editor: {
  206. displayField: "display",
  207. editable: true,
  208. format: "",
  209. hideTrigger: false,
  210. maxLength: 100.0,
  211. minValue: null,
  212. positiveNum: false,
  213. queryMode: "local",
  214. store: null,
  215. valueField: "value",
  216. xtype: "warehouseDbfindTrigger"
  217. }
  218. }, {
  219. text: "数量",
  220. dataIndex: "pd_outqty",
  221. width: 110.0,
  222. xtype: 'numbercolumn',
  223. allowBlank: false,
  224. editor: {
  225. xtype: "numberfield",
  226. decimalPrecision: 3,
  227. minValue: 0
  228. },
  229. renderer: function(v, m, r) {
  230. return saas.util.BaseUtil.numberFormat(v, 3, false);
  231. },
  232. summaryType: 'sum',
  233. summaryRenderer: function(v, d, f, m) {
  234. return saas.util.BaseUtil.numberFormat(v, 3, false);
  235. }
  236. }, {
  237. text: "单位",
  238. width: 65.0,
  239. dataIndex: "pr_unit",
  240. ignore: true,
  241. renderer: function (v, m, r) {
  242. if (!v) {
  243. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  244. }
  245. return v;
  246. }
  247. }, {
  248. text: "单价(元)",
  249. xtype: 'numbercolumn',
  250. dataIndex: "pd_netprice",
  251. width: 120,
  252. editor: {
  253. xtype: "numberfield",
  254. decimalPrecision: 4,
  255. minValue: 0
  256. },
  257. renderer: function(v, m, r) {
  258. return saas.util.BaseUtil.numberFormat(v, 4, true);
  259. },
  260. }, {
  261. text: "含税单价(元)",
  262. xtype: 'numbercolumn',
  263. dataIndex: "pd_orderprice",
  264. editor: {
  265. xtype: "numberfield",
  266. decimalPrecision: 4,
  267. minValue: 0
  268. },
  269. width: 120,
  270. renderer: function(v, m, r) {
  271. return saas.util.BaseUtil.numberFormat(v, 4, true);
  272. },
  273. listeners: {
  274. edit: function (value, grid) {
  275. var r = grid.getSelection()[0],
  276. pd_taxrate = r.get('pd_taxrate');
  277. var v = value / (1 + pd_taxrate / 100);
  278. r.set('pd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
  279. }
  280. }
  281. }, {
  282. text: "金额(元)",
  283. xtype: 'numbercolumn',
  284. dataIndex: "pd_nettotal",
  285. width: 120,
  286. renderer: function(v, m, r) {
  287. return saas.util.BaseUtil.numberFormat(v, 2, true);
  288. },
  289. summaryType: 'sum',
  290. summaryRenderer: function(v, d, f, m) {
  291. return saas.util.BaseUtil.numberFormat(v, 2, true);
  292. }
  293. }, {
  294. text: "税率(%)",
  295. xtype: 'numbercolumn',
  296. dataIndex: "pd_taxrate",
  297. width: 80,
  298. editor: {
  299. xtype: "numberfield",
  300. decimalPrecision: 0,
  301. minValue: 0,
  302. maxValue: 100
  303. },
  304. renderer: function(v, m, r) {
  305. return saas.util.BaseUtil.numberFormat(v, 2, false);
  306. },
  307. }, {
  308. text: "税额(元)",
  309. xtype: 'numbercolumn',
  310. dataIndex: "pd_taxamount",
  311. width: 120,
  312. renderer: function(v, m, r) {
  313. return saas.util.BaseUtil.numberFormat(v, 2, true);
  314. },
  315. summaryType: 'sum',
  316. summaryRenderer: function(v, d, f, m) {
  317. return saas.util.BaseUtil.numberFormat(v, 2, true);
  318. }
  319. }, {
  320. text: "价税合计(元)",
  321. xtype: 'numbercolumn',
  322. dataIndex: "pd_ordertotal",
  323. width: 120,
  324. renderer: function(v, m, r) {
  325. return saas.util.BaseUtil.numberFormat(v, 2, true);
  326. },
  327. summaryType: 'sum',
  328. summaryRenderer: function(v, d, f, m) {
  329. return saas.util.BaseUtil.numberFormat(v, 2, true);
  330. }
  331. }, {
  332. text: "验收明细id",
  333. dataIndex: "pd_ioid",
  334. hidden: true
  335. }, {
  336. text: "关联验收单号",
  337. dataIndex: "iocode",
  338. width: 150.0,
  339. ignore: true
  340. }, {
  341. text: "备注",
  342. dataIndex: "pd_remark",
  343. width: 250,
  344. items: null,
  345. editor: {
  346. xtype: "textfield"
  347. },
  348. }, {
  349. dataIndex: "pd_text1",
  350. text: "自定义字段1",
  351. width: 100,
  352. hidden: true,
  353. initHidden: false,
  354. editor: {
  355. xtype: "textfield"
  356. },
  357. }, {
  358. dataIndex: "pd_text2",
  359. text: "自定义字段2",
  360. width: 100,
  361. hidden: true,
  362. initHidden: false,
  363. editor: {
  364. xtype: "textfield"
  365. },
  366. }, {
  367. dataIndex: "pd_text3",
  368. text: "自定义字段3",
  369. width: 100,
  370. hidden: true,
  371. initHidden: false,
  372. editor: {
  373. xtype: "textfield"
  374. },
  375. }, {
  376. dataIndex: "pd_text4",
  377. text: "自定义字段4",
  378. width: 100,
  379. hidden: true,
  380. initHidden: false,
  381. editor: {
  382. xtype: "textfield"
  383. },
  384. }, {
  385. dataIndex: "pd_text5",
  386. text: "自定义字段5",
  387. width: 100,
  388. hidden: true,
  389. initHidden: false,
  390. editor: {
  391. xtype: "textfield"
  392. },
  393. }]
  394. }, {
  395. xtype: "textfield",
  396. name: "pi_remark",
  397. fieldLabel: "备注",
  398. columnWidth: 1
  399. }, {
  400. xtype: "numberfield",
  401. name: "pi_nettotal",
  402. fieldLabel: "金额(元)",
  403. allowBlank: true,
  404. readOnly: true,
  405. thousandSeparator: ',',
  406. columnWidth: 0.25
  407. }, {
  408. xtype: "numberfield",
  409. name: "pi_total",
  410. fieldLabel: "价税合计(元)",
  411. allowBlank: true,
  412. readOnly: true,
  413. thousandSeparator: ',',
  414. columnWidth: 0.25
  415. }, {
  416. xtype: "hidden",
  417. name: "pi_buyercode",
  418. fieldLabel: "采购员编号"
  419. }, {
  420. xtype: "employeeDbfindTrigger",
  421. name: "pi_buyername",
  422. fieldLabel: "采购员",
  423. columnWidth: 0.25
  424. }, {
  425. xtype: "hidden",
  426. name: "pi_buyerid",
  427. fieldLabel: "采购员ID"
  428. }, {
  429. xtype: "hidden",
  430. name: "creatorId",
  431. fieldLabel: "录入人ID",
  432. readOnly: true
  433. }, {
  434. xtype: "textfield",
  435. name: "creatorName",
  436. fieldLabel: "录入人",
  437. readOnly: true
  438. }, {
  439. xtype: "datefield",
  440. name: "createTime",
  441. fieldLabel: "录入日期",
  442. readOnly: true,
  443. defaultValue: new Date()
  444. }, {
  445. xtype: "hidden",
  446. name: "updaterId",
  447. fieldLabel: "更新人ID",
  448. readOnly: true
  449. }, {
  450. xtype: "hidden",
  451. name: "updaterName",
  452. fieldLabel: "更新人",
  453. readOnly: true
  454. }, {
  455. xtype: "hidden",
  456. name: "updateTime",
  457. fieldLabel: "更新日期",
  458. readOnly: true,
  459. defaultValue: new Date()
  460. }, {
  461. xtype: "textfield",
  462. name: "pi_auditman",
  463. fieldLabel: "审核人",
  464. readOnly: true
  465. }, {
  466. xtype: "datefield",
  467. name: "pi_auditdate",
  468. fieldLabel: "审核日期",
  469. readOnly: true
  470. }, {
  471. xtype: "textfield",
  472. name: "pi_text1",
  473. fieldLabel: "自定义字段1",
  474. hidden: true,
  475. initHidden: false
  476. }, {
  477. xtype: "textfield",
  478. name: "pi_text2",
  479. fieldLabel: "自定义字段2",
  480. hidden: true,
  481. initHidden: false
  482. }, {
  483. xtype: "textfield",
  484. name: "pi_text3",
  485. fieldLabel: "自定义字段3",
  486. hidden: true,
  487. initHidden: false
  488. }, {
  489. xtype: "textfield",
  490. name: "pi_text4",
  491. fieldLabel: "自定义字段4",
  492. hidden: true,
  493. initHidden: false
  494. }, {
  495. xtype: "textfield",
  496. name: "pi_text5",
  497. fieldLabel: "自定义字段5",
  498. hidden: true,
  499. initHidden: false
  500. }]
  501. });
  502. this.callParent(arguments);
  503. },
  504. });