FormPanel.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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 : 160,
  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. 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. ignore:true,
  137. renderer: function (v, m, r) {
  138. if(!v){
  139. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  140. }
  141. return v;
  142. }
  143. }, {
  144. text : "单位",
  145. dataIndex : "bd_unit",
  146. },
  147. {
  148. allowBlank:false,
  149. text : "用量",
  150. dataIndex : "bd_baseqty",
  151. editor : {
  152. xtype : "numberfield",
  153. decimalPrecision: 0,
  154. minValue:0
  155. },
  156. renderer : function(v) {
  157. var arr = (v + '.').split('.');
  158. var xr = (new Array(arr[1].length)).fill('0');
  159. var format = '0.' + xr.join();
  160. return Ext.util.Format.number(v, format);
  161. }
  162. }, {
  163. text : "替代料",
  164. dataIndex : "bd_replace",
  165. editor : {
  166. displayField : "display",
  167. editable : true,
  168. format : "",
  169. hideTrigger : false,
  170. maxLength : 100.0,
  171. minValue : null,
  172. positiveNum : false,
  173. queryMode : "local",
  174. store : null,
  175. valueField : "value",
  176. xtype : "productMultiDbfindTrigger"
  177. }
  178. }, {
  179. text : "备注",
  180. dataIndex : "bd_remark",
  181. width : 250,
  182. items : null,
  183. editor : {
  184. xtype : "textfield"
  185. },
  186. }]
  187. },{
  188. xtype: 'textfield',
  189. name: 'bo_status',
  190. fieldLabel: '产品状态',
  191. reddOnly:true
  192. },{
  193. xtype : "textfield",
  194. name : "bo_recorder",
  195. reddOnly:true,
  196. fieldLabel : "录入人"
  197. },{
  198. xtype : "datefield",
  199. name : "bo_recorddate",
  200. fieldLabel : "录入时间"
  201. }],
  202. auditTexts: {
  203. auditCode: 'CLOSE',
  204. auditText: '已关闭',
  205. unAuditCode: 'OPEN',
  206. unAuditText: '已开启',
  207. auditBtnText: '禁用',
  208. unAuditBtnText: '启用',
  209. }
  210. });