FormPanel.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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: 'codefield',
  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 : "物料名称",
  122. dataIndex : "pr_detail",
  123. ignore:true,
  124. renderer: function (v, m, r) {
  125. if(!v){
  126. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  127. }
  128. return v;
  129. }
  130. }, {
  131. text : "物料规格",
  132. dataIndex : "pr_spec",
  133. ignore:true,
  134. renderer: function (v, m, r) {
  135. if(!v){
  136. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  137. }
  138. return v;
  139. }
  140. }, {
  141. allowBlank:false,
  142. text : "单位",
  143. editor : {
  144. xtype : "textfield"
  145. },
  146. dataIndex : "bd_unit",
  147. },
  148. {
  149. allowBlank:false,
  150. text : "用量",
  151. dataIndex : "bd_baseqty",
  152. editor : {
  153. xtype : "numberfield",
  154. decimalPrecision: 3,
  155. minValue:0
  156. },
  157. renderer : function(v) {
  158. var arr = (v + '.').split('.');
  159. var xr = (new Array(arr[1].length)).fill('0');
  160. var format = '0.' + xr.join();
  161. return Ext.util.Format.number(v, format);
  162. }
  163. }, {
  164. text : "替代料",
  165. dataIndex : "bd_replace",
  166. editor : {
  167. displayField : "display",
  168. editable : true,
  169. format : "",
  170. hideTrigger : false,
  171. maxLength : 100.0,
  172. minValue : null,
  173. positiveNum : false,
  174. queryMode : "local",
  175. store : null,
  176. valueField : "value",
  177. xtype : "multidbfindtrigger"
  178. }
  179. }, {
  180. text : "备注",
  181. dataIndex : "bd_remark",
  182. width : 250,
  183. items : null,
  184. editor : {
  185. xtype : "textfield"
  186. },
  187. }]
  188. },{
  189. xtype : "datefield",
  190. name : "createTime",
  191. fieldLabel : "创建时间"
  192. },{
  193. xtype : "datefield",
  194. name : "updateTime",
  195. fieldLabel : "更新时间"
  196. }],
  197. auditTexts: {
  198. auditCode: 'CLOSE',
  199. auditText: '已关闭',
  200. unAuditCode: 'OPEN',
  201. unAuditText: '已开启',
  202. auditBtnText: '禁用',
  203. unAuditBtnText: '启用',
  204. }
  205. });