FormPanel.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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. defaultItems: [{
  25. xtype: 'hidden',
  26. name: 'id',
  27. fieldLabel: 'id',
  28. allowBlank: true,
  29. columnWidth: 0
  30. }, {
  31. xtype: 'hidden',
  32. name: 'pi_ioid',
  33. fieldLabel: 'pi_ioid'
  34. }, {
  35. xtype: "hidden",
  36. name: "pi_class",
  37. fieldLabel: "单据类型",
  38. readOnly: true,
  39. allowBlank: true,
  40. columnWidth: 0.25
  41. }, {
  42. xtype: "hidden",
  43. name: "pi_vendid",
  44. fieldLabel: "供应商ID",
  45. allowBlank: true,
  46. hidden: true,
  47. columnWidth: 0.0
  48. }, {
  49. xtype: 'hidden',
  50. name: 'pi_vendcode',
  51. fieldLabel: '供应商编号'
  52. }, {
  53. xtype: 'vendorDbfindTrigger',
  54. name: 'pi_vendname',
  55. fieldLabel: '供应商名称',
  56. allowBlank: false,
  57. }, {
  58. xtype: "datefield",
  59. name: "pi_date",
  60. fieldLabel: "单据日期",
  61. allowBlank: false,
  62. columnWidth: 0.25,
  63. defaultValue: new Date()
  64. }, {
  65. xtype: "textfield",
  66. name: "pi_total",
  67. fieldLabel: "总额",
  68. allowBlank: true,
  69. readOnly: true,
  70. columnWidth: 0.25
  71. }, {
  72. xtype: "hidden",
  73. name: "pi_puid",
  74. fieldLabel: "采购单id",
  75. allowBlank: true,
  76. columnWidth: 0.25
  77. }, {
  78. xtype: "hidden",
  79. name: "pi_pucode",
  80. fieldLabel: "采购单号",
  81. allowBlank: true,
  82. columnWidth: 0.25
  83. }, {
  84. name: "detailGridField",
  85. xtype: "detailGridField",
  86. storeModel: 'saas.model.purchase.ProdOutDetail',
  87. deleteDetailUrl: '/api/purchase/prodinout/deleteDetail',
  88. detnoColumn: 'pd_pdno',
  89. columns: [{
  90. text: "id",
  91. dataIndex: "id",
  92. xtype: "numbercolumn",
  93. hidden: true
  94. }, {
  95. text: "物料id",
  96. dataIndex: "pd_prodid",
  97. xtype: "numbercolumn",
  98. hidden: true
  99. }, {
  100. text: "物料编号",
  101. width: 150.0,
  102. dataIndex: "pd_prodcode",
  103. xtype: "",
  104. items: null,
  105. allowBlank: false,
  106. editor: {
  107. displayField: "display",
  108. editable: true,
  109. format: "",
  110. hideTrigger: false,
  111. maxLength: 100.0,
  112. minValue: null,
  113. positiveNum: false,
  114. queryMode: "local",
  115. store: null,
  116. valueField: "value",
  117. xtype: "productMultiDbfindTrigger"
  118. }
  119. }, {
  120. text: 'model映射需要',
  121. dataIndex: 'productDTO',
  122. hidden: true,
  123. }, {
  124. text: "品牌",
  125. width: 150.0,
  126. dataIndex: "pr_brand",
  127. ignore: true,
  128. renderer: function (v, m, r) {
  129. if (!v) {
  130. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  131. }
  132. return v;
  133. }
  134. }, {
  135. text: "名称",
  136. width: 200.0,
  137. dataIndex: "pr_detail",
  138. ignore: true,
  139. renderer: function (v, m, r) {
  140. if (!v) {
  141. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  142. }
  143. return v;
  144. }
  145. }, {
  146. text: "型号",
  147. width: 200.0,
  148. dataIndex: "pr_orispeccode",
  149. ignore: true,
  150. renderer: function (v, m, r) {
  151. if (!v) {
  152. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  153. }
  154. return v;
  155. }
  156. }, {
  157. text: "规格",
  158. width: 150,
  159. dataIndex: "pr_spec",
  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. dataIndex: "pd_outqty",
  170. width: 110.0,
  171. xtype: 'numbercolumn',
  172. allowBlank: false,
  173. editor: {
  174. xtype: "numberfield",
  175. decimalPrecision: 3,
  176. minValue: 0
  177. },
  178. renderer: function (v) {
  179. var arr = (v + '.').split('.');
  180. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  181. var format = '0.' + xr.join('');
  182. return Ext.util.Format.number(v, format);
  183. },
  184. summaryType: 'sum',
  185. summaryRenderer: function (v) {
  186. var arr = (v + '.').split('.');
  187. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  188. var format = '0.' + xr.join('');
  189. return Ext.util.Format.number(v, format);
  190. }
  191. }, {
  192. text: "单位",
  193. width: 80.0,
  194. dataIndex: "pr_unit",
  195. ignore: true,
  196. renderer: function (v, m, r) {
  197. if (!v) {
  198. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  199. }
  200. return v;
  201. }
  202. }, {
  203. text: "单价(元)",
  204. xtype: 'numbercolumn',
  205. dataIndex: "pd_netprice",
  206. width: 120,
  207. editor: {
  208. xtype: "numberfield",
  209. decimalPrecision: 4,
  210. minValue: 0
  211. },
  212. renderer: function (v) {
  213. var arr = (v + '.').split('.');
  214. var xr = (new Array(arr[1].length > 4 ? 4 : arr[1].length)).fill('0');
  215. var format = '0,000.' + xr.join('');
  216. return Ext.util.Format.number(v, format);
  217. },
  218. }, {
  219. text: "含税单价(元)",
  220. xtype: 'numbercolumn',
  221. dataIndex: "pd_orderprice",
  222. editor: {
  223. xtype: "numberfield",
  224. decimalPrecision: 4,
  225. minValue: 0
  226. },
  227. width: 120,
  228. renderer: function (v) {
  229. var arr = (v + '.').split('.');
  230. var xr = (new Array(arr[1].length > 4 ? 4 : arr[1].length)).fill('0');
  231. var format = '0,000.' + xr.join('');
  232. return Ext.util.Format.number(v, format);
  233. },
  234. listeners: {
  235. edit: function (value, grid) {
  236. var r = grid.getSelection()[0],
  237. pd_taxrate = r.get('pd_taxrate');
  238. r.set('pd_netprice', value / (1 + pd_taxrate / 100));
  239. }
  240. }
  241. }, {
  242. text: "金额",
  243. xtype: 'numbercolumn',
  244. dataIndex: "pd_nettotal",
  245. width: 120,
  246. renderer: function (v) {
  247. var arr = (v + '.').split('.');
  248. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  249. var format = '0,000.' + xr.join('');
  250. return Ext.util.Format.number(v, format);
  251. },
  252. summaryType: 'sum',
  253. summaryRenderer: function (v) {
  254. var arr = (v + '.').split('.');
  255. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  256. var format = '0,000.' + xr.join('');
  257. return Ext.util.Format.number(v, format);
  258. }
  259. }, {
  260. text: "税率",
  261. xtype: 'numbercolumn',
  262. dataIndex: "pd_taxrate",
  263. width: 80,
  264. editor: {
  265. xtype: "numberfield",
  266. decimalPrecision: 0,
  267. minValue: 0,
  268. maxValue: 100
  269. },
  270. renderer: function (v) {
  271. return Ext.util.Format.number(v, '0');
  272. },
  273. }, {
  274. text: "税额",
  275. xtype: 'numbercolumn',
  276. dataIndex: "pd_taxamount",
  277. width: 120,
  278. renderer: function (v) {
  279. var arr = (v + '.').split('.');
  280. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  281. var format = '0,000.' + xr.join('');
  282. return Ext.util.Format.number(v, format);
  283. },
  284. summaryType: 'sum',
  285. summaryRenderer: function (v) {
  286. var arr = (v + '.').split('.');
  287. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  288. var format = '0,000.' + xr.join('');
  289. return Ext.util.Format.number(v, format);
  290. }
  291. }, {
  292. text: "价税合计",
  293. xtype: 'numbercolumn',
  294. dataIndex: "pd_ordertotal",
  295. width: 120,
  296. renderer: function (v) {
  297. var arr = (v + '.').split('.');
  298. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  299. var format = '0,000.' + xr.join('');
  300. return Ext.util.Format.number(v, format);
  301. },
  302. summaryType: 'sum',
  303. summaryRenderer: function (v) {
  304. var arr = (v + '.').split('.');
  305. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  306. var format = '0,000.' + xr.join('');
  307. return Ext.util.Format.number(v, format);
  308. }
  309. }, {
  310. text: "仓库id",
  311. dataIndex: "pd_whid",
  312. xtype: "numbercolumn",
  313. hidden: true
  314. }, {
  315. text: "仓库编号",
  316. dataIndex: "pd_whcode",
  317. hidden: true
  318. }, {
  319. text: "仓库",
  320. dataIndex: "pd_whname",
  321. width: 150.0,
  322. allowBlank: false,
  323. editor: {
  324. displayField: "display",
  325. editable: true,
  326. format: "",
  327. hideTrigger: false,
  328. maxLength: 100.0,
  329. minValue: null,
  330. positiveNum: false,
  331. queryMode: "local",
  332. store: null,
  333. valueField: "value",
  334. xtype: "warehouseDbfindTrigger"
  335. }
  336. }, {
  337. text: "验收明细id",
  338. dataIndex: "pd_ioid",
  339. hidden: true
  340. }, {
  341. text: "验收单号",
  342. dataIndex: "iocode",
  343. width: 150.0,
  344. ignore: true
  345. }, {
  346. text: "验收序号",
  347. dataIndex: "iodetno",
  348. xtype: "numbercolumn",
  349. width: 110.0,
  350. ignore: true,
  351. renderer: function (v) {
  352. if (v) {
  353. return Ext.util.Format.number(v, '0');
  354. } else {
  355. return null;
  356. }
  357. }
  358. }, {
  359. text: "备注",
  360. dataIndex: "pd_remark",
  361. width: 250,
  362. items: null,
  363. editor: {
  364. xtype: "textfield"
  365. },
  366. }]
  367. }, {
  368. xtype: "textfield",
  369. name: "pi_remark",
  370. fieldLabel: "备注",
  371. columnWidth: 1
  372. }, {
  373. xtype: "hidden",
  374. name: "creatorId",
  375. fieldLabel: "录入人ID",
  376. readOnly: true
  377. }, {
  378. xtype: "textfield",
  379. name: "creatorName",
  380. fieldLabel: "录入人",
  381. readOnly: true
  382. }, {
  383. xtype: "datefield",
  384. name: "createTime",
  385. fieldLabel: "录入日期",
  386. readOnly: true,
  387. defaultValue: new Date()
  388. }, {
  389. xtype: "hidden",
  390. name: "updaterId",
  391. fieldLabel: "更新人ID",
  392. readOnly: true
  393. }, {
  394. xtype: "hidden",
  395. name: "updaterName",
  396. fieldLabel: "更新人",
  397. readOnly: true
  398. }, {
  399. xtype: "hidden",
  400. name: "updateTime",
  401. fieldLabel: "更新日期",
  402. readOnly: true,
  403. defaultValue: new Date()
  404. }, {
  405. xtype: "textfield",
  406. name: "pi_auditman",
  407. fieldLabel: "审核人",
  408. readOnly: true
  409. }, {
  410. xtype: "datefield",
  411. name: "pi_auditdate",
  412. fieldLabel: "审核日期",
  413. readOnly: true
  414. }]
  415. });