FormPanel.js 15 KB

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