| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310 |
- if (typeof window.wd == "undefined") {
- window.wd = {};
- }
- if (!wd.display) {
- wd.display = {};
- }
- (function () {
- if (wd.topWindow) return;
- var currParent = window;
- var i = 1;
- while (currParent != top) {
- try {
- currParent.parent[new Date().getMilliseconds()] = 1; // 如果这行不报“没权限错误”,才执行下一行。
- currParent = currParent.parent;
- } catch (e) {
- break;
- }
- }
- /**
- * 得到同域的顶层窗口,不直接用top,是因为有把WD的页面嵌入到OA的作子页面的情形 如果顶层窗口直接用top,当顶层窗口是另一网站时,就会报错。
- */
- wd.topWindow = currParent;
- })();
- if (!wd.topWindow.wd) {
- wd.topWindow.wd = {};
- }
- if (!wd.topWindow.wd.display) {
- wd.topWindow.wd.display = {};
- }
- /*
- * Change log:
- *
- * --02-14-2014-- function name wd.display.showComponent from title = '<span
- * style="font:14px \'宋体\'\;line-height:30px;" >'+title+'</span>'; to title = '<span>'+title+'</span>';
- *
- *
- */
- // 初始化滚动条,by SPACE 2019-01-07
- // 关闭鼠标加载动画, by SPACE 2019-04-02
- $(document).ready(function () {
- // waitThenInitNiceScorll(); 不再使用NiceScorll滚动条 Ben(20260106)
- try {
- wd.display.closeLoad();
- } catch (e) {}
- });
- function waitThenInitNiceScorll() {
- try {
- document.onreadystatechange = function () {
- if (document.readyState == "complete")
- setTimeout("initNiceScorll()", 200);
- else setTimeout("waitThenInitNiceScorll()", 10);
- };
- } catch (e) {
- console.log(e);
- }
- }
- /**
- * 初始化滚动条
- */
- var flag = false;
- var resizeScrollIv;
- function initNiceScroll() {
- try {
- // 流程设计器
- if (
- $("#draw_demo").html() != undefined ||
- $("#draw_demo").html() != null ||
- $("#workFlowDesigner").html() != null
- ) {
- return;
- }
- // 网站设计页
- if ($("#updateDesignWebpageUrl").val() != null) {
- return;
- }
- // 内容播放器
- if ($("#fileProperty").val() != null) {
- return;
- }
- // 大滚动条
- var b = $("body");
- if ($(b).attr("nicescroll")) {
- if ($(b).attr("nicescroll") == "true") {
- loadScorll(b);
- }
- } else {
- loadScorll(b);
- }
- loadScorll($("iframe[name='ssTabIframe']")); // [name='wdTabFrame']。Lin
- loadScorll($(".scrollbar"));
- loadScorll($(".mainDiv"));
- loadScorll($(".content-div"));
- loadScorll(parent.$(".content-div"));
- loadScorll($(".CodeMirror-vscrollbar"));
- var iframe = window.parent.getIframeByElement(document.body);
- var iframeObj = $(iframe);
- // loadScorll(iframeObj);
- // 小滚动条
- loadSmallScorll($(".smallScrollbar"));
- // 0.5秒定时监听滚动条变化
- clearInterval(resizeScrollIv);
- resizeScrollIv = setInterval(function () {
- try {
- $("body").getNiceScroll().resize();
- $("iframe[name='ssTabIframe']").getNiceScroll().resize(); // [name='wdTabFrame']。Lin
- $(".mainDiv").getNiceScroll().resize();
- $(".scrollbar").getNiceScroll().resize();
- $(".content-div").getNiceScroll().resize();
- $(parent.$(".content-div")).getNiceScroll().resize(); // $(iframeObj).getNiceScroll().resize();
- $(".CodeMirror-vscrollbar").getNiceScroll().resize();
- $(".smallScrollbar").getNiceScroll().resize();
- } catch (e) {
- console.error(e);
- }
- }, 500);
- } catch (e) {
- if (!flag) {
- flag = true;
- // 解决页面引入多个 Jquery 导致 not function 的问题
- /* 改。Lin
- $("head").append("<script src=\"/wd/js/nicescroll376/jquery.nicescroll.js\"></script>")
- */
- // $("head").append("<script src=\"/ss/nicescroll/jquery.nicescroll.js\"></script>")
- /* 改。Lin
- $("head").append("<script src=\"/wd/js/nicescroll376/jquery.nicescroll.iframehelper.min.js\"></script>")
- */
- // $("head").append("<script src=\"/ss/nicescroll/jquery.nicescroll.iframehelper.min.js\"></script>")
- clearInterval(resizeScrollIv);
- initNiceScorll();
- }
- }
- }
- function getIframeByElement(element) {
- var iframe;
- $("iframe").each(function () {
- if (element.ownerDocument === this.contentWindow.document) {
- iframe = this;
- }
- return !iframe;
- });
- return iframe;
- }
- // 大滚动条
- function loadScroll(dom) {
- try {
- if ($(dom).attr("wdScroll") == "false") return;
- var hori = $(dom).attr("wdScroll") == "XY";
- $(dom).niceScroll({
- cursorcolor: "#C4C4C4", // 改变滚动条颜色,使用16进制颜色值
- cursorwidth: "6px", // 滚动条的宽度,单位:便素
- cursorborder: "1px solid #C4C4C4", // CSS方式定义滚动条边框
- cursorborderradius: "6px", // 滚动条圆角(像素)
- mousescrollstep: 60, // 鼠标滚轮的滚动速度 (像素)
- touchbehavior: false, // 激活拖拽滚动
- hwacceleration: false, // 激活硬件加速
- autohidemode: "true",
- background: "transparent", // 轨道的背景颜色
- iframeautoresize: true, // 在加载事件时自动重置iframe大小
- spacebarenabled: true, // 当按下空格时使页面向下滚动
- railpadding: {
- top: 0,
- right: 4,
- left: 4,
- bottom: 0,
- }, // 设置轨道的内间距
- horizrailenabled: hori || false, // nicescroll可以管理水平滚动
- railalign: "right", // 对齐垂直轨道
- railvalign: "bottom", // 对齐水平轨道
- preservenativescrolling: true,
- enabletranslate3d: true, // nicescroll 可以使用CSS变型来滚动内容
- enablemousewheel: true, // nicescroll可以管理鼠标滚轮事件
- nativeparentscrolling: false, //检测内容底部,并让父节点来滚动,作为原生滚动
- });
- } catch (e) {
- throw e;
- }
- }
- //初始化小滚动条
- function loadScrollXY(dom) {
- try {
- if ($(dom).attr("wdScroll") == "false") return;
- $(dom).niceScroll({
- cursorcolor: "#C4C4C4", // 改变滚动条颜色,使用16进制颜色值
- cursorwidth: "6px", // 滚动条的宽度,单位:便素
- cursorborder: "1px solid #C4C4C4", // CSS方式定义滚动条边框
- cursorborderradius: "6px", // 滚动条圆角(像素)
- mousescrollstep: 60, // 鼠标滚轮的滚动速度 (像素)
- touchbehavior: false, // 激活拖拽滚动
- hwacceleration: false, // 激活硬件加速
- autohidemode: "true",
- background: "transparent", // 轨道的背景颜色
- iframeautoresize: true, // 在加载事件时自动重置iframe大小
- spacebarenabled: true, // 当按下空格时使页面向下滚动
- railpadding: {
- top: 0,
- right: 4,
- left: 4,
- bottom: 0,
- }, // 设置轨道的内间距
- horizrailenabled: true, // nicescroll可以管理水平滚动
- railalign: "right", // 对齐垂直轨道
- railvalign: "bottom", // 对齐水平轨道
- preservenativescrolling: true,
- enabletranslate3d: true, // nicescroll 可以使用CSS变型来滚动内容
- enablemousewheel: true, // nicescroll可以管理鼠标滚轮事件
- nativeparentscrolling: false, //检测内容底部,并让父节点来滚动,作为原生滚动
- });
- } catch (e) {
- throw e;
- }
- }
- // 小滚动条
- function loadSmallScroll(dom) {
- try {
- $(dom).niceScroll({
- cursorcolor: "#C4C4C4", // 改变滚动条颜色,使用16进制颜色值
- cursorwidth: "1px", // 滚动条的宽度,单位:便素
- cursorborder: "1px solid #C4C4C4", // CSS方式定义滚动条边框
- cursorborderradius: "1px", // 滚动条圆角(像素)
- mousescrollstep: 60, // 鼠标滚轮的滚动速度 (像素)
- touchbehavior: false, // 激活拖拽滚动
- hwacceleration: false, // 激活硬件加速
- background: "transparent", // 轨道的背景颜色
- iframeautoresize: true, // 在加载事件时自动重置iframe大小
- spacebarenabled: true, // 当按下空格时使页面向下滚动
- autohidemode: "true", // leave
- railpadding: {
- top: 0,
- right: 2,
- left: 2,
- bottom: 0,
- }, // 设置轨道的内间距
- horizrailenabled: false, // nicescroll可以管理水平滚动
- railalign: "right", // 对齐垂直轨道
- railvalign: "bottom", // 对齐水平轨道
- enabletranslate3d: true, // nicescroll 可以使用CSS变型来滚动内容
- nativeparentscrolling: false, //检测内容底部,并让父节点来滚动,作为原生滚动
- zindex: "999999",
- });
- } catch (e) {
- console.log(e);
- }
- }
- //原来拼写错误,兼容处理
- var initNiceScorll = initNiceScroll;
- var loadScorll = loadScroll;
- var loadScorllXY = loadScrollXY;
- var loadSmallScorll = loadSmallScroll;
- /*
- * 设置HTML元素属性 @param object o 要设置属性的HTML元素 @param string a 要设置的属性名 @param string
- * v 要设置的属性值
- */
- function setAttribute(o, a, v) {
- if (typeof o != "object" || typeof a != "string") return;
- a == "class" ? (o.className = v) : o.setAttribute(a, v);
- }
- /*
- * 获取HTML元素属性值 @param object o 要获取属性的HTML元素 @param string a 要获取的属性名 @return
- * 返回要获取的属性值
- */
- function getAttribute(o, a) {
- if (typeof o != "object" || typeof a != "string") return;
- return a == "class" ? o.className : o.getAttribute(a);
- }
- /*
- * 移除HTML元素属性 @param object o 要移除属性的HTML元素 @param string a 要移除的属性名
- */
- function removeAttribute(o, a) {
- if (typeof o != "object" || typeof a != "string") return;
- o.removeAttribute(a);
- if (a == "class") o.removeAttribute("className");
- }
- /**
- * 去掉所有的html代码
- */
- wd.display.removeHTMLTag = wd.display.toPlainText = function (str) {
- str = str.replace(/<\/?[^>]*>/g, ""); // 去除HTML tag
- str = str.replace(/[ | ]*\n/g, "\n"); // 去除行尾空白
- // str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
- str = str.replace(/ /gi, ""); // 去掉
- str = str.replace(/\s/g, ""); // 将空格去掉
- return str;
- };
- /**
- * 初始化tr的显示样式
- */
- wd.display.initTrDisplay = function (
- trContainerNameOrId, // tr标签的直接父级标签的name或id
- oddClassName, // 奇数行的tr应用的class类名
- evenClassName, // 偶数行的tr应用的class类名
- onMouseOverClassName
- ) {
- // 鼠标放在tr上时,tr应用的css样式
- var container = wd.c.g(trContainerNameOrId);
- // container 可能为 undefined
- if (!container) return;
- var trs = container.childNodes;
- if (!trs) return;
- var trIndex = 0;
- for (var i = 0; i < trs.length; i++) {
- var oneTr = trs[i];
- if (
- !oneTr.tagName ||
- oneTr.tagName != "TR" ||
- oneTr.style.display == "none"
- )
- continue;
- trIndex++;
- if (trIndex % 2 == 1) {
- // 奇数行的tr应用的class类名
- oneTr.className += " " + oddClassName;
- } else {
- oneTr.className += " " + evenClassName;
- }
- oneTr.oriClassName = oneTr.className;
- var omocn = new RegExp(" " + onMouseOverClassName);
- // console.log(omocn);
- oneTr.onmouseover = function () {
- this.className =
- this.className.replace(omocn, "") + " " + onMouseOverClassName;
- };
- oneTr.onmouseout = function () {
- this.className = this.className.replace(omocn, "");
- };
- }
- };
- wd.display.showDynamicParamDialog = function (url, datas) {
- eval(wd.display.replaceDynamicParam(url.toString(), datas));
- };
- wd.display.createMaskDiv = function (containerObj, currWindow, zIndex) {
- // 创建遮罩层
- var ele = currWindow.document.getElementsByTagName("BODY")[0];
- var newID = new Date().getTime();
- if (!(typeof zIndex != "undefined" && zIndex)) {
- zIndex = 100001;
- }
- var coverDiv = document.createElement("div");
- coverDiv.id = newID;
- // coverDiv.style.cssText = 'display: none;' + 'position: absolute;' +
- // 'top: 0%;' + 'left: 0%;' + 'width: 100%;' + 'height: 100%;' +
- // 'background-color: #EEEEEE;' + '-moz-opacity: 0.5;' +
- // 'opacity: .50;' + 'filter: alpha(opacity=50);';
- coverDiv.setAttribute("class", "wdMaskDiv dialog-mask");
- coverDiv.style.zIndex = zIndex - 1;
- ele.appendChild(coverDiv);
- // coverDiv.style.display = 'block';
- var W =
- currWindow.document.body.scrollLeft +
- currWindow.document.body.scrollWidth ||
- currWindow.document.documentElement.scrollLeft +
- currWindow.document.documentElement.scrollWidth;
- var H =
- currWindow.document.body.scrollTop +
- currWindow.document.body.scrollHeight ||
- currWindow.document.documentElement.scrollTop +
- currWindow.document.documentElement.scrollHeight;
- coverDiv.style.width = W + "px";
- coverDiv.style.height = H + "px";
- var maskContainer = containerObj.mask;
- if (!maskContainer) {
- containerObj.mask = [];
- }
- containerObj.mask.push(newID);
- };
- //按钮 [id,pos,title,label,className]
- wd.display.wdButtons = [
- //功能: 旧UI弹窗右上角按钮图标升级为 icon-base(先改 help/lock/close)by xu 20251223
- ["wdHelp", 3, "帮助", "帮助", "dialog-toolbar-icon icon-help"],
- ["CMS_download", 3, "下载", "下载", "icon-download"],
- ["wdShare", 3, "收藏", "收藏", "icon-favorite"],
- ["wdShared", 3, "已收藏", "已收藏", "icon-favoriteOn"],
- ["editWdHelp", 3, "编辑帮助", "编辑帮助", "icon-setHelp"],
- ["editWdHelp_save", 3, "编辑帮助保存", "编辑帮助保存", "invertIcon-save"],
- //功能: icon-base 图标名调整:编辑选项卡 icon-ptab(弹窗顶部用细体)by xu 20251224
- ["wdTab", 3, "编辑选项卡", "编辑选项卡", "dialog-toolbar-icon icon-ptab"],
- //功能: icon-base 图标名调整:保存选项卡使用 icon-save(不再用 invertIcon-save)by xu 20251225
- [
- "wdTab_save",
- 3,
- "保存选项卡",
- "保存选项卡",
- "invertIcon-save dialog-toolbar-icon icon-save",
- ],
- //功能: icon-base 图标名调整:个人选值 icon-pval(弹窗顶部用细体)by xu 20251224
- ["wdRecord", 3, "个人选值", "个人选值", "dialog-toolbar-icon icon-pval"],
- //功能: icon-base 图标名调整:个人选值保存使用 icon-save(不再用 invertIcon-save)by xu 20251225
- [
- "wdRecord_save",
- 3,
- "个人选值保存",
- "个人选值保存",
- "invertIcon-save dialog-toolbar-icon icon-save",
- ],
- ["CMS_fullscreen", 3, "全屏", "全屏", "dialog-restoreButton"],
- ["CMS_nrProperty", 3, "内容属性", "内容属性", "icon-property"],
- ["change_on", 3, "变动查看-开", "变动查看-开", "dialog-changeOnButton"],
- ["change_off", 3, "变动查看-关", "变动查看-关", "dialog-changeButton"],
- ["lockScreen", 3, "锁定", "锁定", "dialog-toolbar-icon icon-lock"],
- ["wdPrint", 3, "打印", "打印", "icon-print"],
- ["wdBatchPrint", 3, "批量打印", "批量打印", "icon-print"],
- ["wdHelpCopyhexcode", 3, "复制帮助代码", "复制帮助代码", "icon-key"],
- //功能: SsSubTab 菜单模式切换按钮改为按需创建,避免所有弹窗都出现 by xu 20251224
- ];
- wd.display.initStyleWdButtons = function () {
- for (var i = 0; i < wd.display.wdButtons.length; i++) {
- var className = "dhtmlx_button_" + wd.display.wdButtons[i][0] + "_default";
- wd.topWindow
- .$("div.dhtmlx_button_" + wd.display.wdButtons[i][0] + "_default")
- .addClass(wd.display.wdButtons[i][4]);
- }
- // 特殊处理close,因为如果close和dhtmlx的close冲突,会隐藏原生,新增一个按钮
- var className = "dhtmlx_button_close_default";
- //功能: 弹窗关闭按钮使用 icon-base(避免依赖 svg/png)by xu 20251223
- wd.topWindow
- .$("div.dhtmlx_button_close_default")
- .removeClass(className)
- .addClass("dialog-toolbar-close-icon icon-close");
- };
- /**
- * 添加隐藏按钮
- * @param {Object} w
- */
- wd.display.addWdUserButton = function (w) {
- var buttonType = wd.display.wdButtons;
- for (var i = 0; i < buttonType.length; i++) {
- //添加按钮
- w.addUserButton(
- buttonType[i][0],
- buttonType[i][1],
- buttonType[i][2],
- buttonType[i][3],
- buttonType[i][4]
- );
- //隐藏按钮
- w.button(buttonType[i][0]).hide();
- // console.log(buttonType[i][0]+":"+w.button(buttonType[i][0]).isHidden())
- }
- wd.display.initStyleWdButtons();
- };
- wd.display.showAllWdUserButton = function (w, nolimit) {
- //解除限制
- if (nolimit) {
- w.unAllowButton = false;
- } else {
- w.unAllowButton = true;
- }
- var buttonType = wd.display.wdButtons;
- for (var i = 0; i < buttonType.length; i++) {
- if (w.button(buttonType[i][0]).isHidden() == false) {
- w.button(buttonType[i][0]).show();
- }
- }
- };
- wd.display.hideAllWdUserButton = function (w) {
- w.unAllowButton = true;
- var buttonType = wd.display.wdButtons;
- for (var i = 0; i < buttonType.length; i++) {
- w.button(buttonType[i][0]).style.display = "none";
- }
- };
- /**
- * 添加弹窗事件
- * @param {Object} w
- */
- wd.display.addComponentEvent = function (w) {
- // 按钮:设置wdRecord
- w.getFrame().addEventListener(
- "load",
- function () {
- var iframeWindow = w.getFrame().contentWindow;
- if ("0" == iframeWindow.loginStatus) return;
- //wdShare
- var wdShare = function () {
- this.win = null;
- this.button;
- this.init = function (w) {
- this.win = w;
- // var wdDialogWin = iframeWindow.document.querySelector("wdDialog[collect=true]")
- // if (!wdDialogWin)
- // return;
- this.sendRequest(
- "query",
- (function () {
- return function (data) {
- if (data == 1) {
- //已分享
- this.addButton("wdShared");
- } else if (data == 0) {
- //未分享
- this.addButton("wdShare");
- }
- };
- })()
- );
- };
- this.addButton = function (buttontype) {
- var THIS = this;
- //恢复隐藏按钮
- if (
- this.win.button(buttontype) &&
- this.win.button(buttontype) != null
- ) {
- this.win.button(buttontype).show();
- } else {
- // if (buttontype == "wdShared") {
- // this.win.addUserButton(buttontype, 3, "已收藏", "已收藏")
- // } else if (buttontype == "wdShare") {
- // this.win.addUserButton(buttontype, 3, "未收藏", "未收藏")
- // }
- }
- this.win.button(buttontype).onclick = function () {
- THIS.wdshareClick(buttontype);
- };
- };
- this.wdshareClick = function (buttontype) {
- var type;
- //已收藏点击:取消收藏
- //未收藏点击:
- if (buttontype == "wdShared") {
- type = "delete";
- } else if (buttontype == "wdShare") {
- type = "add";
- }
- this.sendRequest(type, function (data) {
- if (data == 1) {
- this.win.button(buttontype).hide();
- this.addButton(buttontype == "wdShared" ? "wdShare" : "wdShared");
- } else if (data == 0) {
- console.log(data);
- } else {
- console.log(data);
- }
- });
- };
- this.sendRequest = function (type, callback) {
- var wdsharetype;
- if (type == "query") {
- wdsharetype = "";
- } else if (type == "add") {
- wdsharetype = 1;
- } else if (type == "delete") {
- wdsharetype = 0;
- } else {
- alert("type 值超出范围:" + type); // ("我是不可能出现的!")。Lin
- }
- var THIS = this;
- $.post(
- "/service?ssServ=wdShare",
- {
- wdsharetype: wdsharetype,
- wdshareurl: iframeWindow.window.location.href,
- },
- function (data) {
- if (callback) {
- callback.call(THIS, data);
- }
- }
- );
- };
- };
- new wdShare().init(w);
- },
- false
- );
- };
- //功能: SsSubTab 菜单模式切换按钮启用(由页面主动调用)by xu 20251223
- wd.display.enableSsSubTabMenuModeButton = function () {
- try {
- var wdDialogId = wd.display.getwdDialogId();
- if (!wdDialogId) return false;
- if (!wd.topWindow || !wd.topWindow.dhxWins) return false;
- var w = wd.topWindow.dhxWins.window(wdDialogId);
- if (!w) return false;
- //功能: 打印调试信息(定位点击无反应问题)by xu 20251224
- try {
- console.log("[SsSubTabMenuMode] enable start, wdDialogId=", wdDialogId);
- } catch (e) {}
- //功能: 获取当前弹窗的 DOM 容器(用于精准定位按钮,避免多弹窗 querySelector 选错)by xu 20251224
- var iframeEl = null;
- //功能: 优先通过 wdDialogId 精确定位 iframe(避免误拿到 SsSubTab 内部 iframe)by xu 20251224
- try {
- var ifs = wd.topWindow.document.getElementsByTagName("IFRAME");
- for (var ii = 0; ii < ifs.length; ii++) {
- var iframeObj = ifs[ii];
- var tempId = iframeObj.getAttribute("wdDialogId");
- if (!tempId && iframeObj.dataset) {
- tempId = iframeObj.dataset["wdDialogId"];
- }
- if (tempId && tempId + "" === wdDialogId + "") {
- iframeEl = iframeObj;
- break;
- }
- }
- } catch (e) {}
- if (!iframeEl) {
- try {
- iframeEl = w.getFrame && w.getFrame();
- } catch (e) {}
- }
- if (!iframeEl) {
- try {
- console.log("[SsSubTabMenuMode] fail: no iframeEl");
- } catch (e) {}
- return false;
- }
- var winEl = null;
- try {
- winEl =
- iframeEl.closest &&
- iframeEl.closest("div.dhtmlx_window_active,div.dhtmlx_window_inactive");
- } catch (e) {}
- if (!winEl) {
- try {
- console.log("[SsSubTabMenuMode] fail: no winEl");
- } catch (e) {}
- return false;
- }
- //功能: 精准获取当前弹窗的按钮 DOM(dhtmlx 会切换 _default/_over_default 等)by xu 20251224
- var btnEl = null;
- try {
- btnEl = winEl.querySelector(
- "div[class*='dhtmlx_button_ssSubTabMenuMode_']"
- );
- } catch (e) {}
- if (!btnEl) {
- //功能: 仅在使用 SsSubTab 的页面按需创建按钮,避免所有弹窗默认带出 by xu 20251224
- //功能: icon-base 图标名调整:弹窗顶部菜单模式按钮使用细体 icon-autoTxt / icon-fix by xu 20251224
- try {
- w.addUserButton(
- "ssSubTabMenuMode",
- 3,
- "菜单模式",
- "菜单模式",
- "dialog-toolbar-icon icon-autoTxt"
- );
- } catch (e) {}
- try {
- wd.display.initStyleWdButtons && wd.display.initStyleWdButtons();
- } catch (e) {}
- try {
- btnEl = winEl.querySelector(
- "div[class*='dhtmlx_button_ssSubTabMenuMode_']"
- );
- } catch (e) {}
- if (!btnEl) {
- // 页面可能还没创建完成,交给调用方重试 by xu 20251224
- try {
- console.log("[SsSubTabMenuMode] fail: button dom not found");
- } catch (e) {}
- return false;
- }
- //功能: 打印调试信息(按钮按需创建成功)by xu 20251224
- try {
- console.log("[SsSubTabMenuMode] button created");
- } catch (e) {}
- }
- var btn = null;
- try {
- btn = w.button && w.button("ssSubTabMenuMode");
- } catch (e) {}
- //功能: 弹窗右上角切换按钮放到最左边(flex 顺序)by xu 20251223
- try {
- var btnContainer = btnEl.parentNode;
- if (
- btnContainer &&
- btnContainer.firstElementChild &&
- btnContainer.firstElementChild !== btnEl
- ) {
- btnContainer.insertBefore(btnEl, btnContainer.firstElementChild);
- }
- } catch (e) {}
- //功能: 旧UI弹窗中使用顶部按钮控制 SsSubTab,隐藏组件内置切换按钮 by xu 20251223
- try {
- document.documentElement &&
- document.documentElement.classList &&
- document.documentElement.classList.add("ss-sub-tab-dialog");
- } catch (e) {}
- // 确保组类存在 by xu 20251223
- try {
- btnEl.classList && btnEl.classList.add("dialog-toolbar-icon");
- } catch (e) {}
- //功能: 获取 iframeWindow(用于 click 时动态拿 API,避免 enable 时机问题)by xu 20251224
- var iframeWindow = null;
- try {
- iframeWindow = iframeEl && iframeEl.contentWindow;
- } catch (e) {}
- if (!iframeWindow) {
- try {
- console.log("[SsSubTabMenuMode] fail: no iframeWindow");
- } catch (e) {}
- return false;
- }
- //功能: 递归在多层 iframe 中查找 SsSubTab API(objPlay -> objInfo -> ss-sub-tab)by xu 20251224
- var findSsSubTabCtx = function (win, depth) {
- //功能 by xu 20251224
- if (!win) return null;
- if (depth > 6) return null;
- try {
- var api =
- (win.SS && win.SS.dom && win.SS.dom.ssSubTabApi) ||
- (win.ss && win.ss.dom && win.ss.dom.ssSubTabApi);
- var left =
- win.document &&
- win.document.querySelector &&
- win.document.querySelector(".project-edit-container .left-side");
- if (api && api.toggleMenuMode && left) {
- return { win: win, api: api, leftSide: left };
- }
- } catch (e) {}
- try {
- var ifs =
- win.document && win.document.getElementsByTagName
- ? win.document.getElementsByTagName("IFRAME")
- : [];
- if (!ifs || !ifs.length) return null;
- // 限制扫描数量,避免极端页面卡顿 by xu 20251224
- var maxScan = Math.min(ifs.length, 30);
- for (var i = 0; i < maxScan; i++) {
- var cw = null;
- try {
- cw = ifs[i].contentWindow;
- } catch (e) {
- cw = null;
- }
- if (!cw) continue;
- var r = findSsSubTabCtx(cw, depth + 1);
- if (r) return r;
- }
- } catch (e) {}
- return null;
- };
- var updateIcon = function () {
- //功能 by xu 20251224
- // dhtmlx hover/active 会切换 class(_default/_over_default 等),这里每次取当前节点 by xu 20251224
- var currentBtnEl = null;
- try {
- currentBtnEl = winEl.querySelector(
- "div[class*='dhtmlx_button_ssSubTabMenuMode_']"
- );
- } catch (e) {}
- if (!currentBtnEl || !currentBtnEl.classList) return;
- //功能: 优先从 topWindow 的 apiMap 取(解决 objPlay->objInfo 这种多层iframe拿不到 SS 的问题)by xu 20251224
- var ctx = null;
- try {
- var apiFromTop =
- wd.topWindow &&
- wd.topWindow.__ssSubTabApiMap &&
- wd.topWindow.__ssSubTabApiMap[wdDialogId];
- if (apiFromTop && apiFromTop.toggleMenuMode) {
- ctx = { api: apiFromTop, leftSide: null };
- }
- } catch (e) {}
- if (!ctx) {
- ctx = findSsSubTabCtx(iframeWindow, 0);
- }
- var mode = "collapse";
- try {
- mode =
- (ctx && ctx.api && ctx.api.getMenuMode && ctx.api.getMenuMode()) ||
- (ctx && ctx.leftSide && ctx.leftSide.getAttribute("data-mode")) ||
- "collapse";
- } catch (e) {}
- currentBtnEl.classList.add("dialog-toolbar-icon");
- //功能: icon-base 图标名调整:弹窗顶部菜单模式按钮 icon-autoTxt / icon-fix by xu 20251224
- currentBtnEl.classList.remove("icon-autoTxt", "icon-fix");
- if (mode === "fixed") {
- currentBtnEl.classList.add("icon-fix");
- currentBtnEl.setAttribute("title", "固定菜单");
- } else {
- currentBtnEl.classList.add("icon-autoTxt");
- currentBtnEl.setAttribute("title", "悬浮菜单");
- }
- };
- //功能: 用事件委托绑定点击(避免 dhtmlx 切换 class/替换节点导致点击失效)by xu 20251224
- try {
- var btnsEl = winEl.querySelector("div.dhtmlx_wins_btns");
- if (btnsEl && btnsEl.getAttribute("data-ss-sub-tab-menu-bound") !== "1") {
- btnsEl.setAttribute("data-ss-sub-tab-menu-bound", "1");
- btnsEl.addEventListener(
- "click",
- function (e) {
- try {
- var t = e && e.target;
- var hit =
- t && t.closest
- ? t.closest("div[class*='dhtmlx_button_ssSubTabMenuMode_']")
- : null;
- if (!hit) return;
- //功能: 优先从 topWindow 的 apiMap 取(解决 objPlay->objInfo)by xu 20251224
- var ctx = null;
- var ssSubTabApi = null;
- try {
- ssSubTabApi =
- wd.topWindow &&
- wd.topWindow.__ssSubTabApiMap &&
- wd.topWindow.__ssSubTabApiMap[wdDialogId];
- } catch (ee) {
- ssSubTabApi = null;
- }
- if (ssSubTabApi && ssSubTabApi.toggleMenuMode) {
- ctx = { api: ssSubTabApi };
- } else {
- ctx = findSsSubTabCtx(iframeWindow, 0);
- ssSubTabApi = ctx && ctx.api;
- }
- if (!ssSubTabApi || !ssSubTabApi.toggleMenuMode) {
- try {
- console.log(
- "[SsSubTabMenuMode] click but api not ready",
- "href=",
- iframeWindow.location && iframeWindow.location.href,
- "foundCtx=",
- !!ctx
- );
- } catch (ee) {}
- return;
- }
- //功能: 打印调试信息(点击事件触发)by xu 20251224
- try {
- console.log(
- "[SsSubTabMenuMode] click, before=",
- ssSubTabApi.getMenuMode && ssSubTabApi.getMenuMode()
- );
- } catch (ee) {}
- try {
- ssSubTabApi.toggleMenuMode();
- } catch (ee) {
- console.log(ee);
- }
- try {
- console.log(
- "[SsSubTabMenuMode] click, after=",
- ssSubTabApi.getMenuMode && ssSubTabApi.getMenuMode()
- );
- } catch (ee) {}
- setTimeout(updateIcon, 0);
- } catch (ee) {
- console.log(ee);
- }
- },
- false
- );
- }
- } catch (e) {}
- updateIcon();
- try {
- btn && btn.show && btn.show();
- } catch (e) {}
- return true;
- } catch (e) {
- console.log(e);
- return false;
- }
- };
- /**
- * 将url中的动态参数替换成指定的值
- * 如果param为空,则参数的值在html元素中寻找,如果param的值不为空,则在param中获取
- * 对于现在的服务调用,采用匹配进行
- * @service{name:"xxx",dest:"xxx",param:{"xxx":"xxx","data":"wdVal{data}"}}@
- * 中的"data":"wdVal{data}"
- * 如果要添加额外变量参数,有两种方法
- * 1.在html中 添加 input标签 name对应 data,把需要的值传入value(即是用element获取) <input name="data">
- * 2.如果是js变量,通过传入json变量覆盖,例:
- * var json = JSON.parse('{"data":"' + encodeURI(obj) + '"}');
- * var url = '@service{name:"cd_ydck",dest:"cd_ydck",show:"wdDialog",param:{"cdydid":"wdVal{data}"}}@';
- * url = wd.display.replaceDynamicParam(url, json);
- * eval(url);
- */
- wd.display.replaceDynamicParam = function (url, param) {
- /* 再改,规范 wdVal{ 命名。Lin
- var reg = /wdVal\{\s*[A-Za-z0-9_]*\s*\}/g;
- */ var reg = /ssVal\{\s*[A-Za-z0-9_]*\s*\}/g;
- //如果没有匹配的动态参数
- if (!reg.test(url)) {
- return url;
- } else {
- var result = url.match(reg);
- for (var i = 0; i < result.length; i++) {
- var source = result[i];
- //获取动态参数的name
- var name = source.trim().substring(6, source.trim().length - 1);
- //增加空字符串的可能性
- if (param && param[name] != undefined) {
- url = url.replace(source, param[name]);
- } else {
- var value = document.getElementsByName(name)[0].value;
- url = url.replace(source, value);
- }
- }
- return url;
- }
- };
- wd.display.Yi = 49;
- wd.display.Xi = 23;
- wd.display.addDialogLine = function (w) {
- if (!w) {
- var wdDialogId = wd.display.getwdDialogId();
- w = wd.topWindow.dhxWins.window(wdDialogId);
- }
- $(w)
- .find(".dhtmlx_wins_body_inner")
- .removeClass("dhtmlx_wins_body_inner_noborder")
- .addClass("dhtmlx_wins_body_inner_border");
- };
- wd.display.removeDialogLine = function (w) {
- if (!w) {
- var wdDialogId = wd.display.getwdDialogId();
- w = wd.topWindow.dhxWins.window(wdDialogId);
- }
- $(w)
- .find(".dhtmlx_wins_body_inner")
- .removeClass("dhtmlx_wins_body_inner_border")
- .addClass("dhtmlx_wins_body_inner_noborder");
- };
- /**
- * 方法中文名:切换DOM元素显示 显示第二个参数数组指定的所有DOM元素,隐藏第三个参数数组指定的所有DOM元素,
- * 第四个参数为选填,如果填了,则第二个参数中的第一个iframe将加载此参数(url)指定的页面
- *
- *
- * demo:
- * 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:""})
- * 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:""})
- *
- */
- wd.display.showComponent = function (params) {
- if (
- typeof beacon != "undefined" &&
- beacon.shouldOpenOtherBrowser &&
- beacon.shouldOpenOtherBrowser()
- ) {
- var url = params.url;
- if (url.startsWith("/")) {
- url = window.location.origin + url;
- }
- beacon.openWindow(params.title, params.width, params.height, url);
- return;
- }
- // 加载鼠标动画 by SPACE 2019-04-02
- wd.display.showLoad();
- //alert(top.window.document.querySelector('iframe[name="win2"]'));
- if (window.event) {
- if (window.event.stopPropagation) {
- window.event.stopPropagation();
- } else {
- window.event.cancelBubble = true;
- }
- }
- var fullScreenLimitHeight = true; // 全屏时窗口的高度与window.innerHeight一致
- var showNameOrId = params.show; // 由需要显示的DOM元素的NAME或ID组成的数组或字符串,注意:
- // 如果含有值’wdDialog’,则弹出dhtmlxWindows窗口,否则只是切换部件显示
- var hideNameOrId = params.hide; // 由需要隐藏的DOM元素的NAME或ID组成的数组或字符串(可选参数,可以不填)
- if (!params["getSize"]) {
- params["getSize"] = "1";
- params["wdDialogId"] = new Date().getTime();
- /* 再改,规范 &token= 命名。Lin
- * IDEA = Redundant character escape '\=' in RegExp
- * IDEA = Redundant character escape '\&' in RegExp
- var exec = /token\=([^\&]*)/.exec(params.url)
- */ var exec = /ssToken=([^&]*)/.exec(params.url);
- if (exec) {
- $.ajax({
- url: "/service?ssServ=loadPageParm",
- data: {
- tokenstring: exec[1],
- },
- async: true,
- timeout: 10000,
- type: "POST",
- dataType: "json",
- error: function (data) {
- console.log(arguments);
- wd.display.showComponent(params);
- },
- success: function (result) {
- params = $.extend(params, result, { title: params.title });
- wd.display.showComponent(params);
- },
- });
- return params["wdDialogId"];
- }
- }
- var url = wd.display.replaceDynamicParam(params.url); // 参数showElemNameOrIdArr中的第一个iframe将加载此URL的页面(可选参数,可以不填)
- var width = (parseInt(params.width) || 100) + this.Xi; // 当要弹出窗口宽度,单位为px
- ///??? 有空再去掉参数 high -- 统一用 height???Lin ///
- var high =
- (parseInt(params.high) || parseInt(params.height) || 100) + this.Yi; // 当要弹出窗口宽度,单位为px
- var showTitle = params.showTitle || false;
- //弹出窗口自适应高度
- if (!!params.minHeight && !!params.maxHeight) {
- params.minHeight = parseInt(params.minHeight);
- params.maxHeight = parseInt(params.maxHeight);
- if (params.minHeight + this.Yi > wd.topWindow.innerHeight) {
- high = params.minHeight + this.Yi;
- showNameOrId = "wdFullScreen";
- fullScreenLimitHeight = false;
- } else if (params.maxHeight + this.Yi < wd.topWindow.innerHeight) {
- high = params.maxHeight + this.Yi;
- } else {
- /* 母体里的,showTitle="false" -- if(showTitle) 成立。Lin
- * PMS 里的 showTitle=false -- if(showTitle) 不成立
- * 先改为 high = wd.topWindow.innerHeight;
- * 先不改 */
- if (showTitle) high = wd.topWindow.innerHeight;
- else showNameOrId = "wdFullScreen";
- }
- }
- url = wd.base.setRowCountPerPage(url, high - this.Yi, width);
- var title = params.title || "无题,可能没找到部件"; // 窗口标题,(可选参数,可以不填)
- var form = params.form; // 需要提交的form名字
- // var wdDialogId = params.wdDialogId;//部件ID
- var wdDialogId = params.wdDialogId || new Date().getTime(); // 部件ID
- wd.display.winWidth = width;
- wd.display.winHeight = high;
- if (form) {
- wd.topWindow.wd.display.targetForm =
- window.document.getElementsByName(form)[0];
- wd.topWindow.wd.display.targetUrl = url;
- url = "/wd/js/cloneForm/cloneForm.jsp";
- }
- if (title) {
- // title = '<span style="font:14px
- // \'宋体\'\;line-height:30px;" >'+title+'</span>';
- title =
- '<span style="padding:5px;">' +
- '<a class="dialog-title" target="_blank" onclick="return false;" href="' +
- url +
- "&wdTitle=" +
- title +
- '">' +
- title +
- "</a>" +
- '<a class="secondTitle" target="_blank" onclick="return false;" href="javascript:void(0);"></a>' +
- "</span>";
- }
- if (showNameOrId) {
- // 如果需要显示部件
- if (typeof showNameOrId != "object") {
- // 如果传入的不是数组
- var arr = [];
- arr.push(showNameOrId);
- showNameOrId = arr; // 统一为数组
- }
- var useUrl = true;
- var hasWdDialog = false;
- for (var i = 0; i < showNameOrId.length; i++) {
- var oneNameOrId = showNameOrId[i];
- if (oneNameOrId == "wdDialog") {
- // 这里应该不是 <wdDialog。Lin
- hasWdDialog = true;
- break;
- }
- }
- for (var i = 0; i < showNameOrId.length; i++) {
- var oneNameOrId = showNameOrId[i];
- var selfParam = oneNameOrId.self;
- var titleParam = oneNameOrId.title;
- var nameParam = oneNameOrId.name;
- var sizeParam = oneNameOrId.size;
- var positionParam = oneNameOrId.position;
- var btnParam = oneNameOrId.button;
- // 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:""})
- if (typeof oneNameOrId == "object") {
- if (oneNameOrId.size) {
- var arr = oneNameOrId.size.split("*");
- var width = parseInt(arr[0]) + 15; // 当要弹出窗口宽度,单位为px
- var high = parseInt(arr[1]) + 38; // 当要弹出窗口宽度,单位为px
- }
- oneNameOrId = oneNameOrId.name;
- }
- var storage = window.localStorage;
- if (oneNameOrId == "wdDialog") {
- // "如果要弹出窗口"。这里应该不是 <wdDialog。Lin
- // 把当前窗口的window对象,保存到wd.topWindow窗口中,以便关闭窗口时使用
- if (!wd.topWindow.wd.display.wdDialogOpeners)
- wd.topWindow.wd.display.wdDialogOpeners = {};
- wd.topWindow.wd.display.wdDialogOpeners[wdDialogId] = window;
- var windowId = wdDialogId;
- // /当前可视区域
- var sw = wd.topWindow.screen.availWidth;
- var sh = wd.topWindow.screen.availHeight;
- // 根据可是区域调整窗口
- var cenFlag = false; // 超过时不居中
- if (width > sw - 20) {
- width = sw - 20;
- }
- if (high > sh - 20) high = sh - 20;
- if (width > sw || high > sh) cenFlag = true;
- // /
- if (!wd.topWindow.dhxWins)
- wd.topWindow.dhxWins = new wd.topWindow.dhtmlXWindows();
- var w = wd.topWindow.dhxWins.createWindow(windowId, 0, 0, width, high);
- w.keepInViewport(true); // 保持在窗口内
- if (!cenFlag) w.center(); // 居中
- w.setText(title); // 设置窗口标题
- //2021-09-06 新增,当url超长时候,改成form提交
- var hasInvalidUrlChar = false;
- var invalidUrlChar = ["{", "}", "[", "]", "|"];
- for (var _ici = 0; _ici < invalidUrlChar.length; _ici++) {
- if (url.indexOf(invalidUrlChar[_ici]) > -1) {
- hasInvalidUrlChar = true;
- break;
- }
- }
- if (hasInvalidUrlChar || (url && url.length > 1000)) {
- hasInvalidUrlChar && console.log("url中有非法字符");
- console.log("触发了form提交表单~,url长度:" + url.length);
- w.attachEvent("onContentLoaded", function () {
- try {
- if (this.getFrame().getAttribute("formload")) {
- return;
- }
- var myDoc = this.getFrame().contentDocument;
- var index = url.indexOf("?");
- index = index < 0 ? url.length - 1 : index;
- var base = url.substring(0, index);
- var params = url.substring(index + 1);
- var paramarr = params.split("&");
- var myform = myDoc.createElement("form");
- myform.setAttribute("action", base);
- myform.setAttribute("method", "post");
- myDoc.body.appendChild(myform);
- for (var pi = 0; pi < paramarr.length; pi++) {
- var pstr = paramarr[pi];
- var pei = pstr.indexOf("=");
- pei = pei < 0 ? pstr.length : pei;
- var k = pstr.substring(0, pei);
- var v = pstr.substring(pei + 1);
- var myInput = myDoc.createElement("input");
- myInput.setAttribute("type", "hidden");
- myInput.setAttribute("name", k);
- myInput.value = decodeURIComponent(v); //可能会有url编码了的情况
- myform.appendChild(myInput);
- }
- myform.submit();
- this.getFrame().setAttribute("formload", "true");
- } catch (e) {
- console.error(e);
- }
- });
- w.attachURL("javascript:false;");
- } else {
- w.attachURL(url); // 跳到此URL
- }
- useUrl = false;
- w.setModal(true); // 设置模式窗口
- w.bringToTop(); // 置顶
- wd.display.addWdUserButton(w);
- wd.display.addComponentEvent(w);
- wd.display.addDialogLine(w);
- // 改变按钮的类样式名
- // var buttonType = wd.display.wdButtons;
- // for (var i = 0; i < buttonType.length; i++) {
- // w.button(buttonType[i][0]).className = "dhtmlx_wins_btns_button " + buttonType[i][4];
- // }
- // 隐藏不需要的按钮
- w.clearIcon();
- if (w.button("help")) w.button("help").hide();
- if (w.button("stick")) w.button("stick").hide();
- if (w.button("sticked")) w.button("sticked").hide();
- if (w.button("park")) w.button("park").hide();
- if (w.button("minmax1"))
- // 隐藏最大化按钮
- w.button("minmax1").hide();
- w.denyResize(); // 不允许改变大小
- // if(w.button('close'))
- // w.button('close').hide();
- // w.btns.help.title = "帮助";
- w.button("close").setAttribute("title", "关闭"); // 修改关闭按钮提示
- var containerObj = wd.topWindow.wd.display;
- var currentDialogZIndex = w.zi; // 弹出窗口的z-index
- wd.display.dxwindowsCreateMaskDiv(currentDialogZIndex);
- w.attachEvent("onClose", function (win) {
- wd.display.dxwindowsCloseMaskDiv();
- /*
- * var parentDialog =
- * wd.topWindow.dhxWins.window(parentWdDialogId); if(typeof
- * parentDialog != 'undefined' && parentDialog ){
- * //parentDialog.button('close').enable(); }
- */
- // var iframeObj = $(win).find('iframe')[0];
- function findIframe(dom) {
- for (var i = 0; i < dom.childNodes.length; i++) {
- var c = dom.childNodes[i];
- if (c.tagName == "IFRAME") {
- return c;
- }
- var temp = findIframe(c);
- if (temp) return temp;
- }
- }
- try {
- var iframeObj = findIframe(win);
- var popWindow = iframeObj.contentWindow;
- // 调用关闭窗口时调用的回调方法
- if (
- typeof popWindow != "undefined" &&
- popWindow.wd.display.closeDialogCallbackFun
- ) {
- popWindow.wd.display.closeDialogCallbackFun();
- }
- wd.display.onCloseDialog(win, popWindow);
- } catch (e) {
- console.log(e);
- }
- return true;
- });
- } else if (oneNameOrId == "wdFullScreen") {
- // 如果只是显示功能部件
- if (!wd.topWindow.dhxWins)
- wd.topWindow.dhxWins = new wd.topWindow.dhtmlXWindows();
- if (!wd.topWindow.wd.display.wdDialogOpeners)
- wd.topWindow.wd.display.wdDialogOpeners = {};
- wd.topWindow.wd.display.wdDialogOpeners[wdDialogId] = window;
- var w = wd.topWindow.dhxWins.createWindow(
- wdDialogId,
- 0,
- 0,
- width,
- high
- );
- w.keepInViewport(true); // 保持在窗口内
- w.attachURL(url); // 跳到此URL
- w.setModal(true); // 设置模式窗口
- w.bringToTop(); // 置顶
- w.setText(title);
- w.clearIcon();
- w.hideMenu();
- w.hideToolbar();
- w.center(); //窗口居中
- wd.display.addWdUserButton(w);
- wd.display.addComponentEvent(w);
- wd.display.hideAllWdUserButton(w);
- wd.display.addDialogLine(w);
- var winbody;
- var Pbtn = w.button("close").parentNode; //关闭按钮的父节点
- var titleline = w.childNodes[0].childNodes[2]; //获取到标题元素
- var btns = w.childNodes[0].childNodes[3];
- var odiv = document.createElement("div"); //创建一个新的元素div,用于存放btn div以及标题的div
- w.childNodes[0].appendChild(odiv);
- odiv.style.height = 43 + "px"; //给新元素进行设置样式
- odiv.style.position = "absolute";
- // odiv.style.display = 'none';
- odiv.id = "odiv";
- odiv.style.top = 0;
- odiv.style.width = "100%";
- odiv.style.backgroundColor = "#ffffff";
- odiv.style.zIndex = -1;
- odiv.setAttribute("class", "hLine");
- w.fullScreen = function () {
- //初始化页面的函数
- var dhwin = wd.topWindow.dhxWins;
- if (fullScreenLimitHeight)
- wd.topWindow.document.body.style.overflow = "hidden";
- dhwin._engineGetWindowLabel(this).style.display = "none";
- // alert(dhwin._engineFixWindowPosInViewport(this));
- var vpw = _isIE ? document.body.offsetWidth : window.innerWidth;
- var vph = _isIE ? document.body.offsetHeight : window.innerHeight;
- // this.h = document.body.clientHeight;
- if (fullScreenLimitHeight)
- this.h = wd.topWindow.document.body.offsetHeight;
- this.y = wd.topWindow.document.body.scrollTop;
- // dhwin._engineFixWindowPosInViewport(this);
- dhwin._engineRedrawWindowSize(this);
- dhwin._engineRedrawWindowPos(this);
- winbody = this.vs[this.av].dhxcont;
- winbody.style.top = 0;
- winbody.style.marginTop = 0;
- winbody.style.height = this.h + "px";
- winbody.childNodes[0].style.height = this.h + "px";
- Pbtn.style.zIndex = 100;
- };
- w.fullScreen();
- Pbtn.onmouseover = function () {
- // console.log(w);
- wd.display.showAllWdUserButton(w, true);
- titleline.style.display = "block"; //把标题的display属性改成block,在初始化的时候全部设置成了none
- odiv.style.zIndex = 99; //通过调整div的层数来对原有的信息进行覆盖
- odiv.style.display = "block";
- titleline.style.zIndex = 100;
- };
- odiv.onmouseover = function () {
- this.style.display = "block";
- this.style.zIndex = 99;
- titleline.style.zIndex = 100;
- };
- titleline.onmouseover = function () {
- odiv.style.zIndex = 99;
- odiv.style.display = "block";
- this.style.zIndex = 100;
- };
- Pbtn.onmouseout = function (e) {
- if (!e) e = window.event;
- var reltg = e.relatedTarget ? e.relatedTarget : e.toElement;
- if (reltg.id != "odiv") {
- odiv.style.zIndex = -1;
- odiv.style.display = "none";
- w.childNodes[0].childNodes[2].style.display = "none"; //鼠标离开时进行还原
- wd.display.hideAllWdUserButton(w);
- } else {
- titleline.style.display = "block";
- }
- };
- odiv.onmouseout = function (e) {
- if (!e) e = window.event;
- var reltg = e.relatedTarget ? e.relatedTarget : e.toElement;
- // if (reltg.className == "dhtmlx_wins_btns_button dhtmlx_button_wdTab_default") { //判定离开新元素是否到了按钮
- // titleline.style.display = "block"
- // } else
- if (reltg.className == "dhtmlx_wins_title") {
- //判定离开了新元素是否到了title元素
- titleline.style.display = "block";
- } else {
- odiv.style.zIndex = -1;
- odiv.style.display = "none";
- w.childNodes[0].childNodes[2].style.display = "none";
- wd.display.hideAllWdUserButton(w);
- }
- };
- titleline.onmouseout = function (e) {
- if (!e) e = window.event;
- var reltg = e.relatedTarget ? e.relatedTarget : e.toElement;
- if (reltg.id == "odiv") {
- titleline.style.display = "block";
- } else {
- odiv.style.zIndex = -1;
- odiv.style.display = "none";
- w.childNodes[0].childNodes[2].style.display = "none"; //鼠标离开时进行还原
- wd.display.hideAllWdUserButton(w);
- }
- };
- wd.display.hideAllWdUserButton(w);
- w.button("close").setAttribute("title", "关闭");
- //以上是对鼠标的走向进行判定
- w.attachEvent("onClose", function (win) {
- wd.topWindow.document.body.style.overflow = "auto";
- wd.display.dxwindowsCloseMaskDiv();
- function findIframe(dom) {
- for (var i = 0; i < dom.childNodes.length; i++) {
- var c = dom.childNodes[i];
- if (c.tagName == "IFRAME") {
- return c;
- }
- var temp = findIframe(c);
- if (temp) return temp;
- }
- }
- try {
- var iframeObj = findIframe(win);
- var popWindow = iframeObj.contentWindow;
- // 调用关闭窗口时调用的回调方法
- if (
- typeof popWindow != "undefined" &&
- popWindow.wd.display.closeDialogCallbackFun
- ) {
- popWindow.wd.display.closeDialogCallbackFun();
- }
- wd.display.onCloseDialog(win, popWindow);
- } catch (e) {
- console.log(e);
- }
- return true;
- });
- var currentDialogZIndex = w.zi;
- wd.display.dxwindowsCreateMaskDiv(currentDialogZIndex);
- } else if (showNameOrId == "wdhelpdialog") {
- console.log("wdhelpdialog");
- if (!wd.topWindow.dhxWins)
- wd.topWindow.dhxWins = new wd.topWindow.dhtmlXWindows();
- if (!wd.topWindow.wd.display.wdDialogOpeners)
- wd.topWindow.wd.display.wdDialogOpeners = {};
- wd.topWindow.wd.display.wdDialogOpeners[wdDialogId] = window;
- var w;
- //判断窗口是否已关闭
- if (wd.topWindow.wdhelpdialog && wd.topWindow.wdhelpdialog.id) {
- w = wd.topWindow.wdhelpdialog;
- } else {
- // x,y控制弹窗口位置
- w = wd.topWindow.dhxWins.createWindow(
- wdDialogId,
- params.x,
- params.y,
- width,
- high
- );
- wd.topWindow.wdhelpdialog = w;
- }
- if (params.center) {
- w.center(); //窗口居中
- }
- w.attachHTMLString(url); // 跳到此URL
- w.keepInViewport(true); // 保持在窗口内
- // w.setModal(true); // 设置模式窗口
- w.bringToTop(); // 置顶
- w.setText(title);
- w.clearIcon();
- // w.denyResize()
- // w.hideMenu();
- // w.hideToolbar();
- wd.display.addWdUserButton(w);
- // w.addUserButton("wdHelp_copyhashcode", 3, "复制代码", "复制代码")
- w.button("wdHelp_copyhashcode").onclick = function () {
- var isRTL = document.documentElement.getAttribute("dir") == "rtl";
- var fakeElem = document.createElement("textarea");
- // Prevent zooming on iOS
- fakeElem.style.fontSize = "12pt";
- // Reset box model
- fakeElem.style.border = "0";
- fakeElem.style.padding = "0";
- fakeElem.style.margin = "0";
- // Move element out of screen horizontally
- fakeElem.style.position = "absolute";
- fakeElem.style[isRTL ? "right" : "left"] = "-9999px";
- // Move element to the same position vertically
- fakeElem.style.top =
- (window.pageYOffset || document.documentElement.scrollTop) + "px";
- fakeElem.setAttribute("readonly", "");
- fakeElem.value = params.helpHaShCode;
- document.body.appendChild(fakeElem);
- fakeElem.select();
- var succeeded;
- try {
- succeeded = document.execCommand("copy");
- alert("复制成功");
- } catch (err) {
- succeeded = false;
- alert("复制失败");
- }
- removeFake(fakeElem);
- return succeeded;
- };
- if (params.pin) {
- //已锁定
- w.denyMove();
- w.button("wdHelp_pin").hide();
- w.button("close").show();
- } else {
- //未锁定
- w.button("wdHelp_unpin").show();
- w.button("close").hide();
- w.allowMove();
- wd.topWindow.setTimeout(function () {
- if (w.isMovable()) {
- w.close();
- }
- }, 3000);
- }
- w.button("wdHelp_unpin").onclick = function () {
- w.button("close").show();
- w.denyMove();
- this.hide();
- w.button("wdHelp_pin").hide();
- };
- w.button("wdHelp_pin").onclick = function () {
- w.button("close").hide();
- w.allowMove();
- this.hide();
- w.button("wdHelp_unpin").hide();
- setTimeout(function () {
- if (w.isMovable()) {
- w.close();
- }
- }, 5000);
- };
- return w.getId();
- }
- }
- } // end if
- if (hideNameOrId) {
- // 如果有需要隐藏的DOM元素
- // 显示所有DOM元素
- for (var i = 0; i < hideNameOrId.length; i++) {
- var elem = wd.c.g(hideElemNameOrIdArr[i], windowObj);
- elem.style.display = "none";
- var p = elem.parentNode;
- if (p && p.tagName == "DIV") {
- p.style.display = "none";
- }
- }
- }
- //允许所有iframe全屏
- var arr = wd.topWindow.document.getElementsByTagName("IFRAME");
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- iframeObj.setAttribute("allowfullscreen", true);
- }
- // w.button("wdHelp").show()
- // w.button("wdShare").show()
- // w.button("wdRecord").show()
- return wdDialogId;
- };
- /**
- *
- * 设置当前iframe部件的长宽
- */
- wd.display.changeDxwindowDimension = function (width, height) {
- //wd.topWindow.dhxWins.
- //刷新弹出本窗口的窗口
- if (null != wd.display.getwdDialogOpener) wd.display.refreshOpener();
- //获得弹出部件window对象,通过创建时的部件id
- var wdDialogId = wd.display.getwdDialogId();
- var win = wd.topWindow.dhxWins.window(wdDialogId);
- //myWins.window(id).setDimension(int width, int height);
- win.setDimension(width, height);
- win.keepInViewport(true); // 保持在窗口内
- win.center(); // 居中
- };
- /**
- *
- * @param {}
- * currentDialogZIndex:当前弹出窗口的zIndex
- */
- wd.display.dxwindowsCreateMaskDiv = function (currentDialogZIndex) {
- var containerObj = wd.topWindow.wd.display;
- var topWindow = wd.topWindow;
- wd.display.createMaskDiv(containerObj, topWindow, currentDialogZIndex);
- };
- // 关闭wddialog时,移除遮罩层
- wd.display.dxwindowsCloseMaskDiv = function () {
- var containerObj = wd.topWindow.wd.display.mask;
- var currentMaskEleID = containerObj.pop();
- var currMaskEle = wd.topWindow.document.getElementById(currentMaskEleID);
- if (typeof currMaskEle != "undefined" && currMaskEle) {
- if (typeof currMaskEle.remove != "undefined") {
- currMaskEle.remove();
- } else {
- currMaskEle.parentNode.removeChild(currMaskEle);
- }
- }
- };
- //获取当前窗口对应的dhxWin对象
- wd.display.getwdDialogWindows = function (dialogid) {
- /**
- * 根据是否找到wdDialogId判断当前页面在弹窗中或应用页面
- *
- */
- var wdDialogId = wd.display.getwdDialogId();
- if (dialogid) wdDialogId = dialogid;
- var win = wd.topWindow.dhxWins.window(wdDialogId);
- return win;
- };
- // 如果当前为通过wdDialog弹出的窗口页面,调用此方法返回包含本窗口的iframe
- wd.display.getwdDialogId = function (winUnderIframe) {
- if (!winUnderIframe) {
- winUnderIframe = window;
- }
- var arr = wd.topWindow.document.getElementsByTagName("IFRAME");
- var wdDialogId = null;
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- var cw = iframeObj.contentWindow;
- var tempId = iframeObj.getAttribute("wdDialogId");
- if (cw == winUnderIframe) {
- if (tempId != null) {
- // 如果找到包含本窗口的iframe,ie走这里
- wdDialogId = tempId;
- break;
- } else if (iframeObj.dataset) {
- // chrome走这里
- if (iframeObj.dataset["wdDialogId"]) {
- wdDialogId = iframeObj.dataset["wdDialogId"];
- break;
- }
- }
- }
- }
- if (!wdDialogId) {
- //最顶层页面跳出循环
- if (winUnderIframe == wd.topWindow) return null;
- wdDialogId = wd.display.getwdDialogId(winUnderIframe.parent);
- }
- return wdDialogId;
- };
- // 如果当前为通过wdDialog弹出的窗口页面,调用此方法返回弹出本窗口的原窗口window对象
- wd.display.getwdDialogOpener = function () {
- var wdDialogId = wd.display.getwdDialogId();
- return wd.topWindow.wd.display.wdDialogOpeners[wdDialogId];
- };
- // 刷新弹出本窗口的窗口
- wd.display.refreshOpener = function () {
- // //全屏模式下,按确定按钮关闭全屏模式
- // var fullFiv = wd.topWindow.document.querySelector("#wdfullscreen");
- // if (fullFiv) {
- // fullFiv.parentNode.removeChild(fullFiv);
- // }
- try {
- // 刷新原窗口页面
- var wdDialogOpener = wd.display.getwdDialogOpener(); // 获得原窗口window对象
- if (wd.topWindow == wdDialogOpener) {
- return;
- }
- //执行自定义刷新方法(需要打开窗口定义wdRefresh)
- if (wdDialogOpener.wdRefresh) {
- wdDialogOpener.wdRefresh();
- return;
- }
- //执行默认刷新方法
- var forms = wdDialogOpener.document.getElementsByTagName("FORM");
- //提交表单
- if (forms && forms.length > 0 && forms[0].action) {
- if (forms.length == 1) {
- var f = forms[0];
- f.submit();
- }
- //刷新个人首页部件
- } else {
- if (
- typeof wdDialogOpener.SYBJCTRL != "undefined" &&
- wdDialogOpener.SYBJCTRL
- ) {
- // 个人首页分支 by Rd 2016-01-13
- // 通过刷新调用窗口的部件来替代刷新整个调用窗口
- wdDialogOpener.SYBJCTRL.EventCtrl.FlushBj();
- } else {
- wdDialogOpener.location.reload();
- }
- }
- } catch (e) {
- console.log(e);
- }
- };
- // 关闭弹出窗口
- wd.display.closeDialog = function () {
- try {
- if (typeof beacon != "undefined") beacon.beaconCloseWindow();
- } catch (e) {
- console.error(e);
- }
- var wdDialogId = wd.display.getwdDialogId();
- // console.log(wdDialogId);
- // console.log(wd.topWindow.dhxWins.window(wdDialogId));
- // 关闭鼠标加载动画 by SPACE 2019-04-02
- wd.display.closeLoad();
- // 关闭本弹出窗口
- wd.topWindow.dhxWins.window(wdDialogId).close();
- };
- /**
- * 改变对象的样式
- * event:监听事件的参数--{eventIds:['1','2'],styleName:{onclick:'样式名1',onmouseover:'样式名2',onmouseout:'样式名3'}}
- * eventIds: 监听事件的id数组
- * styleName:样式名(className),[0]是获得点击后样式名,[1]是鼠标移过时的样式名,[2]是对象默认的样式
- */
- wd.display.changeTabStyle = function (param) {
- /**
- * 绑定监听事件 eventIds:绑定事件的id数组, eventType:绑定的事件--onclick,onmouseout等,
- * styleName:样式的类名
- */
- var objClick = new Object();
- objClick.clickId = null;
- objClick.mouseoverId = null;
- function onEvent(tabIds, eventType, styleNames) {
- // try{
- if (eventType == "onclick") {
- for (var key in tabIds) {
- var tagId = document.getElementById(tabIds[key]);
- (function (key) {
- wd.c.addEventListener(tagId, eventType, function () {
- setTabCssToNormal();
- var objById = this;
- var objFocus = document.activeElement;
- objById.className = styleNames.onclick;
- objClick.clickId = tabIds[key];
- });
- })(key);
- }
- } else if (eventType == "onmouseover") {
- for (var key in tabIds) {
- var tagId = document.getElementById(tabIds[key]);
- (function (key) {
- wd.c.addEventListener(tagId, eventType, function () {
- var objById = document.getElementById(tabIds[key]);
- if (tabIds[key] == objClick.clickId) {
- return;
- }
- objById.className = styleNames.onmouseover;
- objClick.mouseoverId = tabIds[key];
- });
- })(key);
- }
- } else if (eventType == "onmouseout") {
- for (var key in tabIds) {
- var tagId = document.getElementById(tabIds[key]);
- (function (key) {
- wd.c.addEventListener(tagId, eventType, function () {
- var objById = document.getElementById(tabIds[key]);
- if (tabIds[key] == objClick.clickId) {
- return;
- }
- objById.className = styleNames.normal;
- });
- })(key);
- }
- }
- /**
- * }catch(e){ alert("创建监听事件错误:"+e.message+" Type:"+e.name); }
- */
- }
- // -----------------------
- var tabIds = param.tabIds;
- var styleNames = param.styleNames;
- onEvent(tabIds, "onclick", styleNames);
- onEvent(tabIds, "onmouseover", styleNames);
- onEvent(tabIds, "onmouseout", styleNames);
- function setTabCssToNormal() {
- for (var i = 0; i < tabIds.length; i++) {
- var tabId = tabIds[i];
- document.getElementById(tabId).className = styleNames.normal;
- }
- }
- // 设置默认对象
- function setTabCssToNormalDefault() {
- for (var i = 0; i < tabIds.length; i++) {
- var tabId = tabIds[i];
- if (i == 0) {
- document.getElementById(tabId).className = styleNames.onclick;
- objClick.clickId = tabId;
- // objClick.clickId = tabId;
- } else {
- document.getElementById(tabId).className = styleNames.normal;
- }
- }
- }
- setTabCssToNormalDefault();
- };
- // 把当前窗口的window对象,保存到指定的窗口中,以便关闭窗口时使用
- wd.display.windowToObj = function (Ele) {
- if (!Ele.dom.wdDialogOpeners) Ele.dom.wdDialogOpeners = {};
- Ele.dom.wdDialogOpeners[Ele.wdDialogId] = window;
- };
- // 为dhtmlXWindows设置参数,创建窗口
- wd.display.setDhtmlXWinParam = function (winParam) {
- var windowId = winParam.wdDialogId;
- // /当前可视区域
- var sw = winParam.dom.document.body.offsetWidth;
- var sh = winParam.dom.document.body.offsetHeight;
- var positionParam = winParam.positionParam;
- var btnParam = winParam.btnParam;
- var sizeParam = winParam.sizeParam;
- var winWid;
- var winHeg;
- // 根据可是区域调整窗口
- var cenFlag = false; // 超过时不居中
- // 处理x,y
- if (positionParam) {
- var win_X = positionParam.split(",")[0];
- var win_Y = positionParam.split(",")[1];
- } else {
- cenFlag = true; // 居中
- }
- // 处理size属性
- if (!sizeParam) {
- // 用户不填写size属性
- winWid = wd.display.getDialogWidAndHei(wd.display.winWidth);
- winHeg = wd.display.getDialogWidAndHei(wd.display.winHeight);
- } else if ("max" == sizeParam) {
- // 这里设置的win
- // size是还原状态下的窗口大小,后面会直接调用控件的最大化方法
- if (wd.topWindow == winParam.dom) {
- winWidth = wd.topWindow.document.body.offsetWidth;
- winHeight = wd.topWindow.document.body.offsetHeight;
- } else {
- winWidth = document.body.offsetWidth;
- winHeight = document.body.offsetHeight;
- }
- winWid = wd.display.getDialogWidAndHei(winWidth);
- winHeg = wd.display.getDialogWidAndHei(winHeight);
- } else {
- winWid = wd.display.getDialogWidAndHei(
- sizeParam.split("*")[0],
- document.body.offsetWidth
- );
- winHeg = wd.display.getDialogWidAndHei(
- sizeParam.split("*")[1],
- document.body.offsetHeight
- );
- }
- // if(winParam.dom.width < winWid || winParam.dom.heigh < winHeg)
- // cenFlag=true;
- if (positionParam) {
- var w = winParam.dom.dhxWins.createWindow(
- windowId,
- parseInt(win_X),
- parseInt(win_Y),
- winWid,
- winHeg
- );
- } else {
- var w = winParam.dom.dhxWins.createWindow(windowId, 0, 0, winWid, winHeg);
- }
- w.keepInViewport(true); // 保持在窗口内
- if (cenFlag) w.center(); // 居中
- if (winParam.title) w.setText(winParam.title); // 设置窗口标题
- w.attachURL(winParam.url); // 跳到此URL
- useUrl = false;
- w.setModal(true); // 设置模式窗口
- w.bringToTop(); // 置顶
- // 隐藏不需要的按钮
- wd.display.showDialogBtn(w, btnParam);
- if ("max" == sizeParam) {
- w.maximize();
- }
- // if(w.button('help'))
- // w.button('help').hide();
- // if(w.button('stick'))
- // w.button('stick').hide();
- // if(w.button('sticked'))
- // w.button('sticked').hide();
- // if(w.button('park'))
- // w.button('park').hide();
- };
- // 处理弹出窗口的大小
- // 分为3中情况:数字*数字;max*数字;max
- wd.display.getDialogWidAndHei = function (p, wp) {
- if (p == "max") {
- p = wp;
- }
- return parseInt(p);
- };
- // 处理弹出窗口的按钮
- wd.display.showDialogBtn = function (w, btnParam) {
- if (w.button("help")) w.button("help").hide();
- if (w.button("stick")) w.button("stick").hide();
- if (w.button("sticked")) w.button("sticked").hide();
- if (w.button("park")) w.button("park").hide();
- if (w.button("minmax1")) w.button("minmax1").hide();
- w.button("minmax2").hide();
- if (w.button("close")) w.button("close").hide();
- if (btnParam) {
- if (btnParam.indexOf("min") >= 0) {
- w.button("park").show();
- }
- if (btnParam.indexOf("max") >= 0) {
- if (w.isMaximized()) w.button("minmax2").show();
- else w.button("minmax1").show();
- }
- if (btnParam.indexOf("close") >= 0) {
- w.button("close").show();
- }
- } else {
- // 用户没填写的话,默认值为“max,close”
- if (w.isMaximized()) w.button("minmax2").show();
- else w.button("minmax1").show();
- w.button("close").show();
- }
- };
- /**
- * 把名为frameName的frame的src属性置为url
- */
- wd.display.changeFrameSrc = function (frameName, url) {
- document.getElementsByName(frameName)[0].src = url;
- };
- wd.display.wdTabNo = wd.display.defaultTabNo = 1; //默认的tab索引值
- // 初始化tab的总方法
- wd.display.initTab = function () {
- (function () {
- var tab = function () {
- this.dom = null;
- this.wdTabFrame = null;
- this.wdTabList = [];
- this.wdSecondaryTab = [];
- this.styles = {
- wdNormalClass: null,
- wdSelectedClass: null,
- wdNormalMoreClass: null,
- wdSelectedMoreClass: null,
- };
- this.selectTab = null;
- this.mouseoutid = null;
- var li = function () {
- this.topSide = null;
- this.dom = null;
- this.type = null; //1:普通,2,显示隐藏开关,3,二级选项
- this.parent = null;
- this.ul = null;
- this.url; //点击刷新iframe的地址
- this.secondaryTabList = [];
- //独立
- this.init = function (ele, type, topside, styles) {
- //二级的顶层
- this.dom = ele;
- this.url = this.dom.getAttribute("ssTabClick"); // ("wdTabClick")。Lin
- this.setTopSide(topside);
- this.type = type;
- this.setStyle(styles);
- // this.dom.setAttribute("class", this.wdNormalClass)
- this.initEvent();
- return this;
- };
- //初始化样式属性
- this.setStyle = function (styles) {
- this.styles = styles;
- if (this.type == 1) {
- } else if (this.type == 2) {
- //初始二级的选项
- this.initSecondaryTap();
- $(this.dom).children("ul").addClass("popup-div").css({
- position: "absolute",
- });
- } else if (this.type == 3) {
- this.dom.style.list_style_type = "none";
- $(this.dom).attr("class", "");
- $(this.dom).addClass(styles.wdNormalMoreClass);
- }
- $(this.dom)
- .removeClass(styles.wdSelectedClass)
- .addClass(styles.wdNormalClass);
- return this;
- };
- //绑定事件初始化
- this.initEvent = function () {
- this.dom.addEventListener("click", this.mouseClickEvent(), false);
- this.dom.addEventListener("mouseover", this.mouseOverEvent(), false);
- this.dom.addEventListener("mouseout", this.mouseOutEvent(), false);
- };
- this.initSecondaryTap = function () {
- var newStyles = $.extend({}, this.styles);
- newStyles.wdNormalClass = this.styles.wdNormalMoreClass;
- newStyles.wdSelectedClass = this.styles.wdSelectedMoreClass;
- var result = [];
- //显示隐藏的位置
- var ul = this.dom.getElementsByTagName("ul")[0];
- if (ul == null) return;
- this.ul = ul;
- ul.style.display = "none";
- var childNodes = ul.childNodes;
- for (var i = 0; i < childNodes.length; i++) {
- var nod = childNodes[i];
- if (nod.nodeType == 1) {
- if (nod.hasAttribute("ssTabClick")) {
- // ("wdtabclick"))。先改,是 wdtabclick,不是 wdTabClick。Lin
- var liobj = new li();
- liobj.init(nod, 3, this.topSide, newStyles);
- result.push(nod);
- }
- }
- }
- this.secondaryTabList = result;
- };
- //设置根
- this.setTopSide = function (obj) {
- this.topSide = obj;
- };
- this.mouseClickEvent = function () {
- var THIS = this;
- return function () {
- //编辑选项卡状态
- if ("1" == THIS.topSide.dom.getAttribute("editing")) {
- return true;
- }
- //清除上次点击
- if (THIS.type != 2 && THIS.topSide.selectTab) {
- $(THIS.topSide.selectTab.dom)
- .removeClass(THIS.topSide.selectTab.styles.wdSelectedClass)
- .addClass(THIS.topSide.selectTab.styles.wdNormalClass);
- // THIS.topSide.selectTab.dom.setAttribute("class", THIS.topSide.selectTab.wdNormalClass)
- THIS.topSide.selectTab = null;
- }
- THIS.topSide.selectTab = THIS;
- THIS.url = THIS.dom.getAttribute("ssTabClick"); // ("wdTabClick")。Lin
- if (THIS.type == 1 || THIS.type == 3) {
- // THIS.topSide.wdTabFrame.src = THIS.url;
- THIS.topSide.wdTabFrame.src = wd.base.setRowCountPerPage(
- THIS.url,
- THIS.topSide.wdTabFrame.offsetHeight
- );
- $(THIS.dom)
- .removeClass(THIS.styles.wdNormalClass)
- .addClass(THIS.styles.wdSelectedClass);
- // THIS.dom.setAttribute("class", THIS.wdSelectedClass);
- } else if (THIS.type == 2) {
- if (THIS.ul) {
- if (THIS.ul.style.display == "none") {
- THIS.ul.style.display = "";
- } else {
- THIS.ul.style.display = "none";
- }
- }
- }
- /**
- * 找不到原来说的点击tab之后更多变成tab对应的名字
- */
- var secondarytab = document.querySelector(
- '[wdsecondarytab="true"]'
- );
- if (secondarytab) {
- var type = THIS.type;
- if (type != 2) {
- $(secondarytab).children(":not(ul)").remove();
- $(secondarytab)
- .contents()
- .filter(function () {
- if (this.nodeType == 3) return true;
- })
- .remove();
- }
- var firstNode = secondarytab.firstChild;
- switch (type) {
- case 1:
- var moreNode = document.createTextNode("更多");
- if (firstNode.nodeType == 3) {
- secondarytab.replaceChild(moreNode, firstNode);
- } else {
- secondarytab.insertBefore(moreNode, firstNode);
- }
- secondarytab.currentSelectedItem = null;
- //删除小黄点
- $(secondarytab).children(".statePoint").remove();
- break;
- case 2:
- //“更多”被点击
- if (secondarytab.currentSelectedItem) {
- secondarytab.currentSelectedItem.dom.click();
- }
- break;
- case 3:
- //复制小黄点
- if ($(THIS.dom).find(".statePoint").length > 0) {
- $(secondarytab).prepend(
- $(THIS.dom).find(".statePoint").clone()
- );
- }
- $(secondarytab).prepend(
- document.createTextNode(
- $(THIS.dom).contents().text() + "..."
- )
- );
- secondarytab.currentSelectedItem = THIS;
- break;
- }
- }
- };
- };
- this.mouseOverEvent = function () {
- var THIS = this;
- return function () {
- if ("1" == THIS.topSide.dom.getAttribute("editing")) {
- return true;
- }
- if (THIS.type == 2) {
- if (THIS.ul) THIS.ul.style.display = "block";
- //THIS.dom.getElementsByTagName("ul")[0]
- if (THIS.topSide.mouseoutid)
- clearTimeout(THIS.topSide.mouseoutid);
- THIS.topSide.mouseoutid = null;
- }
- };
- };
- this.mouseOutEvent = function () {
- var THIS = this;
- return function () {
- if ("1" == THIS.topSide.dom.getAttribute("editing")) {
- return true;
- }
- if (THIS.topSide.selectTab != THIS) {
- $(THIS.dom)
- .removeClass(THIS.styles.wdSelectedClass)
- .addClass(THIS.styles.wdNormalClass);
- }
- // if (THIS.type == 2 && THIS.ul && THIS.ul.style.display == "") {
- // THIS.ul.style.display = "none"
- // }
- if (THIS.type == 2) {
- var pos = THIS.dom.compareDocumentPosition(
- window.event.relatedTarget
- );
- if (pos == 10 || pos == 4) {
- if ("true" == THIS.dom.getAttribute("wdSecondaryTab")) {
- if (THIS.topSide.mouseoutid)
- clearTimeout(THIS.topSide.mouseoutid);
- THIS.topSide.mouseoutid = null;
- THIS.topSide.mouseoutid = setTimeout(function () {
- THIS.ul.style.display = "none";
- }, 800);
- }
- }
- }
- };
- };
- };
- this.init = function (dom) {
- this.dom = dom;
- //原为 this.wdTabFrame = document.getElementsByTagName("iframe")[0]
- this.wdTabFrame =
- document.querySelector('iframe[name="ssTabIframe"]') || // [name="wdTabFrame"]。Lin
- document.getElementsByTagName("iframe")[0];
- this.wdTabFrame.tabObj = this; //为了获取当前选中的tab来刷新当前的iframe
- /* 改,规范命名。Lin
- * wdNormalClass > ssNormClazz
- * 去掉 wdNomalClass
- * wdSelectedClass > ssSelClazz
- this.styles.wdNormalClass = this.dom.getAttribute("wdNormalClass") || this.dom.getAttribute("wdNomalClass");
- this.styles.wdSelectedClass = this.dom.getAttribute("wdSelectedClass");
- */
- this.styles.wdNormalClass = this.dom.getAttribute("ssNormClazz");
- this.styles.wdSelectedClass = this.dom.getAttribute("ssSelClazz");
- var parentiframe = window.parent.document.querySelector("iframe");
- if (parentiframe.tabObj) {
- //双层选项卡
- if (this.styles.wdSelectedClass != "lightTab-selected")
- this.styles.wdSelectedClass += " lightTab-selected";
- if (this.styles.wdNormalClass != "lightTab")
- this.styles.wdNormalClass += " lightTab";
- this.dom.style =
- "height:33px;padding-left: 14px;box-sizing:border-box";
- } else {
- if (this.styles.wdSelectedClass != "tab-selected")
- this.styles.wdSelectedClass += " tab-selected";
- if (this.styles.wdNormalClass != "tab")
- this.styles.wdNormalClass += " tab";
- }
- this.styles.wdNormalMoreClass = "popupList";
- this.styles.wdSelectedMoreClass = "popupList";
- //初始化
- var child = this.findChildLi();
- var secondLi;
- for (var i = 0; i < child.length; i++) {
- var type = 1;
- if (child[i].hasAttribute("wdSecondaryTab")) {
- type = 2;
- }
- var liobj = new li();
- liobj.init(child[i], type, this, this.styles);
- if (type == 2) {
- secondLi = liobj;
- }
- this.wdTabList.push(liobj);
- }
- //超出显示范围,就显示出更多选项卡 start
- var wholewidth = 0;
- var domwidth = $(dom).width();
- for (var i = 0; i < this.wdTabList.length; i++) {
- var w = this.wdTabList[i].dom.offsetWidth;
- wholewidth += w;
- }
- if (wholewidth > domwidth) {
- secondLi.dom.style.display = "";
- domwidth -= secondLi.dom.offsetWidth * 2;
- var fistgroup = [];
- var secondgroup = [];
- var thirdgroup = [];
- wholewidth = 0;
- for (var i = 0; i < this.wdTabList.length; i++) {
- wholewidth += this.wdTabList[i].dom.offsetWidth;
- var t = this.wdTabList[i].type;
- if (t == 2) {
- secondgroup.push(this.wdTabList[i]);
- continue;
- }
- if (wholewidth > domwidth) {
- thirdgroup.push(this.wdTabList[i]);
- this.wdTabList[i].type = 3;
- var oo = $.extend({}, this.wdTabList[i].styles, {
- wdNormalClass: this.wdTabList[i].styles.wdNormalMoreClass,
- wdSelectedClass: this.wdTabList[i].styles.wdNormalMoreClass,
- });
- this.wdTabList[i].setStyle(oo);
- $(this.wdTabList[i].dom).prependTo(secondLi.ul);
- } else {
- fistgroup.push(this.wdTabList[i]);
- }
- }
- this.wdTabList = fistgroup.concat(secondgroup);
- secondLi.secondaryTabList = thirdgroup.concat(
- secondLi.secondaryTabList
- );
- }
- //超出显示范围,就显示出更多选项卡 end
- this.selectClick(wd.display.wdTabNo);
- return this;
- };
- this.findChildLi = function () {
- var result = [];
- var childNodes = this.dom.childNodes;
- for (var i = 0; i < childNodes.length; i++) {
- var nod = childNodes[i];
- if (nod.nodeType == 1) {
- /* 再改,规范 <li wdTabClick= 命名。Lin
- * 先改,是 wdtabclick,不是 wdTabClick
- * wdSecondaryTab,应该没有了 -- 没有 更多...
- if (nod.hasAttribute("wdtabclick") || nod.hasAttribute("wdSecondaryTab")) {
- */ if (nod.hasAttribute("ssTabClick") || nod.hasAttribute("wdSecondaryTab")) {
- result.push(nod);
- }
- }
- }
- return result;
- };
- //指定第几个tab点击
- this.selectClick = function (no) {
- var num = no || 1;
- var childLength = 0;
- var child = this.findChildLi();
- if (child.length == 0) return;
- for (var i = 0; i < child.length; i++) {
- if (child[i].hasAttribute("wdSecondaryTab")) {
- } else {
- childLength++;
- }
- }
- num = isNaN(num) || num > childLength ? wd.display.defaultTabNo : num;
- if (childLength == 0) {
- var cc = $(child[0])
- .find("li")
- .filter(function () {
- return this.style != "none";
- })
- .first();
- if (cc.length == 1) cc[0].click();
- //隐藏更多
- $(child[0]).find("#tabOption").hide();
- } else if (num > childLength) {
- child[0].click();
- } else {
- child[num - 1].click();
- }
- };
- };
- //从wdTabClick的元素顶层初始化
- var initList = document.querySelectorAll("[ssTabClick]"); // ("[wdTabClick]")。Lin
- var tabobj;
- if (initList.length > 0) {
- if ("tabOption" == initList[0].parentNode.getAttribute("id")) {
- tabobj = new tab().init(initList[0].parentNode.parentNode.parentNode);
- } else {
- tabobj = new tab().init(initList[0].parentNode);
- }
- }
- window.tabobj = tabobj;
- })();
- };
- wd.display.getTabInstance = function () {
- return window.tabobj;
- };
- /**
- * 打印指定div等内容,可多个selector
- */
- wd.display.printArea = function (selector, noscroll, options) {
- var jqsrc = "/wd/js/jquery/jquery.js";
- var printsrc = "/wd/js/print/jquery.PrintArea.js";
- if (typeof $ + "" == "undefined") {
- loadScript(jqsrc, "jquery", function () {
- loadAndPrint();
- });
- } else {
- loadAndPrint();
- }
- function loadAndPrint() {
- if (typeof $.PrintArea + "" == "undefined") {
- loadScript(printsrc, "print", function () {
- options = options || {
- mode: "iframe",
- popClose: false,
- extraCss: "",
- retainAttr: ["class", "id", "style", "on"],
- extraHead:
- '<meta charset="utf-8" />,<meta http-equiv="X-UA-Compatible" content="IE=edge"/>',
- };
- if (noscroll) $(selector).css("overflow", "");
- $(selector).append($("link").clone());
- $(selector).append($("style").clone());
- try {
- $(selector).printArea(options);
- } catch (e) {
- alert("打印出错,检查打印窗是否被拦截");
- console.error(e);
- }
- });
- } else {
- if (noscroll) $(selector).css("overflow", "");
- $(selector).append($("link").clone());
- $(selector).append($("style").clone());
- try {
- $(selector).printArea(options);
- } catch (e) {
- alert("打印出错,检查打印窗是否被拦截");
- console.error(e);
- }
- }
- }
- };
- /**
- *
- * @param {Object}
- * output
- * @param {Object}
- * wdurl
- */
- wd.display.qrcode = function (output, wdurl, width, height, render) {
- // console.log($().qrcode);
- // if (typeof $ + "" == "undefined") {
- // loadScript("/wd/js/jquery/jquery.js", "jquery~", function() {
- // wd.display.qrcode(output, wdurl, width, height, render);
- // });
- // } else {
- // if (!$().qrcode)
- // loadScript("/wd/js/qrcode/jquery.qrcode.js", "qrcode1", function() {
- // loadScript("/wd/js/qrcode/qrcode.js", "qrcode2", function() {
- // wd.display.qrcode(output, wdurl, width, height, render);
- // });
- // });
- // else {
- var option = {
- render: render || "table",
- text: wdurl.toString(),
- width: width || "200",
- height: height || "200",
- };
- $(output).find(".qrcode").remove();
- $(output).append("<div class='qrcode'></div>");
- $(output).find(".qrcode").qrcode(option);
- // }
- // }
- };
- /**
- * 改变dom元素的背景图片
- * 但css中的背景图片的url必须如下:url(./img/background.jpg?wdHelpImage=changebg.jpg)
- *
- * @param domId
- * 需要改变背景图片的dom元素id
- */
- wd.display.changeBackgroundImage = function (domId) {
- var domElement = document.getElementById(domId);
- var cssStr = getClass(domElement, "backgroundImage");
- cssStr = cssStr.substring(4, cssStr.length - 1);
- cssStr = cssStr.replace(/http:\/\/([^\s\/])+/, "");
- var imgPath = cssStr.substring(0, cssStr.lastIndexOf("?"));
- if (cssStr.lastIndexOf("?") != -1) {
- imgPath = imgPath.substring(0, imgPath.lastIndexOf("/") + 1); // 图片所在的文件位置
- var changeImgStartIndex = cssStr.lastIndexOf("=") + 1;
- var changeImg = cssStr.substring(
- parseInt(changeImgStartIndex),
- parseInt(cssStr.length)
- );
- var oldUrl = cssStr.substring(0, cssStr.lastIndexOf("?"));
- var oldImg = oldUrl.substring(oldUrl.lastIndexOf("/") + 1);
- changeImg = imgPath + changeImg;
- changeImg = changeImg.replace(/\"/g, "");
- var imgUrl = "url(" + changeImg + "?background=" + oldImg + ")"; // 图片URL
- domElement.style.backgroundImage = imgUrl;
- }
- function getClass(obj, attr) {
- if (obj.currentStyle) {
- if (attr == "backgroundPosition") {
- return (
- obj.currentStyle.backgroundPositionX +
- " " +
- obj.currentStyle.backgroundPositionY
- );
- } else {
- return obj.currentStyle[attr];
- }
- } else {
- return document.defaultView.getComputedStyle(obj, null)[attr];
- }
- }
- };
- /**
- * 改变dom元素的背景图片
- * 但css中的背景图片的url必须如下:url(./img/background.jpg?wdHelpImage=changebg.jpg)
- *
- * @param domId
- * 需要改变背景图片的dom元素id
- */
- wd.display.changeBackgroundImage = function (domId) {
- var domElement = document.getElementById(domId);
- var cssStr = getClass(domElement, "backgroundImage");
- cssStr = cssStr.substring(4, cssStr.length - 1);
- cssStr = cssStr.replace(/http:\/\/([^\s\/])+/, "");
- var imgPath = cssStr.substring(0, cssStr.lastIndexOf("?"));
- if (cssStr.lastIndexOf("?") != -1) {
- imgPath = imgPath.substring(0, imgPath.lastIndexOf("/") + 1); // 图片所在的文件位置
- var changeImgStartIndex = cssStr.lastIndexOf("=") + 1;
- var changeImg = cssStr.substring(
- parseInt(changeImgStartIndex),
- parseInt(cssStr.length)
- );
- var oldUrl = cssStr.substring(0, cssStr.lastIndexOf("?"));
- var oldImg = oldUrl.substring(oldUrl.lastIndexOf("/") + 1);
- changeImg = imgPath + changeImg;
- changeImg = changeImg.replace(/\"/g, "");
- var imgUrl = "url(" + changeImg + "?background=" + oldImg + ")"; // 图片URL
- domElement.style.backgroundImage = imgUrl;
- }
- function getClass(obj, attr) {
- if (obj.currentStyle) {
- if (attr == "backgroundPosition") {
- return (
- obj.currentStyle.backgroundPositionX +
- " " +
- obj.currentStyle.backgroundPositionY
- );
- } else {
- return obj.currentStyle[attr];
- }
- } else {
- return document.defaultView.getComputedStyle(obj, null)[attr];
- }
- }
- };
- // table列表自适应宽度
- // ;(function($){
- //但是每个部件都要加载一次
- if (typeof $ + "" == "undefined") {
- loadScript("/wd/js/jquery.js", "Jquery", function () {
- setTimeout(tabFoo, 200);
- });
- }
- // 这个延迟执行在于加载时比dom元素先加载 而且该js文件在页面被加载多次消耗性能望后来者去解决这些问题
- function tabFoo() {
- var oTh = $("table.list th"),
- oTr = $("table.list tr"),
- arr_oth = Array.prototype.slice.apply(oTh),
- font_size = parseInt($(arr_oth[0]).css("fontSize")),
- style_h = $("style"),
- str_sheet =
- " white-space: nowrap;overflow: hidden;text-overflow: ellipsis;padding-left:10px;";
- if (oTh.length <= 5) {
- if (style_h.length) {
- var first_style = style_h[0],
- sheet = first_style.sheet ? first_style.sheet : first_style.styleSheet;
- if (sheet.insertRule) {
- sheet.insertRule("table.list td,table.list th{" + str_sheet + "}", 1);
- } else {
- sheet.addRule("table.list td,table.list th", str_sheet, 0);
- }
- } else {
- $("head").append(
- '<style type="text/css">table.list td,table.list th{' +
- str_sheet +
- "}</style>"
- );
- }
- for (var i = 0; i < arr_oth.length - 1; i++) {
- // console.log($(arr_oth[i]).text().length, '222');
- var thW = $(arr_oth[i]).text().length;
- thW = thW < 5 ? thW : 5; // 限定th的最大字数是5个字符
- if (i == 0) {
- $(arr_oth[i]).css({
- "min-width": (thW + 10) * font_size + "px", // max-width and
- // min-width
- // 根据th字符数上下浮动一个
- "max-width": (thW + 12) * font_size + "px",
- });
- // console.log($('table.list tr td:nth-child(' + (i + 1) + ')'))
- $("table.list tr td:nth-child(" + (i + 1) + ")").css({
- "min-width": (thW + 10) * font_size + "px",
- "max-width": (thW + 12) * font_size + "px",
- });
- } else {
- $(arr_oth[i]).css({
- "min-width": (thW + 6) * font_size + "px", // max-width and
- // min-width
- // 根据th字符数上下浮动一个
- "max-width": (thW + 8) * font_size + "px",
- });
- // console.log($('table.list tr td:nth-child(' + (i + 1) + ')'))
- $("table.list tr td:nth-child(" + (i + 1) + ")").css({
- "min-width": (thW + 6) * font_size + "px",
- "max-width": (thW + 8) * font_size + "px",
- });
- }
- }
- $("table.list tr td:nth-child(" + arr_oth.length + ")").css({
- "white-space": "inherit",
- overflow: "inherit",
- "text-overflow": "inherit",
- });
- $(".img1").parents("td").css("cssText", "width:90px !important");
- return;
- }
- if (style_h.length) {
- var first_style = style_h[0],
- sheet = first_style.sheet ? first_style.sheet : first_style.styleSheet;
- if (sheet.insertRule) {
- sheet.insertRule("table.list td,table.list th{" + str_sheet + "}", 1);
- } else {
- sheet.addRule("table.list td,table.list th", str_sheet, 0);
- }
- } else {
- $("head").append(
- '<style type="text/css">table.list td,table.list th{' +
- str_sheet +
- "}</style>"
- );
- }
- // console.log(arr_oth.length)
- for (var i = 0; i < arr_oth.length - 1; i++) {
- var thW = $(arr_oth[i]).text().length;
- thW = thW < 5 ? thW : 5; // 限定th的最大字数是5个字符
- $(arr_oth[i]).css({
- "min-width": (thW - 1) * font_size + "px", // max-width and
- // min-width
- // 根据th字符数上下浮动一个
- "max-width": (thW + 1) * font_size + "px",
- });
- // console.log($('table.list tr td:nth-child(' + (i + 1) + ')'))
- $("table.list tr td:nth-child(" + (i + 1) + ")").css({
- "min-width": (thW - 1) * font_size + "px",
- "max-width": (thW + 1) * font_size + "px",
- });
- }
- $("table.list tr td:nth-child(1)").css({
- "min-width": (thW + 1) * font_size + "px",
- "max-width": (thW + 3) * font_size + "px",
- });
- $("table.list tr td:nth-child(" + arr_oth.length + ")").css({
- "white-space": "inherit",
- overflow: "inherit",
- "text-overflow": "inherit",
- });
- $(".img1").parents("td").css("cssText", "width:90px !important");
- // console.log($('.img1').parents('td').css('width'));
- }
- function loadScript(src, id, callback) {
- if (!document.getElementById(id)) {
- var head = document.getElementsByTagName("head")[0];
- var script = document.createElement("script");
- script.id = id;
- script.type = "text/javascript";
- script.onreadystatechange = function () {
- if (this.readyState == "complete") {
- callback();
- }
- };
- script.onload = function () {
- callback();
- };
- script.src = src;
- head.appendChild(script);
- } else {
- callback();
- }
- }
- // })($);
- //下拉改变irame
- wd.display.initWdSelectFrame = function () {
- (function () {
- // 查找所有的option
- var optionAll = document.querySelectorAll("option[wdSelectClick]");
- // 遍历option
- for (var i = 0; i < optionAll.length; i++) {
- var options = optionAll[i];
- // 找出匹配的option
- if (typeof options.getAttribute("wdSelectClick") != "undefined") {
- // 为其父元素绑定一个id
- options.parentNode.setAttribute("id", "wdSelect");
- // 为其父元素绑定一个事件
- options.parentNode.onchange = function () {
- iframeSrc();
- };
- }
- }
- // 下拉默认值
- function iframeSrc() {
- var mySelect = document.getElementById("wdSelect");
- var myOption =
- mySelect.options[mySelect.selectedIndex].getAttribute("wdSelectClick");
- document.getElementById("wdIframe").setAttribute("src", myOption);
- }
- if (optionAll.length > 0) iframeSrc();
- })();
- };
- wd.display.home = function () {
- //显示个人首页
- // if (document.getElementById("mbwzbj")) {
- // document.getElementById("mbwzbj").innerHTML = "个人首页";
- // } else {
- // var div = top.window.document.querySelector("div[name='mbwz']");
- // if (!div)
- try {
- // wd.topWindow.window.document.querySelector("span[id='mbwzbj']").innerHTML = "个人首页";
- wd.display.setHomeIconName("个人首页");
- } catch (e) {
- console.log(e);
- }
- // }
- var iframe = wd.topWindow.window.document.querySelector("iframe[oriSrc]");
- // console.log(iframe);
- iframe.src = iframe.getAttribute("oriSrc");
- //处理菜单项
- /*
- var menu = new dhtmlXMenuObject("menuObj440141088","dhx_black");
- var casState = new Object({
- ctrl: false,
- alt: false,
- shift: false
- });
- menu._clearAndHide();
- if(document.getElementById("mbwzbj")!=null){ //该文字部件可能不存在
- menu.dqlm=menu.itemPull[menu.idPrefix + id]["title"]; //改变当前栏目
- //document.getElementById("mbwzbj").innerHTML=this.itemPull[this.idPrefix + id]["title"]; //系统菜单下项目
- }
- if (menu._isContextMenuVisible() && menu.contextAutoHide) menu._hideContextMenu();
- menu.callEvent("onClick", ["shortcutMenu", false, casState]);
- */
- //
- // var bjsy = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsy');
- // if (bjsy != null && (bjsy.style.display == '' || bjsy.style.display == 'none'))
- // bjsy.style.display = 'inline';
- //
- // var bjsymb = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsymb');
- // if (bjsymb != null && (bjsymb.style.display == '' || bjsymb.style.display == 'none'))
- // bjsymb.style.display = 'inline';
- if (wd.topWindow.userEditButton_official) {
- wd.topWindow.userEditButton_official.style.display = "inline";
- }
- if (wd.topWindow.userEditButton_personal) {
- wd.topWindow.userEditButton_personal.style.display = "inline";
- }
- //自动调整win2的iframe大小
- if (wd.topWindow.wd.base.refreshApplyIframeHeight) {
- wd.topWindow.wd.base.refreshApplyIframeHeight();
- }
- if (wd.topWindow.wdHelpIcon) wd.topWindow.wdHelpIcon.style.display = "none";
- };
- /**
- 异步提交,试用 06-06 by david
- config: {
- param: {},
- async: boolean,
- contentType: string, 默认为application/x-www-form-urlencoded
- dataType: string 默认为json
- }
- callback: success回调
- error: error回调
- **/
- wd.display.ajaxSubmit = function (url, config, callback, error) {
- var xhr = getXmlHttpRequest();
- var callback = undefined == callback ? function () {} : callback;
- var error =
- undefined == error
- ? function (err) {
- console.log(err);
- }
- : error;
- var async;
- var method;
- var contentType;
- var dataType; //xmlhttprequest设置datatype
- if (undefined == config.async || config.async == true) async = true;
- else if (config.async == "false") async = false;
- method = config.method;
- if (method.toLocaleLowerCase() == "get") {
- url += "&"; //一般都带token参数
- url += params(config.param);
- }
- if (undefined == config.contentType)
- contentType = "application/x-www-form-urlencoded";
- else contentType = config.contentType;
- if (undefined == config.dataType) dataType = "json";
- else dataType = config.dataType;
- xhr.responseType = dataType;
- xhr.open(method, url, async);
- xhr.setRequestHeader("Content-Type", contentType);
- xhr.onreadystatechange = function () {
- switch (xhr.readyState) {
- case 1:
- break;
- case 2:
- break;
- case 3:
- break;
- case 4:
- if (xhr.status == 200) {
- /* var result = xhr.response;
- if(window.JSON){
- result = JSON.parse(result);
- }else{
- result = eval("(" + result + ")");
- }
- callback(result); */
- callback(xhr.response);
- } else {
- error(xhr.response);
- }
- break;
- }
- };
- if (method.toLocaleLowerCase() == "get") xhr.send();
- else xhr.send(params(config.param));
- function params(data) {
- var arr = [];
- for (var i in data) {
- arr.push(encodeURIComponent(i) + "=" + encodeURIComponent(data[i]));
- }
- return arr.join("&");
- }
- function getXmlHttpRequest() {
- var xmlHttpRequest = null;
- if (typeof XMLHttpRequest != "undefined") {
- xmlHttpRequest = new XMLHttpRequest();
- } else {
- xmlHttpRequest = new ActiveXObject("Microsoft.XMLHttp");
- }
- return xmlHttpRequest;
- }
- };
- //表格批示使用,url带有单元格序号‘bgbj_xh’>0时全屏
- wd.display.JumpTest = function (params) {
- function FindParam(url, name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
- var r = url.substr(1).match(reg);
- if (r != null) return unescape(r[2]);
- return null;
- }
- /**
- function openScreenLayer(src) {
- var topbody = $("body", wd.topWindow.document);
- var wdfs = topbody.find("#wdfullscreen"); //弹层的div
- if(wdfs.length < 1) {
- topbody.append("<div id='wdfullscreen' style='display:none;top:-10;'></div>");
- wdfs = topbody.find("#wdfullscreen");
- }
- wdfs.html("");
- wdfs.append("<link rel='stylesheet' type='text/css' id='uefullscreenstyle' href='/wd/js/ueditor/ueFull.css'>").show()
- 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>');
- 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>');
- wdfs.find(".fulscrbtn").click(function(e) {
- wdfs.remove();
- });
- }
- **/
- /****/
- function openScreenLayer(src) {
- var topbody = $("body", wd.topWindow.document);
- var wdfs = topbody.find("#wdfullscreen"); //弹层的div
- if (wdfs.length < 1) {
- topbody.append(
- "<div id='wdfullscreen' style='display:none;width:100%;height:100%;margin:0;'></div>"
- );
- wdfs = topbody.find("#wdfullscreen");
- }
- wdfs.html("");
- wdfs
- .append(
- "<link rel='stylesheet' type='text/css' id='uefullscreenstyle' href='/wd/js/ueditor/ueFull.css'>"
- )
- .show();
- wdfs.append(
- '<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>'
- );
- wdfs
- .find(".fullscreen")
- .html(
- '<iframe id="myIframe" src="' +
- src +
- '" style="width:100%;height:96%;"></iframe>'
- );
- wdfs.find(".fulscrbtn").click(function (e) {
- wdfs.remove();
- });
- }
- var a = parseInt(FindParam(params.url, "bgbj_xh"));
- if (a && a > 0) {
- // openScreenLayer(params.url);
- params.show = "wdFullScreen";
- params.width = wd.topWindow.document.body.offsetWidth;
- wd.display.showComponent(params);
- } else {
- wd.display.showComponent(params);
- }
- };
- //使参数指定的滚动图片全屏
- wd.display.fullgdtpScreen = function (element, bjid) {
- // console.log(element);
- // wd.display.CmsZNRFull(element);
- $("#ydfull" + bjid).css("display", "-webkit-flex");
- var index_img = 0;
- var lastindex_img = 0;
- var full_src;
- full_src = $(element).children("img")[0].src;
- // console.log(full_src);
- $("#imgfull" + bjid).attr("src", full_src);
- var items = $("#list" + bjid).find(".ydimg_item");
- if (items != undefined && items.length != 0) {
- lastindex_img = items.length - 1;
- for (var ii = 0; ii < items.length; ii++) {
- if ($(element).children("img")[0] == $(items[ii]).children("img")[0]) {
- index_img = ii;
- }
- }
- }
- var marioVideo = $("#ydfull" + bjid)[0];
- // wd.display.CmsZNRFull(element);
- var fullscreenchange = function () {
- if (document.webkitFullscreenElement != null) {
- // element.style.width = "100%";
- // element.style.height = "100%";
- // element.style.overflowY = 'hidden';
- //console.log("进入全屏函数");
- // $('#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>');
- } else {
- //console.log("退出全屏函数");
- $("#ydfull" + bjid).hide();
- //添加监听器,监听用户进入全屏和退出全屏操作
- marioVideo.removeEventListener(
- "webkitfullscreenchange",
- fullscreenchange
- );
- marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
- }
- };
- // 判断各种浏览器,找到正确的方法
- var elem = marioVideo;
- elem.onmousemove = function (e) {
- // console.log(e.offsetY);
- e = e || window.event;
- var newY = e.screenY;
- //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
- if (newY < window.screen.height / 3 && index_img != 0) {
- elem.style.cursor = 'url("./wd/image/top.cur"),default'; //上1/3区域
- } else if (
- newY > (window.screen.height / 3) * 2 &&
- index_img != lastindex_img
- ) {
- elem.style.cursor = 'url("./wd/image/bottom.cur"),default'; //下1/3区域
- } else {
- elem.style.cursor = "default"; //中1/3区域
- }
- };
- elem.onclick = function (e) {
- e = e || window.event;
- var newY = e.screenY;
- //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
- if (newY < window.screen.height / 3 && index_img != 0) {
- //上一张
- index_img = index_img - 1;
- if (items != undefined && items.length != 0) {
- for (var ii = 0; ii < items.length; ii++) {
- $(items[ii]).removeClass("selected");
- }
- full_src = $(items[index_img]).children("img")[0].src;
- $("#imgfull" + bjid).attr("src", full_src);
- $(items[index_img]).addClass("selected");
- $("#img" + bjid).attr("src", full_src);
- $("#bt" + bjid).html(
- $(items[index_img]).children("img").eq(0).attr("alt")
- );
- }
- } else if (
- newY > (window.screen.height / 3) * 2 &&
- index_img != lastindex_img
- ) {
- //下一张
- index_img = index_img + 1;
- if (items != undefined && items.length != 0) {
- for (var ii = 0; ii < items.length; ii++) {
- $(items[ii]).removeClass("selected");
- }
- full_src = $(items[index_img]).children("img")[0].src;
- $("#imgfull" + bjid).attr("src", full_src);
- $(items[index_img]).addClass("selected");
- $("#img" + bjid).attr("src", full_src);
- $("#bt" + bjid).html(
- $(items[index_img]).children("img").eq(0).attr("alt")
- );
- }
- } else {
- //关闭
- wd.display.exitFullScreen();
- }
- };
- marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("fullscreenchange", fullscreenchange);
- marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
- if (marioVideo.requestFullscreen) {
- marioVideo.requestFullscreen(elem);
- } else if (marioVideo.msRequestFullscreen) {
- marioVideo.msRequestFullscreen(elem);
- } else if (marioVideo.mozRequestFullScreen) {
- marioVideo.mozRequestFullScreen(elem);
- } else if (marioVideo.webkitRequestFullScreen) {
- marioVideo.webkitRequestFullScreen(elem);
- }
- };
- wd.display.fullsltScreen = function (bjid) {
- $("#sltfull" + bjid).css("display", "-webkit-flex");
- var index_img = 0;
- var lastindex_img = 0;
- var full_src;
- var items_selected = $("#list" + bjid).find(".slximg_box.selected");
- if (items_selected != undefined && items_selected.length != 0) {
- for (var ii = 0; ii < items_selected.length; ii++) {
- full_src = $(items_selected[ii]).find("img")[0].src;
- // console.log(full_src);
- $("#imgfull" + bjid).attr("src", full_src);
- }
- }
- var items = $("#list" + bjid).find(".slximg_item");
- if (items != undefined && items.length != 0) {
- lastindex_img = items.length - 1;
- for (var ii = 0; ii < items.length; ii++) {
- if ($(items_selected[0]).find("img")[0] == $(items[ii]).find("img")[0]) {
- index_img = ii;
- }
- }
- }
- var marioVideo = $("#sltfull" + bjid)[0];
- // wd.display.CmsZNRFull(element);
- var fullscreenchange = function () {
- if (document.webkitFullscreenElement != null) {
- // element.style.width = "100%";
- // element.style.height = "100%";
- // element.style.overflowY = 'hidden';
- //console.log("进入全屏函数");
- // $('#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>');
- } else {
- //console.log("退出全屏函数");
- $("#sltfull" + bjid).hide();
- //添加监听器,监听用户进入全屏和退出全屏操作
- marioVideo.removeEventListener(
- "webkitfullscreenchange",
- fullscreenchange
- );
- marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
- }
- };
- // 判断各种浏览器,找到正确的方法
- var elem = marioVideo;
- elem.onmousemove = function (e) {
- // console.log(e.offsetY);
- e = e || window.event;
- var newY = e.screenY;
- //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
- if (newY < window.screen.height / 3 && index_img != 0) {
- elem.style.cursor =
- "url(" + wd.common.loadFile("theme/meow/image/top.cur") + "),default"; //上1/3区域
- } else if (
- newY > (window.screen.height / 3) * 2 &&
- index_img != lastindex_img
- ) {
- elem.style.cursor =
- "url(" +
- wd.common.loadFile("theme/meow/image/bottom.cur") +
- "),default"; //下1/3区域
- } else {
- elem.style.cursor = "default"; //中1/3区域
- }
- };
- elem.onclick = function (e) {
- e = e || window.event;
- var newY = e.screenY;
- //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
- if (newY < window.screen.height / 3 && index_img != 0) {
- //上一张
- index_img = index_img - 1;
- if (items != undefined && items.length != 0) {
- for (var ii = 0; ii < items.length; ii++) {
- $(items[ii]).removeClass("selected");
- }
- full_src = $(items[index_img]).find("img")[0].src;
- $("#imgfull" + bjid).attr("src", full_src);
- $(items[index_img]).addClass("selected");
- $("#img" + bjid).attr("src", full_src);
- $("#bt" + bjid).html($(items[index_img]).find("img").eq(0).attr("alt"));
- }
- } else if (
- newY > (window.screen.height / 3) * 2 &&
- index_img != lastindex_img
- ) {
- //下一张
- index_img = index_img + 1;
- if (items != undefined && items.length != 0) {
- for (var ii = 0; ii < items.length; ii++) {
- $(items[ii]).removeClass("selected");
- }
- full_src = $(items[index_img]).find("img")[0].src;
- $("#imgfull" + bjid).attr("src", full_src);
- $(items[index_img]).addClass("selected");
- $("#img" + bjid).attr("src", full_src);
- $("#bt" + bjid).html($(items[index_img]).find("img").eq(0).attr("alt"));
- }
- } else {
- //关闭
- wd.display.exitFullScreen();
- }
- };
- marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("fullscreenchange", fullscreenchange);
- marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
- if (marioVideo.requestFullscreen) {
- marioVideo.requestFullscreen(elem);
- } else if (marioVideo.msRequestFullscreen) {
- marioVideo.msRequestFullscreen(elem);
- } else if (marioVideo.mozRequestFullScreen) {
- marioVideo.mozRequestFullScreen(elem);
- } else if (marioVideo.webkitRequestFullScreen) {
- marioVideo.webkitRequestFullScreen(elem);
- }
- };
- //使参数指定的DOM元素全屏,如果不传参数则默认带个页面全屏
- wd.display.fullScreen = function (element) {
- element.sdasdasds = playlist;
- // 判断各种浏览器,找到正确的方法
- var requestMethod =
- element.requestFullScreen || //W3C
- element.webkitRequestFullScreen || //Chrome等
- element.mozRequestFullScreen || //FireFox
- element.msRequestFullScreen; //IE11
- if (requestMethod) {
- requestMethod.call(element);
- } else if (typeof window.ActiveXObject !== "undefined") {
- //for Internet Explorer
- var wscript = new ActiveXObject("WScript.Shell");
- if (wscript !== null) {
- alert("f11");
- wscript.SendKeys("{F11}");
- }
- }
- };
- //从全屏状态切换为普通状态
- wd.display.exitFullScreen = function () {
- // 判断各种浏览器,找到正确的方法
- var exitMethod =
- document.exitFullscreen || //W3C
- document.mozCancelFullScreen || //Chrome等
- document.webkitExitFullscreen || //FireFox
- document.webkitExitFullscreen; //IE11
- if (exitMethod) {
- exitMethod.call(document);
- } else if (typeof window.ActiveXObject !== "undefined") {
- //for Internet Explorer
- var wscript = new ActiveXObject("WScript.Shell");
- if (wscript !== null) {
- wscript.SendKeys("{F11}");
- }
- }
- };
- wd.display.CmsZNRFull = function (element) {
- //目前对图片,视频,pdf,word,flash,全屏下特殊处理
- var IMG_TYPE = "IMG";
- var VIDEO_TYPE = "VIDEO";
- var PDF_TYPE = "PDF";
- var WORD_TYPE = "WORD";
- var FLASH_TYPE = "FLASH";
- var XLS_TYPE = "XLS";
- var PPT_TYPE = "PPT";
- function nrjsblmType(nrjslbm) {
- var group = {
- 300: IMG_TYPE,
- 310: IMG_TYPE,
- 320: IMG_TYPE,
- 330: IMG_TYPE,
- 340: IMG_TYPE,
- 500: VIDEO_TYPE,
- 510: VIDEO_TYPE,
- 520: VIDEO_TYPE,
- 1010: PDF_TYPE,
- 810: PPT_TYPE,
- 910: WORD_TYPE,
- 1110: XLS_TYPE,
- 710: FLASH_TYPE,
- };
- return group[nrjslbm];
- }
- var width; //定义宽度与高度
- var height;
- var dataList = [];
- //查找出当前所有的所有播放器
- var playlist = element.querySelectorAll("[data-init]");
- console.log("555:" + playlist.length);
- // var nrid = null;
- for (var i = 0; i < playlist.length; i++) {
- var playDiv = playlist[i];
- var nrJson = JSON.parse(playDiv.getAttribute("data-init"));
- // console.log(nrJson);
- // nrid = nrJson.resDesign.ID;
- var nrjslbm = nrJson.resDesign.nrjslbm;
- var TYPE = nrjsblmType(nrjslbm);
- if (!TYPE) continue;
- // console.log("666:" + TYPE);
- var exitFunction = null; //退出全屏回调方法
- var data = {
- type: TYPE,
- nrjslbm: nrjslbm,
- };
- // console.log(TYPE);
- if (TYPE == IMG_TYPE) {
- var handle = playDiv.querySelector(".img");
- width = handle.naturalWidth;
- height = handle.naturalHeight;
- //退出全屏用到的数据缓存
- data.handle = handle;
- data.width = handle.style.width;
- data.height = handle.style.height;
- data.exitFunction = function (data) {
- // console.log(data)
- data.handle.style.width = data.width;
- data.handle.style.height = data.height;
- };
- var zzz = wd.display.CmscalZoomSize(width, height);
- handle.style.width = zzz.width + "px";
- handle.style.height = zzz.height + "px";
- // console.log(handle.style.width)
- // console.log(handle.style.height)
- } else if (TYPE == VIDEO_TYPE) {
- var handle = playDiv.querySelector(".video");
- var handleparent = playDiv.querySelector(".videoparent");
- width = handle.videoWidth;
- height = handle.videoHeight;
- //退出全屏还原
- data.handleparent = handleparent;
- data.width = handleparent.style.width;
- data.height = handleparent.style.height;
- data.exitFunction = function (data) {
- // console.log(data)
- data.handleparent.style.width = data.width;
- data.handleparent.style.height = data.height;
- };
- var zzz = wd.display.CmscalZoomSize(width, height);
- handleparent.style.width = zzz.width + "px";
- handleparent.style.height = zzz.height + "px";
- } else if (TYPE == PDF_TYPE || TYPE == WORD_TYPE || TYPE == XLS_TYPE) {
- var handle = playDiv.querySelector(".show");
- var son1 = handle.querySelector("#pf1");
- if (son1 == null) return;
- width = son1.clientWidth;
- height = son1.clientHeight;
- var zzz = wd.display.CmscalZoomSize(width, height);
- data.handle = handle;
- data.overflow = handle.style.overflow;
- data.zoom = handle.style.zoom;
- //特殊处理excel背景颜色变黑色
- if (TYPE == XLS_TYPE) {
- playDiv.style.background = "white";
- }
- data.exitFunction = function (data) {
- if (zzz.zoom != null) {
- element.scrollTop = element.scrollTop / zzz.zoom;
- }
- // console.log(data)
- data.handle.style.zoom = data.zoom;
- data.handle.style.overflow = data.overflow;
- if (data.type == XLS_TYPE) {
- data.handle.style.background = "";
- }
- };
- handle.style.zoom = zzz.zoom;
- element.scrollTop = element.scrollTop * zzz.zoom;
- } else if (TYPE == FLASH_TYPE) {
- var handle = playDiv.querySelector("#embed");
- //退出全屏方法
- data.handle = handle;
- data.width = handle.style.width;
- data.height = handle.style.height;
- data.exitFunction = function (data) {
- // console.log(data)
- data.handle.style.width = $("#mainDiv").innerWidth();
- data.handle.style.height = $("#mainDiv").innerHeight();
- };
- var zzz = wd.display.CmscalZoomSize();
- handle.style.width = zzz.maxWidth + "px";
- handle.style.height = zzz.maxHeight + "px";
- }
- dataList.push(data);
- playlist[i].dataList = dataList;
- }
- };
- /**
- *
- * 计算放大后width,height,zoom
- * @param {Object} w
- * @param {Object} h
- */
- wd.display.CmscalZoomSize = function (w, h) {
- var maxWidth = screen.availWidth - 1;
- var maxHeight = screen.availHeight - 1; //获取页面的高度与宽度
- var xswidth = w;
- var xsheight = h;
- if (w && h) {
- //显示的高度与宽度
- var ratio1 = w / maxWidth;
- var ratio2 = h / maxHeight;
- //根据长度与宽度获取缩放比例
- if (ratio1 > 1 || ratio2 > 1) {
- if (ratio1 > ratio2) {
- //选取较大的缩放比例
- xswidth = w / ratio1;
- xsheight = h / ratio1;
- } else {
- xswidth = w / ratio2;
- xsheight = h / ratio2;
- }
- }
- }
- if (w) {
- var zoom = maxWidth / w;
- if (zoom >= 2) {
- //确定zoom 用于word与pdf放缩
- zoom = 2;
- }
- }
- return {
- width: xswidth,
- height: xsheight,
- zoom: zoom,
- maxWidth: maxWidth,
- maxHeight: maxHeight,
- };
- };
- wd.display.CmsFullDiv = function (
- element,
- onFullscreen,
- onExitfullscreen,
- win
- ) {
- win = win || element.ownerDocument.defaultView;
- // var video,photo,pdf,word,flash;
- // console.log(element);
- var marioVideo = element;
- var fullscreenchange = function () {
- if (win.document.webkitFullscreenElement != null) {
- //$(element).addClass("scrollbar");
- // $(element).css("padding","25px");
- // $(element).css("box-sizing","border-box");
- // element.style.overflowY = "auto";
- // element.style.overflowX = "hidden";
- // element.style.width = "100%";
- // element.style.height = "100%";
- // console.log("进入全屏函数");
- // element.setAttribute("isCmsFullScreen", 'true');
- win
- .$(element)
- .append(
- '<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>'
- );
- onFullscreen && onFullscreen();
- } else {
- // console.log("退出全屏函数");
- win.$(element).find("#pageClose").remove();
- //$(element).removeClass("scrollbar");
- // $(element).css("padding","0px");
- // $(element).css("box-sizing","border-box");
- // element.style.height = 'auto';
- // element.style.width = 'auto';
- // element.setAttribute("isCmsFullScreen", 'false');
- // element.style.overflowY = 'auto';
- // element.style.height = '100%';
- // element.style.width = '750px';
- //添加监听器,监听用户进入全屏和退出全屏操作
- marioVideo.removeEventListener(
- "webkitfullscreenchange",
- fullscreenchange
- );
- marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
- onExitfullscreen && onExitfullscreen();
- }
- };
- var elem = marioVideo;
- marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("fullscreenchange", fullscreenchange);
- marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
- if (marioVideo.requestFullscreen) {
- marioVideo.requestFullscreen(elem);
- } else if (marioVideo.msRequestFullscreen) {
- marioVideo.msRequestFullscreen(elem);
- } else if (marioVideo.mozRequestFullScreen) {
- marioVideo.mozRequestFullScreen(elem);
- } else if (marioVideo.webkitRequestFullScreen) {
- marioVideo.webkitRequestFullScreen(elem);
- }
- };
- wd.display.CmsFullScreen = function (
- element,
- onFullscreen,
- onExitfullscreen,
- win
- ) {
- win = win || element.ownerDocument.defaultView;
- // var video,photo,pdf,word,flash;
- // console.log(element);
- var marioVideo = element;
- try {
- win.wd.display.CmsZNRFull(element);
- } catch (e) {}
- var fullscreenchange = function () {
- if (win.document.webkitFullscreenElement != null) {
- //$(element).addClass("scrollbar");
- // $(element).css("padding","25px");
- // $(element).css("box-sizing","border-box");
- element.style.overflowY = "auto";
- element.style.overflowX = "hidden";
- element.style.width = "100%";
- element.style.height = "100%";
- // console.log("进入全屏函数");
- element.setAttribute("isCmsFullScreen", "true");
- win
- .$(element)
- .append(
- '<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>'
- );
- onFullscreen && onFullscreen();
- } else {
- // console.log("退出全屏函数");
- win.$(element).find("#pageClose").remove();
- //$(element).removeClass("scrollbar");
- // $(element).css("padding","0px");
- // $(element).css("box-sizing","border-box");
- // element.style.height = 'auto';
- // element.style.width = 'auto';
- element.setAttribute("isCmsFullScreen", "false");
- // element.style.overflowY = 'auto';
- element.style.height = "100%";
- element.style.width = "750px";
- //回调退出全屏方法
- var playlist = element.querySelectorAll("[data-init]");
- for (var i = 0; i < playlist.length; i++) {
- dataList = playlist[i].dataList;
- for (var j = 0; dataList != null && j < dataList.length; j++) {
- var data = dataList[j];
- if (data.exitFunction) {
- data.exitFunction.call(this, data);
- }
- }
- delete playlist[i].dataList;
- }
- //添加监听器,监听用户进入全屏和退出全屏操作
- marioVideo.removeEventListener(
- "webkitfullscreenchange",
- fullscreenchange
- );
- marioVideo.removeEventListener("fullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.removeEventListener("msfullscreenchange", fullscreenchange);
- onExitfullscreen && onExitfullscreen();
- }
- };
- var elem = marioVideo;
- marioVideo.addEventListener("webkitfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("fullscreenchange", fullscreenchange);
- marioVideo.addEventListener("mozfullscreenchange", fullscreenchange);
- marioVideo.addEventListener("msfullscreenchange", fullscreenchange);
- if (marioVideo.requestFullscreen) {
- marioVideo.requestFullscreen(elem);
- } else if (marioVideo.msRequestFullscreen) {
- marioVideo.msRequestFullscreen(elem);
- } else if (marioVideo.mozRequestFullScreen) {
- marioVideo.mozRequestFullScreen(elem);
- } else if (marioVideo.webkitRequestFullScreen) {
- marioVideo.webkitRequestFullScreen(elem);
- }
- };
- //附件滑动和上下项
- wd.display.CmsNrscroll = function (element, currSubNrid) {
- var ismousedown = false;
- var oldY, scollY;
- var nrid = currSubNrid;
- element.onmousedown = function (e) {
- oldscrollTop = element.scrollTop;
- oldY = e.screenY;
- scollY = element.scrollTop;
- ismousedown = true;
- };
- element.onmouseup = function (e) {
- ismousedown = false;
- };
- element.onmousemove = function (e) {
- // console.log(e.offsetY);
- e = e || window.event;
- var newY = e.screenY;
- //console.log(ismousedown+":"+scollY +":"+ oldY +":"+ e.screenY +":"+(scollY + (oldY - e.screenY) * 2))
- if (ismousedown) {
- //console.log(element.scrollTop + element.clientHeight+"###"+element.scrollHeight)
- if (
- oldY - newY >= 150 &&
- element.scrollTop + element.clientHeight + 1 >= element.scrollHeight &&
- oldscrollTop + element.clientHeight + 1 >= element.scrollHeight
- ) {
- ismousedown = false;
- // console.log("鼠标向上移动");
- nrid = nextitem(nrid);
- // console.log(element.getAttribute("isCmsFullScreen"));
- } else if (
- newY - oldY >= 150 &&
- element.scrollTop <= 0 &&
- oldscrollTop == 0
- ) {
- ismousedown = false;
- // console.log("鼠标向下移动");
- nrid = lastitem(nrid);
- // console.log(element.getAttribute("isCmsFullScreen"));
- } else {
- element.scrollTop = scollY + (oldY - e.screenY); //此处调节滚动速度
- }
- }
- };
- function nextitem(nrid) {
- var items = $(".dragList").find(".item");
- var i = 0;
- var result = nrid;
- items.each(function () {
- if (nrid == $(items[i]).find(".nrid").text()) {
- if (i < items.length - 1) {
- // $(items[i])[0].style.border = "solid 1px #CCCCCC";//全部边框变黑 20170929
- // $(items[i + 1])[0].style.border = "2px solid #FF0000";//点击变红 20170929
- selectItem($(items[i + 1])[0]);
- loadPlayer(
- $(items[i + 1])
- .find(".nrid")
- .text(),
- $(items[i + 1])
- .find(".nrjslbm")
- .text()
- );
- result = $(items[i + 1])
- .find(".nrid")
- .text();
- }
- return false; //跳出循环
- } else {
- i++;
- }
- });
- return result;
- }
- function lastitem(nrid) {
- var items = $(".dragList").find(".item");
- var i = 0;
- var result = nrid;
- items.each(function () {
- if (nrid == $(items[i]).find(".nrid").text()) {
- if (i > 0) {
- // $(items[i])[0].style.border = "solid 1px #CCCCCC";//全部边框变黑 20170929
- // $(items[i - 1])[0].style.border = "2px solid #FF0000";//点击变红 20170929
- selectItem($(items[i - 1])[0]);
- loadPlayer(
- $(items[i - 1])
- .find(".nrid")
- .text(),
- $(items[i - 1])
- .find(".nrjslbm")
- .text()
- );
- //$(items[i - 1])[0].scrollTop( $(items[i - 1])[0].scrollHeight );
- result = $(items[i - 1])
- .find(".nrid")
- .text();
- }
- return false; //跳出循环
- } else {
- i++;
- }
- });
- return result;
- }
- };
- /**
- * 退出登录
- */
- wd.display.exit = function (param) {
- // console.log("exit")
- wd.display.showLoad();
- var beaconLogin =
- wd.display.beaconLogin("loginOut") || wd.display.getBeaconWhetherToOpen();
- param = param || {};
- var homepage = 1 == param.homepage ? "&homepage=" + param.homepage : "";
- var urlparam = "" + homepage;
- /* 改。Lin
- $.post("/service?wdApplication=wd&wdService=ss.exitByA&wdtest=false", {}, function (result) {
- */
- /* 再改,规范命名。Lin
- * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
- * &wdService= 改为 ssServ
- $.post("/service?wdApplication=wd&wdService=exit", {}, function (result) {
- */ $.post(
- "/service?ssServ=ssExit",
- {},
- function (result) {
- // =exit"。Lin
- var newurl =
- result.path + (result.path.indexOf("?") == -1 ? "?" : "") + urlparam;
- if (beaconLogin) {
- setTimeout(function () {
- wd.topWindow.location.href = newurl;
- }, 1000);
- } else {
- wd.topWindow.location.href = newurl;
- }
- },
- "json"
- );
- };
- /**
- * 执行当前弹窗的wdfitheight调整事件
- */
- wd.display.initWdFitHeight = function (windowobj) {
- var dialogid = wd.display.getwdDialogId();
- if (!dialogid) return;
- //弹窗对象
- var win = wd.topWindow.dhxWins.window(dialogid);
- if (!win) return;
- var nextiframe = win.getFrame();
- var count = 0;
- while (nextiframe != null) {
- if (count > 10) break; // 最多查找10层iframe,防止死循环
- count++;
- //执行页面所在的初始化iframe事件
- if (nextiframe.contentWindow.window.initWdFitHeightFunction) {
- if (nextiframe.contentWindow.window != windowobj) {
- nextiframe.contentWindow.window.initWdFitHeightFunction();
- }
- }
- // console.log(nextiframe)
- nextiframe = nextiframe.contentWindow.document.querySelector("iframe[src]");
- }
- };
- /**
- *
- */
- wd.display.submitToTopTab = function (submitBtn) {
- if (!submitBtn) console.error("请指定submit按钮");
- var myform = submitBtn.form.cloneNode(true);
- myform.style.display = "none";
- submitBtn.form.parentNode.innerHTML = "";
- var win = window,
- topFrame = wd.display.getFrameOfWindow(win);
- while (topFrame.tabObj) {
- //找到不是tab为止
- win = win.parent;
- topFrame = wd.display.getFrameOfWindow(win);
- }
- topFrame.contentWindow.document.body.appendChild(myform);
- myform.submit();
- // submitBtn.click();
- };
- /**
- * 获取window所在的iframe
- *
- */
- wd.display.getFrameOfWindow = function (win) {
- win = win || window;
- if (
- win != win.top &&
- win.parent &&
- win.parent.document.querySelectorAll("iframe").length > 0
- ) {
- var pfs = win.parent.document.querySelectorAll("iframe");
- for (var i = 0; i < pfs.length; i++) {
- if (pfs[i].contentWindow == win) {
- return pfs[i];
- }
- }
- console.error("没找到上级window所对应当前window的iframe");
- } else {
- console.warn("当前页面不存在任何iframe底下");
- return null;
- }
- };
- /**
- * 刷新当前的tabframe
- */
- wd.display.refreshTabFrame = function (wdTabNo) {
- var frame = wd.display.getFrameOfWindow();
- if (frame) {
- if (frame.tabObj) {
- if (wdTabNo && /[0-9]*/.test(wdTabNo)) {
- // frame.contentWindow.wd.display.wdTabNo=wdTabNo;
- var num = parseInt(wdTabNo);
- frame.tabObj.selectClick(num);
- } else {
- frame.tabObj.selectTab.dom.click();
- }
- } else {
- console.error("当前iframe不是tabFrame");
- }
- }
- };
- wd.display.changeFormAction = function (
- url,
- element,
- width,
- height,
- minHeight,
- maxHeight
- ) {
- var a = $(element).parents("form:first").attr("action", url);
- if (a.length != 1) {
- alert("找不到form元素");
- return false;
- }
- if (a[0].checkOnly) {
- if (!a[0].checkOnly(true)) {
- return;
- }
- }
- if (width && height && minHeight && maxHeight) {
- wd.display.resizeComponent(width, height, minHeight, maxHeight);
- }
- return true;
- };
- wd.display.MsgManager = function (timeout, minHeight, minWidth) {
- if (wd.topWindow.popupPanel == null) {
- // 动画小圈圈
- //flashMessageDocument--fmd
- $("body", wd.topWindow.document).append(
- '<div id="fMD" style="position: fixed; display:none; pointer-events:none; z-index: 9999;" class="cursor-loading" /></div>'
- );
- 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>'
- );
- $("body", wd.topWindow.document).append(wd.topWindow.popupPanel);
- timeout = timeout || 1300;
- // minHeight = minHeight || "10px";
- // minWidth = minWidth || "70px";
- // this.element[0].className = "flashMsg-div";
- // this.element[0].id = "flashmsgtipsId";
- // $(".flashMsg-div").append("<div class='flashMsg-down' style='bottom: -10px;left: 7px'></div>");
- // this.element.css({
- // display: "none",
- // position: "fixed",
- // // minHeight: minHeight,
- // // minWidth: minWidth,
- // "z-index": "999"
- // });
- this.messages = [];
- var this_ = this;
- setInterval(function () {
- // if (this_.messages.length > 1) {
- // this_.removeMsg(this_.messages.shift());
- // } else if (this_.messages.length == 1) {
- // setTimeout(function () {
- // this_.removeMsg(this_.messages.shift());
- // }, 1700);
- // }
- if (this_.messages.length > 0) {
- var span = this_.messages.shift();
- setTimeout(function () {
- this_.removeMsg(span);
- }, span.data("timeout"));
- }
- }, timeout);
- }
- this.removeMsg = function (span) {
- var $span = $(span);
- $span.slideUp("normal", function () {
- $span.trigger("onHide");
- $span.remove();
- });
- this.messages.length == 0 && this.element.fadeOut("fast");
- };
- this.pushMsg = function (msg, options) {
- if (msg == "" || msg == null) return;
- var $span = $("<p>");
- $span.text(msg);
- $span.data("timeout", Math.max(300 * (msg.length / 3), 1700));
- $span.bind("onShow", function () {
- options && options.onShow && options.onShow.call(this);
- });
- $span.bind("onHide", function () {
- options && options.onHide && options.onHide.call(this);
- });
- this.messages.push($span);
- this.element.prepend($span).show();
- $span.fadeIn("normal", function () {
- $span.trigger("onShow");
- });
- };
- };
- //开启加载动画
- wd.display.showLoad = function () {
- wd.topWindow.$("#fMD").show();
- };
- //关闭加载动画
- wd.display.closeLoad = function () {
- wd.topWindow.$("#fMD").hide();
- };
- if (!window.flashmsgmousemove) {
- window.flashmsgmousemove = 1;
- document.addEventListener("mousemove", function () {
- if (wd.topWindow.$("#flashmsgtipsId").is(":visible")) {
- return;
- }
- if (wd.display.isFixation) {
- return;
- }
- // 有弹出窗口且大于 1 时,MSG固定右下角
- if (wd.topWindow.$(".wdMaskDiv").size() > 1) {
- setFixation();
- }
- // 无弹出窗口或弹出窗口等于 1 时,MSG跟随鼠标
- else {
- var xy, x, y;
- try {
- xy = recursionIframe();
- x = window.event.pageX += xy.left;
- y = window.event.pageY += xy.top;
- } catch (e) {
- //console.log("xy err " + e)
- x = window.event.pageX;
- y = window.event.pageY;
- }
- if (wd.topWindow.$("#flashmsgtipsId").find("p").size() < 1) {
- // wd.topWindow.$("#flashmsgtipsId").addClass("flashmsgtips").removeClass("flashmsgtips-submit");
- wd.topWindow.$("#flashmsgtipsId").css({
- top: y - 53 + "px",
- left: x - 7 + "px",
- bottom: "",
- right: "",
- });
- }
- wd.topWindow.$("#fMD").css("left", x - 10);
- wd.topWindow.$("#fMD").css("top", y - 4);
- }
- });
- }
- wd.display.showMsgPopup = function (msg, options) {
- if (window.location.href.indexOf("view.jsp") > 0) return;
- var msgs = (wd.topWindow.wd.display.popupMsgMagager =
- wd.topWindow.window.wd.display.popupMsgMagager ||
- new wd.topWindow.window.wd.display.MsgManager());
- msgs.pushMsg(msg, options);
- if (wd.display.isFixation) {
- setFixation();
- }
- };
- var setFixation = function () {
- // wd.topWindow.$("#flashmsgtipsId").addClass("flashmsgtips-submit").removeClass('flashmsgtips');
- wd.topWindow.$("#flashmsgtipsId").css({
- bottom: "50px",
- right: "10px",
- top: "",
- left: "",
- });
- };
- var recursionIframe = function (win) {
- try {
- win = win || window;
- function getTop(e) {
- var offset = e.offsetTop;
- if (e.offsetParent != null) offset += getTop(e.offsetParent);
- return offset;
- }
- function getLeft(e) {
- var offset = e.offsetLeft;
- if (e.offsetParent != null) offset += getLeft(e.offsetParent);
- return offset;
- }
- if ((win.parent == top && win.parent == win) || win.document == undefined) {
- return {
- left: 0,
- top: 0,
- };
- }
- var winPar = win.parent;
- var iframeArr = winPar.document.getElementsByTagName("IFRAME");
- var targetIframe;
- var iframeArr1 = win.document.getElementsByTagName("IFRAME");
- for (var i = 0; i < iframeArr1.length; i++) {
- var iframeElem = iframeArr1[i];
- if (iframeElem.contentWindow == win) {
- targetIframe = iframeElem;
- break;
- }
- }
- for (var i = 0; i < iframeArr.length; i++) {
- var iframeElem = iframeArr[i];
- if (iframeElem.contentWindow == win) {
- targetIframe = iframeElem;
- break;
- }
- }
- var xy = {
- left: getLeft(targetIframe),
- top: getTop(targetIframe),
- };
- if (winPar.parent != winPar) {
- var xy2 = recursionIframe(winPar);
- xy.left += xy2.left;
- xy.top += xy2.top;
- }
- return xy;
- } catch (e) {
- console.log("Point err " + e);
- }
- };
- wd.display.resizeComponent = function (width, height, minHeight, maxHeight) {
- if (parseInt(width) == "NaN" || parseInt(height) == "NaN") return;
- var dialog = wd.display.getwdDialogWindows();
- if (!dialog) return;
- var changesize = true;
- if (minHeight && !isNaN(minHeight) && maxHeight && !isNaN(maxHeight)) {
- minHeight = parseInt(minHeight);
- maxHeight = parseInt(maxHeight);
- if (minHeight + this.Yi > wd.topWindow.innerHeight) {
- height = minHeight + this.Yi;
- // showNameOrId = 'wdFullScreen';
- // fullScreenLimitHeight = false;
- } else if (maxHeight + this.Yi < wd.topWindow.innerHeight) {
- height = maxHeight + this.Yi;
- } else {
- height = wd.topWindow.innerHeight;
- changesize = true;
- // changesize = false;
- // showNameOrId = 'wdFullScreen';
- }
- }
- wd.display.addDialogLine();
- if (changesize) {
- dialog.setDimension(width, height);
- dialog.keepInViewport(false);
- dialog.center();
- }
- };
- wd.display.reset = function (
- type,
- submitBtn,
- url,
- width,
- height,
- minHeight,
- maxHeight
- ) {
- var canSubmit = false;
- if (submitBtn.iscommit) {
- canSubmit = true;
- } else if (!submitBtn.form) {
- console.warn("没找到元素所在form");
- } else {
- if (!submitBtn.form.checkOnly) {
- //没有校验器
- canSubmit = true;
- } else if (submitBtn.form.checkOnly(true)) {
- //验证通过
- canSubmit = true;
- } else {
- //表单验证不通过
- canSubmit = false;
- }
- }
- if (canSubmit) {
- wd.display.changeFormAction(url, submitBtn);
- if (type == "dialog") {
- wd.display.resizeComponent(width, height, minHeight, maxHeight);
- wd.display.submitToTopTab(submitBtn);
- return false;
- }
- // submitBtn.iscommit = true;
- // submitBtn.click();
- }
- return canSubmit;
- };
- /**
- * commwrite oneLine=true 限制宽度,结尾添加'...'
- * @param {Object} ele
- */
- wd.display.initOneLine = function (ele) {
- try {
- var parent = ele.parentNode;
- parent.removeChild(ele);
- parent.setAttribute("title", parent.innerHTML);
- parent.style.overflow = "hidden";
- parent.style.textOverflow = "ellipsis";
- parent.style.whiteSpace = "nowrap";
- // 如果无效 table加样式 table-layout: fixed;
- // var poffsetW = parent.offsetWidth;
- // var pscrollW = parent.scrollWidth;
- // console.log(poffsetW+" "+pscrollW)
- // parent.setAttribute("aaa",poffsetW+"/"+pscrollW)
- // if(poffsetW<pscrollW){
- // parent.style.overflow="hidden";
- // parent.style.textOverflow="ellipsis";
- // parent.style.whiteSpace="nowrap";
- // }
- } catch (e) {
- console.log(e);
- }
- };
- wd.display.callback_suffix = "confirm_callback";
- wd.display.cancelcallback_suffix = "cancel_callback";
- wd.display.confirm = function (title, msg, callback, cancelCallback) {
- var params = {
- dialog: "dialog",
- width: 400,
- height: 180,
- };
- //第一个参数是对象参数 {title:title,msg:msg}
- if (typeof title == "object") {
- $.extend(params, title);
- } else {
- params.title = title;
- params.msg = msg;
- params.callback = callback;
- params.cancelCallback = cancelCallback;
- params.url = "/page/sure.jsp?msg=" + encodeURIComponent(msg);
- }
- /// 增加,来自 PMS下载。Lin
- if (!params.url)
- params.url = "/page/sure.jsp?msg=" + encodeURIComponent(params.msg);
- ///
- var dialogid = wd.display.showComponent({
- show: ["wdDialog"],
- hide: [],
- url: params.url,
- title: params.title || " ",
- width: params.width,
- height: params.height,
- });
- if (typeof params.callback == "string") {
- // window[dialogid+wd.display.callback_suffix]=eval(callback);
- window[dialogid + wd.display.callback_suffix] = function () {
- var iframe = wd.display.getFrameOfWindow();
- // console.log(this)
- if (iframe.tabObj == null) {
- this.location = params.callback;
- } else {
- this.parent.location = params.callback;
- }
- };
- } else if (typeof params.callback == "function") {
- window[dialogid + wd.display.callback_suffix] = params.callback;
- }
- if (params.cancelCallback) {
- window[dialogid + wd.display.cancelcallback_suffix] = params.cancelCallback;
- }
- };
- //window.confirm = wd.display.confirm;
- //
- wd.display.alert = function (message, options) {
- wd.display.showMsgPopup(message, options);
- };
- // window.alert = wd.display.alert; // 再去掉,恢复 window.alert -- 需要使用不定时消失的对话框。Lin
- // isFixation 为 true 时,弹窗将立刻固定在右下角
- wd.display.isFixation = false;
- wd.display.fixationAlert = function (message, options) {
- wd.display.isFixation = true;
- wd.display.showMsgPopup(message, options);
- wd.display.isFixation = false;
- };
- // window.alert = wd.display.fixationAlert; // 再去掉,恢复 window.alert -- 需要使用不定时消失的对话框。Lin
- /**
- *
- * 获取弹窗内所有window对象
- *
- */
- wd.display.getwdDialogWindowObjects = function (wdDialogId) {
- var contain = wd.display.getwdDialogWindows(wdDialogId);
- if (!contain) return null;
- var aaa = [];
- var thisIframe = contain.getFrame();
- var cc = 0;
- do {
- if (thisIframe.contentWindow.closed) break;
- aaa.push(thisIframe.contentWindow.window);
- thisIframe = thisIframe.contentWindow.document.querySelector("iframe");
- cc++;
- } while (thisIframe && cc <= 100);
- return aaa;
- };
- wd.display.shareTable = function (wdDialogId) {
- // console.log("archive!");
- var iframe = wd.display.getFrameOfWindow();
- //归档按钮
- if (iframe != null && iframe.contentWindow == window) {
- var bottom_div = $(".bottom-down-div");
- if (bottom_div.find(".submitButton").length == 0) {
- // bottom_div.append("<input type=\"button\" class=\"bottom-button submitButton\" value=\"确认\" />")
- // bottom_div.append("<input type=\"button\" class=\"bottom-button authorize\" value=\"授权\" />")
- // bottom_div.append("<select id=\"xxgkfsmOption\"><option value='1'>系统内公开</option><option value='1'>不公开</option></select>")
- bottom_div.html(
- '<input type="button" class="bottom-button submitButton" value="确认" />' +
- '<input type="button" class="bottom-button authorize" value="授权" />' +
- '<select id="xxgkfsmOption" style="display:none;"><option value="1">系统内公开</option><option value="1">不公开</option></select>' +
- bottom_div.html()
- );
- bottom_div.on("click", ".authorize", function () {
- wd.display.getwdDialogWindows().getFrame().contentWindow.authorize();
- });
- bottom_div.on("click", ".submitButton", function () {
- wd.display.getwdDialogWindows().getFrame().contentWindow.agree();
- });
- }
- }
- var tokenList = [];
- var tokenData = {};
- var $elements = $("[onclick^='wd.display.showComponent']:not(:hidden)").each(
- function (num, ele) {
- var showComponentFunStr = this.getAttribute("onClick");
- //获取token查询
- var reg = new RegExp("ssToken=[0-9a-zA-Z]+", "g"); // ("token=[。Lin
- var patt = reg.exec(showComponentFunStr);
- if (patt == null) return true;
- var token = patt[0].split("=")[1];
- tokenList.push(token);
- tokenData[token] = {
- type: "childObject",
- ele: this,
- };
- }
- );
- // console.log(tokenData)
- if (iframe != null && iframe.contentWindow == window) {
- var reg = new RegExp("ssToken=[0-9a-zA-Z]+", "g"); // ("token=[。Lin
- var patt = reg.exec(window.location.href);
- var token = "";
- if (patt == null) {
- // return true
- token = window.location.href;
- } else {
- token = patt[0].split("=")[1];
- }
- tokenList.push(token);
- tokenData[token] = {
- type: "primaryObject",
- };
- }
- if (tokenList.length == 0) return;
- // console.log(tokenList)
- /* 再改,规范命名。Lin
- * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
- * &wdService= 改为 ssServ
- $.post("/service?wdApplication=wd&wdService=objectDataQueryByToken", {
- */ $.post(
- "/service?ssServ=objectDataQueryByToken",
- {
- tokenList: JSON.stringify(tokenList),
- },
- function (data) {
- data = eval(data);
- var mark = wd.topWindow.mark[wdDialogId];
- // console.log(tokenData)
- for (var i = 0; i < data.length; i++) {
- var temp = data[i];
- var ele = tokenData[temp.token].ele;
- var type = tokenData[temp.token].type;
- var keyid = temp.object + temp.id;
- var checked =
- temp.checked == "true" || temp.checked == true ? true : false;
- if (!mark[keyid]) {
- mark[keyid] = {
- id: temp.id,
- type: type,
- object: temp.object,
- checkStatue: checked,
- checked: checked,
- };
- }
- // console.log(mark[keyid]);
- // console.log(mark[keyid])
- if (type != "childObject") continue;
- var topDoc = window.document;
- var chartDiv = topDoc.createElement("div");
- chartDiv.setAttribute("id", keyid);
- topDoc.body.appendChild(chartDiv);
- // chartDiv.innerHTML = "<input id=\"" + keyid + "\" type='checkbox' " + (mark[keyid].checked ? "checked" : "") +
- // " value='' />";
- if (mark[keyid].checked) {
- chartDiv.setAttribute("class", "smallButton-checked checked");
- } else {
- chartDiv.setAttribute("class", "smallButton-unchecked");
- }
- var bounding = ele.getBoundingClientRect();
- $(chartDiv).css({
- left: bounding.left - chartDiv.offsetWidth * 0.5,
- top: bounding.top + ele.offsetHeight * 0.5 - chartDiv.offsetHeight,
- // width: "auto",
- // height: ele.offsetHeight,
- zIndex: 65535,
- position: "absolute",
- // background: (mark[keyid].checkStatue != mark[keyid].checked ? 'red' : 'cyan'),
- // display: 'block'
- });
- $(chartDiv).on("click", function () {
- var id = this.getAttribute("id");
- var checked = $(this).hasClass("smallButton-unchecked");
- var mark = wd.topWindow.mark[wdDialogId];
- mark[id]["checked"] = checked;
- // console.log(checked)
- if (checked) {
- this.setAttribute("class", "smallButton-checked");
- } else {
- this.setAttribute("class", "smallButton-unchecked");
- }
- //
- //
- // $(this).css({
- // background: (mark[id]["checkStatue"] != mark[id]["checked"] ? 'red' : 'cyan'),
- // })
- // console.log(wd.topWindow.mark[wdDialogId])
- });
- }
- }
- );
- };
- //临时js
- $(function () {
- //首页模板添加样式
- if (wd.topWindow && wd.topWindow.MenuSetting) {
- var topiframe = wd.topWindow.document.querySelector(
- "iframe[name=" + wd.topWindow.MenuSetting.target + "]"
- );
- if (topiframe && topiframe.contentWindow) {
- if (topiframe.contentWindow == window) {
- $(window.document.body).addClass("home-div");
- $(wd.topWindow.document.body).addClass("home-div");
- $(".gridster,#pg_cj").addClass("home-div");
- }
- }
- }
- //动态添加单记录授权按钮
- var wdDialogId = wd.display.getwdDialogId();
- // return;
- if (!wdDialogId) return;
- if (!wd.topWindow.mark) wd.topWindow.mark = {};
- //打标记
- if (document.querySelector("meow")) {
- if (!wd.topWindow.mark[wdDialogId]) wd.topWindow.mark[wdDialogId] = {};
- }
- if (wd.topWindow.mark[wdDialogId]) {
- wd.display.shareTable(wdDialogId);
- }
- var win = wd.topWindow.dhxWins.window(wdDialogId);
- if (wd.topWindow.lockScreen) {
- win.button("lockScreen").onclick = function () {
- wd.display.beaconLogin("loginOut");
- wd.topWindow.lockScreen();
- };
- win.button("lockScreen").show();
- }
- });
- //查询获取object的function服务
- //结果用来调用弹窗方法 wd.display.showComponent.call(window,r);
- wd.display.createObjectService = function (objName, functionName) {
- var p = {
- objName: objName,
- funcName: functionName,
- };
- var r = null;
- $.ajax({
- type: "post",
- /* 再改,规范命名。Lin
- * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
- * &wdService= 改为 ssServ
- url: "/service?wdApplication=wd&wdService=createObjectService&wdtest=false",
- */ url: "/service?ssServ=makeFuncParm",
- data: p,
- async: false,
- dataType: "json",
- success: function (result) {
- r = result;
- // console.log(r);
- addRemoveToken(r.token);
- r.show = "wdDialog";
- // wd.display.showComponent.call(window,r);
- if (r.pageList) {
- for (var i = 0; i < r.pageList.lenth; i++) {
- addRemoveToken(r.pageList[i].token);
- }
- }
- },
- error: function (error) {
- // alert("查询失败")
- console.log(error);
- },
- });
- return r;
- };
- wd.display.showTextTile = function (id, msg) {
- var iii = document.getElementById(id);
- iii.parentNode.setAttribute("title", msg);
- iii.parentNode.removeChild(iii);
- };
- var styleAttrs = {
- width: "width",
- height: "minHeight",
- };
- var isdebug = false;
- wd.display.initGrowHighHtml = function (areaId, maxHeight, buttons) {
- return wd.display.initGrowHigh(areaId, maxHeight, buttons, true);
- };
- wd.display.initGrowHigh = function (areaId, maxHeight, buttons, multimedia) {
- // if (typeof GrowHeight == "undefined")
- // $.getScript("/wd/js/growHeight.js", function () {
- // getGrowHeight(areaId, maxHeight, buttons);
- // });
- // else
- return getGrowHeight(areaId, maxHeight, buttons, multimedia ? 2 : 3);
- };
- /* 再改,部件里的 var wdFitHeightbqgd= 改为 ssLblHeightByFith=。Lin
- if (!window.wdFitHeightbqgd) {
- window.wdFitHeightbqgd = 0;
- }
- */
- if (!window.ssLblHeightByFith) window.ssLblHeightByFith = 0;
- /**
- * wdfitheight传入减去高度
- */
- wd.display.fitHeightbqgd = function (n) {
- /* 再改,部件里的 var wdFitHeightbqgd= 改为 ssLblHeightByFith=。Lin
- window.wdFitHeightbqgd += n;
- */ window.ssLblHeightByFith += n;
- };
- wd.display.initGrowHighByIds = function (ids, maxHeight) {
- for (var i = 0; i < ids.length; i++) {
- if (typeof ids[i] != "string") {
- console.error("这不是一个ID");
- continue;
- }
- wd.display.initGrowHigh(ids[i], maxHeight, {});
- }
- };
- wd.display.ellipsisContent = function (dom, height) {
- function setText(text) {
- var nn = this.nodeName;
- if (nn == "TEXTAREA" || nn == "INPUT") {
- this.value = text;
- } else {
- this.innerText = text;
- }
- }
- function getText() {
- var nn = this.nodeName;
- if (nn == "TEXTAREA" || nn == "INPUT") {
- return this.value;
- } else {
- return this.innerText;
- }
- }
- function haveScroll(dom) {
- return dom.scrollHeight > dom.clientHeight;
- }
- function getCnHeight() {
- var otxt = getText.call(this);
- setText.call(this, "中");
- var cnHeight = Math.max(this.scrollHeight, this.clientHeight);
- setText.call(this, otxt);
- return cnHeight;
- }
- var css = dom.style.cssText,
- $dom = $(dom),
- srcText = getText.call(dom);
- dom.srcText = srcText;
- var _style = window.getComputedStyle(dom);
- var fontSize = _style.fontSize;
- fontSize = parseInt(fontSize) || $("body").css("font-size");
- var domWidth = $dom.width();
- var cnHeight = getCnHeight.call(dom);
- height =
- height || parseFloat(_style.height) || parseFloat($dom.css("min-height"));
- height = Math.max(cnHeight, height);
- dom.style.setProperty("height", height + "px", "important");
- setText.call(dom, dom.srcText);
- if (srcText.length == 0 || height == 0) {
- dom.style.cssText = css;
- return srcText;
- }
- // console.log(dom, cnHeight, height, fontSize, haveScroll(dom));
- // var noBlankText = srcText.replace(/\s/g, "");
- var endOffset = parseInt(domWidth / fontSize); //大概一行的字数
- var viewText = srcText.substring(0, endOffset);
- setText.call(dom, viewText);
- var dot = false;
- while (endOffset < srcText.length && !haveScroll(dom)) {
- //还有字但是没有滚动条,加
- endOffset++;
- viewText = srcText.substring(0, endOffset);
- setText.call(dom, viewText);
- if (haveScroll(dom)) {
- //
- dot = true;
- }
- }
- while (endOffset > 0 && haveScroll(dom)) {
- //出了滚动条,减
- endOffset--;
- viewText = viewText.substring(0, endOffset) + "...";
- (function (vt) {
- setText.call(dom, vt);
- })(viewText);
- }
- setText.call(dom, viewText);
- dom.style.cssText = css;
- return viewText;
- };
- //显示tag圆点
- wd.display.showTagState = function (url) {
- // console.log(url)
- $(function () {
- var tokenList = [];
- var lis = document.querySelectorAll("[ssTabClick]"); // ("[wdtabclick]")。先改,是 wdtabclick,不是 wdTabClick。Lin
- for (var i = 0; i < lis.length; i++) {
- var reg = new RegExp("ssToken=[0-9a-zA-Z]+", "g"); // ("token=[。Lin
- var patt = reg.exec(lis[i].getAttribute("ssTabClick")); // ("wdtabclick"))。先改,是 wdtabclick,不是 wdTabClick。Lin
- if (patt == null) {
- tokenList.push(null);
- } else {
- var token = patt[0].split("=")[1];
- tokenList.push(token);
- }
- }
- // console.log(7777777777)
- // console.log(tokenList)
- //
- $.post(
- url,
- {
- tokenList: JSON.stringify(tokenList),
- },
- function (result) {
- result = eval("(" + result + ")");
- // console.log(result);
- for (var i = 0; i < lis.length; i++) {
- if (!result[i]) continue;
- if (true == result[i].cgxList) {
- // ("true" ==。字符串改为布尔型。Lin
- lis[i].innerHTML =
- lis[i].innerHTML +
- '<span class="statePoint icon-highlightPoint"></span>';
- } else if (true == result[i].objectList) {
- // ("true" ==。字符串改为布尔型。Lin
- lis[i].innerHTML =
- lis[i].innerHTML +
- '<span class="statePoint icon-dimPoint"></span>';
- } else {
- }
- }
- }
- );
- });
- };
- //级联查看 growheight前文本处理
- wd.display.combineDiv = function (id) {
- // console.log($("#" + id).children().find("[id$=combine]"))
- //
- if (
- $("#" + id)
- .children()
- .find("[id$=combine]").length > 0
- )
- return;
- var content = "";
- var isCascading =
- $("#" + id).find(".content-offButton,.content-onButton").length == 0;
- if (isCascading) {
- $("#" + id)
- .children(":visible")
- .each(function () {
- content += this.innerHTML + " ";
- });
- } else {
- $("#" + id)
- .find(":visible")
- .each(function () {
- if ($(this).is("[type=button]")) {
- // var name = this.getAttribute("name");
- // if ("1" == $("[type=hidden][name=" + name + "]").val()) {
- // content += ($("[type=button][name=" + name + "][wdValue=1]").val() + " ");
- // }
- if ($(this).hasClass("content-onButton")) {
- content += $(this).val() + " ";
- }
- }
- });
- }
- if (/\ \;$/.test(content))
- content = content.substring(0, content.length - " ".length);
- $("#" + id)
- .empty()
- .html(content);
- };
- wd.display.initSelectOption = function (id) {
- wd.topWindow.$("#" + id).remove();
- var ele = $(
- '<div id="' +
- id +
- '" class="popup-div hLine-highlightBlod" >' +
- '<div class="scrollbar" style="max-height:250px;overflow-x:auto;padding-right:16px;"></div>' +
- "</div>"
- )[0];
- wd.topWindow.document.body.appendChild(ele);
- return ele;
- };
- wd.display.buildSelectOption = function (
- dom,
- datalist,
- valueKey,
- nameKey,
- selectValue,
- hasNullOption
- ) {
- var ul = dom.childNodes[0];
- if (datalist && datalist.length > 0) {
- var listr = hasNullOption
- ? '<div class="popupList" status="noitem"> </div>'
- : "";
- for (var i = 0; i < datalist.length; i++) {
- var name = datalist[i][nameKey];
- var value = datalist[i][valueKey];
- listr +=
- '<div class="' +
- (value == selectValue ? " selected " : "") +
- 'popupList" status="people" value="' +
- value +
- '"' +
- 'index="' +
- i +
- '">' +
- name +
- "</div>";
- }
- ul.innerHTML = listr;
- } else {
- ul.innerHTML = hasNullOption
- ? '<div class="popupList" status="noitem">找不到相关项</div>'
- : "";
- }
- };
- wd.display.queryNrSubNr = function (nrid, jlztm, datas) {
- var result = [];
- $.ajax({
- type: "post",
- url: "/service",
- dataType: "json",
- data: {
- ssServ: "wrCmsList", // wdService: "nrxtsy",。Lin
- nrid: "T-" + nrid,
- sfbf: 1,
- jlztm: jlztm,
- },
- async: false,
- success: function (jsonData) {
- for (var i = 0; i < jsonData.length; i++) {
- result.push({
- name: jsonData[i].mc,
- value: jsonData[i].mswj,
- nrjslbm: jsonData[i].nrjslbm,
- });
- }
- },
- });
- return result;
- };
- wd.display.initCmsbtn = function (btn, fjid) {
- if (fjid != null && fjid != "") {
- $.ajax({
- type: "post",
- url: "/service?ssServ=wrCcmsList", // =getSubNrCount",。Lin
- data: {
- nrid: "T-" + fjid,
- jlztm: 51,
- },
- dataType: "json", // 增加,统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData。Lin
- success: function (data) {
- /* 改,增加错误处理 -- 统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData。Lin
- * 去掉 JSON.parse(,改为用 Map<String, Object> 传输
- var names = JSON.parse(data);
- */
- if (data.ssCode != 0) {
- alert(data.ssMsg);
- return;
- }
- var names = data.ssData;
- var count = names.length;
- //if (count > 0) {
- var num = btn[0].querySelector(".attachment_count");
- if (!num) {
- num = document.createElement("span");
- num.className = "attachment_count";
- btn[0].appendChild(num);
- }
- num.innerText = count;
- if (count == 0) {
- $(num).hide();
- } else {
- $(num).show();
- }
- var datas = [];
- for (var iii = 0; iii < names.length; iii++) {
- datas.push({
- name: iii,
- value: names[iii],
- });
- }
- btn.off("mouseenter").on("mouseenter", function () {
- var menuelement = wd.display.initCmsMenu(fjid + "", 51);
- if (menuelement) {
- menuelement.showAt(btn[0]);
- btn.off("mouseleave").on("mouseleave", function () {
- menuelement.hide();
- });
- }
- });
- },
- error: function (data) {
- console.log(data);
- },
- });
- }
- };
- wd.display.initCmsMenu = function (id) {
- wd.topWindow.$("#CMSMENU").remove();
- var nrid = (id = id.replace(/\D*/, ""));
- //注册内容
- $.ajax({
- url: "/service",
- data: {
- nrid: "T-" + nrid,
- ssServ: "regCms", // wdService: "register"。Lin
- },
- async: false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- },
- });
- var data = wd.display.queryNrSubNr(nrid);
- if (data.length == 0) {
- return;
- }
- var mainElement = wd.display.initSelectOption("CMSMENU");
- function loadPlayer(contentDiv) {
- var win = contentDiv.ownerDocument.defaultView;
- var se = contentDiv.srcElement,
- $se = $(se),
- subnrid = $se.attr("value"),
- nrjslbm = $se.attr("nrjslbm");
- win.$.ajax({
- type: "GET",
- url: "/service",
- data: {
- ssServ: "wrCmsPlay", // : wdService: "loadNrDesignAndPlayerData",。Lin
- nrid: subnrid,
- nrjslbm: nrjslbm,
- },
- async: false,
- dataType: "json",
- success: function (data) {
- /// 增加,增加错误处理 -- 统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData。Lin
- if (data.ssCode != 0) {
- alert(data.ssMsg);
- return;
- }
- ///
- var div = document.createElement("div");
- var obj = {};
- obj.design = data.design;
- obj.resDesign = data.resDesign;
- div.setAttribute("data-init", JSON.stringify(obj));
- var tempData = data.data.replace(
- new RegExp("@dataFolder@", "gm"),
- data.dataFolderPath
- );
- var $ma = win.$(contentDiv);
- var hasClose = $ma.find("#pageClose").length > 0;
- div.innerHTML = tempData;
- var $div = $(div);
- // $div.hide();
- $ma.html($div);
- $ma.append(
- '<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>'
- );
- // var $content = $(contentDiv);
- // loadScorll($content);
- // $content.getNiceScroll().resize();
- div.addEventListener("DOMSubtreeModified", function () {
- try {
- win.wd.display.CmsZNRFull(contentDiv);
- } catch (e) {}
- // var $content = $(contentDiv);
- // loadScorll($content);
- // $content.getNiceScroll().resize();
- // $content.css("height", $content.height());
- // $content.css("height", "100%");
- });
- },
- });
- var $pe = $se.prev(".popupList"),
- prev = $pe.attr("value"),
- $ne = $se.next(".popupList"),
- next = $ne.attr("value");
- var ismousedown = false;
- var oldY, scollY;
- contentDiv.onmousedown = function (e) {
- oldscrollTop = contentDiv.scrollTop;
- oldY = e.screenY;
- scollY = contentDiv.scrollTop;
- ismousedown = true;
- };
- contentDiv.onmouseup = function (e) {
- ismousedown = false;
- };
- contentDiv.onmousemove = function (e) {
- e = e || window.event;
- var newY = e.screenY;
- if (ismousedown) {
- //console.log(element.scrollTop + element.clientHeight+"###"+element.scrollHeight)
- if (
- oldY - newY >= 150 &&
- contentDiv.scrollTop + contentDiv.clientHeight + 1 >=
- contentDiv.scrollHeight &&
- oldscrollTop + contentDiv.clientHeight + 1 >= contentDiv.scrollHeight
- ) {
- ismousedown = false;
- // console.log("鼠标向上移动");
- if ($ne.length > 0) {
- contentDiv.srcElement = $ne[0];
- loadPlayer(contentDiv);
- }
- // console.log(contentDiv.getAttribute("isCmsFullScreen"));
- } else if (
- newY - oldY >= 150 &&
- contentDiv.scrollTop <= 0 &&
- oldscrollTop == 0
- ) {
- ismousedown = false;
- // console.log("鼠标向下移动");
- if ($pe.length > 0) {
- contentDiv.srcElement = $pe[0];
- loadPlayer(contentDiv);
- }
- // console.log(contentDiv.getAttribute("isCmsFullScreen"));
- } else {
- contentDiv.scrollTop = scollY + (oldY - e.screenY); //此处调节滚动速度
- }
- }
- };
- // console.log("加载播放器完毕")
- }
- mainElement.style.minWidth = "180px";
- wd.display.buildSelectOption(mainElement, data, "value", "name", "null");
- var $mainElement = wd.topWindow.$(mainElement);
- $.each(data, function () {
- $mainElement
- .find("[value='" + this.value + "']")
- .attr("nrjslbm", this.nrjslbm);
- });
- $mainElement.find(".popupList").click(function () {
- //绑定全屏
- var doc = mainElement.ownerDocument;
- var maindiv = doc.querySelector("#CMSPLAY" + id);
- if (maindiv == null) {
- //创建打的包装div
- maindiv = doc.createElement("div");
- maindiv.id = "CMSPLAY" + id;
- maindiv.style.textAlign = "center";
- maindiv.onselectstart = function () {
- return false;
- };
- doc.body.appendChild(maindiv);
- $(maindiv).append('<link rel="stylesheet" href="/ss/pdf/base.min.css">');
- $(maindiv).append('<link rel="stylesheet" href="/ss/pdf/fancy.min.css">');
- $(maindiv).append(
- '<script type="text/javascript" src="/ss/pdf/compatibility.min.js"></script>'
- );
- $(maindiv).append(
- '<script type="text/javascript" src="/ss/pdf/pdf2htmlEX.min.js"></script>'
- );
- var contentDiv = (maindiv.contentDiv = doc.createElement("div"));
- contentDiv.className = "mainDiv";
- contentDiv.style.width = "100%";
- contentDiv.style.height = "100%";
- contentDiv.style.display = "flex";
- contentDiv.style.justifyContent = "center";
- contentDiv.style.background = "white";
- contentDiv.style.alignItems = "center";
- maindiv.appendChild(contentDiv);
- }
- maindiv.contentDiv.srcElement = this;
- // setTimeout(function () {
- // console.log("开始全屏")
- doc.defaultView.wd.display.CmsFullScreen(
- maindiv.getElementsByTagName("DIV")[0],
- function () {
- loadPlayer(maindiv.contentDiv);
- $(maindiv).children("#pageClose").remove();
- },
- function () {
- maindiv.parentNode.removeChild(maindiv);
- doc.defaultView.clearInterval(maindiv.contentDiv.intervalID);
- }
- );
- // }, 500);
- });
- $mainElement.mouseenter(function () {
- if (this.removeTimerId != null) {
- this.ownerDocument.defaultView.clearTimeout(this.removeTimerId);
- this.removeTimerId = null;
- }
- });
- mainElement.hide = function () {
- mainElement.removeTimerId =
- mainElement.ownerDocument.defaultView.setTimeout(function () {
- $mainElement.remove();
- }, 300);
- };
- $mainElement.mouseleave(function () {
- this.hide();
- });
- mainElement.showAt = function (element) {
- $mainElement.show();
- var bounding = element.getBoundingClientRect(),
- mb = mainElement.getBoundingClientRect(),
- xy = recursionIframe(window);
- var left = bounding.right + xy.left - mb.width;
- var top_ = bounding.top + xy.top - 10 - mb.height;
- $mainElement.css({
- left: left,
- top: top_,
- });
- };
- $mainElement.click(function (e) {
- e.stopPropagation();
- });
- $("body").click(function () {
- mainElement.hide();
- });
- $("body", wd.topWindow.document).click(function () {
- mainElement.hide();
- });
- $mainElement.hide();
- return mainElement;
- };
- //获取表单元素
- //growHeight
- //objectpicker
- //onoffbutton
- //ueditor
- //input select datepicker
- //编辑帮助,个人选值
- wd.display.getInputsGroups = function () {
- var arr = $("form,input,select,:radio,:checkbox").serializeArray();
- var ret = {};
- for (var i = 0; i < arr.length; i++) {
- var name = arr[i].name;
- if (!name) continue;
- if (/objectPicker.*/.test(name)) continue;
- var cc = wd.display.getInputBox(name);
- if (!cc) continue;
- ret[name] = cc;
- }
- return ret;
- };
- /**
- *
- * @param {Object} name
- * @param {Object} any true:不过滤隐藏元素
- */
- wd.display.getInputBox = function (name, any) {
- if (wd.display.filterInputBoxNames[name]) {
- // console.log("filterInputBoxNames:"+name);
- return null;
- }
- var result = {
- name: name,
- container: null, //定位元素
- setChange: null,
- focus: null, //光标
- onKeyDown: null, //enter key event
- onKeyDownContainer: null,
- modify: null,
- modifyContainer: null,
- };
- result.getValue = function () {
- return $(this.container).val();
- };
- result.setValue = function (v) {
- $(this.container).val(v);
- };
- result.setChange = function (changefunc) {
- $(this.container).on("change", changefunc);
- };
- result.focus = function () {
- $(this.container).focus();
- };
- result.modify = function (canmodify) {
- if (canmodify) {
- $(this.modifyContainer || this.container).removeAttr("readonly");
- } else {
- $(this.modifyContainer || this.container).attr("readonly", "readonly");
- }
- };
- //键盘录入监听,keycode 9:tab 13:enter
- result.onKeyDown = function (keycode, func) {
- var code = [];
- code = keycode;
- $(this.onKeyDownContainer || this.container).on("keydown", function () {
- if (code.indexOf(window.event.keyCode) != -1) {
- return func();
- }
- });
- };
- try {
- if (window.growHeightList && window.growHeightList[name]) {
- result.type = "growHeight";
- result.instance = growHeightList[name];
- result.container = growHeightList[name].container.parentNode;
- result.getValue = function () {
- return this.instance.val();
- };
- result.setValue = function (v) {
- this.instance.val(v);
- };
- result.focus = function () {
- this.instance.onFocus();
- };
- result.onKeyDownContainer = $(
- growHeightList[name].getInputElement().parentNode
- ).find("textarea");
- result.modifyContainer = growHeightList[name].getInputElement();
- } else if (
- wd &&
- wd.edit &&
- wd.edit.objectPicker &&
- wd.edit.objectPicker.getInstance(name)
- ) {
- result.type = "objectPicker";
- result.instance = wd.edit.objectPicker.getInstance(name);
- result.container = result.instance.getDisplayElement();
- result.getValue = function () {
- return this.instance.getValue();
- };
- result.setValue = function (v) {
- this.instance.initValue(v);
- };
- result.setChange = function (func) {
- this.instance.onchange = func;
- };
- result.modify = function (canmodify) {
- this.instance.modify(canmodify);
- };
- } else if (
- window.EditorManager &&
- EditorManager.instances &&
- EditorManager.instances[name]
- ) {
- result.type = "ueditor";
- result.container = EditorManager.instances[name].getUeditor().container;
- result.instance = EditorManager.instances[name].getUeditor();
- result.getValue = function () {
- var c = this.instance.getContent();
- return c ? wd.display.toPlainText() : c;
- };
- result.setValue = function (v) {
- return this.instance.setContent(v);
- };
- } else if ($("#" + name + "_onoffbutton_list").length == 1) {
- result.type = "onoffbutton";
- result.container = $("[name=" + name + "][type=button]").last()[0];
- result.getValue = function () {
- return $("[name='" + name + "'][type=hidden]").val();
- };
- result.setValue = function (v) {
- /* 改,是小写的 wdvalue=,也改先 -- 规范命名。Lin
- $("[name='"+name+"'][type=button][wdvalue="+v+"]").click();
- */ $("[name='" + name + "'][type=button][ssVal=" + v + "]").click();
- };
- } else if (window.enrolDateList && window.enrolDateList[name]) {
- result.type = "enrolDate";
- result.instance = window.enrolDateList[name];
- result.container = window.enrolDateList[name].container;
- result.getValue = function () {
- return this.instance.getValue();
- };
- result.setValue = function (v) {
- this.instance.setValue(v);
- };
- result.setChange = function (func) {
- this.instance.onchange = func;
- };
- } else if (window.editPhotoList && window.editPhotoList[name]) {
- result.type = "editPhoto";
- result.instance = window.editPhotoList[name];
- result.container = window.editPhotoList[name].container;
- result.getValue = function () {
- return this.instance.getValue();
- };
- result.setValue = function (v) {
- this.instance.setValue(v);
- };
- result.modify = function (canmodify) {
- this.instance.modify(canmodify);
- };
- } else if (document.querySelector("[name='" + name + "']")) {
- result.type = "input";
- result.container = document.querySelector("[name='" + name + "']");
- } else {
- return null;
- }
- if (any) {
- } else {
- if ($(result.container).width() == 0) return null;
- }
- } catch (e) {
- console.log(e);
- }
- return result;
- };
- if (!wd.display.filterInputBoxNames) {
- wd.display.filterInputBoxNames = {};
- }
- /**
- * 过滤inputbox
- */
- wd.display.filterInputBox = function (name) {
- for (var i = 0; i < arguments.length; i++) {
- var m = arguments[i];
- wd.display.filterInputBoxNames[m] = "1";
- }
- // console.log(wd.display.filterInputBoxNames);
- };
- wd.display.changeFirstTitle = function (t) {
- var displgid = wd.display.getwdDialogId();
- if (!displgid) return;
- wd.topWindow.dhxWins
- .window(displgid)
- .querySelector(".dialog-title").innerHTML = t;
- };
- wd.display.changeSecondTitle = function (t) {
- var displgid = wd.display.getwdDialogId();
- if (!displgid) return;
- wd.topWindow.dhxWins
- .window(displgid)
- .querySelector(".secondTitle").innerHTML = t;
- };
- /**
- * 判断当前url是否个人首页
- * @param {Object} win
- */
- wd.display.isPersonalHomePageUrl = function (url) {
- if (!url) return false;
- return url.indexOf("initDesktop") == -1 ? false : true;
- };
- /**
- * 生成更多按钮
- * @param {Object} buttonId
- * @param {Object} childrenClass
- * selectedDiv 选中菜单,显示按钮名称
- * recordvalue 启用个人选值
- */
- wd.display.attachButton = function (
- buttonId,
- childrenClass,
- selectedDiv,
- buttonNotClickAschild,
- recordvalue
- ) {
- var $button = $("#" + buttonId);
- var vanishId;
- //获取二级数据
- function findDatalist() {
- var datalist = [];
- var d = document.querySelectorAll("." + childrenClass);
- //adminNo
- for (var i = 0; i < d.length; i++) {
- datalist.push({
- name: d[i].getAttribute("value"),
- value: d[i].getAttribute("value"),
- ele: d[i],
- });
- }
- return datalist;
- }
- function showChild(v, isinit) {
- var datalist = findDatalist();
- var thisdata;
- for (var i = 0; i < datalist.length; i++) {
- if (datalist[i].value == v) {
- thisdata = datalist[i];
- }
- }
- //记忆,点击按钮触发上一个点击过的选项
- $button.off("click");
- if (true === buttonNotClickAschild) {
- $button.on("click", function () {
- vanishId = setTimeout(function () {
- $("#" + buttonId + "_buttons").hide();
- }, 500);
- });
- } else {
- $("#" + buttonId + "_buttons").hide();
- var html = thisdata ? thisdata.name : "";
- if (true === isinit) {
- html = $button.val() + html;
- }
- if (selectedDiv) {
- $button.find(selectedDiv).html(html);
- } else if ($button.is("input")) {
- $button.val(html);
- }
- $button.on("click", function () {
- $(thisdata.ele).trigger("click");
- });
- }
- return thisdata;
- }
- $button
- .on("mouseenter click", function () {
- //获取下拉数据
- var datalist = findDatalist();
- //create div
- $("#" + buttonId + "_buttons").remove();
- var dom = wd.display.initSelectOption(buttonId + "_buttons");
- if (datalist.length > 0) {
- /* 再改,不知为何要反转 细分部件(原 plugin) 顺序???Lin
- wd.display.buildSelectOption(dom, datalist.reverse(), "value", "name", null, false);
- */ wd.display.buildSelectOption(dom, datalist, "value", "name", null, false);
- $("body").append(dom);
- }
- //position
- var dombounding = dom.getBoundingClientRect();
- var bounding = (
- this.querySelector("img") || this
- ).getBoundingClientRect();
- //console.log(bounding);
- var left = bounding.left;
- //防止超出屏幕出现滚动条
- if (left + dombounding.width > window.innerWidth) {
- left = window.innerWidth - dombounding.width;
- }
- dom.style.left = Math.max(left, 0) + "px";
- if (
- bounding.top + bounding.height + dombounding.height >
- window.innerHeight
- ) {
- dom.style.top = bounding.top - dombounding.height + "px";
- //console.log("up side")
- } else {
- //console.log("down side")
- dom.style.top = bounding.top + bounding.height + "px";
- }
- //bind event
- $(dom)
- .on("click", ".popupList", function () {
- if (window.event) {
- if (window.event.stopPropagation) {
- window.event.stopPropagation();
- } else {
- window.event.cancelBubble = true;
- }
- }
- var v = this.getAttribute("value");
- var thisdata = showChild(v);
- $(thisdata.ele).trigger("click");
- // console.log(thisdata);
- if (recordvalue) {
- var recordzhi = {};
- recordzhi[buttonId] = {
- value: v,
- default: true,
- };
- wd.edit.insertRecord(recordzhi);
- }
- })
- .on("mouseleave", function () {
- $(this).hide();
- })
- .on("mouseenter", function () {
- if (vanishId) clearTimeout(vanishId);
- });
- })
- .on("mouseleave", function () {
- if ($(window.event.relatedTarget).is($(this).parents())) {
- vanishId = setTimeout(function () {
- $("#" + buttonId + "_buttons").hide();
- }, 500);
- }
- });
- if (recordvalue) {
- $(function () {
- var record = wd.edit.getRecord();
- // console.log(record);
- if (record && record[buttonId]) {
- var v = record[buttonId].value;
- showChild(v, true);
- }
- });
- }
- };
- wd.display.inputCaptcha = function (name, captchalength) {
- try {
- var inputbox = wd.display.getInputBox(name);
- if (!inputbox) return;
- var inputClass = name + "_inputCaptcha";
- var va = $(
- '<div style="position:absolute; left: 5px;top: 5px;width: 100%;height: 100%;z-index: 1;display: flex;">' +
- '<div class="hLine" style="display: flex; height: 30px;">' +
- '<input class="' +
- inputClass +
- '" style="width:140px;border: none;padding-left: 7px;" placeholder=\'请输入验证码\'/>' +
- '<img align="middle" vspace="2" id="codeimg" title="看不清楚可单击刷新" class="header_yzmimg" src="/wd/verificationCode.do?' +
- new Date().getTime() +
- '">' +
- // +"<input type=\"button\" value=\"确定\" class=\"content-button\" onclick=\"void(0);\" style=\"margin-left: 10px;\"/>"
- "</div>" +
- "</div>"
- );
- // va.css({position:"absolute",left:0,top:0,width:"100%",height:"100%",background:"azure",zIndex:1})
- $(inputbox.container).before(va);
- va.on("click", "img", function () {
- this.setAttribute(
- "src",
- "/wd/verificationCode.do?" + new Date().getTime()
- );
- }).on("blur", "." + inputClass, function () {
- /* 再改,规范命名。Lin
- * 去掉 ?wdApplication=,不支持多个应用 -- 服务名可以写 ss.xxx
- * &wdService= 改为 ssServ
- $.post("/service?wdApplication=wd&wdService=checkCaptcha_ajax&wdtest=false", {
- */ $.post(
- "/service?ssServ=checkCaptcha_ajax",
- {
- yzm: this.value,
- },
- function (result) {
- if ("1" == result.result) {
- va.hide();
- $(inputbox.container).show();
- if (typeof window.inputCaptchaCallback == "function")
- window.inputCaptchaCallback();
- } else {
- wd.display.alert("验证码错误!");
- }
- },
- "json"
- );
- });
- $(inputbox.container).hide();
- } catch (e) {
- console.log(e);
- }
- };
- wd.display.previewPicture = function (url, errorPhoto) {
- if ($(window.event.srcElement).is("input,button")) return;
- $(".previewPicture").remove();
- // var onerror = errorPhoto ? ('this.src=\'' + errorPhoto + '\'') : "";
- var onerror = "";
- // if(true)return;
- // $("<div class='previewPicture ' style=\"display:none;z-index: 999999;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);border: 1px solid #6c9ddb;\">"
- // + "<img src=" + url + " onerror=\"" + onerror + "\" style=\"max-width:100%;max-height: 100%;\" onload=\"$('.previewPicture').show()\"/>"
- // +"<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>"
- // +"<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>"
- // + "</div>")
- // .appendTo("body")
- // .on('click',".close", function () {
- // $('.previewPicture').remove();
- // });
- var startLeft, startTop, startX, startY;
- $(
- "<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;\">" +
- '<div class="lightDialog-title hLine">' +
- '<div title="下载" class="download icon-download" style="position: absolute;right: 35px;top: 9px;"></div>' +
- '<div title="关闭" class="close icon-close"></div>' +
- "</div>" +
- "<img src=" +
- url +
- ' onerror="' +
- onerror +
- '" style="max-width:100%;max-height: 100%;" onload="$(\'.previewPicture\').show()"/>' +
- "</div>"
- )
- .appendTo("body")
- .on("click", ".close", function () {
- $(".previewPicture").remove();
- })
- .on("click", ".download", function () {
- wd.display.downloadFile(url + "&download=1");
- // $('.previewPicture').remove();
- });
- // on("mousedown",function(){
- // startLeft=parseInt( $(this).css("marginLeft"));
- // startTop=parseInt( $(this).css("marginTop"));
- // startX=window.event.clientX;
- // startY=window.event.clientY;
- // this.setAttribute("move","1");
- // }).on("mouseup mouseout",function(){
- // this.setAttribute("move","0");
- // }).on("mousemove",function(){
- // if("1"!=this.getAttribute("move"))return;
- // $(this).css({
- // marginLeft:startLeft+window.event.clientX-startX,
- // marginTop:startTop+window.event.clientY-startY
- // })
- // })
- };
- wd.display.beaconLogin = function (type) {
- type = type || "login";
- try {
- if (typeof beacon == "undefined") return false;
- if (type == "login") {
- beacon.login(wd.topWindow.beaconLoginTicket);
- } else {
- beacon.loginOut();
- }
- return true;
- } catch (error) {
- console.log("------------------------------------");
- console.log(error);
- console.log("------------------------------------");
- }
- return false;
- };
- wd.display.getBeaconWhetherToOpen = function () {
- try {
- if (typeof beacon == "undefined") return false;
- if (beacon.getBeaconWhetherToOpen() == "True") {
- alert("“待办列表”已在烽火台打开");
- beacon.close2();
- }
- return true;
- } catch (error) {
- console.error(error);
- }
- return false;
- };
- wd.display.refreshToDoList = function () {
- wd.display.refreshHomeplugin("6011");
- };
- wd.display.refreshHomeplugin = function (type) {
- if (!wd.topWindow.wd.base.applyIframeElement.contentWindow.SYBJCTRL)
- return "0";
- return wd.topWindow.wd.base.applyIframeElement.contentWindow.SYBJCTRL.refreshHomeplugin(
- type
- );
- };
- wd.display.setCloseWindowParam = function (p) {
- if (!p) return;
- var wdDialogId = wd.display.getwdDialogId();
- if (!wdDialogId) return;
- var win = wd.topWindow.dhxWins.window(wdDialogId);
- win.closeWindowParam = p;
- return win;
- };
- wd.display.onCloseDialog = function (win, popWindow) {
- try {
- // console.log("wd.display.onCloseDialog");
- // console.log(win.closeWindowParam);
- if (!win.closeWindowParam) return;
- var openerWindow = popWindow.wd.display.getwdDialogOpener();
- var name = openerWindow.wd.edit.objectPicker.addButtonClickName;
- if (!name) return;
- var objectpickerobj = openerWindow.wd.edit.objectPicker.getInstance(name);
- if (!objectpickerobj) return;
- // var data={option:[{name:"abc",id:"999"}]};
- var data = eval("(" + win.closeWindowParam + ")");
- objectpickerobj.setwdCloseWindowParamData(data);
- // console.log(objectpickerobj);
- } catch (err) {
- console.error(err);
- }
- };
- /**
- * 调用关闭窗口时调用的回调方法
- */
- wd.display.closeDialogCallbackFun = null;
- /**
- * 给一个按钮绑定事件
- * @param {Object} buttonname
- * @param {Object} bindevent
- * @param {Object} bindfunction
- */
- wd.display.bindWdButton = function (buttonname, bindevent, bindfunction) {
- var wdDialogId = wd.display.getwdDialogId();
- if (!wdDialogId) return;
- var win = wd.topWindow.dhxWins.window(wdDialogId);
- var b = win.button(buttonname);
- $(b).on(bindevent, bindfunction);
- };
- /**
- * px 2 rem
- */
- wd.display.px2Rem = function (px) {
- var unit = parseFloat($("html").css("font-size"));
- return px / unit;
- };
- /**
- *
- * rem 2 px
- */
- wd.display.rem2Px = function (rem) {
- var unit = parseFloat($("html").css("font-size"));
- return rem * unit;
- };
- /*
- *
- 调用示例
- 1:
- wd.flashMsg.show({
- el: $("#domDiv"), // 吸附的元素
- msg: "hi,hello", // 内容
- time: 200000, // 显示的时间,默认 3000,单位毫秒,
- offset: 'd', // 气泡方向,[u]: 上, [d]: 下,当所定的方向无法完全显示内容时,将自动进行调整方向
- arrowsOffset: 'r', // 箭头方位,[l]:左边,[c]:居中,[r]:右,默认为[c]居中
- zindex: 100, // 层级,默认 1996,
- animate: true, // 为真则开启动画,默认开启
- end: function() {
- console.log("销毁后的回调");
- }
- });
- 2:
- wd.flashMsg.show("内容");
- */
- wd.flashMsg = {
- vars: {
- ARROWS_UP_CLASS_NAME: "flashMsg-up",
- ARROWS_DOWN_CLASS_NAME: "flashMsg-down",
- },
- timeout: undefined,
- flashDivTemplate: `<div class="flashMsg-div {flashMsgClassName}" id="flashmsgtipsId" style="left: 0px; top: 0px; display: none;{position}">
- <p>{msg}</p>
- <div class="{arrorwsClassName}" style="{arrorwsStyle}"></div>
- </div>`,
- show: function (param) {
- var setting;
- if (typeof param == "object") {
- setting = param;
- } else {
- setting = {
- el: window.event.srcElement,
- msg: param,
- };
- }
- if (!this.validation(setting)) {
- return;
- }
- // 获取吸附元素的坐标和宽高
- // var positionObj = this.getAbsolute(document, $(setting.el)[0]);
- var positionObj = $(setting.el).position();
- var offsetObj = $(setting.el).offset();
- var elTop = offsetObj.top;
- var elLeft = offsetObj.left;
- var elWidth = $(setting.el).innerWidth();
- var elHeight = $(setting.el).innerHeight();
- setting.time = isNaN(setting.time) ? 3000 : setting.time; // 显示时间,默认3秒
- setting.animate = setting.animate == undefined ? true : setting.animate; // 动画,默认为真
- setting.zindex = this.isNull(setting.zindex) ? 1996 : setting.zindex; // 气泡的层级样式,默认层级 999
- setting.offset = this.isNull(setting.offset) ? "d" : setting.offset; // 气泡的定位样式,默认在下面
- setting.arrowsOffset = this.isNull(setting.arrowsOffset)
- ? "l"
- : setting.arrowsOffset; // 箭头的定位样式,默认左边
- var arrorwsStyle = ""; // 箭头样式
- var flashMsgClassName = setting.animate ? "wd-anim wd-anim-upbit" : ""; // 动画
- var arrorwsClassName = undefined; // 箭头的类名
- // 气泡在上
- if (setting.offset && setting.offset == "u") {
- arrorwsStyle += "bottom: -10px;left: 7px";
- arrorwsClassName = this.vars.ARROWS_DOWN_CLASS_NAME;
- }
- // 气泡在下
- else if (setting.offset && setting.offset == "d") {
- arrorwsStyle += "bottom: -10px;left: 7px";
- arrorwsClassName = this.vars.ARROWS_UP_CLASS_NAME;
- }
- // 默认气泡在上
- else {
- arrorwsStyle += "bottom: -10px;left: 7px";
- arrorwsClassName = this.vars.ARROWS_DOWN_CLASS_NAME;
- }
- this.clearFlashMsg();
- $("body").append(
- this.getFlashDivTemplate(
- setting,
- elTop,
- elLeft,
- arrorwsClassName,
- arrorwsStyle,
- flashMsgClassName
- )
- );
- ////////////////////////////// 计算最终的坐标 //////////////////////////////
- var lastTop = -1;
- var flashDom = $("#flashmsgtipsId");
- var flashDomWidth = $(flashDom).innerWidth();
- var flashDomHeight = $(flashDom).innerHeight(); // 是箭头的高度
- $(flashDom).css({
- top: elTop + "px",
- left: elLeft + "px",
- });
- // 气泡在上
- if (arrorwsClassName == this.vars.ARROWS_DOWN_CLASS_NAME) {
- var lastDomTop = elTop - flashDomHeight - 16;
- lastTop = elTop - flashDomHeight - 16;
- // flashMsg 元素超出了窗口顶部范围
- if (lastDomTop < 0) {
- // 未尝试过向上的方向
- if (!setting.upFlag) {
- setting.offset = "d";
- setting.downFlag = true;
- this.show(setting);
- return;
- }
- lastTop = flashDomHeight + 6;
- }
- }
- // 气泡在下
- else if (arrorwsClassName == this.vars.ARROWS_UP_CLASS_NAME) {
- lastTop = elTop + elHeight + 20;
- var lastDomTop = elTop + elHeight + flashDomHeight + 20;
- // flashMsg 元素超出了窗口底部范围
- if (lastDomTop > window.innerHeight) {
- // 未尝试过向下的方向
- if (!setting.downFlag) {
- setting.offset = "u";
- setting.upFlag = true;
- this.show(setting);
- return;
- }
- lastTop = window.innerHeight - flashDomHeight - 12;
- }
- } else {
- console.error("arrorwsClassName [" + arrorwsClassName + "] error!");
- return;
- }
- this.settingFlashMsgArrorwsLeft(
- setting,
- arrorwsClassName,
- elWidth,
- elLeft,
- flashDom,
- flashDomWidth
- );
- $(flashDom).css("top", lastTop + "px");
- $(flashDom).show();
- if (setting.time != 0) {
- this.timeout = setTimeout(function () {
- wd.flashMsg.clearFlashMsg(setting);
- }, setting.time);
- }
- },
- /**
- * 清除气泡
- */
- clear: function () {
- this.clearFlashMsg();
- },
- settingFlashMsgArrorwsLeft: function (
- setting,
- arrorwsClassName,
- elWidth,
- elLeft,
- flashDom,
- flashDomWidth
- ) {
- var arrorwsDom = $(flashDom).find("div." + arrorwsClassName);
- // 箭头往左
- if (setting.arrowsOffset == "l") {
- var arrowLeft = 7;
- $(arrorwsDom).css("left", arrowLeft + "px");
- return;
- }
- // 箭头往右
- else if (setting.arrowsOffset == "r") {
- var arrowLeft = flashDomWidth - 20;
- // 箭头的位置超出了元素的宽度
- var elEndLeft = elLeft + elWidth;
- if (arrowLeft > elEndLeft) {
- // 元素的一半宽度大于12像素的时候,看着就不会太别扭,放心置 left 为 6px
- if (elWidth / 2 >= 12) {
- arrowLeft = elEndLeft - 6 - 7;
- }
- // 取半
- else {
- arrowLeft = elLeft + elWidth / 2;
- }
- }
- $(arrorwsDom).css("left", arrowLeft + "px");
- }
- // 箭头居中
- else {
- /////////////////////// 重新定位气泡 ///////////////////////
- var flashMsgDomLeft = this.settingFlashMsgLeft(
- flashDom,
- flashDomWidth,
- elWidth,
- elLeft
- );
- var arrowLeft = elLeft - flashMsgDomLeft + elWidth / 2;
- $(arrorwsDom).css("left", arrowLeft + "px");
- }
- },
- settingFlashMsgLeft: function (flashDom, flashDomWidth, elWidth, elLeft) {
- var flashMsgDomLeft = elLeft - (flashDomWidth - elWidth) / 2;
- // 超出了屏幕左边,向右移动
- if (flashMsgDomLeft < 0) {
- flashMsgDomLeft = 6;
- }
- // 超出屏幕右边,向左移动
- else if (flashMsgDomLeft + flashDomWidth > window.innerWidth) {
- flashMsgDomLeft -= flashMsgDomLeft + flashDomWidth - window.innerWidth;
- }
- $(flashDom).css("left", flashMsgDomLeft);
- return flashMsgDomLeft;
- },
- clearFlashMsg: function (setting) {
- window.clearTimeout(wd.flashMsg.timeout);
- wd.flashMsg.timeout = undefined;
- $("#flashmsgtipsId").remove(); // 移除掉之前的
- if (setting && setting.end) {
- setting.end();
- }
- },
- getFlashDivTemplate: function (
- setting,
- elTop,
- elLeft,
- arrorwsClassName,
- arrowsStyle,
- flashMsgClassName
- ) {
- var html = this.flashDivTemplate.replace(
- "{position}",
- "zindex:" + setting.zindex + ";"
- );
- html = html.replace("{arrorwsClassName}", arrorwsClassName);
- html = html.replace("{arrorwsStyle}", arrowsStyle);
- html = html.replace("{msg}", setting.msg);
- html = html.replace("{flashMsgClassName}", flashMsgClassName);
- return html;
- },
- isNull: function (obj) {
- switch (typeof obj) {
- case "undefined":
- return true;
- case "string":
- if (obj.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, "").length == 0)
- return true;
- break;
- case "boolean":
- if (!obj) return true;
- break;
- case "number":
- if (0 === obj || isNaN(obj)) return true;
- break;
- case "object":
- if (null === obj || obj.length === 0) return true;
- for (var i in obj) {
- return false;
- }
- return true;
- }
- return false;
- },
- notNull: function (obj) {
- return !this.isNull(obj);
- },
- validation: function (setting) {
- if (this.isNull(setting)) {
- console.error("flashMsg 未获取到 setting!");
- return false;
- }
- if (this.isNull(setting.el)) {
- console.error("flashMsg Setting [el] 属性不能为空 ");
- return false;
- }
- if (this.isNull(setting.msg)) {
- console.error("flashMsg Setting [msg] 属性不能为空 ");
- return false;
- }
- return true;
- },
- getAbsolute: function (reference, target) {
- var result = {
- left: -target.clientLeft,
- top: -target.clientTop,
- };
- var node = target;
- while (node != reference && node != document) {
- result.left = result.left + node.offsetLeft + node.clientLeft;
- result.top = result.top + node.offsetTop + node.clientTop;
- node = node.parentNode;
- }
- if (isNaN(reference.scrollLeft)) {
- result.right = document.documentElement.scrollWidth - result.left;
- result.bottom = document.documentElement.scrollHeight - result.top;
- } else {
- result.right = reference.scrollWidth - result.left;
- result.bottom = reference.scrollHeight - result.top;
- }
- return result;
- },
- };
- //隐藏的元素
- wd.display._lockScreenElement = null;
- //有值表示正在执行lockScreen,unlockScreen
- wd.display._lockScreenWaitting = null;
- /**
- * 锁屏
- */
- wd.display.lockScreen = function () {
- "use strict";
- if (wd.display._lockScreenWaitting) return;
- wd.display._lockScreenWaitting = 0;
- $.post(
- "/service?ssServ=lockScreen",
- {},
- function (result) {
- if (wd.display._lockScreenElement) return;
- wd.display._lockScreenElement = $("body > * :visible");
- wd.display._lockScreenElement.hide();
- $("body").append(
- '<div class="lockscreenMask" style="position: absolute;left: 0px;top: 0px;width: 100%;height: 100%;background-color: black;z-index: 99;"></div>'
- );
- },
- "json"
- );
- wd.display._lockScreenWaitting = null;
- };
- /**
- * 解锁屏
- */
- wd.display.unlockScreen = function () {
- "use strict";
- if (wd.display._lockScreenWaitting) return;
- wd.display._lockScreenWaitting = 1;
- $.post(
- "/service?ssServ=unlockScreen",
- {},
- function (result) {
- if (!wd.display._lockScreenElement) return;
- wd.display._lockScreenElement.show();
- wd.display._lockScreenElement = null;
- $(".lockscreenMask").remove();
- },
- "json"
- );
- wd.display._lockScreenWaitting = null;
- };
- window.enrolDateList = window.enrolDateList || {};
- wd.display.initEnrolDate = function (nameee, mode) {
- var hiddenEle = document.querySelector("[name=" + nameee + "][type=hidden]");
- if ("play" == mode) {
- if (!hiddenEle.value) return;
- var year = parseInt(hiddenEle.value.split("-")[0]);
- var month = parseInt(hiddenEle.value.split("-")[1]);
- $(hiddenEle).before(
- "<span>" + year + "年(" + (month <= 6 ? "春季" : "秋季") + ")</span>"
- );
- return;
- }
- function editEnrolDate(name) {
- var THIS = this;
- this.onchange = null;
- this.getValue = null;
- this.setValue = null;
- this.container = null;
- var hiddenEle = document.querySelector("[name=" + name + "][type=hidden]");
- this.element = hiddenEle;
- var yyy = document.querySelector("[name=" + name + "_year]");
- var mmm = document.querySelector("[name=" + name + "_month]");
- wd.display.filterInputBox(name + "_year", name + "_month");
- var placeholder = hiddenEle.getAttribute("placeholder");
- if (placeholder) {
- yyy.setAttribute("placeholder", placeholder);
- } else {
- //样式特殊处理
- yyy.style.width = "30px";
- }
- this.container = yyy.parentNode;
- this.container.style.display = "inline";
- var width = hiddenEle.getAttribute("width");
- if (width) yyy.style.width = width;
- this._initYear = function (y) {
- yyy.value = y;
- };
- this._initMonth = function (m) {
- /* 改,规范 wdValue= 命名。Lin
- $("[name="+name+"_month][type=button][wdValue="+(m<=6?3:9)+"]").trigger("click");
- */ $(
- "[name=" + name + "_month][type=button][ssVal=" + (m <= 6 ? 3 : 9) + "]"
- ).trigger("click");
- };
- var year, month;
- //默认值为当前时间
- if ("0" == hiddenEle.value) {
- year = new Date().getUTCFullYear();
- month = new Date().getMonth() + 1;
- } else if (hiddenEle.value && hiddenEle.value.split("-").length > 0) {
- year = parseInt(hiddenEle.value.split("-")[0]);
- month = parseInt(hiddenEle.value.split("-")[1]);
- } else {
- //默认秋季
- month = 9;
- }
- if (year) {
- this._initYear(year);
- }
- if (month) {
- this._initMonth(month);
- }
- function RebuildingValue() {
- var yy = document.querySelector("[name=" + name + "_year]").value;
- var mm = document.querySelector(
- "[name=" + name + "_month][type=hidden]"
- ).value;
- var hiddenvalue = "";
- if (yy && mm) {
- hiddenvalue = yy + "-0" + mm + "-01";
- }
- console.log(hiddenvalue);
- document.querySelector("[name=" + name + "][type=hidden]").value =
- hiddenvalue;
- if (THIS.onchange) THIS.onchange();
- }
- RebuildingValue();
- $("[name=" + name + "_month][type=button]").on("click", RebuildingValue);
- $("[name=" + name + "_year][type=text]").on("click", function () {
- wd.edit.datePicker({
- dateFmt: "yyyy",
- onpicked: RebuildingValue,
- oncleared: RebuildingValue,
- el: this,
- });
- });
- this.setValue = function (v) {
- var v_year = v.split("-")[0];
- var v_month = v.split("-")[1];
- THIS._initYear(v_year);
- THIS._initMonth(v_month);
- };
- this.getValue = function () {
- return THIS.element.value;
- };
- }
- if (window.enrolDateList[nameee]) return;
- window.enrolDateList[nameee] = new editEnrolDate(nameee);
- };
- window.defaultValueList = window.defaultValueList || {};
- wd.display.inputDefaultValue = function (name, param) {
- //xq[rxnd];
- param = param.replace(/]$/, "");
- var pp = param.split(/\[/);
- var dictName = pp[0];
- var dictParam = pp[1];
- if (window.defaultValueList[name]) return;
- window.defaultValueList[name] = new (function (name, n, p) {
- var THIS = this;
- this.name = name;
- this.dict = n;
- this.dictParam = p;
- this.dictItem = wd.display.getInputBox(p);
- this._change = function () {
- console.log(THIS);
- var v = THIS.dictItem.getValue();
- $.ajax({
- url: "/service?ssServ=defaultValueTranslate",
- data: {
- dict: THIS.dict,
- param: "{" + THIS.dictParam + ":" + v + "}",
- },
- async: true,
- dataType: "json",
- success: function (data) {
- wd.display.getInputBox(THIS.name).setValue(data.result);
- },
- });
- };
- this.dictItem.setChange(this._change);
- if (!wd.display.getInputBox(name).getValue()) {
- this._change();
- }
- })(name, dictName, dictParam);
- };
- //下载文件
- wd.display.downloadFile = function (path, downloadName) {
- var download = downloadName ? 'download="' + downloadName + '"' : "";
- $("<a " + download + ' href="' + path + '"><span></span></a>')
- .find("span")
- .trigger("click");
- //关闭圈圈
- wd.display.closeLoad();
- //ScreenOver层移除
- $("#ScreenOver").remove();
- };
- //首页图标
- wd.display.setHomeIconName = function (name) {
- var ele = wd.topWindow.document.getElementById("mbwzbj");
- if (ele != null && name) {
- ele.innerHTML = name;
- }
- };
- /**
- *
- * 弹出右键菜单
- *
- * param {
- * leftClick:true//左击弹菜单
- * }
- *
- * wd.display.showContextMenu("body",[{text:"图片",func:function(element){}}]);
- */
- wd.display.showContextMenu = function (selecter, datas, param) {
- var options = $.extend({}, { leftClick: false }, param);
- for (var i = 0; i < datas.length; i++) {
- datas[i].value = i;
- }
- var id = "what_menu" + new Date().getTime();
- var dom = wd.display.initSelectOption(id);
- wd.display.buildSelectOption(dom, datas, "value", "text", null, false);
- $("body").append(dom);
- var $dom = $(dom).css({ position: "absolute" }).hide();
- var triggerElement;
- $dom.on("click", ".popupList", function () {
- var v = $(this).attr("value");
- datas[v].func.call(triggerElement, triggerElement);
- $dom.hide();
- return false;
- });
- var eventName = options.leftClick ? "contextmenu click" : "contextmenu";
- $(document).on(eventName, selecter, function () {
- var offset = $(this).offset();
- dom.style.left = offset.left + window.event.offsetX + "px";
- dom.style.top = offset.top + window.event.offsetY + "px";
- $(dom).show();
- triggerElement = this;
- return false;
- });
- $(document).on("click", function () {
- $dom.hide();
- });
- $(".content-div,.list-div").scroll(function () {
- $dom.hide();
- });
- };
|