display.js 169 KB

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