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