FormPanel.js 6.8 KB

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