FormPanel.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. defaultItems: [{
  45. xtype: 'hidden',
  46. name: 'id',
  47. fieldLabel: 'id',
  48. },{
  49. xtype: 'hidden',
  50. name: 'bo_motherid',
  51. fieldLabel: '产品id'
  52. },{
  53. xtype : "productDbfindTrigger",
  54. name: 'bo_mothercode',
  55. fieldLabel: '产品编号',
  56. allowBlank: false
  57. },{
  58. xtype: 'textfield',
  59. name: 'bo_mothername',
  60. fieldLabel: '产品名称',
  61. reddOnly:true,
  62. allowBlank: false
  63. },{
  64. xtype: 'textfield',
  65. name: 'pr_spec',
  66. fieldLabel: '产品规格',
  67. reddOnly:true,
  68. },{
  69. xtype: 'hidden',
  70. name: 'bo_statuscode',
  71. fieldLabel: '状态码'
  72. },{
  73. xtype: 'textfield',
  74. name: 'bo_version',
  75. fieldLabel: '版本',
  76. allowBlank: false
  77. }, {
  78. xtype : "detailGridField",
  79. detnoColumn: 'bd_detno',
  80. showCount: false,
  81. storeModel:'saas.model.document.bomdetail',
  82. deleteDetailUrl:'/api/document/bom/deleteDetail',
  83. columns : [
  84. {
  85. text : "ID",
  86. dataIndex : "id",
  87. hidden : true,
  88. xtype : "numbercolumn"
  89. },
  90. {
  91. text : "关联ID",
  92. dataIndex : "bd_bomid",
  93. hidden : true,
  94. xtype : "numbercolumn"
  95. },
  96. {
  97. allowBlank:false,
  98. text : "物料编号",
  99. dataIndex : "bd_soncode",
  100. width : 150,
  101. editor : {
  102. displayField : "display",
  103. editable : true,
  104. format : "",
  105. hideTrigger : false,
  106. maxLength : 100.0,
  107. minValue : null,
  108. positiveNum : false,
  109. queryMode : "local",
  110. store : null,
  111. valueField : "value",
  112. xtype : "productMultiDbfindTrigger"
  113. }
  114. }, {
  115. allowBlank:false,
  116. text : "物料ID",
  117. hidden : true,
  118. dataIndex : "bd_sonid",
  119. },{
  120. text: 'model映射需要',
  121. dataIndex: 'productDTO',
  122. hidden: true,
  123. }, {
  124. text : "物料名称",
  125. dataIndex : "pr_detail",
  126. width : 200,
  127. ignore:true,
  128. renderer: function (v, m, r) {
  129. if(!v){
  130. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  131. }
  132. return v;
  133. }
  134. }, {
  135. text : "物料规格",
  136. dataIndex : "pr_spec",
  137. width : 150,
  138. ignore:true,
  139. renderer: function (v, m, r) {
  140. if(!v){
  141. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  142. }
  143. return v;
  144. }
  145. }, {
  146. text : "单位",
  147. dataIndex : "bd_unit",
  148. width : 80
  149. },
  150. {
  151. allowBlank:false,
  152. text : "用量",
  153. width : 80,
  154. dataIndex : "bd_baseqty",
  155. editor : {
  156. xtype : "numberfield",
  157. decimalPrecision: 0,
  158. minValue:0,
  159. maxLength: 10,
  160. listeners: {
  161. change: function(f, v) {
  162. if((v+'').length > 10) {
  163. f.setValue(Number((v+'').substr(0, 10)));
  164. }
  165. }
  166. }
  167. },
  168. renderer : function(v) {
  169. var arr = (v + '.').split('.');
  170. var xr = (new Array(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 : "bd_replace",
  177. width : 250,
  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 : "productMultiDbfindTrigger"
  190. }
  191. }, {
  192. text : "备注",
  193. dataIndex : "bd_remark",
  194. width : 250,
  195. items : null,
  196. editor : {
  197. xtype : "textfield"
  198. },
  199. }]
  200. },{
  201. xtype: 'textfield',
  202. name: 'bo_status',
  203. fieldLabel: '产品状态',
  204. reddOnly:true
  205. },{
  206. xtype : "textfield",
  207. name : "creatorName",
  208. reddOnly:true,
  209. fieldLabel : "录入人"
  210. },{
  211. xtype : "datefield",
  212. name : "createTime",
  213. fieldLabel : "录入时间"
  214. }],
  215. auditTexts: {
  216. auditCode: 'BANNED',
  217. auditText: '已禁用',
  218. unAuditCode: 'ENABLE',
  219. unAuditText: '已启用',
  220. auditBtnText: '禁用',
  221. unAuditBtnText: '启用',
  222. }
  223. });