FormPanel.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. _deleteMsg: '删除的BOM资料将不能恢复,请确认是否删除?',
  20. codeInHeader: false,
  21. defaultButtons:[{
  22. cls: 'x-formpanel-btn-blue',
  23. xtype: 'button',
  24. text: '新增',
  25. bind: {
  26. hidden: '{!id}'
  27. },
  28. handler: 'add'
  29. }, {
  30. xtype: 'button',
  31. text: '保存',
  32. handler: 'onSave'
  33. }, {
  34. xtype: 'button',
  35. text: '删除',
  36. handler: 'delete'
  37. }, {
  38. xtype: 'button',
  39. bind: {
  40. text: '{auditBtnText}'
  41. },
  42. handler: "auditBtnClick",
  43. }],
  44. defaultItems: [{
  45. xtype: 'hidden',
  46. name: 'id',
  47. fieldLabel: 'id',
  48. },{
  49. xtype: 'hidden',
  50. name: 'bo_motherid',
  51. fieldLabel: '产品id'
  52. },{
  53. xtype : "productDbfindTrigger",
  54. name: 'bo_mothercode',
  55. fieldLabel: '产品编号',
  56. allowBlank: false
  57. },{
  58. xtype: 'textfield',
  59. name: 'pr_brand',
  60. fieldLabel: '品牌',
  61. readOnly:true,
  62. },{
  63. xtype: 'textfield',
  64. name: 'bo_mothername',
  65. fieldLabel: '产品名称',
  66. readOnly:true,
  67. allowBlank: false
  68. },{
  69. xtype: 'textfield',
  70. name: 'pr_orispeccode',
  71. fieldLabel: '产品型号',
  72. readOnly:true,
  73. },{
  74. xtype: 'textfield',
  75. name: 'pr_spec',
  76. fieldLabel: '产品规格',
  77. readOnly:true,
  78. ignore:true
  79. },{
  80. xtype: 'textfield',
  81. name: 'bo_version',
  82. fieldLabel: '版本',
  83. allowBlank: false
  84. }, {
  85. xtype : "detailGridField",
  86. detnoColumn: 'bd_detno',
  87. showCount: false,
  88. storeModel:'saas.model.document.bomdetail',
  89. deleteDetailUrl:'/api/document/bom/deleteDetail',
  90. columns : [
  91. {
  92. text : "ID",
  93. dataIndex : "id",
  94. hidden : true,
  95. xtype : "numbercolumn"
  96. },
  97. {
  98. text : "关联ID",
  99. dataIndex : "bd_bomid",
  100. hidden : true,
  101. xtype : "numbercolumn"
  102. },
  103. {
  104. allowBlank:false,
  105. text : "物料编号",
  106. dataIndex : "bd_soncode",
  107. width : 150,
  108. editor : {
  109. displayField : "display",
  110. editable : true,
  111. format : "",
  112. hideTrigger : false,
  113. maxLength : 100.0,
  114. minValue : null,
  115. positiveNum : false,
  116. queryMode : "local",
  117. store : null,
  118. valueField : "value",
  119. xtype : "productMultiDbfindTrigger"
  120. }
  121. }, {
  122. allowBlank:false,
  123. text : "物料ID",
  124. hidden : true,
  125. dataIndex : "bd_sonid",
  126. },{
  127. text: 'model映射需要',
  128. dataIndex: 'productDTO',
  129. hidden: true,
  130. },
  131. {
  132. text : "品牌",
  133. width : 150.0,
  134. dataIndex : "pr_brand",
  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. {
  144. text : "名称",
  145. width : 200.0,
  146. dataIndex : "pr_detail",
  147. ignore:true,
  148. renderer: function (v, m, r) {
  149. if(!v){
  150. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  151. }
  152. return v;
  153. }
  154. },
  155. {
  156. text : "型号",
  157. width : 200.0,
  158. dataIndex : "pr_orispeccode",
  159. ignore:true,
  160. renderer: function (v, m, r) {
  161. if(!v){
  162. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  163. }
  164. return v;
  165. }
  166. },{
  167. text : "规格",
  168. width : 150,
  169. dataIndex : "pr_spec",
  170. ignore:true,
  171. renderer: function (v, m, r) {
  172. if(!v){
  173. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  174. }
  175. return v;
  176. }
  177. },{
  178. text : "单位",
  179. dataIndex : "bd_unit",
  180. width : 80
  181. },
  182. {
  183. allowBlank:false,
  184. text : "用量",
  185. width : 80,
  186. dataIndex : "bd_baseqty",
  187. editor : {
  188. xtype : "numberfield",
  189. decimalPrecision: 3,
  190. minValue:0,
  191. maxLength: 10,
  192. },
  193. renderer : function(v) {
  194. var arr = (v + '.').split('.');
  195. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  196. var format = '0.' + xr.join('');
  197. return Ext.util.Format.number(v, format);
  198. }
  199. }, {
  200. text : "替代料",
  201. dataIndex : "bd_replace",
  202. width : 250,
  203. editor : {
  204. displayField : "display",
  205. editable : true,
  206. format : "",
  207. hideTrigger : false,
  208. maxLength : 100.0,
  209. minValue : null,
  210. positiveNum : false,
  211. queryMode : "local",
  212. store : null,
  213. valueField : "value",
  214. xtype : "productAddMultiDbfindTrigger"
  215. }
  216. }, {
  217. text : "备注",
  218. dataIndex : "bd_remark",
  219. width : 250,
  220. items : null,
  221. editor : {
  222. xtype : "textfield"
  223. },
  224. }]
  225. }, {
  226. xtype: 'hidden',
  227. name: 'bo_statuscode',
  228. fieldLabel: '状态码',
  229. readOnly:true,
  230. defaultValue: ''
  231. }, {
  232. xtype: 'textfield',
  233. name: 'bo_status',
  234. fieldLabel: '产品状态',
  235. readOnly:true,
  236. defaultValue: ''
  237. },{
  238. xtype : "textfield",
  239. name : "creatorName",
  240. readOnly:true,
  241. fieldLabel : "录入人"
  242. },{
  243. xtype : "datefield",
  244. name : "createTime",
  245. fieldLabel : "录入时间"
  246. }],
  247. auditTexts: {
  248. auditCode: 'BANNED',
  249. auditText: '已禁用',
  250. unAuditCode: 'ENABLE',
  251. unAuditText: '已启用',
  252. auditBtnText: '禁用',
  253. unAuditBtnText: '启用',
  254. }
  255. });