FormPanel.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. width : 160,
  103. editor : {
  104. displayField : "display",
  105. editable : true,
  106. format : "",
  107. hideTrigger : false,
  108. maxLength : 100.0,
  109. minValue : null,
  110. positiveNum : false,
  111. queryMode : "local",
  112. store : null,
  113. valueField : "value",
  114. xtype : "multidbfindtrigger"
  115. }
  116. }, {
  117. allowBlank:false,
  118. text : "物料ID",
  119. hidden : true,
  120. dataIndex : "bd_sonid",
  121. },{
  122. text: 'model映射需要',
  123. dataIndex: 'productDTO',
  124. hidden: true,
  125. }, {
  126. text : "物料名称",
  127. dataIndex : "pr_detail",
  128. ignore:true,
  129. renderer: function (v, m, r) {
  130. if(!v){
  131. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  132. }
  133. return v;
  134. }
  135. }, {
  136. text : "物料规格",
  137. dataIndex : "pr_spec",
  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. },
  149. {
  150. allowBlank:false,
  151. text : "用量",
  152. dataIndex : "bd_baseqty",
  153. editor : {
  154. xtype : "numberfield",
  155. decimalPrecision: 3,
  156. minValue:0
  157. },
  158. renderer : function(v) {
  159. var arr = (v + '.').split('.');
  160. var xr = (new Array(arr[1].length)).fill('0');
  161. var format = '0.' + xr.join();
  162. return Ext.util.Format.number(v, format);
  163. }
  164. }, {
  165. text : "替代料",
  166. dataIndex : "bd_replace",
  167. editor : {
  168. displayField : "display",
  169. editable : true,
  170. format : "",
  171. hideTrigger : false,
  172. maxLength : 100.0,
  173. minValue : null,
  174. positiveNum : false,
  175. queryMode : "local",
  176. store : null,
  177. valueField : "value",
  178. xtype : "multidbfindtrigger"
  179. }
  180. }, {
  181. text : "备注",
  182. dataIndex : "bd_remark",
  183. width : 250,
  184. items : null,
  185. editor : {
  186. xtype : "textfield"
  187. },
  188. }]
  189. },{
  190. xtype : "textfield",
  191. name : "bo_recorder",
  192. reddOnly:true,
  193. fieldLabel : "录入人"
  194. },{
  195. xtype : "datefield",
  196. name : "bo_recorddate",
  197. fieldLabel : "录入时间"
  198. }],
  199. auditTexts: {
  200. auditCode: 'CLOSE',
  201. auditText: '已关闭',
  202. unAuditCode: 'OPEN',
  203. unAuditText: '已开启',
  204. auditBtnText: '禁用',
  205. unAuditBtnText: '启用',
  206. }
  207. });