display.js 182 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053
  1. if(typeof window.wd =="undefined"){
  2. window.wd={};
  3. }
  4. if (!wd.display) {
  5. wd.display = {};
  6. };
  7. (function () {
  8. if(wd.topWindow)return;
  9. var currParent = window;
  10. var i = 1;
  11. while (currParent != top) {
  12. try {
  13. currParent.parent[new Date().getMilliseconds()] = 1; // 如果这行不报“没权限错误”,才执行下一行。
  14. currParent = currParent.parent;
  15. } catch (e) {
  16. break;
  17. }
  18. }
  19. /**
  20. * 得到同域的顶层窗口,不直接用top,是因为有把WD的页面嵌入到OA的作子页面的情形 如果顶层窗口直接用top,当顶层窗口是另一网站时,就会报错。
  21. */
  22. wd.topWindow = currParent;
  23. })();
  24. if (!wd.topWindow.wd) {
  25. wd.topWindow.wd = {};
  26. }
  27. if (!wd.topWindow.wd.display) {
  28. wd.topWindow.wd.display = {};
  29. }
  30. /*
  31. * Change log:
  32. *
  33. * --02-14-2014-- function name wd.display.showComponent from title = '<span
  34. * style="font:14px \'宋体\'\;line-height:30px;" >'+title+'</span>'; to title = '<span>'+title+'</span>';
  35. *
  36. *
  37. */
  38. // 初始化滚动条,by SPACE 2019-01-07
  39. // 关闭鼠标加载动画, by SPACE 2019-04-02
  40. $(document).ready(function () {
  41. // waitThenInitNiceScorll(); 不再使用NiceScorll滚动条 Ben(20260106)
  42. try {
  43. wd.display.closeLoad();
  44. } catch (e) { }
  45. });
  46. function waitThenInitNiceScorll() {
  47. try {
  48. document.onreadystatechange = function () {
  49. if (document.readyState == "complete")
  50. setTimeout("initNiceScorll()", 200);
  51. else
  52. setTimeout("waitThenInitNiceScorll()", 10);
  53. }
  54. } catch (e) {
  55. console.log(e);
  56. }
  57. }
  58. /**
  59. * 初始化滚动条
  60. */
  61. var flag = false;
  62. var resizeScrollIv;
  63. function initNiceScroll() {
  64. try {
  65. // 流程设计器
  66. if ($("#draw_demo").html() != undefined || $("#draw_demo").html() != null || $("#workFlowDesigner").html() != null) {
  67. return;
  68. }
  69. // 网站设计页
  70. if ($("#updateDesignWebpageUrl").val() != null) {
  71. return;
  72. }
  73. // 内容播放器
  74. if ($("#fileProperty").val() != null) {
  75. return;
  76. }
  77. // 大滚动条
  78. var b = $("body");
  79. if ($(b).attr("nicescroll")) {
  80. if ($(b).attr("nicescroll") == 'true') {
  81. loadScorll(b);
  82. }
  83. } else {
  84. loadScorll(b);
  85. }
  86. loadScorll($("iframe[name='ssTabIframe']")); // [name='wdTabFrame']。Lin
  87. loadScorll($(".scrollbar"));
  88. loadScorll($(".mainDiv"));
  89. loadScorll($(".content-div"));
  90. loadScorll(parent.$(".content-div"));
  91. loadScorll($(".CodeMirror-vscrollbar"));
  92. var iframe = window.parent.getIframeByElement(document.body);
  93. var iframeObj = $(iframe);
  94. // loadScorll(iframeObj);
  95. // 小滚动条
  96. loadSmallScorll($(".smallScrollbar"))
  97. // 0.5秒定时监听滚动条变化
  98. clearInterval(resizeScrollIv);
  99. resizeScrollIv = setInterval(function () {
  100. try {
  101. $("body").getNiceScroll().resize();
  102. $("iframe[name='ssTabIframe']").getNiceScroll().resize(); // [name='wdTabFrame']。Lin
  103. $(".mainDiv").getNiceScroll().resize();
  104. $(".scrollbar").getNiceScroll().resize();
  105. $(".content-div").getNiceScroll().resize();
  106. $(parent.$(".content-div")).getNiceScroll().resize(); // $(iframeObj).getNiceScroll().resize();
  107. $(".CodeMirror-vscrollbar").getNiceScroll().resize();
  108. $(".smallScrollbar").getNiceScroll().resize();
  109. } catch (e) {
  110. console.error(e);
  111. }
  112. }, 500);
  113. } catch (e) {
  114. if (!flag) {
  115. flag = true;
  116. // 解决页面引入多个 Jquery 导致 not function 的问题
  117. /* 改。Lin
  118. $("head").append("<script src=\"/wd/js/nicescroll376/jquery.nicescroll.js\"></script>")
  119. */
  120. // $("head").append("<script src=\"/ss/nicescroll/jquery.nicescroll.js\"></script>")
  121. /* 改。Lin
  122. $("head").append("<script src=\"/wd/js/nicescroll376/jquery.nicescroll.iframehelper.min.js\"></script>")
  123. */
  124. // $("head").append("<script src=\"/ss/nicescroll/jquery.nicescroll.iframehelper.min.js\"></script>")
  125. clearInterval(resizeScrollIv);
  126. initNiceScorll();
  127. }
  128. }
  129. }
  130. function getIframeByElement(element) {
  131. var iframe;
  132. $("iframe").each(function () {
  133. if (element.ownerDocument === this.contentWindow.document) {
  134. iframe = this;
  135. }
  136. return !iframe;
  137. });
  138. return iframe;
  139. }
  140. // 大滚动条
  141. function loadScroll(dom) {
  142. try {
  143. if($(dom).attr("wdScroll")=="false")return;
  144. var hori= $(dom).attr("wdScroll")=="XY";
  145. $(dom).niceScroll({
  146. cursorcolor: "#C4C4C4", // 改变滚动条颜色,使用16进制颜色值
  147. cursorwidth: "6px", // 滚动条的宽度,单位:便素
  148. cursorborder: "1px solid #C4C4C4", // CSS方式定义滚动条边框
  149. cursorborderradius: "6px", // 滚动条圆角(像素)
  150. mousescrollstep: 60, // 鼠标滚轮的滚动速度 (像素)
  151. touchbehavior: false, // 激活拖拽滚动
  152. hwacceleration: false, // 激活硬件加速
  153. autohidemode: "true",
  154. background: "transparent", // 轨道的背景颜色
  155. iframeautoresize: true, // 在加载事件时自动重置iframe大小
  156. spacebarenabled: true, // 当按下空格时使页面向下滚动
  157. railpadding: {
  158. top: 0,
  159. right: 4,
  160. left: 4,
  161. bottom: 0
  162. }, // 设置轨道的内间距
  163. horizrailenabled: hori||false, // nicescroll可以管理水平滚动
  164. railalign: "right", // 对齐垂直轨道
  165. railvalign: "bottom", // 对齐水平轨道
  166. preservenativescrolling: true,
  167. enabletranslate3d: true, // nicescroll 可以使用CSS变型来滚动内容
  168. enablemousewheel: true, // nicescroll可以管理鼠标滚轮事件
  169. nativeparentscrolling: false //检测内容底部,并让父节点来滚动,作为原生滚动
  170. });
  171. } catch (e) {
  172. throw e;
  173. }
  174. }
  175. //初始化小滚动条
  176. function loadScrollXY(dom) {
  177. try {
  178. if($(dom).attr("wdScroll")=="false")return;
  179. $(dom).niceScroll({
  180. cursorcolor: "#C4C4C4", // 改变滚动条颜色,使用16进制颜色值
  181. cursorwidth: "6px", // 滚动条的宽度,单位:便素
  182. cursorborder: "1px solid #C4C4C4", // CSS方式定义滚动条边框
  183. cursorborderradius: "6px", // 滚动条圆角(像素)
  184. mousescrollstep: 60, // 鼠标滚轮的滚动速度 (像素)
  185. touchbehavior: false, // 激活拖拽滚动
  186. hwacceleration: false, // 激活硬件加速
  187. autohidemode: "true",
  188. background: "transparent", // 轨道的背景颜色
  189. iframeautoresize: true, // 在加载事件时自动重置iframe大小
  190. spacebarenabled: true, // 当按下空格时使页面向下滚动
  191. railpadding: {
  192. top: 0,
  193. right: 4,
  194. left: 4,
  195. bottom: 0
  196. }, // 设置轨道的内间距
  197. horizrailenabled: true, // nicescroll可以管理水平滚动
  198. railalign: "right", // 对齐垂直轨道
  199. railvalign: "bottom", // 对齐水平轨道
  200. preservenativescrolling: true,
  201. enabletranslate3d: true, // nicescroll 可以使用CSS变型来滚动内容
  202. enablemousewheel: true, // nicescroll可以管理鼠标滚轮事件
  203. nativeparentscrolling: false //检测内容底部,并让父节点来滚动,作为原生滚动
  204. });
  205. } catch (e) {
  206. throw e;
  207. }
  208. }
  209. // 小滚动条
  210. function loadSmallScroll(dom) {
  211. try {
  212. $(dom).niceScroll({
  213. cursorcolor: "#C4C4C4", // 改变滚动条颜色,使用16进制颜色值
  214. cursorwidth: "1px", // 滚动条的宽度,单位:便素
  215. cursorborder: "1px solid #C4C4C4", // CSS方式定义滚动条边框
  216. cursorborderradius: "1px", // 滚动条圆角(像素)
  217. mousescrollstep: 60, // 鼠标滚轮的滚动速度 (像素)
  218. touchbehavior: false, // 激活拖拽滚动
  219. hwacceleration: false, // 激活硬件加速
  220. background: "transparent", // 轨道的背景颜色
  221. iframeautoresize: true, // 在加载事件时自动重置iframe大小
  222. spacebarenabled: true, // 当按下空格时使页面向下滚动
  223. autohidemode: "true", // leave
  224. railpadding: {
  225. top: 0,
  226. right: 2,
  227. left: 2,
  228. bottom: 0
  229. }, // 设置轨道的内间距
  230. horizrailenabled: false, // nicescroll可以管理水平滚动
  231. railalign: "right", // 对齐垂直轨道
  232. railvalign: "bottom", // 对齐水平轨道
  233. enabletranslate3d: true, // nicescroll 可以使用CSS变型来滚动内容
  234. nativeparentscrolling: false, //检测内容底部,并让父节点来滚动,作为原生滚动
  235. zindex: "999999"
  236. });
  237. } catch (e) {
  238. console.log(e);
  239. }
  240. }
  241. //原来拼写错误,兼容处理
  242. var initNiceScorll= initNiceScroll;
  243. var loadScorll=loadScroll;
  244. var loadScorllXY=loadScrollXY;
  245. var loadSmallScorll=loadSmallScroll;
  246. /*
  247. * 设置HTML元素属性 @param object o 要设置属性的HTML元素 @param string a 要设置的属性名 @param string
  248. * v 要设置的属性值
  249. */
  250. function setAttribute(o, a, v) {
  251. if (typeof o != 'object' || typeof a != 'string')
  252. return;
  253. a == 'class' ? o.className = v : o.setAttribute(a, v);
  254. }
  255. /*
  256. * 获取HTML元素属性值 @param object o 要获取属性的HTML元素 @param string a 要获取的属性名 @return
  257. * 返回要获取的属性值
  258. */
  259. function getAttribute(o, a) {
  260. if (typeof o != 'object' || typeof a != 'string')
  261. return;
  262. return a == 'class' ? o.className : o.getAttribute(a);
  263. }
  264. /*
  265. * 移除HTML元素属性 @param object o 要移除属性的HTML元素 @param string a 要移除的属性名
  266. */
  267. function removeAttribute(o, a) {
  268. if (typeof o != 'object' || typeof a != 'string')
  269. return;
  270. o.removeAttribute(a);
  271. if (a == 'class')
  272. o.removeAttribute('className');
  273. }
  274. /**
  275. * 去掉所有的html代码
  276. */
  277. wd.display.removeHTMLTag = wd.display.toPlainText = function (str) {
  278. str = str.replace(/<\/?[^>]*>/g, ''); // 去除HTML tag
  279. str = str.replace(/[ | ]*\n/g, '\n'); // 去除行尾空白
  280. // str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
  281. str = str.replace(/&nbsp;/ig, ''); // 去掉&nbsp;
  282. str = str.replace(/\s/g, ''); // 将空格去掉
  283. return str;
  284. };
  285. /**
  286. * 初始化tr的显示样式
  287. */
  288. wd.display.initTrDisplay = function (trContainerNameOrId, // tr标签的直接父级标签的name或id
  289. oddClassName, // 奇数行的tr应用的class类名
  290. evenClassName, // 偶数行的tr应用的class类名
  291. onMouseOverClassName) { // 鼠标放在tr上时,tr应用的css样式
  292. var container = wd.c.g(trContainerNameOrId);
  293. // container 可能为 undefined
  294. if (!container)
  295. return;
  296. var trs = container.childNodes;
  297. if (!trs)
  298. return;
  299. var trIndex = 0;
  300. for (var i = 0; i < trs.length; i++) {
  301. var oneTr = trs[i];
  302. if (!oneTr.tagName || oneTr.tagName != 'TR' ||
  303. oneTr.style.display == 'none')
  304. continue;
  305. trIndex++;
  306. if (trIndex % 2 == 1) { // 奇数行的tr应用的class类名
  307. oneTr.className += " " + oddClassName;
  308. } else {
  309. oneTr.className += " " + evenClassName;
  310. }
  311. oneTr.oriClassName = oneTr.className;
  312. var omocn = new RegExp(" " + onMouseOverClassName);
  313. // console.log(omocn);
  314. oneTr.onmouseover = function () {
  315. this.className = this.className.replace(omocn, "") + " " +
  316. onMouseOverClassName;
  317. }
  318. oneTr.onmouseout = function () {
  319. this.className = this.className.replace(omocn, "");
  320. }
  321. }
  322. };
  323. wd.display.showDynamicParamDialog = function (url, datas) {
  324. eval(wd.display.replaceDynamicParam(url.toString(), datas));
  325. }
  326. wd.display.createMaskDiv = function (containerObj, currWindow, zIndex) { // 创建遮罩层
  327. var ele = currWindow.document.getElementsByTagName('BODY')[0];
  328. var newID = new Date().getTime();
  329. if (!(typeof zIndex != 'undefined' && zIndex)) {
  330. zIndex = 100001;
  331. }
  332. var coverDiv = document.createElement("div");
  333. coverDiv.id = newID;
  334. // coverDiv.style.cssText = 'display: none;' + 'position: absolute;' +
  335. // 'top: 0%;' + 'left: 0%;' + 'width: 100%;' + 'height: 100%;' +
  336. // 'background-color: #EEEEEE;' + '-moz-opacity: 0.5;' +
  337. // 'opacity: .50;' + 'filter: alpha(opacity=50);';
  338. coverDiv.setAttribute("class", "wdMaskDiv dialog-mask");
  339. coverDiv.style.zIndex = zIndex - 1;
  340. ele.appendChild(coverDiv);
  341. // coverDiv.style.display = 'block';
  342. var W = (currWindow.document.body.scrollLeft + currWindow.document.body.scrollWidth) ||
  343. (currWindow.document.documentElement.scrollLeft + currWindow.document.documentElement.scrollWidth);
  344. var H = (currWindow.document.body.scrollTop + currWindow.document.body.scrollHeight) ||
  345. (currWindow.document.documentElement.scrollTop + currWindow.document.documentElement.scrollHeight);
  346. coverDiv.style.width = W + 'px';
  347. coverDiv.style.height = H + 'px';
  348. var maskContainer = containerObj.mask;
  349. if (!maskContainer) {
  350. containerObj.mask = [];
  351. }
  352. containerObj.mask.push(newID);
  353. };
  354. //按钮 [id,pos,title,label,className]
  355. wd.display.wdButtons = [
  356. //功能: 旧UI弹窗右上角按钮图标升级为 icon-base(先改 help/lock/close)by xu 20251223
  357. ["wdHelp", 3, "帮助", "帮助", "dialog-toolbar-icon icon-help"],
  358. ["CMS_download", 3, "下载", "下载", "icon-download"],
  359. ["wdShare", 3, "收藏", "收藏", "icon-favorite"],
  360. ["wdShared", 3, "已收藏", "已收藏", "icon-favoriteOn"],
  361. ["editWdHelp", 3, "编辑帮助", "编辑帮助", "icon-setHelp"],
  362. ["editWdHelp_save", 3, "编辑帮助保存", "编辑帮助保存", "invertIcon-save"],
  363. //功能: icon-base 图标名调整:编辑选项卡 icon-ptab(弹窗顶部用细体)by xu 20251224
  364. ["wdTab", 3, "编辑选项卡", "编辑选项卡", "dialog-toolbar-icon icon-ptab"],
  365. //功能: icon-base 图标名调整:保存选项卡使用 icon-save(不再用 invertIcon-save)by xu 20251225
  366. ["wdTab_save", 3, "保存选项卡", "保存选项卡", "invertIcon-save dialog-toolbar-icon icon-save"],
  367. //功能: icon-base 图标名调整:个人选值 icon-pval(弹窗顶部用细体)by xu 20251224
  368. ["wdRecord", 3, "个人选值", "个人选值", "dialog-toolbar-icon icon-pval"],
  369. //功能: icon-base 图标名调整:个人选值保存使用 icon-save(不再用 invertIcon-save)by xu 20251225
  370. ["wdRecord_save", 3, "个人选值保存", "个人选值保存", "invertIcon-save dialog-toolbar-icon icon-save"],
  371. ["CMS_fullscreen", 3, "全屏", "全屏", "dialog-restoreButton"],
  372. ["CMS_nrProperty", 3, "内容属性", "内容属性", "icon-property"],
  373. ["change_on", 3, "变动查看-开", "变动查看-开", "dialog-changeOnButton"],
  374. ["change_off", 3, "变动查看-关", "变动查看-关", "dialog-changeButton"],
  375. ["lockScreen", 3, "锁定", "锁定", "dialog-toolbar-icon icon-lock"],
  376. /// 改为在这定义 "悬浮菜单" -- 去掉残留在 关闭 按钮左边的 菜单模式 按钮。Lin
  377. ["ssSubTabMenuMode", 3, "菜单模式", "菜单模式", "dialog-toolbar-icon icon-autoTxt"],
  378. ///
  379. ["wdPrint", 3, "打印", "打印", "icon-print"],
  380. ["wdBatchPrint", 3, "批量打印", "批量打印", "icon-print"],
  381. ["wdHelpCopyhexcode", 3, "复制帮助代码", "复制帮助代码", "icon-key"]
  382. //功能: SsSubTab 菜单模式切换按钮改为按需创建,避免所有弹窗都出现 by xu 20251224
  383. ];
  384. wd.display.initStyleWdButtons = function () {
  385. for (var i = 0; i < wd.display.wdButtons.length; i++) {
  386. var className = "dhtmlx_button_" + wd.display.wdButtons[i][0] + "_default";
  387. /* 再改,用上 className 变量。Lin
  388. wd.topWindow.$("div.dhtmlx_button_" + wd.display.wdButtons[i][0] + "_default").addClass(wd.display.wdButtons[i][4]);
  389. */ wd.topWindow.$("div."+ className).addClass(wd.display.wdButtons[i][4]);
  390. }
  391. // 特殊处理close,因为如果close和dhtmlx的close冲突,会隐藏原生,新增一个按钮
  392. /* 再改,IDEA = "Duplicate declaration"。Lin
  393. var className = "dhtmlx_button_close_default";
  394. */ className = "dhtmlx_button_close_default";
  395. //功能: 弹窗关闭按钮使用 icon-base(避免依赖 svg/png)by xu 20251223
  396. /* 再改,用上 className 变量。Lin
  397. wd.topWindow.$("div.dhtmlx_button_close_default").removeClass(className).addClass("dialog-toolbar-close-icon icon-close");
  398. */
  399. /* 再改,growh(全屏)时,关闭 按钮改为 透明并带右端竖线 的。Lin
  400. * 不加样式,有占位,但没显示图标 -- 类似透明
  401. wd.topWindow.$("div."+ className).removeClass(className).addClass("dialog-toolbar-close-icon icon-close");
  402. */
  403. if (showNameOrId[0] !== "wdFullScreen") // 不是 growh(全屏)。Lin
  404. wd.topWindow.$("div."+ className).removeClass(className).addClass("dialog-toolbar-close-icon icon-close");
  405. }
  406. /**
  407. * 添加隐藏按钮
  408. * @param {Object} w
  409. */
  410. wd.display.addWdUserButton = function (w) {
  411. var buttonType = wd.display.wdButtons;
  412. for (var i = 0; i < buttonType.length; i++) {
  413. //添加按钮
  414. w.addUserButton(buttonType[i][0], buttonType[i][1], buttonType[i][2], buttonType[i][3], buttonType[i][4]);
  415. //隐藏按钮
  416. w.button(buttonType[i][0]).hide();
  417. // console.log(buttonType[i][0]+":"+w.button(buttonType[i][0]).isHidden())
  418. }
  419. wd.display.initStyleWdButtons();
  420. }
  421. wd.display.showAllWdUserButton = function (w, nolimit) {
  422. //解除限制
  423. if (nolimit) {
  424. w.unAllowButton = false;
  425. } else {
  426. w.unAllowButton = true;
  427. }
  428. var buttonType = wd.display.wdButtons;
  429. for (var i = 0; i < buttonType.length; i++) {
  430. if (w.button(buttonType[i][0]).isHidden() == false) {
  431. w.button(buttonType[i][0]).show();
  432. }
  433. }
  434. /// 再增加,透明并带右端竖线的关闭按钮改为正常的关闭按钮 -- 来自 wd.display.initStyleWdButtons() 里的显示关闭按钮部分。Lin
  435. wd.topWindow.$("div.dhtmlx_button_close_default").removeClass("dialog-toolbar-close-icon-growh")
  436. .addClass("dialog-toolbar-close-icon icon-close");
  437. ///
  438. }
  439. wd.display.hideAllWdUserButton = function (w) {
  440. w.unAllowButton = true;
  441. var buttonType = wd.display.wdButtons;
  442. for (var i = 0; i < buttonType.length; i++) {
  443. w.button(buttonType[i][0]).style.display = "none";
  444. }
  445. /// 再增加,去掉原关闭按钮的样式,改用 透明并带右端竖线 的样式。Lin
  446. wd.topWindow.$("div.dhtmlx_button_close_default").removeClass("dialog-toolbar-close-icon icon-close").addClass("dialog-toolbar-close-icon-growh");
  447. ///
  448. }
  449. /**
  450. * 添加弹窗事件
  451. * @param {Object} w
  452. */
  453. wd.display.addComponentEvent = function (w) {
  454. // 按钮:设置wdRecord
  455. w.getFrame().addEventListener("load", function () {
  456. var iframeWindow = w.getFrame().contentWindow
  457. if ("0" == iframeWindow.loginStatus)
  458. return;
  459. //wdShare
  460. var wdShare = function () {
  461. this.win = null;
  462. this.button;
  463. this.init = function (w) {
  464. this.win = w;
  465. // var wdDialogWin = iframeWindow.document.querySelector("wdDialog[collect=true]")
  466. // if (!wdDialogWin)
  467. // return;
  468. this.sendRequest("query", (function () {
  469. return function (data) {
  470. if (data == 1) {
  471. //已分享
  472. this.addButton("wdShared")
  473. } else if (data == 0) {
  474. //未分享
  475. this.addButton("wdShare")
  476. }
  477. }
  478. })())
  479. }
  480. this.addButton = function (buttontype) {
  481. var THIS = this;
  482. //恢复隐藏按钮
  483. if (this.win.button(buttontype) && this.win.button(buttontype) != null) {
  484. this.win.button(buttontype).show();
  485. } else {
  486. // if (buttontype == "wdShared") {
  487. // this.win.addUserButton(buttontype, 3, "已收藏", "已收藏")
  488. // } else if (buttontype == "wdShare") {
  489. // this.win.addUserButton(buttontype, 3, "未收藏", "未收藏")
  490. // }
  491. }
  492. this.win.button(buttontype).onclick = function () {
  493. THIS.wdshareClick(buttontype)
  494. }
  495. }
  496. this.wdshareClick = function (buttontype) {
  497. var type;
  498. //已收藏点击:取消收藏
  499. //未收藏点击:
  500. if (buttontype == "wdShared") {
  501. type = "delete"
  502. } else if (buttontype == "wdShare") {
  503. type = "add"
  504. }
  505. this.sendRequest(type, function (data) {
  506. if (data == 1) {
  507. this.win.button(buttontype).hide();
  508. this.addButton(buttontype == "wdShared" ? "wdShare" : "wdShared")
  509. } else if (data == 0) {
  510. console.log(data);
  511. } else {
  512. console.log(data)
  513. }
  514. });
  515. }
  516. this.sendRequest = function (type, callback) {
  517. var wdsharetype;
  518. if (type == "query") {
  519. wdsharetype = "";
  520. } else if (type == "add") {
  521. wdsharetype = 1;
  522. } else if (type == "delete") {
  523. wdsharetype = 0;
  524. } else {
  525. alert("type 值超出范围:"+ type) // ("我是不可能出现的!")。Lin
  526. }
  527. var THIS = this;
  528. $.post("/service?ssServ=wdShare", {
  529. wdsharetype: wdsharetype,
  530. wdshareurl: iframeWindow.window.location.href
  531. }, function (data) {
  532. if (callback) {
  533. callback.call(THIS, data)
  534. }
  535. })
  536. }
  537. }
  538. new wdShare().init(w);
  539. }, false);
  540. }
  541. /// 增加 setMenuMode(bjid) -- 改为在 wd.display.wdButtons = [ 里定义 "菜单模式" -- 去掉残留在 关闭 按钮左边的 菜单模式 按钮。Lin
  542. // 在 objChg.jsp 里调用
  543. function setMenuMode(bjid) {
  544. const wdDialogId = wd.display.getwdDialogId();
  545. const win = wd.topWindow.dhxWins.window(wdDialogId);
  546. win.button("ssSubTabMenuMode").show();
  547. }
  548. ///
  549. //功能: SsSubTab 菜单模式切换按钮启用(由页面主动调用)by xu 20251223
  550. wd.display.enableSsSubTabMenuModeButton = function () {
  551. try {
  552. var wdDialogId = wd.display.getwdDialogId();
  553. if (!wdDialogId) return false;
  554. if (!wd.topWindow || !wd.topWindow.dhxWins) return false;
  555. var w = wd.topWindow.dhxWins.window(wdDialogId);
  556. if (!w) return false;
  557. //功能: 打印调试信息(定位点击无反应问题)by xu 20251224
  558. try { console.log("[SsSubTabMenuMode] enable start, wdDialogId=", wdDialogId); } catch (e) { }
  559. //功能: 获取当前弹窗的 DOM 容器(用于精准定位按钮,避免多弹窗 querySelector 选错)by xu 20251224
  560. var iframeEl = null;
  561. //功能: 优先通过 wdDialogId 精确定位 iframe(避免误拿到 SsSubTab 内部 iframe)by xu 20251224
  562. try {
  563. var ifs = wd.topWindow.document.getElementsByTagName("IFRAME");
  564. for (var ii = 0; ii < ifs.length; ii++) {
  565. var iframeObj = ifs[ii];
  566. var tempId = iframeObj.getAttribute("wdDialogId");
  567. if (!tempId && iframeObj.dataset) {
  568. tempId = iframeObj.dataset["wdDialogId"];
  569. }
  570. if (tempId && (tempId + "") === (wdDialogId + "")) {
  571. iframeEl = iframeObj;
  572. break;
  573. }
  574. }
  575. } catch (e) { }
  576. if (!iframeEl) {
  577. try { iframeEl = w.getFrame && w.getFrame(); } catch (e) { }
  578. }
  579. if (!iframeEl) {
  580. try { console.log("[SsSubTabMenuMode] fail: no iframeEl"); } catch (e) { }
  581. return false;
  582. }
  583. var winEl = null;
  584. try { winEl = iframeEl.closest && iframeEl.closest("div.dhtmlx_window_active,div.dhtmlx_window_inactive"); } catch (e) { }
  585. if (!winEl) {
  586. try { console.log("[SsSubTabMenuMode] fail: no winEl"); } catch (e) { }
  587. return false;
  588. }
  589. //功能: 精准获取当前弹窗的按钮 DOM(dhtmlx 会切换 _default/_over_default 等)by xu 20251224
  590. var btnEl = null;
  591. try { btnEl = winEl.querySelector("div[class*='dhtmlx_button_ssSubTabMenuMode_']"); } catch (e) { }
  592. /* 再去掉,改为在 wd.display.wdButtons = [ 里定义 "悬浮菜单" -- 去掉残留在 关闭 按钮左边的 菜单模式 按钮。Lin
  593. * ["ssSubTabMenuMode", 3, "菜单模式", "菜单模式", "dialog-toolbar-icon icon-autoTxt"]
  594. if (!btnEl) {
  595. //功能: 仅在使用 SsSubTab 的页面按需创建按钮,避免所有弹窗默认带出 by xu 20251224
  596. //功能: icon-base 图标名调整:弹窗顶部菜单模式按钮使用细体 icon-autoTxt / icon-fix by xu 20251224
  597. try { w.addUserButton("ssSubTabMenuMode", 3, "菜单模式", "菜单模式", "dialog-toolbar-icon icon-autoTxt"); } catch (e) { }
  598. try { wd.display.initStyleWdButtons && wd.display.initStyleWdButtons(); } catch (e) { }
  599. try { btnEl = winEl.querySelector("div[class*='dhtmlx_button_ssSubTabMenuMode_']"); } catch (e) { }
  600. if (!btnEl) {
  601. // 页面可能还没创建完成,交给调用方重试 by xu 20251224
  602. try { console.log("[SsSubTabMenuMode] fail: button dom not found"); } catch (e) { }
  603. return false;
  604. }
  605. //功能: 打印调试信息(按钮按需创建成功)by xu 20251224
  606. try { console.log("[SsSubTabMenuMode] button created"); } catch (e) { }
  607. }
  608. */
  609. var btn = null;
  610. try { btn = w.button && w.button("ssSubTabMenuMode"); } catch (e) { }
  611. //功能: 弹窗右上角切换按钮放到最左边(flex 顺序)by xu 20251223
  612. try {
  613. var btnContainer = btnEl.parentNode;
  614. if (btnContainer && btnContainer.firstElementChild && btnContainer.firstElementChild !== btnEl) {
  615. btnContainer.insertBefore(btnEl, btnContainer.firstElementChild);
  616. }
  617. } catch (e) { }
  618. //功能: 旧UI弹窗中使用顶部按钮控制 SsSubTab,隐藏组件内置切换按钮 by xu 20251223
  619. try { document.documentElement && document.documentElement.classList && document.documentElement.classList.add("ss-sub-tab-dialog"); } catch (e) { }
  620. // 确保组类存在 by xu 20251223
  621. try { btnEl.classList && btnEl.classList.add("dialog-toolbar-icon"); } catch (e) { }
  622. //功能: 获取 iframeWindow(用于 click 时动态拿 API,避免 enable 时机问题)by xu 20251224
  623. var iframeWindow = null;
  624. try { iframeWindow = iframeEl && iframeEl.contentWindow; } catch (e) { }
  625. if (!iframeWindow) {
  626. try { console.log("[SsSubTabMenuMode] fail: no iframeWindow"); } catch (e) { }
  627. return false;
  628. }
  629. //功能: 递归在多层 iframe 中查找 SsSubTab API(objPlay -> objInfo -> ss-sub-tab)by xu 20251224
  630. var findSsSubTabCtx = function (win, depth) { //功能 by xu 20251224
  631. if (!win) return null;
  632. if (depth > 6) return null;
  633. try {
  634. var api =
  635. (win.SS && win.SS.dom && win.SS.dom.ssSubTabApi) ||
  636. (win.ss && win.ss.dom && win.ss.dom.ssSubTabApi);
  637. var left = win.document && win.document.querySelector && win.document.querySelector(".project-edit-container .left-side");
  638. if (api && api.toggleMenuMode && left) {
  639. return { win: win, api: api, leftSide: left };
  640. }
  641. } catch (e) { }
  642. try {
  643. var ifs = win.document && win.document.getElementsByTagName ? win.document.getElementsByTagName("IFRAME") : [];
  644. if (!ifs || !ifs.length) return null;
  645. // 限制扫描数量,避免极端页面卡顿 by xu 20251224
  646. var maxScan = Math.min(ifs.length, 30);
  647. for (var i = 0; i < maxScan; i++) {
  648. var cw = null;
  649. try { cw = ifs[i].contentWindow; } catch (e) { cw = null; }
  650. if (!cw) continue;
  651. var r = findSsSubTabCtx(cw, depth + 1);
  652. if (r) return r;
  653. }
  654. } catch (e) { }
  655. return null;
  656. };
  657. var updateIcon = function () { //功能 by xu 20251224
  658. // dhtmlx hover/active 会切换 class(_default/_over_default 等),这里每次取当前节点 by xu 20251224
  659. var currentBtnEl = null;
  660. try { currentBtnEl = winEl.querySelector("div[class*='dhtmlx_button_ssSubTabMenuMode_']"); } catch (e) { }
  661. if (!currentBtnEl || !currentBtnEl.classList) return;
  662. //功能: 优先从 topWindow 的 apiMap 取(解决 objPlay->objInfo 这种多层iframe拿不到 SS 的问题)by xu 20251224
  663. var ctx = null;
  664. try {
  665. var apiFromTop = wd.topWindow && wd.topWindow.__ssSubTabApiMap && wd.topWindow.__ssSubTabApiMap[wdDialogId];
  666. if (apiFromTop && apiFromTop.toggleMenuMode) {
  667. ctx = { api: apiFromTop, leftSide: null };
  668. }
  669. } catch (e) { }
  670. if (!ctx) {
  671. ctx = findSsSubTabCtx(iframeWindow, 0);
  672. }
  673. var mode = "collapse";
  674. try {
  675. mode = (ctx && ctx.api && ctx.api.getMenuMode && ctx.api.getMenuMode()) || (ctx && ctx.leftSide && ctx.leftSide.getAttribute("data-mode")) || "collapse";
  676. } catch (e) { }
  677. currentBtnEl.classList.add("dialog-toolbar-icon");
  678. //功能: icon-base 图标名调整:弹窗顶部菜单模式按钮 icon-autoTxt / icon-fix by xu 20251224
  679. currentBtnEl.classList.remove("icon-autoTxt", "icon-fix");
  680. if (mode === "fixed") {
  681. currentBtnEl.classList.add("icon-fix");
  682. currentBtnEl.setAttribute("title", "固定菜单");
  683. } else {
  684. currentBtnEl.classList.add("icon-autoTxt");
  685. currentBtnEl.setAttribute("title", "悬浮菜单");
  686. }
  687. };
  688. //功能: 用事件委托绑定点击(避免 dhtmlx 切换 class/替换节点导致点击失效)by xu 20251224
  689. try {
  690. var btnsEl = winEl.querySelector("div.dhtmlx_wins_btns");
  691. if (btnsEl && btnsEl.getAttribute("data-ss-sub-tab-menu-bound") !== "1") {
  692. btnsEl.setAttribute("data-ss-sub-tab-menu-bound", "1");
  693. btnsEl.addEventListener("click", function (e) {
  694. try {
  695. var t = e && e.target;
  696. var hit = t && t.closest ? t.closest("div[class*='dhtmlx_button_ssSubTabMenuMode_']") : null;
  697. if (!hit) return;
  698. //功能: 优先从 topWindow 的 apiMap 取(解决 objPlay->objInfo)by xu 20251224
  699. var ctx = null;
  700. var ssSubTabApi = null;
  701. try {
  702. ssSubTabApi = wd.topWindow && wd.topWindow.__ssSubTabApiMap && wd.topWindow.__ssSubTabApiMap[wdDialogId];
  703. } catch (ee) { ssSubTabApi = null; }
  704. if (ssSubTabApi && ssSubTabApi.toggleMenuMode) {
  705. ctx = { api: ssSubTabApi };
  706. } else {
  707. ctx = findSsSubTabCtx(iframeWindow, 0);
  708. ssSubTabApi = ctx && ctx.api;
  709. }
  710. if (!ssSubTabApi || !ssSubTabApi.toggleMenuMode) {
  711. try {
  712. console.log(
  713. "[SsSubTabMenuMode] click but api not ready",
  714. "href=", iframeWindow.location && iframeWindow.location.href,
  715. "foundCtx=", !!ctx
  716. );
  717. } catch (ee) { }
  718. return;
  719. }
  720. //功能: 打印调试信息(点击事件触发)by xu 20251224
  721. try { console.log("[SsSubTabMenuMode] click, before=", ssSubTabApi.getMenuMode && ssSubTabApi.getMenuMode()); } catch (ee) { }
  722. try { ssSubTabApi.toggleMenuMode(); } catch (ee) { console.log(ee); }
  723. try { console.log("[SsSubTabMenuMode] click, after=", ssSubTabApi.getMenuMode && ssSubTabApi.getMenuMode()); } catch (ee) { }
  724. setTimeout(updateIcon, 0);
  725. } catch (ee) {
  726. console.log(ee);
  727. }
  728. }, false);
  729. }
  730. } catch (e) { }
  731. updateIcon();
  732. try { btn && btn.show && btn.show(); } catch (e) { }
  733. return true;
  734. } catch (e) {
  735. console.log(e);
  736. return false;
  737. }
  738. };
  739. /**
  740. * 将url中的动态参数替换成指定的值
  741. * 如果param为空,则参数的值在html元素中寻找,如果param的值不为空,则在param中获取
  742. * 对于现在的服务调用,采用匹配进行
  743. * @service{name:"xxx",dest:"xxx",param:{"xxx":"xxx","data":"wdVal{data}"}}@
  744. * 中的"data":"wdVal{data}"
  745. * 如果要添加额外变量参数,有两种方法
  746. * 1.在html中 添加 input标签 name对应 data,把需要的值传入value(即是用element获取) <input name="data">
  747. * 2.如果是js变量,通过传入json变量覆盖,例:
  748. * var json = JSON.parse('{"data":"' + encodeURI(obj) + '"}');
  749. * var url = '@service{name:"cd_ydck",dest:"cd_ydck",show:"wdDialog",param:{"cdydid":"wdVal{data}"}}@';
  750. * url = wd.display.replaceDynamicParam(url, json);
  751. * eval(url);
  752. */
  753. wd.display.replaceDynamicParam = function (url, param) {
  754. /* 再改,规范 wdVal{ 命名。Lin
  755. var reg = /wdVal\{\s*[A-Za-z0-9_]*\s*\}/g;
  756. */var reg = /ssVal\{\s*[A-Za-z0-9_]*\s*\}/g;
  757. //如果没有匹配的动态参数
  758. if (!reg.test(url)) {
  759. return url;
  760. } else {
  761. var result = url.match(reg);
  762. for (var i = 0; i < result.length; i++) {
  763. var source = result[i];
  764. //获取动态参数的name
  765. var name = source.trim().substring(6, source.trim().length - 1);
  766. //增加空字符串的可能性
  767. if (param && param[name] != undefined) {
  768. url = url.replace(source, param[name]);
  769. } else {
  770. var value = document.getElementsByName(name)[0].value;
  771. url = url.replace(source, value);
  772. }
  773. }
  774. return url;
  775. }
  776. };
  777. wd.display.Yi = 49;
  778. wd.display.Xi = 23;
  779. wd.display.addDialogLine = function (w) {
  780. if (!w) {
  781. var wdDialogId = wd.display.getwdDialogId();
  782. w = wd.topWindow.dhxWins.window(wdDialogId);
  783. }
  784. $(w).find(".dhtmlx_wins_body_inner").removeClass("dhtmlx_wins_body_inner_noborder").addClass(
  785. "dhtmlx_wins_body_inner_border");
  786. }
  787. wd.display.removeDialogLine = function (w) {
  788. if (!w) {
  789. var wdDialogId = wd.display.getwdDialogId();
  790. w = wd.topWindow.dhxWins.window(wdDialogId);
  791. }
  792. $(w).find(".dhtmlx_wins_body_inner").removeClass("dhtmlx_wins_body_inner_border").addClass(
  793. "dhtmlx_wins_body_inner_noborder");
  794. }
  795. /**
  796. * 方法中文名:切换DOM元素显示 显示第二个参数数组指定的所有DOM元素,隐藏第三个参数数组指定的所有DOM元素,
  797. * 第四个参数为选填,如果填了,则第二个参数中的第一个iframe将加载此参数(url)指定的页面
  798. *
  799. *
  800. * demo:
  801. * wd.display.showComponent({show:[{"name":"wdDialog","size":"450*380"}],hide:[],url:"/service?wdApplication=jw&wdService=ty_gg_ck&wdOutputComponent=44786&wdtest=false&ggid=44000059",dest:"gg.ty_gg_ck",title:"查看",width:450,high:380,wdDialogId:44786,form:""})
  802. * wd.display.showComponent({show:["wdDialog"],hide:[],url:"/service?wdApplication=wd&wdService=grxx_shlist&wdToken=689&wdOutputComponent=44983&wdtest=false&sqid=44438",dest:"shqk",title:"审核情况件",width:500,high:300,wdDialogId:44983,form:""})
  803. *
  804. */
  805. /// 把 wd.display.showComponent = function (params) { 里的 showNameOrId 移到这,改为全局变量 -- growh(全屏)时,关闭 按钮改为 透明并带右端竖线 的。Lin
  806. let showNameOrId;
  807. ///
  808. wd.display.showComponent = function (params) {
  809. if (typeof beacon != 'undefined' && beacon.shouldOpenOtherBrowser && beacon.shouldOpenOtherBrowser()) {
  810. var url = params.url;
  811. if (url.startsWith("/")) {
  812. url = window.location.origin + url;
  813. }
  814. beacon.openWindow(params.title, params.width, params.height, url);
  815. return;
  816. }
  817. // 加载鼠标动画 by SPACE 2019-04-02
  818. wd.display.showLoad();
  819. //alert(top.window.document.querySelector('iframe[name="win2"]'));
  820. if (window.event) {
  821. if (window.event.stopPropagation) {
  822. window.event.stopPropagation();
  823. } else {
  824. window.event.cancelBubble = true;
  825. }
  826. }
  827. var fullScreenLimitHeight = true; // 全屏时窗口的高度与window.innerHeight一致
  828. /* 再改,改为全局变量 -- growh(全屏)时,关闭 按钮改为 透明并带右端竖线 的。Lin
  829. var showNameOrId = params.show; // 由需要显示的DOM元素的NAME或ID组成的数组或字符串,注意:
  830. */showNameOrId = params.show; // 由需要显示的DOM元素的NAME或ID组成的数组或字符串,注意:
  831. // 如果含有值’wdDialog’,则弹出dhtmlxWindows窗口,否则只是切换部件显示
  832. var hideNameOrId = params.hide; // 由需要隐藏的DOM元素的NAME或ID组成的数组或字符串(可选参数,可以不填)
  833. if (!params["getSize"]) {
  834. params["getSize"] = "1";
  835. params["wdDialogId"] = new Date().getTime();
  836. /* 再改,规范 &token= 命名。Lin
  837. * IDEA = Redundant character escape '\=' in RegExp
  838. * IDEA = Redundant character escape '\&' in RegExp
  839. var exec = /token\=([^\&]*)/.exec(params.url)
  840. */ var exec = /ssToken=([^&]*)/.exec(params.url)
  841. if (exec) {
  842. $.ajax({
  843. url: "/service?ssServ=loadPageParm",
  844. data: {
  845. "tokenstring": exec[1]
  846. },
  847. async: true,
  848. timeout: 10000,
  849. type: "POST",
  850. dataType: "json",
  851. error: function (data) {
  852. console.log(arguments);
  853. wd.display.showComponent(params);
  854. },
  855. success: function (result) {
  856. params = $.extend(params, result, { title: params.title });
  857. wd.display.showComponent(params);
  858. }
  859. })
  860. return params["wdDialogId"];
  861. }
  862. }
  863. var url = wd.display.replaceDynamicParam(params.url); // 参数showElemNameOrIdArr中的第一个iframe将加载此URL的页面(可选参数,可以不填)
  864. var width = (parseInt(params.width) || 100) + this.Xi; // 当要弹出窗口宽度,单位为px
  865. ///??? 有空再去掉参数 high -- 统一用 height???Lin ///
  866. var high = (parseInt(params.high) || parseInt(params.height) || 100) + this.Yi; // 当要弹出窗口宽度,单位为px
  867. var showTitle = params.showTitle || false;
  868. //弹出窗口自适应高度
  869. if (!!params.minHeight && !!params.maxHeight) {
  870. params.minHeight = parseInt(params.minHeight);
  871. params.maxHeight = parseInt(params.maxHeight);
  872. if (params.minHeight + this.Yi > wd.topWindow.innerHeight) {
  873. high = params.minHeight + this.Yi;
  874. showNameOrId = 'wdFullScreen';
  875. fullScreenLimitHeight = false;
  876. } else if (params.maxHeight + this.Yi < wd.topWindow.innerHeight) {
  877. high = params.maxHeight + this.Yi;
  878. } else {
  879. /* 母体里的,showTitle="false" -- if(showTitle) 成立。Lin
  880. * PMS 里的 showTitle=false -- if(showTitle) 不成立
  881. * 先改为 high = wd.topWindow.innerHeight;
  882. * 先不改 */
  883. if (showTitle)
  884. high = wd.topWindow.innerHeight;
  885. else
  886. showNameOrId = 'wdFullScreen';
  887. }
  888. }
  889. url=wd.base.setRowCountPerPage(url,high-this.Yi,width);
  890. var title = params.title || "无题,可能没找到部件"; // 窗口标题,(可选参数,可以不填)
  891. var form = params.form; // 需要提交的form名字
  892. // var wdDialogId = params.wdDialogId;//部件ID
  893. var wdDialogId = params.wdDialogId || new Date().getTime(); // 部件ID
  894. wd.display.winWidth = width;
  895. wd.display.winHeight = high;
  896. if (form) {
  897. wd.topWindow.wd.display.targetForm = window.document
  898. .getElementsByName(form)[0];
  899. wd.topWindow.wd.display.targetUrl = url;
  900. url = "/wd/js/cloneForm/cloneForm.jsp";
  901. }
  902. if (title) {
  903. // title = '<span style="font:14px
  904. // \'宋体\'\;line-height:30px;" >'+title+'</span>';
  905. title = '<span style="padding:5px;">' +
  906. '<a class="dialog-title" target="_blank" onclick="return false;" href="' +
  907. url +
  908. '&wdTitle=' +
  909. title +
  910. '">' +
  911. title +
  912. '</a>' +
  913. '<a class="secondTitle" target="_blank" onclick="return false;" href="javascript:void(0);"></a>' +
  914. '</span>';
  915. }
  916. if (showNameOrId) { // 如果需要显示部件
  917. if (typeof (showNameOrId) != 'object') { // 如果传入的不是数组
  918. var arr = [];
  919. arr.push(showNameOrId);
  920. showNameOrId = arr; // 统一为数组
  921. }
  922. var useUrl = true;
  923. var hasWdDialog = false;
  924. for (var i = 0; i < showNameOrId.length; i++) {
  925. var oneNameOrId = showNameOrId[i];
  926. if (oneNameOrId == 'wdDialog') { // 这里应该不是 <wdDialog。Lin
  927. hasWdDialog = true;
  928. break;
  929. }
  930. }
  931. for (var i = 0; i < showNameOrId.length; i++) {
  932. var oneNameOrId = showNameOrId[i];
  933. var selfParam = oneNameOrId.self;
  934. var titleParam = oneNameOrId.title;
  935. var nameParam = oneNameOrId.name;
  936. var sizeParam = oneNameOrId.size;
  937. var positionParam = oneNameOrId.position;
  938. var btnParam = oneNameOrId.button;
  939. // wd.display.showComponent({show:[{"name":"wdDialog","size":"450*380"}],hide:[],url:"/service?wdApplication=jw&wdService=ty_gg_ck&wdOutputComponent=44786&wdtest=false&ggid=44000059",dest:"gg.ty_gg_ck",title:"查看",width:450,high:380,wdDialogId:44786,form:""})
  940. if (typeof (oneNameOrId) == 'object') {
  941. if (oneNameOrId.size) {
  942. var arr = oneNameOrId.size.split("*");
  943. var width = parseInt(arr[0]) + 15; // 当要弹出窗口宽度,单位为px
  944. var high = parseInt(arr[1]) + 38; // 当要弹出窗口宽度,单位为px
  945. }
  946. oneNameOrId = oneNameOrId.name;
  947. }
  948. var storage = window.localStorage;
  949. if (oneNameOrId == 'wdDialog') { // "如果要弹出窗口"。这里应该不是 <wdDialog。Lin
  950. // 把当前窗口的window对象,保存到wd.topWindow窗口中,以便关闭窗口时使用
  951. if (!wd.topWindow.wd.display.wdDialogOpeners)
  952. wd.topWindow.wd.display.wdDialogOpeners = {};
  953. wd.topWindow.wd.display.wdDialogOpeners[wdDialogId] = window;
  954. var windowId = wdDialogId;
  955. // /当前可视区域
  956. var sw = wd.topWindow.screen.availWidth;
  957. var sh = wd.topWindow.screen.availHeight;
  958. // 根据可是区域调整窗口
  959. var cenFlag = false; // 超过时不居中
  960. if (width > (sw - 20)) {
  961. width = sw - 20;
  962. };
  963. if (high > (sh - 20))
  964. high = sh - 20;
  965. if (width > sw || high > sh)
  966. cenFlag = true;
  967. // /
  968. if (!wd.topWindow.dhxWins)
  969. wd.topWindow.dhxWins = new wd.topWindow.dhtmlXWindows();
  970. var w = wd.topWindow.dhxWins.createWindow(windowId, 0, 0, width, high);
  971. w.keepInViewport(true); // 保持在窗口内
  972. if (!cenFlag)
  973. w.center(); // 居中
  974. w.setText(title); // 设置窗口标题
  975. //2021-09-06 新增,当url超长时候,改成form提交
  976. var hasInvalidUrlChar = false;
  977. var invalidUrlChar = ['{', '}', '[', ']', '|'];
  978. for (var _ici = 0; _ici < invalidUrlChar.length; _ici++) {
  979. if (url.indexOf(invalidUrlChar[_ici]) > -1) {
  980. hasInvalidUrlChar = true;
  981. break;
  982. }
  983. }
  984. if (hasInvalidUrlChar || (url && url.length > 1000)) {
  985. hasInvalidUrlChar && console.log("url中有非法字符");
  986. console.log("触发了form提交表单~,url长度:"+url.length);
  987. w.attachEvent("onContentLoaded", function () {
  988. try {
  989. if (this.getFrame().getAttribute("formload")) {
  990. return;
  991. }
  992. var myDoc = this.getFrame().contentDocument;
  993. var index = url.indexOf("?");
  994. index = index < 0 ? url.length - 1 : index;
  995. var base = url.substring(0, index);
  996. var params = url.substring(index + 1);
  997. var paramarr = params.split("&");
  998. var myform = myDoc.createElement("form");
  999. myform.setAttribute("action", base);
  1000. myform.setAttribute("method", "post");
  1001. myDoc.body.appendChild(myform);
  1002. for (var pi = 0; pi < paramarr.length; pi++) {
  1003. var pstr = paramarr[pi];
  1004. var pei = pstr.indexOf("=");
  1005. pei = pei < 0 ? pstr.length : pei;
  1006. var k = pstr.substring(0, pei);
  1007. var v = pstr.substring(pei + 1);
  1008. var myInput = myDoc.createElement("input");
  1009. myInput.setAttribute("type", "hidden");
  1010. myInput.setAttribute("name", k);
  1011. myInput.value =decodeURIComponent(v);//可能会有url编码了的情况
  1012. myform.appendChild(myInput);
  1013. }
  1014. myform.submit();
  1015. this.getFrame().setAttribute("formload", "true")
  1016. } catch (e) {
  1017. console.error(e)
  1018. }
  1019. });
  1020. w.attachURL("javascript:false;");
  1021. } else {
  1022. w.attachURL(url); // 跳到此URL
  1023. }
  1024. useUrl = false;
  1025. w.setModal(true); // 设置模式窗口
  1026. w.bringToTop(); // 置顶
  1027. wd.display.addWdUserButton(w);
  1028. wd.display.addComponentEvent(w);
  1029. wd.display.addDialogLine(w);
  1030. // 改变按钮的类样式名
  1031. // var buttonType = wd.display.wdButtons;
  1032. // for (var i = 0; i < buttonType.length; i++) {
  1033. // w.button(buttonType[i][0]).className = "dhtmlx_wins_btns_button " + buttonType[i][4];
  1034. // }
  1035. // 隐藏不需要的按钮
  1036. w.clearIcon();
  1037. if (w.button('help'))
  1038. w.button('help').hide();
  1039. if (w.button('stick'))
  1040. w.button('stick').hide();
  1041. if (w.button('sticked'))
  1042. w.button('sticked').hide();
  1043. if (w.button('park'))
  1044. w.button('park').hide();
  1045. if (w.button('minmax1')) // 隐藏最大化按钮
  1046. w.button('minmax1').hide();
  1047. w.denyResize(); // 不允许改变大小
  1048. // if(w.button('close'))
  1049. // w.button('close').hide();
  1050. // w.btns.help.title = "帮助";
  1051. w.button('close').setAttribute("title", "关闭"); // 修改关闭按钮提示
  1052. var containerObj = wd.topWindow.wd.display;
  1053. var currentDialogZIndex = w.zi; // 弹出窗口的z-index
  1054. wd.display.dxwindowsCreateMaskDiv(currentDialogZIndex);
  1055. w.attachEvent("onClose", function (win) {
  1056. wd.display.dxwindowsCloseMaskDiv();
  1057. /*
  1058. * var parentDialog =
  1059. * wd.topWindow.dhxWins.window(parentWdDialogId); if(typeof
  1060. * parentDialog != 'undefined' && parentDialog ){
  1061. * //parentDialog.button('close').enable(); }
  1062. */
  1063. // var iframeObj = $(win).find('iframe')[0];
  1064. function findIframe(dom) {
  1065. for (var i = 0; i < dom.childNodes.length; i++) {
  1066. var c = dom.childNodes[i];
  1067. if (c.tagName == 'IFRAME') {
  1068. return c;
  1069. }
  1070. var temp = findIframe(c);
  1071. if (temp)
  1072. return temp;
  1073. }
  1074. }
  1075. try {
  1076. var iframeObj = findIframe(win);
  1077. var popWindow = iframeObj.contentWindow;
  1078. // 调用关闭窗口时调用的回调方法
  1079. if (typeof popWindow != 'undefined' && popWindow.wd.display.closeDialogCallbackFun) {
  1080. popWindow.wd.display.closeDialogCallbackFun();
  1081. }
  1082. wd.display.onCloseDialog(win, popWindow);
  1083. } catch (e) {
  1084. console.log(e);
  1085. }
  1086. return true;
  1087. });
  1088. } else if (oneNameOrId == "wdFullScreen") { // 如果只是显示功能部件
  1089. if (!wd.topWindow.dhxWins)
  1090. wd.topWindow.dhxWins = new wd.topWindow.dhtmlXWindows();
  1091. if (!wd.topWindow.wd.display.wdDialogOpeners)
  1092. wd.topWindow.wd.display.wdDialogOpeners = {};
  1093. wd.topWindow.wd.display.wdDialogOpeners[wdDialogId] = window;
  1094. var w = wd.topWindow.dhxWins.createWindow(wdDialogId, 0, 0, width, high);
  1095. w.keepInViewport(true); // 保持在窗口内
  1096. w.attachURL(url); // 跳到此URL
  1097. w.setModal(true); // 设置模式窗口
  1098. w.bringToTop(); // 置顶
  1099. w.setText(title);
  1100. w.clearIcon();
  1101. w.hideMenu();
  1102. w.hideToolbar();
  1103. w.center(); //窗口居中
  1104. wd.display.addWdUserButton(w);
  1105. wd.display.addComponentEvent(w);
  1106. wd.display.hideAllWdUserButton(w);
  1107. wd.display.addDialogLine(w);
  1108. var winbody;
  1109. var Pbtn = w.button('close').parentNode; //关闭按钮的父节点
  1110. var titleline = w.childNodes[0].childNodes[2]//获取到标题元素
  1111. var btns = w.childNodes[0].childNodes[3];
  1112. var odiv = document.createElement("div"); //创建一个新的元素div,用于存放btn div以及标题的div
  1113. w.childNodes[0].appendChild(odiv);
  1114. odiv.style.height = 43 + "px"; //给新元素进行设置样式
  1115. odiv.style.position = "absolute";
  1116. // odiv.style.display = 'none';
  1117. odiv.id = "odiv";
  1118. odiv.style.top = 0;
  1119. odiv.style.width = "100%";
  1120. odiv.style.backgroundColor = '#ffffff';
  1121. odiv.style.zIndex = -1;
  1122. odiv.setAttribute("class", "hLine");
  1123. w.fullScreen = function () { //初始化页面的函数
  1124. var dhwin = wd.topWindow.dhxWins;
  1125. if (fullScreenLimitHeight)
  1126. wd.topWindow.document.body.style.overflow = "hidden";
  1127. dhwin._engineGetWindowLabel(this).style.display = "none";
  1128. // alert(dhwin._engineFixWindowPosInViewport(this));
  1129. var vpw = (_isIE ? document.body.offsetWidth : window.innerWidth);
  1130. var vph = (_isIE ? document.body.offsetHeight : window.innerHeight);
  1131. // this.h = document.body.clientHeight;
  1132. if (fullScreenLimitHeight)
  1133. this.h = wd.topWindow.document.body.offsetHeight;
  1134. this.y = wd.topWindow.document.body.scrollTop;
  1135. // dhwin._engineFixWindowPosInViewport(this);
  1136. dhwin._engineRedrawWindowSize(this);
  1137. dhwin._engineRedrawWindowPos(this);
  1138. winbody = this.vs[this.av].dhxcont;
  1139. winbody.style.top = 0;
  1140. winbody.style.marginTop = 0;
  1141. winbody.style.height = this.h + "px";
  1142. winbody.childNodes[0].style.height = this.h + "px";
  1143. Pbtn.style.zIndex = 100;
  1144. }
  1145. w.fullScreen();
  1146. /* 再改,改用 mouseenter -- 原,导致鼠标从标题行 右、上 端离开时,不会关闭标题行。Lin
  1147. Pbtn.onmouseover = function () {
  1148. */ Pbtn.onmouseenter = function () {
  1149. // console.log(w);
  1150. wd.display.showAllWdUserButton(w, true);
  1151. titleline.style.display = "block" //把标题的display属性改成block,在初始化的时候全部设置成了none
  1152. odiv.style.zIndex = 99; //通过调整div的层数来对原有的信息进行覆盖
  1153. odiv.style.display = 'block';
  1154. odiv.style.height = "48px"; // 再增加,解决关闭按钮突出标题行问题 -- 标题行高为 43px。Lin
  1155. titleline.style.zIndex = 100;
  1156. }
  1157. odiv.onmouseover = function () {
  1158. this.style.display = 'block';
  1159. this.style.zIndex = 99;
  1160. titleline.style.zIndex = 100;
  1161. }
  1162. titleline.onmouseover = function () {
  1163. odiv.style.zIndex = 99;
  1164. odiv.style.display = 'block';
  1165. this.style.zIndex = 100;
  1166. }
  1167. /* 再改,改用 mouseenter -- 原,导致鼠标从标题行 右、上 端离开时,不会关闭标题行。Lin
  1168. Pbtn.onmouseout = function (e) {
  1169. */ Pbtn.onmouseleave = function (e) {
  1170. if (!e)
  1171. e = window.event;
  1172. var reltg = e.relatedTarget ? e.relatedTarget : e.toElement;
  1173. if (reltg.id != "odiv") {
  1174. odiv.style.zIndex = -1;
  1175. odiv.style.display = 'none';
  1176. w.childNodes[0].childNodes[2].style.display = "none" //鼠标离开时进行还原
  1177. wd.display.hideAllWdUserButton(w);
  1178. } else {
  1179. titleline.style.display = "block"
  1180. }
  1181. }
  1182. odiv.onmouseout = function (e) {
  1183. if (!e)
  1184. e = window.event;
  1185. var reltg = e.relatedTarget ? e.relatedTarget : e.toElement;
  1186. // if (reltg.className == "dhtmlx_wins_btns_button dhtmlx_button_wdTab_default") { //判定离开新元素是否到了按钮
  1187. // titleline.style.display = "block"
  1188. // } else
  1189. if (reltg.className == "dhtmlx_wins_title") { //判定离开了新元素是否到了title元素
  1190. titleline.style.display = "block"
  1191. } else {
  1192. odiv.style.zIndex = -1;
  1193. odiv.style.display = 'none';
  1194. w.childNodes[0].childNodes[2].style.display = "none";
  1195. wd.display.hideAllWdUserButton(w);
  1196. }
  1197. }
  1198. titleline.onmouseout = function (e) {
  1199. if (!e)
  1200. e = window.event;
  1201. var reltg = e.relatedTarget ? e.relatedTarget : e.toElement;
  1202. if (reltg.id == "odiv") {
  1203. titleline.style.display = "block"
  1204. } else {
  1205. odiv.style.zIndex = -1;
  1206. odiv.style.display = 'none';
  1207. w.childNodes[0].childNodes[2].style.display = "none" //鼠标离开时进行还原
  1208. wd.display.hideAllWdUserButton(w);
  1209. }
  1210. }
  1211. wd.display.hideAllWdUserButton(w);
  1212. w.button('close').setAttribute("title", "关闭");
  1213. //以上是对鼠标的走向进行判定
  1214. w.attachEvent("onClose", function (win) {
  1215. wd.topWindow.document.body.style.overflow = "auto";
  1216. wd.display.dxwindowsCloseMaskDiv();
  1217. function findIframe(dom) {
  1218. for (var i = 0; i < dom.childNodes.length; i++) {
  1219. var c = dom.childNodes[i];
  1220. if (c.tagName == 'IFRAME') {
  1221. return c;
  1222. }
  1223. var temp = findIframe(c);
  1224. if (temp)
  1225. return temp;
  1226. }
  1227. }
  1228. try {
  1229. var iframeObj = findIframe(win);
  1230. var popWindow = iframeObj.contentWindow;
  1231. // 调用关闭窗口时调用的回调方法
  1232. if (typeof popWindow != 'undefined' && popWindow.wd.display.closeDialogCallbackFun) {
  1233. popWindow.wd.display.closeDialogCallbackFun();
  1234. }
  1235. wd.display.onCloseDialog(win, popWindow);
  1236. } catch (e) {
  1237. console.log(e);
  1238. }
  1239. return true;
  1240. });
  1241. var currentDialogZIndex = w.zi;
  1242. wd.display.dxwindowsCreateMaskDiv(currentDialogZIndex);
  1243. } else if (showNameOrId == "wdhelpdialog") {
  1244. console.log("wdhelpdialog")
  1245. if (!wd.topWindow.dhxWins)
  1246. wd.topWindow.dhxWins = new wd.topWindow.dhtmlXWindows();
  1247. if (!wd.topWindow.wd.display.wdDialogOpeners)
  1248. wd.topWindow.wd.display.wdDialogOpeners = {};
  1249. wd.topWindow.wd.display.wdDialogOpeners[wdDialogId] = window;
  1250. var w;
  1251. //判断窗口是否已关闭
  1252. if (wd.topWindow.wdhelpdialog && wd.topWindow.wdhelpdialog.id) {
  1253. w = wd.topWindow.wdhelpdialog
  1254. } else {
  1255. // x,y控制弹窗口位置
  1256. w = wd.topWindow.dhxWins.createWindow(wdDialogId, params.x, params.y, width, high);
  1257. wd.topWindow.wdhelpdialog = w;
  1258. }
  1259. if (params.center) {
  1260. w.center(); //窗口居中
  1261. }
  1262. w.attachHTMLString(url); // 跳到此URL
  1263. w.keepInViewport(true); // 保持在窗口内
  1264. // w.setModal(true); // 设置模式窗口
  1265. w.bringToTop(); // 置顶
  1266. w.setText(title);
  1267. w.clearIcon();
  1268. // w.denyResize()
  1269. // w.hideMenu();
  1270. // w.hideToolbar();
  1271. wd.display.addWdUserButton(w);
  1272. // w.addUserButton("wdHelp_copyhashcode", 3, "复制代码", "复制代码")
  1273. w.button("wdHelp_copyhashcode").onclick = function () {
  1274. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  1275. var fakeElem = document.createElement('textarea');
  1276. // Prevent zooming on iOS
  1277. fakeElem.style.fontSize = '12pt';
  1278. // Reset box model
  1279. fakeElem.style.border = '0';
  1280. fakeElem.style.padding = '0';
  1281. fakeElem.style.margin = '0';
  1282. // Move element out of screen horizontally
  1283. fakeElem.style.position = 'absolute';
  1284. fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  1285. // Move element to the same position vertically
  1286. fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
  1287. fakeElem.setAttribute('readonly', '');
  1288. fakeElem.value = params.helpHaShCode;
  1289. document.body.appendChild(fakeElem);
  1290. fakeElem.select();
  1291. var succeeded;
  1292. try {
  1293. succeeded = document.execCommand('copy');
  1294. alert("复制成功");
  1295. } catch (err) {
  1296. succeeded = false;
  1297. alert("复制失败");
  1298. }
  1299. removeFake(fakeElem);
  1300. return succeeded;
  1301. }
  1302. if (params.pin) {
  1303. //已锁定
  1304. w.denyMove();
  1305. w.button("wdHelp_pin").hide();
  1306. w.button("close").show();
  1307. } else {
  1308. //未锁定
  1309. w.button("wdHelp_unpin").show();
  1310. w.button("close").hide();
  1311. w.allowMove();
  1312. wd.topWindow.setTimeout(function () {
  1313. if (w.isMovable()) {
  1314. w.close();
  1315. }
  1316. }, 3000)
  1317. }
  1318. w.button("wdHelp_unpin").onclick = function () {
  1319. w.button("close").show();
  1320. w.denyMove();
  1321. this.hide();
  1322. w.button("wdHelp_pin").hide();
  1323. }
  1324. w.button("wdHelp_pin").onclick = function () {
  1325. w.button("close").hide()
  1326. w.allowMove();
  1327. this.hide();
  1328. w.button("wdHelp_unpin").hide();
  1329. setTimeout(function () {
  1330. if (w.isMovable()) {
  1331. w.close();
  1332. }
  1333. }, 5000)
  1334. }
  1335. return w.getId();
  1336. }
  1337. }
  1338. } // end if
  1339. if (hideNameOrId) { // 如果有需要隐藏的DOM元素
  1340. // 显示所有DOM元素
  1341. for (var i = 0; i < hideNameOrId.length; i++) {
  1342. var elem = wd.c.g(hideElemNameOrIdArr[i], windowObj);
  1343. elem.style.display = "none";
  1344. var p = elem.parentNode;
  1345. if (p && p.tagName == 'DIV') {
  1346. p.style.display = "none";
  1347. }
  1348. }
  1349. }
  1350. //允许所有iframe全屏
  1351. var arr = wd.topWindow.document.getElementsByTagName('IFRAME');
  1352. for (var i = 0; i < arr.length; i++) {
  1353. var iframeObj = arr[i];
  1354. iframeObj.setAttribute("allowfullscreen", true);
  1355. }
  1356. // w.button("wdHelp").show()
  1357. // w.button("wdShare").show()
  1358. // w.button("wdRecord").show()
  1359. return wdDialogId;
  1360. };
  1361. /**
  1362. *
  1363. * 设置当前iframe部件的长宽
  1364. */
  1365. wd.display.changeDxwindowDimension = function (width, height) {
  1366. //wd.topWindow.dhxWins.
  1367. //刷新弹出本窗口的窗口
  1368. if (null != wd.display.getwdDialogOpener)
  1369. wd.display.refreshOpener();
  1370. //获得弹出部件window对象,通过创建时的部件id
  1371. var wdDialogId = wd.display.getwdDialogId();
  1372. var win = wd.topWindow.dhxWins.window(wdDialogId);
  1373. //myWins.window(id).setDimension(int width, int height);
  1374. win.setDimension(width, height);
  1375. win.keepInViewport(true); // 保持在窗口内
  1376. win.center(); // 居中
  1377. };
  1378. /**
  1379. *
  1380. * @param {}
  1381. * currentDialogZIndex:当前弹出窗口的zIndex
  1382. */
  1383. wd.display.dxwindowsCreateMaskDiv = function (currentDialogZIndex) {
  1384. var containerObj = wd.topWindow.wd.display;
  1385. var topWindow = wd.topWindow;
  1386. wd.display.createMaskDiv(containerObj, topWindow, currentDialogZIndex);
  1387. };
  1388. // 关闭wddialog时,移除遮罩层
  1389. wd.display.dxwindowsCloseMaskDiv = function () {
  1390. var containerObj = wd.topWindow.wd.display.mask;
  1391. var currentMaskEleID = containerObj.pop();
  1392. var currMaskEle = wd.topWindow.document.getElementById(currentMaskEleID);
  1393. if (typeof currMaskEle != 'undefined' && currMaskEle) {
  1394. if (typeof currMaskEle.remove != 'undefined') {
  1395. currMaskEle.remove();
  1396. } else {
  1397. currMaskEle.parentNode.removeChild(currMaskEle);
  1398. }
  1399. }
  1400. };
  1401. //获取当前窗口对应的dhxWin对象
  1402. wd.display.getwdDialogWindows = function (dialogid) {
  1403. /**
  1404. * 根据是否找到wdDialogId判断当前页面在弹窗中或应用页面
  1405. *
  1406. */
  1407. var wdDialogId = wd.display.getwdDialogId();
  1408. if (dialogid)
  1409. wdDialogId = dialogid
  1410. var win = wd.topWindow.dhxWins.window(wdDialogId);
  1411. return win;
  1412. };
  1413. // 如果当前为通过wdDialog弹出的窗口页面,调用此方法返回包含本窗口的iframe
  1414. wd.display.getwdDialogId = function (winUnderIframe) {
  1415. if (!winUnderIframe) {
  1416. winUnderIframe = window;
  1417. }
  1418. var arr = wd.topWindow.document.getElementsByTagName('IFRAME');
  1419. var wdDialogId = null;
  1420. for (var i = 0; i < arr.length; i++) {
  1421. var iframeObj = arr[i];
  1422. var cw = iframeObj.contentWindow;
  1423. var tempId = iframeObj.getAttribute('wdDialogId');
  1424. if (cw == winUnderIframe) {
  1425. if (tempId != null) { // 如果找到包含本窗口的iframe,ie走这里
  1426. wdDialogId = tempId;
  1427. break;
  1428. } else if (iframeObj.dataset) { // chrome走这里
  1429. if (iframeObj.dataset['wdDialogId']) {
  1430. wdDialogId = iframeObj.dataset['wdDialogId'];
  1431. break;
  1432. }
  1433. }
  1434. }
  1435. }
  1436. if (!wdDialogId) {
  1437. //最顶层页面跳出循环
  1438. if (winUnderIframe == wd.topWindow)
  1439. return null;
  1440. wdDialogId = wd.display.getwdDialogId(winUnderIframe.parent);
  1441. }
  1442. return wdDialogId;
  1443. }
  1444. // 如果当前为通过wdDialog弹出的窗口页面,调用此方法返回弹出本窗口的原窗口window对象
  1445. wd.display.getwdDialogOpener = function () {
  1446. var wdDialogId = wd.display.getwdDialogId();
  1447. return wd.topWindow.wd.display.wdDialogOpeners[wdDialogId];
  1448. }
  1449. // 刷新弹出本窗口的窗口
  1450. wd.display.refreshOpener = function () {
  1451. // //全屏模式下,按确定按钮关闭全屏模式
  1452. // var fullFiv = wd.topWindow.document.querySelector("#wdfullscreen");
  1453. // if (fullFiv) {
  1454. // fullFiv.parentNode.removeChild(fullFiv);
  1455. // }
  1456. try {
  1457. // 刷新原窗口页面
  1458. var wdDialogOpener = wd.display.getwdDialogOpener(); // 获得原窗口window对象
  1459. if (wd.topWindow == wdDialogOpener) {
  1460. return;
  1461. }
  1462. //执行自定义刷新方法(需要打开窗口定义wdRefresh)
  1463. if (wdDialogOpener.wdRefresh) {
  1464. wdDialogOpener.wdRefresh();
  1465. return;
  1466. }
  1467. //执行默认刷新方法
  1468. var forms = wdDialogOpener.document.getElementsByTagName('FORM');
  1469. //提交表单
  1470. if (forms && forms.length > 0 && forms[0].action) {
  1471. if (forms.length == 1) {
  1472. var f = forms[0];
  1473. f.submit();
  1474. }
  1475. //刷新个人首页部件
  1476. } else {
  1477. if (typeof wdDialogOpener.SYBJCTRL != 'undefined' && wdDialogOpener.SYBJCTRL) {
  1478. // 个人首页分支 by Rd 2016-01-13
  1479. // 通过刷新调用窗口的部件来替代刷新整个调用窗口
  1480. wdDialogOpener.SYBJCTRL.EventCtrl.FlushBj();
  1481. } else {
  1482. wdDialogOpener.location.reload();
  1483. }
  1484. }
  1485. } catch (e) {
  1486. console.log(e)
  1487. }
  1488. }
  1489. // 关闭弹出窗口
  1490. wd.display.closeDialog = function () {
  1491. try {
  1492. if (typeof beacon != "undefined")
  1493. beacon.beaconCloseWindow();
  1494. } catch (e) {
  1495. console.error(e);
  1496. }
  1497. var wdDialogId = wd.display.getwdDialogId();
  1498. // console.log(wdDialogId);
  1499. // console.log(wd.topWindow.dhxWins.window(wdDialogId));
  1500. // 关闭鼠标加载动画 by SPACE 2019-04-02
  1501. wd.display.closeLoad();
  1502. // 关闭本弹出窗口
  1503. wd.topWindow.dhxWins.window(wdDialogId).close();
  1504. }
  1505. /**
  1506. * 改变对象的样式
  1507. * event:监听事件的参数--{eventIds:['1','2'],styleName:{onclick:'样式名1',onmouseover:'样式名2',onmouseout:'样式名3'}}
  1508. * eventIds: 监听事件的id数组
  1509. * styleName:样式名(className),[0]是获得点击后样式名,[1]是鼠标移过时的样式名,[2]是对象默认的样式
  1510. */
  1511. wd.display.changeTabStyle = function (param) {
  1512. /**
  1513. * 绑定监听事件 eventIds:绑定事件的id数组, eventType:绑定的事件--onclick,onmouseout等,
  1514. * styleName:样式的类名
  1515. */
  1516. var objClick = new Object();
  1517. objClick.clickId = null;
  1518. objClick.mouseoverId = null;
  1519. function onEvent(tabIds, eventType, styleNames) {
  1520. // try{
  1521. if (eventType == 'onclick') {
  1522. for (var key in tabIds) {
  1523. var tagId = document.getElementById(tabIds[key]);
  1524. (function (key) {
  1525. wd.c.addEventListener(tagId, eventType, function () {
  1526. setTabCssToNormal();
  1527. var objById = this;
  1528. var objFocus = document.activeElement
  1529. objById.className = styleNames.onclick;
  1530. objClick.clickId = tabIds[key];
  1531. });
  1532. })(key)
  1533. }
  1534. } else if (eventType == 'onmouseover') {
  1535. for (var key in tabIds) {
  1536. var tagId = document.getElementById(tabIds[key]);
  1537. (function (key) {
  1538. wd.c.addEventListener(tagId, eventType, function () {
  1539. var objById = document.getElementById(tabIds[key]);
  1540. if (tabIds[key] == objClick.clickId) {
  1541. return;
  1542. }
  1543. objById.className = styleNames.onmouseover;
  1544. objClick.mouseoverId = tabIds[key];
  1545. });
  1546. })(key)
  1547. }
  1548. } else if (eventType == 'onmouseout') {
  1549. for (var key in tabIds) {
  1550. var tagId = document.getElementById(tabIds[key]);
  1551. (function (key) {
  1552. wd.c.addEventListener(tagId, eventType, function () {
  1553. var objById = document.getElementById(tabIds[key]);
  1554. if (tabIds[key] == objClick.clickId) {
  1555. return;
  1556. }
  1557. objById.className = styleNames.normal;
  1558. });
  1559. })(key)
  1560. }
  1561. }
  1562. /**
  1563. * }catch(e){ alert("创建监听事件错误:"+e.message+" Type:"+e.name); }
  1564. */
  1565. }
  1566. // -----------------------
  1567. var tabIds = param.tabIds;
  1568. var styleNames = param.styleNames;
  1569. onEvent(tabIds, 'onclick', styleNames);
  1570. onEvent(tabIds, 'onmouseover', styleNames);
  1571. onEvent(tabIds, 'onmouseout', styleNames);
  1572. function setTabCssToNormal() {
  1573. for (var i = 0; i < tabIds.length; i++) {
  1574. var tabId = tabIds[i];
  1575. document.getElementById(tabId).className = styleNames.normal;
  1576. }
  1577. }
  1578. // 设置默认对象
  1579. function setTabCssToNormalDefault() {
  1580. for (var i = 0; i < tabIds.length; i++) {
  1581. var tabId = tabIds[i];
  1582. if (i == 0) {
  1583. document.getElementById(tabId).className = styleNames.onclick;
  1584. objClick.clickId = tabId;
  1585. // objClick.clickId = tabId;
  1586. } else {
  1587. document.getElementById(tabId).className = styleNames.normal;
  1588. }
  1589. }
  1590. }
  1591. setTabCssToNormalDefault();
  1592. }
  1593. // 把当前窗口的window对象,保存到指定的窗口中,以便关闭窗口时使用
  1594. wd.display.windowToObj = function (Ele) {
  1595. if (!Ele.dom.wdDialogOpeners)
  1596. Ele.dom.wdDialogOpeners = {};
  1597. Ele.dom.wdDialogOpeners[Ele.wdDialogId] = window;
  1598. }
  1599. // 为dhtmlXWindows设置参数,创建窗口
  1600. wd.display.setDhtmlXWinParam = function (winParam) {
  1601. var windowId = winParam.wdDialogId;
  1602. // /当前可视区域
  1603. var sw = winParam.dom.document.body.offsetWidth;
  1604. var sh = winParam.dom.document.body.offsetHeight;
  1605. var positionParam = winParam.positionParam;
  1606. var btnParam = winParam.btnParam;
  1607. var sizeParam = winParam.sizeParam;
  1608. var winWid;
  1609. var winHeg;
  1610. // 根据可是区域调整窗口
  1611. var cenFlag = false; // 超过时不居中
  1612. // 处理x,y
  1613. if (positionParam) {
  1614. var win_X = positionParam.split(",")[0];
  1615. var win_Y = positionParam.split(",")[1];
  1616. } else {
  1617. cenFlag = true; // 居中
  1618. }
  1619. // 处理size属性
  1620. if (!sizeParam) { // 用户不填写size属性
  1621. winWid = wd.display.getDialogWidAndHei(wd.display.winWidth);
  1622. winHeg = wd.display.getDialogWidAndHei(wd.display.winHeight);
  1623. } else if ("max" == sizeParam) { // 这里设置的win
  1624. // size是还原状态下的窗口大小,后面会直接调用控件的最大化方法
  1625. if (wd.topWindow == winParam.dom) {
  1626. winWidth = wd.topWindow.document.body.offsetWidth;
  1627. winHeight = wd.topWindow.document.body.offsetHeight;
  1628. } else {
  1629. winWidth = document.body.offsetWidth;
  1630. winHeight = document.body.offsetHeight;
  1631. }
  1632. winWid = wd.display.getDialogWidAndHei(winWidth);
  1633. winHeg = wd.display.getDialogWidAndHei(winHeight);
  1634. } else {
  1635. winWid = wd.display.getDialogWidAndHei(sizeParam.split("*")[0],
  1636. document.body.offsetWidth);
  1637. winHeg = wd.display.getDialogWidAndHei(sizeParam.split("*")[1],
  1638. document.body.offsetHeight);
  1639. }
  1640. // if(winParam.dom.width < winWid || winParam.dom.heigh < winHeg)
  1641. // cenFlag=true;
  1642. if (positionParam) {
  1643. var w = winParam.dom.dhxWins.createWindow(windowId, parseInt(win_X),
  1644. parseInt(win_Y), winWid, winHeg);
  1645. } else {
  1646. var w = winParam.dom.dhxWins.createWindow(windowId, 0, 0, winWid,
  1647. winHeg);
  1648. }
  1649. w.keepInViewport(true); // 保持在窗口内
  1650. if (cenFlag)
  1651. w.center(); // 居中
  1652. if (winParam.title)
  1653. w.setText(winParam.title); // 设置窗口标题
  1654. w.attachURL(winParam.url); // 跳到此URL
  1655. useUrl = false;
  1656. w.setModal(true); // 设置模式窗口
  1657. w.bringToTop(); // 置顶
  1658. // 隐藏不需要的按钮
  1659. wd.display.showDialogBtn(w, btnParam);
  1660. if ("max" == sizeParam) {
  1661. w.maximize();
  1662. }
  1663. // if(w.button('help'))
  1664. // w.button('help').hide();
  1665. // if(w.button('stick'))
  1666. // w.button('stick').hide();
  1667. // if(w.button('sticked'))
  1668. // w.button('sticked').hide();
  1669. // if(w.button('park'))
  1670. // w.button('park').hide();
  1671. }
  1672. // 处理弹出窗口的大小
  1673. // 分为3中情况:数字*数字;max*数字;max
  1674. wd.display.getDialogWidAndHei = function (p, wp) {
  1675. if (p == "max") {
  1676. p = wp;
  1677. }
  1678. return parseInt(p);
  1679. }
  1680. // 处理弹出窗口的按钮
  1681. wd.display.showDialogBtn = function (w, btnParam) {
  1682. if (w.button('help'))
  1683. w.button('help').hide();
  1684. if (w.button('stick'))
  1685. w.button('stick').hide();
  1686. if (w.button('sticked'))
  1687. w.button('sticked').hide();
  1688. if (w.button('park'))
  1689. w.button('park').hide();
  1690. if (w.button('minmax1'))
  1691. w.button('minmax1').hide();
  1692. w.button('minmax2').hide();
  1693. if (w.button('close'))
  1694. w.button('close').hide();
  1695. if (btnParam) {
  1696. if (btnParam.indexOf("min") >= 0) {
  1697. w.button('park').show();
  1698. }
  1699. if (btnParam.indexOf("max") >= 0) {
  1700. if (w.isMaximized())
  1701. w.button('minmax2').show();
  1702. else
  1703. w.button('minmax1').show();
  1704. }
  1705. if (btnParam.indexOf("close") >= 0) {
  1706. w.button('close').show();
  1707. }
  1708. } else { // 用户没填写的话,默认值为“max,close”
  1709. if (w.isMaximized())
  1710. w.button('minmax2').show();
  1711. else
  1712. w.button('minmax1').show();
  1713. w.button('close').show();
  1714. }
  1715. }
  1716. /**
  1717. * 把名为frameName的frame的src属性置为url
  1718. */
  1719. wd.display.changeFrameSrc = function (frameName, url) {
  1720. document.getElementsByName(frameName)[0].src = url;
  1721. }
  1722. wd.display.wdTabNo = wd.display.defaultTabNo = 1; //默认的tab索引值
  1723. // 初始化tab的总方法
  1724. wd.display.initTab = function () {
  1725. (function () {
  1726. var tab = function () {
  1727. this.dom = null;
  1728. this.wdTabFrame = null;
  1729. this.wdTabList = [];
  1730. this.wdSecondaryTab = [];
  1731. this.styles = {
  1732. wdNormalClass: null,
  1733. wdSelectedClass: null,
  1734. wdNormalMoreClass: null,
  1735. wdSelectedMoreClass: null
  1736. }
  1737. this.selectTab = null;
  1738. this.mouseoutid = null;
  1739. var li = function () {
  1740. this.topSide = null;
  1741. this.dom = null;
  1742. this.type = null; //1:普通,2,显示隐藏开关,3,二级选项
  1743. this.parent = null;
  1744. this.ul = null;
  1745. this.url //点击刷新iframe的地址
  1746. this.secondaryTabList = [];
  1747. //独立
  1748. this.init = function (ele, type, topside, styles) {
  1749. //二级的顶层
  1750. this.dom = ele
  1751. this.url = this.dom.getAttribute("ssTabClick"); // ("wdTabClick")。Lin
  1752. this.setTopSide(topside)
  1753. this.type = type;
  1754. this.setStyle(styles);
  1755. // this.dom.setAttribute("class", this.wdNormalClass)
  1756. this.initEvent()
  1757. return this;
  1758. }
  1759. //初始化样式属性
  1760. this.setStyle = function (styles) {
  1761. this.styles = styles;
  1762. if (this.type == 1) {
  1763. }else if (this.type == 2) {
  1764. //初始二级的选项
  1765. this.initSecondaryTap();
  1766. $(this.dom).children("ul").addClass("popup-div").css({
  1767. "position": "absolute"
  1768. });
  1769. } else if (this.type == 3) {
  1770. this.dom.style.list_style_type = "none"
  1771. $(this.dom).attr("class","");
  1772. $(this.dom).addClass(styles.wdNormalMoreClass);
  1773. }
  1774. $(this.dom).removeClass(styles.wdSelectedClass).addClass(styles.wdNormalClass);
  1775. return this;
  1776. }
  1777. //绑定事件初始化
  1778. this.initEvent = function () {
  1779. this.dom.addEventListener("click", this.mouseClickEvent(), false)
  1780. this.dom.addEventListener("mouseover", this.mouseOverEvent(), false)
  1781. this.dom.addEventListener("mouseout", this.mouseOutEvent(), false)
  1782. }
  1783. this.initSecondaryTap = function () {
  1784. var newStyles = $.extend({},this.styles);
  1785. newStyles.wdNormalClass = this.styles.wdNormalMoreClass;
  1786. newStyles.wdSelectedClass = this.styles.wdSelectedMoreClass;
  1787. var result = [];
  1788. //显示隐藏的位置
  1789. var ul = this.dom.getElementsByTagName("ul")[0]
  1790. if (ul == null)
  1791. return;
  1792. this.ul = ul;
  1793. ul.style.display = "none";
  1794. var childNodes = ul.childNodes;
  1795. for (var i = 0; i < childNodes.length; i++) {
  1796. var nod = childNodes[i];
  1797. if (nod.nodeType == 1) {
  1798. if (nod.hasAttribute("ssTabClick")) { // ("wdtabclick"))。先改,是 wdtabclick,不是 wdTabClick。Lin
  1799. var liobj = new li();
  1800. liobj.init(nod, 3, this.topSide, newStyles)
  1801. result.push(nod)
  1802. }
  1803. }
  1804. }
  1805. this.secondaryTabList = result;
  1806. }
  1807. //设置根
  1808. this.setTopSide = function (obj) {
  1809. this.topSide = obj;
  1810. }
  1811. this.mouseClickEvent = function () {
  1812. var THIS = this;
  1813. return function () {
  1814. //编辑选项卡状态
  1815. if ("1" == THIS.topSide.dom.getAttribute("editing")) {
  1816. return true;
  1817. }
  1818. //清除上次点击
  1819. if (THIS.type != 2 && THIS.topSide.selectTab) {
  1820. $(THIS.topSide.selectTab.dom).removeClass(THIS.topSide.selectTab.styles.wdSelectedClass).addClass(THIS.topSide.selectTab.styles.wdNormalClass)
  1821. // THIS.topSide.selectTab.dom.setAttribute("class", THIS.topSide.selectTab.wdNormalClass)
  1822. THIS.topSide.selectTab = null
  1823. }
  1824. THIS.topSide.selectTab = THIS
  1825. THIS.url = THIS.dom.getAttribute("ssTabClick"); // ("wdTabClick")。Lin
  1826. if (THIS.type == 1 || THIS.type == 3) {
  1827. // THIS.topSide.wdTabFrame.src = THIS.url;
  1828. THIS.topSide.wdTabFrame.src = wd.base.setRowCountPerPage(THIS.url, THIS.topSide.wdTabFrame.offsetHeight);
  1829. $(THIS.dom).removeClass(THIS.styles.wdNormalClass).addClass(THIS.styles.wdSelectedClass)
  1830. // THIS.dom.setAttribute("class", THIS.wdSelectedClass);
  1831. } else if (THIS.type == 2) {
  1832. if (THIS.ul) {
  1833. if (THIS.ul.style.display == "none") {
  1834. THIS.ul.style.display = ""
  1835. } else {
  1836. THIS.ul.style.display = "none"
  1837. }
  1838. }
  1839. }
  1840. /**
  1841. * 找不到原来说的点击tab之后更多变成tab对应的名字
  1842. */
  1843. var secondarytab = document.querySelector('[wdsecondarytab="true"]');
  1844. if (secondarytab) {
  1845. var type = THIS.type;
  1846. if (type != 2) {
  1847. $(secondarytab).children(":not(ul)").remove();
  1848. $(secondarytab).contents().filter(function () {
  1849. if (this.nodeType == 3)
  1850. return true
  1851. }).remove()
  1852. }
  1853. var firstNode = secondarytab.firstChild;
  1854. switch (type) {
  1855. case 1:
  1856. var moreNode = document.createTextNode('更多');
  1857. if (firstNode.nodeType == 3) {
  1858. secondarytab.replaceChild(moreNode, firstNode);
  1859. } else {
  1860. secondarytab.insertBefore(moreNode, firstNode);
  1861. }
  1862. secondarytab.currentSelectedItem = null;
  1863. //删除小黄点
  1864. $(secondarytab).children(".statePoint").remove();
  1865. break;
  1866. case 2:
  1867. //“更多”被点击
  1868. if (secondarytab.currentSelectedItem) {
  1869. secondarytab.currentSelectedItem.dom.click();
  1870. }
  1871. break;
  1872. case 3:
  1873. //复制小黄点
  1874. if($(THIS.dom).find(".statePoint").length>0){
  1875. $(secondarytab).prepend($(THIS.dom).find(".statePoint").clone());
  1876. }
  1877. $(secondarytab).prepend(document.createTextNode($(THIS.dom).contents().text() + "..."))
  1878. secondarytab.currentSelectedItem = THIS;
  1879. break;
  1880. }
  1881. }
  1882. }
  1883. }
  1884. this.mouseOverEvent = function () {
  1885. var THIS = this;
  1886. return function () {
  1887. if ("1" == THIS.topSide.dom.getAttribute("editing")) {
  1888. return true;
  1889. }
  1890. if (THIS.type == 2) {
  1891. if (THIS.ul)
  1892. THIS.ul.style.display = "block";
  1893. //THIS.dom.getElementsByTagName("ul")[0]
  1894. if (THIS.topSide.mouseoutid)
  1895. clearTimeout(THIS.topSide.mouseoutid);
  1896. THIS.topSide.mouseoutid = null;
  1897. }
  1898. }
  1899. }
  1900. this.mouseOutEvent = function () {
  1901. var THIS = this;
  1902. return function () {
  1903. if ("1" == THIS.topSide.dom.getAttribute("editing")) {
  1904. return true;
  1905. }
  1906. if (THIS.topSide.selectTab != THIS) {
  1907. $(THIS.dom).removeClass(THIS.styles.wdSelectedClass).addClass(THIS.styles.wdNormalClass)
  1908. }
  1909. // if (THIS.type == 2 && THIS.ul && THIS.ul.style.display == "") {
  1910. // THIS.ul.style.display = "none"
  1911. // }
  1912. if (THIS.type == 2) {
  1913. var pos = THIS.dom.compareDocumentPosition(window.event.relatedTarget);
  1914. if (pos == 10 || pos == 4) {
  1915. if ("true" == THIS.dom.getAttribute("wdSecondaryTab")) {
  1916. if (THIS.topSide.mouseoutid)
  1917. clearTimeout(THIS.topSide.mouseoutid);
  1918. THIS.topSide.mouseoutid = null;
  1919. THIS.topSide.mouseoutid = setTimeout(function () {
  1920. THIS.ul.style.display = "none";
  1921. }, 800)
  1922. }
  1923. }
  1924. }
  1925. }
  1926. }
  1927. }
  1928. this.init = function (dom) {
  1929. this.dom = dom;
  1930. //原为 this.wdTabFrame = document.getElementsByTagName("iframe")[0]
  1931. this.wdTabFrame = document.querySelector('iframe[name="ssTabIframe"]') || // [name="wdTabFrame"]。Lin
  1932. document.getElementsByTagName("iframe")[0];
  1933. this.wdTabFrame.tabObj = this; //为了获取当前选中的tab来刷新当前的iframe
  1934. /* 改,规范命名。Lin
  1935. * wdNormalClass > ssNormClazz
  1936. * 去掉 wdNomalClass
  1937. * wdSelectedClass > ssSelClazz
  1938. this.styles.wdNormalClass = this.dom.getAttribute("wdNormalClass") || this.dom.getAttribute("wdNomalClass");
  1939. this.styles.wdSelectedClass = this.dom.getAttribute("wdSelectedClass");
  1940. */
  1941. this.styles.wdNormalClass = this.dom.getAttribute("ssNormClazz");
  1942. this.styles.wdSelectedClass = this.dom.getAttribute("ssSelClazz");
  1943. var parentiframe = window.parent.document.querySelector("iframe");
  1944. if (parentiframe.tabObj) { //双层选项卡
  1945. if (this.styles.wdSelectedClass != "lightTab-selected")
  1946. this.styles.wdSelectedClass += " lightTab-selected";
  1947. if (this.styles.wdNormalClass != "lightTab")
  1948. this.styles.wdNormalClass += " lightTab";
  1949. this.dom.style = "height:33px;padding-left: 14px;box-sizing:border-box";
  1950. } else {
  1951. if (this.styles.wdSelectedClass != "tab-selected")
  1952. this.styles.wdSelectedClass += " tab-selected";
  1953. if (this.styles.wdNormalClass != "tab")
  1954. this.styles.wdNormalClass += " tab";
  1955. }
  1956. this.styles.wdNormalMoreClass = "popupList";
  1957. this.styles.wdSelectedMoreClass = "popupList";
  1958. //初始化
  1959. var child = this.findChildLi();
  1960. var secondLi;
  1961. for (var i = 0; i < child.length; i++) {
  1962. var type = 1;
  1963. if (child[i].hasAttribute("wdSecondaryTab")) {
  1964. type = 2;
  1965. }
  1966. var liobj = new li();
  1967. liobj.init(child[i], type, this, this.styles);
  1968. if(type==2){
  1969. secondLi=liobj;
  1970. }
  1971. this.wdTabList.push(liobj)
  1972. }
  1973. //超出显示范围,就显示出更多选项卡 start
  1974. var wholewidth=0;
  1975. var domwidth=$(dom).width();
  1976. for(var i=0;i<this.wdTabList.length;i++){
  1977. var w=this.wdTabList[i].dom.offsetWidth;
  1978. wholewidth+=w;
  1979. }
  1980. if(wholewidth>domwidth){
  1981. secondLi.dom.style.display="";
  1982. domwidth-=secondLi.dom.offsetWidth*2;
  1983. var fistgroup=[];
  1984. var secondgroup=[];
  1985. var thirdgroup=[];
  1986. wholewidth=0;
  1987. for(var i=0;i<this.wdTabList.length;i++){
  1988. wholewidth+=this.wdTabList[i].dom.offsetWidth
  1989. var t=this.wdTabList[i].type;
  1990. if(t==2){
  1991. secondgroup.push(this.wdTabList[i]);
  1992. continue;
  1993. }
  1994. if(wholewidth>domwidth){
  1995. thirdgroup.push(this.wdTabList[i]);
  1996. this.wdTabList[i].type=3;
  1997. var oo=$.extend({},this.wdTabList[i].styles,{wdNormalClass:this.wdTabList[i].styles.wdNormalMoreClass,wdSelectedClass:this.wdTabList[i].styles.wdNormalMoreClass});
  1998. this.wdTabList[i].setStyle(oo);
  1999. $(this.wdTabList[i].dom).prependTo(secondLi.ul);
  2000. }else{
  2001. fistgroup.push(this.wdTabList[i]);
  2002. }
  2003. }
  2004. this.wdTabList=fistgroup.concat(secondgroup);
  2005. secondLi.secondaryTabList=thirdgroup.concat(secondLi.secondaryTabList);
  2006. }
  2007. //超出显示范围,就显示出更多选项卡 end
  2008. this.selectClick(wd.display.wdTabNo);
  2009. return this;
  2010. }
  2011. this.findChildLi = function () {
  2012. var result = []
  2013. var childNodes = this.dom.childNodes;
  2014. for (var i = 0; i < childNodes.length; i++) {
  2015. var nod = childNodes[i];
  2016. if (nod.nodeType == 1) {
  2017. /* 再改,规范 <li wdTabClick= 命名。Lin
  2018. * 先改,是 wdtabclick,不是 wdTabClick
  2019. * wdSecondaryTab,应该没有了 -- 没有 更多...
  2020. if (nod.hasAttribute("wdtabclick") || nod.hasAttribute("wdSecondaryTab")) {
  2021. */ if (nod.hasAttribute("ssTabClick") || nod.hasAttribute("wdSecondaryTab")) {
  2022. result.push(nod);
  2023. }
  2024. }
  2025. }
  2026. return result;
  2027. }
  2028. //指定第几个tab点击
  2029. this.selectClick = function (no) {
  2030. var num = no || 1;
  2031. var childLength = 0;
  2032. var child = this.findChildLi();
  2033. if (child.length == 0)
  2034. return;
  2035. for (var i = 0; i < child.length; i++) {
  2036. if (child[i].hasAttribute("wdSecondaryTab")) { }
  2037. else {
  2038. childLength++;
  2039. }
  2040. }
  2041. num = (isNaN(num) || num > childLength) ? wd.display.defaultTabNo : num;
  2042. if (childLength == 0) {
  2043. var cc = $(child[0]).find("li").filter(function () {
  2044. return this.style != 'none'
  2045. }).first();
  2046. if (cc.length == 1)
  2047. cc[0].click();
  2048. //隐藏更多
  2049. $(child[0]).find("#tabOption").hide();
  2050. } else if (num > childLength) {
  2051. child[0].click();
  2052. } else {
  2053. child[num - 1].click();
  2054. }
  2055. }
  2056. }
  2057. //从wdTabClick的元素顶层初始化
  2058. var initList = document.querySelectorAll("[ssTabClick]"); // ("[wdTabClick]")。Lin
  2059. var tabobj;
  2060. if (initList.length > 0) {
  2061. if ("tabOption" == initList[0].parentNode.getAttribute("id")) {
  2062. tabobj = new tab().init(initList[0].parentNode.parentNode.parentNode)
  2063. } else {
  2064. tabobj = new tab().init(initList[0].parentNode)
  2065. }
  2066. }
  2067. window.tabobj = tabobj;
  2068. })()
  2069. }
  2070. wd.display.getTabInstance = function () {
  2071. return window.tabobj;
  2072. }
  2073. /**
  2074. * 打印指定div等内容,可多个selector
  2075. */
  2076. wd.display.printArea = function (selector, noscroll, options) {
  2077. var jqsrc = "/wd/js/jquery/jquery.js";
  2078. var printsrc = "/wd/js/print/jquery.PrintArea.js";
  2079. if (typeof $ + "" == "undefined") {
  2080. loadScript(jqsrc, "jquery", function () {
  2081. loadAndPrint();
  2082. });
  2083. } else {
  2084. loadAndPrint();
  2085. }
  2086. function loadAndPrint() {
  2087. if (typeof $.PrintArea + '' == "undefined") {
  2088. loadScript(printsrc, "print", function () {
  2089. options = options || {
  2090. "mode": "iframe",
  2091. "popClose": false,
  2092. "extraCss": "",
  2093. "retainAttr": ["class", "id", "style", "on"],
  2094. "extraHead": "<meta charset=\"utf-8\" />,<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/>"
  2095. }
  2096. if (noscroll)
  2097. $(selector).css("overflow", "");
  2098. $(selector).append($("link").clone());
  2099. $(selector).append($("style").clone());
  2100. try {
  2101. $(selector).printArea(options);
  2102. } catch (e) {
  2103. alert("打印出错,检查打印窗是否被拦截");
  2104. console.error(e);
  2105. }
  2106. });
  2107. } else {
  2108. if (noscroll)
  2109. $(selector).css("overflow", "");
  2110. $(selector).append($("link").clone());
  2111. $(selector).append($("style").clone());
  2112. try {
  2113. $(selector).printArea(options);
  2114. } catch (e) {
  2115. alert("打印出错,检查打印窗是否被拦截");
  2116. console.error(e);
  2117. }
  2118. }
  2119. }
  2120. };
  2121. /**
  2122. *
  2123. * @param {Object}
  2124. * output
  2125. * @param {Object}
  2126. * wdurl
  2127. */
  2128. wd.display.qrcode = function (output, wdurl, width, height, render) {
  2129. // console.log($().qrcode);
  2130. // if (typeof $ + "" == "undefined") {
  2131. // loadScript("/wd/js/jquery/jquery.js", "jquery~", function() {
  2132. // wd.display.qrcode(output, wdurl, width, height, render);
  2133. // });
  2134. // } else {
  2135. // if (!$().qrcode)
  2136. // loadScript("/wd/js/qrcode/jquery.qrcode.js", "qrcode1", function() {
  2137. // loadScript("/wd/js/qrcode/qrcode.js", "qrcode2", function() {
  2138. // wd.display.qrcode(output, wdurl, width, height, render);
  2139. // });
  2140. // });
  2141. // else {
  2142. var option = {
  2143. render: render || "table",
  2144. text: wdurl.toString(),
  2145. width: width || "200",
  2146. height: height || "200"
  2147. };
  2148. $(output).find(".qrcode").remove();
  2149. $(output).append("<div class='qrcode'></div>");
  2150. $(output).find(".qrcode").qrcode(option);
  2151. // }
  2152. // }
  2153. };
  2154. /**
  2155. * 改变dom元素的背景图片
  2156. * 但css中的背景图片的url必须如下:url(./img/background.jpg?wdHelpImage=changebg.jpg)
  2157. *
  2158. * @param domId
  2159. * 需要改变背景图片的dom元素id
  2160. */
  2161. wd.display.changeBackgroundImage = function (domId) {
  2162. var domElement = document.getElementById(domId);
  2163. var cssStr = getClass(domElement, "backgroundImage");
  2164. cssStr = cssStr.substring(4, cssStr.length - 1);
  2165. cssStr = cssStr.replace(/http:\/\/([^\s\/])+/, "");
  2166. var imgPath = cssStr.substring(0, cssStr.lastIndexOf("?"));
  2167. if (cssStr.lastIndexOf("?") != -1) {
  2168. imgPath = imgPath.substring(0, imgPath.lastIndexOf("/") + 1); // 图片所在的文件位置
  2169. var changeImgStartIndex = cssStr.lastIndexOf("=") + 1;
  2170. var changeImg = cssStr.substring(parseInt(changeImgStartIndex),
  2171. parseInt(cssStr.length));
  2172. var oldUrl = cssStr.substring(0, cssStr.lastIndexOf("?"));
  2173. var oldImg = oldUrl.substring(oldUrl.lastIndexOf("/") + 1);
  2174. changeImg = imgPath + changeImg;
  2175. changeImg = changeImg.replace(/\"/g, "");
  2176. var imgUrl = "url(" + changeImg + "?background=" + oldImg + ")"; // 图片URL
  2177. domElement.style.backgroundImage = imgUrl;
  2178. }
  2179. function getClass(obj, attr) {
  2180. if (obj.currentStyle) {
  2181. if (attr == "backgroundPosition") {
  2182. return obj.currentStyle.backgroundPositionX + " " +
  2183. obj.currentStyle.backgroundPositionY;
  2184. } else {
  2185. return obj.currentStyle[attr];
  2186. }
  2187. } else {
  2188. return document.defaultView.getComputedStyle(obj, null)[attr];
  2189. }
  2190. }
  2191. }
  2192. /**
  2193. * 改变dom元素的背景图片
  2194. * 但css中的背景图片的url必须如下:url(./img/background.jpg?wdHelpImage=changebg.jpg)
  2195. *
  2196. * @param domId
  2197. * 需要改变背景图片的dom元素id
  2198. */
  2199. wd.display.changeBackgroundImage = function (domId) {
  2200. var domElement = document.getElementById(domId);
  2201. var cssStr = getClass(domElement, "backgroundImage");
  2202. cssStr = cssStr.substring(4, cssStr.length - 1);
  2203. cssStr = cssStr.replace(/http:\/\/([^\s\/])+/, "");
  2204. var imgPath = cssStr.substring(0, cssStr.lastIndexOf("?"));
  2205. if (cssStr.lastIndexOf("?") != -1) {
  2206. imgPath = imgPath.substring(0, imgPath.lastIndexOf("/") + 1); // 图片所在的文件位置
  2207. var changeImgStartIndex = cssStr.lastIndexOf("=") + 1;
  2208. var changeImg = cssStr.substring(parseInt(changeImgStartIndex),
  2209. parseInt(cssStr.length));
  2210. var oldUrl = cssStr.substring(0, cssStr.lastIndexOf("?"));
  2211. var oldImg = oldUrl.substring(oldUrl.lastIndexOf("/") + 1);
  2212. changeImg = imgPath + changeImg;
  2213. changeImg = changeImg.replace(/\"/g, "");
  2214. var imgUrl = "url(" + changeImg + "?background=" + oldImg + ")"; // 图片URL
  2215. domElement.style.backgroundImage = imgUrl;
  2216. }
  2217. function getClass(obj, attr) {
  2218. if (obj.currentStyle) {
  2219. if (attr == "backgroundPosition") {
  2220. return obj.currentStyle.backgroundPositionX + " " +
  2221. obj.currentStyle.backgroundPositionY;
  2222. } else {
  2223. return obj.currentStyle[attr];
  2224. }
  2225. } else {
  2226. return document.defaultView.getComputedStyle(obj, null)[attr];
  2227. }
  2228. }
  2229. }
  2230. // table列表自适应宽度
  2231. // ;(function($){
  2232. //但是每个部件都要加载一次
  2233. if ((typeof $) + "" == "undefined") {
  2234. loadScript("/wd/js/jquery.js", "Jquery", function () {
  2235. setTimeout(tabFoo, 200);
  2236. });
  2237. }
  2238. // 这个延迟执行在于加载时比dom元素先加载 而且该js文件在页面被加载多次消耗性能望后来者去解决这些问题
  2239. function tabFoo() {
  2240. var oTh = $('table.list th'),
  2241. oTr = $('table.list tr'),
  2242. arr_oth = Array.prototype.slice.apply(oTh),
  2243. font_size = parseInt($(arr_oth[0]).css('fontSize')),
  2244. style_h = $('style'),
  2245. str_sheet = " white-space: nowrap;overflow: hidden;text-overflow: ellipsis;padding-left:10px;";
  2246. if (oTh.length <= 5) {
  2247. if (style_h.length) {
  2248. var first_style = style_h[0],
  2249. sheet = first_style.sheet ?
  2250. first_style.sheet :
  2251. first_style.styleSheet;
  2252. if (sheet.insertRule) {
  2253. sheet.insertRule('table.list td,table.list th{' + str_sheet + '}',
  2254. 1);
  2255. } else {
  2256. sheet.addRule('table.list td,table.list th', str_sheet, 0)
  2257. }
  2258. } else {
  2259. $('head').append('<style type="text/css">table.list td,table.list th{' +
  2260. str_sheet + '}</style>')
  2261. }
  2262. for (var i = 0; i < arr_oth.length - 1; i++) {
  2263. // console.log($(arr_oth[i]).text().length, '222');
  2264. var thW = $(arr_oth[i]).text().length;
  2265. thW = thW < 5 ? thW : 5; // 限定th的最大字数是5个字符
  2266. if (i == 0) {
  2267. $(arr_oth[i]).css({
  2268. 'min-width': (thW + 10) * font_size + 'px', // max-width and
  2269. // min-width
  2270. // 根据th字符数上下浮动一个
  2271. 'max-width': (thW + 12) * font_size + 'px'
  2272. });
  2273. // console.log($('table.list tr td:nth-child(' + (i + 1) + ')'))
  2274. $('table.list tr td:nth-child(' + (i + 1) + ')').css({
  2275. 'min-width': (thW + 10) * font_size + 'px',
  2276. 'max-width': (thW + 12) * font_size + 'px'
  2277. });
  2278. } else {
  2279. $(arr_oth[i]).css({
  2280. 'min-width': (thW + 6) * font_size + 'px', // max-width and
  2281. // min-width
  2282. // 根据th字符数上下浮动一个
  2283. 'max-width': (thW + 8) * font_size + 'px'
  2284. });
  2285. // console.log($('table.list tr td:nth-child(' + (i + 1) + ')'))
  2286. $('table.list tr td:nth-child(' + (i + 1) + ')').css({
  2287. 'min-width': (thW + 6) * font_size + 'px',
  2288. 'max-width': (thW + 8) * font_size + 'px'
  2289. });
  2290. }
  2291. }
  2292. $('table.list tr td:nth-child(' + arr_oth.length + ')').css({
  2293. "white-space": "inherit",
  2294. "overflow": "inherit",
  2295. "text-overflow": "inherit"
  2296. })
  2297. $('.img1').parents('td').css('cssText', 'width:90px !important');
  2298. return;
  2299. }
  2300. if (style_h.length) {
  2301. var first_style = style_h[0],
  2302. sheet = first_style.sheet ?
  2303. first_style.sheet :
  2304. first_style.styleSheet;
  2305. if (sheet.insertRule) {
  2306. sheet.insertRule('table.list td,table.list th{' + str_sheet + '}',
  2307. 1);
  2308. } else {
  2309. sheet.addRule('table.list td,table.list th', str_sheet, 0)
  2310. }
  2311. } else {
  2312. $('head').append('<style type="text/css">table.list td,table.list th{' +
  2313. str_sheet + '}</style>')
  2314. }
  2315. // console.log(arr_oth.length)
  2316. for (var i = 0; i < arr_oth.length - 1; i++) {
  2317. var thW = $(arr_oth[i]).text().length;
  2318. thW = thW < 5 ? thW : 5; // 限定th的最大字数是5个字符
  2319. $(arr_oth[i]).css({
  2320. 'min-width': (thW - 1) * font_size + 'px', // max-width and
  2321. // min-width
  2322. // 根据th字符数上下浮动一个
  2323. 'max-width': (thW + 1) * font_size + 'px'
  2324. });
  2325. // console.log($('table.list tr td:nth-child(' + (i + 1) + ')'))
  2326. $('table.list tr td:nth-child(' + (i + 1) + ')').css({
  2327. 'min-width': (thW - 1) * font_size + 'px',
  2328. 'max-width': (thW + 1) * font_size + 'px'
  2329. });
  2330. }
  2331. $('table.list tr td:nth-child(1)').css({
  2332. 'min-width': (thW + 1) * font_size + 'px',
  2333. 'max-width': (thW + 3) * font_size + 'px'
  2334. });
  2335. $('table.list tr td:nth-child(' + arr_oth.length + ')').css({
  2336. "white-space": "inherit",
  2337. "overflow": "inherit",
  2338. "text-overflow": "inherit"
  2339. })
  2340. $('.img1').parents('td').css('cssText', 'width:90px !important');
  2341. // console.log($('.img1').parents('td').css('width'));
  2342. }
  2343. function loadScript(src, id, callback) {
  2344. if (!document.getElementById(id)) {
  2345. var head = document.getElementsByTagName('head')[0];
  2346. var script = document.createElement('script');
  2347. script.id = id;
  2348. script.type = 'text/javascript';
  2349. script.onreadystatechange = function () {
  2350. if (this.readyState == 'complete') {
  2351. callback();
  2352. }
  2353. }
  2354. script.onload = function () {
  2355. callback();
  2356. }
  2357. script.src = src;
  2358. head.appendChild(script);
  2359. } else {
  2360. callback()
  2361. };
  2362. }
  2363. // })($);
  2364. //下拉改变irame
  2365. wd.display.initWdSelectFrame = function () {
  2366. (function () {
  2367. // 查找所有的option
  2368. var optionAll = document.querySelectorAll("option[wdSelectClick]")
  2369. // 遍历option
  2370. for (var i = 0; i < optionAll.length; i++) {
  2371. var options = optionAll[i];
  2372. // 找出匹配的option
  2373. if (typeof options.getAttribute("wdSelectClick") != "undefined") {
  2374. // 为其父元素绑定一个id
  2375. options.parentNode.setAttribute("id", "wdSelect");
  2376. // 为其父元素绑定一个事件
  2377. options.parentNode.onchange = function () {
  2378. iframeSrc();
  2379. };
  2380. }
  2381. }
  2382. // 下拉默认值
  2383. function iframeSrc() {
  2384. var mySelect = document.getElementById("wdSelect");
  2385. var myOption = mySelect.options[mySelect.selectedIndex].getAttribute("wdSelectClick");
  2386. document.getElementById("wdIframe").setAttribute("src", myOption);
  2387. }
  2388. if (optionAll.length > 0)
  2389. iframeSrc();
  2390. })()
  2391. }
  2392. wd.display.home = function () {
  2393. //显示个人首页
  2394. // if (document.getElementById("mbwzbj")) {
  2395. // document.getElementById("mbwzbj").innerHTML = "个人首页";
  2396. // } else {
  2397. // var div = top.window.document.querySelector("div[name='mbwz']");
  2398. // if (!div)
  2399. try {
  2400. // wd.topWindow.window.document.querySelector("span[id='mbwzbj']").innerHTML = "个人首页";
  2401. wd.display.setHomeIconName("个人首页");
  2402. } catch (e) {
  2403. console.log(e);
  2404. }
  2405. // }
  2406. var iframe = wd.topWindow.window.document.querySelector("iframe[oriSrc]");
  2407. // console.log(iframe);
  2408. iframe.src = iframe.getAttribute("oriSrc");
  2409. //处理菜单项
  2410. /*
  2411. var menu = new dhtmlXMenuObject("menuObj440141088","dhx_black");
  2412. var casState = new Object({
  2413. ctrl: false,
  2414. alt: false,
  2415. shift: false
  2416. });
  2417. menu._clearAndHide();
  2418. if(document.getElementById("mbwzbj")!=null){ //该文字部件可能不存在
  2419. menu.dqlm=menu.itemPull[menu.idPrefix + id]["title"]; //改变当前栏目
  2420. //document.getElementById("mbwzbj").innerHTML=this.itemPull[this.idPrefix + id]["title"]; //系统菜单下项目
  2421. }
  2422. if (menu._isContextMenuVisible() && menu.contextAutoHide) menu._hideContextMenu();
  2423. menu.callEvent("onClick", ["shortcutMenu", false, casState]);
  2424. */
  2425. //
  2426. // var bjsy = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsy');
  2427. // if (bjsy != null && (bjsy.style.display == '' || bjsy.style.display == 'none'))
  2428. // bjsy.style.display = 'inline';
  2429. //
  2430. // var bjsymb = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsymb');
  2431. // if (bjsymb != null && (bjsymb.style.display == '' || bjsymb.style.display == 'none'))
  2432. // bjsymb.style.display = 'inline';
  2433. if (wd.topWindow.userEditButton_official) {
  2434. wd.topWindow.userEditButton_official.style.display = "inline"
  2435. }
  2436. if (wd.topWindow.userEditButton_personal) {
  2437. wd.topWindow.userEditButton_personal.style.display = "inline"
  2438. }
  2439. //自动调整win2的iframe大小
  2440. if (wd.topWindow.wd.base.refreshApplyIframeHeight) {
  2441. wd.topWindow.wd.base.refreshApplyIframeHeight();
  2442. }
  2443. if (wd.topWindow.wdHelpIcon)
  2444. wd.topWindow.wdHelpIcon.style.display = "none";
  2445. }
  2446. /**
  2447. 异步提交,试用 06-06 by david
  2448. config: {
  2449. param: {},
  2450. async: boolean,
  2451. contentType: string, 默认为application/x-www-form-urlencoded
  2452. dataType: string 默认为json
  2453. }
  2454. callback: success回调
  2455. error: error回调
  2456. **/
  2457. wd.display.ajaxSubmit = function (url, config, callback, error) {
  2458. var xhr = getXmlHttpRequest();
  2459. var callback = undefined == callback ? function () { }
  2460. :
  2461. callback;
  2462. var error = undefined == error ? function (err) {
  2463. console.log(err);
  2464. }
  2465. :
  2466. error;
  2467. var async;
  2468. var method;
  2469. var contentType;
  2470. var dataType; //xmlhttprequest设置datatype
  2471. if (undefined == config.async || config.async == true)
  2472. async = true;
  2473. else if (config.async == 'false')
  2474. async = false;
  2475. method = config.method;
  2476. if (method.toLocaleLowerCase() == 'get') {
  2477. url += '&'; //一般都带token参数
  2478. url += params(config.param);
  2479. }
  2480. if (undefined == config.contentType)
  2481. contentType = 'application/x-www-form-urlencoded';
  2482. else
  2483. contentType = config.contentType;
  2484. if (undefined == config.dataType)
  2485. dataType = 'json';
  2486. else
  2487. dataType = config.dataType;
  2488. xhr.responseType = dataType;
  2489. xhr.open(method, url, async);
  2490. xhr.setRequestHeader("Content-Type", contentType);
  2491. xhr.onreadystatechange = function () {
  2492. switch (xhr.readyState) {
  2493. case 1:
  2494. break;
  2495. case 2:
  2496. break;
  2497. case 3:
  2498. break;
  2499. case 4:
  2500. if (xhr.status == 200) {
  2501. /* var result = xhr.response;
  2502. if(window.JSON){
  2503. result = JSON.parse(result);
  2504. }else{
  2505. result = eval("(" + result + ")");
  2506. }
  2507. callback(result); */
  2508. callback(xhr.response);
  2509. } else {
  2510. error(xhr.response);
  2511. }
  2512. break;
  2513. }
  2514. };
  2515. if (method.toLocaleLowerCase() == 'get')
  2516. xhr.send();
  2517. else
  2518. xhr.send(params(config.param));
  2519. function params(data) {
  2520. var arr = [];
  2521. for (var i in data) {
  2522. arr.push(encodeURIComponent(i) + "=" + encodeURIComponent(data[i]));
  2523. }
  2524. return arr.join("&");
  2525. }
  2526. function getXmlHttpRequest() {
  2527. var xmlHttpRequest = null;
  2528. if ((typeof XMLHttpRequest) != 'undefined') {
  2529. xmlHttpRequest = new XMLHttpRequest();
  2530. } else {
  2531. xmlHttpRequest = new ActiveXObject('Microsoft.XMLHttp');
  2532. }
  2533. return xmlHttpRequest;
  2534. }
  2535. }
  2536. //表格批示使用,url带有单元格序号‘bgbj_xh’>0时全屏
  2537. wd.display.JumpTest = function (params) {
  2538. function FindParam(url, name) {
  2539. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  2540. var r = url.substr(1).match(reg);
  2541. if (r != null)
  2542. return unescape(r[2]);
  2543. return null;
  2544. }
  2545. /**
  2546. function openScreenLayer(src) {
  2547. var topbody = $("body", wd.topWindow.document);
  2548. var wdfs = topbody.find("#wdfullscreen"); //弹层的div
  2549. if(wdfs.length < 1) {
  2550. topbody.append("<div id='wdfullscreen' style='display:none;top:-10;'></div>");
  2551. wdfs = topbody.find("#wdfullscreen");
  2552. }
  2553. wdfs.html("");
  2554. wdfs.append("<link rel='stylesheet' type='text/css' id='uefullscreenstyle' href='/wd/js/ueditor/ueFull.css'>").show()
  2555. wdfs.append('<div class="uefullscreen"><input type="button" style="z-index: 999999999;position: absolute;top:10px;right:10px" class="btn-list fulscrbtn fullButton" value="" state="1" /><div class="fullscreen fullscreenSrc" style="overflow:auto;-webkit-overflow-scrolling:touch!important;" ></div></div>');
  2556. wdfs.find(".fullscreen").html('<iframe id="myIframe" src="' + src + '" style="width:100%;height:100%;position: absolute;top: 0;left: 0;right: 0;bottom: 0;margin: auto;border: 1px solid #e4e4e4;overflow:auto;-webkit-overflow-scrolling:touch!important;"></iframe>');
  2557. wdfs.find(".fulscrbtn").click(function(e) {
  2558. wdfs.remove();
  2559. });
  2560. }
  2561. **/
  2562. /****/
  2563. function openScreenLayer(src) {
  2564. var topbody = $("body", wd.topWindow.document);
  2565. var wdfs = topbody.find("#wdfullscreen"); //弹层的div
  2566. if (wdfs.length < 1) {
  2567. topbody.append("<div id='wdfullscreen' style='display:none;width:100%;height:100%;margin:0;'></div>");
  2568. wdfs = topbody.find("#wdfullscreen");
  2569. }
  2570. wdfs.html("");
  2571. wdfs.append("<link rel='stylesheet' type='text/css' id='uefullscreenstyle' href='/wd/js/ueditor/ueFull.css'>").show()
  2572. wdfs.append(
  2573. '<div class="uefullscreen" style="height:100%;margin:0;"><input type="button" style="z-index: 999999999;position: absolute;top:10px;right:14px" class="btn-list fulscrbtn fullButton" value="" state="1" /><div class="fullscreen fullscreenSrc" style="width:100%;height:1100px;-webkit-overflow-scrolling:touch; overflow:scroll;"></div></div>');
  2574. wdfs.find(".fullscreen").html('<iframe id="myIframe" src="' + src + '" style="width:100%;height:96%;"></iframe>');
  2575. wdfs.find(".fulscrbtn").click(function (e) {
  2576. wdfs.remove();
  2577. });
  2578. }
  2579. var a = parseInt(FindParam(params.url, "bgbj_xh"))
  2580. if (a && a > 0) {
  2581. // openScreenLayer(params.url);
  2582. params.show = "wdFullScreen";
  2583. params.width = wd.topWindow.document.body.offsetWidth;
  2584. wd.display.showComponent(params);
  2585. } else {
  2586. wd.display.showComponent(params);
  2587. }
  2588. }
  2589. //使参数指定的滚动图片全屏
  2590. wd.display.fullgdtpScreen = function (element, bjid) {
  2591. // console.log(element);
  2592. // wd.display.CmsZNRFull(element);
  2593. $("#ydfull" + bjid).css('display', '-webkit-flex');
  2594. var index_img = 0;
  2595. var lastindex_img = 0;
  2596. var full_src;
  2597. full_src = $(element).children("img")[0].src;
  2598. // console.log(full_src);
  2599. $("#imgfull" + bjid).attr("src", full_src);
  2600. var items = $("#list" + bjid).find(".ydimg_item");
  2601. if (items != undefined && items.length != 0) {
  2602. lastindex_img = items.length - 1;
  2603. for (var ii = 0; ii < items.length; ii++) {
  2604. if ($(element).children("img")[0] == $(items[ii]).children("img")[0]) {
  2605. index_img = ii;
  2606. }
  2607. }
  2608. }
  2609. var marioVideo = $("#ydfull" + bjid)[0];
  2610. // wd.display.CmsZNRFull(element);
  2611. var fullscreenchange = function () {
  2612. if (document.webkitFullscreenElement != null) {
  2613. // element.style.width = "100%";
  2614. // element.style.height = "100%";
  2615. // element.style.overflowY = 'hidden';
  2616. //console.log("进入全屏函数");
  2617. // $('#mainDiv').append('<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="dhtmlx_wins_btns" style="position:fixed;right:0px;"><div class="dhtmlx_wins_btns_button dhtmlx_button_close_default" onclick="wd.display.exitFullScreen()" title="Close"></div></div></div></div>');
  2618. } else {
  2619. //console.log("退出全屏函数");
  2620. $("#ydfull" + bjid).hide();
  2621. //添加监听器,监听用户进入全屏和退出全屏操作
  2622. marioVideo.removeEventListener("webkitfullscreenchange", fullscreenchange);
  2623. marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
  2624. marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
  2625. marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
  2626. }
  2627. }
  2628. // 判断各种浏览器,找到正确的方法
  2629. var elem = marioVideo;
  2630. elem.onmousemove = function (e) {
  2631. // console.log(e.offsetY);
  2632. e = e || window.event;
  2633. var newY = e.screenY;
  2634. //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
  2635. if (newY < (window.screen.height / 3) && index_img != 0) {
  2636. elem.style.cursor = "url(\"./wd/image/top.cur\"),default"; //上1/3区域
  2637. } else if (newY > (window.screen.height / 3 * 2) && index_img != lastindex_img) {
  2638. elem.style.cursor = "url(\"./wd/image/bottom.cur\"),default"; //下1/3区域
  2639. } else {
  2640. elem.style.cursor = "default"; //中1/3区域
  2641. }
  2642. }
  2643. elem.onclick = function (e) {
  2644. e = e || window.event;
  2645. var newY = e.screenY;
  2646. //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
  2647. if (newY < (window.screen.height / 3) && index_img != 0) { //上一张
  2648. index_img = index_img - 1;
  2649. if (items != undefined && items.length != 0) {
  2650. for (var ii = 0; ii < items.length; ii++) {
  2651. $(items[ii]).removeClass('selected');
  2652. }
  2653. full_src = $(items[index_img]).children("img")[0].src;
  2654. $("#imgfull" + bjid).attr("src", full_src);
  2655. $(items[index_img]).addClass('selected');
  2656. $("#img" + bjid).attr("src", full_src);
  2657. $("#bt" + bjid).html($(items[index_img]).children("img").eq(0).attr("alt"));
  2658. }
  2659. } else if (newY > (window.screen.height / 3 * 2) && index_img != lastindex_img) { //下一张
  2660. index_img = index_img + 1;
  2661. if (items != undefined && items.length != 0) {
  2662. for (var ii = 0; ii < items.length; ii++) {
  2663. $(items[ii]).removeClass('selected');
  2664. }
  2665. full_src = $(items[index_img]).children("img")[0].src;
  2666. $("#imgfull" + bjid).attr("src", full_src);
  2667. $(items[index_img]).addClass('selected');
  2668. $("#img" + bjid).attr("src", full_src);
  2669. $("#bt" + bjid).html($(items[index_img]).children("img").eq(0).attr("alt"));
  2670. }
  2671. } else { //关闭
  2672. wd.display.exitFullScreen();
  2673. }
  2674. }
  2675. marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
  2676. marioVideo.addEventListener("fullscreenchange", fullscreenchange);
  2677. marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
  2678. marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
  2679. if (marioVideo.requestFullscreen) {
  2680. marioVideo.requestFullscreen(elem);
  2681. } else if (marioVideo.msRequestFullscreen) {
  2682. marioVideo.msRequestFullscreen(elem);
  2683. } else if (marioVideo.mozRequestFullScreen) {
  2684. marioVideo.mozRequestFullScreen(elem);
  2685. } else if (marioVideo.webkitRequestFullScreen) {
  2686. marioVideo.webkitRequestFullScreen(elem);
  2687. }
  2688. }
  2689. wd.display.fullsltScreen = function (bjid) {
  2690. $("#sltfull" + bjid).css('display', '-webkit-flex');
  2691. var index_img = 0;
  2692. var lastindex_img = 0;
  2693. var full_src;
  2694. var items_selected = $("#list" + bjid).find(".slximg_box.selected");
  2695. if (items_selected != undefined && items_selected.length != 0) {
  2696. for (var ii = 0; ii < items_selected.length; ii++) {
  2697. full_src = $(items_selected[ii]).find("img")[0].src;
  2698. // console.log(full_src);
  2699. $("#imgfull" + bjid).attr("src", full_src);
  2700. }
  2701. }
  2702. var items = $("#list" + bjid).find(".slximg_item");
  2703. if (items != undefined && items.length != 0) {
  2704. lastindex_img = items.length - 1;
  2705. for (var ii = 0; ii < items.length; ii++) {
  2706. if ($(items_selected[0]).find("img")[0] == $(items[ii]).find("img")[0]) {
  2707. index_img = ii;
  2708. }
  2709. }
  2710. }
  2711. var marioVideo = $("#sltfull" + bjid)[0];
  2712. // wd.display.CmsZNRFull(element);
  2713. var fullscreenchange = function () {
  2714. if (document.webkitFullscreenElement != null) {
  2715. // element.style.width = "100%";
  2716. // element.style.height = "100%";
  2717. // element.style.overflowY = 'hidden';
  2718. //console.log("进入全屏函数");
  2719. // $('#mainDiv').append('<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="dhtmlx_wins_btns" style="position:fixed;right:0px;"><div class="dhtmlx_wins_btns_button dhtmlx_button_close_default" onclick="wd.display.exitFullScreen()" title="Close"></div></div></div></div>');
  2720. } else {
  2721. //console.log("退出全屏函数");
  2722. $("#sltfull" + bjid).hide();
  2723. //添加监听器,监听用户进入全屏和退出全屏操作
  2724. marioVideo.removeEventListener("webkitfullscreenchange", fullscreenchange);
  2725. marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
  2726. marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
  2727. marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
  2728. }
  2729. }
  2730. // 判断各种浏览器,找到正确的方法
  2731. var elem = marioVideo;
  2732. elem.onmousemove = function (e) {
  2733. // console.log(e.offsetY);
  2734. e = e || window.event;
  2735. var newY = e.screenY;
  2736. //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
  2737. if (newY < (window.screen.height / 3) && index_img != 0) {
  2738. elem.style.cursor = "url(" + wd.common.loadFile("theme/meow/image/top.cur") + "),default"; //上1/3区域
  2739. } else if (newY > (window.screen.height / 3 * 2) && index_img != lastindex_img) {
  2740. elem.style.cursor = "url(" + wd.common.loadFile("theme/meow/image/bottom.cur") + "),default"; //下1/3区域
  2741. } else {
  2742. elem.style.cursor = "default"; //中1/3区域
  2743. }
  2744. }
  2745. elem.onclick = function (e) {
  2746. e = e || window.event;
  2747. var newY = e.screenY;
  2748. //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
  2749. if (newY < (window.screen.height / 3) && index_img != 0) { //上一张
  2750. index_img = index_img - 1;
  2751. if (items != undefined && items.length != 0) {
  2752. for (var ii = 0; ii < items.length; ii++) {
  2753. $(items[ii]).removeClass('selected');
  2754. }
  2755. full_src = $(items[index_img]).find("img")[0].src;
  2756. $("#imgfull" + bjid).attr("src", full_src);
  2757. $(items[index_img]).addClass('selected');
  2758. $("#img" + bjid).attr("src", full_src);
  2759. $("#bt" + bjid).html($(items[index_img]).find("img").eq(0).attr("alt"));
  2760. }
  2761. } else if (newY > (window.screen.height / 3 * 2) && index_img != lastindex_img) { //下一张
  2762. index_img = index_img + 1;
  2763. if (items != undefined && items.length != 0) {
  2764. for (var ii = 0; ii < items.length; ii++) {
  2765. $(items[ii]).removeClass('selected');
  2766. }
  2767. full_src = $(items[index_img]).find("img")[0].src;
  2768. $("#imgfull" + bjid).attr("src", full_src);
  2769. $(items[index_img]).addClass('selected');
  2770. $("#img" + bjid).attr("src", full_src);
  2771. $("#bt" + bjid).html($(items[index_img]).find("img").eq(0).attr("alt"));
  2772. }
  2773. } else { //关闭
  2774. wd.display.exitFullScreen();
  2775. }
  2776. }
  2777. marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
  2778. marioVideo.addEventListener("fullscreenchange", fullscreenchange);
  2779. marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
  2780. marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
  2781. if (marioVideo.requestFullscreen) {
  2782. marioVideo.requestFullscreen(elem);
  2783. } else if (marioVideo.msRequestFullscreen) {
  2784. marioVideo.msRequestFullscreen(elem);
  2785. } else if (marioVideo.mozRequestFullScreen) {
  2786. marioVideo.mozRequestFullScreen(elem);
  2787. } else if (marioVideo.webkitRequestFullScreen) {
  2788. marioVideo.webkitRequestFullScreen(elem);
  2789. }
  2790. }
  2791. //使参数指定的DOM元素全屏,如果不传参数则默认带个页面全屏
  2792. wd.display.fullScreen = function (element) {
  2793. element.sdasdasds = playlist;
  2794. // 判断各种浏览器,找到正确的方法
  2795. var requestMethod = element.requestFullScreen || //W3C
  2796. element.webkitRequestFullScreen || //Chrome等
  2797. element.mozRequestFullScreen || //FireFox
  2798. element.msRequestFullScreen; //IE11
  2799. if (requestMethod) {
  2800. requestMethod.call(element);
  2801. } else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
  2802. var wscript = new ActiveXObject("WScript.Shell");
  2803. if (wscript !== null) {
  2804. alert("f11");
  2805. wscript.SendKeys("{F11}");
  2806. }
  2807. }
  2808. }
  2809. //从全屏状态切换为普通状态
  2810. wd.display.exitFullScreen = function () {
  2811. // 判断各种浏览器,找到正确的方法
  2812. var exitMethod = document.exitFullscreen || //W3C
  2813. document.mozCancelFullScreen || //Chrome等
  2814. document.webkitExitFullscreen || //FireFox
  2815. document.webkitExitFullscreen; //IE11
  2816. if (exitMethod) {
  2817. exitMethod.call(document);
  2818. } else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
  2819. var wscript = new ActiveXObject("WScript.Shell");
  2820. if (wscript !== null) {
  2821. wscript.SendKeys("{F11}");
  2822. }
  2823. }
  2824. }
  2825. wd.display.CmsZNRFull = function (element) {
  2826. //目前对图片,视频,pdf,word,flash,全屏下特殊处理
  2827. var IMG_TYPE = "IMG";
  2828. var VIDEO_TYPE = "VIDEO";
  2829. var PDF_TYPE = "PDF";
  2830. var WORD_TYPE = "WORD";
  2831. var FLASH_TYPE = "FLASH";
  2832. var XLS_TYPE = "XLS";
  2833. var PPT_TYPE = "PPT";
  2834. function nrjsblmType(nrjslbm) {
  2835. var group = {
  2836. "300": IMG_TYPE,
  2837. "310": IMG_TYPE,
  2838. "320": IMG_TYPE,
  2839. "330": IMG_TYPE,
  2840. "340": IMG_TYPE,
  2841. "500": VIDEO_TYPE,
  2842. "510": VIDEO_TYPE,
  2843. "520": VIDEO_TYPE,
  2844. "1010": PDF_TYPE,
  2845. "810": PPT_TYPE,
  2846. "910": WORD_TYPE,
  2847. "1110": XLS_TYPE,
  2848. "710": FLASH_TYPE
  2849. }
  2850. return group[nrjslbm];
  2851. }
  2852. var width; //定义宽度与高度
  2853. var height;
  2854. var dataList = [];
  2855. //查找出当前所有的所有播放器
  2856. var playlist = element.querySelectorAll("[data-init]");
  2857. console.log("555:" + playlist.length);
  2858. // var nrid = null;
  2859. for (var i = 0; i < playlist.length; i++) {
  2860. var playDiv = playlist[i];
  2861. var nrJson = JSON.parse(playDiv.getAttribute("data-init"));
  2862. // console.log(nrJson);
  2863. // nrid = nrJson.resDesign.ID;
  2864. var nrjslbm = nrJson.resDesign.nrjslbm;
  2865. var TYPE = nrjsblmType(nrjslbm);
  2866. if (!TYPE)
  2867. continue;
  2868. // console.log("666:" + TYPE);
  2869. var exitFunction = null; //退出全屏回调方法
  2870. var data = {
  2871. "type": TYPE,
  2872. "nrjslbm": nrjslbm,
  2873. }
  2874. // console.log(TYPE);
  2875. if (TYPE == IMG_TYPE) {
  2876. var handle = playDiv.querySelector(".img");
  2877. width = handle.naturalWidth;
  2878. height = handle.naturalHeight;
  2879. //退出全屏用到的数据缓存
  2880. data.handle = handle;
  2881. data.width = handle.style.width;
  2882. data.height = handle.style.height;
  2883. data.exitFunction = function (data) {
  2884. // console.log(data)
  2885. data.handle.style.width = data.width;
  2886. data.handle.style.height = data.height;
  2887. }
  2888. var zzz = wd.display.CmscalZoomSize(width, height);
  2889. handle.style.width = zzz.width + "px";
  2890. handle.style.height = zzz.height + "px";
  2891. // console.log(handle.style.width)
  2892. // console.log(handle.style.height)
  2893. } else if (TYPE == VIDEO_TYPE) {
  2894. var handle = playDiv.querySelector(".video");
  2895. var handleparent = playDiv.querySelector(".videoparent");
  2896. width = handle.videoWidth;
  2897. height = handle.videoHeight;
  2898. //退出全屏还原
  2899. data.handleparent = handleparent;
  2900. data.width = handleparent.style.width;
  2901. data.height = handleparent.style.height;
  2902. data.exitFunction = function (data) {
  2903. // console.log(data)
  2904. data.handleparent.style.width = data.width;
  2905. data.handleparent.style.height = data.height;
  2906. }
  2907. var zzz = wd.display.CmscalZoomSize(width, height);
  2908. handleparent.style.width = zzz.width + "px";
  2909. handleparent.style.height = zzz.height + "px";
  2910. } else if (TYPE == PDF_TYPE || TYPE == WORD_TYPE || TYPE == XLS_TYPE) {
  2911. var handle = playDiv.querySelector(".show");
  2912. var son1 = handle.querySelector("#pf1");
  2913. if (son1 == null)
  2914. return;
  2915. width = son1.clientWidth;
  2916. height = son1.clientHeight;
  2917. var zzz = wd.display.CmscalZoomSize(width, height);
  2918. data.handle = handle;
  2919. data.overflow = handle.style.overflow;
  2920. data.zoom = handle.style.zoom;
  2921. //特殊处理excel背景颜色变黑色
  2922. if(TYPE == XLS_TYPE){
  2923. playDiv.style.background = "white";
  2924. }
  2925. data.exitFunction = function (data) {
  2926. if (zzz.zoom != null) {
  2927. element.scrollTop = element.scrollTop / zzz.zoom;
  2928. }
  2929. // console.log(data)
  2930. data.handle.style.zoom = data.zoom;
  2931. data.handle.style.overflow = data.overflow;
  2932. if(data.type == XLS_TYPE){
  2933. data.handle.style.background = "";
  2934. }
  2935. }
  2936. handle.style.zoom = zzz.zoom;
  2937. element.scrollTop = element.scrollTop * zzz.zoom;
  2938. } else if (TYPE == FLASH_TYPE) {
  2939. var handle = playDiv.querySelector("#embed");
  2940. //退出全屏方法
  2941. data.handle = handle;
  2942. data.width = handle.style.width;
  2943. data.height = handle.style.height;
  2944. data.exitFunction = function (data) {
  2945. // console.log(data)
  2946. data.handle.style.width = $("#mainDiv").innerWidth();
  2947. data.handle.style.height = $("#mainDiv").innerHeight();
  2948. }
  2949. var zzz = wd.display.CmscalZoomSize();
  2950. handle.style.width = zzz.maxWidth + 'px';
  2951. handle.style.height = zzz.maxHeight + 'px';
  2952. }
  2953. dataList.push(data);
  2954. playlist[i].dataList = dataList;
  2955. }
  2956. }
  2957. /**
  2958. *
  2959. * 计算放大后width,height,zoom
  2960. * @param {Object} w
  2961. * @param {Object} h
  2962. */
  2963. wd.display.CmscalZoomSize = function (w, h) {
  2964. var maxWidth = screen.availWidth - 1;
  2965. var maxHeight = screen.availHeight - 1; //获取页面的高度与宽度
  2966. var xswidth = w;
  2967. var xsheight = h;
  2968. if (w && h) {
  2969. //显示的高度与宽度
  2970. var ratio1 = w / maxWidth;
  2971. var ratio2 = h / maxHeight;
  2972. //根据长度与宽度获取缩放比例
  2973. if (ratio1 > 1 || ratio2 > 1) {
  2974. if (ratio1 > ratio2) { //选取较大的缩放比例
  2975. xswidth = w / ratio1;
  2976. xsheight = h / ratio1;
  2977. } else {
  2978. xswidth = w / ratio2;
  2979. xsheight = h / ratio2;
  2980. }
  2981. }
  2982. }
  2983. if (w) {
  2984. var zoom = maxWidth / w;
  2985. if (zoom >= 2) { //确定zoom 用于word与pdf放缩
  2986. zoom = 2;
  2987. }
  2988. }
  2989. return {
  2990. width: xswidth,
  2991. height: xsheight,
  2992. zoom: zoom,
  2993. maxWidth: maxWidth,
  2994. maxHeight: maxHeight
  2995. }
  2996. }
  2997. wd.display.CmsFullDiv = function (element, onFullscreen, onExitfullscreen, win) {
  2998. win = win || element.ownerDocument.defaultView;
  2999. // var video,photo,pdf,word,flash;
  3000. // console.log(element);
  3001. var marioVideo = element;
  3002. var fullscreenchange = function () {
  3003. if (win.document.webkitFullscreenElement != null) {
  3004. //$(element).addClass("scrollbar");
  3005. // $(element).css("padding","25px");
  3006. // $(element).css("box-sizing","border-box");
  3007. // element.style.overflowY = "auto";
  3008. // element.style.overflowX = "hidden";
  3009. // element.style.width = "100%";
  3010. // element.style.height = "100%";
  3011. // console.log("进入全屏函数");
  3012. // element.setAttribute("isCmsFullScreen", 'true');
  3013. win.$(element).append(
  3014. '<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="icon-restore" style="position: fixed;right: 10px;top: 10px;height:22px;width:22px;" onclick="wd.display.exitFullScreen()" ></div></div></div>');
  3015. onFullscreen && onFullscreen()
  3016. } else {
  3017. // console.log("退出全屏函数");
  3018. win.$(element).find('#pageClose').remove();
  3019. //$(element).removeClass("scrollbar");
  3020. // $(element).css("padding","0px");
  3021. // $(element).css("box-sizing","border-box");
  3022. // element.style.height = 'auto';
  3023. // element.style.width = 'auto';
  3024. // element.setAttribute("isCmsFullScreen", 'false');
  3025. // element.style.overflowY = 'auto';
  3026. // element.style.height = '100%';
  3027. // element.style.width = '750px';
  3028. //添加监听器,监听用户进入全屏和退出全屏操作
  3029. marioVideo.removeEventListener("webkitfullscreenchange", fullscreenchange);
  3030. marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
  3031. marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
  3032. marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
  3033. onExitfullscreen && onExitfullscreen()
  3034. }
  3035. }
  3036. var elem = marioVideo;
  3037. marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
  3038. marioVideo.addEventListener("fullscreenchange", fullscreenchange);
  3039. marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
  3040. marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
  3041. if (marioVideo.requestFullscreen) {
  3042. marioVideo.requestFullscreen(elem);
  3043. } else if (marioVideo.msRequestFullscreen) {
  3044. marioVideo.msRequestFullscreen(elem);
  3045. } else if (marioVideo.mozRequestFullScreen) {
  3046. marioVideo.mozRequestFullScreen(elem);
  3047. } else if (marioVideo.webkitRequestFullScreen) {
  3048. marioVideo.webkitRequestFullScreen(elem);
  3049. }
  3050. }
  3051. wd.display.CmsFullScreen = function (element, onFullscreen, onExitfullscreen, win) {
  3052. win = win || element.ownerDocument.defaultView;
  3053. // var video,photo,pdf,word,flash;
  3054. // console.log(element);
  3055. var marioVideo = element;
  3056. try {
  3057. win.wd.display.CmsZNRFull(element);
  3058. } catch (e) { }
  3059. var fullscreenchange = function () {
  3060. if (win.document.webkitFullscreenElement != null) {
  3061. //$(element).addClass("scrollbar");
  3062. // $(element).css("padding","25px");
  3063. // $(element).css("box-sizing","border-box");
  3064. element.style.overflowY = "auto";
  3065. element.style.overflowX = "hidden";
  3066. element.style.width = "100%";
  3067. element.style.height = "100%";
  3068. // console.log("进入全屏函数");
  3069. element.setAttribute("isCmsFullScreen", 'true');
  3070. win.$(element).append(
  3071. '<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="largeIcon-restore" style="position: fixed;right: 10px;top: 10px;" onclick="wd.display.exitFullScreen()" ></div></div></div>');
  3072. onFullscreen && onFullscreen()
  3073. } else {
  3074. // console.log("退出全屏函数");
  3075. win.$(element).find('#pageClose').remove();
  3076. //$(element).removeClass("scrollbar");
  3077. // $(element).css("padding","0px");
  3078. // $(element).css("box-sizing","border-box");
  3079. // element.style.height = 'auto';
  3080. // element.style.width = 'auto';
  3081. element.setAttribute("isCmsFullScreen", 'false');
  3082. // element.style.overflowY = 'auto';
  3083. element.style.height = '100%';
  3084. element.style.width = '750px';
  3085. //回调退出全屏方法
  3086. var playlist = element.querySelectorAll("[data-init]");
  3087. for (var i = 0; i < playlist.length; i++) {
  3088. dataList = playlist[i].dataList;
  3089. for (var j = 0; dataList != null && j < dataList.length; j++) {
  3090. var data = dataList[j];
  3091. if (data.exitFunction) {
  3092. data.exitFunction.call(this, data);
  3093. }
  3094. }
  3095. delete playlist[i].dataList;
  3096. }
  3097. //添加监听器,监听用户进入全屏和退出全屏操作
  3098. marioVideo.removeEventListener("webkitfullscreenchange", fullscreenchange);
  3099. marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
  3100. marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
  3101. marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
  3102. onExitfullscreen && onExitfullscreen()
  3103. }
  3104. }
  3105. var elem = marioVideo;
  3106. marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
  3107. marioVideo.addEventListener("fullscreenchange", fullscreenchange);
  3108. marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
  3109. marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
  3110. if (marioVideo.requestFullscreen) {
  3111. marioVideo.requestFullscreen(elem);
  3112. } else if (marioVideo.msRequestFullscreen) {
  3113. marioVideo.msRequestFullscreen(elem);
  3114. } else if (marioVideo.mozRequestFullScreen) {
  3115. marioVideo.mozRequestFullScreen(elem);
  3116. } else if (marioVideo.webkitRequestFullScreen) {
  3117. marioVideo.webkitRequestFullScreen(elem);
  3118. }
  3119. }
  3120. //附件滑动和上下项
  3121. wd.display.CmsNrscroll = function (element, currSubNrid) {
  3122. var ismousedown = false;
  3123. var oldY,
  3124. scollY;
  3125. var nrid = currSubNrid;
  3126. element.onmousedown = function (e) {
  3127. oldscrollTop = element.scrollTop;
  3128. oldY = e.screenY;
  3129. scollY = element.scrollTop;
  3130. ismousedown = true;
  3131. }
  3132. element.onmouseup = function (e) {
  3133. ismousedown = false;
  3134. }
  3135. element.onmousemove = function (e) {
  3136. // console.log(e.offsetY);
  3137. e = e || window.event;
  3138. var newY = e.screenY;
  3139. //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
  3140. if (ismousedown) {
  3141. //console.log(element.scrollTop + element.clientHeight+"###"+element.scrollHeight)
  3142. if (oldY - newY >= 150 && element.scrollTop + element.clientHeight + 1 >= element.scrollHeight && oldscrollTop +
  3143. element.clientHeight + 1 >= element.scrollHeight) {
  3144. ismousedown = false;
  3145. // console.log("鼠标向上移动");
  3146. nrid = nextitem(nrid);
  3147. // console.log(element.getAttribute("isCmsFullScreen"));
  3148. } else if (newY - oldY >= 150 && element.scrollTop <= 0 && oldscrollTop == 0) {
  3149. ismousedown = false;
  3150. // console.log("鼠标向下移动");
  3151. nrid = lastitem(nrid);
  3152. // console.log(element.getAttribute("isCmsFullScreen"));
  3153. } else {
  3154. element.scrollTop = scollY + (oldY - e.screenY); //此处调节滚动速度
  3155. }
  3156. }
  3157. }
  3158. function nextitem(nrid) {
  3159. var items = $(".dragList").find(".item");
  3160. var i = 0;
  3161. var result = nrid;
  3162. items.each(function () {
  3163. if (nrid == $(items[i]).find(".nrid").text()) {
  3164. if (i < items.length - 1) {
  3165. // $(items[i])[0].style.border = "solid 1px #CCCCCC";//全部边框变黑 20170929
  3166. // $(items[i + 1])[0].style.border = "2px solid #FF0000";//点击变红 20170929
  3167. selectItem($(items[i + 1])[0]);
  3168. loadPlayer($(items[i + 1]).find(".nrid").text(), $(items[i + 1]).find(".nrjslbm").text());
  3169. result = $(items[i + 1]).find(".nrid").text();
  3170. }
  3171. return false; //跳出循环
  3172. } else {
  3173. i++;
  3174. }
  3175. });
  3176. return result;
  3177. }
  3178. function lastitem(nrid) {
  3179. var items = $(".dragList").find(".item");
  3180. var i = 0;
  3181. var result = nrid;
  3182. items.each(function () {
  3183. if (nrid == $(items[i]).find(".nrid").text()) {
  3184. if (i > 0) {
  3185. // $(items[i])[0].style.border = "solid 1px #CCCCCC";//全部边框变黑 20170929
  3186. // $(items[i - 1])[0].style.border = "2px solid #FF0000";//点击变红 20170929
  3187. selectItem($(items[i - 1])[0]);
  3188. loadPlayer($(items[i - 1]).find(".nrid").text(), $(items[i - 1]).find(".nrjslbm").text());
  3189. //$(items[i - 1])[0].scrollTop( $(items[i - 1])[0].scrollHeight );
  3190. result = $(items[i - 1]).find(".nrid").text();
  3191. }
  3192. return false; //跳出循环
  3193. } else {
  3194. i++;
  3195. }
  3196. });
  3197. return result;
  3198. }
  3199. }
  3200. /**
  3201. * 退出登录
  3202. */
  3203. wd.display.exit = function (param) {
  3204. // console.log("exit")
  3205. wd.display.showLoad();
  3206. var beaconLogin = wd.display.beaconLogin("loginOut") || wd.display.getBeaconWhetherToOpen();
  3207. param=param||{};
  3208. var homepage=(1==param.homepage)?("&homepage="+param.homepage):"";
  3209. var urlparam=""+homepage;
  3210. /* 改。Lin
  3211. $.post("/service?wdApplication=wd&wdService=ss.exitByA&wdtest=false", {}, function (result) {
  3212. */
  3213. /* 再改,规范命名。Lin
  3214. * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
  3215. * &wdService= 改为 ssServ
  3216. $.post("/service?wdApplication=wd&wdService=exit", {}, function (result) {
  3217. */ $.post("/service?ssServ=ssExit", {}, function (result) { // =exit"。Lin
  3218. var newurl=result.path+(result.path.indexOf("?")==-1?"?":"")+urlparam;
  3219. if (beaconLogin) {
  3220. setTimeout(function () {
  3221. wd.topWindow.location.href =newurl ;
  3222. }, 1000);
  3223. } else {
  3224. wd.topWindow.location.href = newurl;
  3225. }
  3226. }, "json")
  3227. }
  3228. /**
  3229. * 执行当前弹窗的wdfitheight调整事件
  3230. */
  3231. wd.display.initWdFitHeight = function (windowobj) {
  3232. var dialogid = wd.display.getwdDialogId();
  3233. if (!dialogid)
  3234. return;
  3235. //弹窗对象
  3236. var win = wd.topWindow.dhxWins.window(dialogid);
  3237. if (!win)
  3238. return;
  3239. var nextiframe = win.getFrame();
  3240. var count = 0;
  3241. while (nextiframe != null) {
  3242. if (count > 10)
  3243. break; // 最多查找10层iframe,防止死循环
  3244. count++;
  3245. //执行页面所在的初始化iframe事件
  3246. if (nextiframe.contentWindow.window.initWdFitHeightFunction) {
  3247. if (nextiframe.contentWindow.window != windowobj) {
  3248. nextiframe.contentWindow.window.initWdFitHeightFunction();
  3249. }
  3250. }
  3251. // console.log(nextiframe)
  3252. nextiframe = nextiframe.contentWindow.document.querySelector("iframe[src]");
  3253. }
  3254. }
  3255. /**
  3256. *
  3257. */
  3258. wd.display.submitToTopTab = function (submitBtn) {
  3259. if (!submitBtn)
  3260. console.error("请指定submit按钮");
  3261. var myform = submitBtn.form.cloneNode(true);
  3262. myform.style.display = "none";
  3263. submitBtn.form.parentNode.innerHTML = "";
  3264. var win = window,
  3265. topFrame = wd.display.getFrameOfWindow(win);
  3266. while (topFrame.tabObj) { //找到不是tab为止
  3267. win = win.parent;
  3268. topFrame = wd.display.getFrameOfWindow(win);
  3269. }
  3270. topFrame.contentWindow.document.body.appendChild(myform);
  3271. myform.submit();
  3272. // submitBtn.click();
  3273. }
  3274. /**
  3275. * 获取window所在的iframe
  3276. *
  3277. */
  3278. wd.display.getFrameOfWindow = function (win) {
  3279. win = win || window;
  3280. if (win != win.top && win.parent && win.parent.document.querySelectorAll("iframe").length > 0) {
  3281. var pfs = win.parent.document.querySelectorAll("iframe");
  3282. for (var i = 0; i < pfs.length; i++) {
  3283. if (pfs[i].contentWindow == win) {
  3284. return pfs[i];
  3285. }
  3286. }
  3287. console.error("没找到上级window所对应当前window的iframe")
  3288. } else {
  3289. console.warn("当前页面不存在任何iframe底下")
  3290. return null
  3291. }
  3292. }
  3293. /**
  3294. * 刷新当前的tabframe
  3295. */
  3296. wd.display.refreshTabFrame = function (wdTabNo) {
  3297. var frame = wd.display.getFrameOfWindow();
  3298. if (frame) {
  3299. if (frame.tabObj) {
  3300. if (wdTabNo && /[0-9]*/.test(wdTabNo)) {
  3301. // frame.contentWindow.wd.display.wdTabNo=wdTabNo;
  3302. var num = parseInt(wdTabNo);
  3303. frame.tabObj.selectClick(num);
  3304. } else {
  3305. frame.tabObj.selectTab.dom.click();
  3306. }
  3307. } else {
  3308. console.error("当前iframe不是tabFrame");
  3309. }
  3310. }
  3311. }
  3312. wd.display.changeFormAction = function (url, element, width, height, minHeight, maxHeight) {
  3313. var a = $(element).parents("form:first").attr("action", url);
  3314. if (a.length != 1) {
  3315. alert("找不到form元素");
  3316. return false;
  3317. }
  3318. if (a[0].checkOnly) {
  3319. if (!a[0].checkOnly(true)) {
  3320. return
  3321. }
  3322. }
  3323. if (width && height && minHeight && maxHeight) {
  3324. wd.display.resizeComponent(width, height, minHeight, maxHeight);
  3325. }
  3326. return true;
  3327. }
  3328. wd.display.MsgManager = function (timeout, minHeight, minWidth) {
  3329. if (wd.topWindow.popupPanel == null) {
  3330. // 动画小圈圈
  3331. //flashMessageDocument--fmd
  3332. $("body", wd.topWindow.document).append('<div id="fMD" style="position: fixed; display:none; pointer-events:none; z-index: 9999;" class="cursor-loading" /></div>');
  3333. this.element = wd.topWindow.popupPanel = $("<div id=\"flashmsgtipsId\" class=\"flashMsg-div\" style=\"display:none;position:fixed;z-index:999\"><div class='flashMsg-down' style='bottom: -10px;left: 7px'></div></div>");
  3334. $("body", wd.topWindow.document).append(wd.topWindow.popupPanel);
  3335. timeout = timeout || 1300;
  3336. // minHeight = minHeight || "10px";
  3337. // minWidth = minWidth || "70px";
  3338. // this.element[0].className = "flashMsg-div";
  3339. // this.element[0].id = "flashmsgtipsId";
  3340. // $(".flashMsg-div").append("<div class='flashMsg-down' style='bottom: -10px;left: 7px'></div>");
  3341. // this.element.css({
  3342. // display: "none",
  3343. // position: "fixed",
  3344. // // minHeight: minHeight,
  3345. // // minWidth: minWidth,
  3346. // "z-index": "999"
  3347. // });
  3348. this.messages = [];
  3349. var this_ = this;
  3350. setInterval(function () {
  3351. // if (this_.messages.length > 1) {
  3352. // this_.removeMsg(this_.messages.shift());
  3353. // } else if (this_.messages.length == 1) {
  3354. // setTimeout(function () {
  3355. // this_.removeMsg(this_.messages.shift());
  3356. // }, 1700);
  3357. // }
  3358. if (this_.messages.length > 0) {
  3359. var span=this_.messages.shift();
  3360. setTimeout(function () {
  3361. this_.removeMsg(span);
  3362. },span.data("timeout"));
  3363. }
  3364. }, timeout);
  3365. };
  3366. this.removeMsg = function (span) {
  3367. var $span = $(span);
  3368. $span.slideUp("normal", function () {
  3369. $span.trigger("onHide");
  3370. $span.remove();
  3371. });
  3372. this.messages.length == 0 && this.element.fadeOut("fast");
  3373. }
  3374. this.pushMsg = function (msg, options) {
  3375. if (msg == "" || msg == null)
  3376. return;
  3377. var $span = $("<p>");
  3378. $span.text(msg);
  3379. $span.data("timeout",Math.max(300*(msg.length/3),1700));
  3380. $span.bind("onShow", function () {
  3381. options && options.onShow && options.onShow.call(this);
  3382. });
  3383. $span.bind("onHide", function () {
  3384. options && options.onHide && options.onHide.call(this);
  3385. });
  3386. this.messages.push($span);
  3387. this.element.prepend($span).show();
  3388. $span.fadeIn("normal", function () {
  3389. $span.trigger("onShow");
  3390. });
  3391. }
  3392. };
  3393. //开启加载动画
  3394. wd.display.showLoad = function () {
  3395. wd.topWindow.$("#fMD").show();
  3396. }
  3397. //关闭加载动画
  3398. wd.display.closeLoad = function () {
  3399. wd.topWindow.$("#fMD").hide();
  3400. }
  3401. if(!window.flashmsgmousemove){
  3402. window.flashmsgmousemove=1;
  3403. document.addEventListener("mousemove", function () {
  3404. if (wd.topWindow.$("#flashmsgtipsId").is(":visible")) {
  3405. return;
  3406. }
  3407. if (wd.display.isFixation) {
  3408. return;
  3409. }
  3410. // 有弹出窗口且大于 1 时,MSG固定右下角
  3411. if (wd.topWindow.$(".wdMaskDiv").size() > 1) {
  3412. setFixation();
  3413. }
  3414. // 无弹出窗口或弹出窗口等于 1 时,MSG跟随鼠标
  3415. else {
  3416. var xy,
  3417. x,
  3418. y;
  3419. try {
  3420. xy = recursionIframe();
  3421. x = window.event.pageX += xy.left;
  3422. y = window.event.pageY += xy.top;
  3423. } catch (e) {
  3424. //console.log("xy err " + e)
  3425. x = window.event.pageX;
  3426. y = window.event.pageY;
  3427. }
  3428. if (wd.topWindow.$("#flashmsgtipsId").find("p").size() < 1) {
  3429. // wd.topWindow.$("#flashmsgtipsId").addClass("flashmsgtips").removeClass("flashmsgtips-submit");
  3430. wd.topWindow.$("#flashmsgtipsId").css({
  3431. "top": y - 53 + "px",
  3432. "left": x - 7 + "px",
  3433. "bottom": "",
  3434. "right": ""
  3435. })
  3436. }
  3437. wd.topWindow.$("#fMD").css("left", x - 10);
  3438. wd.topWindow.$("#fMD").css("top", y - 4);
  3439. }
  3440. });
  3441. }
  3442. wd.display.showMsgPopup = function (msg, options) {
  3443. if (window.location.href.indexOf("view.jsp") > 0)
  3444. return;
  3445. var msgs = wd.topWindow.wd.display.popupMsgMagager = wd.topWindow.window.wd.display.popupMsgMagager || new wd.topWindow.window
  3446. .wd.display.MsgManager();
  3447. msgs.pushMsg(msg, options);
  3448. if (wd.display.isFixation) {
  3449. setFixation();
  3450. }
  3451. }
  3452. var setFixation = function () {
  3453. // wd.topWindow.$("#flashmsgtipsId").addClass("flashmsgtips-submit").removeClass('flashmsgtips');
  3454. wd.topWindow.$("#flashmsgtipsId").css({
  3455. "bottom": "50px",
  3456. "right": "10px",
  3457. "top": "",
  3458. "left": ""
  3459. })
  3460. }
  3461. var recursionIframe = function (win) {
  3462. try {
  3463. win = win || window;
  3464. function getTop(e) {
  3465. var offset = e.offsetTop;
  3466. if (e.offsetParent != null)
  3467. offset += getTop(e.offsetParent);
  3468. return offset;
  3469. }
  3470. function getLeft(e) {
  3471. var offset = e.offsetLeft;
  3472. if (e.offsetParent != null)
  3473. offset += getLeft(e.offsetParent);
  3474. return offset;
  3475. }
  3476. if (win.parent == top && win.parent == win || win.document == undefined) {
  3477. return {
  3478. "left": 0,
  3479. "top": 0
  3480. };
  3481. }
  3482. var winPar = win.parent;
  3483. var iframeArr = winPar.document.getElementsByTagName('IFRAME');
  3484. var targetIframe;
  3485. var iframeArr1 = win.document.getElementsByTagName('IFRAME');
  3486. for (var i = 0; i < iframeArr1.length; i++) {
  3487. var iframeElem = iframeArr1[i];
  3488. if (iframeElem.contentWindow == win) {
  3489. targetIframe = iframeElem;
  3490. break;
  3491. }
  3492. }
  3493. for (var i = 0; i < iframeArr.length; i++) {
  3494. var iframeElem = iframeArr[i];
  3495. if (iframeElem.contentWindow == win) {
  3496. targetIframe = iframeElem;
  3497. break;
  3498. }
  3499. }
  3500. var xy = {
  3501. left: getLeft(targetIframe),
  3502. top: getTop(targetIframe)
  3503. }
  3504. if (winPar.parent != winPar) {
  3505. var xy2 = recursionIframe(winPar);
  3506. xy.left += xy2.left;
  3507. xy.top += xy2.top;
  3508. }
  3509. return xy
  3510. } catch (e) {
  3511. console.log("Point err " + e)
  3512. }
  3513. }
  3514. wd.display.resizeComponent = function (width, height, minHeight, maxHeight) {
  3515. if (parseInt(width) == "NaN" || parseInt(height) == "NaN")
  3516. return;
  3517. var dialog = wd.display.getwdDialogWindows();
  3518. if (!dialog)
  3519. return
  3520. var changesize = true;
  3521. if (minHeight && !isNaN(minHeight) && maxHeight && !isNaN(maxHeight)) {
  3522. minHeight = parseInt(minHeight);
  3523. maxHeight = parseInt(maxHeight);
  3524. if (minHeight + this.Yi > wd.topWindow.innerHeight) {
  3525. height = minHeight + this.Yi;
  3526. // showNameOrId = 'wdFullScreen';
  3527. // fullScreenLimitHeight = false;
  3528. } else if (maxHeight + this.Yi < wd.topWindow.innerHeight) {
  3529. height = maxHeight + this.Yi;
  3530. } else {
  3531. height = wd.topWindow.innerHeight;
  3532. changesize = true;
  3533. // changesize = false;
  3534. // showNameOrId = 'wdFullScreen';
  3535. }
  3536. }
  3537. wd.display.addDialogLine();
  3538. if (changesize) {
  3539. dialog.setDimension(width, height);
  3540. dialog.keepInViewport(false);
  3541. dialog.center();
  3542. }
  3543. }
  3544. wd.display.reset = function (type, submitBtn, url, width, height, minHeight, maxHeight) {
  3545. var canSubmit = false;
  3546. if (submitBtn.iscommit) {
  3547. canSubmit = true;
  3548. } else if (!submitBtn.form) {
  3549. console.warn("没找到元素所在form");
  3550. } else {
  3551. if (!submitBtn.form.checkOnly) { //没有校验器
  3552. canSubmit = true;
  3553. } else if (submitBtn.form.checkOnly(true)) { //验证通过
  3554. canSubmit = true;
  3555. } else { //表单验证不通过
  3556. canSubmit = false;
  3557. }
  3558. }
  3559. if (canSubmit) {
  3560. wd.display.changeFormAction(url, submitBtn);
  3561. if (type == "dialog") {
  3562. wd.display.resizeComponent(width, height, minHeight, maxHeight);
  3563. wd.display.submitToTopTab(submitBtn);
  3564. return false;
  3565. }
  3566. // submitBtn.iscommit = true;
  3567. // submitBtn.click();
  3568. }
  3569. return canSubmit;
  3570. }
  3571. /**
  3572. * commwrite oneLine=true 限制宽度,结尾添加'...'
  3573. * @param {Object} ele
  3574. */
  3575. wd.display.initOneLine = function (ele) {
  3576. try {
  3577. var parent = ele.parentNode;
  3578. parent.removeChild(ele);
  3579. parent.setAttribute("title", parent.innerHTML);
  3580. parent.style.overflow = "hidden";
  3581. parent.style.textOverflow = "ellipsis";
  3582. parent.style.whiteSpace = "nowrap";
  3583. // 如果无效 table加样式 table-layout: fixed;
  3584. // var poffsetW = parent.offsetWidth;
  3585. // var pscrollW = parent.scrollWidth;
  3586. // console.log(poffsetW+" "+pscrollW)
  3587. // parent.setAttribute("aaa",poffsetW+"/"+pscrollW)
  3588. // if(poffsetW<pscrollW){
  3589. // parent.style.overflow="hidden";
  3590. // parent.style.textOverflow="ellipsis";
  3591. // parent.style.whiteSpace="nowrap";
  3592. // }
  3593. } catch (e) {
  3594. console.log(e)
  3595. }
  3596. };
  3597. wd.display.callback_suffix = "confirm_callback";
  3598. wd.display.cancelcallback_suffix = "cancel_callback";
  3599. wd.display.confirm = function (title, msg, callback, cancelCallback) {
  3600. var params = {
  3601. dialog: "dialog",
  3602. width: 400,
  3603. height: 180
  3604. };
  3605. //第一个参数是对象参数 {title:title,msg:msg}
  3606. if (typeof title == "object") {
  3607. $.extend(params, title);
  3608. } else {
  3609. params.title = title;
  3610. params.msg = msg;
  3611. params.callback = callback;
  3612. params.cancelCallback = cancelCallback;
  3613. params.url = "/page/sure.jsp?msg=" + encodeURIComponent(msg);
  3614. }
  3615. /// 增加,来自 PMS下载。Lin
  3616. if(!params.url)
  3617. params.url = "/page/sure.jsp?msg=" + encodeURIComponent(params.msg);
  3618. ///
  3619. var dialogid = wd.display.showComponent({
  3620. show: ["wdDialog"],
  3621. hide: [],
  3622. url: params.url,
  3623. title: params.title||" ",
  3624. width: params.width,
  3625. height: params.height
  3626. });
  3627. if (typeof params.callback == "string") {
  3628. // window[dialogid+wd.display.callback_suffix]=eval(callback);
  3629. window[dialogid + wd.display.callback_suffix] = function () {
  3630. var iframe = wd.display.getFrameOfWindow();
  3631. // console.log(this)
  3632. if (iframe.tabObj == null) {
  3633. this.location = params.callback;
  3634. } else {
  3635. this.parent.location = params.callback;
  3636. }
  3637. };
  3638. } else if (typeof params.callback == "function") {
  3639. window[dialogid + wd.display.callback_suffix] = params.callback;
  3640. }
  3641. if (params.cancelCallback) {
  3642. window[dialogid + wd.display.cancelcallback_suffix] = params.cancelCallback;
  3643. }
  3644. };
  3645. //window.confirm = wd.display.confirm;
  3646. //
  3647. wd.display.alert = function (message, options) {
  3648. wd.display.showMsgPopup(message, options);
  3649. };
  3650. // window.alert = wd.display.alert; // 再去掉,恢复 window.alert -- 需要使用不定时消失的对话框。Lin
  3651. // isFixation 为 true 时,弹窗将立刻固定在右下角
  3652. wd.display.isFixation = false;
  3653. wd.display.fixationAlert = function (message, options) {
  3654. wd.display.isFixation = true;
  3655. wd.display.showMsgPopup(message, options);
  3656. wd.display.isFixation = false;
  3657. };
  3658. // window.alert = wd.display.fixationAlert; // 再去掉,恢复 window.alert -- 需要使用不定时消失的对话框。Lin
  3659. /**
  3660. *
  3661. * 获取弹窗内所有window对象
  3662. *
  3663. */
  3664. wd.display.getwdDialogWindowObjects = function (wdDialogId) {
  3665. var contain = wd.display.getwdDialogWindows(wdDialogId);
  3666. if (!contain)
  3667. return null;
  3668. var aaa = [];
  3669. var thisIframe = contain.getFrame();
  3670. var cc = 0;
  3671. do {
  3672. if (thisIframe.contentWindow.closed)
  3673. break;
  3674. aaa.push(thisIframe.contentWindow.window);
  3675. thisIframe = thisIframe.contentWindow.document.querySelector("iframe");
  3676. cc++
  3677. } while (thisIframe && cc <= 100)
  3678. return aaa;
  3679. }
  3680. wd.display.shareTable = function (wdDialogId) {
  3681. // console.log("archive!");
  3682. var iframe = wd.display.getFrameOfWindow();
  3683. //归档按钮
  3684. if (iframe != null && iframe.contentWindow == window) {
  3685. var bottom_div = $(".bottom-down-div");
  3686. if (bottom_div.find(".submitButton").length == 0) {
  3687. // bottom_div.append("<input type=\"button\" class=\"bottom-button submitButton\" value=\"确认\" />")
  3688. // bottom_div.append("<input type=\"button\" class=\"bottom-button authorize\" value=\"授权\" />")
  3689. // bottom_div.append("<select id=\"xxgkfsmOption\"><option value='1'>系统内公开</option><option value='1'>不公开</option></select>")
  3690. bottom_div.html('<input type=\"button\" class=\"bottom-button submitButton\" value=\"确认\" />' +
  3691. '<input type=\"button\" class=\"bottom-button authorize\" value=\"授权\" />' +
  3692. '<select id=\"xxgkfsmOption\" style="display:none;"><option value="1">系统内公开</option><option value="1">不公开</option></select>' +
  3693. bottom_div.html());
  3694. bottom_div.on("click", ".authorize", function () {
  3695. wd.display.getwdDialogWindows().getFrame().contentWindow.authorize();
  3696. })
  3697. bottom_div.on("click", ".submitButton", function () {
  3698. wd.display.getwdDialogWindows().getFrame().contentWindow.agree();
  3699. })
  3700. }
  3701. }
  3702. var tokenList = [];
  3703. var tokenData = {};
  3704. var $elements = $("[onclick^='wd.display.showComponent']:not(:hidden)").each(function (num, ele) {
  3705. var showComponentFunStr = this.getAttribute("onClick");
  3706. //获取token查询
  3707. var reg = new RegExp("ssToken=[0-9a-zA-Z]+", "g"); // ("token=[。Lin
  3708. var patt = reg.exec(showComponentFunStr);
  3709. if (patt == null)
  3710. return true;
  3711. var token = patt[0].split("=")[1];
  3712. tokenList.push(token);
  3713. tokenData[token] = {
  3714. 'type': 'childObject',
  3715. 'ele': this
  3716. };
  3717. });
  3718. // console.log(tokenData)
  3719. if (iframe != null && iframe.contentWindow == window) {
  3720. var reg = new RegExp("ssToken=[0-9a-zA-Z]+", "g"); // ("token=[。Lin
  3721. var patt = reg.exec(window.location.href);
  3722. var token = "";
  3723. if (patt == null) {
  3724. // return true
  3725. token = window.location.href
  3726. } else {
  3727. token = patt[0].split("=")[1];
  3728. }
  3729. tokenList.push(token);
  3730. tokenData[token] = {
  3731. 'type': 'primaryObject'
  3732. };
  3733. }
  3734. if (tokenList.length == 0)
  3735. return;
  3736. // console.log(tokenList)
  3737. /* 再改,规范命名。Lin
  3738. * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
  3739. * &wdService= 改为 ssServ
  3740. $.post("/service?wdApplication=wd&wdService=objectDataQueryByToken", {
  3741. */ $.post("/service?ssServ=objectDataQueryByToken", {
  3742. 'tokenList': JSON.stringify(tokenList)
  3743. }, function (data) {
  3744. data = eval(data)
  3745. var mark = wd.topWindow.mark[wdDialogId];
  3746. // console.log(tokenData)
  3747. for (var i = 0; i < data.length; i++) {
  3748. var temp = data[i]
  3749. var ele = tokenData[temp.token].ele;
  3750. var type = tokenData[temp.token].type;
  3751. var keyid = temp.object + temp.id;
  3752. var checked = (temp.checked == "true" || temp.checked == true) ? true : false;
  3753. if (!mark[keyid]) {
  3754. mark[keyid] = {
  3755. 'id': temp.id,
  3756. 'type': type,
  3757. 'object': temp.object,
  3758. 'checkStatue': checked,
  3759. 'checked': checked
  3760. }
  3761. }
  3762. // console.log(mark[keyid]);
  3763. // console.log(mark[keyid])
  3764. if (type != "childObject")
  3765. continue;
  3766. var topDoc = window.document;
  3767. var chartDiv = topDoc.createElement('div');
  3768. chartDiv.setAttribute("id", keyid);
  3769. topDoc.body.appendChild(chartDiv);
  3770. // chartDiv.innerHTML = "<input id=\"" + keyid + "\" type='checkbox' " + (mark[keyid].checked ? "checked" : "") +
  3771. // " value='' />";
  3772. if (mark[keyid].checked) {
  3773. chartDiv.setAttribute("class", "smallButton-checked checked")
  3774. } else {
  3775. chartDiv.setAttribute("class", "smallButton-unchecked")
  3776. }
  3777. var bounding = ele.getBoundingClientRect();
  3778. $(chartDiv).css({
  3779. left: bounding.left - chartDiv.offsetWidth * 0.5,
  3780. top: bounding.top + (ele.offsetHeight * 0.5) - chartDiv.offsetHeight,
  3781. // width: "auto",
  3782. // height: ele.offsetHeight,
  3783. zIndex: 65535,
  3784. position: 'absolute',
  3785. // background: (mark[keyid].checkStatue != mark[keyid].checked ? 'red' : 'cyan'),
  3786. // display: 'block'
  3787. })
  3788. $(chartDiv).on("click", function () {
  3789. var id = this.getAttribute("id");
  3790. var checked = $(this).hasClass("smallButton-unchecked");
  3791. var mark = wd.topWindow.mark[wdDialogId];
  3792. mark[id]["checked"] = checked;
  3793. // console.log(checked)
  3794. if (checked) {
  3795. this.setAttribute("class", "smallButton-checked")
  3796. } else {
  3797. this.setAttribute("class", "smallButton-unchecked")
  3798. }
  3799. //
  3800. //
  3801. // $(this).css({
  3802. // background: (mark[id]["checkStatue"] != mark[id]["checked"] ? 'red' : 'cyan'),
  3803. // })
  3804. // console.log(wd.topWindow.mark[wdDialogId])
  3805. })
  3806. }
  3807. })
  3808. }
  3809. //临时js
  3810. $(function () {
  3811. //首页模板添加样式
  3812. if (wd.topWindow && wd.topWindow.MenuSetting) {
  3813. var topiframe = wd.topWindow.document.querySelector("iframe[name=" + wd.topWindow.MenuSetting.target + "]");
  3814. if (topiframe && topiframe.contentWindow) {
  3815. if (topiframe.contentWindow == window) {
  3816. $(window.document.body).addClass("home-div");
  3817. $(wd.topWindow.document.body).addClass("home-div");
  3818. $(".gridster,#pg_cj").addClass("home-div");
  3819. }
  3820. }
  3821. }
  3822. //动态添加单记录授权按钮
  3823. var wdDialogId = wd.display.getwdDialogId();
  3824. // return;
  3825. if (!wdDialogId)
  3826. return
  3827. if (!wd.topWindow.mark)
  3828. wd.topWindow.mark = {};
  3829. //打标记
  3830. if (document.querySelector("meow")) {
  3831. if (!wd.topWindow.mark[wdDialogId])
  3832. wd.topWindow.mark[wdDialogId] = {};
  3833. }
  3834. if (wd.topWindow.mark[wdDialogId]) {
  3835. wd.display.shareTable(wdDialogId);
  3836. }
  3837. var win = wd.topWindow.dhxWins.window(wdDialogId);
  3838. if (wd.topWindow.lockScreen) {
  3839. win.button("lockScreen").onclick = function () {
  3840. wd.display.beaconLogin("loginOut");
  3841. wd.topWindow.lockScreen();
  3842. }
  3843. win.button("lockScreen").show();
  3844. }
  3845. })
  3846. //查询获取object的function服务
  3847. //结果用来调用弹窗方法 wd.display.showComponent.call(window,r);
  3848. wd.display.createObjectService = function (objName, functionName) {
  3849. var p = {
  3850. objName: objName,
  3851. funcName: functionName
  3852. }
  3853. var r = null;
  3854. $.ajax({
  3855. type: "post",
  3856. /* 再改,规范命名。Lin
  3857. * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
  3858. * &wdService= 改为 ssServ
  3859. url: "/service?wdApplication=wd&wdService=createObjectService&wdtest=false",
  3860. */ url: "/service?ssServ=makeFuncParm",
  3861. data: p,
  3862. async: false,
  3863. dataType: "json",
  3864. success: function (result) {
  3865. r = result;
  3866. // console.log(r);
  3867. addRemoveToken(r.token);
  3868. r.show = "wdDialog";
  3869. // wd.display.showComponent.call(window,r);
  3870. if (r.pageList) {
  3871. for (var i = 0; i < r.pageList.lenth; i++) {
  3872. addRemoveToken(r.pageList[i].token);
  3873. }
  3874. }
  3875. },
  3876. error: function (error) {
  3877. // alert("查询失败")
  3878. console.log(error)
  3879. }
  3880. })
  3881. return r;
  3882. }
  3883. wd.display.showTextTile = function (id, msg) {
  3884. var iii = document.getElementById(id);
  3885. iii.parentNode.setAttribute("title", msg);
  3886. iii.parentNode.removeChild(iii);
  3887. }
  3888. var styleAttrs = {
  3889. "width": "width",
  3890. "height": "minHeight"
  3891. };
  3892. var isdebug = false;
  3893. wd.display.initGrowHighHtml = function (areaId, maxHeight, buttons) {
  3894. return wd.display.initGrowHigh(areaId, maxHeight, buttons, true);
  3895. }
  3896. wd.display.initGrowHigh = function (areaId, maxHeight, buttons, multimedia) {
  3897. // if (typeof GrowHeight == "undefined")
  3898. // $.getScript("/wd/js/growHeight.js", function () {
  3899. // getGrowHeight(areaId, maxHeight, buttons);
  3900. // });
  3901. // else
  3902. return getGrowHeight(areaId, maxHeight, buttons, multimedia ? 2 : 3);
  3903. }
  3904. /* 再改,部件里的 var wdFitHeightbqgd= 改为 ssLblHeightByFith=。Lin
  3905. if (!window.wdFitHeightbqgd) {
  3906. window.wdFitHeightbqgd = 0;
  3907. }
  3908. */
  3909. if (!window.ssLblHeightByFith)
  3910. window.ssLblHeightByFith = 0;
  3911. /**
  3912. * wdfitheight传入减去高度
  3913. */
  3914. wd.display.fitHeightbqgd = function (n) {
  3915. /* 再改,部件里的 var wdFitHeightbqgd= 改为 ssLblHeightByFith=。Lin
  3916. window.wdFitHeightbqgd += n;
  3917. */ window.ssLblHeightByFith += n;
  3918. }
  3919. wd.display.initGrowHighByIds = function (ids, maxHeight) {
  3920. for (var i = 0; i < ids.length; i++) {
  3921. if (typeof ids[i] != "string") {
  3922. console.error("这不是一个ID")
  3923. continue;
  3924. }
  3925. wd.display.initGrowHigh(ids[i], maxHeight, {});
  3926. }
  3927. }
  3928. wd.display.ellipsisContent = function (dom, height) {
  3929. function setText(text) {
  3930. var nn = this.nodeName;
  3931. if (nn == "TEXTAREA" || nn == "INPUT") {
  3932. this.value = text;
  3933. } else {
  3934. this.innerText = text;
  3935. }
  3936. }
  3937. function getText() {
  3938. var nn = this.nodeName;
  3939. if (nn == "TEXTAREA" || nn == "INPUT") {
  3940. return this.value;
  3941. } else {
  3942. return this.innerText;
  3943. }
  3944. }
  3945. function haveScroll(dom) {
  3946. return dom.scrollHeight > dom.clientHeight;
  3947. }
  3948. function getCnHeight() {
  3949. var otxt = getText.call(this);
  3950. setText.call(this, "中");
  3951. var cnHeight = Math.max(this.scrollHeight, this.clientHeight);
  3952. setText.call(this, otxt);
  3953. return cnHeight;
  3954. }
  3955. var css = dom.style.cssText,
  3956. $dom = $(dom),
  3957. srcText = getText.call(dom);
  3958. dom.srcText = srcText;
  3959. var _style = window.getComputedStyle(dom);
  3960. var fontSize = _style.fontSize;
  3961. fontSize = parseInt(fontSize) || $("body").css("font-size");
  3962. var domWidth = $dom.width();
  3963. var cnHeight = getCnHeight.call(dom);
  3964. height = height || parseFloat(_style.height) || parseFloat($dom.css("min-height"));
  3965. height = Math.max(cnHeight, height);
  3966. dom.style.setProperty("height", height + "px", "important");
  3967. setText.call(dom, dom.srcText);
  3968. if (srcText.length == 0 || height == 0) {
  3969. dom.style.cssText = css;
  3970. return srcText;
  3971. }
  3972. // console.log(dom, cnHeight, height, fontSize, haveScroll(dom));
  3973. // var noBlankText = srcText.replace(/\s/g, "");
  3974. var endOffset = parseInt(domWidth / fontSize); //大概一行的字数
  3975. var viewText = srcText.substring(0, endOffset);
  3976. setText.call(dom, viewText);
  3977. var dot = false;
  3978. while (endOffset < srcText.length && !haveScroll(dom)) { //还有字但是没有滚动条,加
  3979. endOffset++;
  3980. viewText = srcText.substring(0, endOffset);
  3981. setText.call(dom, viewText);
  3982. if (haveScroll(dom)) { //
  3983. dot = true;
  3984. }
  3985. }
  3986. while (endOffset > 0 && haveScroll(dom)) { //出了滚动条,减
  3987. endOffset--;
  3988. viewText = viewText.substring(0, endOffset) + "...";
  3989. (function (vt) {
  3990. setText.call(dom, vt)
  3991. })(viewText);
  3992. }
  3993. setText.call(dom, viewText)
  3994. dom.style.cssText = css;
  3995. return viewText;
  3996. }
  3997. //显示tag圆点
  3998. wd.display.showTagState = function (url) {
  3999. // console.log(url)
  4000. $(function () {
  4001. var tokenList = []
  4002. var lis = document.querySelectorAll("[ssTabClick]"); // ("[wdtabclick]")。先改,是 wdtabclick,不是 wdTabClick。Lin
  4003. for (var i = 0; i < lis.length; i++) {
  4004. var reg = new RegExp("ssToken=[0-9a-zA-Z]+", "g"); // ("token=[。Lin
  4005. var patt = reg.exec(lis[i].getAttribute("ssTabClick")); // ("wdtabclick"))。先改,是 wdtabclick,不是 wdTabClick。Lin
  4006. if (patt == null) {
  4007. tokenList.push(null);
  4008. } else {
  4009. var token = patt[0].split("=")[1];
  4010. tokenList.push(token);
  4011. }
  4012. }
  4013. // console.log(7777777777)
  4014. // console.log(tokenList)
  4015. //
  4016. $.post(url, {
  4017. "tokenList": JSON.stringify(tokenList)
  4018. }, function (result) {
  4019. result = eval("(" + result + ")");
  4020. // console.log(result);
  4021. for (var i = 0; i < lis.length; i++) {
  4022. if (!result[i])
  4023. continue;
  4024. if (true == result[i].cgxList) { // ("true" ==。字符串改为布尔型。Lin
  4025. lis[i].innerHTML = lis[i].innerHTML + "<span class=\"statePoint icon-highlightPoint\"></span>"
  4026. } else if (true == result[i].objectList) { // ("true" ==。字符串改为布尔型。Lin
  4027. lis[i].innerHTML = lis[i].innerHTML + "<span class=\"statePoint icon-dimPoint\"></span>"
  4028. } else { }
  4029. }
  4030. })
  4031. })
  4032. }
  4033. //级联查看 growheight前文本处理
  4034. wd.display.combineDiv = function (id) {
  4035. // console.log($("#" + id).children().find("[id$=combine]"))
  4036. //
  4037. if ($("#" + id).children().find("[id$=combine]").length > 0)
  4038. return
  4039. var content = "";
  4040. var isCascading = $("#" + id).find(".content-offButton,.content-onButton").length == 0;
  4041. if (isCascading) {
  4042. $("#" + id).children(":visible").each(function () {
  4043. content += (this.innerHTML + "&nbsp;");
  4044. })
  4045. } else {
  4046. $("#" + id).find(":visible").each(function () {
  4047. if ($(this).is("[type=button]")) {
  4048. // var name = this.getAttribute("name");
  4049. // if ("1" == $("[type=hidden][name=" + name + "]").val()) {
  4050. // content += ($("[type=button][name=" + name + "][wdValue=1]").val() + "&nbsp;");
  4051. // }
  4052. if ($(this).hasClass("content-onButton")) {
  4053. content += ($(this).val() + "&nbsp;");
  4054. }
  4055. }
  4056. })
  4057. }
  4058. if (/\&nbsp\;$/.test(content))
  4059. content = content.substring(0, content.length - "&nbsp;".length)
  4060. $("#" + id).empty().html(content);
  4061. }
  4062. wd.display.initSelectOption = function (id) {
  4063. wd.topWindow.$("#" + id).remove();
  4064. var ele = $("<div id=\"" + id + "\" class=\"popup-div hLine-highlightBlod\" >"
  4065. + "<div class=\"scrollbar\" style=\"max-height:250px;overflow-x:auto;padding-right:16px;\"></div>"
  4066. + "</div>")[0];
  4067. wd.topWindow.document.body.appendChild(ele);
  4068. return ele
  4069. }
  4070. wd.display.buildSelectOption = function (dom, datalist, valueKey, nameKey, selectValue, hasNullOption) {
  4071. var ul = dom.childNodes[0];
  4072. if (datalist && datalist.length > 0) {
  4073. var listr = hasNullOption ? '<div class=\"popupList\" status="noitem">&nbsp;&nbsp;&nbsp;</div>' : '';
  4074. for (var i = 0; i < datalist.length; i++) {
  4075. var name = datalist[i][nameKey];
  4076. var value = datalist[i][valueKey];
  4077. listr += '<div class=\"' + (value == selectValue ? ' selected ' : '') + 'popupList\" status="people" value="' + value + '"' + 'index="' + i + '">' + name + '</div>';
  4078. }
  4079. ul.innerHTML = listr;
  4080. } else {
  4081. ul.innerHTML = hasNullOption ? '<div class=\"popupList\" status="noitem">找不到相关项</div>' : '';
  4082. }
  4083. }
  4084. wd.display.queryNrSubNr = function (nrid, jlztm, datas) {
  4085. var result = [];
  4086. $.ajax({
  4087. type: 'post',
  4088. url: "/service",
  4089. dataType: "json",
  4090. data: {
  4091. ssServ: "wrCmsList", // wdService: "nrxtsy",。Lin
  4092. nrid: "T-" + nrid,
  4093. sfbf: 1,
  4094. jlztm: jlztm
  4095. },
  4096. async: false,
  4097. success: function (jsonData) {
  4098. for (var i = 0; i < jsonData.length; i++) {
  4099. result.push({
  4100. name: jsonData[i].mc,
  4101. value: jsonData[i].mswj,
  4102. nrjslbm: jsonData[i].nrjslbm
  4103. });
  4104. }
  4105. }
  4106. });
  4107. return result;
  4108. }
  4109. wd.display.initCmsbtn = function (btn, fjid) {
  4110. if (fjid != null && fjid != "") {
  4111. $.ajax({
  4112. type: "post",
  4113. url: "/service?ssServ=wrCcmsList", // =getSubNrCount",。Lin
  4114. data: {
  4115. nrid: "T-" + fjid,
  4116. jlztm: 51
  4117. },
  4118. dataType: "json", // 增加,统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData。Lin
  4119. success: function (data) {
  4120. /* 改,增加错误处理 -- 统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData。Lin
  4121. * 去掉 JSON.parse(,改为用 Map<String, Object> 传输
  4122. var names = JSON.parse(data);
  4123. */
  4124. if (data.ssCode != 0) {
  4125. alert(data.ssMsg);
  4126. return;
  4127. }
  4128. var names = data.ssData;
  4129. var count = names.length;
  4130. //if (count > 0) {
  4131. var num = btn[0].querySelector(".attachment_count");
  4132. if (!num) {
  4133. num = document.createElement("span");
  4134. num.className = "attachment_count";
  4135. btn[0].appendChild(num);
  4136. }
  4137. num.innerText = count;
  4138. if (count == 0) {
  4139. $(num).hide();
  4140. } else {
  4141. $(num).show();
  4142. }
  4143. var datas = [];
  4144. for (var iii = 0; iii < names.length; iii++) {
  4145. datas.push({
  4146. name: iii,
  4147. value: names[iii]
  4148. })
  4149. }
  4150. btn.off("mouseenter").on("mouseenter", function () {
  4151. var menuelement = wd.display.initCmsMenu(fjid + "", 51);
  4152. if (menuelement) {
  4153. menuelement.showAt(btn[0]);
  4154. btn.off("mouseleave").on("mouseleave", function () {
  4155. console.log("进入 btn.off(\"mouseleave\").on(\"mouseleave\", function () {");
  4156. menuelement.hide();
  4157. });
  4158. }
  4159. });
  4160. },
  4161. error: function (data) {
  4162. console.log(data);
  4163. }
  4164. });
  4165. }
  4166. }
  4167. wd.display.initCmsMenu = function (id) {
  4168. wd.topWindow.$("#CMSMENU").remove();
  4169. var nrid = id = id.replace(/\D*/, "");
  4170. //注册内容
  4171. $.ajax({
  4172. url: "/service",
  4173. data: {
  4174. nrid: "T-" + nrid,
  4175. ssServ: "regCms" // wdService: "register"。Lin
  4176. },
  4177. async: false,
  4178. dataType: "json",
  4179. success: function (data) {
  4180. console.log(data);
  4181. }
  4182. });
  4183. var data = wd.display.queryNrSubNr(nrid);
  4184. if (data.length == 0) {
  4185. return;
  4186. }
  4187. var mainElement = wd.display.initSelectOption("CMSMENU");
  4188. function loadPlayer(contentDiv) {
  4189. var win = contentDiv.ownerDocument.defaultView;
  4190. var se = contentDiv.srcElement,
  4191. $se = $(se),
  4192. subnrid = $se.attr("value"),
  4193. nrjslbm = $se.attr("nrjslbm");
  4194. win.$.ajax({
  4195. type: "GET",
  4196. url: "/service",
  4197. data: {
  4198. ssServ: "wrCmsPlay", // : wdService: "loadNrDesignAndPlayerData",。Lin
  4199. "nrid": subnrid,
  4200. "nrjslbm": nrjslbm
  4201. },
  4202. async: false,
  4203. dataType: "json",
  4204. success: function (data) {
  4205. /// 增加,增加错误处理 -- 统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData。Lin
  4206. if (data.ssCode != 0) {
  4207. alert(data.ssMsg);
  4208. return;
  4209. }
  4210. ///
  4211. var div = document.createElement("div");
  4212. var obj = {};
  4213. obj.design = data.design;
  4214. obj.resDesign = data.resDesign;
  4215. div.setAttribute("data-init", JSON.stringify(obj));
  4216. var tempData = data.data.replace(new RegExp('@dataFolder@', 'gm'), data.dataFolderPath);
  4217. var $ma = win.$(contentDiv);
  4218. var hasClose = $ma.find("#pageClose").length > 0;
  4219. div.innerHTML = tempData;
  4220. var $div = $(div);
  4221. // $div.hide();
  4222. $ma.html($div);
  4223. $ma.append(
  4224. '<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="icon-restore" style="position: fixed;right: 13px;top: 10px;height:22px;width:22px;" onclick="wd.display.exitFullScreen()" ></div></div></div>');
  4225. // var $content = $(contentDiv);
  4226. // loadScorll($content);
  4227. // $content.getNiceScroll().resize();
  4228. div.addEventListener("DOMSubtreeModified", function () {
  4229. try {
  4230. win.wd.display.CmsZNRFull(contentDiv);
  4231. } catch (e) { }
  4232. // var $content = $(contentDiv);
  4233. // loadScorll($content);
  4234. // $content.getNiceScroll().resize();
  4235. // $content.css("height", $content.height());
  4236. // $content.css("height", "100%");
  4237. });
  4238. }
  4239. });
  4240. var $pe = $se.prev(".popupList"),
  4241. prev = $pe.attr("value"),
  4242. $ne = $se.next(".popupList"),
  4243. next = $ne.attr("value");
  4244. var ismousedown = false;
  4245. var oldY,
  4246. scollY;
  4247. contentDiv.onmousedown = function (e) {
  4248. oldscrollTop = contentDiv.scrollTop;
  4249. oldY = e.screenY;
  4250. scollY = contentDiv.scrollTop;
  4251. ismousedown = true;
  4252. }
  4253. contentDiv.onmouseup = function (e) {
  4254. ismousedown = false;
  4255. }
  4256. contentDiv.onmousemove = function (e) {
  4257. e = e || window.event;
  4258. var newY = e.screenY;
  4259. if (ismousedown) {
  4260. //console.log(element.scrollTop + element.clientHeight+"###"+element.scrollHeight)
  4261. if (oldY - newY >= 150 && contentDiv.scrollTop + contentDiv.clientHeight + 1 >= contentDiv.scrollHeight && oldscrollTop +
  4262. contentDiv.clientHeight + 1 >= contentDiv.scrollHeight) {
  4263. ismousedown = false;
  4264. // console.log("鼠标向上移动");
  4265. if ($ne.length > 0) {
  4266. contentDiv.srcElement = $ne[0];
  4267. loadPlayer(contentDiv);
  4268. }
  4269. // console.log(contentDiv.getAttribute("isCmsFullScreen"));
  4270. } else if (newY - oldY >= 150 && contentDiv.scrollTop <= 0 && oldscrollTop == 0) {
  4271. ismousedown = false;
  4272. // console.log("鼠标向下移动");
  4273. if ($pe.length > 0) {
  4274. contentDiv.srcElement = $pe[0];
  4275. loadPlayer(contentDiv);
  4276. }
  4277. // console.log(contentDiv.getAttribute("isCmsFullScreen"));
  4278. } else {
  4279. contentDiv.scrollTop = scollY + (oldY - e.screenY); //此处调节滚动速度
  4280. }
  4281. }
  4282. }
  4283. // console.log("加载播放器完毕")
  4284. }
  4285. mainElement.style.minWidth = "180px";
  4286. wd.display.buildSelectOption(mainElement, data, "value", "name", "null");
  4287. var $mainElement = wd.topWindow.$(mainElement);
  4288. $.each(data, function () {
  4289. $mainElement.find("[value='" + this.value + "']").attr("nrjslbm", this.nrjslbm);
  4290. });
  4291. $mainElement.find(".popupList").click(function () {
  4292. //绑定全屏
  4293. var doc = mainElement.ownerDocument;
  4294. var maindiv = doc.querySelector("#CMSPLAY" + id);
  4295. if (maindiv == null) {
  4296. //创建打的包装div
  4297. maindiv = doc.createElement("div");
  4298. maindiv.id = "CMSPLAY" + id;
  4299. maindiv.style.textAlign = "center";
  4300. maindiv.onselectstart = function () {
  4301. return false;
  4302. }
  4303. doc.body.appendChild(maindiv);
  4304. $(maindiv).append('<link rel="stylesheet" href="/ss/pdf/base.min.css">');
  4305. $(maindiv).append('<link rel="stylesheet" href="/ss/pdf/fancy.min.css">');
  4306. $(maindiv).append('<script type="text/javascript" src="/ss/pdf/compatibility.min.js"></script>');
  4307. $(maindiv).append('<script type="text/javascript" src="/ss/pdf/pdf2htmlEX.min.js"></script>');
  4308. var contentDiv = maindiv.contentDiv = doc.createElement("div");
  4309. contentDiv.className = "mainDiv";
  4310. contentDiv.style.width = "100%";
  4311. contentDiv.style.height = "100%";
  4312. contentDiv.style.display = "flex";
  4313. contentDiv.style.justifyContent = "center";
  4314. contentDiv.style.background = "white";
  4315. contentDiv.style.alignItems = "center";
  4316. maindiv.appendChild(contentDiv);
  4317. }
  4318. maindiv.contentDiv.srcElement = this;
  4319. // setTimeout(function () {
  4320. // console.log("开始全屏")
  4321. doc.defaultView.wd.display.CmsFullScreen(maindiv.getElementsByTagName('DIV')[0], function () {
  4322. loadPlayer(maindiv.contentDiv);
  4323. $(maindiv).children("#pageClose").remove();
  4324. }, function () {
  4325. maindiv.parentNode.removeChild(maindiv);
  4326. doc.defaultView.clearInterval(maindiv.contentDiv.intervalID);
  4327. });
  4328. // }, 500);
  4329. });
  4330. $mainElement.mouseenter(function () {
  4331. console.log("进入 $mainElement.mouseenter(function () {");
  4332. if (this.removeTimerId != null) {
  4333. this.ownerDocument.defaultView.clearTimeout(this.removeTimerId);
  4334. this.removeTimerId = null;
  4335. }
  4336. });
  4337. mainElement.hide = function () {
  4338. mainElement.removeTimerId = mainElement.ownerDocument.defaultView.setTimeout(function () {
  4339. $mainElement.remove();
  4340. }, 300);
  4341. };
  4342. $mainElement.mouseleave(function () {
  4343. console.log("进入 $mainElement.mouseleave(function () {");
  4344. this.hide();
  4345. });
  4346. mainElement.showAt = function (element) {
  4347. $mainElement.show();
  4348. var bounding = element.getBoundingClientRect(),
  4349. mb = mainElement.getBoundingClientRect(),
  4350. xy = recursionIframe(window);
  4351. var left = bounding.right + xy.left - mb.width;
  4352. var top_ = bounding.top + xy.top - 10 - mb.height;
  4353. $mainElement.css({
  4354. left: left,
  4355. top: top_
  4356. });
  4357. }
  4358. $mainElement.click(function (e) {
  4359. e.stopPropagation();
  4360. });
  4361. $("body").click(function () {
  4362. mainElement.hide()
  4363. });
  4364. $("body", wd.topWindow.document).click(function () {
  4365. mainElement.hide()
  4366. });
  4367. $mainElement.hide();
  4368. return mainElement;
  4369. }
  4370. //获取表单元素
  4371. //growHeight
  4372. //objectpicker
  4373. //onoffbutton
  4374. //ueditor
  4375. //input select datepicker
  4376. //编辑帮助,个人选值
  4377. wd.display.getInputsGroups = function () {
  4378. var arr = $("form,input,select,:radio,:checkbox").serializeArray();
  4379. var ret = {};
  4380. for (var i = 0; i < arr.length; i++) {
  4381. var name = arr[i].name;
  4382. if (!name)
  4383. continue;
  4384. if (/objectPicker.*/.test(name))
  4385. continue;
  4386. var cc = wd.display.getInputBox(name);
  4387. if (!cc)
  4388. continue;
  4389. ret[name] = cc;
  4390. }
  4391. return ret;
  4392. }
  4393. /**
  4394. *
  4395. * @param {Object} name
  4396. * @param {Object} any true:不过滤隐藏元素
  4397. */
  4398. wd.display.getInputBox = function (name,any) {
  4399. if(wd.display.filterInputBoxNames[name]){
  4400. // console.log("filterInputBoxNames:"+name);
  4401. return null;
  4402. }
  4403. var result = {
  4404. name: name,
  4405. container: null, //定位元素
  4406. setChange:null,
  4407. focus:null,//光标
  4408. onKeyDown:null,//enter key event
  4409. onKeyDownContainer: null,
  4410. modify:null,
  4411. modifyContainer:null
  4412. };
  4413. result.getValue = function () {
  4414. return $(this.container).val()
  4415. }
  4416. result.setValue = function (v) {
  4417. $(this.container).val(v)
  4418. }
  4419. result.setChange = function (changefunc) {
  4420. $(this.container).on("change",changefunc);
  4421. }
  4422. result.focus = function () {
  4423. $(this.container).focus();
  4424. }
  4425. result.modify= function (canmodify) {
  4426. if(canmodify){
  4427. $(this.modifyContainer||this.container ).removeAttr("readonly");
  4428. }else{
  4429. $(this.modifyContainer||this.container).attr("readonly","readonly");
  4430. }
  4431. }
  4432. //键盘录入监听,keycode 9:tab 13:enter
  4433. result.onKeyDown=function (keycode,func) {
  4434. var code=[];
  4435. code=keycode;
  4436. $(this.onKeyDownContainer||this.container).on("keydown",function(){
  4437. if(code.indexOf(window.event.keyCode)!=-1){
  4438. return func();
  4439. }
  4440. });
  4441. }
  4442. try {
  4443. if (window.growHeightList &&window.growHeightList[name]) {
  4444. result.type = "growHeight"
  4445. result.instance = growHeightList[name];
  4446. result.container = growHeightList[name].container.parentNode
  4447. result.getValue = function () {
  4448. return this.instance.val();
  4449. }
  4450. result.setValue = function (v) {
  4451. this.instance.val(v);
  4452. }
  4453. result.focus = function () {
  4454. this.instance.onFocus()
  4455. }
  4456. result.onKeyDownContainer=$(growHeightList[name].getInputElement().parentNode).find("textarea");
  4457. result.modifyContainer=growHeightList[name].getInputElement();
  4458. } else if (wd && wd.edit && wd.edit.objectPicker && wd.edit.objectPicker.getInstance(name)) {
  4459. result.type = "objectPicker"
  4460. result.instance = wd.edit.objectPicker.getInstance(name);
  4461. result.container = result.instance.getDisplayElement();
  4462. result.getValue = function () {
  4463. return this.instance.getValue()
  4464. }
  4465. result.setValue = function (v) {
  4466. this.instance.initValue(v);
  4467. }
  4468. result.setChange=function(func){
  4469. this.instance.onchange=func;
  4470. }
  4471. result.modify=function(canmodify){
  4472. this.instance.modify(canmodify);
  4473. }
  4474. } else if (window.EditorManager&&EditorManager.instances&&EditorManager.instances[name]) {
  4475. result.type = "ueditor"
  4476. result.container =EditorManager.instances[name].getUeditor().container;
  4477. result.instance =EditorManager.instances[name].getUeditor();
  4478. result.getValue = function () {
  4479. var c= this.instance.getContent();
  4480. return (c)?wd.display.toPlainText():c;
  4481. }
  4482. result.setValue = function (v) {
  4483. return this.instance.setContent(v);
  4484. }
  4485. } else if ($("#" + name + "_onoffbutton_list").length == 1) {
  4486. result.type = "onoffbutton"
  4487. result.container = $("[name="+name+"][type=button]").last()[0];
  4488. result.getValue = function () {
  4489. return $("[name='"+name+"'][type=hidden]").val();
  4490. }
  4491. result.setValue = function (v) {
  4492. /* 改,是小写的 wdvalue=,也改先 -- 规范命名。Lin
  4493. $("[name='"+name+"'][type=button][wdvalue="+v+"]").click();
  4494. */ $("[name='"+name+"'][type=button][ssVal="+v+"]").click();
  4495. }
  4496. }else if(window.enrolDateList&&window.enrolDateList[name]){
  4497. result.type = "enrolDate"
  4498. result.instance = window.enrolDateList[name];
  4499. result.container = window.enrolDateList[name].container
  4500. result.getValue = function () {
  4501. return this.instance.getValue();
  4502. }
  4503. result.setValue = function (v) {
  4504. this.instance.setValue(v);
  4505. }
  4506. result.setChange=function(func){
  4507. this.instance.onchange=func;
  4508. }
  4509. }else if(window.editPhotoList&&window.editPhotoList[name]){
  4510. result.type = "editPhoto"
  4511. result.instance = window.editPhotoList[name];
  4512. result.container = window.editPhotoList[name].container;
  4513. result.getValue = function () {
  4514. return this.instance.getValue();
  4515. }
  4516. result.setValue = function (v) {
  4517. this.instance.setValue(v);
  4518. }
  4519. result.modify=function(canmodify){
  4520. this.instance.modify(canmodify);
  4521. }
  4522. } else if (document.querySelector("[name='" + name + "']")) {
  4523. result.type = "input";
  4524. result.container = document.querySelector("[name='" + name + "']");
  4525. } else {
  4526. return null;
  4527. }
  4528. if(any){
  4529. }else{
  4530. if ($(result.container).width() == 0)
  4531. return null;
  4532. }
  4533. } catch (e) {
  4534. console.log(e);
  4535. }
  4536. return result;
  4537. }
  4538. if(!wd.display.filterInputBoxNames){
  4539. wd.display.filterInputBoxNames={};
  4540. }
  4541. /**
  4542. * 过滤inputbox
  4543. */
  4544. wd.display.filterInputBox=function (name) {
  4545. for(var i=0;i<arguments.length;i++){
  4546. var m=arguments[i];
  4547. wd.display.filterInputBoxNames[m]="1";
  4548. }
  4549. // console.log(wd.display.filterInputBoxNames);
  4550. }
  4551. wd.display.changeFirstTitle = function (t) {
  4552. var displgid = wd.display.getwdDialogId();
  4553. if (!displgid)
  4554. return;
  4555. wd.topWindow.dhxWins.window(displgid).querySelector(".dialog-title").innerHTML = t
  4556. }
  4557. wd.display.changeSecondTitle = function (t) {
  4558. var displgid = wd.display.getwdDialogId();
  4559. if (!displgid)
  4560. return;
  4561. wd.topWindow.dhxWins.window(displgid).querySelector(".secondTitle").innerHTML = t
  4562. }
  4563. /**
  4564. * 判断当前url是否个人首页
  4565. * @param {Object} win
  4566. */
  4567. wd.display.isPersonalHomePageUrl = function (url) {
  4568. if (!url)
  4569. return false;
  4570. return url.indexOf("initDesktop") == -1 ? false : true;
  4571. }
  4572. /**
  4573. * 生成更多按钮
  4574. * @param {Object} buttonId
  4575. * @param {Object} childrenClass
  4576. * selectedDiv 选中菜单,显示按钮名称
  4577. * recordvalue 启用个人选值
  4578. */
  4579. wd.display.attachButton = function (buttonId, childrenClass, selectedDiv, buttonNotClickAschild, recordvalue) {
  4580. var $button = $("#" + buttonId);
  4581. var vanishId;
  4582. //获取二级数据
  4583. function findDatalist() {
  4584. var datalist = [];
  4585. var d = document.querySelectorAll("." + childrenClass);
  4586. //adminNo
  4587. for (var i = 0; i < d.length; i++) {
  4588. datalist.push({
  4589. name: d[i].getAttribute("value"),
  4590. value: d[i].getAttribute("value"),
  4591. ele: d[i]
  4592. });
  4593. }
  4594. return datalist;
  4595. }
  4596. function showChild(v, isinit) {
  4597. var datalist = findDatalist();
  4598. var thisdata;
  4599. for (var i = 0; i < datalist.length; i++) {
  4600. if (datalist[i].value == v) {
  4601. thisdata = datalist[i];
  4602. }
  4603. }
  4604. //记忆,点击按钮触发上一个点击过的选项
  4605. $button.off("click");
  4606. if (true === buttonNotClickAschild) {
  4607. $button.on("click", function () {
  4608. vanishId = setTimeout(function () {
  4609. $("#" + buttonId + "_buttons").hide();
  4610. }, 500)
  4611. })
  4612. } else {
  4613. $("#" + buttonId + "_buttons").hide();
  4614. var html = thisdata ? thisdata.name : "";
  4615. if (true === isinit) {
  4616. html = $button.val() + html;
  4617. }
  4618. if (selectedDiv) {
  4619. $button.find(selectedDiv).html(html);
  4620. } else if ($button.is("input")) {
  4621. $button.val(html);
  4622. }
  4623. $button.on("click", function () {
  4624. $(thisdata.ele).trigger("click");
  4625. })
  4626. }
  4627. return thisdata;
  4628. }
  4629. $button.on("mouseenter click", function () {
  4630. console.log("进入 $button.on(\"mouseenter click\", function () {");
  4631. //获取下拉数据
  4632. var datalist = findDatalist();
  4633. //create div
  4634. $("#" + buttonId + "_buttons").remove();
  4635. var dom = wd.display.initSelectOption(buttonId + "_buttons");
  4636. if (datalist.length > 0) {
  4637. /* 再改,不知为何要反转 细分部件(原 plugin) 顺序???Lin
  4638. wd.display.buildSelectOption(dom, datalist.reverse(), "value", "name", null, false);
  4639. */ wd.display.buildSelectOption(dom, datalist, "value", "name", null, false);
  4640. $("body").append(dom);
  4641. }
  4642. //position
  4643. var dombounding = dom.getBoundingClientRect();
  4644. var bounding = (this.querySelector("img") || this).getBoundingClientRect();
  4645. //console.log(bounding);
  4646. var left = bounding.left;
  4647. //防止超出屏幕出现滚动条
  4648. if ((left + dombounding.width) > window.innerWidth) {
  4649. left = window.innerWidth - dombounding.width;
  4650. }
  4651. dom.style.left = Math.max(left, 0) + "px";
  4652. if (bounding.top + bounding.height + dombounding.height > window.innerHeight) {
  4653. dom.style.top = (bounding.top - dombounding.height) + "px"
  4654. //console.log("up side")
  4655. } else {
  4656. //console.log("down side")
  4657. dom.style.top = (bounding.top + bounding.height) + "px"
  4658. }
  4659. //bind event
  4660. $(dom).on("click", ".popupList", function () {
  4661. if (window.event) {
  4662. if (window.event.stopPropagation) {
  4663. window.event.stopPropagation();
  4664. } else {
  4665. window.event.cancelBubble = true;
  4666. }
  4667. }
  4668. var v = this.getAttribute("value");
  4669. var thisdata = showChild(v);
  4670. $(thisdata.ele).trigger("click");
  4671. // console.log(thisdata);
  4672. if (recordvalue) {
  4673. var recordzhi = {};
  4674. recordzhi[buttonId] = {
  4675. value: v,
  4676. default:
  4677. true
  4678. };
  4679. wd.edit.insertRecord(recordzhi);
  4680. }
  4681. }).on("mouseleave", function () {
  4682. $(this).hide();
  4683. }).on("mouseenter", function () {
  4684. if (vanishId)
  4685. clearTimeout(vanishId);
  4686. })
  4687. }).on("mouseleave", function () {
  4688. if ($(window.event.relatedTarget).is($(this).parents())) {
  4689. vanishId = setTimeout(function () {
  4690. $("#" + buttonId + "_buttons").hide();
  4691. }, 500)
  4692. }
  4693. })
  4694. if (recordvalue) {
  4695. $(function () {
  4696. var record = wd.edit.getRecord();
  4697. // console.log(record);
  4698. if (record && record[buttonId]) {
  4699. var v = record[buttonId].value;
  4700. showChild(v, true);
  4701. }
  4702. })
  4703. }
  4704. }
  4705. wd.display.inputCaptcha = function (name, captchalength) {
  4706. try {
  4707. var inputbox = wd.display.getInputBox(name);
  4708. if (!inputbox)
  4709. return;
  4710. var inputClass = name + "_inputCaptcha";
  4711. var va = $("<div style=\"position:absolute; left: 5px;top: 5px;width: 100%;height: 100%;z-index: 1;display: flex;\">"
  4712. + "<div class=\"hLine\" style=\"display: flex; height: 30px;\">"
  4713. + "<input class=\"" + inputClass + "\" style=\"width:140px;border: none;padding-left: 7px;\" placeholder='请输入验证码'/>"
  4714. + "<img align=\"middle\" vspace=\"2\" id=\"codeimg\" title=\"看不清楚可单击刷新\" class=\"header_yzmimg\" src=\"/wd/verificationCode.do?" + new Date().getTime() + "\">"
  4715. // +"<input type=\"button\" value=\"确定\" class=\"content-button\" onclick=\"void(0);\" style=\"margin-left: 10px;\"/>"
  4716. + "</div>"
  4717. + "</div>");
  4718. // va.css({position:"absolute",left:0,top:0,width:"100%",height:"100%",background:"azure",zIndex:1})
  4719. $(inputbox.container).before(va);
  4720. va.on("click", "img", function () {
  4721. this.setAttribute("src", "/wd/verificationCode.do?" + new Date().getTime());
  4722. }).on("blur", "." + inputClass, function () {
  4723. /* 再改,规范命名。Lin
  4724. * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
  4725. * &wdService= 改为 ssServ
  4726. $.post("/service?wdApplication=wd&wdService=checkCaptcha_ajax&wdtest=false", {
  4727. */ $.post("/service?ssServ=checkCaptcha_ajax", {
  4728. yzm: this.value
  4729. }, function (result) {
  4730. if ("1" == result.result) {
  4731. va.hide();
  4732. $(inputbox.container).show();
  4733. if (typeof window.inputCaptchaCallback == "function")
  4734. window.inputCaptchaCallback();
  4735. } else {
  4736. wd.display.alert("验证码错误!")
  4737. }
  4738. }, "json")
  4739. })
  4740. $(inputbox.container).hide();
  4741. } catch (e) {
  4742. console.log(e);
  4743. }
  4744. }
  4745. wd.display.previewPicture = function (url, errorPhoto) {
  4746. if ($(window.event.srcElement).is("input,button"))
  4747. return;
  4748. $('.previewPicture').remove();
  4749. // var onerror = errorPhoto ? ('this.src=\'' + errorPhoto + '\'') : "";
  4750. var onerror = "";
  4751. // if(true)return;
  4752. // $("<div class='previewPicture ' style=\"display:none;z-index: 999999;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);border: 1px solid #6c9ddb;\">"
  4753. // + "<img src=" + url + " onerror=\"" + onerror + "\" style=\"max-width:100%;max-height: 100%;\" onload=\"$('.previewPicture').show()\"/>"
  4754. // +"<span class='close' style=\"width: 30px;height:30px;position: absolute;top: 0px;right: 0px;font-size: 20px;background-color: #e2e2e2;text-align: center;line-height: 30px;\">X</span>"
  4755. // +"<span class='download' style=\"width: 30px;height:30px;position: absolute;top: 0px;right: -30px;font-size: 20px;background-color: #e2e2e2;text-align: center;line-height: 30px;\">download</span>"
  4756. // + "</div>")
  4757. // .appendTo("body")
  4758. // .on('click',".close", function () {
  4759. // $('.previewPicture').remove();
  4760. // });
  4761. var startLeft,startTop,startX,startY;
  4762. $("<div class='previewPicture lightDialog-div' style=\"display:none;z-index: 9999;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);border: 1px solid #6c9ddb;\">"
  4763. +'<div class="lightDialog-title hLine">'
  4764. +'<div title="下载" class="download icon-download" style="position: absolute;right: 35px;top: 9px;"></div>'
  4765. +'<div title="关闭" class="close icon-close"></div>'
  4766. +'</div>'
  4767. + "<img src=" + url + " onerror=\"" + onerror + "\" style=\"max-width:100%;max-height: 100%;\" onload=\"$('.previewPicture').show()\"/>"
  4768. + "</div>"
  4769. )
  4770. .appendTo("body")
  4771. .on('click',".close", function () {
  4772. $('.previewPicture').remove();
  4773. }).on('click',".download", function () {
  4774. wd.display.downloadFile(url+"&download=1");
  4775. // $('.previewPicture').remove();
  4776. });
  4777. // on("mousedown",function(){
  4778. // startLeft=parseInt( $(this).css("marginLeft"));
  4779. // startTop=parseInt( $(this).css("marginTop"));
  4780. // startX=window.event.clientX;
  4781. // startY=window.event.clientY;
  4782. // this.setAttribute("move","1");
  4783. // }).on("mouseup mouseout",function(){
  4784. // this.setAttribute("move","0");
  4785. // }).on("mousemove",function(){
  4786. // if("1"!=this.getAttribute("move"))return;
  4787. // $(this).css({
  4788. // marginLeft:startLeft+window.event.clientX-startX,
  4789. // marginTop:startTop+window.event.clientY-startY
  4790. // })
  4791. // })
  4792. }
  4793. wd.display.beaconLogin = function (type) {
  4794. type = type || 'login';
  4795. try {
  4796. if (typeof beacon == "undefined")
  4797. return false;
  4798. if (type == 'login') {
  4799. beacon.login(wd.topWindow.beaconLoginTicket);
  4800. } else {
  4801. beacon.loginOut();
  4802. }
  4803. return true;
  4804. } catch (error) {
  4805. console.log('------------------------------------');
  4806. console.log(error);
  4807. console.log('------------------------------------');
  4808. }
  4809. return false;
  4810. }
  4811. wd.display.getBeaconWhetherToOpen = function () {
  4812. try {
  4813. if (typeof beacon == "undefined")
  4814. return false;
  4815. if (beacon.getBeaconWhetherToOpen() == "True") {
  4816. alert("“待办列表”已在烽火台打开");
  4817. beacon.close2();
  4818. }
  4819. return true;
  4820. } catch (error) {
  4821. console.error(error);
  4822. }
  4823. return false
  4824. }
  4825. wd.display.refreshToDoList = function () {
  4826. wd.display.refreshHomeplugin("6011");
  4827. }
  4828. wd.display.refreshHomeplugin = function (type) {
  4829. if (!wd.topWindow.wd.base.applyIframeElement.contentWindow.SYBJCTRL)
  4830. return "0";
  4831. return wd.topWindow.wd.base.applyIframeElement.contentWindow.SYBJCTRL.refreshHomeplugin(type)
  4832. }
  4833. wd.display.setCloseWindowParam = function (p) {
  4834. if (!p)
  4835. return;
  4836. var wdDialogId = wd.display.getwdDialogId();
  4837. if (!wdDialogId)
  4838. return;
  4839. var win = wd.topWindow.dhxWins.window(wdDialogId);
  4840. win.closeWindowParam = p;
  4841. return win;
  4842. }
  4843. wd.display.onCloseDialog = function (win, popWindow) {
  4844. try {
  4845. // console.log("wd.display.onCloseDialog");
  4846. // console.log(win.closeWindowParam);
  4847. if (!win.closeWindowParam)
  4848. return;
  4849. var openerWindow = popWindow.wd.display.getwdDialogOpener();
  4850. var name = openerWindow.wd.edit.objectPicker.addButtonClickName;
  4851. if (!name)
  4852. return;
  4853. var objectpickerobj = openerWindow.wd.edit.objectPicker.getInstance(name);
  4854. if (!objectpickerobj)
  4855. return;
  4856. // var data={option:[{name:"abc",id:"999"}]};
  4857. var data = eval("(" + win.closeWindowParam + ")")
  4858. objectpickerobj.setwdCloseWindowParamData(data);
  4859. // console.log(objectpickerobj);
  4860. } catch (err) {
  4861. console.error(err);
  4862. }
  4863. }
  4864. /**
  4865. * 调用关闭窗口时调用的回调方法
  4866. */
  4867. wd.display.closeDialogCallbackFun = null;
  4868. /**
  4869. * 给一个按钮绑定事件
  4870. * @param {Object} buttonname
  4871. * @param {Object} bindevent
  4872. * @param {Object} bindfunction
  4873. */
  4874. wd.display.bindWdButton = function (buttonname, bindevent, bindfunction) {
  4875. var wdDialogId = wd.display.getwdDialogId();
  4876. if (!wdDialogId)
  4877. return;
  4878. var win = wd.topWindow.dhxWins.window(wdDialogId);
  4879. var b = win.button(buttonname);
  4880. $(b).on(bindevent, bindfunction);
  4881. }
  4882. /**
  4883. * px 2 rem
  4884. */
  4885. wd.display.px2Rem = function (px) {
  4886. var unit = parseFloat($("html").css("font-size"));
  4887. return px / unit;
  4888. }
  4889. /**
  4890. *
  4891. * rem 2 px
  4892. */
  4893. wd.display.rem2Px = function (rem) {
  4894. var unit = parseFloat($("html").css("font-size"));
  4895. return rem * unit;
  4896. }
  4897. /*
  4898. *
  4899. 调用示例
  4900. 1:
  4901. wd.flashMsg.show({
  4902. el: $("#domDiv"), // 吸附的元素
  4903. msg: "hi,hello", // 内容
  4904. time: 200000, // 显示的时间,默认 3000,单位毫秒,
  4905. offset: 'd', // 气泡方向,[u]: 上, [d]: 下,当所定的方向无法完全显示内容时,将自动进行调整方向
  4906. arrowsOffset: 'r', // 箭头方位,[l]:左边,[c]:居中,[r]:右,默认为[c]居中
  4907. zindex: 100, // 层级,默认 1996,
  4908. animate: true, // 为真则开启动画,默认开启
  4909. end: function() {
  4910. console.log("销毁后的回调");
  4911. }
  4912. });
  4913. 2:
  4914. wd.flashMsg.show("内容");
  4915. */
  4916. wd.flashMsg = {
  4917. vars: {
  4918. ARROWS_UP_CLASS_NAME: "flashMsg-up",
  4919. ARROWS_DOWN_CLASS_NAME: "flashMsg-down"
  4920. },
  4921. timeout: undefined,
  4922. flashDivTemplate: `<div class="flashMsg-div {flashMsgClassName}" id="flashmsgtipsId" style="left: 0px; top: 0px; display: none;{position}">
  4923. <p>{msg}</p>
  4924. <div class="{arrorwsClassName}" style="{arrorwsStyle}"></div>
  4925. </div>`,
  4926. show: function (param) {
  4927. var setting;
  4928. if(typeof param=="object"){
  4929. setting=param;
  4930. }else{
  4931. setting={
  4932. el:window.event.srcElement,
  4933. msg:param
  4934. }
  4935. }
  4936. if (!this.validation(setting)) {
  4937. return;
  4938. }
  4939. // 获取吸附元素的坐标和宽高
  4940. // var positionObj = this.getAbsolute(document, $(setting.el)[0]);
  4941. var positionObj = $(setting.el).position();
  4942. var offsetObj = $(setting.el).offset();
  4943. var elTop = offsetObj.top;
  4944. var elLeft = offsetObj.left;
  4945. var elWidth = $(setting.el).innerWidth();
  4946. var elHeight = $(setting.el).innerHeight();
  4947. setting.time = isNaN(setting.time)? 3000:setting.time; // 显示时间,默认3秒
  4948. setting.animate = setting.animate == undefined ? true : setting.animate; // 动画,默认为真
  4949. setting.zindex = this.isNull(setting.zindex) ? 1996 : setting.zindex; // 气泡的层级样式,默认层级 999
  4950. setting.offset = this.isNull(setting.offset) ? 'd' : setting.offset; // 气泡的定位样式,默认在下面
  4951. setting.arrowsOffset = this.isNull(setting.arrowsOffset) ? 'l' : setting.arrowsOffset; // 箭头的定位样式,默认左边
  4952. var arrorwsStyle = ""; // 箭头样式
  4953. var flashMsgClassName = setting.animate ? "wd-anim wd-anim-upbit" : ""; // 动画
  4954. var arrorwsClassName = undefined; // 箭头的类名
  4955. // 气泡在上
  4956. if (setting.offset && setting.offset == "u") {
  4957. arrorwsStyle += 'bottom: -10px;left: 7px';
  4958. arrorwsClassName = this.vars.ARROWS_DOWN_CLASS_NAME;
  4959. }
  4960. // 气泡在下
  4961. else if (setting.offset && setting.offset == "d") {
  4962. arrorwsStyle += 'bottom: -10px;left: 7px';
  4963. arrorwsClassName = this.vars.ARROWS_UP_CLASS_NAME;
  4964. }
  4965. // 默认气泡在上
  4966. else {
  4967. arrorwsStyle += 'bottom: -10px;left: 7px';
  4968. arrorwsClassName = this.vars.ARROWS_DOWN_CLASS_NAME;
  4969. }
  4970. this.clearFlashMsg();
  4971. $("body").append(this.getFlashDivTemplate(setting, elTop, elLeft, arrorwsClassName, arrorwsStyle, flashMsgClassName));
  4972. ////////////////////////////// 计算最终的坐标 //////////////////////////////
  4973. var lastTop = -1;
  4974. var flashDom = $("#flashmsgtipsId");
  4975. var flashDomWidth = $(flashDom).innerWidth();
  4976. var flashDomHeight = $(flashDom).innerHeight(); // 是箭头的高度
  4977. $(flashDom).css({
  4978. top: elTop + "px"
  4979. ,left: elLeft + "px"
  4980. });
  4981. // 气泡在上
  4982. if (arrorwsClassName == this.vars.ARROWS_DOWN_CLASS_NAME) {
  4983. var lastDomTop = elTop - flashDomHeight - 16;
  4984. lastTop = elTop - flashDomHeight - 16;
  4985. // flashMsg 元素超出了窗口顶部范围
  4986. if (lastDomTop < 0) {
  4987. // 未尝试过向上的方向
  4988. if (!setting.upFlag) {
  4989. setting.offset = "d";
  4990. setting.downFlag = true;
  4991. this.show(setting);
  4992. return;
  4993. }
  4994. lastTop = flashDomHeight + 6;
  4995. }
  4996. }
  4997. // 气泡在下
  4998. else if (arrorwsClassName == this.vars.ARROWS_UP_CLASS_NAME) {
  4999. lastTop = elTop + elHeight + 20;
  5000. var lastDomTop = elTop + elHeight + flashDomHeight + 20;
  5001. // flashMsg 元素超出了窗口底部范围
  5002. if (lastDomTop > window.innerHeight) {
  5003. // 未尝试过向下的方向
  5004. if (!setting.downFlag) {
  5005. setting.offset = "u";
  5006. setting.upFlag = true;
  5007. this.show(setting);
  5008. return;
  5009. }
  5010. lastTop = window.innerHeight - flashDomHeight - 12;
  5011. }
  5012. } else {
  5013. console.error("arrorwsClassName [" + arrorwsClassName + "] error!");
  5014. return;
  5015. }
  5016. this.settingFlashMsgArrorwsLeft(setting, arrorwsClassName, elWidth, elLeft, flashDom, flashDomWidth);
  5017. $(flashDom).css("top", lastTop + "px");
  5018. $(flashDom).show();
  5019. if(setting.time!=0){
  5020. this.timeout = setTimeout(function () {
  5021. wd.flashMsg.clearFlashMsg(setting);
  5022. }, setting.time);
  5023. }
  5024. },
  5025. /**
  5026. * 清除气泡
  5027. */
  5028. clear: function () {
  5029. this.clearFlashMsg();
  5030. },
  5031. settingFlashMsgArrorwsLeft: function (setting, arrorwsClassName, elWidth, elLeft, flashDom, flashDomWidth) {
  5032. var arrorwsDom = $(flashDom).find("div." + arrorwsClassName);
  5033. // 箭头往左
  5034. if (setting.arrowsOffset == 'l') {
  5035. var arrowLeft = 7;
  5036. $(arrorwsDom).css("left", arrowLeft + "px");
  5037. return;
  5038. }
  5039. // 箭头往右
  5040. else if (setting.arrowsOffset == 'r') {
  5041. var arrowLeft = flashDomWidth - 20;
  5042. // 箭头的位置超出了元素的宽度
  5043. var elEndLeft = elLeft + elWidth;
  5044. if (arrowLeft > elEndLeft) {
  5045. // 元素的一半宽度大于12像素的时候,看着就不会太别扭,放心置 left 为 6px
  5046. if ((elWidth / 2) >= 12) {
  5047. arrowLeft = elEndLeft - 6 - 7;
  5048. }
  5049. // 取半
  5050. else {
  5051. arrowLeft = elLeft + (elWidth / 2);
  5052. }
  5053. }
  5054. $(arrorwsDom).css("left", arrowLeft + "px");
  5055. }
  5056. // 箭头居中
  5057. else {
  5058. /////////////////////// 重新定位气泡 ///////////////////////
  5059. var flashMsgDomLeft = this.settingFlashMsgLeft(flashDom, flashDomWidth, elWidth, elLeft);
  5060. var arrowLeft = elLeft - flashMsgDomLeft + (elWidth / 2);
  5061. $(arrorwsDom).css("left", arrowLeft + "px");
  5062. }
  5063. },
  5064. settingFlashMsgLeft: function (flashDom, flashDomWidth, elWidth, elLeft) {
  5065. var flashMsgDomLeft = elLeft - ((flashDomWidth - elWidth) / 2);
  5066. // 超出了屏幕左边,向右移动
  5067. if (flashMsgDomLeft < 0) {
  5068. flashMsgDomLeft = 6;
  5069. }
  5070. // 超出屏幕右边,向左移动
  5071. else if ((flashMsgDomLeft + flashDomWidth) > window.innerWidth) {
  5072. flashMsgDomLeft -= ((flashMsgDomLeft + flashDomWidth) - window.innerWidth);
  5073. }
  5074. $(flashDom).css("left", flashMsgDomLeft);
  5075. return flashMsgDomLeft;
  5076. },
  5077. clearFlashMsg: function (setting) {
  5078. window.clearTimeout(wd.flashMsg.timeout);
  5079. wd.flashMsg.timeout = undefined;
  5080. $("#flashmsgtipsId").remove(); // 移除掉之前的
  5081. if (setting && setting.end) {
  5082. setting.end();
  5083. }
  5084. },
  5085. getFlashDivTemplate: function (setting, elTop, elLeft, arrorwsClassName, arrowsStyle, flashMsgClassName) {
  5086. var html = this.flashDivTemplate.replace("{position}", "zindex:" + setting.zindex + ";");
  5087. html = html.replace("{arrorwsClassName}", arrorwsClassName);
  5088. html = html.replace("{arrorwsStyle}", arrowsStyle);
  5089. html = html.replace("{msg}", setting.msg);
  5090. html = html.replace("{flashMsgClassName}", flashMsgClassName);
  5091. return html;
  5092. },
  5093. isNull: function (obj) {
  5094. switch (typeof obj) {
  5095. case 'undefined':
  5096. return true;
  5097. case 'string':
  5098. if (obj.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  5099. break;
  5100. case 'boolean':
  5101. if (!obj) return true;
  5102. break;
  5103. case 'number':
  5104. if (0 === obj || isNaN(obj)) return true;
  5105. break;
  5106. case 'object':
  5107. if (null === obj || obj.length === 0) return true;
  5108. for (var i in obj) {
  5109. return false;
  5110. }
  5111. return true;
  5112. }
  5113. return false;
  5114. },
  5115. notNull: function (obj) {
  5116. return !(this.isNull(obj));
  5117. },
  5118. validation: function (setting) {
  5119. if (this.isNull(setting)) {
  5120. console.error("flashMsg 未获取到 setting!");
  5121. return false;
  5122. }
  5123. if (this.isNull(setting.el)) {
  5124. console.error("flashMsg Setting [el] 属性不能为空 ");
  5125. return false;
  5126. }
  5127. if (this.isNull(setting.msg)) {
  5128. console.error("flashMsg Setting [msg] 属性不能为空 ");
  5129. return false;
  5130. }
  5131. return true;
  5132. },
  5133. getAbsolute: function (reference, target) {
  5134. var result = {
  5135. left: -target.clientLeft,
  5136. top: -target.clientTop
  5137. }
  5138. var node = target;
  5139. while (node != reference && node != document) {
  5140. result.left = result.left + node.offsetLeft + node.clientLeft;
  5141. result.top = result.top + node.offsetTop + node.clientTop;
  5142. node = node.parentNode;
  5143. }
  5144. if (isNaN(reference.scrollLeft)) {
  5145. result.right = document.documentElement.scrollWidth - result.left;
  5146. result.bottom = document.documentElement.scrollHeight - result.top;
  5147. } else {
  5148. result.right = reference.scrollWidth - result.left;
  5149. result.bottom = reference.scrollHeight - result.top;
  5150. }
  5151. return result;
  5152. }
  5153. }
  5154. //隐藏的元素
  5155. wd.display._lockScreenElement = null;
  5156. //有值表示正在执行lockScreen,unlockScreen
  5157. wd.display._lockScreenWaitting = null;
  5158. /**
  5159. * 锁屏
  5160. */
  5161. wd.display.lockScreen = function () {
  5162. "use strict";
  5163. if (wd.display._lockScreenWaitting) return;
  5164. wd.display._lockScreenWaitting = 0;
  5165. $.post("/service?ssServ=lockScreen", {}, function (result) {
  5166. if (wd.display._lockScreenElement) return;
  5167. wd.display._lockScreenElement = $("body > * :visible");
  5168. wd.display._lockScreenElement.hide();
  5169. $("body").append("<div class=\"lockscreenMask\" style=\"position: absolute;left: 0px;top: 0px;width: 100%;height: 100%;background-color: black;z-index: 99;\"></div>");
  5170. }, "json");
  5171. wd.display._lockScreenWaitting = null;
  5172. }
  5173. /**
  5174. * 解锁屏
  5175. */
  5176. wd.display.unlockScreen = function () {
  5177. "use strict";
  5178. if (wd.display._lockScreenWaitting) return;
  5179. wd.display._lockScreenWaitting = 1;
  5180. $.post("/service?ssServ=unlockScreen", {}, function (result) {
  5181. if (!wd.display._lockScreenElement) return;
  5182. wd.display._lockScreenElement.show();
  5183. wd.display._lockScreenElement = null;
  5184. $(".lockscreenMask").remove();
  5185. }, "json");
  5186. wd.display._lockScreenWaitting = null;
  5187. }
  5188. window.enrolDateList = window.enrolDateList || {};
  5189. wd.display.initEnrolDate=function(nameee,mode){
  5190. var hiddenEle=document.querySelector("[name="+nameee+"][type=hidden]");
  5191. if("play"==mode){
  5192. if(!hiddenEle.value)return;
  5193. var year=parseInt( hiddenEle.value.split("-")[0]);
  5194. var month=parseInt( hiddenEle.value.split("-")[1]);
  5195. $(hiddenEle).before('<span>'+year+'年('+(month<=6?'春季':'秋季')+')</span>');
  5196. return;
  5197. }
  5198. function editEnrolDate(name){
  5199. var THIS=this;
  5200. this.onchange=null;
  5201. this.getValue=null;
  5202. this.setValue=null;
  5203. this.container=null;
  5204. var hiddenEle=document.querySelector("[name="+name+"][type=hidden]");
  5205. this.element=hiddenEle;
  5206. var yyy=document.querySelector("[name="+name+"_year]");
  5207. var mmm=document.querySelector("[name="+name+"_month]");
  5208. wd.display.filterInputBox(name+"_year",name+"_month");
  5209. var placeholder=hiddenEle.getAttribute("placeholder");
  5210. if(placeholder){
  5211. yyy.setAttribute("placeholder",placeholder);
  5212. }else{//样式特殊处理
  5213. yyy.style.width="30px";
  5214. }
  5215. this.container=yyy.parentNode;
  5216. this.container.style.display="inline";
  5217. var width=hiddenEle.getAttribute("width");
  5218. if(width)yyy.style.width=width;
  5219. this._initYear=function(y){
  5220. yyy.value=y;
  5221. }
  5222. this._initMonth=function(m){
  5223. /* 改,规范 wdValue= 命名。Lin
  5224. $("[name="+name+"_month][type=button][wdValue="+(m<=6?3:9)+"]").trigger("click");
  5225. */ $("[name="+name+"_month][type=button][ssVal="+(m<=6?3:9)+"]").trigger("click");
  5226. }
  5227. var year,month;
  5228. //默认值为当前时间
  5229. if("0"==hiddenEle.value){
  5230. year=new Date().getUTCFullYear();
  5231. month=new Date().getMonth()+1;
  5232. }else if(hiddenEle.value&&hiddenEle.value.split("-").length>0){
  5233. year=parseInt( hiddenEle.value.split("-")[0]);
  5234. month=parseInt( hiddenEle.value.split("-")[1]);
  5235. }else{
  5236. //默认秋季
  5237. month=9;
  5238. }
  5239. if(year){
  5240. this._initYear(year);
  5241. }
  5242. if(month){
  5243. this._initMonth(month);
  5244. }
  5245. function RebuildingValue(){
  5246. var yy=document.querySelector("[name="+name+"_year]").value;
  5247. var mm=document.querySelector("[name="+name+"_month][type=hidden]").value;
  5248. var hiddenvalue="";
  5249. if(yy&&mm){hiddenvalue=yy+"-0"+mm+"-01"}
  5250. console.log(hiddenvalue);
  5251. document.querySelector("[name="+name+"][type=hidden]").value=hiddenvalue;
  5252. if(THIS.onchange)THIS.onchange();
  5253. }
  5254. RebuildingValue();
  5255. $("[name="+name+"_month][type=button]").on("click",RebuildingValue)
  5256. $("[name="+name+"_year][type=text]").on("click",function(){
  5257. wd.edit.datePicker({dateFmt:'yyyy',onpicked:RebuildingValue,oncleared:RebuildingValue,el:this});
  5258. });
  5259. this.setValue=function(v){
  5260. var v_year=v.split("-")[0];
  5261. var v_month=v.split("-")[1];
  5262. THIS._initYear(v_year);
  5263. THIS._initMonth(v_month);
  5264. }
  5265. this.getValue=function(){
  5266. return THIS.element.value;
  5267. }
  5268. }
  5269. if(window.enrolDateList[nameee])return;
  5270. window.enrolDateList[nameee]=new editEnrolDate(nameee);
  5271. }
  5272. window.defaultValueList = window.defaultValueList || {};
  5273. wd.display.inputDefaultValue=function(name,param){
  5274. //xq[rxnd];
  5275. param=param.replace(/]$/,"");
  5276. var pp=param.split(/\[/);
  5277. var dictName=pp[0];
  5278. var dictParam=pp[1];
  5279. if(window.defaultValueList[name])return;
  5280. window.defaultValueList[name]=new (function(name,n,p){
  5281. var THIS=this;
  5282. this.name=name;
  5283. this.dict=n;
  5284. this.dictParam=p;
  5285. this.dictItem=wd.display.getInputBox(p);
  5286. this._change=function(){
  5287. console.log(THIS);
  5288. var v=THIS.dictItem.getValue();
  5289. $.ajax({
  5290. url: "/service?ssServ=defaultValueTranslate",
  5291. data: {
  5292. dict: THIS.dict,
  5293. param: "{"+THIS.dictParam+":"+v+"}"
  5294. },
  5295. async:true,
  5296. dataType: "json",
  5297. success: function (data) {
  5298. wd.display.getInputBox(THIS.name).setValue(data.result);
  5299. }
  5300. });
  5301. }
  5302. this.dictItem.setChange(this._change);
  5303. if(!wd.display.getInputBox(name).getValue()){
  5304. this._change();
  5305. }
  5306. })(name,dictName,dictParam);
  5307. }
  5308. //下载文件
  5309. wd.display.downloadFile=function(path,downloadName){
  5310. var download=downloadName?("download=\""+downloadName+"\""):"";
  5311. $('<a '+download+' href="'+path+'"><span></span></a>').find("span").trigger("click");
  5312. //关闭圈圈
  5313. wd.display.closeLoad();
  5314. //ScreenOver层移除
  5315. $("#ScreenOver").remove();
  5316. }
  5317. //首页图标
  5318. wd.display.setHomeIconName=function(name){
  5319. var ele =wd.topWindow.document.getElementById('mbwzbj');
  5320. if (ele != null&&name) {
  5321. ele.innerHTML =name;
  5322. }
  5323. }
  5324. /**
  5325. *
  5326. * 弹出右键菜单
  5327. *
  5328. * param {
  5329. * leftClick:true//左击弹菜单
  5330. * }
  5331. *
  5332. * wd.display.showContextMenu("body",[{text:"图片",func:function(element){}}]);
  5333. */
  5334. wd.display.showContextMenu=function(selecter,datas,param){
  5335. var options= $.extend({},{leftClick:false},param)
  5336. for(var i=0;i<datas.length;i++){
  5337. datas[i].value=i;
  5338. }
  5339. var id="what_menu"+new Date().getTime();
  5340. var dom = wd.display.initSelectOption(id);
  5341. wd.display.buildSelectOption(dom,datas, "value", "text", null, false);
  5342. $("body").append(dom);
  5343. var $dom=$(dom).css({position:"absolute"}).hide();
  5344. var triggerElement;
  5345. $dom.on("click",".popupList",function(){
  5346. var v=$(this).attr("value");
  5347. datas[v].func.call(triggerElement,triggerElement);
  5348. $dom.hide();
  5349. return false;
  5350. })
  5351. var eventName=options.leftClick?"contextmenu click":"contextmenu";
  5352. $(document).on(eventName,selecter,function(){
  5353. var offset=$(this).offset();
  5354. dom.style.left=(offset.left+window.event.offsetX)+"px";
  5355. dom.style.top =(offset.top+window.event.offsetY)+"px";
  5356. $(dom).show();
  5357. triggerElement=this;
  5358. return false;
  5359. })
  5360. $(document).on("click",function(){
  5361. $dom.hide();
  5362. })
  5363. $(".content-div,.list-div").scroll(function(){
  5364. $dom.hide();
  5365. })
  5366. }