FormPanel.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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-orange',
  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. ignore:true
  69. },{
  70. xtype: 'hidden',
  71. name: 'bo_statuscode',
  72. fieldLabel: '状态码'
  73. },{
  74. xtype: 'textfield',
  75. name: 'bo_version',
  76. fieldLabel: '版本'
  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. },
  160. renderer : function(v) {
  161. var arr = (v + '.').split('.');
  162. var xr = (new Array(arr[1].length)).fill('0');
  163. var format = '0.' + xr.join();
  164. return Ext.util.Format.number(v, format);
  165. }
  166. }, {
  167. text : "替代料",
  168. dataIndex : "bd_replace",
  169. width : 250,
  170. editor : {
  171. displayField : "display",
  172. editable : true,
  173. format : "",
  174. hideTrigger : false,
  175. maxLength : 100.0,
  176. minValue : null,
  177. positiveNum : false,
  178. queryMode : "local",
  179. store : null,
  180. valueField : "value",
  181. xtype : "productMultiDbfindTrigger"
  182. }
  183. }, {
  184. text : "备注",
  185. dataIndex : "bd_remark",
  186. width : 250,
  187. items : null,
  188. editor : {
  189. xtype : "textfield"
  190. },
  191. }]
  192. },{
  193. xtype: 'textfield',
  194. name: 'bo_status',
  195. fieldLabel: '产品状态',
  196. reddOnly:true
  197. },{
  198. xtype : "textfield",
  199. name : "creatorName",
  200. reddOnly:true,
  201. fieldLabel : "录入人"
  202. },{
  203. xtype : "datefield",
  204. name : "createTime",
  205. fieldLabel : "录入时间"
  206. }],
  207. auditTexts: {
  208. auditCode: 'CLOSE',
  209. auditText: '已关闭',
  210. unAuditCode: 'OPEN',
  211. unAuditText: '已开启',
  212. auditBtnText: '禁用',
  213. unAuditBtnText: '启用',
  214. }
  215. });