FormPanel.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. Ext.define('make.view.make.makeIn.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: ['make-makein-formpanel', 'makein-formpanel'],
  4. controller: 'make-makein-formpanel',
  5. viewModel: 'make-makein-formpanel',
  6. viewName: 'make-makein-formpanel',
  7. caller: 'MakeIn',
  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/make/prodinout/read',
  18. _saveUrl: '/api/make/prodinout/save',
  19. _auditUrl: '/api/make/prodinout/audit',
  20. _unAuditUrl: '/api/make/prodinout/unAudit',
  21. _deleteUrl: '/api/make/prodinout/delete',
  22. initId: 0,
  23. initComponent: function () {
  24. var currentDepart = saas.util.BaseUtil.getCurrentUserDepart();
  25. Ext.apply(this, {
  26. defaultItems: [{
  27. xtype: 'hidden',
  28. name: 'id',
  29. fieldLabel: 'id',
  30. allowBlank: true,
  31. columnWidth: 0
  32. }, {
  33. xtype: "datefield",
  34. name: "pi_date",
  35. fieldLabel: "单据日期",
  36. allowBlank: false,
  37. columnWidth: 0.25,
  38. defaultValue: new Date()
  39. }, {
  40. xtype: "hidden",
  41. name: "pi_class",
  42. fieldLabel: "单据类型",
  43. readOnly: true,
  44. allowBlank: true,
  45. defaultValue: 'MAKEIN',
  46. columnWidth: 0.25
  47. }, {
  48. xtype: 'departDbfindTrigger',
  49. name: 'pi_departmentname',
  50. fieldLabel: '部门名称',
  51. allowBlank: false,
  52. columnWidth: 0.25,
  53. defaultValue: currentDepart.dp_name
  54. }, {
  55. xtype: 'hidden',
  56. name: 'pi_departmentcode',
  57. fieldLabel: '部门编号',
  58. allowBlank: true,
  59. defaultValue: currentDepart.dp_code
  60. },{
  61. name: "detailGridField",
  62. xtype: "detailGridField",
  63. storeModel: 'make.model.make.MakeInDetail',
  64. deleteDetailUrl: '/api/make/prodinout/deleteDetail',
  65. relativeBinds:{
  66. refFields:['pd_maid'],
  67. fields:['pd_prodcode','pr_detail']
  68. },
  69. detnoColumn: 'pd_pdno',
  70. columns: [{
  71. text: "id",
  72. dataIndex: "id",
  73. xtype: "numbercolumn",
  74. hidden: true
  75. }, {
  76. text: "制造单号",
  77. dataIndex: "pd_ordercode",
  78. width: 150.0,
  79. editor: {
  80. displayField: "display",
  81. editable: true,
  82. format: "",
  83. hideTrigger: false,
  84. maxLength: 100.0,
  85. minValue: null,
  86. caller:'MakeIn',
  87. positiveNum: false,
  88. //queryMode: "local",
  89. store: null,
  90. valueField: "value",
  91. xtype: "makeMainMultiDbfindTrigger"
  92. }
  93. },{
  94. text: "工单id",
  95. dataIndex: "pd_orderid",
  96. xtype: "numbercolumn",
  97. hidden: true
  98. }, {
  99. text: "订单id",
  100. dataIndex: "pd_maid",
  101. xtype: "numbercolumn",
  102. hidden: true
  103. }, {
  104. text: "物料id",
  105. dataIndex: "pd_prodid",
  106. xtype: "numbercolumn",
  107. hidden: true
  108. }, {
  109. text: "物料编号",
  110. width: 150.0,
  111. dataIndex: "pd_prodcode"
  112. }, {
  113. text: "物料名称",
  114. width: 150.0,
  115. dataIndex: "pr_detail",
  116. ignore: true,
  117. renderer: function (v, m, r) {
  118. if (!v) {
  119. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  120. }
  121. return v;
  122. }
  123. }, {
  124. text: "物料规格",
  125. hidden:true,
  126. width: 200,
  127. dataIndex: "pr_spec",
  128. ignore: true,
  129. renderer: function (v, m, r) {
  130. if (!v) {
  131. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  132. }
  133. return v;
  134. }
  135. }, {
  136. text: "单位",
  137. width: 65.0,
  138. dataIndex: "pr_unit",
  139. ignore: true,
  140. renderer: function (v, m, r) {
  141. if (!v) {
  142. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  143. }
  144. return v;
  145. }
  146. },{
  147. text: "完工数量",
  148. dataIndex: "pd_inqty",
  149. xtype: 'numbercolumn',
  150. width: 110.0,
  151. allowBlank: false,
  152. editor: {
  153. xtype: "numberfield",
  154. decimalPrecision: 6,
  155. minValue: 0
  156. },
  157. renderer: function(v, m, r) {
  158. return saas.util.BaseUtil.numberFormat(v, 6, true);
  159. },
  160. summaryType: 'sum',
  161. summaryRenderer: function(v, d, f, m) {
  162. return saas.util.BaseUtil.numberFormat(v, 6, true);
  163. }
  164. }, {
  165. text: "仓库id",
  166. dataIndex: "pd_whid",
  167. xtype: "numbercolumn",
  168. hidden: true
  169. }, {
  170. text: "仓库编号",
  171. dataIndex: "pd_whcode",
  172. hidden: true
  173. }, {
  174. text: "仓库",
  175. dataIndex: "pd_whname",
  176. width: 110.0,
  177. allowBlank: false,
  178. editor: {
  179. displayField: "display",
  180. editable: true,
  181. format: "",
  182. hideTrigger: false,
  183. maxLength: 100.0,
  184. minValue: null,
  185. positiveNum: false,
  186. queryMode: "local",
  187. store: null,
  188. valueField: "value",
  189. xtype: "warehouseDbfindTrigger"
  190. }
  191. }, {
  192. text: 'model映射需要',
  193. dataIndex: 'productDTO',
  194. hidden: true,
  195. }, {
  196. text: "单价(元)",
  197. xtype: 'numbercolumn',
  198. width: 120,
  199. editor: {
  200. xtype: "numberfield",
  201. decimalPrecision: 8,
  202. minValue: 0
  203. },
  204. dataIndex: "pd_price",
  205. width: 120,
  206. renderer: function(v, m, r) {
  207. return saas.util.BaseUtil.numberFormat(v, 8, true);
  208. }
  209. }, {
  210. text: "金额(元)",
  211. xtype: 'numbercolumn',
  212. dataIndex: "pd_total",
  213. width: 120,
  214. renderer: function(v, m, r) {
  215. return saas.util.BaseUtil.numberFixFormat(v, 2, true);
  216. },
  217. summaryType: 'sum',
  218. summaryRenderer: function(v, d, f, m) {
  219. return saas.util.BaseUtil.numberFixFormat(v, 2, true);
  220. }
  221. },{
  222. text: "厂家/品牌",
  223. hidden:true,
  224. width: 100.0,
  225. dataIndex: "pr_brand",
  226. ignore: true,
  227. renderer: function (v, m, r) {
  228. if (!v) {
  229. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  230. }
  231. return v;
  232. }
  233. }, {
  234. text: "型号",
  235. width: 200.0,
  236. dataIndex: "pr_orispeccode",
  237. ignore: true,
  238. renderer: function (v, m, r) {
  239. var str = '';
  240. if(r.data["productDTO"] ){
  241. if(r.data["productDTO"]['pr_brand']){
  242. str += '厂家/品牌:'+ r.data["productDTO"]['pr_brand'] + '<br>';
  243. }
  244. if(r.data["productDTO"]['pr_spec']){
  245. str += '规格:' + r.data["productDTO"]['pr_spec'];
  246. }
  247. if(str) m.tdAttr = 'data-qtip="'+ str +'"';
  248. if (!v) {
  249. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  250. }
  251. }
  252. return v;
  253. }
  254. }, {
  255. text: "备注",
  256. dataIndex: "pd_remark",
  257. width: 250,
  258. items: null,
  259. editor: {
  260. xtype: "textfield"
  261. }
  262. }, {
  263. dataIndex: "pd_text1",
  264. text: "自定义字段1",
  265. width: 100,
  266. hidden: true,
  267. initHidden: false,
  268. editor: {
  269. xtype: "textfield"
  270. },
  271. }, {
  272. dataIndex: "pd_text2",
  273. text: "自定义字段2",
  274. width: 100,
  275. hidden: true,
  276. initHidden: false,
  277. editor: {
  278. xtype: "textfield"
  279. },
  280. }, {
  281. dataIndex: "pd_text3",
  282. text: "自定义字段3",
  283. width: 100,
  284. hidden: true,
  285. initHidden: false,
  286. editor: {
  287. xtype: "textfield"
  288. },
  289. }, {
  290. dataIndex: "pd_text4",
  291. text: "自定义字段4",
  292. width: 100,
  293. hidden: true,
  294. initHidden: false,
  295. editor: {
  296. xtype: "textfield"
  297. },
  298. }, {
  299. dataIndex: "pd_text5",
  300. text: "自定义字段5",
  301. width: 100,
  302. hidden: true,
  303. initHidden: false,
  304. editor: {
  305. xtype: "textfield"
  306. },
  307. }]
  308. }, {
  309. xtype: "textfield",
  310. name: "pi_remark",
  311. fieldLabel: "备注",
  312. columnWidth: 1
  313. }, {
  314. xtype: "datefield",
  315. name: "pi_date",
  316. fieldLabel: "单据日期",
  317. columnWidth: 0.3,
  318. hidden: true,
  319. defaultValue: new Date()
  320. }, {
  321. xtype: "hidden",
  322. name: "creatorId",
  323. fieldLabel: "录入人ID",
  324. readOnly: true
  325. }, {
  326. xtype: "textfield",
  327. name: "creatorName",
  328. fieldLabel: "录入人",
  329. readOnly: true,
  330. columnWidth: 0.3
  331. }, {
  332. xtype: "hidden",
  333. name: "createTime",
  334. fieldLabel: "录入日期",
  335. readOnly: true,
  336. defaultValue: new Date()
  337. }, {
  338. xtype: "hidden",
  339. name: "updaterId",
  340. fieldLabel: "更新人ID",
  341. readOnly: true
  342. }, {
  343. xtype: "hidden",
  344. name: "updaterName",
  345. fieldLabel: "更新人",
  346. readOnly: true
  347. }, {
  348. xtype: "hidden",
  349. name: "updateTime",
  350. fieldLabel: "更新日期",
  351. readOnly: true,
  352. defaultValue: new Date()
  353. }, {
  354. xtype: "textfield",
  355. name: "pi_auditman",
  356. fieldLabel: "审核人",
  357. columnWidth: 0.3,
  358. readOnly: true
  359. }, {
  360. xtype: "displayfield",
  361. name: "pi_costtotal",
  362. fieldLabel: "金额(元)",
  363. labelWidth:200,
  364. labelAlign : 'right',
  365. columnWidth: 0.4,
  366. thousandSeparator: ',',
  367. renderer: function (v){
  368. if(!v){
  369. v=0;
  370. }
  371. return '<p class="money-rtl"><font color="red"><B>'+saas.util.BaseUtil.numberFixFormat(v, 2, true)+'</font>'
  372. },
  373. readOnly: true
  374. }, {
  375. xtype: "hidden",
  376. name: "pi_auditdate",
  377. fieldLabel: "审核日期",
  378. readOnly: true
  379. }, {
  380. xtype: "textfield",
  381. name: "pi_text1",
  382. fieldLabel: "自定义字段1",
  383. hidden: true,
  384. initHidden: false
  385. }, {
  386. xtype: "textfield",
  387. name: "pi_text2",
  388. fieldLabel: "自定义字段2",
  389. hidden: true,
  390. initHidden: false
  391. }, {
  392. xtype: "textfield",
  393. name: "pi_text3",
  394. fieldLabel: "自定义字段3",
  395. hidden: true,
  396. initHidden: false
  397. }, {
  398. xtype: "textfield",
  399. name: "pi_text4",
  400. fieldLabel: "自定义字段4",
  401. hidden: true,
  402. initHidden: false
  403. }, {
  404. xtype: "textfield",
  405. name: "pi_text5",
  406. fieldLabel: "自定义字段5",
  407. hidden: true,
  408. initHidden: false
  409. }],
  410. });
  411. this.callParent(arguments);
  412. },
  413. // beforeAudit: function () {
  414. // var me = this,
  415. // viewModel = me.getViewModel(),
  416. // grid = me.down('detailGridField'),
  417. // data = grid.getTrueData();
  418. // Ext.Array.each(data, function (item) {
  419. // if (item.pd_price == 0) {
  420. // saas.util.BaseUtil.showErrorToast(item.pd_pdno + '行' + item.pd_prodcode + '物料单价为0');
  421. // }
  422. // });
  423. // return true;
  424. // }
  425. });