BrandInApply.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. Ext.define('erp.view.b2c.BrandInApply',{
  2. extend: 'Ext.Viewport',
  3. layout: 'fit',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. formCondition = getUrlParam('formCondition');
  8. Ext.apply(me, {
  9. items: [{
  10. id:'BrandInApplyViewport',
  11. layout: 'anchor',
  12. bodyStyle: 'background: #f1f1f1;',
  13. items: [{
  14. xtype: 'form',
  15. id:'form',
  16. autoScroll:true,
  17. anchor: '100% 100%',
  18. codeField:'br_code',
  19. keyField:'br_id',
  20. statusField:'br_status',
  21. statuscodeField:'br_statuscode',
  22. getIdUrl: 'common/getId.action?seq=BRANDINAPPLY_SEQ',
  23. submitUrl: 'b2c/product/submitBrandInApply.action',
  24. resSubmitUrl: 'b2c/product/resSubmitBrandInApply.action',
  25. auditUrl: 'b2c/product/auditBrandInApply.action',
  26. resAuditUrl: 'b2c/product/resAuditBrandInApply.action',
  27. tablename:'BrandInApply',
  28. title:'品牌入库申请',
  29. bodyPadding:'5 0 0 30',
  30. bodyStyle: 'background: #f1f1f1;',
  31. defaults:{
  32. xtype:'textfield',
  33. beforeLabelTextTpl: [
  34. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  35. ],
  36. labelStyle:"color:red;"
  37. },
  38. items:[{
  39. xtype:"container",
  40. html:'<div class="x-form-group-label" id="group1" style="background-color: #bfbfbe;height:22px!important;" title="收拢"><h6>品牌基本信息</h6></div>',
  41. style:"padding-bottom: 4px;"
  42. //onclick="javascript:collapse(1);"
  43. },{
  44. name:'br_name',
  45. id:'br_name',
  46. fieldLabel:'名称',
  47. width:400,
  48. allowBlank : false,
  49. beforeLabelTextTpl: [
  50. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  51. ],
  52. group:1,
  53. groupName:"品牌基本信息"
  54. },{
  55. name:'br_vendor',
  56. id:'br_vendor',
  57. fieldLabel:'厂商',
  58. width:1000,
  59. allowBlank : false,
  60. group:1,
  61. groupName:"品牌基本信息"
  62. },{
  63. name:'br_logourl',
  64. id:'br_logourl',
  65. hidden:true,
  66. allowBlank:false
  67. },{
  68. id:'fileform',
  69. xtype:'form',
  70. bodyStyle: 'background: transparent no-repeat 0 0;border: none;',
  71. items:[{
  72. name:'br_logo',
  73. id:'br_logo',
  74. xtype: 'filefield',
  75. labelStyle:"color:red;",
  76. columnWidth:1,
  77. name: 'file',
  78. fieldLabel:'Logo',
  79. //fieldLabel:'<div style="color:blue;padding-left:10px;">品牌Logo,建议图片尺寸在150*90像素左右</div>',
  80. //allowBlank: false,
  81. buttonOnly:true,
  82. group:1,
  83. groupName:"品牌基本信息",
  84. buttonConfig:{
  85. text:'选择图片',
  86. iconCls:'x-button-icon-pic'
  87. },
  88. listeners: {
  89. change: function(field){
  90. field.ownerCt.upload(field);
  91. }
  92. }
  93. },{
  94. xtype: 'image',
  95. width: 155,
  96. height: 96,
  97. id:'logo',
  98. hidden:true,
  99. margin:'5 0 10 110'
  100. }],
  101. upload: function(field){
  102. if(field.ownerCt.down('image').hidden){
  103. field.ownerCt.getForm().submit({
  104. url: basePath + 'b2c/product/saveBrandLogo.action',
  105. waitMsg:'正在上传',
  106. success: function(fp, o){
  107. if(o.result.success){
  108. Ext.Msg.alert('提示','上传成功');
  109. var logo=Ext.getCmp('logo');
  110. logo.show();
  111. logo.setSrc(o.result.filepath);
  112. Ext.getCmp('br_logourl').setValue(o.result.filepath);
  113. }else Ext.Msg.alert('提示','上传失败,请检查文件大小及格式!');
  114. },
  115. failure:function(fp,o){
  116. Ext.Msg.alert('提示','上传失败,请检查文件大小及格式!');
  117. }
  118. });
  119. }
  120. }
  121. },{
  122. xtype:'htmleditor',
  123. fieldLabel:'简介',
  124. id:'br_brief',
  125. name:'br_brief',
  126. width:1000,
  127. allowBlank: false,
  128. group:1,
  129. groupName:"品牌基本信息"
  130. },{
  131. xtype : 'fieldcontainer',
  132. fieldLabel : '区域',
  133. defaultType: 'radiofield',
  134. allowBlank: false,
  135. group:1,
  136. groupName:"品牌基本信息",
  137. defaults: {
  138. flex: 1
  139. },
  140. layout: 'hbox',
  141. items: [
  142. {
  143. boxLabel : '大陆',
  144. name : 'br_area',
  145. inputValue: '大陆',
  146. id : 'radio1'
  147. }, {
  148. boxLabel : '港澳台',
  149. name : 'br_area',
  150. inputValue: '港澳台',
  151. id : 'radio2'
  152. }, {
  153. boxLabel : '日韩',
  154. name : 'br_area',
  155. inputValue: '日韩',
  156. id : 'radio3'
  157. }, {
  158. boxLabel : '欧美',
  159. name : 'br_area',
  160. inputValue: '欧美',
  161. id : 'radio4'
  162. }, {
  163. boxLabel : '其它',
  164. name : 'br_area',
  165. inputValue: '其它',
  166. id : 'radio5'
  167. }
  168. ]
  169. },{
  170. xtype:"container",
  171. html:'<div class="x-form-group-label" id="group2" style="background-color: #bfbfbe;height:22px!important;" title="收拢"><h6>品牌应用</h6></div>',
  172. style:"padding-bottom: 4px;"
  173. //onclick="javascript:collapse(2);"
  174. },{
  175. name:'br_series',
  176. id:'br_series',
  177. fieldLabel:'主打产品',
  178. xtype:'textareafield',
  179. grow : true,
  180. width:1000,
  181. heigth:100,
  182. allowBlank: false,
  183. group:2,
  184. groupName:"品牌应用"
  185. },{
  186. xtype: 'checkboxgroup',
  187. fieldLabel: '应用领域',
  188. //defaultType: 'checkboxfield',
  189. //allowBlank: false,
  190. group:2,
  191. groupName:"品牌应用",
  192. id:'br_application',
  193. defaults: {
  194. flex: 1
  195. },
  196. layout: 'hbox',
  197. items: [
  198. {
  199. boxLabel : '移动手持',
  200. name : 'br_application',
  201. inputValue: '移动手持',
  202. id : 'checkbox1'
  203. }, {
  204. boxLabel : '医疗电子',
  205. name : 'br_application',
  206. inputValue: '医疗电子',
  207. id : 'checkbox2'
  208. }, {
  209. boxLabel : '消费电子',
  210. name : 'br_application',
  211. inputValue: '消费电子',
  212. id : 'checkbox3'
  213. }, {
  214. boxLabel : '通信网络',
  215. name : 'br_application',
  216. inputValue: '通信网络',
  217. id : 'checkbox4'
  218. }, {
  219. boxLabel : '汽车电子',
  220. name : 'br_application',
  221. inputValue: '汽车电子',
  222. id : 'checkbox5'
  223. }, {
  224. boxLabel : '能源控制',
  225. name : 'br_application',
  226. inputValue: '能源控制',
  227. id : 'checkbox6'
  228. }, {
  229. boxLabel : '家用电器',
  230. name : 'br_application',
  231. inputValue: '家用电器',
  232. id : 'checkbox7'
  233. }, {
  234. boxLabel : '工业控制',
  235. name : 'br_application',
  236. inputValue: '工业控制',
  237. id : 'checkbox8'
  238. }, {
  239. boxLabel : '安防监控',
  240. name : 'br_application',
  241. inputValue: '安防监控',
  242. id : 'checkbox9'
  243. }
  244. ]
  245. },{
  246. xtype: 'fieldcontainer',
  247. margin:'5 0 10 110',
  248. padding:'5 5 5 5',
  249. combineErrors: true,
  250. group:2,
  251. groupName:"品牌应用",
  252. msgTarget: 'under',
  253. defaults: {
  254. hideLabel: true
  255. },
  256. items: [{
  257. layout:'column',
  258. bodyStyle: 'background: #f1f1f1;border:none',
  259. items:[{
  260. xtype:'button',
  261. text: '其他领域',
  262. cls: 'x-dd-drop-ok-add',
  263. iconCls: 'x-dd-drop-icon',
  264. columnWidth:0.1,
  265. handler:function(btn){
  266. var f = btn.ownerCt;
  267. f.insert(f.items.length, {
  268. xtype:'triggerfield',
  269. name: 'otherApplication',
  270. columnWidth:.40,
  271. style:'margin-left:5px;',
  272. triggerCls : Ext.baseCSSPrefix + "form-clear-trigger",
  273. onTriggerClick:function(){
  274. this.ownerCt.remove(this);
  275. }
  276. });
  277. }
  278. },{
  279. xtype: 'displayfield',
  280. columnWidth:0.9,
  281. value: '如果您的品牌应用领域不在上述范围,您可以手动添加其他领域'
  282. }]
  283. }]
  284. },{
  285. xtype:'htmleditor',
  286. name:'br_achievement',
  287. id:'br_achievement',
  288. fieldLabel:'主要成就',
  289. width:1000,
  290. allowBlank: false,
  291. group:2,
  292. groupName:"品牌应用"
  293. },{
  294. id:'br_id',
  295. name:'br_id',
  296. hidden:true
  297. },{
  298. id:'br_code',
  299. name:'br_code',
  300. hidden:true
  301. },{
  302. id:'br_date',
  303. name:'br_date',
  304. xytpe:'datefield',
  305. defaultvalue:new Date(),
  306. hidden:true
  307. },{
  308. id:'br_indate',
  309. name:'br_indate',
  310. xytpe:'datefield',
  311. value:new Date(),
  312. hidden:true
  313. },{
  314. id:'br_recorder',
  315. name:'br_recorder',
  316. hidden:true
  317. },{
  318. id:'br_status',
  319. name:'br_status',
  320. value:'在录入',
  321. hidden:true
  322. },{
  323. id:'br_statuscode',
  324. name:'br_statuscode',
  325. value:'',
  326. hidden:true
  327. },{
  328. id:'br_auditman',
  329. name:'br_auditman',
  330. hidden:true
  331. },{
  332. id:'br_auditdate',
  333. name:'br_auditdate',
  334. hidden:true
  335. }] ,
  336. buttonAlign:'center',
  337. buttons:[{
  338. xtype:'erpSaveButton',
  339. hidden:_nobutton==1 || !Ext.isEmpty(formCondition)
  340. },{
  341. xtype:'erpUpdateButton',
  342. hidden:_nobutton==1 || Ext.isEmpty(formCondition)
  343. },{
  344. xtype:'erpSubmitButton',
  345. hidden:_nobutton==1 || Ext.isEmpty(formCondition)
  346. },{
  347. xtype:'erpResSubmitButton',
  348. hidden:_nobutton==1 || Ext.isEmpty(formCondition)
  349. },{
  350. xtype:'erpAuditButton',
  351. hidden:_nobutton==1 || Ext.isEmpty(formCondition)
  352. },{
  353. xtype:'erpResAuditButton',
  354. hidden:_nobutton==1 || Ext.isEmpty(formCondition)
  355. }]
  356. }]
  357. }]
  358. });
  359. me.getData();
  360. me.callParent(arguments);
  361. },
  362. getData:function(){
  363. //从url解析参数
  364. if(formCondition != null && formCondition != ''){
  365. formCondition = (formCondition == null) ? "" : formCondition.replace(/IS/g,"=");
  366. var me = this;
  367. this.setLoading(true);
  368. Ext.Ajax.request({
  369. url : basePath + 'b2c/product/getBrandData.action',
  370. params: {
  371. caller: caller,
  372. id: formCondition.split("=")[1],
  373. _noc: (getUrlParam('_noc') || me._noc)
  374. },
  375. method : 'post',
  376. callback : function(options,success,response){
  377. me.setLoading(false);
  378. var res = new Ext.decode(response.responseText);
  379. if(res.exceptionInfo != null){
  380. showError(res.exceptionInfo);return;
  381. }else{
  382. var form = Ext.getCmp('form');
  383. var o = {};
  384. o.br_application = res.data.br_application.split(",");
  385. res.data.br_application = o;
  386. form.getForm().setValues(res.data);
  387. if(res.data.br_logourl){
  388. var logo=Ext.getCmp('logo');
  389. logo.show();
  390. logo.setSrc(res.data.br_logourl);
  391. }
  392. if(res.data.br_statuscode = 'AUDITED'){
  393. form.readOnly = true;
  394. }
  395. }
  396. }
  397. });
  398. }
  399. }
  400. });