FormPanel.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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: 'bo_mothercode',
  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. codeInHeader: false,
  20. defaultButtons:[{
  21. cls: 'x-formpanel-btn-orange',
  22. xtype: 'button',
  23. text: '新增',
  24. bind: {
  25. hidden: '{!id}'
  26. },
  27. handler: 'add'
  28. }, {
  29. xtype: 'button',
  30. text: '保存',
  31. handler: 'onSave'
  32. }, {
  33. xtype: 'button',
  34. text: '删除',
  35. handler: 'delete'
  36. }, {
  37. xtype: 'button',
  38. bind: {
  39. text: '{auditBtnText}'
  40. },
  41. handler: "auditBtnClick",
  42. }],
  43. defaultItems: [{
  44. xtype: 'hidden',
  45. name: 'id',
  46. fieldLabel: 'id',
  47. },{
  48. xtype: 'hidden',
  49. name: 'bo_motherid',
  50. fieldLabel: '产品id'
  51. },{
  52. xtype : "dbfindtrigger",
  53. name: 'bo_mothercode',
  54. fieldLabel: '产品编号',
  55. allowBlank: false
  56. },{
  57. xtype: 'textfield',
  58. name: 'bo_mothername',
  59. fieldLabel: '产品名称',
  60. allowBlank: false
  61. },{
  62. xtype: 'textfield',
  63. name: 'pr_spec',
  64. fieldLabel: '产品规格',
  65. reddOnly:true,
  66. ignore:true
  67. },{
  68. xtype: 'textfield',
  69. name: 'bo_status',
  70. fieldLabel: '产品状态'
  71. },{
  72. xtype: 'hidden',
  73. name: 'bo_statuscode',
  74. fieldLabel: '状态码'
  75. },{
  76. xtype: 'textfield',
  77. name: 'bo_version',
  78. fieldLabel: '版本'
  79. }, {
  80. xtype : "detailGridField",
  81. detnoColumn: 'bd_detno',
  82. showCount: false,
  83. storeModel:'saas.model.document.bomdetail',
  84. deleteDetailUrl:'/api/document/bom/deleteDetail/',
  85. columns : [
  86. {
  87. text : "ID",
  88. dataIndex : "id",
  89. hidden : true,
  90. xtype : "numbercolumn"
  91. },
  92. {
  93. text : "关联ID",
  94. dataIndex : "bd_bomid",
  95. hidden : true,
  96. xtype : "numbercolumn"
  97. },
  98. {
  99. allowBlank:false,
  100. text : "物料编号",
  101. dataIndex : "bd_soncode",
  102. editor : {
  103. displayField : "display",
  104. editable : true,
  105. format : "",
  106. hideTrigger : false,
  107. maxLength : 100.0,
  108. minValue : null,
  109. positiveNum : false,
  110. queryMode : "local",
  111. store : null,
  112. valueField : "value",
  113. xtype : "multidbfindtrigger"
  114. }
  115. }, {
  116. allowBlank:false,
  117. text : "物料ID",
  118. hidden : true,
  119. dataIndex : "bd_sonid",
  120. },{
  121. text: 'model映射需要',
  122. dataIndex: 'productDTO',
  123. hidden: true,
  124. }, {
  125. text : "物料名称",
  126. dataIndex : "pr_detail",
  127. ignore:true,
  128. renderer: function (v, m, r) {
  129. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
  130. }
  131. }, {
  132. text : "物料规格",
  133. dataIndex : "pr_spec",
  134. ignore:true,
  135. renderer: function (v, m, r) {
  136. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:v;
  137. }
  138. }, {
  139. allowBlank:false,
  140. text : "单位",
  141. editor : {
  142. xtype : "textfield"
  143. },
  144. dataIndex : "bd_unit",
  145. },
  146. {
  147. allowBlank:false,
  148. text : "用量",
  149. dataIndex : "bd_baseqty",
  150. editor : {
  151. xtype : "numberfield",
  152. decimalPrecision: 3,
  153. minValue:0
  154. },
  155. renderer : function(v) {
  156. var arr = (v + '.').split('.');
  157. var xr = (new Array(arr[1].length)).fill('0');
  158. var format = '0.' + xr.join();
  159. return Ext.util.Format.number(v, format);
  160. }
  161. }, {
  162. text : "替代料",
  163. dataIndex : "bd_replace",
  164. editor : {
  165. displayField : "display",
  166. editable : true,
  167. format : "",
  168. hideTrigger : false,
  169. maxLength : 100.0,
  170. minValue : null,
  171. positiveNum : false,
  172. queryMode : "local",
  173. store : null,
  174. valueField : "value",
  175. xtype : "multidbfindtrigger"
  176. }
  177. }, {
  178. text : "备注",
  179. dataIndex : "bd_remark",
  180. width : 250,
  181. items : null,
  182. editor : {
  183. xtype : "textfield"
  184. },
  185. }]
  186. },{
  187. xtype : "datefield",
  188. name : "createTime",
  189. fieldLabel : "创建时间"
  190. },{
  191. xtype : "datefield",
  192. name : "updateTime",
  193. fieldLabel : "更新时间"
  194. }],
  195. auditTexts: {
  196. auditCode: 'CLOSE',
  197. auditText: '已关闭',
  198. unAuditCode: 'OPEN',
  199. unAuditText: '已开启',
  200. auditBtnText: '禁用',
  201. unAuditBtnText: '启用',
  202. }
  203. });