FormPanel.js 19 KB

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