table.js 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486
  1. /**
  2. * 当控件为只读时不让光标进入
  3. * @param target
  4. */
  5. function FWnoPointer(target){
  6. if(jQuery(target).attr("readOnly")){
  7. //设置tab键为最大避免光标进入时出不来
  8. jQuery(target).attr("tabindex","10000000");
  9. jQuery(target).bind('focus.readOnly',function(event){
  10. this.blur();
  11. return true;
  12. });
  13. }
  14. }
  15. /**
  16. * 显示隐藏表格
  17. * @param imgId
  18. * @param tableId
  19. */
  20. function FWshowTable(imgId,tableId){
  21. var tableDivObj = document.getElementById(tableId);
  22. var imageObj = document.getElementById(imgId);
  23. var srcPath = imageObj.src;
  24. var re;
  25. tableDivObj.style.display = (tableDivObj.style.display=="none"?"block":"none");
  26. if(tableDivObj.style.display=='none'){
  27. re = /right/g;
  28. imageObj.src=srcPath.replace(re,'down');
  29. var ft = $("#"+tableId).parent("fieldset").get(0);
  30. var needMoveArchiveBtn = ft.needMoveArchiveBtn;
  31. if("true" == needMoveArchiveBtn){
  32. var fwgtid = ft.fwgtid;
  33. var tblArchiveDiv = document.getElementById(fwgtid+"_archive_div");
  34. if(null != tblArchiveDiv){
  35. var tblHeight = $("#" + fwgtid).parent().outerHeight();
  36. tblArchiveDiv.style.top = parseInt(tblArchiveDiv.style.top) - tblHeight;
  37. }
  38. }
  39. }else{
  40. re = /down/g;
  41. imageObj.src=srcPath.replace(re,'right');
  42. $(document).trigger('gridlazyInit');
  43. FWresizeObject(tableDivObj);
  44. if($("div:first",tableDivObj).hasClass("fwdatagrid")){
  45. $(tableDivObj).fwdatagrid('setSize',tableDivObj);
  46. }
  47. var ft = $("#"+tableId).parent("fieldset").get(0);
  48. var needMoveArchiveBtn = ft.needMoveArchiveBtn;
  49. if("true" == needMoveArchiveBtn){
  50. var fwgtid = $("#"+tableId).parent("fieldset").get(0).fwgtid;
  51. var tblArchiveDiv = document.getElementById(fwgtid+"_archive_div");
  52. if(null != tblArchiveDiv){
  53. var tblHeight = $("#" + fwgtid).parent().outerHeight();
  54. tblArchiveDiv.style.top = parseInt(tblArchiveDiv.style.top) + tblHeight;
  55. }
  56. }
  57. }
  58. }
  59. /**
  60. * 单击回车键就调用TAB键
  61. * @param event
  62. * @returns {Boolean}
  63. */
  64. function FWenterToTab(event){
  65. //8 backspace 9 tab 46 delete
  66. if(event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 46){
  67. return true;
  68. }
  69. if (event.keyCode == 13) {
  70. event.keyCode = 9;
  71. return true;
  72. }
  73. if(event.ctrlKey||event.shiftKey){return true;}
  74. return false;
  75. }
  76. /**
  77. * 初始化表格的控件
  78. * @param tableId
  79. */
  80. function FWinitObject(tableId){
  81. var tableDivObj = document.getElementById(tableId);
  82. //获取全部的下拉框的宽度保存到mw属性值内
  83. //注意目前只有这种方式才能让下拉框的宽度保持一致;
  84. //fwcombox.js init(target) 函数内会引用到
  85. jQuery('select',tableDivObj).each(function(){
  86. var mw = $(this).outerWidth();
  87. $(this).attr('mw',mw);
  88. });
  89. $(':input',tableDivObj).each(function(){
  90. FWObjInit(this);
  91. });
  92. }
  93. /**
  94. * 初始化每个控件
  95. * @param obj 控件对象
  96. */
  97. function FWObjInit(obj){
  98. var input = $(obj);
  99. jQuery(obj).each(function(){
  100. //有disabled的属性改成readOnly 目的是改变字体的颜色
  101. if(this.type=='checkbox'||this.type=='radio'){
  102. return true;
  103. }
  104. if(this.type=='text'||this.type=='textarea'){
  105. //下拉框的不用理会
  106. if($(this).hasClass('fwcombox-text')){
  107. return true;
  108. }
  109. //可编辑多记录表的下拉框不用理会
  110. if(this.cmb=='true'){
  111. return true;
  112. }
  113. if($(this).attr('disabled')==true){
  114. $(this).removeAttr('disabled');
  115. $(this).attr("readOnly",true);
  116. toDisabledObj(this);
  117. }
  118. if($(this).attr('readOnly')==true){
  119. toDisabledObj(this);
  120. }
  121. }
  122. });
  123. //一般的单行文本输入框
  124. if(input.hasClass('textbox')){
  125. FWinitTextBox(obj);
  126. return true;
  127. }
  128. // 身份证录入框
  129. if(input.hasClass('idcardbox')){
  130. FWinitIdCardBox(obj);
  131. return true;
  132. }
  133. //只能录入数值框
  134. if(input.hasClass('numberbox')){
  135. FWinitNumberBox(obj);
  136. return true;
  137. }
  138. //只能录入浮点数
  139. if(input.hasClass('floatbox')){
  140. FWinitFloatBox(obj);
  141. return true;
  142. }
  143. //只能录入日期
  144. if(input.hasClass('datebox')){
  145. input.datepicker();
  146. FWinitDateBox(obj);
  147. return true;
  148. }
  149. //只能录入日期 时间
  150. if(input.hasClass('datetime')){
  151. FWinitDateTime(obj);
  152. return true;
  153. }
  154. //只录入时分
  155. if(input.hasClass('timebox')){
  156. FWinitTimeBox(obj);
  157. return true;
  158. }
  159. //只录入中文
  160. if(input.hasClass('chinessbox')){
  161. FWinitChinessBox(obj);
  162. return true;
  163. }
  164. //只能录入年月
  165. if(input.hasClass('yearmonthbox')){
  166. FWinitYearmonthBox(obj);
  167. return true;
  168. }
  169. if(input.hasClass('bankaccount')){
  170. FWInitBankaccount(obj);
  171. return true;
  172. }
  173. //只能录入邮政编码
  174. if(input.hasClass('postbox')){
  175. FWinitPostBox(obj);
  176. return true;
  177. }
  178. //只能录入电话号码
  179. if(input.hasClass('phonebox')){
  180. FWinitPhoneBox(obj);
  181. return true;
  182. }
  183. //不允许复制拷贝录入框
  184. if(input.hasClass('notpastebox')){
  185. FWinitNotpasteBox(obj);
  186. return true;
  187. }
  188. //对普通的下拉框进行封装
  189. if(input.hasClass('combobox')){
  190. var __this = obj;
  191. $(__this).fwcombox({editable:false});
  192. var span =jQuery.data(__this,'fwcombox').fwcombox;
  193. var arrow = span.find('span.fwcombox-arrow');
  194. jQuery(__this).bind('blur',function(){
  195. //若为只读则不往下执行
  196. if(jQuery(__this).attr("readOnly")){return true;}
  197. var msg = FWelementValidate(__this);
  198. if(msg!=null){
  199. FWvalidateTip(arrow,msg);
  200. } else {
  201. $(arrow).qtip("destroy");
  202. }
  203. });
  204. return true;
  205. }
  206. //对可录入下拉框进行封装
  207. if(input.hasClass('incombox')){
  208. var __this = obj;
  209. $(__this).fwcombox({editable:true});
  210. var span =jQuery.data(__this,'fwcombox').fwcombox;
  211. var arrow = span.find('span.fwcombox-arrow');
  212. jQuery(__this).bind('blur',function(){
  213. //若为只读则不往下执行
  214. if(jQuery(__this).attr("readOnly")){return true;}
  215. var msg = FWelementValidate(__this);
  216. if(msg!=null){
  217. FWvalidateTip(arrow,msg);
  218. } else {
  219. $(arrow).qtip("destroy");
  220. }
  221. });
  222. return true;
  223. }
  224. //对可录入远程数据库查询下拉框进行封装
  225. if(input.hasClass('dbcombox')){
  226. input.fwcombox({editable:true,remotedb:true});
  227. return true;
  228. }
  229. //联动下拉框 现在已经不用这种方式
  230. //处理目的:当父下拉框选择某项值后,根据此值过滤子下拉框的内容
  231. if(input.hasClass('ldcombox')){
  232. input.fwcombox({editable:false,ldcombox:true});
  233. return true;
  234. }
  235. }
  236. /**
  237. * 初始化textbox
  238. * @param obj
  239. */
  240. function FWinitTextBox(obj){
  241. jQuery(obj).bind('keydown',function(event){
  242. if(FWenterToTab(event)){
  243. return true;
  244. }
  245. });
  246. //焦点失去事件
  247. jQuery(obj).bind('blur',function(){
  248. //若为只读则不往下执行
  249. if(jQuery(this).attr("readOnly")){return true;}
  250. var msg = FWelementValidate(this);
  251. if(msg!=null){
  252. FWvalidateTip(this,msg);
  253. } else {
  254. $(this).qtip("destroy");
  255. }
  256. });
  257. }
  258. /**
  259. * 初始化idcardbox
  260. * @param obj
  261. */
  262. function FWinitIdCardBox(obj){
  263. // 焦点失去事件
  264. jQuery(obj).bind('blur',function(){
  265. // 若为只读则不往下执行
  266. if(jQuery(this).attr("readOnly")){return true;}
  267. var msg = FWelementValidate(this);
  268. if(msg!=null){
  269. FWvalidateTip(this,msg);
  270. return true;
  271. } else {
  272. $(this).qtip("destroy");
  273. }
  274. FWidcard(this);
  275. });
  276. jQuery(obj).bind('keydown',function(event){
  277. if(FWenterToTab(event)){
  278. return true;
  279. }
  280. if(event.keyCode == 88){// X
  281. return true;
  282. }
  283. // 只能录入数字
  284. if(FWNumOnly(event)){
  285. return true;
  286. }
  287. return false;
  288. });
  289. }
  290. /**
  291. *初始化数字框
  292. */
  293. function FWinitNumberBox(obj){
  294. var val = obj.value;
  295. val = val.replace(/,/g,'');
  296. obj.value = val;
  297. jQuery(obj).bind('keydown',function(event){
  298. if(FWenterToTab(event)){
  299. return true;
  300. }
  301. switch(event.keyCode){
  302. case 189:// -
  303. case 109:// -(小键盘)
  304. case 190:// .
  305. case 110:// .(小键盘)
  306. case 35:// (End)
  307. case 36:// (Home)
  308. case 37://< (Left)
  309. case 39://> (Right)
  310. return true;
  311. default:
  312. return FWNumOnly(event);
  313. }
  314. });
  315. //焦点失去事件
  316. jQuery(obj).bind('blur',function(){
  317. //若为只读则不往下执行
  318. if(jQuery(this).attr("readOnly")){return true;}
  319. var msg = FWelementValidate(this);
  320. if(msg!=null){
  321. FWvalidateTip(this,msg);
  322. return;
  323. } else {
  324. $(this).qtip("destroy");
  325. }
  326. // 尝试转化为数值型,继续测试是否为整形
  327. try{
  328. var number = this.value;
  329. if(!isFinite(number)){
  330. // 非数值类型,清空输入框
  331. this.value = "";
  332. FWvalidateTip(this,"此输入框只能录入数字!");
  333. }else{
  334. // 转换成可以理解的数值(去除重复的“--”和“..”)
  335. this.value = number;
  336. }
  337. }catch(e){
  338. this.value = "";
  339. }
  340. });
  341. }
  342. /**
  343. * 初始化floatbox
  344. * @param obj
  345. */
  346. function FWinitFloatBox(obj){
  347. jQuery(obj).bind('keydown',function(event){
  348. if(FWenterToTab(event)){
  349. return true;
  350. }
  351. switch(event.keyCode){
  352. case 189://-
  353. case 109://-(小键盘)
  354. case 190://.
  355. case 110://.(小键盘)
  356. case 35:// (End)
  357. case 36:// (Home)
  358. case 37://< (Left)
  359. case 39://> (Right)
  360. return true;
  361. default:
  362. return FWNumOnly(event);
  363. }
  364. return false;
  365. });
  366. //焦点失去事件
  367. jQuery(obj).bind('blur',function(){
  368. //若为只读则不往下执行
  369. if(jQuery(this).attr("readOnly")){return true;}
  370. var sValue = this.value;
  371. if(sValue!=null&&sValue.length>0){
  372. sValue = parseFloat(sValue,10);
  373. if(isNaN(sValue)){
  374. this.value = '';
  375. FWvalidateTip(this,'不是一个浮点数值!');
  376. return;
  377. } else {
  378. $(this).qtip("destroy");
  379. }
  380. this.value = sValue;
  381. sValue = sValue+"";
  382. var iPos = sValue.indexOf(".");
  383. if(iPos==-1){
  384. this.value = sValue+'.00';
  385. }
  386. }
  387. var msg = FWelementValidate(this);
  388. if(msg!=null){
  389. FWvalidateTip(this,msg);
  390. return;
  391. } else {
  392. $(this).qtip("destroy");
  393. }
  394. });
  395. }
  396. /**
  397. * 初始化日期控件
  398. * @param obj
  399. */
  400. function FWinitDateBox(obj){
  401. var val = obj.value;
  402. val = val.replace(/,/g,'');
  403. if(val.length==8){
  404. obj.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2);
  405. }
  406. jQuery(obj).bind('keydown',function(event){
  407. if(FWenterToTab(event)){
  408. return true;
  409. }
  410. if (event.keyCode == 189){ //-
  411. return true;
  412. }
  413. if (event.keyCode == 109){ //-
  414. return true;
  415. }
  416. if (event.keyCode == 191) { // /
  417. return true;
  418. }
  419. if(FWNumOnly(event)){
  420. return true;
  421. }
  422. return false;
  423. });
  424. //焦点失去事件
  425. jQuery(obj).bind('change',function(){
  426. var val = this.value;
  427. if(val.length==8){
  428. this.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2);
  429. }
  430. if(!FWdatebox(this,'yyyy-mm-dd')){
  431. return;
  432. }
  433. var msg = FWelementValidate(this);
  434. if(msg!=null){
  435. FWvalidateTip(this,msg);
  436. } else {
  437. $(this).qtip("destroy");
  438. }
  439. });
  440. }
  441. /**
  442. * 初始化日期控件
  443. * @param obj
  444. */
  445. function FWinitDateTime(obj){
  446. var val = obj.value;
  447. val = val.replace(/,/g,'');
  448. if(val.length==14){
  449. obj.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2) + ' ' + val.substr(8,2) + ':'+ val.substr(10,2)+":"+ val.substr(12,2);
  450. }
  451. jQuery(obj).bind('keydown',function(event){
  452. if(FWenterToTab(event)){
  453. return true;
  454. }
  455. if(event.keyCode == 189){ //-
  456. return true;
  457. }
  458. if (event.keyCode == 109){ //-
  459. return true;
  460. }
  461. if(event.keyCode == 191) { // /
  462. return true;
  463. }
  464. if (event.keyCode == 186) { // :
  465. return true;
  466. }
  467. if (event.keyCode == 32) { // 空格
  468. return true;
  469. }
  470. if(FWNumOnly(event)){
  471. return true;
  472. }
  473. return false;
  474. });
  475. jQuery(obj).bind('blur',function(){
  476. //若为只读则不往下执行
  477. if(jQuery(this).attr("readOnly")){return true;}
  478. //yyyy-mm-dd hh:mm:ss
  479. var val = this.value;
  480. //用户只录入201009011223 改成 2010-09-01 12:23:00
  481. if(val.length==12){
  482. this.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2) + ' ' + val.substr(8,2) + ':'+ val.substr(10,2)+":00";
  483. }
  484. //用户只录入20100901 1223 改成 2010-09-01 12:23:00
  485. if(val.length==13){
  486. this.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2) + ' ' + val.substr(9,2) + ':'+ val.substr(11,2)+":00";
  487. }
  488. //用户只录入20101010121212 改成 2010-10-10 12:12:12
  489. if(val.length==14){
  490. this.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2) + ' ' + val.substr(8,2) + ':'+ val.substr(10,2)+":"+ val.substr(12,2);
  491. }
  492. if(!FWdatetime(this)) {
  493. return false;
  494. }
  495. var msg = FWelementValidate(this);
  496. if(msg!=null){
  497. FWvalidateTip(this,msg);
  498. } else {
  499. $(this).qtip("destroy");
  500. }
  501. });
  502. }
  503. /**
  504. * 初始化时间控件
  505. * @param obj
  506. */
  507. function FWinitTimeBox(obj){
  508. jQuery(obj).bind('keydown',function(event){
  509. if(FWenterToTab(event)){
  510. return true;
  511. }
  512. if (event.keyCode == 186) { // :
  513. return true;
  514. }
  515. if(FWNumOnly(event)){
  516. return true;
  517. }
  518. return false;
  519. });
  520. jQuery(obj).bind('blur',function(){
  521. var val = this.value;
  522. //若为只读则不往下执行
  523. if(jQuery(this).attr("readOnly")){return true;}
  524. //用户只录入录120505
  525. if(val.length==6){
  526. this.value=val.substr(0,2)+':'+ val.substr(2,2) + ':'+ val.substr(4,2);
  527. }
  528. //用户只录入1205 改成
  529. if(val.length==4){
  530. this.value=val.substr(0,2)+':'+ val.substr(2,2) + ':00';
  531. }
  532. if(!FWtimebox(this)){
  533. return;
  534. }
  535. var msg = FWelementValidate(this);
  536. if(msg!=null){
  537. FWvalidateTip(this,msg);
  538. } else {
  539. $(this).qtip("destroy");
  540. }
  541. });
  542. }
  543. /**
  544. * 初始化只能录入中文控件
  545. * @param obj
  546. */
  547. function FWinitChinessBox(obj){
  548. jQuery(obj).bind('keydown',function(event){
  549. if(FWenterToTab(event)){
  550. return true;
  551. }
  552. return true;
  553. });
  554. jQuery(obj).bind('blur',function(){
  555. //若为只读则不往下执行
  556. if(jQuery(this).attr("readOnly")){return true;}
  557. if(!FWchiness(this)){
  558. return ;
  559. }
  560. var msg = FWelementValidate(this);
  561. if(msg!=null){
  562. FWvalidateTip(this,msg);
  563. } else {
  564. $(this).qtip("destroy");
  565. }
  566. });
  567. }
  568. /**
  569. * 初始化银行账号
  570. * @param obj
  571. */
  572. function FWInitBankaccount(obj){
  573. var val=obj.value;
  574. var temp='';
  575. val=val.replace(/\s+/g,"");
  576. for(var i=0;i<val.length;i++){
  577. if(i>0 && i%4==0){
  578. temp+=" ";
  579. }
  580. temp += val.substr (i,1);
  581. }
  582. obj.value=temp;
  583. jQuery(obj).bind('keydown',function(event){
  584. if(FWenterToTab(event)){
  585. return true;
  586. }
  587. switch(event.keyCode){
  588. case 189:// -
  589. case 109:// -(小键盘)
  590. case 35:// (End)
  591. case 36:// (Home)
  592. case 37://< (Left)
  593. case 39://> (Right)
  594. return true;
  595. default:
  596. return FWNumOnly(event);
  597. }
  598. return false;
  599. });
  600. jQuery(obj).bind('blur',function(){
  601. //若为只读则不往下执行
  602. if(jQuery(this).attr("readOnly")){return true;}
  603. if(obj.value==""){
  604. if( -1 != obj.name.indexOf("_HID_") ){
  605. var name=obj.name.substr( obj.name.indexOf("_HID_")+5);
  606. jQuery(':input[name="'+name+'"]').val('');
  607. }
  608. return true;
  609. }
  610. var val=obj.value;
  611. var temp='';
  612. val=val.replace(/\s+/g,"");
  613. for(var i=0;i<val.length;i++){
  614. if(i>0 && i%4==0){
  615. temp+=" ";
  616. }
  617. temp += val.substr (i,1);
  618. }
  619. obj.value=temp;
  620. if( -1 != obj.name.indexOf("_HID_") ){
  621. var name=obj.name.substr( obj.name.indexOf("_HID_")+5);
  622. jQuery(':input[name="'+name+'"]').val(val);
  623. }
  624. });
  625. }
  626. /**
  627. * 初始化录入年月控件
  628. * @param obj
  629. */
  630. function FWinitYearmonthBox(obj){
  631. jQuery(obj).bind('keydown',function(event){
  632. if(FWenterToTab(event)){
  633. return true;
  634. }
  635. //小键盘的数字区
  636. if(event.keyCode >= 96 && event.keyCode <= 105){
  637. return true;
  638. }
  639. //王码五笔字形无法录入数字的问题
  640. if(event.keyCode==229){
  641. return true;
  642. }
  643. if(event.keyCode >= 48 && event.keyCode <= 57 && event.ctrlKey == false && event.shiftKey == false){
  644. /* 解决当值在选中的状态下时输入数字会输入到前边 20110628 herong
  645. str = this.value;
  646. iLen = str.length;
  647. if(iLen>=6){
  648. this.value = str.substr(0,5);
  649. } */
  650. return true;
  651. }
  652. return false;
  653. });
  654. jQuery(obj).bind('blur',function(){
  655. //若为只读则不往下执行
  656. if(jQuery(this).attr("readOnly")){return true;}
  657. if(!FWyearmonth(this)) {
  658. return;
  659. }
  660. var msg = FWelementValidate(this);
  661. if(msg!=null){
  662. FWvalidateTip(this,msg);
  663. } else {
  664. $(this).qtip("destroy");
  665. }
  666. });
  667. }
  668. /**
  669. * 初始化邮编控件
  670. * @param obj
  671. */
  672. function FWinitPostBox(obj){
  673. jQuery(obj).bind('keydown',function(event){
  674. if(FWenterToTab(event)){
  675. return true;
  676. }
  677. //王码五笔字形无法录入数字的问题
  678. if(event.keyCode==229){
  679. return true;
  680. }
  681. //小键盘的数字区
  682. if(event.keyCode >= 96 && event.keyCode <= 105){
  683. return true;
  684. }
  685. if(event.keyCode >= 48 && event.keyCode <= 57 && event.ctrlKey == false && event.shiftKey == false) {
  686. str = this.value;
  687. iLen = str.length;
  688. if(iLen>=6){
  689. this.value = str.substr(0,5);
  690. }
  691. return true;
  692. }
  693. return false;
  694. });
  695. jQuery(obj).bind('blur',function(){
  696. //若为只读则不往下执行
  697. if(jQuery(this).attr("readOnly")){return true;}
  698. var msg = FWelementValidate(this);
  699. if(msg!=null){
  700. FWvalidateTip(this,msg);
  701. } else {
  702. $(this).qtip("destroy");
  703. }
  704. });
  705. }
  706. /**
  707. * 初始化电话控件
  708. * @param obj
  709. */
  710. function FWinitPhoneBox(obj){
  711. jQuery(obj).bind('keydown',function(event){
  712. if(FWenterToTab(event)){
  713. return true;
  714. }
  715. if(event.keyCode == 189){//-
  716. return true;
  717. }
  718. if(event.shiftKey==true && (event.keyCode==48||event.keyCode == 57)){//()
  719. return true;
  720. }
  721. if(FWNumOnly(event)){
  722. return true;
  723. }
  724. return false;
  725. });
  726. jQuery(obj).bind('blur',function(){
  727. //若为只读则不往下执行
  728. if(jQuery(this).attr("readOnly")){return true;}
  729. var msg = FWelementValidate(this);
  730. if(msg!=null){
  731. FWvalidateTip(this,msg);
  732. } else {
  733. $(this).qtip("destroy");
  734. }
  735. });
  736. }
  737. /**
  738. * 初始化不可粘贴控件
  739. * @param obj
  740. */
  741. function FWinitNotpasteBox(obj){
  742. jQuery(obj).bind('paste',function(event){
  743. return false;
  744. });
  745. jQuery(obj).bind('contextmenu',function(event){
  746. return false;
  747. });
  748. jQuery(obj).bind('keydown',function(event){
  749. if(FWenterToTab(event)){
  750. return true;
  751. }
  752. return true;
  753. });
  754. }
  755. /**
  756. * 证件类型的处理 选择了证件类型为身份证号码后,录入的证件号码
  757. * @param parentOBJ
  758. * @param childOBJ
  759. * 必须能校验
  760. */
  761. function FWzjlx(parentOBJ,childOBJ){
  762. var child = jQuery(childOBJ).attr("name");
  763. var parent = jQuery(parentOBJ).attr("name");
  764. jQuery(childOBJ).attr("pn",parent);
  765. jQuery(parentOBJ).attr("cn",child);
  766. jQuery(childOBJ).unbind('keydown');
  767. jQuery(childOBJ).bind('keydown',function(event){
  768. if(FWenterToTab(event)){
  769. return true;
  770. }
  771. if(parentOBJ.value=='6'){//为身份证号码
  772. if(event.keyCode == 88){//X
  773. return true;
  774. } //只能录入数字
  775. if(FWNumOnly(event)){
  776. return true;
  777. }
  778. return false;
  779. }
  780. return true;
  781. });
  782. //焦点失去事件
  783. jQuery(childOBJ).bind('blur',function(){
  784. if(parentOBJ.value=='6'){//为身份证号码
  785. FWidcard(this);
  786. }
  787. });
  788. }
  789. /**
  790. * 响应数据装载事件
  791. * @param ListID
  792. * @param FunName
  793. * @returns {Boolean}
  794. */
  795. function FWonListLoad(ListID,FunName){
  796. var target = eval('document.all.'+ListID);
  797. var opts = null;
  798. if(jQuery.data(target, 'fwdatagrid')!=null){
  799. opts = jQuery.data(target, 'fwdatagrid').options;
  800. }else{
  801. opts = jQuery.data(target, 'fweditgrid').options;
  802. }
  803. var fun = window[FunName];
  804. opts.onLoadSuccess = fun;
  805. return true;
  806. }
  807. /**
  808. * 响应单记录表双击事件
  809. * @param ListID
  810. * @param FunName
  811. * @returns {Boolean}
  812. */
  813. function FWonDblClickListRow(ListID,FunName){
  814. var target = eval('document.all.'+ListID);
  815. var opts = jQuery.data(target, 'fwdatagrid').options;
  816. var fun = window[FunName];
  817. opts.onDblClickRow = fun;
  818. return true;
  819. }
  820. /**
  821. * 响应多记录表单击事件
  822. * @param ListID
  823. * @param FunName
  824. * @returns {Boolean}
  825. */
  826. function FWonClickListRow(ListID,FunName){
  827. var target = eval('document.all.'+ListID);
  828. var opts = jQuery.data(target, 'fwdatagrid').options;
  829. var fun = window[FunName];
  830. opts.onClickRow = fun;
  831. return true;
  832. }
  833. /**
  834. * 重新装载数据
  835. * @param ListID
  836. * @param Where
  837. * @param pageNum 为刷新列表后显示第几页的数据,-1表示当前页,默认为1
  838. * @returns {Boolean}
  839. */
  840. function FWgetListData(ListID,Where,pageNum){
  841. var target = eval('document.all.'+ListID);
  842. var opts ;
  843. if(jQuery.data(target, 'fwdatagrid')!=null){
  844. opts = jQuery.data(target, 'fwdatagrid').options;
  845. opts.ReGetListData(target,Where,pageNum);
  846. return true;
  847. }
  848. if(jQuery.data(target, 'fweditgrid')!=null){
  849. opts = jQuery.data(target, 'fweditgrid').options;
  850. opts.ReGetListData(target,Where,pageNum);
  851. return true;
  852. }
  853. return true;
  854. }
  855. /**
  856. * form内部控件的设置和获取
  857. * 从html的form里面提取控件的值,用object表示,属性名是控件的名称,属性值是控件的值。
  858. * 如果form里面有重名控件,那么属性值是个数组。另外,checkbox和可以多选的下拉列表的值
  859. * 总是数组。
  860. */
  861. function FWGetForm(form){
  862. //先取有效的只
  863. var array = $(form).serializeArray();
  864. var rst = {};
  865. //重复的组织成数组
  866. $.each(array,function(index,element){
  867. if(typeof rst[element.name] !='undefined'){
  868. try{//加入数组
  869. rst[element.name].push(element.value);
  870. }catch(e){//合并
  871. rst[element.name]=[rst[element.name],element.value];
  872. }
  873. }else{
  874. rst[element.name]=element.value;
  875. }
  876. });
  877. //如果是字典项,添加字典项的中文在这个form里面
  878. $('.combobox,.incombox,.dbcombox,.ldcombox',form).each(function(){
  879. //看看这个控件的代码是否已在GetForm的取值范围内,如果是才取对应的中文值
  880. var name = this.name;
  881. if(rst[name]==null){
  882. return ;
  883. }
  884. //取对应的值
  885. var textValue = $(this).fwcombox('text');
  886. var textName = '_DIC_'+name;
  887. //表单中是否已经存在
  888. if(rst[textName]==null){
  889. //还没有则直接赋值
  890. rst[textName]= textValue;
  891. }else if(!jQuery.isArray(rst[textName])){
  892. //变成数组处理
  893. rst[textName]=[rst[textName],textValue];
  894. }else{
  895. //已经是数组的话,直接push即可
  896. rst[textName].push(textValue);
  897. }
  898. });
  899. $('.searchgridbox',form).each(function(){
  900. //看看这个控件的代码是否已在GetForm的取值范围内,如果是才取对应的中文值
  901. var name = this.name;
  902. if(rst[name]==null){
  903. return ;
  904. }
  905. //取对应的值
  906. var textValue = $(this).searchgrid('text');
  907. var textName = '_DIC_'+name;
  908. //表单中是否已经存在
  909. if(rst[textName]==null){
  910. //还没有则直接赋值
  911. rst[textName]= textValue;
  912. }else if(!jQuery.isArray(rst[textName])){
  913. //变成数组处理
  914. rst[textName]=[rst[textName],textValue];
  915. }else{
  916. //已经是数组的话,直接push即可
  917. rst[textName].push(textValue);
  918. }
  919. });
  920. //找出表单中所有的可能为数组的名称串
  921. if(rst['_multiple']){
  922. var _multiple =rst['_multiple'];
  923. if(typeof _multiple =='string'){
  924. _multiple=[_multiple];
  925. }
  926. _multiple=_multiple.join(',').split(',');
  927. //遍历所有可能多值的对象,全部封装成数组
  928. for(i in _multiple){
  929. var v=rst[_multiple[i]];
  930. if(typeof v=='string'){
  931. rst[_multiple[i]]=[v];
  932. }
  933. //如果是字典项,特殊处理
  934. v=rst['_DIC_'+_multiple[i]];
  935. if(typeof v=='string'){
  936. rst['_DIC_'+_multiple[i]]=[v];
  937. }
  938. }
  939. }
  940. return rst;
  941. }
  942. /**
  943. * 设置表单的值
  944. * 与FWGetForm相对应,values是一个object
  945. */
  946. function FWSetForm(form,values){
  947. var formName = form.name;
  948. var target;
  949. for(key in values){
  950. target = null;
  951. try{
  952. target = $('[name="'+key+'"]',form).get(0);
  953. }catch(e){
  954. target = null;
  955. }
  956. try{
  957. if(jQuery.data(target,"fwcombox")!=null){
  958. FWsetCombVal(target,values[key]);
  959. }else if(jQuery(target).hasClass("searchgridbox")){
  960. //05q,05p特殊处理
  961. //看看有没有字典项_DIC_如果有自动设置
  962. //先判断是否为空
  963. if(values[key]===null||typeof values[key]=='undefined'){
  964. target.value='';
  965. }else{
  966. target.value= values[key];
  967. }
  968. if(values['_DIC_'+key]){
  969. //有就拿里面的值
  970. jQuery(target).searchgrid('text',values['_DIC_'+key]);
  971. }else{
  972. if(null !=FW_JS_05Q_SETFORM_ASYN && "true" === (FW_JS_05Q_SETFORM_ASYN).toLowerCase()){
  973. //没有中文值就从数据库获取中文值
  974. $(target).searchgrid('setTextById',values[key]);
  975. }else{;
  976. //没有中文值就直接设置为空
  977. $(target).searchgrid('text','');
  978. }
  979. }
  980. }else if(jQuery(target).hasClass('datebox')){
  981. var val = values[key]+'';
  982. val = val.replace(/,/g,'');
  983. if(val.length==10){
  984. target.value = val;
  985. }else if(val.length==8){
  986. target.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2);
  987. } else {
  988. target.value = "";
  989. }
  990. }else if(jQuery(target).hasClass('datetime')){
  991. var val = values[key]+'';
  992. val = val.replace(/,/g,'');
  993. if(val.length==19){
  994. target.value = val;
  995. }else if(val.length==14){
  996. target.value = val.substr(0,4)+'-'+ val.substr(4,2) +'-'+ val.substr(6,2) + ' ' + val.substr(8,2) + ':'+ val.substr(10,2)+":"+ val.substr(12,2);
  997. } else {
  998. target.value = "";
  999. }
  1000. }else if(jQuery(target).hasClass('bankaccounthid')){
  1001. var val= values[key]+'';
  1002. var temp='';
  1003. val=val.replace(/\s+/g,"");
  1004. for(var i=0;i<val.length;i++){
  1005. if(i>0 && i%4==0){
  1006. temp+=" ";
  1007. }
  1008. temp += val.substr (i,1);
  1009. }
  1010. target.value=val;
  1011. var name='_HID_'+key;
  1012. jQuery(':input[name="'+name+'"]',form).val(temp);
  1013. }
  1014. else{
  1015. if(values[key]==null){
  1016. jQuery(':input[name="'+key+'"]',form).val('');
  1017. }else{
  1018. jQuery(':input[name="'+key+'"]',form).val(values[key]);
  1019. }
  1020. }
  1021. }catch(e){}
  1022. }
  1023. }
  1024. /**
  1025. *
  1026. * @param obj 下拉框对象
  1027. * @param val 值
  1028. * 功能说明:因为下拉框经过封装,在JS脚本内赋值给下拉框时,下拉框会没有反应,
  1029. * 需要调用此函数来赋值
  1030. */
  1031. function FWsetCombVal(combox,val){
  1032. if(jQuery(combox).attr("tagName")=="SELECT"){
  1033. //尚未初始化就直接赋值
  1034. if(jQuery.data(combox, 'fwcombox')!=null){
  1035. var opts = jQuery.data(combox, 'fwcombox').options;
  1036. var oldVal = combox.value;
  1037. opts.setValue(combox,val);
  1038. if(val!=oldVal){
  1039. $(combox).trigger('change');
  1040. }
  1041. }else{
  1042. combox.value = val;
  1043. }
  1044. }else if($(combox).hasClass('searchgridbox')){
  1045. $(combox).searchgrid('setTextById',val);
  1046. }
  1047. }
  1048. /**
  1049. * @param combox
  1050. * @param val
  1051. * 功能说明:删掉下拉框内的值,特别说明此函数不会删除IE自带的SELECT框内的值
  1052. * 此函数配合 filter 一起使用
  1053. * e.g:
  1054. * FWremoveItem(document.qForm.ROLETYPE,'11');
  1055. *
  1056. * or
  1057. * 删除多个
  1058. * FWremoveItem(document.qForm.ROLETYPE,['11','12']);
  1059. *
  1060. */
  1061. function FWremoveItem(combox,val){
  1062. if(jQuery(combox).attr("tagName")=="SELECT"){
  1063. if(jQuery.data(combox, 'fwcombox')!=null){
  1064. var opts = jQuery.data(combox, 'fwcombox').options;
  1065. if ( typeof val == 'string') {
  1066. opts.removeItem(combox,val);
  1067. } else {//数组
  1068. $.each(val,function(i,o){
  1069. opts.removeItem(combox,o);
  1070. });
  1071. }
  1072. }
  1073. }
  1074. }
  1075. jQuery(':input').live('keydown',function(event){
  1076. if(this.readOnly!=true){
  1077. return true;
  1078. }else if(event.keyCode==8){
  1079. //屏蔽只读输入框的backspace按键
  1080. return false;
  1081. }
  1082. }).live('dblclick',function(){
  1083. //只读采用双击拷贝内容
  1084. window.clipboardData.setData('Text',this.value);
  1085. });
  1086. /**
  1087. * 重新调整网页指定节点(注意,必须是dom对象)里面所有控件(比如:form表单、div等)的大小
  1088. * @param parentObj 网页任意节点对象
  1089. */
  1090. function FWresizeObject(parentObj){
  1091. //查找节点对象里面的所有需要重新调整的节点
  1092. $('.fwresize',parentObj).trigger('fwresize');
  1093. }
  1094. /**
  1095. * 更改form表单输入域js校验规则
  1096. * e.g:
  1097. * FWchangeVldStr(iForm,['XM'],'nn');
  1098. * FWchangeVldStr(iForm,['XM','XB'],'nn');
  1099. *
  1100. * @param formName form表单对象
  1101. * @param fields 输入域名 数组, 如: ['XM','XB']
  1102. * @param vldStr 校验串 ,如: 'nn'
  1103. */
  1104. function FWchangeVldStr(formName,fields,vldStr) {
  1105. var theForm = $(formName);
  1106. $.each(fields, function(i, o) {
  1107. var flag = false;
  1108. var label = $("[name='" + o + "']", theForm).closest('td').prev().css("color","black");
  1109. if(vldStr != null && $.trim(vldStr) != ''){//只要vldstr不为空flag为true
  1110. if( vldStr.indexOf('nn') >= 0){//包含非空必录
  1111. label.css("color","blue");
  1112. }
  1113. if(vldStr.indexOf('sn') >= 0){//包含基础查询条件
  1114. label.css("color","#be0101");
  1115. }
  1116. flag = true;
  1117. }
  1118. var msg = label.text();
  1119. //此处对05q控件进行特殊处理,需改变05q的文本行的vldStr
  1120. if($("[name='" + o + "']", theForm).hasClass('searchgridbox')){
  1121. $("[name='" + o + "']", theForm).next(" .searchgrid-text").get(0).vldStr = !flag ? '' : msg + "=" + vldStr;
  1122. }else{
  1123. $("[name='" + o + "']", theForm).get(0).vldStr = !flag ? '' : msg + "=" + vldStr;
  1124. }
  1125. });
  1126. }
  1127. $('input,textarea').live('focus',function(){
  1128. //$(this).addClass('focus'); 目前暂时采用这种方式
  1129. if($(this).hasClass('readOnly')){
  1130. return true;
  1131. }
  1132. if(this.type=='checkbox'){
  1133. return true;
  1134. }
  1135. var tmp = $(this).css("background-color");
  1136. $(this).attr("_color",tmp);
  1137. $(this).css("background-color","#FDFDBD");
  1138. }).live('blur',function(){
  1139. //$(this).removeClass('focus');
  1140. //应用remove 这种方式会导致焦点移开后录入框撑大
  1141. if($(this).hasClass('readOnly')){
  1142. return true;
  1143. }
  1144. if(this.type=='checkbox'){
  1145. return true;
  1146. }
  1147. var tmp = $(this).attr("_color");
  1148. if(tmp=='#fdfdbd'){
  1149. $(this).css("background-color",'white');
  1150. }else{
  1151. $(this).css("background-color",tmp);
  1152. }
  1153. });
  1154. /**
  1155. * 获取存储大字典所用的APPLET
  1156. * @returns applet对象
  1157. */
  1158. function FWGetDictApplet(){
  1159. var twindow = window;
  1160. while(twindow.dialogArguments!=null || twindow.opener != null){
  1161. while(twindow.dialogArguments!=null){
  1162. if(_isWindow(twindow.dialogArguments)){
  1163. twindow = twindow.dialogArguments;
  1164. }else if(_isWindow(twindow.dialogArguments.window)){
  1165. twindow = twindow.dialogArguments.window;
  1166. }
  1167. }
  1168. while(twindow.opener != null){
  1169. twindow = twindow.opener;
  1170. }
  1171. }
  1172. var tapplet;
  1173. var sortStr = "";
  1174. try {
  1175. var isSsoEnalbeStr = "false";
  1176. if (typeof(ssoDictName) !='undefined') {
  1177. sortStr = ssoDictName;
  1178. }
  1179. if (typeof(isSsoEnable) !='undefined') {
  1180. isSsoEnalbeStr = isSsoEnable;
  1181. }
  1182. if ('true' == isSsoEnalbeStr && !isNull(sortStr)) {
  1183. tapplet = twindow.top.frames[sortStr].dictapplet;
  1184. } else {
  1185. tapplet = twindow.top.frames['TreeMenu'].dictapplet;
  1186. }
  1187. } catch (Ex) {
  1188. try {
  1189. if (!isNull(sortStr)) {
  1190. tapplet = twindow.top.frames[sortStr].dictapplet;
  1191. } else {
  1192. FWalert("未设置SSO_SUBSYS_URL字典!");
  1193. return ;
  1194. }
  1195. } catch (Ex2) {
  1196. FWalert(Ex2.message);
  1197. return ;
  1198. }
  1199. }
  1200. return tapplet;
  1201. function _isWindow(obj){
  1202. return obj && typeof obj === "object" && "setInterval" in obj;
  1203. }
  1204. }
  1205. /**
  1206. *多记录表单拉伸列宽
  1207. */
  1208. function FWMouseDownToResize(obj,tableID){
  1209. if($(obj).closest('th')[0]['sortable']!='true'){
  1210. return;
  1211. }
  1212. var theObjTable = document.getElementById(tableID);
  1213. FWsetTableLayoutToFixed(tableID);
  1214. obj.mouseDownX=event.clientX;
  1215. obj.pareneTdW=obj.parentElement.offsetWidth;
  1216. obj.pareneTableW=theObjTable.offsetWidth;
  1217. obj.setCapture();
  1218. }
  1219. /**
  1220. *多记录表单拉伸列宽
  1221. */
  1222. function FWMouseMoveToResize(obj,tableID){
  1223. if($(obj).closest('th')[0]['sortable']!='true'){
  1224. return;
  1225. }
  1226. if(!obj.mouseDownX) return false;
  1227. var newWidth=obj.pareneTdW*1+event.clientX*1-obj.mouseDownX;
  1228. if(newWidth>10){
  1229. var theObjTable = document.getElementById(tableID);
  1230. obj.parentElement.style.width = newWidth;
  1231. theObjTable.style.width=obj.pareneTdW*1+event.clientX*1-obj.mouseDownX;
  1232. }
  1233. //处理拉伸列宽时不进行排序
  1234. $(obj).attr('_m',true);
  1235. }
  1236. /**
  1237. *多记录表单拉伸列宽
  1238. */
  1239. function FWMouseUpToResize(obj){
  1240. if($(obj).closest('th')[0]['sortable']!='true'){
  1241. return;
  1242. }
  1243. obj.releaseCapture();
  1244. obj.mouseDownX=0;
  1245. }
  1246. /**
  1247. *多记录表单拉伸列宽
  1248. */
  1249. function FWsetTableLayoutToFixed(tableID){
  1250. var theObjTable = document.getElementById(tableID);
  1251. if(theObjTable.style.tableLayout=='fixed') return;
  1252. var headerTr=theObjTable.rows[0];
  1253. if(headerTr.className=='fweditgrid-header-group'||
  1254. headerTr.className=='fwdatagrid-header-group'){
  1255. return true;
  1256. }
  1257. var height = $(headerTr.cells[0]).height();
  1258. for(var i=0;i<headerTr.cells.length;i++){
  1259. headerTr.cells[i].styleOffsetWidth=headerTr.cells[i].offsetWidth;
  1260. }
  1261. for(var i=0;i<headerTr.cells.length;i++){
  1262. headerTr.cells[i].style.width=headerTr.cells[i].styleOffsetWidth;
  1263. $(headerTr.cells[i]).height(height);
  1264. }
  1265. theObjTable.style.tableLayout='fixed';
  1266. }
  1267. /**
  1268. * add by liujun(2013.4.7)
  1269. * 取查询条件表单的中文条件,用于导出Excel表头条件行使用
  1270. * @param idStr 查询条件表单Form的ID
  1271. * @returns 生成的中文条件
  1272. */
  1273. function FWGetGtZwWhereCls(idStr) {
  1274. var strWhere = "";
  1275. var myobj = $('form[name='+ idStr+"]");
  1276. var array = FWGetForm(myobj.get(0));
  1277. $.each(array,function(name,value){
  1278. if(value!=null && value!=""){
  1279. try{
  1280. if(name.indexOf('_DIC')>=0) return true;
  1281. if($('[name="'+name+'"]').attr("type") == "hidden") return true;
  1282. if(typeof array['_DIC_'+name] !='undefined'){
  1283. //字典
  1284. var label = $("[name='" + name + "']", myobj).closest('td').prev().get(0).innerText;
  1285. value = array['_DIC_'+name];
  1286. }else{
  1287. var label = $("[name='" + name + "']", myobj).closest('td').prev().get(0).innerText;
  1288. }
  1289. strWhere += label + ":" + value + " ";
  1290. }catch(e){
  1291. //获取label出错,不作处理
  1292. }
  1293. }
  1294. });
  1295. return strWhere;
  1296. }
  1297. /**
  1298. * add by liujun(2013.4.7)
  1299. * 保存查询条件与查询结果表单的关联关系,用于导出Excel表头条件行时使用
  1300. * @param gltid 查询结果的表单ID
  1301. * @param gtid 查询条件的表单ID
  1302. * @returns true:设置成功,false:设置失败
  1303. */
  1304. function FWSaveGtGltRelation(gltid, gtid) {
  1305. var target = eval('document.all.' + gltid);
  1306. var opts;
  1307. if (jQuery.data(target, 'fwdatagrid') != null) {
  1308. opts = jQuery.data(target, 'fwdatagrid').options;
  1309. opts["_gtid"] = gtid;
  1310. return true;
  1311. }
  1312. return false;
  1313. }