FormPanel.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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. columnWidth: 0.5,
  93. name: "pi_address",
  94. xtype: "remotecombo",
  95. fieldLabel: "交货地址",
  96. editable: false,
  97. allowBlank: false,
  98. storeUrl: '/api/document/customer/getAddressCombo',
  99. hiddenBtn: true, //true 则会关闭新增按钮功能
  100. }, {
  101. xtype: "datefield",
  102. name: "pi_date",
  103. fieldLabel: "单据日期",
  104. allowBlank: false,
  105. columnWidth: 0.25,
  106. defaultValue: new Date()
  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: 150.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: 200.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: 150,
  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: "出货数量",
  192. xtype: 'numbercolumn',
  193. dataIndex: "pd_outqty",
  194. width: 110.0,
  195. allowBlank: false,
  196. editor: {
  197. xtype: "numberfield",
  198. decimalPrecision: 3,
  199. minValue: 0
  200. },
  201. renderer: function (v) {
  202. return saas.util.BaseUtil.numberFormat(v, 3, true);
  203. },
  204. summaryType: 'sum',
  205. summaryRenderer: function (v) {
  206. return saas.util.BaseUtil.numberFormat(v, 3, true);
  207. }
  208. }, {
  209. text: "单位",
  210. width: 80.0,
  211. dataIndex: "pr_unit",
  212. ignore: true,
  213. renderer: function (v, m, r) {
  214. if (!v) {
  215. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  216. }
  217. return v;
  218. }
  219. }, {
  220. text: "单价(元)",
  221. xtype: 'numbercolumn',
  222. dataIndex: "pd_netprice",
  223. width: 120,
  224. editor: {
  225. xtype: "numberfield",
  226. decimalPrecision: 4,
  227. minValue: 0
  228. },
  229. renderer: function (v) {
  230. return saas.util.BaseUtil.numberFormat(v, 4, true);
  231. },
  232. }, {
  233. text: "含税单价(元)",
  234. xtype: 'numbercolumn',
  235. dataIndex: "pd_sendprice",
  236. width: 120,
  237. editor: {
  238. xtype: "numberfield",
  239. decimalPrecision: 4,
  240. minValue: 0
  241. },
  242. renderer: function (v) {
  243. return saas.util.BaseUtil.numberFormat(v, 4, true);
  244. },
  245. listeners: {
  246. edit: function (value, grid) {
  247. var r = grid.getSelection()[0],
  248. pd_taxrate = r.get('pd_taxrate');
  249. var v = value / (1 + pd_taxrate / 100);
  250. r.set('pd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
  251. }
  252. }
  253. }, {
  254. text: "金额(元)",
  255. xtype: 'numbercolumn',
  256. dataIndex: "pd_nettotal",
  257. width: 120,
  258. renderer: function (v) {
  259. return saas.util.BaseUtil.numberFormat(v, 2, true);
  260. },
  261. summaryType: 'sum',
  262. summaryRenderer: function (v) {
  263. return saas.util.BaseUtil.numberFormat(v, 2, true);
  264. }
  265. }, {
  266. text: "税率",
  267. xtype: 'numbercolumn',
  268. dataIndex: "pd_taxrate",
  269. width: 80,
  270. editor: {
  271. xtype: "numberfield",
  272. decimalPrecision: 0,
  273. minValue: 0,
  274. maxValue: 100
  275. },
  276. renderer: function (v) {
  277. return Ext.util.Format.number(v, '0');
  278. }
  279. }, {
  280. text: "税额(元)",
  281. xtype: 'numbercolumn',
  282. dataIndex: "pd_taxamount",
  283. width: 120,
  284. renderer: function (v) {
  285. return saas.util.BaseUtil.numberFormat(v, 2, true);
  286. },
  287. summaryType: 'sum',
  288. summaryRenderer: function (v) {
  289. return saas.util.BaseUtil.numberFormat(v, 2, true);
  290. }
  291. }, {
  292. text: "价税合计(元)",
  293. xtype: 'numbercolumn',
  294. dataIndex: "pd_ordertotal",
  295. width: 120,
  296. renderer: function (v) {
  297. return saas.util.BaseUtil.numberFormat(v, 2, true);
  298. },
  299. summaryType: 'sum',
  300. summaryRenderer: function (v) {
  301. return saas.util.BaseUtil.numberFormat(v, 2, true);
  302. }
  303. }, {
  304. text: "仓库ID",
  305. dataIndex: "pd_whid",
  306. hidden: true
  307. }, {
  308. text: "仓库编号",
  309. dataIndex: "pd_whcode",
  310. hidden: true
  311. }, {
  312. text: "仓库",
  313. dataIndex: "pd_whname",
  314. width: 150.0,
  315. items: null,
  316. allowBlank: false,
  317. editor: {
  318. displayField: "display",
  319. editable: true,
  320. format: "",
  321. hideTrigger: false,
  322. maxLength: 100.0,
  323. minValue: null,
  324. positiveNum: false,
  325. queryMode: "local",
  326. store: null,
  327. valueField: "value",
  328. xtype: "warehouseDbfindTrigger"
  329. }
  330. }, {
  331. text: "销售单号",
  332. dataIndex: "pd_ordercode",
  333. width: 150.0,
  334. ignore: true
  335. }, {
  336. text: "销售序号",
  337. dataIndex: "pd_orderdetno",
  338. xtype: "numbercolumn",
  339. width: 110.0,
  340. format: '0',
  341. ignore: true,
  342. renderer: function (v) {
  343. return v ? v : null;
  344. }
  345. }, {
  346. text: "备注",
  347. dataIndex: "pd_remark",
  348. width: 250,
  349. items: null,
  350. editor: {
  351. xtype: "textfield"
  352. },
  353. }]
  354. }, {
  355. xtype: "textfield",
  356. name: "pi_total",
  357. fieldLabel: "单据金额",
  358. readOnly: true
  359. }, {
  360. xtype: "textfield",
  361. name: "pi_remark",
  362. fieldLabel: "备注",
  363. columnWidth: 0.75
  364. }, {
  365. xtype: "hidden",
  366. name: "creatorId",
  367. fieldLabel: "录入人ID",
  368. readOnly: true
  369. }, {
  370. xtype: "textfield",
  371. name: "creatorName",
  372. fieldLabel: "录入人",
  373. readOnly: true
  374. }, {
  375. xtype: "datefield",
  376. name: "createTime",
  377. fieldLabel: "录入日期",
  378. readOnly: true,
  379. defaultValue: new Date()
  380. }, {
  381. xtype: "hidden",
  382. name: "updaterId",
  383. fieldLabel: "更新人ID",
  384. readOnly: true
  385. }, {
  386. xtype: "hidden",
  387. name: "updaterName",
  388. fieldLabel: "更新人",
  389. readOnly: true
  390. }, {
  391. xtype: "hidden",
  392. name: "updateTime",
  393. fieldLabel: "更新日期",
  394. readOnly: true,
  395. defaultValue: new Date()
  396. }, {
  397. xtype: "textfield",
  398. name: "pi_auditman",
  399. fieldLabel: "审核人",
  400. readOnly: true
  401. }, {
  402. xtype: "datefield",
  403. name: "pi_auditdate",
  404. fieldLabel: "审核日期",
  405. readOnly: true
  406. }]
  407. });