Pressure.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.plm.test.Pressure', {
  3. extend: 'Ext.app.Controller',
  4. requires: ['erp.util.FormUtil', 'erp.util.GridUtil','erp.util.BaseUtil'],
  5. stores: ['TreeStore'],
  6. views: ['plm.test.Pressure', 'common.main.TreePanel'],
  7. init:function(){
  8. var me = this;
  9. me.FormUtil = Ext.create('erp.util.FormUtil');
  10. me.GridUtil = Ext.create('erp.util.GridUtil');
  11. me.BaseUtil = Ext.create('erp.util.BaseUtil');
  12. this.control({
  13. 'erpTreePanel': {
  14. itemmousedown: function(selModel, record){
  15. this.loadTab(selModel, record);
  16. }
  17. },
  18. 'button[id=t_input]': {//生成测试数据
  19. click: function(btn){
  20. if(this.contentWindow == null){
  21. showError("请先选择需要测试界面");return;
  22. } else {
  23. var form = this.getTestForm();
  24. var grid = this.getTestGrid();
  25. var count = Ext.getCmp('t_count').value;//压力测试次数
  26. var r = Ext.getCmp('t_result');
  27. r.setValue(r.value + '\n*****测试数据加载开始******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  28. me.formStore = new Array();
  29. me.gridStore = new Array();
  30. me.BaseUtil.getRandomNumber(form.tablename, null, 'codeString');//自动添加编号
  31. for(var i=1;i<=count;i++){
  32. if(form){
  33. me.loadTestFormData(form, i);//加载测试数据
  34. }
  35. if(grid){
  36. me.loadTestGridData(grid, i);
  37. }
  38. r.setValue(r.value + '\n单据' + i + '数据加载完毕!');
  39. }
  40. r.setValue(r.value + '\n*****测试数据加载结束******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  41. r.getEl().scroll('b', 10*count);
  42. Ext.getCmp('t_level1').setValue('');
  43. Ext.getCmp('t_input').setDisabled(true);
  44. Ext.getCmp('t_save').setDisabled(false);
  45. }
  46. }
  47. },
  48. 'button[id=t_save]': {//执行保存
  49. click: function(btn){
  50. var r = Ext.getCmp('t_result');
  51. if(me.formStore == null || me.formStore.length == 0){
  52. showError("请先生成测试数据");return;
  53. }else{
  54. var count = me.formStore.length;
  55. r.setValue(r.value + '\n*****测试数据保存开始******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  56. r.ids = new Array();//保存测试数据的id
  57. me.reCount = 0;
  58. Ext.getCmp('testpage').setLoading(true);
  59. for(var i=1;i<=count;i++){
  60. me.testSave(me.formStore[i-1], me.gridStore[i-1], i);
  61. }
  62. Ext.getCmp('t_submit').setDisabled(false);
  63. Ext.getCmp('t_save').setDisabled(true);
  64. }
  65. }
  66. },
  67. 'button[id=t_submit]': {//执行提交
  68. click: function(btn){
  69. var r = Ext.getCmp('t_result');
  70. if(r.ids == null || r.ids.length == 0){
  71. showError("请先生成测试数据");return;
  72. }else{
  73. me.testSubmit();
  74. }
  75. Ext.getCmp('t_audit').setDisabled(false);
  76. Ext.getCmp('t_submit').setDisabled(true);
  77. }
  78. },
  79. 'button[id=t_audit]': {//执行审核
  80. click: function(btn){
  81. var r = Ext.getCmp('t_result');
  82. if(r.ids == null || r.ids.length == 0){
  83. showError("请先生成测试数据");return;
  84. }else{
  85. me.testAudit();
  86. }
  87. if(form.tablename='ProdInOut'){
  88. Ext.getCmp('t_post').setDisabled(false);
  89. }
  90. Ext.getCmp('t_audit').setDisabled(true);
  91. }
  92. },
  93. 'button[id=t_analyse]': {//分析测试结果
  94. click: function(btn){
  95. Ext.Ajax.request({
  96. url : basePath + 'common/getFieldData.action',
  97. params: {
  98. caller: 'DetailGrid',
  99. field: 'dg_table',
  100. condition: "dg_caller='" + me.contentWindow.caller + "'"
  101. },
  102. method : 'post',
  103. callback : function(options,success,response){
  104. var localJson = new Ext.decode(response.responseText);
  105. if(localJson.exceptionInfo){
  106. showError(localJson.exceptionInfo);return;
  107. }
  108. if(localJson.success){
  109. me.analyse(localJson.data);
  110. }
  111. }
  112. });
  113. }
  114. },
  115. 'button[id=t_report]': {
  116. click: function(btn){
  117. //生成测试报告
  118. }
  119. },
  120. 'button[id=t_clear]': {
  121. click: function(btn){
  122. var r = Ext.getCmp('t_result');
  123. if(r.ids == null || r.ids.length == 0){
  124. showError("请先生成测试数据");return;
  125. } else{
  126. //清除测试数据
  127. me.testDelete();
  128. Ext.getCmp('t_level1').setValue('※');
  129. Ext.getCmp('t_result').setValue('测试结果');
  130. Ext.getCmp('t_save').setDisabled(true);
  131. Ext.getCmp('t_submit').setDisabled(true);
  132. Ext.getCmp('t_audit').setDisabled(true);
  133. Ext.getCmp('t_post').setDisabled(true);
  134. Ext.getCmp('t_input').setDisabled(false);
  135. }
  136. }
  137. },
  138. 'button[id=prev]': {
  139. click: function(btn){
  140. var r = Ext.getCmp('t_result');
  141. var d = null;
  142. Ext.each(r.ids, function(k, i){
  143. if(k.onload){
  144. if(i > 0){
  145. k.onload = false;
  146. d = r.ids[i-1];
  147. if(i == 1){
  148. btn.setDisabled(true);
  149. }
  150. }
  151. }
  152. });
  153. if(d){
  154. me.loadFormStore(d.id);
  155. me.loadGridStore(d.id);
  156. d.onload = true;
  157. Ext.getCmp('next').setDisabled(false);
  158. } else {
  159. btn.setDisabled(true);
  160. }
  161. }
  162. },
  163. 'button[id=next]': {
  164. click: function(btn){
  165. var r = Ext.getCmp('t_result');
  166. var d = null;
  167. Ext.each(r.ids, function(k, i){
  168. if(k.onload){
  169. if(i < r.ids.length-1){
  170. k.onload = false;
  171. d = r.ids[i+1];
  172. if(i == r.ids.length - 2){
  173. btn.setDisabled(true);
  174. }
  175. }
  176. }
  177. });
  178. if(d){
  179. me.loadFormStore(d.id);
  180. me.loadGridStore(d.id);
  181. d.onload = true;
  182. Ext.getCmp('prev').setDisabled(false);
  183. } else {
  184. btn.setDisabled(true);
  185. }
  186. }
  187. }
  188. });
  189. },
  190. loadTab: function(selModel, record){
  191. var me = this;
  192. if (record.get('leaf')) {
  193. if(record.data['showMode'] != 0){
  194. showError("该页面禁止进行压力测试");return;
  195. }
  196. var url = record.data['url'];
  197. if(contains(url, 'datalist.jsp', true) || contains(url, 'query.jsp', true) ||
  198. contains(url, 'print.jsp', true) || contains(url, 'batchPrint.jsp', true) ||
  199. contains(url, 'batchDeal.jsp', true) || contains(url, 'vastDatalist.jsp', true) ||
  200. contains(url, 'gridpage.jsp', true)){//列表、查询、报表等页面禁止进行压力测试
  201. showError("该页面禁止进行压力测试");return;
  202. }
  203. Ext.getCmp('t_page').setValue(record.data['text']);
  204. Ext.get('iframe_test').dom.setAttribute('src', basePath + me.parseUrl(url));
  205. this.contentWindow = Ext.getCmp('testpage').el.dom.getElementsByTagName('iframe')[0].contentWindow;
  206. this.removeTestPageBtns();
  207. } else {
  208. if(record.isExpanded() && record.childNodes.length > 0){//是根节点,且已展开
  209. record.collapse(true,true);//收拢
  210. } else {//未展开
  211. //看是否加载了其children
  212. if(record.childNodes.length == 0){
  213. //从后台加载
  214. var tree = Ext.getCmp('tree-panel');
  215. tree.setLoading(true, tree.body);
  216. Ext.Ajax.request({//拿到tree数据
  217. url : basePath + 'common/lazyTree.action',
  218. params: {
  219. parentId: record.data['id']
  220. },
  221. callback : function(options,success,response){
  222. tree.setLoading(false);
  223. var res = new Ext.decode(response.responseText);
  224. if(res.tree){
  225. record.appendChild(res.tree);
  226. record.expand(false,true);//展开
  227. } else if(res.exceptionInfo){
  228. showError(res.exceptionInfo);
  229. }
  230. }
  231. });
  232. } else {
  233. record.expand(false,true);//展开
  234. }
  235. }
  236. }
  237. },
  238. openTab : function (panel, id, url){
  239. var o = (typeof panel == "string" ? panel : id || panel.id);
  240. var main = Ext.getCmp("content-panel");
  241. var tab = main.getComponent(o);
  242. if (tab) {
  243. main.setActiveTab(tab);
  244. } else if(typeof panel!="string"){
  245. panel.id = o;
  246. var p = main.add(panel);
  247. main.setActiveTab(p);
  248. }
  249. },
  250. parseUrl: function(url){
  251. if(contains(url, 'session:em_uu', true)){//对url中session值的处理
  252. url = url.replace(/session:em_uu/,em_uu);
  253. }
  254. if(contains(url, 'session:em_code', true)){//对url中em_code值的处理
  255. url = url.replace(/session:em_code/, "'" + em_code + "'");
  256. }
  257. if(contains(url, 'sysdate', true)){//对url中系统时间sysdate的处理
  258. url = url.replace(/sysdate/, "to_date('" + Ext.Date.toString(new Date()) + "','yyyy-mm-dd')");
  259. }
  260. if(contains(url, 'session:em_name', true)){
  261. url = url.replace(/session:em_name/,"'"+em_name+"'" );
  262. }
  263. return url;
  264. },
  265. getTestForm: function(){
  266. var w = this.contentWindow || Ext.getCmp('testpage').el.dom.getElementsByTagName('iframe')[0].contentWindow;
  267. this.contentWindow = w;
  268. return w.Ext.getCmp('form');
  269. },
  270. getTestGrid: function(){
  271. var w = this.contentWindow || Ext.getCmp('testpage').el.dom.getElementsByTagName('iframe')[0].contentWindow;
  272. return w.Ext.getCmp('grid');
  273. },
  274. loadTestFormData: function(form, index){
  275. var data = new Object();
  276. var v;
  277. Ext.each(form.items.items, function(item){
  278. v = '' + index;
  279. if(Ext.isEmpty(item.originalValue)){
  280. if(item.dataIndex == form.codeField){
  281. v = Ext.getCmp('codeString').value + '-' + index;//自动添加编号
  282. }
  283. if(item.xtype == 'datefield'){
  284. v = Ext.Date.format(new Date(), 'Y-m-d');
  285. } else if(item.xtype == 'datetimefield'){
  286. v = Ext.Date.format(new Date(), 'Y-m-d H:i:s');
  287. } else if(item.xtype == 'erpYnField'){
  288. v = 0;
  289. }
  290. } else {
  291. v = item.value;
  292. if(item.xtype == 'datefield'){
  293. v = Ext.Date.format(v, 'Y-m-d');
  294. } else if(item.xtype == 'datetimefield'){
  295. v = Ext.Date.format(v, 'Y-m-d H:i:s');
  296. }
  297. }
  298. if(item.name == form.keyField){
  299. v = 0;
  300. }
  301. data[item.name] = v;
  302. });
  303. this.formStore.push(data);
  304. },
  305. loadTestGridData: function(grid, index){
  306. var data = new Array();
  307. var d,v;
  308. for(var i=0;i<20;i++){
  309. d = new Object();
  310. Ext.each(grid.columns, function(c){
  311. v = '' + index;
  312. if(c.dataIndex == grid.detno){
  313. v = index*10000 + (i+1);//约定detno公式
  314. }
  315. if(c.xtype == 'datecolumn'){
  316. v = Ext.Date.format(new Date(), 'Y-m-d');
  317. } else if(c.xtype == 'datetimefield'){
  318. v = Ext.Date.format(new Date(), 'Y-m-d H:i:s');
  319. }
  320. d[c.dataIndex] = v;
  321. });
  322. data.push(d);
  323. }
  324. this.gridStore.push(data);
  325. },
  326. /**
  327. * 保存测试
  328. */
  329. testSave: function(formStore, gridStore, index){
  330. var me = this;
  331. var r = Ext.getCmp('t_result');
  332. r.setValue(r.value + '\n单据' + index + '开始保存\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  333. Ext.Ajax.request({
  334. url : basePath + 'common/saveCommon.action',
  335. params : {
  336. caller: this.contentWindow.caller,
  337. formStore: unescape(Ext.JSON.encode(formStore).replace(/\\/g,"%")),
  338. param: unescape(Ext.JSON.encode(gridStore).replace(/\\/g,"%"))
  339. },
  340. method : 'post',
  341. callback : function(options,success,response){
  342. var localJson = new Ext.decode(response.responseText);
  343. if(localJson.success){
  344. me.reCount++;
  345. r.setValue(r.value + '\n单据' + index + '保存成功\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  346. r.ids.push({
  347. index: index,
  348. id: localJson.id
  349. });
  350. } else if(localJson.exceptionInfo){
  351. var str = localJson.exceptionInfo;
  352. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){
  353. me.reCount++;
  354. r.setValue(r.value + '\n单据' + index + '保存成功\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  355. r.ids.push({
  356. index: index,
  357. id: localJson.id
  358. });
  359. } else {
  360. showError(str);
  361. return;
  362. }
  363. } else{
  364. saveFailure();
  365. }
  366. if(me.reCount == me.formStore.length){
  367. Ext.getCmp('testpage').setLoading(false);
  368. r.setValue(r.value + '\n*****测试数据保存结束******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  369. //显示保存的数据
  370. var d = Ext.Object.getValues(r.ids)[0];
  371. d.onload = true;
  372. me.loadFormStore(d.id);
  373. me.loadGridStore(d.id);
  374. }
  375. }
  376. });
  377. },
  378. /**
  379. * 删除测试
  380. */
  381. testDelete: function(){
  382. var me = this;
  383. var r = Ext.getCmp('t_result');
  384. r.setValue(r.value + '\n*****测试数据删除开始******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  385. var caller = this.contentWindow.caller;
  386. if(r.ids && r.ids.length > 0){
  387. var count = r.ids.length;
  388. var reCount = 0;
  389. Ext.getCmp('testpage').setLoading(true);
  390. Ext.each(r.ids, function(k){
  391. r.setValue(r.value + '\n单据' + k.index + '开始删除\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  392. Ext.Ajax.request({
  393. url : basePath + 'common/deleteCommon.action',
  394. params: {
  395. caller: caller,
  396. id: k.id
  397. },
  398. method : 'post',
  399. callback : function(options,success,response){
  400. var localJson = new Ext.decode(response.responseText);
  401. if(localJson.exceptionInfo){
  402. showError(localJson.exceptionInfo);return;
  403. }
  404. if(localJson.success){
  405. reCount++;
  406. r.setValue(r.value + '\n单据' + k.index + '删除成功\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  407. } else {
  408. delFailure();
  409. }
  410. if(reCount == count){
  411. Ext.getCmp('testpage').setLoading(false);
  412. r.setValue(r.value + '\n*****测试数据删除结束******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  413. r.ids = new Array();
  414. me.contentWindow.location.reload();//刷新
  415. me.formStore = new Array();
  416. me.gridStore = new Array();
  417. me.removeTestPageBtns();
  418. }
  419. }
  420. });
  421. });
  422. }
  423. },
  424. /**
  425. * 提交测试
  426. */
  427. testSubmit: function(){
  428. var me = this;
  429. var r = Ext.getCmp('t_result');
  430. r.setValue(r.value + '\n*****测试数据提交开始******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  431. var caller = this.contentWindow.caller;
  432. if(r.ids && r.ids.length > 0){
  433. var count = r.ids.length;
  434. var reCount = 0;
  435. Ext.getCmp('testpage').setLoading(true);
  436. Ext.each(r.ids, function(k){
  437. r.setValue(r.value + '\n单据' + k.index + '开始提交\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  438. Ext.Ajax.request({
  439. url : basePath + 'common/submitCommon.action',
  440. params: {
  441. caller: caller,
  442. id: k.id
  443. },
  444. method : 'post',
  445. callback : function(options,success,response){
  446. var localJson = new Ext.decode(response.responseText);
  447. if(localJson.exceptionInfo){
  448. showError(localJson.exceptionInfo);return;
  449. }
  450. if(localJson.success){
  451. reCount++;
  452. r.setValue(r.value + '\n单据' + k.index + '提交成功\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  453. }
  454. if(reCount == count){
  455. Ext.getCmp('testpage').setLoading(false);
  456. r.setValue(r.value + '\n*****测试数据提交结束******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  457. //显示保存的数据
  458. var d = Ext.Object.getValues(r.ids)[0];
  459. d.onload = true;
  460. me.loadFormStore(d.id);
  461. me.loadGridStore(d.id);
  462. if(Ext.getCmp('testpage').down('#next')){
  463. Ext.getCmp('testpage').down('#next').setDisabled(false);
  464. }
  465. }
  466. }
  467. });
  468. });
  469. }
  470. },
  471. /**
  472. * 审核测试
  473. */
  474. testAudit: function(){
  475. var me = this;
  476. var r = Ext.getCmp('t_result');
  477. r.setValue(r.value + '\n*****测试数据审核开始******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  478. var caller = this.contentWindow.caller;
  479. if(r.ids && r.ids.length > 0){
  480. var count = r.ids.length;
  481. var reCount = 0;
  482. Ext.getCmp('testpage').setLoading(true);
  483. Ext.each(r.ids, function(k){
  484. r.setValue(r.value + '\n单据' + k.index + '开始审核\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  485. Ext.Ajax.request({
  486. url : basePath + 'common/auditCommon.action',
  487. params: {
  488. caller: caller,
  489. id: k.id
  490. },
  491. method : 'post',
  492. callback : function(options,success,response){
  493. var localJson = new Ext.decode(response.responseText);
  494. if(localJson.exceptionInfo){
  495. showError(localJson.exceptionInfo);return;
  496. }
  497. if(localJson.success){
  498. reCount++;
  499. r.setValue(r.value + '\n单据' + k.index + '审核成功\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  500. }
  501. if(reCount == count){
  502. Ext.getCmp('testpage').setLoading(false);
  503. r.setValue(r.value + '\n*****测试数据审核结束******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  504. //显示保存的数据
  505. var d = Ext.Object.getValues(r.ids)[0];
  506. d.onload = true;
  507. me.loadFormStore(d.id);
  508. me.loadGridStore(d.id);
  509. }
  510. }
  511. });
  512. });
  513. }
  514. },
  515. analyse: function(tablename){
  516. var r = Ext.getCmp('t_result');
  517. r.setValue(r.value + '\n*****数据分析开始******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  518. if(r.ids && r.ids.length > 0){
  519. var count = r.ids.length;
  520. var reCount = 0;
  521. var grid = this.getTestGrid();
  522. Ext.getCmp('testpage').setLoading(true);
  523. Ext.each(r.ids, function(k){
  524. r.setValue(r.value + '\n单据' + k.index + '开始检查数据\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  525. Ext.Ajax.request({
  526. url : basePath + 'common/getFieldData.action',
  527. params: {
  528. caller: tablename,
  529. field: grid.detno,
  530. condition: grid.mainField + '=' + k.id +
  531. " AND (" + grid.detno + '<' + (k.index*10000 + 1) + ' OR ' + grid.detno + '>' + (k.index*10000 + 20) + ")"
  532. },
  533. method : 'post',
  534. callback : function(options,success,response){
  535. var localJson = new Ext.decode(response.responseText);
  536. if(localJson.exceptionInfo){
  537. showError(localJson.exceptionInfo);return;
  538. }
  539. if(localJson.data == null){
  540. reCount++;
  541. r.setValue(r.value + '\n单据' + k.index + '数据无误\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  542. } else {
  543. reCount++;
  544. r.setValue(r.value + '\n单据' + k.index + '数据有误,行号:' + localJson.data +
  545. '\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  546. }
  547. if(reCount == count){
  548. Ext.getCmp('testpage').setLoading(false);
  549. r.setValue(r.value + '\n*****数据分析结束******\n' + '时间:' + Ext.Date.format(new Date(), 'Y-m-d H:i:s'));
  550. }
  551. }
  552. });
  553. });
  554. }
  555. },
  556. loadFormStore: function(id){
  557. var form = this.getTestForm();
  558. this.FormUtil.loadNewStore(form, {caller: this.contentWindow.caller, condition: form.keyField + "=" + id});
  559. if(!Ext.getCmp('testpage').down('#testbar')){
  560. Ext.getCmp('testpage').addDocked({
  561. docked: 'top',
  562. xtype: 'toolbar',
  563. id: 'testbar',
  564. items: [{
  565. text: '上一条',
  566. id: 'prev',
  567. iconCls: 'x-button-icon-up',
  568. cls: 'x-btn-gray',
  569. disabled: true
  570. },{
  571. text: '下一条',
  572. id: 'next',
  573. iconCls: 'x-button-icon-down',
  574. cls: 'x-btn-gray'
  575. }]
  576. });
  577. }
  578. },
  579. loadGridStore: function(id){
  580. var grid = this.getTestGrid();
  581. this.GridUtil.loadNewStore(grid, {caller: this.contentWindow.caller, condition: grid.mainField + "=" + id});
  582. },
  583. /**
  584. * 去掉测试页面的buttons
  585. */
  586. removeTestPageBtns: function(){
  587. var me = this;
  588. setTimeout(function(){
  589. if(!me.contentWindow.Ext || !me.contentWindow.Ext.getCmp('form')){
  590. me.removeTestPageBtns();
  591. } else {
  592. var form = me.getTestForm();
  593. Ext.each(form.dockedItems.items, function(item){
  594. if(item){
  595. form.removeDocked(item, true);
  596. }
  597. });
  598. if(form.dockedItems.items.length > 0){
  599. me.removeTestPageBtns();
  600. }
  601. }
  602. }, 1000);
  603. }
  604. });