FormPanel.js 6.7 KB

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