Panel.js 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379
  1. /**
  2. * ERP项目前台formpanel自定义样式1
  3. * 可供大部分单表直接使用
  4. */
  5. Ext.define('erp.view.core.form.Panel',{
  6. extend: 'Ext.form.Panel',
  7. alias: 'widget.erpFormPanel',
  8. id: 'form',
  9. region: 'north',
  10. frame : true,
  11. layout : 'column',
  12. autoScroll : true,
  13. defaultType : 'textfield',
  14. labelSeparator : ':',
  15. source:'',//全功能导航展示使用
  16. buttonAlign : 'center',
  17. cls: 'u-form-default',
  18. fieldDefaults : {
  19. fieldStyle : "background:#FFFAFA;color:#515151;",
  20. focusCls: 'x-form-field-cir-focus',
  21. labelAlign : "right",
  22. msgTarget: 'side',
  23. blankText : $I18N.common.form.blankText
  24. },
  25. requires: ['erp.view.common.JProcess.SetNodeGridPanel','erp.view.oa.task.TaskPanel'],
  26. FormUtil: Ext.create('erp.util.FormUtil'),
  27. BaseUtil: Ext.create('erp.util.BaseUtil'),
  28. saveUrl: '',
  29. updateUrl: '',
  30. deleteUrl: '',
  31. auditUrl: '',
  32. resAuditUrl: '',
  33. submitUrl: '',
  34. resSubmitUrl: '',
  35. bannedUrl: '',
  36. resBannedUrl: '',
  37. postUrl:'',
  38. printUrl: '',
  39. getIdUrl: '',
  40. keyField: '',
  41. codeField: '',
  42. statusField: '',
  43. params: null,
  44. caller: null,
  45. formCondition:null,
  46. Contextvalue:null,
  47. LastValue:null,
  48. enableTools: true,
  49. enableKeyEvents: true,
  50. _noc: 0,
  51. initComponent : function(){
  52. formCondition = getUrlParam('formCondition');//从url解析参数
  53. formCondition = (formCondition == null) ? "" : formCondition.replace(/IS/g,"=");
  54. //集团版
  55. var master=getUrlParam('newMaster');
  56. var _copyConf=getUrlParam('_copyConf');
  57. var param = {caller: this.caller || caller, condition: this.formCondition || formCondition, _noc: (getUrlParam('_noc') || this._noc)};
  58. if(master){
  59. param.master=master;
  60. }
  61. if(_copyConf!=null){//复制界面
  62. param._copyConf=_copyConf;//复制来源单据的条件
  63. }
  64. //界面不显示按钮
  65. var _nobutton=getUrlParam('_nobutton'),source=getUrlParam('source'),_config=getUrlParam('_config');
  66. if(source=='allnavigation'){
  67. this.readOnly=true;
  68. this._nobutton=true;
  69. this.source='allnavigation';
  70. this.enableTools=false;
  71. }
  72. if(_nobutton) this._nobutton=true;
  73. if(_config){
  74. param._config=_config;
  75. }
  76. if(this.getItemsAndButtons) this.getItemsAndButtons(this, 'common/singleFormItems.action', this.params || param);
  77. else this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', this.params || param);
  78. this.callParent(arguments);
  79. //加prev、next、refresh等tool
  80. if(this.enableTools) {
  81. this.setTools();
  82. }
  83. //给页面加上ctrl+alt+s键盘事件,自动跳转form配置界面
  84. if(this.enableKeyEvents) {
  85. this.addKeyBoardEvents();
  86. }
  87. },
  88. /**
  89. * FormHeader Tools
  90. * 包括:查看日志、查看流程、查看列表、最大化、最小化、刷新、关闭、上一条、下一条
  91. */
  92. setTools: function(){
  93. var me = this, datalistId = getUrlParam('datalistId'), isRefererList = !!datalistId,
  94. hasVoucher = !!me.voucherConfig, dumpable = me.dumpable,
  95. isNormalPage = !me.dumpable && !me.adminPage, hasList = !me.singlePage;
  96. me.tools = [
  97. { xtype:'button',
  98. text:'选项',
  99. id:'buttons',
  100. margin:'0 0 0 2',
  101. listeners:{
  102. mouseover:function(){
  103. var buttons=Ext.getCmp("buttons");
  104. buttons.showMenu();
  105. }
  106. },
  107. menu: [{
  108. iconCls: 'x-nbutton-icon-log',
  109. text: '操作日志',
  110. listeners:{
  111. afterrender:function(btn){
  112. formCondition = getUrlParam('formCondition');
  113. if(formCondition==null||formCondition==''){
  114. btn.disable();
  115. }
  116. },
  117. click: function(btn){
  118. var form = Ext.getCmp('form');
  119. var id = Ext.getCmp(form.keyField).value;
  120. if(id != null && id != 0){
  121. form.getLogs(id);
  122. }
  123. }
  124. }
  125. },{
  126. iconCls: 'x-nbutton-icon-message',
  127. text: '消息日志',
  128. listeners:{
  129. afterrender:function(btn){
  130. formCondition = getUrlParam('formCondition');
  131. if(formCondition==null||formCondition==''){
  132. btn.disable();
  133. }
  134. },
  135. click:function(btn){
  136. var form = Ext.getCmp('form');
  137. var id = Ext.getCmp(form.keyField).value;
  138. if(id != null && id != 0){
  139. me.getMessageInfo(id,caller);}
  140. }
  141. }
  142. },{
  143. iconCls: 'x-nbutton-icon-link',
  144. text: '关联查询',
  145. hidden: !isNormalPage,
  146. listeners:{
  147. afterrender:function(btn){
  148. formCondition = getUrlParam('formCondition');
  149. if(formCondition==null||formCondition==''){
  150. btn.disable();
  151. }
  152. },
  153. click:function(btn){
  154. var form = Ext.getCmp('form');
  155. form.showRelativeQuery();
  156. }
  157. }
  158. },{
  159. iconCls: 'x-nbutton-icon-download',
  160. text: '下载数据',
  161. hidden: !isNormalPage,
  162. listeners:{
  163. afterrender:function(btn){
  164. formCondition = getUrlParam('formCondition');
  165. if(formCondition==null||formCondition==''){
  166. btn.disable();
  167. }
  168. },
  169. click:function(){
  170. var form = Ext.getCmp('form');
  171. var id = Ext.getCmp(form.keyField).value;
  172. var grids=Ext.ComponentQuery.query('grid');
  173. var obj =new Object();
  174. if(grids){
  175. Ext.each(grids,function(g,index){
  176. if(!g.caller){
  177. if(g.mainField&&g.mainField!='null')
  178. obj[caller]=g.mainField;
  179. }else{
  180. if(g.mainField&&g.mainField!='null')
  181. obj[g.caller]=g.mainField;
  182. }
  183. });
  184. }
  185. form.saveAsExcel(id,caller,encodeURI(Ext.JSON.encode(obj)));
  186. }
  187. }
  188. },{
  189. iconCls: 'x-nbutton-icon-task',
  190. text: '发起任务',
  191. hidden: !isNormalPage,
  192. listeners : {
  193. click : function(btn) {
  194. var form = Ext.getCmp('form');
  195. if(!form.codeField){
  196. btn.disable(true);
  197. }
  198. else form.addTask(form);
  199. }
  200. }
  201. },{
  202. iconCls: 'x-nbutton-icon-plan',
  203. text: '导出方案',
  204. hidden: !dumpable,
  205. listeners:{
  206. afterrender:function(btn){
  207. formCondition = getUrlParam('formCondition');
  208. if(formCondition==null||formCondition==''){
  209. btn.disable();
  210. }
  211. },
  212. click:function(){
  213. // 用于配置方案导出
  214. me.expData();
  215. }
  216. }
  217. },{
  218. iconCls: 'x-nbutton-icon-process',
  219. text: '流程处理',
  220. hidden: !isNormalPage,
  221. listeners:{
  222. afterrender:function(btn){
  223. var form = Ext.getCmp('form');
  224. if(!form.statuscodeField){
  225. btn.disable(true);
  226. } else {
  227. var f = form.statuscodeField;
  228. if(!Ext.getCmp(f) || Ext.getCmp(f).value == 'ENTERING'){
  229. btn.disable(true);
  230. } }
  231. },
  232. click :function(btn){
  233. var form = Ext.getCmp('form');
  234. if(!form.statuscodeField){
  235. btn.disable(true);
  236. } else {
  237. var f = form.statuscodeField;
  238. if(!Ext.getCmp(f) || Ext.getCmp(f).value == 'ENTERING'){
  239. btn.disable(true);
  240. } else {
  241. var id = Ext.getCmp(form.keyField).value;
  242. if(id != null && id != 0){
  243. form.getProcess(id);
  244. }
  245. }
  246. }
  247. }
  248. }
  249. },{
  250. iconCls: 'x-nbutton-icon-report',
  251. text: '单据设置',
  252. listeners:{
  253. afterrender:function(v){
  254. me.ifadmin(v);
  255. },
  256. click:function(){
  257. me.reportset();
  258. }
  259. }
  260. }]
  261. },
  262. {
  263. xtype : 'button',
  264. text:'凭证',
  265. margin:'0 0 0 2',
  266. id:'Voucher',
  267. hidden : !hasVoucher,
  268. listeners : {
  269. click : function(t) {
  270. var form = t.ownerCt.ownerCt;
  271. form.createVoucher(form.voucherConfig);
  272. }
  273. }
  274. },
  275. {
  276. xtype: 'button',
  277. text:'帮助',
  278. margin:'0 0 0 2',
  279. hidden : !isNormalPage,
  280. listeners:{
  281. click: function(t){
  282. var form = t.ownerCt.ownerCt;
  283. form.showHelpWindow();
  284. }
  285. }
  286. },
  287. {
  288. id: 'prev',
  289. iconCls: 'x-nbutton-icon-left',
  290. xtype:'button',
  291. hidden : !hasVoucher,
  292. listeners:{
  293. render: function(btn){
  294. if(parent.Ext) {
  295. var datalist = parent.Ext.getCmp(datalistId);
  296. if(datalist){
  297. var datalistStore = datalist.currentStore;
  298. Ext.each(datalistStore, function(){
  299. if(this.selected == true){
  300. if(this.prev == null){
  301. btn.disable(true);
  302. }
  303. }
  304. });
  305. } else {
  306. btn.disable(true);
  307. }
  308. }
  309. },
  310. click: function(btn){
  311. var datalist = parent.Ext.getCmp(datalistId);
  312. if(datalist){
  313. var datalistStore = datalist.currentStore;
  314. var form = Ext.getCmp('form');
  315. var newId = 0;
  316. var idx = 0;
  317. Ext.each(datalistStore, function(s, index){
  318. if(this.selected == true){
  319. if(this.prev != null){
  320. newId = this.prev;
  321. idx = index;
  322. }
  323. }
  324. });
  325. datalistStore[idx].selected = false;
  326. datalistStore[idx-1].selected = true;
  327. var url = window.location.href;
  328. if(form.keyField) {
  329. url = url.replace(/formCondition=(\w*)(IS|=)(\d*)/, 'formCondition=$1$2' + newId);
  330. url = url.replace(/gridCondition=(\w*)(IS|=)(\d*)/, 'gridCondition=$1$2' + newId);
  331. }
  332. window.location.href = url;
  333. }
  334. }
  335. }
  336. },{
  337. xtype: 'button',
  338. iconCls: 'x-nbutton-icon-right',
  339. id: 'next',
  340. tooltip: '下一条',
  341. hidden : !hasVoucher,
  342. listeners:{
  343. render: function(btn){
  344. if(parent.Ext) {
  345. var datalist = parent.Ext.getCmp(datalistId);
  346. if(datalist){
  347. var datalistStore = datalist.currentStore;
  348. Ext.each(datalistStore, function(){
  349. if(this.selected == true){
  350. if(this.next == null){
  351. btn.disable(true);
  352. }
  353. }
  354. });
  355. } else {
  356. btn.disable(true);
  357. }
  358. }
  359. },
  360. click: function(btn){
  361. var datalist = parent.Ext.getCmp(datalistId);
  362. if(datalist){
  363. var datalistStore = datalist.currentStore;
  364. var form = Ext.getCmp('form');
  365. var newId = 0;
  366. var idx = 0;
  367. Ext.each(datalistStore, function(s, index){
  368. if(s.selected == true){
  369. if(s.next != null){
  370. newId = s.next;
  371. idx = index;
  372. }
  373. }
  374. });
  375. datalistStore[idx].selected = false;
  376. datalistStore[idx+1].selected = true;
  377. var url = window.location.href;
  378. if(form.keyField) {
  379. url = url.replace(/formCondition=(\w*)(IS|=)(\d*)/, 'formCondition=$1$2' + newId);
  380. url = url.replace(/gridCondition=(\w*)(IS|=)(\d*)/, 'gridCondition=$1$2' + newId);
  381. }
  382. window.location.href = url;
  383. }
  384. }
  385. }
  386. }];
  387. },
  388. ifadmin:function(v){
  389. var table='EMPLOYEE';
  390. var field='EM_TYPE';
  391. Ext.Ajax.request({
  392. url : basePath + '/common/isadmin.action',
  393. params: {
  394. table:table,
  395. field:field
  396. },
  397. method : 'get',
  398. async:false,
  399. callback : function(opt, s, res){
  400. var r = new Ext.decode(res.responseText);
  401. if(r.exceptionInfo){
  402. showError(r.exceptionInfo);
  403. } else if(r.success){
  404. if(r.data!='admin'){
  405. v.disable();
  406. }
  407. }
  408. }
  409. });
  410. },
  411. reportset:function(){
  412. var me=this;
  413. var url = "jsps/ma/form.jsp?formCondition=fo_idIS" + me.fo_id + "&gridCondition=fd_foidIS" + me.fo_id,
  414. forms = Ext.ComponentQuery.query('form');
  415. grids = Ext.ComponentQuery.query('gridpanel');
  416. formSet = [], gridSet = [];
  417. if(forms.length > 0) {
  418. Ext.Array.each(forms, function(f){
  419. f.fo_id && (formSet.push(f.fo_id));
  420. });
  421. }
  422. if(grids.length > 0) {
  423. Ext.Array.each(grids, function(g){
  424. gridSet.push(g.caller || window.caller);
  425. });
  426. gridSet = Ext.Array.unique(gridSet);
  427. }
  428. if(formSet.length > 0 || gridSet.length > 0) {
  429. url = "jsps/ma/multiform.jsp?formParam=" + formSet.join(',') + '&gridParam=' + gridSet.join(',');
  430. }
  431. var myurl=basePath+url;
  432. var windows=parent.Ext.create('Ext.window.Window', {
  433. title: '<span style="color:#CD6839;">单据设置</span>',
  434. iconCls: 'x-button-icon-set',
  435. closeAction: 'hide',
  436. height: "90%",
  437. width: "90%",
  438. modal:true,
  439. maximizable : true,
  440. buttonAlign : 'center',
  441. layout : 'anchor',
  442. items: [{
  443. xtype:'tabpanel',
  444. anchor: '100% 100%',
  445. layout : 'anchor',
  446. items:[{
  447. xtype: 'panel',
  448. title:'界面配置',
  449. anchor: '100% 100%',
  450. items:[
  451. { xtype: 'component',
  452. id:'iframe_detail_multiform',
  453. autoEl: {
  454. tag: 'iframe',
  455. style: 'height: 100%; width: 100%; border: none;',
  456. src: myurl}
  457. }]
  458. },{
  459. title:'逻辑配置',
  460. xtype: 'panel',
  461. items:[
  462. { xtype: 'component',
  463. id:'iframe_detail_config',
  464. autoEl: {
  465. tag: 'iframe',
  466. style: 'height: 100%; width: 100%; border: none;',
  467. src: basePath + 'jsps/ma/logic/config.jsp?whoami=' +caller}
  468. }]
  469. }/*,{
  470. xtype: 'panel',
  471. title:'知会设置',
  472. items:[{ xtype: 'component',
  473. id:'iframe_detail_messageset',
  474. autoEl: {
  475. tag: 'iframe',
  476. style: 'height: 100%; width: 100%; border: none;',
  477. src: basePath + 'jsps/sysmng/MsgSetting.jsp?whoami=' +caller}
  478. }]
  479. }*/]
  480. }],
  481. buttons : [{
  482. text : '关 闭',
  483. iconCls: 'x-button-icon-close',
  484. cls: 'x-btn-gray',
  485. handler : function(){
  486. this.ownerCt.ownerCt.close();
  487. }
  488. }]
  489. });
  490. windows.show();
  491. },
  492. getMessageInfo:function(id,caller){
  493. if(Ext.getCmp('msgwin' + id)){
  494. Ext.getCmp('msgwin' + id).show();
  495. } else {
  496. var me=this;
  497. Ext.Ajax.request({
  498. url : basePath + 'common/getMessageInfo.action',
  499. params: {
  500. caller:caller,
  501. id:id
  502. },
  503. method : 'get',
  504. async:false,
  505. callback : function(opt, s, res){
  506. var r = new Ext.decode(res.responseText);
  507. if(r.exceptionInfo){
  508. showError(r.exceptionInfo);
  509. } else if(r.success){
  510. me.showmessagelog(r.logs,id);
  511. }
  512. }
  513. });
  514. }
  515. },
  516. showmessagelog:function(logs,id){
  517. if(logs.length<1){
  518. Ext.create('Ext.window.Window', {
  519. title: '<span style="color:#CD6839;">消息日志</span>',
  520. iconCls: 'x-button-icon-set',
  521. closeAction: 'hide',
  522. height: "90%",
  523. width: "90%",
  524. modal:true,
  525. maximizable : true,
  526. buttonAlign : 'center',
  527. layout : 'anchor',
  528. items: [{
  529. anchor: '100% 100%',
  530. xtype: 'form',
  531. ignore: true,
  532. bodyStyle: 'background:#f1f1f1;',
  533. autoScroll: true,
  534. html:'<div style="left:35%;position:absolute;top:30%;font-weight:bold;font-size:25px;color:rgba(144, 143, 143, 0.5)">本单据不存在消息日志</div>'
  535. }],
  536. buttons : [{
  537. text : '关 闭',
  538. iconCls: 'x-button-icon-close',
  539. cls: 'x-btn-gray',
  540. handler : function(){
  541. this.ownerCt.ownerCt.close();
  542. }
  543. }]
  544. }).show();
  545. }else{
  546. Ext.create('Ext.window.Window', {
  547. id : 'msgwin'+id,
  548. title: '<span style="color:#CD6839;">消息日志</span>',
  549. iconCls: 'x-button-icon-set',
  550. closeAction: 'hide',
  551. height: "90%",
  552. width: "90%",
  553. modal:true,
  554. maximizable : true,
  555. buttonAlign : 'center',
  556. layout : 'anchor',
  557. items: [{
  558. anchor: '100% 100%',
  559. xtype: 'gridpanel',
  560. ignore: true,
  561. bodyStyle: 'background:#f1f1f1;',
  562. autoScroll: true,
  563. store: Ext.create('Ext.data.Store', {
  564. fields: ['IH_DATE', 'IHD_RECEIVE', 'IH_CONTEXT', 'IHD_READSTATUS','IHD_READTIME'],
  565. data: logs
  566. }),
  567. columnLines: true,
  568. columns: [
  569. { header: '发出时间',
  570. dataIndex: 'IH_DATE',
  571. flex: 1.5 ,
  572. renderer: function(val){
  573. if(val != '无数据'){
  574. return Ext.Date.format(new Date(val), 'Y-m-d H:i:s');
  575. }
  576. }},
  577. { header: '接收人',
  578. dataIndex: 'IHD_RECEIVE',
  579. flex: 1 ,
  580. renderer: function(val){
  581. if(val == em_name){
  582. return '<font color=red>' + val + '</font>';
  583. } else {
  584. return val;
  585. }
  586. }},
  587. { header: '信息描述',
  588. dataIndex: 'IH_CONTEXT',
  589. flex: 3.5
  590. },
  591. { header: '阅读状态',
  592. dataIndex: 'IHD_READSTATUS',
  593. flex: 1,
  594. renderer:function(value,meta,record){
  595. if(value==0){
  596. return '<font color="#ff0000">未读</font>';
  597. }else if(value==-1){
  598. return '<font color="#4795ef">已读</font>';
  599. }
  600. }
  601. },
  602. { header: '阅读时间',
  603. dataIndex: 'IHD_READTIME',
  604. flex: 1.5,
  605. renderer: function(val){
  606. if(val != ''&&val!=null){
  607. return Ext.Date.format(new Date(val), 'Y-m-d H:i:s');
  608. }
  609. }
  610. }]
  611. }],
  612. buttons : [{
  613. text : '关 闭',
  614. iconCls: 'x-button-icon-close',
  615. cls: 'x-btn-gray',
  616. handler : function(){
  617. Ext.getCmp('msgwin' + id).close();
  618. }
  619. }]
  620. }).show();
  621. }
  622. },
  623. /**
  624. * 监听一些事件
  625. * <br>
  626. * Ctrl+Alt+S 单据配置维护
  627. * Ctrl+Alt+P 参数、逻辑配置维护
  628. */
  629. addKeyBoardEvents: function(){
  630. var me = this;
  631. Ext.EventManager.addListener(document.body, 'keydown', function(e){
  632. if(e.altKey && e.ctrlKey) {
  633. if(e.keyCode == Ext.EventObject.S) {
  634. var url = "jsps/ma/form.jsp?formCondition=fo_idIS" + me.fo_id + "&gridCondition=fd_foidIS" + me.fo_id,
  635. forms = Ext.ComponentQuery.query('form'),
  636. grids = Ext.ComponentQuery.query('gridpanel'),
  637. formSet = [], gridSet = [];
  638. if(forms.length > 0) {
  639. Ext.Array.each(forms, function(f){
  640. f.fo_id && (formSet.push(f.fo_id));
  641. });
  642. }
  643. if(grids.length > 0) {
  644. Ext.Array.each(grids, function(g){
  645. gridSet.push(g.caller || window.caller);
  646. });
  647. gridSet = Ext.Array.unique(gridSet);
  648. }
  649. if(formSet.length > 0 || gridSet.length > 0) {
  650. url = "jsps/ma/multiform.jsp?formParam=" + formSet.join(',') + '&gridParam=' + gridSet.join(',');
  651. }
  652. //用于生成datalist 时要用的sn_lockpage
  653. var main = parent.Ext.getCmp("content-panel");
  654. if(!main){
  655. main = parent.parent.Ext.getCmp("content-panel");
  656. }
  657. if(main){
  658. main.lockPage = window.location.pathname.replace('/ERP/', '').split("?")[0];
  659. }
  660. me.FormUtil.onAdd('form' + caller, 'Form配置维护(' + caller + ')', url);
  661. } else if(e.keyCode == Ext.EventObject.P) {
  662. me.FormUtil.onAdd('configs-' + caller, '逻辑配置维护(' + caller + ')', "jsps/ma/logic/config.jsp?whoami=" + caller);
  663. }
  664. }
  665. });
  666. },
  667. /**
  668. * 拿到操作日志
  669. */
  670. getLogs: function(id){
  671. if(Ext.getCmp('win' + id)){
  672. Ext.getCmp('win' + id).show();
  673. } else {
  674. Ext.Ajax.request({//拿到grid的columns
  675. url : basePath + 'common/getMessageLogs.action',
  676. async: false,
  677. params: {
  678. caller: caller,
  679. id: id
  680. },
  681. method : 'post',
  682. callback : function(options,success,response){
  683. var res = new Ext.decode(response.responseText);
  684. if(res.exception || res.exceptionInfo){
  685. showError(res.exceptionInfo);
  686. return;
  687. }
  688. var logs = res.logs;
  689. logs = logs.length == 0 ? [{ml_date: $I18N.common.grid.emptyText, ml_man: $I18N.common.grid.emptyText,
  690. ml_content: $I18N.common.grid.emptyText, ml_result: $I18N.common.grid.emptyText}] : logs;
  691. Ext.create('Ext.window.Window', {
  692. id : 'win' + id,
  693. title: '<span style="color:#CD6839;">操作日志</span>',
  694. iconCls: 'x-button-icon-set',
  695. closeAction: 'hide',
  696. height: "90%",
  697. width: "90%",
  698. modal:true,
  699. maximizable : true,
  700. buttonAlign : 'center',
  701. layout : 'anchor',
  702. items: [{
  703. anchor: '100% 100%',
  704. xtype: 'gridpanel',
  705. ignore: true,
  706. bodyStyle: 'background:#f1f1f1;',
  707. autoScroll: true,
  708. store: Ext.create('Ext.data.Store', {
  709. fields: ['ml_date', 'ml_man', 'ml_content', 'ml_result'],
  710. data: logs
  711. }),
  712. columnLines: true,
  713. columns: [
  714. { header: '时间', dataIndex: 'ml_date', flex: 1.5 , renderer: function(val){
  715. if(val != '无数据'){
  716. return Ext.Date.format(new Date(val), 'Y-m-d H:i:s');
  717. }
  718. }},
  719. { header: '操作人员', dataIndex: 'ml_man', flex: 1 ,renderer: function(val){
  720. if(val == em_name){
  721. return '<font color=red>' + val + '</font>';
  722. } else {
  723. return val;
  724. }
  725. }},
  726. { header: '操作', dataIndex: 'ml_content', flex: 1.5},
  727. { header: '结果', dataIndex: 'ml_result', flex: 3,
  728. renderer:function(value,meta,record){
  729. meta.style = 'height: auto;overflow:visible !important;white-space:normal !important;';
  730. return value;
  731. }
  732. }]
  733. }],
  734. buttons : [{
  735. text : '关 闭',
  736. iconCls: 'x-button-icon-close',
  737. cls: 'x-btn-gray',
  738. handler : function(){
  739. Ext.getCmp('win' + id).close();
  740. }
  741. }]
  742. }).show();
  743. }
  744. });
  745. }
  746. },
  747. saveAsExcel:function(id,caller,o){
  748. if(id==null || id =='') showMessage('提示','无法导出空数据单据',1000);
  749. else window.location.href=basePath+'excel/savePanelAsExcel.action?id='+id+"&caller="+caller+"&o="+o+"&_noc=1";
  750. },
  751. /*
  752. * 拿到流程处理情况
  753. */
  754. getProcess: function(id){
  755. var me = this;
  756. //先获取jprocess的nodeId
  757. Ext.Ajax.request({
  758. url : basePath + 'common/getJProcessByForm.action',
  759. async: false,
  760. params: {
  761. caller: me.realCaller||caller,
  762. keyValue: id,
  763. _noc:1
  764. },
  765. method : 'post',
  766. callback : function(options,success,response){
  767. var localJson = new Ext.decode(response.responseText);
  768. if(localJson.exceptionInfo){
  769. showError(localJson.exceptionInfo);return;
  770. }
  771. if(localJson.node && localJson.node != -1){
  772. //再根据nodeId调取流程信息
  773. if(Ext.getCmp('win-flow' + id)){
  774. Ext.getCmp('win-flow' + id).show();
  775. } else {
  776. var form = Ext.create('Ext.form.Panel', {
  777. layout: 'column',
  778. defaultType: 'textfield',
  779. anchor: '100% 20%' ,
  780. bodyStyle: 'background:#f1f1f1;',
  781. fieldDefaults: {
  782. columnWidth: 0.33,
  783. readOnly: true,
  784. cls : "form-field-allowBlank",
  785. fieldStyle: 'background:#f0f0f0;border: 1px solid #8B8970;'
  786. },
  787. items: [{
  788. id: 'jp_name',
  789. name: 'jp_name',
  790. fieldLabel: '流程名称',
  791. columnWidth: 0.33
  792. },{
  793. columnWidth: 0.33,
  794. xtype: 'textfield',
  795. fieldLabel: '发起时间',
  796. name: 'jp_launchTime',
  797. id:'jp_launchTime',
  798. readOnly: true,
  799. fieldStyle: 'background:#f0f0f0;border: 1px solid #8B8970;'
  800. },{
  801. fieldLabel: '发起人',
  802. columnWidth: 0.33,
  803. xtype: 'textfield',
  804. id:'jp_launcherName',
  805. name: 'jp_launcherName',
  806. readOnly: true,
  807. fieldStyle: 'background:#f0f0f0;border: 1px solid #8B8970;'
  808. },{
  809. fieldLabel: '节点名称',
  810. id: 'jp_nodeName',
  811. name: 'jp_nodeName',
  812. xtype: 'textfield',
  813. readOnly: true,
  814. fieldStyle: 'background:#f0f0f0;border: 1px solid #8B8970;'
  815. },{
  816. fieldLabel: '处理人',
  817. id: 'jp_nodeDealMan',
  818. name: 'jp_nodeDealMan',
  819. xtype: 'textfield',
  820. fieldStyle: 'background:#f0f0f0;border: 1px solid #8B8970;',
  821. readOnly: true,
  822. listeners:{
  823. change:function(field){
  824. var em=Ext.getCmp('jp_nodeDealMan').getValue();
  825. var btn=Ext.getCmp('dealbutton');
  826. if(em!=em_code) btn.setDisabled(true);
  827. }
  828. }
  829. },{
  830. fieldLabel: '审批状态',
  831. id:'jp_status',
  832. name:'jp_status',
  833. xtype: 'textfield',
  834. fieldStyle: 'background:#f0f0f0;border: 1px solid #8B8970;',
  835. readOnly: true
  836. }],
  837. loader: {
  838. url: basePath + 'common/getCurrentNode.action',
  839. renderer: function(loader, response, active) {
  840. var res = Ext.decode(response.responseText);
  841. if(res.info.currentnode.jp_nodeDealMan){
  842. res.info.currentnode.jp_nodeDealMan=res.info.dealmanname+"("+res.info.currentnode.jp_nodeDealMan+")";
  843. }else res.info.currentnode.jp_nodeDealMan=res.info.dealmanname+"("+res.info.currentnode.jp_candidate+")";
  844. res.info.currentnode.jp_launchTime = Ext.Date.format(new Date(res.info.currentnode.jp_launchTime), 'Y-m-d H:i:s');
  845. this.target.getForm().setValues(res.info.currentnode);
  846. return true;
  847. },
  848. autoLoad: true,
  849. params: {
  850. jp_nodeId: localJson.node,
  851. _noc:1
  852. }
  853. },
  854. buttonAlign: 'center',
  855. buttons: [{
  856. text: $I18N.common.button.erpFlowButton,
  857. iconCls: 'x-button-icon-scan',
  858. cls: 'x-btn-gray',
  859. id:'dealbutton',
  860. handler: function(btn){
  861. me.FormUtil.onAdd(caller + '_flow', '流程处理', 'jsps/common/jprocessDeal.jsp?formCondition=jp_nodeidIS' + localJson.node);
  862. }
  863. },{
  864. text : '关 闭',
  865. iconCls: 'x-button-icon-close',
  866. cls: 'x-btn-gray',
  867. handler : function(){
  868. Ext.getCmp('win-flow' + id).close();
  869. }
  870. }]
  871. });
  872. Ext.create('Ext.window.Window', {
  873. id : 'win-flow' + id,
  874. title: '<span style="color:#CD6839;">流程处理</span>',
  875. iconCls: 'x-button-icon-set',
  876. closeAction: 'hide',
  877. height: "90%",
  878. width: "90%",
  879. modal:true,
  880. maximizable : true,
  881. buttonAlign : 'center',
  882. layout : 'fit',
  883. items:[{
  884. xtype:'tabpanel',
  885. frame:true,
  886. layout:'fit',
  887. items:[{
  888. title:'处理明细',
  889. layout:'anchor',
  890. frame:true,
  891. items:[form, Ext.create("erp.view.common.JProcess.GridPanel",{
  892. anchor: '100% 80%' ,
  893. nodeId: localJson.node
  894. })]
  895. },{
  896. title : '节点设置',
  897. buttonAlign : 'center',
  898. layout : 'fit',
  899. items:[{
  900. title:'设置流程节点',
  901. anchor: '100% 90%' ,
  902. xtype:'SetNodeGridPanel',
  903. keyValue: id,
  904. FlowCaller:caller
  905. }],
  906. buttons:['->',{
  907. text:'保 存',
  908. iconCls: 'x-button-icon-save',
  909. cls: 'x-btn-gray',
  910. width : 65,
  911. style: {
  912. marginLeft: '10px'
  913. },
  914. handler:function(btn){
  915. var win=btn.ownerCt.ownerCt,grid=win.items.items[0];
  916. var msg=grid.GridUtil.checkGridDirty(grid);
  917. if(msg==''){
  918. Ext.Msg.alert('提示','无任何修改!');
  919. }else {
  920. var param= grid.GridUtil.getGridStore(grid);
  921. param= unescape("[" + param.toString().replace(/\\/g,"%") + "]");
  922. me.FormUtil.setLoading(true);
  923. var url=grid.xtype=='TaskGridPanel'?'plm/task/updatePageTask.action?_noc=1':'common/updateJnodePerson.action?_noc=1';
  924. Ext.Ajax.request({
  925. url : basePath+url,
  926. params: {
  927. param:param,
  928. caller:caller,
  929. keyValue:id
  930. },
  931. method : 'post',
  932. callback : function(options,success,response){
  933. me.FormUtil.setLoading(false);
  934. var localJson = new Ext.decode(response.responseText);
  935. if(localJson.success){
  936. showMessage('提示', '保存成功!', 1000);
  937. grid.loadNewStore(grid,caller,id);
  938. }else if(localJson.exceptionInfo != null){
  939. showError(res.exceptionInfo);return;
  940. }
  941. }
  942. });
  943. }
  944. }
  945. },{
  946. text:'关 闭',
  947. iconCls: 'x-button-icon-close',
  948. cls: 'x-btn-gray',
  949. width: 65,
  950. style: {
  951. marginLeft: '10px'
  952. },
  953. handler:function(btn){
  954. Ext.getCmp('win-flow' + id).close();
  955. }
  956. },'->']
  957. },{
  958. title : '流程图',
  959. items:[{
  960. tag : 'iframe',
  961. style:{
  962. background:'#f0f0f0',
  963. border:'none'
  964. },
  965. frame : true,
  966. border : false,
  967. layout : 'fit',
  968. height:window.innerHeight*0.9,
  969. iconCls : 'x-tree-icon-tab-tab',
  970. html : '<iframe id="iframe_maindetail_" src="'+basePath+'workfloweditor/workfloweditorscan.jsp?jdId='+localJson.jd+"&type="+localJson.type+"&nodeId="+localJson.node+'" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
  971. }]
  972. },{
  973. title:'历史处理明细',
  974. layout:'anchor',
  975. frame:true,
  976. items:[Ext.create("erp.view.common.JProcess.AllHistoryGridPanel",{
  977. anchor: '100% 100%' ,
  978. nodeId: localJson.node
  979. })]
  980. }]
  981. }]
  982. }).show();
  983. }
  984. } else {
  985. showMessage("提示", "当前单据无流程处理!");
  986. }
  987. }
  988. });
  989. },
  990. SetNodeDealMan:function(id){
  991. var me=this;
  992. var nodewin=Ext.getCmp('win-nodeflow'+id);
  993. if(nodewin){
  994. nodewin.show();
  995. }else {
  996. Ext.create('Ext.window.Window', {
  997. id : 'win-nodeflow' + id,
  998. title: '<span style="color:#CD6839;">单据设置</span>',
  999. iconCls: 'x-button-icon-set',
  1000. closable: false,
  1001. height: "100%",
  1002. width: "90%",
  1003. maximizable : true,
  1004. buttonAlign : 'center',
  1005. layout : 'fit',
  1006. items:[{
  1007. title:'设置流程节点',
  1008. anchor: '100% 90%' ,
  1009. xtype:'SetNodeGridPanel',
  1010. keyValue: id,
  1011. FlowCaller:caller
  1012. }],
  1013. buttons:['->',{
  1014. text:'保 存',
  1015. iconCls: 'x-button-icon-save',
  1016. cls: 'x-btn-gray',
  1017. width : 65,
  1018. style: {
  1019. marginLeft: '10px'
  1020. },
  1021. handler:function(btn){
  1022. var win=btn.ownerCt.ownerCt,grid=win.items.items[0];
  1023. var msg=grid.GridUtil.checkGridDirty(grid);
  1024. if(msg==''){
  1025. Ext.Msg.alert('提示','无任何修改!');
  1026. }else {
  1027. var param= grid.GridUtil.getGridStore(grid);
  1028. param= unescape("[" + param.toString().replace(/\\/g,"%") + "]");
  1029. me.FormUtil.setLoading(true);
  1030. var url=grid.xtype=='TaskGridPanel'?'plm/task/updatePageTask.action?_noc=1':'common/updateJnodePerson.action?_noc=1';
  1031. Ext.Ajax.request({
  1032. url : basePath+url,
  1033. params: {
  1034. param:param,
  1035. caller:caller,
  1036. keyValue:id
  1037. },
  1038. method : 'post',
  1039. callback : function(options,success,response){
  1040. me.FormUtil.setLoading(false);
  1041. var localJson = new Ext.decode(response.responseText);
  1042. if(localJson.success){
  1043. showMessage('提示', '保存成功!', 1000);
  1044. grid.loadNewStore(grid,caller,id);
  1045. }else if(localJson.exceptionInfo != null){
  1046. showError(res.exceptionInfo);return;
  1047. }
  1048. }
  1049. });
  1050. }
  1051. }
  1052. },{
  1053. text:'关 闭',
  1054. iconCls: 'x-button-icon-close',
  1055. cls: 'x-btn-gray',
  1056. width: 65,
  1057. style: {
  1058. marginLeft: '10px'
  1059. },
  1060. handler:function(btn){
  1061. btn.ownerCt.ownerCt.hide();
  1062. var form=Ext.getCmp('form');
  1063. var f = form.statuscodeField;
  1064. if(Ext.getCmp(f) && Ext.getCmp(f).value == 'ENTERING'){
  1065. showMessage('提示', '提交成功!', 1000);
  1066. window.location.reload();
  1067. }
  1068. }
  1069. },'->']
  1070. }).show();
  1071. }
  1072. },
  1073. /**
  1074. * 关联查询
  1075. */
  1076. showRelativeQuery: function() {
  1077. var me = this,
  1078. win = Ext.getCmp('ext-relative-query');
  1079. if(!win) {
  1080. win = Ext.create('Ext.Window', {
  1081. id: 'ext-relative-query',
  1082. width: '90%',
  1083. height: '90%',
  1084. modal:true,
  1085. closeAction: 'hide',
  1086. //title: '<font style="font-family: KaiTi;color:#333;">' + me.title + '</font>--查询',
  1087. title: '<span style="color:#CD6839;">关联查询</span>',
  1088. iconCls: 'x-button-icon-set',
  1089. layout: 'anchor',
  1090. items: [{
  1091. tag : 'iframe',
  1092. frame : true,
  1093. anchor : '100% 100%',
  1094. layout : 'fit',
  1095. html : '<iframe src="' + basePath + 'jsps/common/relativeSearch.jsp?whoami=' + caller + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
  1096. }]
  1097. });
  1098. }
  1099. win.show();
  1100. },
  1101. showHelpWindow:function(){
  1102. var me = this,
  1103. win = Ext.getCmp('ext-help'),path;
  1104. Ext.Ajax.request({
  1105. url : basePath + 'ma/help/scan.action',
  1106. params: {
  1107. caller:caller
  1108. },
  1109. method : 'get',
  1110. async:false,
  1111. callback : function(opt, s, res){
  1112. var r = new Ext.decode(res.responseText);
  1113. if(r.exceptionInfo){
  1114. showError(r.exceptionInfo);
  1115. } else if(r.success){
  1116. path=r.path;
  1117. }
  1118. }
  1119. });
  1120. if(!win) {
  1121. win = Ext.create('Ext.Window', {
  1122. id: 'ext-help',
  1123. width: '90%',
  1124. height: '100%',
  1125. closeAction: 'hide',
  1126. title: '帮助文档',
  1127. modal:true,
  1128. layout: 'border',
  1129. items: [{
  1130. region:'center',
  1131. tag : 'iframe',
  1132. layout : 'fit',
  1133. html : '<iframe src="' + basePath + path + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
  1134. }/*,{
  1135. region: 'south',
  1136. height: 100,
  1137. split: true,
  1138. collapsible: true,
  1139. title: '相关信息',
  1140. minHeight:60,
  1141. collapsed: true,
  1142. html: '相关信息'
  1143. }*/]
  1144. });
  1145. }
  1146. win.show();
  1147. },
  1148. parseVoucherConfig : function(config) {
  1149. var form = this, keys = Ext.Object.getKeys(config), args = {};
  1150. Ext.each(keys, function(k){
  1151. if (typeof config[k] === 'function') {
  1152. args[k] = config[k].call(null, form);
  1153. } else if (k == 'yearmonth') {
  1154. args[k] = form.getYearmonthByField(config[k]);
  1155. } else if (k == 'datas') {
  1156. args[k] = form.getDataByField(config[k]);
  1157. } else {
  1158. args[k] = config[k];
  1159. }
  1160. });
  1161. return args;
  1162. },
  1163. createVoucher: function(config) {
  1164. var me = this, args = this.parseVoucherConfig(config);
  1165. if('unneed' == args.kind) {
  1166. showMessage('提示', '该类型单据无需制作凭证!');
  1167. return;
  1168. }
  1169. me.getVoucher(function(data){
  1170. var vf = me.voucherConfig.voucherField;
  1171. if (!Ext.isEmpty(data[vf])) {
  1172. if(data[vf] != 'UNNEED') {
  1173. var box = Ext.create('Ext.window.MessageBox', {
  1174. buttonAlign : 'center',
  1175. buttons: [{
  1176. text: '查看凭证',
  1177. handler: function(b) {
  1178. me.linkVoucher(data);
  1179. b.ownerCt.ownerCt.close();
  1180. }
  1181. },{
  1182. text: '取消凭证',
  1183. handler: function(b) {
  1184. me.onVoucherUnCreate(args);
  1185. b.ownerCt.ownerCt.close();
  1186. }
  1187. },{
  1188. text: '关闭',
  1189. handler : function(b) {
  1190. b.ownerCt.ownerCt.close();
  1191. }
  1192. }]
  1193. });
  1194. box.show({
  1195. title : "提示",
  1196. msg : "当前单据已制作过凭证:" + data[vf],
  1197. icon : Ext.MessageBox.QUESTION
  1198. });
  1199. } else
  1200. showMessage('提示', '该类型单据无需制作凭证!');
  1201. } else {
  1202. warnMsg('现在制作凭证?', function(b){
  1203. if (b == 'ok' || b == 'yes') {
  1204. me.beforeVoucherCreate(args);
  1205. }
  1206. });
  1207. }
  1208. });
  1209. },
  1210. beforeVoucherCreate : function(args) {
  1211. var me = this;
  1212. if(me.keyField && me.statusField) {
  1213. var val = me.down('#' + me.keyField).getValue(),
  1214. params = {
  1215. caller: me.tablename,
  1216. field: me.voucherConfig.status || me.statusField,
  1217. condition: me.keyField + '=' + val
  1218. };
  1219. Ext.Ajax.request({
  1220. url : basePath + 'common/getFieldData.action',
  1221. params: params,
  1222. method : 'post',
  1223. callback : function(opt, s, res){
  1224. var r = new Ext.decode(res.responseText);
  1225. if(r.exceptionInfo){
  1226. showError(r.exceptionInfo);
  1227. } else if(r.success && (args.statusValue || 'POSTED') == r.data){
  1228. me.onVoucherCreate(args);
  1229. } else {
  1230. showError('单据还未过账!');
  1231. }
  1232. }
  1233. });
  1234. }
  1235. },
  1236. onVoucherCreate : function(args) {
  1237. var me = this;
  1238. me.setLoading(true);
  1239. Ext.Ajax.request({
  1240. url: basePath + 'fa/vc/createVoucher.action',
  1241. params: args,
  1242. callback: function(opt, s, r) {
  1243. me.setLoading(false);
  1244. var rs = Ext.decode(r.responseText);
  1245. if(rs.exceptionInfo) {
  1246. showError(rs.exceptionInfo);
  1247. } else {
  1248. if(rs.success && rs.content){
  1249. var msg = "";
  1250. Ext.Array.each(rs.content, function(item){
  1251. if(item.errMsg) {
  1252. msg += item.errMsg + '<hr>';
  1253. } else if(item.id) {
  1254. msg += '凭证号:<a href="javascript:openUrl2(\'jsps/fa/ars/voucher.jsp?formCondition=vo_idIS'
  1255. + item.id + '&gridCondition=vd_voidIS' + item.id + '\',\'凭证\',\'vo_id\','+item.id+');">' + item.code + '</a><hr>';
  1256. }
  1257. });
  1258. showMessage('提示', msg);
  1259. }
  1260. }
  1261. }
  1262. });
  1263. },
  1264. onVoucherUnCreate : function(args) {
  1265. var me = this;
  1266. me.setLoading(true);
  1267. Ext.Ajax.request({
  1268. url: basePath + 'fa/vc/unCreateVoucher.action',
  1269. params: args,
  1270. callback: function(opt, s, r) {
  1271. me.setLoading(false);
  1272. var rs = Ext.decode(r.responseText);
  1273. if(rs.exceptionInfo) {
  1274. showError(rs.exceptionInfo);
  1275. } else if(rs.error) {
  1276. showMessage('提示', rs.error);
  1277. } else {
  1278. showMessage('提示', '取消成功!');
  1279. var vf = me.voucherConfig.voucherField, v = me.down('#' + vf);
  1280. v && v.setValue(null);
  1281. }
  1282. }
  1283. });
  1284. },
  1285. getDataByField : function(field) {
  1286. var form = this, f = form.child('#' + field);
  1287. return f ? "'" + f.getValue() + "'" : '';
  1288. },
  1289. getYearmonthByField : function(field) {
  1290. var form = this;
  1291. var f = form.child('#' + field),
  1292. v = f ? (Ext.isDate(f.value) ? f.value : Ext.Date.parse(f.value, 'Y-m-d')) : new Date();
  1293. return Ext.Date.format(v, 'Ym');
  1294. },
  1295. getVoucher : function(callback) {
  1296. var me = this, vf = me.voucherConfig.voucherField;
  1297. Ext.Ajax.request({
  1298. url : basePath + 'common/getFieldsData.action',
  1299. params: {
  1300. caller : me.tablename + ' left join voucher on vo_code=' + vf,
  1301. fields : 'vo_id,' + vf,
  1302. condition : me.keyField + '=' + me.down('#' + me.keyField).value
  1303. },
  1304. method : 'post',
  1305. callback : function(opt, s, res){
  1306. var r = new Ext.decode(res.responseText);
  1307. if(r.exceptionInfo){
  1308. showError(r.exceptionInfo);return;
  1309. }
  1310. if(r.success){
  1311. callback.call(null, r.data || {});
  1312. }
  1313. }
  1314. });
  1315. },
  1316. linkVoucher : function(data) {
  1317. this.FormUtil.onAdd(null, '凭证', 'jsps/fa/ars/voucher.jsp?formCondition=vo_idIS' +
  1318. data.vo_id + '&gridCondition=vd_voidIS' + data.vo_id);
  1319. },
  1320. addTask : function() {
  1321. var me=this,win=Ext.getCmp('win_task');
  1322. if(!win){
  1323. win=Ext.create('Ext.window.Window', {
  1324. id : 'win_task',
  1325. title: '发起任务',
  1326. iconCls: 'x-button-icon-set',
  1327. closeAction: 'hide',
  1328. width: '90%',
  1329. height: '90%',
  1330. modal:true,
  1331. maximizable : true,
  1332. buttonAlign : 'center',
  1333. layout : 'anchor',
  1334. items: [{
  1335. anchor: '100% 100%',
  1336. xtype: 'TaskPanel',
  1337. sourceForm:me
  1338. }]
  1339. });
  1340. }
  1341. win.show();
  1342. },
  1343. getIdentity : function(){
  1344. // 取唯一值
  1345. var me = this, identity = me.identity, kfield = me.keyField;
  1346. if (identity) {
  1347. return (typeof identity === 'function' ? identity.call(me) : identity);
  1348. } else if (kfield) {
  1349. return Ext.getCmp(kfield).value;
  1350. }
  1351. return null;
  1352. },
  1353. expData : function() {
  1354. window.open(basePath + 'common/dump/exp.action?type=' + caller + "&identity=" + encodeURIComponent(this.getIdentity()));
  1355. }
  1356. });