FormPanel.js 13 KB

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