FormPanel.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  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: "pd_remark",
  353. width: 250,
  354. items: null,
  355. editor: {
  356. xtype: "textfield"
  357. },
  358. }, {
  359. dataIndex: "pd_text1",
  360. text: "自定义字段1",
  361. width: 100,
  362. hidden: true,
  363. initHidden: false,
  364. editor: {
  365. xtype: "textfield"
  366. },
  367. }, {
  368. dataIndex: "pd_text2",
  369. text: "自定义字段2",
  370. width: 100,
  371. hidden: true,
  372. initHidden: false,
  373. editor: {
  374. xtype: "textfield"
  375. },
  376. }, {
  377. dataIndex: "pd_text3",
  378. text: "自定义字段3",
  379. width: 100,
  380. hidden: true,
  381. initHidden: false,
  382. editor: {
  383. xtype: "textfield"
  384. },
  385. }, {
  386. dataIndex: "pd_text4",
  387. text: "自定义字段4",
  388. width: 100,
  389. hidden: true,
  390. initHidden: false,
  391. editor: {
  392. xtype: "textfield"
  393. },
  394. }, {
  395. dataIndex: "pd_text5",
  396. text: "自定义字段5",
  397. width: 100,
  398. hidden: true,
  399. initHidden: false,
  400. editor: {
  401. xtype: "textfield"
  402. },
  403. }]
  404. }, {
  405. xtype: "textfield",
  406. name: "pi_remark",
  407. fieldLabel: "备注",
  408. columnWidth: 1
  409. }, {
  410. xtype: "numberfield",
  411. name: "pi_nettotal",
  412. fieldLabel: "金额(元)",
  413. allowBlank: true,
  414. readOnly: true,
  415. thousandSeparator: ',',
  416. columnWidth: 0.25
  417. }, {
  418. xtype: "numberfield",
  419. name: "pi_total",
  420. fieldLabel: "价税合计(元)",
  421. allowBlank: true,
  422. readOnly: true,
  423. thousandSeparator: ',',
  424. columnWidth: 0.25
  425. }, {
  426. xtype: "hidden",
  427. name: "pi_buyercode",
  428. fieldLabel: "采购员编号"
  429. }, {
  430. xtype: "employeeDbfindTrigger",
  431. name: "pi_buyername",
  432. fieldLabel: "采购员",
  433. columnWidth: 0.25
  434. }, {
  435. xtype: "hidden",
  436. name: "pi_buyerid",
  437. fieldLabel: "采购员ID"
  438. }, {
  439. xtype: "hidden",
  440. name: "creatorId",
  441. fieldLabel: "录入人ID",
  442. readOnly: true
  443. }, {
  444. xtype: "textfield",
  445. name: "creatorName",
  446. fieldLabel: "录入人",
  447. readOnly: true
  448. }, {
  449. xtype: "datefield",
  450. name: "createTime",
  451. fieldLabel: "录入日期",
  452. readOnly: true,
  453. defaultValue: new Date()
  454. }, {
  455. xtype: "hidden",
  456. name: "updaterId",
  457. fieldLabel: "更新人ID",
  458. readOnly: true
  459. }, {
  460. xtype: "hidden",
  461. name: "updaterName",
  462. fieldLabel: "更新人",
  463. readOnly: true
  464. }, {
  465. xtype: "hidden",
  466. name: "updateTime",
  467. fieldLabel: "更新日期",
  468. readOnly: true,
  469. defaultValue: new Date()
  470. }, {
  471. xtype: "textfield",
  472. name: "pi_auditman",
  473. fieldLabel: "审核人",
  474. readOnly: true
  475. }, {
  476. xtype: "datefield",
  477. name: "pi_auditdate",
  478. fieldLabel: "审核日期",
  479. readOnly: true
  480. }, {
  481. xtype: "textfield",
  482. name: "pi_text1",
  483. fieldLabel: "自定义字段1",
  484. hidden: true,
  485. initHidden: false
  486. }, {
  487. xtype: "textfield",
  488. name: "pi_text2",
  489. fieldLabel: "自定义字段2",
  490. hidden: true,
  491. initHidden: false
  492. }, {
  493. xtype: "textfield",
  494. name: "pi_text3",
  495. fieldLabel: "自定义字段3",
  496. hidden: true,
  497. initHidden: false
  498. }, {
  499. xtype: "textfield",
  500. name: "pi_text4",
  501. fieldLabel: "自定义字段4",
  502. hidden: true,
  503. initHidden: false
  504. }, {
  505. xtype: "textfield",
  506. name: "pi_text5",
  507. fieldLabel: "自定义字段5",
  508. hidden: true,
  509. initHidden: false
  510. }]
  511. });
  512. this.callParent(arguments);
  513. },
  514. });