FormPanel.js 13 KB

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