FormPanel.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. Ext.define('saas.view.document.bom.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'document-bom-formpanel',
  4. controller: 'document-bom-formpanel',
  5. viewModel: 'document-bom-formpanel',
  6. caller:'Bom',
  7. //字段属性
  8. _title:'BOM资料',
  9. _idField: 'id',
  10. _codeField: 'codefied',
  11. _statusField: 'bo_status',
  12. _statusCodeField: 'bo_statuscode',
  13. _readUrl:'/api/document/bom/read',
  14. _saveUrl:'/api/document/bom/save',
  15. _openUrl:'/api/document/bom/open',
  16. _closeUrl:'/api/document/bom/close',
  17. _deleteUrl:'/api/document/bom/delete',
  18. initId:0,
  19. _deleteMsg: '删除的BOM资料将不能恢复,请确认是否删除?',
  20. codeInHeader: false,
  21. initComponent: function () {
  22. Ext.applyIf(this, {
  23. defaultButtons:[{
  24. cls: 'x-formpanel-btn-blue',
  25. xtype: 'button',
  26. text: '新增',
  27. bind: {
  28. hidden: '{!id}'
  29. },
  30. handler: 'add'
  31. }, {
  32. xtype: 'button',
  33. text: '保存',
  34. handler: 'onSave'
  35. }, {
  36. xtype: 'button',
  37. text: '删除',
  38. handler: 'delete'
  39. }, {
  40. xtype: 'button',
  41. bind: {
  42. text: '{auditBtnText}'
  43. },
  44. handler: "auditBtnClick",
  45. }],
  46. defaultItems: [{
  47. xtype: 'hidden',
  48. name: 'id',
  49. fieldLabel: 'id',
  50. },{
  51. xtype: 'hidden',
  52. name: 'bo_motherid',
  53. fieldLabel: '产品id'
  54. },{
  55. xtype : "productDbfindTrigger",
  56. name: 'bo_mothercode',
  57. fieldLabel: '产品编号',
  58. allowBlank: false
  59. },{
  60. xtype: 'textfield',
  61. name: 'pr_brand',
  62. fieldLabel: '品牌',
  63. readOnly:true,
  64. },{
  65. xtype: 'textfield',
  66. name: 'bo_mothername',
  67. fieldLabel: '产品名称',
  68. readOnly:true,
  69. allowBlank: false
  70. },{
  71. xtype: 'textfield',
  72. name: 'pr_orispeccode',
  73. fieldLabel: '产品型号',
  74. readOnly:true,
  75. },{
  76. xtype: 'textfield',
  77. name: 'pr_spec',
  78. fieldLabel: '产品规格',
  79. readOnly:true,
  80. ignore:true
  81. },{
  82. xtype: 'textfield',
  83. name: 'bo_version',
  84. fieldLabel: '版本号',
  85. allowBlank: false
  86. }, {
  87. xtype : "detailGridField",
  88. detnoColumn: 'bd_detno',
  89. showCount: false,
  90. storeModel:'saas.model.document.bomdetail',
  91. deleteDetailUrl:'/api/document/bom/deleteDetail',
  92. columns : [
  93. {
  94. text : "ID",
  95. dataIndex : "id",
  96. hidden : true,
  97. xtype : "numbercolumn"
  98. }, {
  99. text : "关联ID",
  100. dataIndex : "bd_bomid",
  101. hidden : true,
  102. xtype : "numbercolumn"
  103. }, {
  104. allowBlank:false,
  105. text : "物料编号",
  106. dataIndex : "bd_soncode",
  107. width : 150,
  108. editor : {
  109. displayField : "display",
  110. editable : true,
  111. format : "",
  112. hideTrigger : false,
  113. maxLength : 100.0,
  114. minValue : null,
  115. positiveNum : false,
  116. queryMode : "local",
  117. store : null,
  118. valueField : "value",
  119. xtype : "productMultiDbfindTrigger"
  120. }
  121. }, {
  122. allowBlank:false,
  123. text : "物料ID",
  124. hidden : true,
  125. dataIndex : "bd_sonid",
  126. }, {
  127. text: 'model映射需要',
  128. dataIndex: 'productDTO',
  129. hidden: true,
  130. }, {
  131. text : "品牌",
  132. width : 100.0,
  133. dataIndex : "pr_brand",
  134. ignore:true,
  135. renderer: function (v, m, r) {
  136. if(!v){
  137. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  138. }
  139. return v;
  140. }
  141. }, {
  142. text : "物料名称",
  143. width : 150.0,
  144. dataIndex : "pr_detail",
  145. ignore:true,
  146. renderer: function (v, m, r) {
  147. if(!v){
  148. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  149. }
  150. return v;
  151. }
  152. },
  153. {
  154. text : "型号",
  155. width : 200.0,
  156. dataIndex : "pr_orispeccode",
  157. ignore:true,
  158. renderer: function (v, m, r) {
  159. if(!v){
  160. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  161. }
  162. return v;
  163. }
  164. },{
  165. text : "规格",
  166. width : 200,
  167. dataIndex : "pr_spec",
  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. allowBlank:false,
  177. text : "用量",
  178. width : 110,
  179. xtype : "numbercolumn",
  180. dataIndex : "bd_baseqty",
  181. editor : {
  182. xtype : "numberfield",
  183. decimalPrecision: 3,
  184. minValue:0,
  185. maxLength: 10,
  186. align: 'end'
  187. },
  188. renderer : function(v) {
  189. return saas.util.BaseUtil.numberFormat(v, 3, false);
  190. }
  191. }, {
  192. text : "单位",
  193. dataIndex : "bd_unit",
  194. width : 65
  195. }, {
  196. text : "替代料",
  197. dataIndex : "bd_replace",
  198. width : 250,
  199. editor : {
  200. displayField : "display",
  201. editable : true,
  202. format : "",
  203. hideTrigger : false,
  204. maxLength : 100.0,
  205. minValue : null,
  206. positiveNum : false,
  207. queryMode : "local",
  208. store : null,
  209. valueField : "value",
  210. xtype : "productAddMultiDbfindTrigger"
  211. }
  212. }, {
  213. text : "备注",
  214. dataIndex : "bd_remark",
  215. width : 250,
  216. items : null,
  217. editor : {
  218. xtype : "textfield"
  219. },
  220. }]
  221. }, {
  222. xtype: 'hidden',
  223. name: 'bo_statuscode',
  224. fieldLabel: '状态码',
  225. readOnly:true,
  226. defaultValue: ''
  227. }, {
  228. xtype: 'textfield',
  229. name: 'bo_status',
  230. fieldLabel: '产品状态',
  231. readOnly:true,
  232. defaultValue: ''
  233. },{
  234. xtype : "textfield",
  235. name : "creatorName",
  236. readOnly:true,
  237. fieldLabel : "录入人"
  238. },{
  239. xtype : "datefield",
  240. name : "createTime",
  241. fieldLabel : "录入时间"
  242. }],
  243. auditTexts: {
  244. auditCode: 'BANNED',
  245. auditText: '已禁用',
  246. unAuditCode: 'ENABLE',
  247. unAuditText: '已启用',
  248. auditBtnText: '禁用',
  249. unAuditBtnText: '启用',
  250. }
  251. });
  252. this.callParent(arguments);
  253. },
  254. });