display.js 174 KB

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