FormPanel.js 19 KB

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