FormPanel.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. 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. reddOnly:true,
  61. allowBlank: false
  62. },{
  63. xtype: 'textfield',
  64. name: 'pr_spec',
  65. fieldLabel: '产品规格',
  66. reddOnly:true,
  67. ignore:true
  68. },{
  69. xtype: 'textfield',
  70. name: 'bo_status',
  71. fieldLabel: '产品状态',
  72. reddOnly:true
  73. },{
  74. xtype: 'hidden',
  75. name: 'bo_statuscode',
  76. fieldLabel: '状态码'
  77. },{
  78. xtype: 'textfield',
  79. name: 'bo_version',
  80. fieldLabel: '版本'
  81. }, {
  82. xtype : "detailGridField",
  83. detnoColumn: 'bd_detno',
  84. showCount: false,
  85. storeModel:'saas.model.document.bomdetail',
  86. deleteDetailUrl:'/api/document/bom/deleteDetail/',
  87. columns : [
  88. {
  89. text : "ID",
  90. dataIndex : "id",
  91. hidden : true,
  92. xtype : "numbercolumn"
  93. },
  94. {
  95. text : "关联ID",
  96. dataIndex : "bd_bomid",
  97. hidden : true,
  98. xtype : "numbercolumn"
  99. },
  100. {
  101. allowBlank:false,
  102. text : "物料编号",
  103. dataIndex : "bd_soncode",
  104. width : 160,
  105. editor : {
  106. displayField : "display",
  107. editable : true,
  108. format : "",
  109. hideTrigger : false,
  110. maxLength : 100.0,
  111. minValue : null,
  112. positiveNum : false,
  113. queryMode : "local",
  114. store : null,
  115. valueField : "value",
  116. xtype : "multidbfindtrigger"
  117. }
  118. }, {
  119. allowBlank:false,
  120. text : "物料ID",
  121. hidden : true,
  122. dataIndex : "bd_sonid",
  123. },{
  124. text: 'model映射需要',
  125. dataIndex: 'productDTO',
  126. hidden: true,
  127. }, {
  128. text : "物料名称",
  129. dataIndex : "pr_detail",
  130. ignore:true,
  131. renderer: function (v, m, r) {
  132. if(!v){
  133. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  134. }
  135. return v;
  136. }
  137. }, {
  138. text : "物料规格",
  139. dataIndex : "pr_spec",
  140. ignore:true,
  141. renderer: function (v, m, r) {
  142. if(!v){
  143. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  144. }
  145. return v;
  146. }
  147. }, {
  148. text : "单位",
  149. dataIndex : "bd_unit",
  150. },
  151. {
  152. allowBlank:false,
  153. text : "用量",
  154. dataIndex : "bd_baseqty",
  155. editor : {
  156. xtype : "numberfield",
  157. decimalPrecision: 3,
  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. editor : {
  170. displayField : "display",
  171. editable : true,
  172. format : "",
  173. hideTrigger : false,
  174. maxLength : 100.0,
  175. minValue : null,
  176. positiveNum : false,
  177. queryMode : "local",
  178. store : null,
  179. valueField : "value",
  180. xtype : "multidbfindtrigger"
  181. }
  182. }, {
  183. text : "备注",
  184. dataIndex : "bd_remark",
  185. width : 250,
  186. items : null,
  187. editor : {
  188. xtype : "textfield"
  189. },
  190. }]
  191. },{
  192. xtype : "textfield",
  193. name : "bo_recorder",
  194. reddOnly:true,
  195. fieldLabel : "录入人"
  196. },{
  197. xtype : "datefield",
  198. name : "bo_recorddate",
  199. fieldLabel : "录入时间"
  200. }],
  201. auditTexts: {
  202. auditCode: 'CLOSE',
  203. auditText: '已关闭',
  204. unAuditCode: 'OPEN',
  205. unAuditText: '已开启',
  206. auditBtnText: '禁用',
  207. unAuditBtnText: '启用',
  208. }
  209. });