FormPanel.js 6.2 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. 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: 'hidden',
  70. name: 'bo_statuscode',
  71. fieldLabel: '状态码'
  72. },{
  73. xtype: 'textfield',
  74. name: 'bo_version',
  75. fieldLabel: '版本'
  76. }, {
  77. xtype : "detailGridField",
  78. detnoColumn: 'bd_detno',
  79. showCount: false,
  80. storeModel:'saas.model.document.bomdetail',
  81. deleteDetailUrl:'/api/document/bom/deleteDetail/',
  82. columns : [
  83. {
  84. text : "ID",
  85. dataIndex : "id",
  86. hidden : true,
  87. xtype : "numbercolumn"
  88. },
  89. {
  90. text : "关联ID",
  91. dataIndex : "bd_bomid",
  92. hidden : true,
  93. xtype : "numbercolumn"
  94. },
  95. {
  96. allowBlank:false,
  97. text : "物料编号",
  98. dataIndex : "bd_soncode",
  99. width : 160,
  100. editor : {
  101. displayField : "display",
  102. editable : true,
  103. format : "",
  104. hideTrigger : false,
  105. maxLength : 100.0,
  106. minValue : null,
  107. positiveNum : false,
  108. queryMode : "local",
  109. store : null,
  110. valueField : "value",
  111. xtype : "multidbfindtrigger"
  112. }
  113. }, {
  114. allowBlank:false,
  115. text : "物料ID",
  116. hidden : true,
  117. dataIndex : "bd_sonid",
  118. },{
  119. text: 'model映射需要',
  120. dataIndex: 'productDTO',
  121. hidden: true,
  122. }, {
  123. text : "物料名称",
  124. dataIndex : "pr_detail",
  125. ignore:true,
  126. renderer: function (v, m, r) {
  127. if(!v){
  128. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  129. }
  130. return v;
  131. }
  132. }, {
  133. text : "物料规格",
  134. dataIndex : "pr_spec",
  135. ignore:true,
  136. renderer: function (v, m, r) {
  137. if(!v){
  138. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  139. }
  140. return v;
  141. }
  142. }, {
  143. text : "单位",
  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: 'textfield',
  188. name: 'bo_status',
  189. fieldLabel: '产品状态',
  190. reddOnly:true
  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. });