SoftVersionLibForm.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. /**
  2. * softVersionLib的Form
  3. */
  4. Ext.define('erp.view.scm.product.SoftVersionLibForm',{
  5. extend: 'Ext.form.Panel',
  6. alias: 'widget.erpSoftVersionLibForm',
  7. id: 'form',
  8. title : '软件版本维护',
  9. frame : true,
  10. layout: 'column',
  11. autoScroll : true,
  12. defaultType : 'textfield',
  13. buttonAlign : 'center',
  14. cls: 'u-form-default',
  15. enableTools: true,
  16. fieldDefaults : {
  17. fieldStyle : "background:#FFFAFA;color:#515151;",
  18. focusCls: 'x-form-field-cir-focus',
  19. labelAlign : "right",
  20. msgTarget: 'side',
  21. blankText : $I18N.common.form.blankText
  22. },
  23. FormUtil: Ext.create('erp.util.FormUtil'),
  24. BaseUtil: Ext.create('erp.util.BaseUtil'),
  25. items : [{
  26. allowBlank:false,
  27. allowDecimals:false,
  28. cls:"form-field-allowBlank-hidden",
  29. columnWidth:0.25,
  30. dataIndex:"sl_id",
  31. editable:true,
  32. fieldLabel:"ID",
  33. fieldStyle:"background:#E0E0FF;color:#515151;",
  34. id:"sl_id",
  35. labelAlign:"left",
  36. name:"sl_id",
  37. readOnly:true,
  38. table:"SoftVersionLib",
  39. xtype:"hidden"
  40. },{
  41. allowBlank:false,
  42. cls:"form-field-allowBlank",
  43. columnWidth:0.25,
  44. dataIndex:"sl_code",
  45. editable:true,
  46. fieldLabel:"<font color='red'>版本号</font>",
  47. labelSeparator : "<font color='red'>:</font>",
  48. fieldStyle:"background:#FFFAFA;color:#515151;",
  49. id:"sl_code",
  50. labelAlign:"left",
  51. name:"sl_code",
  52. table:"SoftVersionLib",
  53. xtype:"textfield"
  54. },{
  55. allowBlank:false,
  56. cls:"form-field-allowBlank",
  57. columnWidth:0.25,
  58. dataIndex:"sl_name",
  59. editable:true,
  60. fieldLabel:"<font color='red'>版本名称</font>",
  61. labelSeparator : "<font color='red'>:</font>",
  62. fieldStyle:"background:#FFFAFA;color:#515151;",
  63. id:"sl_name",
  64. labelAlign:"left",
  65. name:"sl_name",
  66. table:"SoftVersionLib",
  67. xtype:"textfield"
  68. },{
  69. allowBlank:true,
  70. allowDecimals:false,
  71. cls:"form-field-allowBlank",
  72. columnWidth:0.25,
  73. dataIndex:"sl_platform",
  74. editable:true,
  75. fieldLabel:"平台",
  76. fieldStyle:"background:#FFFAFA;color:#515151;",
  77. labelSeparator : ":",
  78. id:"sl_platform",
  79. labelAlign:"left",
  80. name:"sl_platform",
  81. table:"SoftVersionLib",
  82. xtype:"textfield"
  83. },{
  84. cls:"form-field-allowBlank",
  85. columnWidth:0.25,
  86. dataIndex:"sl_status",
  87. editable:true,
  88. fieldLabel:"状态",
  89. labelSeparator : ":",
  90. fieldStyle:"background:#E0E0FF;color:#515151;",
  91. id:"sl_status",
  92. labelAlign:"left",
  93. name:"sl_status",
  94. readOnly:true,
  95. table:"SoftVersionLib",
  96. value:"在录入",
  97. xtype:"textfield"
  98. },{
  99. cls:"form-field-allowBlank",
  100. columnWidth:0.25,
  101. dataIndex:"sl_inman",
  102. editable:true,
  103. fieldLabel:"录入人",
  104. labelSeparator : ":",
  105. fieldStyle:"background:#E0E0FF;color:#515151;",
  106. id:"sl_inman",
  107. labelAlign:"left",
  108. name:"sl_inman",
  109. readOnly:true,
  110. table:"SoftVersionLib",
  111. value:"",
  112. xtype:"textfield"
  113. },{
  114. cls:"form-field-allowBlank",
  115. columnWidth:0.25,
  116. dataIndex:"sl_indate",
  117. editable:true,
  118. fieldLabel:"录入日期",
  119. labelSeparator : ":",
  120. fieldStyle:"background:#E0E0FF;color:#515151;",
  121. id:"sl_indate",
  122. labelAlign:"left",
  123. name:"sl_indate",
  124. readOnly:true,
  125. table:"SoftVersionLib",
  126. value:"",
  127. xtype:"datefield"
  128. },{
  129. cls:"form-field-allowBlank",
  130. columnWidth:0.25,
  131. dataIndex:"sl_statuscode",
  132. editable:true,
  133. fieldLabel:"状态码",
  134. id:"sl_statuscode",
  135. labelAlign:"left",
  136. name:"sl_statuscode",
  137. table:"SoftVersionLib",
  138. value:"ENTERING",
  139. xtype:"hidden"
  140. },{
  141. cls:"form-field-allowBlank",
  142. columnWidth:0.5,
  143. dataIndex:"sl_remark",
  144. editable:true,
  145. fieldLabel:"备注",
  146. fieldStyle:"background:#FFFAFA;color:#515151;",
  147. id:"sl_remark",
  148. labelAlign:"left",
  149. name:"sl_remark",
  150. table:"SoftVersionLib",
  151. value:"",
  152. xtype:"textfield"
  153. }],
  154. buttonAlign:'center',
  155. buttons:[{
  156. xtype: 'erpAddButton',
  157. id:"addButton"
  158. },{
  159. xtype: 'erpSaveButton',
  160. id:"saveButton"
  161. },{
  162. xtype: 'erpUpdateButton',
  163. id:"updateButton"
  164. },{
  165. xtype: 'erpEnableButton',
  166. id:"enableButton"
  167. },{
  168. xtype: 'erpForBiddenButton',
  169. id:"forbiddenButton"
  170. },{
  171. xtype: 'erpCloseButton',
  172. id:'close'
  173. }],
  174. initComponent : function(){
  175. var me = this;
  176. me.FormUtil=Ext.create('erp.util.FormUtil');
  177. me.GridUtil=Ext.create('erp.util.GridUtil');
  178. me.BaseUtil=Ext.create('erp.util.BaseUtil');
  179. formCondition = getUrlParam('formCondition');
  180. this.getData();
  181. this.callParent(arguments);
  182. if(this.enableTools) {
  183. me.setTools();
  184. }
  185. },
  186. /**
  187. * FormHeader Tools
  188. * 包括:查看日志、查看流程、查看列表、最大化、最小化、刷新、关闭、上一条、下一条
  189. */
  190. setTools: function(){
  191. var datalistId = getUrlParam('datalistId');
  192. this.tools = [{
  193. type: 'search',
  194. tooltip: '查看单据日志',
  195. listeners:{
  196. click: function(btn){
  197. var form = Ext.getCmp('form');
  198. var id = Ext.getCmp(form.keyField).value;
  199. if(id != null && id != 0){
  200. form.getLogs(id);
  201. }
  202. }
  203. }
  204. },{
  205. type: 'save',
  206. tooltip: '导出Excel',
  207. listeners:{
  208. click: function(btn){
  209. var form = Ext.getCmp('form');
  210. var id = Ext.getCmp(form.keyField).value;
  211. form.saveAsExcel(id,caller);
  212. }
  213. }
  214. },{
  215. type: 'expand',
  216. tooltip: '查看流程处理',
  217. listeners:{
  218. click: function(btn){
  219. var form = btn.ownerCt.ownerCt;
  220. if(!form.statuscodeField){
  221. btn.disable(true);
  222. } else {
  223. var f = form.statuscodeField;
  224. if(!Ext.getCmp(f) || Ext.getCmp(f).value == 'ENTERING'){
  225. btn.disable(true);
  226. } else {
  227. var id = Ext.getCmp(form.keyField).value;
  228. if(id != null && id != 0){
  229. form.getProcess(id);
  230. }
  231. }
  232. }
  233. }
  234. }
  235. },{
  236. type: 'gear',
  237. tooltip: '设置流程处理人',
  238. listeners:{
  239. click: function(btn){
  240. var form = btn.ownerCt.ownerCt;
  241. if(!form.statuscodeField){
  242. btn.disable(true);
  243. } else {
  244. var f = form.statuscodeField;
  245. if(!Ext.getCmp(f) || Ext.getCmp(f).value == 'ENTERING'){
  246. btn.disable(true);
  247. } else {
  248. var id = Ext.getCmp(form.keyField).value;
  249. if(id != null && id != 0){
  250. form.SetNodeDealMan(id);
  251. }
  252. }
  253. }
  254. }
  255. }
  256. },{
  257. type: 'collapse',
  258. tooltip: '查看列表',
  259. listeners:{
  260. click: function(btn){
  261. if(parent.Ext) {
  262. Ext.Ajax.request({
  263. url: basePath + 'common/getFieldData.action',
  264. params: {
  265. caller: 'Datalist',
  266. field: 'count(*)',
  267. condition: 'dl_caller=\'' + caller + '\''
  268. },
  269. callback: function(opt, s, r) {
  270. var rs = Ext.decode(r.responseText);
  271. if(rs.exceptionInfo) {
  272. showError(localJson.exceptionInfo);return null;
  273. } else if(rs.success && rs.data){
  274. var datalist = parent.Ext.getCmp(datalistId);
  275. if(!datalist){
  276. var form = btn.ownerCt.ownerCt;
  277. var url = 'jsps/common/datalist.jsp?whoami=' + caller;
  278. if(btn.urlcondition){
  279. url += '&urlcondition=' + btn.urlcondition;
  280. }
  281. form.FormUtil.onAdd(caller + '_scan', parent.Ext.getCmp('content-panel').getActiveTab().title + 'DataList', url);
  282. } else {
  283. datalist.ownerCt.setActiveTab(datalist);
  284. }
  285. }
  286. }
  287. });
  288. }
  289. }
  290. }
  291. },{
  292. type: 'restore',
  293. tooltip: '关联查询',
  294. listeners:{
  295. click: function(btn){
  296. var form = btn.ownerCt.ownerCt;
  297. form.showRelativeQuery();
  298. }
  299. }
  300. },{
  301. type: 'maximize',
  302. tooltip: '最大化',
  303. listeners:{
  304. click: function(btn){
  305. var height = window.screen.height*0.87;
  306. var width = window.screen.width;
  307. //弹出框显示,可以锁定住地址栏和工具栏,防止用户不合理操作
  308. window.open(window.location.href, '', 'width=' + width + ',height=' + height + ',top=0,left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
  309. }
  310. }
  311. },{
  312. type: 'minus',
  313. tooltip: '最小化',
  314. listeners:{
  315. click: function(btn){
  316. var p = parent.Ext.getCmp('content-panel');
  317. if(p){
  318. var t = p.getActiveTab();
  319. var b = parent.Ext.getCmp('bottom');
  320. if(b){
  321. b.insert(4, {
  322. text: t.title,
  323. tooltip: t.tabConfig.tooltip,
  324. tab: t,
  325. handler: function(btn){
  326. var a = p.add(btn.tab);
  327. p.setActiveTab(a);
  328. btn.destroy();
  329. }
  330. });
  331. p.remove(t, false);//并不销毁
  332. }
  333. }
  334. }
  335. }
  336. },{
  337. type: 'refresh',
  338. tooltip: '刷新',
  339. listeners:{
  340. click: function(btn){
  341. var form = btn.up('form');
  342. if(typeof form.refresh === 'function')
  343. form.refresh.call(null, form);
  344. else
  345. window.location.reload();
  346. }
  347. }
  348. },{
  349. type: 'task',
  350. cls : 'custom-tool',
  351. tooltip: '添加任务',
  352. listeners : {
  353. click : function(btn) {
  354. var form = btn.ownerCt.ownerCt;
  355. if(!form.codeField){
  356. btn.disable(true);
  357. }
  358. else form.addTask(form);
  359. }
  360. }
  361. },{
  362. type:'prev',
  363. id: 'prev',
  364. tooltip: '上一条',
  365. listeners:{
  366. render: function(btn){
  367. if(parent.Ext) {
  368. var datalist = parent.Ext.getCmp(datalistId);
  369. if(datalist){
  370. var datalistStore = datalist.currentStore;
  371. Ext.each(datalistStore, function(){
  372. if(this.selected == true){
  373. if(this.prev == null){
  374. btn.disable(true);
  375. }
  376. }
  377. });
  378. } else {
  379. btn.disable(true);
  380. }
  381. }
  382. },
  383. click: function(btn){
  384. var datalist = parent.Ext.getCmp(datalistId);
  385. if(datalist){
  386. var datalistStore = datalist.currentStore;
  387. var form = Ext.getCmp('form');
  388. var newId = 0;
  389. var idx = 0;
  390. Ext.each(datalistStore, function(s, index){
  391. if(this.selected == true){
  392. if(this.prev != null){
  393. newId = this.prev;
  394. idx = index;
  395. }
  396. }
  397. });
  398. datalistStore[idx].selected = false;
  399. datalistStore[idx-1].selected = true;
  400. var url = window.location.href;
  401. if(form.keyField) {
  402. url = url.replace(/formCondition=(\w*)(IS|=)(\d*)/, 'formCondition=$1$2' + newId);
  403. url = url.replace(/gridCondition=(\w*)(IS|=)(\d*)/, 'gridCondition=$1$2' + newId);
  404. }
  405. window.location.href = url;
  406. }
  407. }
  408. }
  409. },{
  410. type: 'next',
  411. id: 'next',
  412. tooltip: '下一条',
  413. listeners:{
  414. render: function(btn){
  415. if(parent.Ext) {
  416. var datalist = parent.Ext.getCmp(datalistId);
  417. if(datalist){
  418. var datalistStore = datalist.currentStore;
  419. Ext.each(datalistStore, function(){
  420. if(this.selected == true){
  421. if(this.next == null){
  422. btn.disable(true);
  423. }
  424. }
  425. });
  426. } else {
  427. btn.disable(true);
  428. }
  429. }
  430. },
  431. click: function(btn){
  432. var datalist = parent.Ext.getCmp(datalistId);
  433. if(datalist){
  434. var datalistStore = datalist.currentStore;
  435. var form = Ext.getCmp('form');
  436. var newId = 0;
  437. var idx = 0;
  438. Ext.each(datalistStore, function(s, index){
  439. if(s.selected == true){
  440. if(s.next != null){
  441. newId = s.next;
  442. idx = index;
  443. }
  444. }
  445. });
  446. datalistStore[idx].selected = false;
  447. datalistStore[idx+1].selected = true;
  448. var url = window.location.href;
  449. if(form.keyField) {
  450. url = url.replace(/formCondition=(\w*)(IS|=)(\d*)/, 'formCondition=$1$2' + newId);
  451. url = url.replace(/gridCondition=(\w*)(IS|=)(\d*)/, 'gridCondition=$1$2' + newId);
  452. }
  453. window.location.href = url;
  454. }
  455. }
  456. }
  457. },{
  458. type : 'pin',
  459. tooltip : '凭证制作',
  460. listeners : {
  461. click : function(t) {
  462. var form = t.ownerCt.ownerCt;
  463. if (form.voucherConfig) {
  464. form.createVoucher(form.voucherConfig);
  465. }
  466. }
  467. }
  468. },{
  469. type: 'unpin',
  470. tooltip: '使用条例与规则',
  471. listeners:{
  472. click: function(t){
  473. var form = t.ownerCt.ownerCt, foid = form.fo_id;
  474. Ext.Ajax.request({//拿到grid的columns
  475. url : basePath + "common/getFieldData.action",
  476. params: {
  477. caller: 'FormBook',
  478. field: 'fb_content',
  479. condition: "fb_foid='" + foid + "'"
  480. },
  481. method : 'post',
  482. async: false,
  483. callback : function(options,success,response){
  484. var res = new Ext.decode(response.responseText);
  485. if(res.exceptionInfo){
  486. showError(res.exceptionInfo);return;
  487. }
  488. if(res.success){
  489. var win = new Ext.window.Window({
  490. title: '使用条例与规则',
  491. height: "90%",
  492. width: "95%",
  493. maximizable : true,
  494. buttonAlign : 'center',
  495. layout : 'anchor',
  496. items: [{
  497. xtype : 'container',
  498. anchor : '100% 100%',
  499. html : res.data,
  500. style: 'padding: 20px;background: #fff'
  501. }]
  502. });
  503. win.show();
  504. }
  505. }
  506. });
  507. }
  508. }
  509. },{
  510. type:'plus',
  511. tooltip:'单据样例',
  512. listeners:{
  513. click: function(t){
  514. var form = t.ownerCt.ownerCt;
  515. Ext.Ajax.request({//拿到grid的columns
  516. url : basePath + 'common/form/reqDemo.action',
  517. async: false,
  518. params: {
  519. caller: caller
  520. },
  521. method : 'post',
  522. callback : function(options,success,response){
  523. window.open(response.responseText);
  524. //var res = new Ext.decode(response.responseText);
  525. }
  526. });
  527. }
  528. }
  529. },{
  530. type: 'help',
  531. tooltip: '帮助文档',
  532. listeners:{
  533. click: function(t){
  534. var form = t.ownerCt.ownerCt;
  535. form.showHelpWindow();
  536. }
  537. }
  538. }];
  539. },
  540. /**
  541. * 拿到操作日志
  542. */
  543. getLogs: function(id){
  544. if(Ext.getCmp('win' + id)){
  545. Ext.getCmp('win' + id).show();
  546. } else {
  547. Ext.Ajax.request({//拿到grid的columns
  548. url : basePath + 'common/getMessageLogs.action',
  549. async: false,
  550. params: {
  551. caller: caller,
  552. id: id
  553. },
  554. method : 'post',
  555. callback : function(options,success,response){
  556. var res = new Ext.decode(response.responseText);
  557. if(res.exception || res.exceptionInfo){
  558. showError(res.exceptionInfo);
  559. return;
  560. }
  561. var logs = res.logs;
  562. logs = logs.length == 0 ? [{ml_date: $I18N.common.grid.emptyText, ml_man: $I18N.common.grid.emptyText,
  563. ml_content: $I18N.common.grid.emptyText, ml_result: $I18N.common.grid.emptyText}] : logs;
  564. Ext.create('Ext.window.Window', {
  565. id : 'win' + id,
  566. title: '<span style="color:#CD6839;">操作日志</span>',
  567. iconCls: 'x-button-icon-set',
  568. closeAction: 'hide',
  569. height: "100%",
  570. width: "80%",
  571. maximizable : true,
  572. buttonAlign : 'center',
  573. layout : 'anchor',
  574. items: [{
  575. anchor: '100% 100%',
  576. xtype: 'gridpanel',
  577. ignore: true,
  578. bodyStyle: 'background:#f1f1f1;',
  579. autoScroll: true,
  580. store: Ext.create('Ext.data.Store', {
  581. fields: ['ml_date', 'ml_man', 'ml_content', 'ml_result'],
  582. data: logs
  583. }),
  584. columnLines: true,
  585. columns: [
  586. { header: '时间', dataIndex: 'ml_date', flex: 1.5 , renderer: function(val){
  587. if(val != '无数据'){
  588. return Ext.Date.format(new Date(val), 'Y-m-d H:i:s');
  589. }
  590. }},
  591. { header: '操作人员', dataIndex: 'ml_man', flex: 1 ,renderer: function(val){
  592. if(val == em_name){
  593. return '<font color=red>' + val + '</font>';
  594. } else {
  595. return val;
  596. }
  597. }},
  598. { header: '操作', dataIndex: 'ml_content', flex: 1.5},
  599. { header: '结果', dataIndex: 'ml_result', flex: 3}
  600. ]
  601. }],
  602. buttons : [{
  603. text : '关 闭',
  604. iconCls: 'x-button-icon-close',
  605. cls: 'x-btn-gray',
  606. handler : function(){
  607. Ext.getCmp('win' + id).close();
  608. }
  609. }]
  610. }).show();
  611. }
  612. });
  613. }
  614. },
  615. showHelpWindow:function(){
  616. var me = this,
  617. win = Ext.getCmp('ext-help'),path;
  618. Ext.Ajax.request({
  619. url : basePath + 'ma/help/scan.action',
  620. params: {
  621. caller:caller
  622. },
  623. method : 'get',
  624. async:false,
  625. callback : function(opt, s, res){
  626. var r = new Ext.decode(res.responseText);
  627. if(r.exceptionInfo){
  628. showError(r.exceptionInfo);
  629. } else if(r.success){
  630. path=r.path;
  631. }
  632. }
  633. });
  634. if(!win) {
  635. win = Ext.create('Ext.Window', {
  636. id: 'ext-help',
  637. width: '90%',
  638. height: '100%',
  639. closeAction: 'hide',
  640. title: '帮助文档',
  641. modal:true,
  642. layout: 'border',
  643. items: [{
  644. region:'center',
  645. tag : 'iframe',
  646. layout : 'fit',
  647. html : '<iframe src="' + basePath + path + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
  648. }]
  649. });
  650. }
  651. win.show();
  652. },
  653. saveAsExcel:function(id,caller){
  654. if(id==null || id =='') showMessage('提示','无法导出空数据单据',1000);
  655. else window.location.href=basePath+'excel/savePanelAsExcel.action?id='+id+"&caller="+caller+"&_noc=1";
  656. },
  657. getData:function(){
  658. var me = this;
  659. //从url解析参数
  660. if(formCondition != null && formCondition != ''){
  661. Ext.Ajax.request({
  662. url : basePath + 'scm/product/getSoftVersionLibData.action',
  663. params: {
  664. caller: caller,
  665. id: formCondition.split("IS")[1],
  666. _noc: (getUrlParam('_noc') || me._noc)
  667. },
  668. method : 'post',
  669. callback : function(options,success,response){
  670. var res = new Ext.decode(response.responseText);
  671. if(res.exceptionInfo != null){
  672. showError(res.exceptionInfo);
  673. return;
  674. }else{
  675. Ext.getCmp("saveButton").hide();
  676. if(res.data.sl_statuscode=='ENTERING'){
  677. Ext.getCmp("enableButton").hide();
  678. }else{
  679. Ext.getCmp('sl_code').setReadOnly(true);
  680. Ext.getCmp('sl_code').setFieldStyle("background:#E0E0FF;color:#515151;");
  681. Ext.getCmp('sl_name').setReadOnly(true);
  682. Ext.getCmp('sl_name').setFieldStyle("background:#E0E0FF;color:#515151;");
  683. Ext.getCmp('sl_platform').setReadOnly(true);
  684. Ext.getCmp('sl_platform').setFieldStyle("background:#E0E0FF;color:#515151;");
  685. Ext.getCmp('sl_remark').setReadOnly(true);
  686. Ext.getCmp('sl_remark').setFieldStyle("background:#E0E0FF;color:#515151;");
  687. Ext.getCmp("updateButton").hide();
  688. Ext.getCmp("forbiddenButton").hide();
  689. }
  690. //
  691. me.setFormValues(res.data);
  692. }
  693. }
  694. });
  695. }else{
  696. Ext.Ajax.request({
  697. url : basePath + "scm/product/getNow.action",
  698. params: {},
  699. method : 'post',
  700. callback : function(options,success,response){
  701. var res = new Ext.decode(response.responseText);
  702. if(res.exceptionInfo != null){
  703. showError(res.exceptionInfo);return;
  704. }
  705. if(res.man&&res.date){
  706. Ext.getCmp("sl_inman").setValue(res.man);
  707. Ext.getCmp("sl_indate").setValue(res.date);
  708. }
  709. Ext.getCmp("updateButton").hide();
  710. Ext.getCmp("enableButton").hide();
  711. Ext.getCmp("forbiddenButton").hide();
  712. }
  713. });
  714. }
  715. },
  716. setFormValues : function(data){
  717. var form = Ext.getCmp('form');
  718. form.getForm().setValues(data);
  719. }
  720. });