FormPanel.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. Ext.define('saas.view.sale.saleout.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'sale-saleout-formpanel',
  4. controller: 'sale-saleout-formpanel',
  5. viewModel: 'sale-saleout-formpanel',
  6. viewName: 'sale-saleout-formpanel',
  7. caller: 'SaleOut',
  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/sale/prodinout/read',
  18. _saveUrl: '/api/sale/prodinout/save',
  19. _auditUrl: '/api/sale/prodinout/audit',
  20. _unAuditUrl: '/api/sale/prodinout/unAudit',
  21. _deleteUrl: '/api/sale/prodinout/delete',
  22. _turnInUrl: '/api/sale/prodinout/turnProdIn',
  23. initId: 0,
  24. initComponent: function () {
  25. Ext.apply(this, {
  26. toolBtns: [{
  27. xtype: 'button',
  28. text: '转销售退货',
  29. handler: 'turnProdIn',
  30. hidden: true,
  31. bind: {
  32. hidden: '{pi_statuscode!="AUDITED"}'
  33. }
  34. }],
  35. defaultItems: [{
  36. xtype: 'hidden',
  37. name: 'id',
  38. fieldLabel: 'id'
  39. }, {
  40. xtype: "hidden",
  41. name: "pi_class",
  42. fieldLabel: "单据类型",
  43. readOnly: true,
  44. allowBlank: false,
  45. defaultValue: '出货单'
  46. }, {
  47. xtype: "hidden",
  48. name: "pi_custid",
  49. fieldLabel: "客户ID"
  50. }, {
  51. xtype: "hidden",
  52. name: "pi_custcode",
  53. fieldLabel: "客户编号"
  54. }, {
  55. xtype: "customerDbfindTrigger",
  56. name: "pi_custname",
  57. fieldLabel: "客户名称",
  58. allowBlank: false,
  59. columnWidth: 0.5,
  60. setValue: function (value) {
  61. var me = this,
  62. bind, valueBind;
  63. var form = me.ownerCt;
  64. var c = form.down('[name=pi_address]');
  65. if (value && value != '') {
  66. c.setDisabled(false);
  67. } else {
  68. c.setDisabled(true);
  69. }
  70. if (me.hasFocus) {
  71. bind = me.getBind();
  72. valueBind = bind && bind.value;
  73. if (valueBind && valueBind.syncing) {
  74. if ((Ext.isEmpty(value) && Ext.isEmpty(me.value)) || value === me.value) {
  75. return me;
  76. } else if (Ext.isArray(value) && Ext.isArray(me.value) && Ext.Array.equals(value, me.value)) {
  77. return me;
  78. }
  79. }
  80. } else {
  81. me.lastSelectedRecords = null;
  82. }
  83. if (value != null) {
  84. me.doSetValue(value);
  85. } else {
  86. me.suspendEvent('select');
  87. me.valueCollection.beginUpdate();
  88. me.pickerSelectionModel.deselectAll();
  89. me.valueCollection.endUpdate();
  90. me.resumeEvent('select');
  91. }
  92. return me;
  93. }
  94. }, {
  95. xtype: 'condbfindtrigger',
  96. fieldLabel: '币别汇率',
  97. allowBlank: false,
  98. dbType: 'currencyDbfindTrigger',
  99. dbfinds: [{
  100. from: 'cr_name', to: 'pi_currency'
  101. }, {
  102. from: 'cr_rate', to: 'pi_rate'
  103. }],
  104. defaultValue: {
  105. pi_currency: 'RMB',
  106. pi_rate: 1
  107. },
  108. supFieldConfig: {
  109. xtype: 'numberfield',
  110. readOnly: false,
  111. defaultReadOnly: false,
  112. defaultValue: 1,
  113. decimalPrecision: 6,
  114. vtype: 'positiveNumber'
  115. }
  116. }, {
  117. xtype: "datefield",
  118. name: "pi_date",
  119. fieldLabel: "单据日期",
  120. allowBlank: false,
  121. columnWidth: 0.25,
  122. defaultValue: new Date()
  123. }, {
  124. columnWidth: 0.5,
  125. name: "pi_address",
  126. xtype: "remotecombo",
  127. fieldLabel: "交货地址",
  128. editable: false,
  129. allowBlank: false,
  130. storeUrl: '/api/document/customer/getAddressCombo',
  131. hiddenBtn: true, //true 则会关闭新增按钮功能
  132. }, {
  133. name: "detailGridField",
  134. xtype: "detailGridField",
  135. detnoColumn: 'pd_pdno',
  136. storeModel: 'saas.model.sale.SaleOutDetail',
  137. deleteDetailUrl: '/api/sale/prodinout/deleteDetail',
  138. columns: [{
  139. text: "id",
  140. dataIndex: "id",
  141. xtype: "numbercolumn",
  142. hidden: true
  143. }, {
  144. text: "物料id",
  145. dataIndex: "pd_prodid",
  146. hidden: true
  147. }, {
  148. text: "物料编号",
  149. width: 150.0,
  150. dataIndex: "pd_prodcode",
  151. xtype: "",
  152. items: null,
  153. allowBlank: false,
  154. editor: {
  155. displayField: "display",
  156. editable: true,
  157. format: "",
  158. hideTrigger: false,
  159. maxLength: 100.0,
  160. minValue: null,
  161. positiveNum: false,
  162. queryMode: "local",
  163. store: null,
  164. valueField: "value",
  165. xtype: "productMultiDbfindTrigger"
  166. }
  167. }, {
  168. text: 'model映射需要',
  169. dataIndex: 'productDTO',
  170. hidden: true,
  171. }, {
  172. text: "品牌",
  173. width: 100.0,
  174. dataIndex: "pr_brand",
  175. ignore: true,
  176. renderer: function (v, m, r) {
  177. if (!v) {
  178. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  179. }
  180. return v;
  181. }
  182. }, {
  183. text: "物料名称",
  184. width: 150.0,
  185. dataIndex: "pr_detail",
  186. ignore: true,
  187. renderer: function (v, m, r) {
  188. if (!v) {
  189. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  190. }
  191. return v;
  192. }
  193. }, {
  194. text: "型号",
  195. width: 200.0,
  196. dataIndex: "pr_orispeccode",
  197. ignore: true,
  198. renderer: function (v, m, r) {
  199. if (!v) {
  200. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  201. }
  202. return v;
  203. }
  204. }, {
  205. text: "规格",
  206. width: 200,
  207. dataIndex: "pr_spec",
  208. ignore: true,
  209. renderer: function (v, m, r) {
  210. if (!v) {
  211. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  212. }
  213. return v;
  214. }
  215. }, {
  216. text: "仓库ID",
  217. dataIndex: "pd_whid",
  218. hidden: true
  219. }, {
  220. text: "仓库编号",
  221. dataIndex: "pd_whcode",
  222. hidden: true
  223. }, {
  224. text: "仓库",
  225. dataIndex: "pd_whname",
  226. width: 110.0,
  227. items: null,
  228. allowBlank: false,
  229. editor: {
  230. displayField: "display",
  231. editable: true,
  232. format: "",
  233. hideTrigger: false,
  234. maxLength: 100.0,
  235. minValue: null,
  236. positiveNum: false,
  237. queryMode: "local",
  238. store: null,
  239. valueField: "value",
  240. xtype: "warehouseDbfindTrigger"
  241. }
  242. }, {
  243. text: "数量",
  244. xtype: 'numbercolumn',
  245. dataIndex: "pd_outqty",
  246. width: 110.0,
  247. allowBlank: false,
  248. editor: {
  249. xtype: "numberfield",
  250. decimalPrecision: 3,
  251. minValue: 0
  252. },
  253. renderer: function(v, m, r) {
  254. return saas.util.BaseUtil.numberFormat(v, 3, false);
  255. },
  256. summaryType: 'sum',
  257. summaryRenderer: function(v, d, f, m) {
  258. return saas.util.BaseUtil.numberFormat(v, 3, false);
  259. }
  260. }, {
  261. text: "单位",
  262. width: 65.0,
  263. dataIndex: "pr_unit",
  264. ignore: true,
  265. renderer: function (v, m, r) {
  266. if (!v) {
  267. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  268. }
  269. return v;
  270. }
  271. }, {
  272. text: "单价(元)",
  273. xtype: 'numbercolumn',
  274. dataIndex: "pd_netprice",
  275. width: 120,
  276. editor: {
  277. xtype: "numberfield",
  278. decimalPrecision: 4,
  279. minValue: 0
  280. },
  281. renderer: function(v, m, r) {
  282. return saas.util.BaseUtil.numberFormat(v, 4, true);
  283. },
  284. }, {
  285. text: "含税单价(元)",
  286. xtype: 'numbercolumn',
  287. dataIndex: "pd_sendprice",
  288. width: 120,
  289. editor: {
  290. xtype: "numberfield",
  291. decimalPrecision: 4,
  292. minValue: 0
  293. },
  294. renderer: function(v, m, r) {
  295. return saas.util.BaseUtil.numberFormat(v, 4, true);
  296. },
  297. listeners: {
  298. edit: function (value, grid) {
  299. var r = grid.getSelection()[0],
  300. pd_taxrate = r.get('pd_taxrate');
  301. var v = value / (1 + pd_taxrate / 100);
  302. r.set('pd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
  303. }
  304. }
  305. }, {
  306. text: "金额(元)",
  307. xtype: 'numbercolumn',
  308. dataIndex: "pd_nettotal",
  309. width: 120,
  310. renderer: function(v, m, r) {
  311. return saas.util.BaseUtil.numberFormat(v, 2, true);
  312. },
  313. summaryType: 'sum',
  314. summaryRenderer: function(v, d, f, m) {
  315. return saas.util.BaseUtil.numberFormat(v, 2, true);
  316. }
  317. }, {
  318. text: "税率(%)",
  319. xtype: 'numbercolumn',
  320. dataIndex: "pd_taxrate",
  321. width: 80,
  322. editor: {
  323. xtype: "numberfield",
  324. decimalPrecision: 0,
  325. minValue: 0,
  326. maxValue: 100
  327. },
  328. renderer: function(v, m, r) {
  329. return saas.util.BaseUtil.numberFormat(v, 2, false);
  330. }
  331. }, {
  332. text: "税额(元)",
  333. xtype: 'numbercolumn',
  334. dataIndex: "pd_taxamount",
  335. width: 120,
  336. renderer: function(v, m, r) {
  337. return saas.util.BaseUtil.numberFormat(v, 2, true);
  338. },
  339. summaryType: 'sum',
  340. summaryRenderer: function(v, d, f, m) {
  341. return saas.util.BaseUtil.numberFormat(v, 2, true);
  342. }
  343. }, {
  344. text: "价税合计(元)",
  345. xtype: 'numbercolumn',
  346. dataIndex: "pd_ordertotal",
  347. width: 120,
  348. renderer: function(v, m, r) {
  349. return saas.util.BaseUtil.numberFormat(v, 2, true);
  350. },
  351. summaryType: 'sum',
  352. summaryRenderer: function (v) {
  353. return saas.util.BaseUtil.numberFormat(v, 2, true);
  354. }
  355. }, {
  356. text: "关联销售单号",
  357. dataIndex: "pd_ordercode",
  358. width: 150.0,
  359. ignore: true
  360. }, {
  361. text: "备注",
  362. dataIndex: "pd_remark",
  363. width: 250,
  364. items: null,
  365. editor: {
  366. xtype: "textfield"
  367. },
  368. }, {
  369. dataIndex: "pd_text1",
  370. text: "自定义字段1",
  371. width: 100,
  372. hidden: true,
  373. initHidden: false,
  374. editor: {
  375. xtype: "textfield"
  376. },
  377. }, {
  378. dataIndex: "pd_text2",
  379. text: "自定义字段2",
  380. width: 100,
  381. hidden: true,
  382. initHidden: false,
  383. editor: {
  384. xtype: "textfield"
  385. },
  386. }, {
  387. dataIndex: "pd_text3",
  388. text: "自定义字段3",
  389. width: 100,
  390. hidden: true,
  391. initHidden: false,
  392. editor: {
  393. xtype: "textfield"
  394. },
  395. }, {
  396. dataIndex: "pd_text4",
  397. text: "自定义字段4",
  398. width: 100,
  399. hidden: true,
  400. initHidden: false,
  401. editor: {
  402. xtype: "textfield"
  403. },
  404. }, {
  405. dataIndex: "pd_text5",
  406. text: "自定义字段5",
  407. width: 100,
  408. hidden: true,
  409. initHidden: false,
  410. editor: {
  411. xtype: "textfield"
  412. },
  413. }]
  414. }, {
  415. xtype: "textfield",
  416. name: "pi_remark",
  417. fieldLabel: "备注",
  418. columnWidth: 1
  419. }, {
  420. xtype: "numberfield",
  421. name: "pi_nettotal",
  422. fieldLabel: "金额(元)",
  423. readOnly: true,
  424. thousandSeparator: ','
  425. }, {
  426. xtype: "numberfield",
  427. name: "pi_total",
  428. fieldLabel: "价税合计(元)",
  429. readOnly: true,
  430. thousandSeparator: ','
  431. }, {
  432. xtype: "employeeDbfindTrigger",
  433. name: "pi_seller",
  434. fieldLabel: "业务员"
  435. }, {
  436. xtype: "hidden",
  437. name: "pi_sellerid",
  438. fieldLabel: "业务员ID"
  439. }, {
  440. xtype: "hidden",
  441. name: "pi_sellercode",
  442. fieldLabel: "业务员编号",
  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. });