FormPanel.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'purchase-purchasein-formpanel',
  4. controller: 'purchase-purchasein-formpanel',
  5. viewModel: 'purchase-purchasein-formpanel',
  6. viewName: 'purchase-purchasein-formpanel',
  7. caller:'PurchaseIn',
  8. //字段属性
  9. _title:'采购验收单',
  10. _idField: 'id',
  11. _codeField: 'pi_inoutno',
  12. _statusField: 'pi_status',
  13. _statusCodeField: 'pi_statuscode',
  14. _relationColumn: 'pd_piid',
  15. _readUrl:'/api/purchase/prodinout/read/',
  16. _saveUrl:'/api/purchase/prodinout/save',
  17. _auditUrl:'/api/purchase/prodinout/audit',
  18. _unAuditUrl:'/api/purchase/prodinout/unAudit/',
  19. _deleteUrl:'/api/purchase/prodinout/delete/',
  20. _turnOutUrl:'/api/purchase/prodinout/turnProdOut/',
  21. initId:0,
  22. toolBtns: [{
  23. xtype: 'button',
  24. text: '转采购验退单',
  25. hidden: true,
  26. bind: {
  27. hidden: '{turnHidden}'
  28. },
  29. handler: 'turnOut'
  30. }],
  31. defaultItems: [{
  32. xtype: 'hidden',
  33. name: 'id',
  34. fieldLabel: 'id',
  35. allowBlank: true,
  36. columnWidth: 0
  37. },{
  38. xtype : "textfield",
  39. name : "pi_class",
  40. fieldLabel : "单据类型",
  41. readOnly:true,
  42. allowBlank : true,
  43. columnWidth : 0.25
  44. },{
  45. xtype : "hidden",
  46. name : "pi_vendid",
  47. fieldLabel : "供应商ID",
  48. allowBlank : true,
  49. columnWidth : 0.0
  50. },{
  51. xtype: 'hidden',
  52. name: 'pi_vendcode',
  53. fieldLabel: '供应商编号'
  54. }, {
  55. xtype: 'dbfindtrigger',
  56. name: 'pi_vendname',
  57. fieldLabel: '供应商名称',
  58. allowBlank : false,
  59. },{
  60. xtype : "datefield",
  61. name : "pi_date",
  62. fieldLabel : "单据日期",
  63. allowBlank : false,
  64. columnWidth : 0.25,
  65. defaultValue: new Date()
  66. },{
  67. xtype : "textfield",
  68. name : "pi_total",
  69. fieldLabel : "总额",
  70. allowBlank : true,
  71. readOnly: true,
  72. columnWidth : 0.25
  73. }, {
  74. xtype : "hidden",
  75. name : "pi_puid",
  76. fieldLabel : "采购单id",
  77. allowBlank : true,
  78. columnWidth : 0.25
  79. },{
  80. xtype : "hidden",
  81. name : "pi_pucode",
  82. fieldLabel : "采购单号",
  83. allowBlank : true,
  84. columnWidth : 0.25
  85. }, {
  86. name : "detailGridField",
  87. xtype : "detailGridField",
  88. storeModel:'saas.model.purchase.ProdIODetail',
  89. deleteDetailUrl:'/api/purchase/prodinout/deleteDetail/',
  90. detnoColumn: 'pd_pdno',
  91. columns : [
  92. {
  93. text : "id",
  94. dataIndex : "id",
  95. xtype : "numbercolumn",
  96. hidden:true
  97. },{
  98. text : "物料id",
  99. dataIndex : "pd_prodid",
  100. xtype : "numbercolumn",
  101. hidden:true
  102. },
  103. {
  104. text : "物料编号",
  105. width : 200.0,
  106. dataIndex : "pd_prodcode",
  107. xtype : "",
  108. items : null,
  109. allowBlank : false,
  110. editor : {
  111. displayField : "display",
  112. editable : true,
  113. format : "",
  114. hideTrigger : false,
  115. maxLength : 100.0,
  116. minValue : null,
  117. positiveNum : false,
  118. queryMode : "local",
  119. store : null,
  120. valueField : "value",
  121. xtype : "multidbfindtrigger"
  122. }
  123. },{
  124. text: 'model映射需要',
  125. dataIndex: 'productDTO',
  126. hidden: true,
  127. },
  128. {
  129. text : "名称",
  130. dataIndex : "pr_detail",
  131. ignore:true,
  132. renderer: function (v, m, r) {
  133. if(!v){
  134. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  135. }
  136. return v;
  137. }
  138. },
  139. {
  140. text : "规格",
  141. dataIndex : "pr_spec",
  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. dataIndex : "pd_inqty",
  153. xtype: 'numbercolumn',
  154. width : 120.0,
  155. allowBlank : false,
  156. editor : {
  157. xtype : "numberfield",
  158. decimalPrecision: 3,
  159. minValue:0
  160. },
  161. renderer : function(v) {
  162. var arr = (v + '.').split('.');
  163. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  164. var format = '0.' + xr.join();
  165. return Ext.util.Format.number(v, format);
  166. },
  167. summaryType: 'sum',
  168. summaryRenderer: function(v) {
  169. var arr = (v + '.').split('.');
  170. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  171. var format = '0.' + xr.join();
  172. return Ext.util.Format.number(v, format);
  173. }
  174. }, {
  175. text : "已转数",
  176. dataIndex : "pd_yqty",
  177. xtype: 'numbercolumn',
  178. hidden:true,
  179. width : 120.0,
  180. editor : {
  181. xtype : "numberfield",
  182. decimalPrecision: 3,
  183. editable : false
  184. },
  185. renderer : 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. summaryType: 'sum',
  192. summaryRenderer: function(v) {
  193. var arr = (v + '.').split('.');
  194. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  195. var format = '0.' + xr.join();
  196. return Ext.util.Format.number(v, format);
  197. }
  198. },{
  199. text : "仓库id",
  200. dataIndex : "pd_whid",
  201. xtype : "numbercolumn",
  202. hidden:true
  203. },
  204. {
  205. text : "仓库编号",
  206. dataIndex : "pd_whcode",
  207. hidden:true
  208. },
  209. {
  210. text : "仓库",
  211. dataIndex : "pd_whname",
  212. width : 120.0,
  213. allowBlank : false,
  214. editor : {
  215. displayField : "display",
  216. editable : true,
  217. format : "",
  218. hideTrigger : false,
  219. maxLength : 100.0,
  220. minValue : null,
  221. positiveNum : false,
  222. queryMode : "local",
  223. store : null,
  224. valueField : "value",
  225. xtype : "dbfindtrigger"
  226. }
  227. },
  228. {
  229. text : "单价",
  230. xtype: 'numbercolumn',
  231. editor : {
  232. xtype : "numberfield",
  233. decimalPrecision: 8,
  234. minValue:0
  235. },
  236. dataIndex : "pd_orderprice",
  237. width : 120.0,
  238. renderer : function(v) {
  239. var arr = (v + '.').split('.');
  240. var xr = (new Array(arr[1].length > 8 ? 8 : arr[1].length)).fill('0');
  241. var format = '0,000.' + xr.join();
  242. return Ext.util.Format.number(v, format);
  243. },
  244. }, {
  245. xtype: 'numbercolumn',
  246. text : "税率",
  247. dataIndex : "pd_taxrate",
  248. width : 120.0,
  249. editor : {
  250. xtype : "numberfield",
  251. decimalPrecision: 0,
  252. minValue: 0,
  253. maxValue: 100
  254. },
  255. renderer : function(v) {
  256. return Ext.util.Format.number(v, '0');
  257. },
  258. },{
  259. text : "含税金额",
  260. xtype: 'numbercolumn',
  261. dataIndex : "pd_total",
  262. width : 120.0,
  263. editor : {
  264. xtype : "numberfield",
  265. decimalPrecision: 2,
  266. editable : false
  267. },
  268. renderer : function(v) {
  269. var arr = (v + '.').split('.');
  270. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  271. var format = '0,000.' + xr.join();
  272. return Ext.util.Format.number(v, format);
  273. },
  274. summaryType: 'sum',
  275. summaryRenderer: function(v) {
  276. var arr = (v + '.').split('.');
  277. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  278. var format = '0,000.' + xr.join();
  279. return Ext.util.Format.number(v, format);
  280. }
  281. },
  282. {
  283. text : "未税金额",
  284. xtype: 'numbercolumn',
  285. dataIndex : "pd_nettotal",
  286. editor : {
  287. xtype : "numberfield",
  288. decimalPrecision: 2,
  289. editable : false
  290. },
  291. renderer : function(v) {
  292. var arr = (v + '.').split('.');
  293. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  294. var format = '0,000.' + xr.join();
  295. return Ext.util.Format.number(v, format);
  296. },
  297. summaryType: 'sum',
  298. summaryRenderer: function(v) {
  299. var arr = (v + '.').split('.');
  300. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  301. var format = '0,000.' + xr.join();
  302. return Ext.util.Format.number(v, format);
  303. }
  304. },
  305. {
  306. text : "采购单明细id",
  307. dataIndex : "pd_orderid",
  308. width : 120.0,
  309. hidden:true
  310. },
  311. {
  312. text : "采购单号",
  313. dataIndex : "pd_ordercode",
  314. width : 120.0
  315. },{
  316. text : "采购序号",
  317. dataIndex : "pd_orderdetno",
  318. xtype : "numbercolumn",
  319. width : 120.0,
  320. format: '0',
  321. renderer: function(v) {
  322. return v ? v : null;
  323. }
  324. },{
  325. text : "备注",
  326. dataIndex : "pd_remark",
  327. width : 250,
  328. items : null,
  329. editor : {
  330. xtype : "textfield"
  331. },
  332. }
  333. ]
  334. },{
  335. xtype : "textfield",
  336. name : "pi_remark",
  337. fieldLabel : "备注",
  338. columnWidth : 1
  339. },
  340. {
  341. xtype : "hidden",
  342. name : "creatorId",
  343. fieldLabel : "录入人ID",
  344. readOnly:true
  345. },
  346. {
  347. xtype : "textfield",
  348. name : "creatorName",
  349. fieldLabel : "录入人",
  350. readOnly:true
  351. }, {
  352. xtype : "datefield",
  353. name : "createTime",
  354. fieldLabel : "录入日期",
  355. readOnly:true,
  356. defaultValue: new Date()
  357. },{
  358. xtype : "hidden",
  359. name : "updaterId",
  360. fieldLabel : "更新人ID",
  361. readOnly:true
  362. },{
  363. xtype : "hidden",
  364. name : "updaterName",
  365. fieldLabel : "更新人",
  366. readOnly:true
  367. }, {
  368. xtype : "hidden",
  369. name : "updateTime",
  370. fieldLabel : "更新日期",
  371. readOnly:true,
  372. defaultValue: new Date()
  373. }, {
  374. xtype : "textfield",
  375. name : "pi_auditman",
  376. fieldLabel : "审核人",
  377. readOnly:true
  378. }, {
  379. xtype : "datefield",
  380. name : "pi_auditdate",
  381. fieldLabel : "审核日期",
  382. readOnly:true
  383. }],
  384. beforeAudit:function(){
  385. var me = this,
  386. viewModel = me.getViewModel(),
  387. grid = me.down('detailGridField'),
  388. data = grid.getTrueData();
  389. Ext.Array.each(data,function(item){
  390. if(item.pd_orderprice==0){
  391. saas.util.BaseUtil.showToast(item.pd_pdno+'行'+item.pd_prodcode+'物料单价为0');
  392. }
  393. });
  394. return true;
  395. }
  396. });