12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078 |
- var appFormly = angular.module('formlyExample', ['formly', 'formlyBootstrap', 'ui.bootstrap']);
- app.requires.push('formlyExample');
- appFormly.config(
- function config(formlyConfigProvider) {
- //格式转换方法 XXX-XXX转驼峰命名
- function camelize(string) {
- string = string.replace(/[\-_\s]+(.)?/g, function (match, chr) {
- return chr ? chr.toUpperCase() : '';
- });
- // Ensure 1st char is always lowercase
- return string.replace(/^([A-Z])/, function (match, chr) {
- return chr ? chr.toLowerCase() : '';
- });
- }
- //获取ngModelAttr对象设置
- function getNgModelAttr(attrs, bindings) {
- var ngModelAttrs = {};
- angular.forEach(attrs, function (attr) {
- ngModelAttrs[camelize(attr)] = { attribute: attr };
- });
- angular.forEach(bindings, function (binding) {
- ngModelAttrs[camelize(binding)] = { bound: binding };
- });
- return ngModelAttrs;
- }
- formlyConfigProvider.setWrapper({
- name: 'bootstrapLabel',
- templateUrl: 'assets/views/customform/tpl/normal-label.html'
- });
- formlyConfigProvider.setType({
- name: 'ui-panel',
- templateUrl: 'assets/views/customform/tpl/ui-panel.html'
- });
- formlyConfigProvider.setType({
- name: 'ui-currentuser',
- // extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-username.html',
- controller: ['$scope', function ($scope) {
- if ($scope.options.templateOptions.user) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.user;
- $scope.options.initialValue = $scope.model[$scope.options.key];
- } else {
- $scope.model[$scope.options.key] = $scope.$root.user;
- }
- }]
- });
- //流程
- formlyConfigProvider.setType({
- name: 'ui-processincident',
- // extends: 'input',
- templateUrl: 'assets/views/customform/tpl/processincident.html',
- controller: ['$scope', 'api_bpm_domain', 'moment', function ($scope, api_bpm_domain, moment) {
- $scope.events = [];
- $scope.side = 'right';
- api_bpm_domain.flowTracing($scope.model.incident.processInstanceId).then(function (data) {
- var myData = data;
- $scope.events = myData.data;
- angular.forEach($scope.events, function (item, index) {
- if (item.activityName == "开始") {
- // else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '申请',
- when: moment($scope.model.incident.acceptDate).format('YYYY年MM月DD日 hh时mm分ss秒'),
- content: $scope.model.incident.requester.name + '报修,待维修人员接单'
- })
- // }
- } else if (item.activityName == "接单") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '接单',
- when: moment($scope.model.incident.acceptDate).format('YYYY年MM月DD日 hh时mm分ss秒'),
- content: '待维修人员【' + item.requester.name + '】接单'
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '接单',
- when: $scope.events[index].startTime,
- content: '维修人员【' + item.user.name + '】已接单'
- })
- }
- } else if (item.activityName == "事件处理") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '处理',
- when: $scope.events[index].startTime,
- content: '维修人员【' + item.user.name + '】正在处理该报修'
- // })
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '处理',
- when: $scope.events[index].startTime,
- content: '维修人员已处理该报修'
- })
- }
- } else if (item.activityName == "事件关闭") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '关闭',
- when: $scope.events[index].startTime,
- content: '报修单处理完,等待【' + item.user.name + '】关闭'
- // })
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '关闭',
- when: $scope.events[index].startTime,
- content: '报修单处理完,【' + item.user.name + '】已关闭该单'
- })
- }
- } else if (item.activityName == "结束") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '结束',
- when: $scope.events[index].startTime,
- content: '报修已关闭,如有疑问可拨打电话(87543241)'
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '结束',
- when: $scope.events[index].startTime,
- content: '报修已完成。'
- })
- }
- } else if (item.activityName == "处理人建单审核") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '审核',
- when: $scope.events[index].startTime,
- content: '等待【' + item.user.name + '】审核。'
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '审核',
- when: $scope.events[index].startTime,
- content: '现已由【' + item.user.name + '】审核。'
- })
- }
- } else if (item.activityName == "事件重新指派") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '指派',
- when: $scope.events[index].startTime,
- content: '处理人' + item.user.name
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '指派',
- when: $scope.events[index].startTime,
- content: '处理人' + item.user.name
- })
- }
- } else if (item.activityName == "复杂度升级审核") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '审核',
- when: $scope.events[index].startTime,
- content: '处理人' + item.user.name
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '审核',
- when: $scope.events[index].startTime,
- content: '处理人' + item.user.name
- })
- }
- } else if (item.activityName == "转派") {
- if ($scope.events.length == index + 1) {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'font-color-graylight',
- titleClass: 'font-color-graylight',
- badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- title: '转派',
- when: $scope.events[index].startTime,
- content: '处理人' + item.user.name
- })
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: '转派',
- when: $scope.events[index].startTime,
- content: '处理人' + item.user.name
- })
- }
- } else {
- $scope.events[index] = angular.extend($scope.events[index], {
- badgeClass: 'info',
- titleClass: 'info',
- badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- title: item.activityName,
- when: $scope.events[index].startTime,
- content: '处理人' + item.user.name
- })
- }
- })
- $scope.events = $scope.events.reverse();
- // $scope.events = [{
- // badgeClass: 'font-color-graylight',
- // titleClass: 'font-color-graylight',
- // badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- // title: '处理',
- // when: '',
- // content: ''
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- // title: '受理',
- // when: myData.data[0].time,
- // content: '您的报修服务台已受理,待维修人员接单'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '申请',
- // when: moment($scope.model.incident.acceptDate).format('YYYY年MM月DD日 hh时mm分ss秒'),
- // content: '您的报修已提交至网络与信息运维服务系统,待服务台受理,咨询电话87543241'
- // }]
- // if (myData.data.length == 1) {
- // $scope.events = [{
- // badgeClass: 'font-color-graylight',
- // titleClass: 'font-color-graylight',
- // badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- // title: '处理',
- // when: '',
- // content: ''
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- // title: '受理',
- // when: myData.data[0].time,
- // content: '您的报修服务台已受理,待维修人员接单'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '申请',
- // when: moment($scope.model.incident.acceptDate).format('YYYY年MM月DD日 hh时mm分ss秒'),
- // content: '您的报修已提交至网络与信息运维服务系统,待服务台受理,咨询电话87543241'
- // }]
- // } else if (myData.data.length == 2) {
- // $scope.events = [{
- // badgeClass: 'font-color-graylight',
- // titleClass: 'font-color-graylight',
- // badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- // title: '评价',
- // when: '',
- // content: ''
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- // title: '处理',
- // when: myData.data[1].time,
- // content: '维修人员【' + $scope.item.incident.handlingPersonnelUser.name + '(' + $scope.item.incident.handlingPersonnelUser.phone + ')】已接单,正在处理中'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '受理',
- // when: myData.data[0].time,
- // content: '您的报修服务台已受理,待维修人员接单'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '申请',
- // when: moment($scope.model.incident.acceptDate).format('YYYY年MM月DD日 hh时mm分ss秒'),
- // content: '您的报修已提交至网络与信息运维服务系统,待服务台受理,咨询电话87543241'
- // }]
- // } else if (myData.data.length == 3) {
- // $scope.events = [{
- // badgeClass: 'font-color-graylight',
- // titleClass: 'font-color-graylight',
- // badgeIconClass: 'icon iconfont dsit-icon_weizuo font-color-graylight',
- // title: '完成',
- // when: '',
- // content: ''
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- // title: '评价',
- // when: myData.data[2].time,
- // content: '您的报修已处理完毕,您可以对本次服务进行评价,如有需要,咨询电话87543241'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '处理',
- // when: myData.data[1].time,
- // content: '维修人员【' + $scope.item.incident.handlingPersonnelUser.name + '(' + $scope.item.incident.handlingPersonnelUser.phone + ')】已接单,正在处理中'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '受理',
- // when: myData.data[0].time,
- // content: '您的报修服务台已受理,待维修人员接单'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '申请',
- // when: moment($scope.model.incident.acceptDate).format('YYYY年MM月DD日 hh时mm分ss秒'),
- // content: '您的报修已提交至网络与信息运维服务系统,待服务台受理,咨询电话87543241'
- // }]
- // } else if (myData.data.length == 4) {
- // $scope.events = [{
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_zhengzaijinx font_statetwo',
- // title: '完成',
- // when: myData.data[3].time,
- // content: '报修已完成,如有疑问可拨打电话(87543241)'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '评价',
- // when: myData.data[2].time,
- // content: '您的报修已处理完毕,您可以对本次服务进行评价,如有需要,咨询电话87543241'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '处理',
- // when: myData.data[1].time,
- // content: '维修人员【' + $scope.item.incident.handlingPersonnelUser.name + '(' + $scope.item.incident.handlingPersonnelUser.phone + ')】已接单,正在处理中'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '受理',
- // when: myData.data[0].time,
- // content: '您的报修服务台已受理,待维修人员接单'
- // }, {
- // badgeClass: 'info',
- // titleClass: 'info',
- // badgeIconClass: 'icon iconfont dsit-icon_liucheng',
- // title: '申请',
- // when: moment($scope.model.incident.acceptDate).format('YYYY年MM月DD日 hh时mm分ss秒'),
- // content: '您的报修已提交至网络与信息运维服务系统,待服务台受理,咨询电话87543241'
- // }]
- // }
- });
- }]
- });
- //仪表盘
- formlyConfigProvider.setType({
- name: 'ui-assess',
- // extends: 'input',
- templateUrl: 'assets/views/customform/tpl/assess.html',
- controller: ['$scope', function ($scope) {
- $scope.getscore = function (score) {
- $scope.model[$scope.options.key] = score;
- }
- // if ($scope.options.templateOptions.user) {
- // $scope.model[$scope.options.key] = $scope.options.templateOptions.user;
- // $scope.options.initialValue = $scope.model[$scope.options.key];
- // } else {
- // $scope.model[$scope.options.key] = $scope.$root.user;
- // }
- }]
- });
- //人员
- formlyConfigProvider.setType({
- name: 'ui-userwechatselect',
- extends: 'input',
- template: '<user-select></user-select>',
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', '$aside', 'BpmRestangular', 'UserRestangular', 'WechatRestangular', 'api_user_data', function ($scope, $aside, BpmRestangular, UserRestangular, WechatRestangular, api_user_data) {
- $scope.getselect = function (item) {
- if ($scope.options.key == "assignee") {
- $scope.model[$scope.options.key] = item[0].id;
- $scope.$parent.$parent.$parent.model[$scope.options.key] = item[0].id;
- } else {
- $scope.model[$scope.options.key] = item[0];
- if ($scope.model.incidentsign) {
- $scope.$parent.$parent.$parent.model.incident[$scope.options.key] = item[0];
- } else {
- $scope.$parent.$parent.$parent.model[$scope.options.key] = item[0];
- }
- }
- }
- // $scope.gerdirect = function(item) {
- // $scope.model[$scope.options.key] = item[0];
- // }
- var mydatauser = [{
- id: '1',
- value: '',
- }]
- // $scope.getareadata = function() {
- // api_user_data.fetchDataList('area', { area: { wechatArea: true }, idx: 0, sum: 1000 }).then(function(response) {
- // if (response.status == 200) {
- // mydataarea = response.list;
- // for (var i = 0; i < mydataarea.length; i++) {
- // mydataarea[i].value = mydataarea[i].area;
- // }
- // $scope.MobileSelect.wheels[0] = { data: mydataarea }
- // // $scope.getplacedata(mydataarea[0].id);
- // }
- // })
- // }
- // { "idx": 0, "sum": 1000, "user": { "roledata": { "rolecode": "first-line support" }, "selectType": "1", "groupdata": { "id": 7 } } }
- $scope.getplacedata = function (areaId) {
- var fildata = { idx: 0, sum: 1000 };
- if (areaId && areaId != null) {
- fildata = angular.extend(fildata, { "user": { "roledata": { "rolecode": "first-line support" }, "selectType": "1", "groupdata": { "id": areaId } } })
- }
- if ($scope.options.templateOptions.userSelect) {
- fildata = angular.extend(fildata, $scope.options.templateOptions.userSelect)
- }
- api_user_data.fetchDataList('user', fildata).then(function (data) {
- if (data.status == 200) {
- mydatauser = data.list;
- for (var i = 0; i < mydatauser.length; i++) {
- mydatauser[i].value = mydatauser[i].name;
- }
- $scope.MobileSelect.wheels[0] = { data: mydatauser }
- $scope.gerdirect($scope.MobileSelect);
- // $scope.getcum(0, {
- // id: '1',
- // value: '',
- // });
- }
- }, function () {
- // $scope.gerdirect();
- })
- }
- var groupdata = {};
- // if (($scope.model.candidateGroup || $scope.model.candidateGroup == null) && $scope.model.candidateGroup != groupdata) {
- // groupdata = angular.copy($scope.model.candidateGroup);
- setInterval(function () {
- if ($scope.model.incident && $scope.model.incident.candidateGroup && $scope.model.incident.candidateGroup.id && $scope.model.incident.candidateGroup.id != groupdata.id) {
- groupdata = angular.copy($scope.model.incident.candidateGroup);
- $scope.getplacedata($scope.model.incident.candidateGroup.id);
- }
- }, 1000);
- // setTimeout(function() {
- // var filterData = {
- // "idx": 0,
- // "sum": 5,
- // "incident": { "requester": { "id": "" } }
- // }
- // $scope.options.templateOptions.getWorkernumber($scope.options.templateOptions.ApiService, filterData).then(function(result) {
- // var modelData = $scope.options.templateOptions.Restangular.stripRestangular(result);
- // });
- // }, 1000);
- $scope.getplacedata();
- $scope.MobileSelect = {
- trigger: '#triggertwo',
- title: '人员选择',
- wheels: [{
- data: mydatauser
- }],
- transitionEnd: function (indexArr, data) {
- // var fildatas = { idx: 0, sum: 1000 };
- // if ($scope.options.templateOptions.userSelect) {
- // fildatas = angular.extend(fildatas, $scope.options.templateOptions.userSelect)
- // }
- // api_user_data.fetchDataList('user', fildatas).then(function(dataone) {
- // if (dataone.status == 200) {
- // mydatauser = dataone.list;
- // for (var i = 0; i < mydatauser.length; i++) {
- // mydataplace[i].value = mydatauser[i].name;
- // }
- // $scope.getcum(1, mydatauser)
- // }
- // })
- // this.updateWheel(1, mydataplace)
- },
- callback: function (indexArr, data) {
- console.log(data);
- }
- }
- }]
- });
- //知识库分类
- formlyConfigProvider.setType({
- name: 'ui-knowwechatselect',
- extends: 'input',
- template: '<know-select></know-select>',
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', '$aside', 'BpmRestangular', 'UserRestangular', 'WechatRestangular', 'api_solution', function ($scope, $aside, BpmRestangular, UserRestangular, WechatRestangular, api_solution) {
- var mydataknow = [{
- id: '1',
- value: '',
- }]
- $scope.getselect = function (item) {
- $scope.model[$scope.options.key] = item[0];
- }
- $scope.getplacedata = function (areaId) {
- // var fildata = { idx: 0, sum: 1000 };
- // if ($scope.options.templateOptions.userSelect) {
- // fildata = angular.extend(fildata, $scope.options.templateOptions.userSelect)
- // }
- api_solution.findSolutionTypeActions(1).then(function (data) {
- if (data.status == 200) {
- mydataknow = data.data;
- for (var i = 0; i < mydataknow.length; i++) {
- mydataknow[i].value = mydataknow[i].typeName;
- }
- $scope.MobileSelect.wheels[0] = { data: mydataknow }
- $scope.gerdirect($scope.MobileSelect);
- }
- }, function () {
- // $scope.gerdirect();
- })
- }
- $scope.getplacedata();
- $scope.MobileSelect = {
- trigger: '#triggerthree',
- title: '知识库分类',
- wheels: [{
- data: mydataknow
- }],
- transitionEnd: function (indexArr, data) { },
- callback: function (indexArr, data) {
- console.log(data);
- }
- }
- }]
- });
- //工作组
- formlyConfigProvider.setType({
- name: 'ui-groupselect',
- extends: 'input',
- template: '<group-select></group-select>',
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', '$aside', 'BpmRestangular', 'UserRestangular', 'WechatRestangular', 'api_user_data', function ($scope, $aside, BpmRestangular, UserRestangular, WechatRestangular, api_user_data) {
- var mydataugroup = [{
- id: '1',
- value: '',
- }]
- $scope.getselect = function (item) {
- $scope.model[$scope.options.key] = item[0];
- }
- $scope.getplacedata = function () {
- api_user_data.fetchDataList('group', { "idx": 0, "sum": 1000 }).then(function (data) {
- if (data.status == 200) {
- mydataugroup = data.list;
- for (var i = 0; i < mydataugroup.length; i++) {
- mydataugroup[i].value = mydataugroup[i].groupName;
- }
- $scope.MobileSelect.wheels[0] = { data: mydataugroup }
- $scope.gerdirect($scope.MobileSelect);
- }
- }, function () {
- // $scope.gerdirect();
- })
- }
- $scope.getplacedata();
- $scope.MobileSelect = {
- trigger: '#triggerfour',
- title: '工作组',
- wheels: [{
- data: mydataugroup
- }],
- transitionEnd: function (indexArr, data) {
- $scope.getcum(0, mydataugroup);
- },
- callback: function (indexArr, data) {
- $scope.model[$scope.options.key] = data[0];
- // $scope.$parent.$parent.$parent.model.assignee = null;
- }
- }
- }]
- });
- //事件分类控件
- formlyConfigProvider.setType({
- name: 'ui-incidentcatogry',
- extends: 'input',
- template: '<categry-select id="op"></categry-select>',
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', '$rootScope', '$aside', 'BpmRestangular', 'UserRestangular', 'WechatRestangular', 'api_user_data', 'api_bpm_data', function ($scope, $rootScope, $aside, BpmRestangular, UserRestangular, WechatRestangular, api_user_data, api_bpm_data) {
- // $scope.placelable = [];
- // setInterval(function() {
- // if ($scope.model.title !=$scope.model.category.category) {
- // } else {}
- // }, 500);
- $scope.model.acceptUser = $rootScope.user;
- $scope.getselect = function (item) {
- // $scope.model.title = item[2].category;
- // $scope.model.description = item[2].category;
- $scope.$parent.$parent.$parent.model.incident.title = item[2].category;
- $scope.$parent.$parent.$parent.model.incident.description = item[2].category;
- // $scope.$parent.$parent.$parent.model.incident.complexity = item[2].complexity;
- // $scope.$apply($scope.$parent.$parent.$parent.model.incident.complexity = item[2].complexity);
- // $scope.model.complexity = item[2].complexity;
- // if ($scope.$parent.$parent.$parent.model.incident.complexity && item[2].complexity) {
- // $scope.$parent.$parent.$parent.model.incident.complexity.name = item[2].complexity.name;
- // $scope.$parent.$parent.$parent.model.incident.complexity.id = item[2].complexity.id;
- // }
- $scope.$apply();
- $scope.model[$scope.options.key] = item[2];
- }
- var mydataCategoryone = [{
- id: '1',
- value: '',
- }]
- var mydataCategorytwo = [{
- id: '1',
- value: '',
- }]
- var mydataCategorythree = [{
- id: '1',
- value: '',
- }]
- var indexdata = [];
- $scope.getareadata = function () {
- api_bpm_data.fetchDataList('incidentcategory', { incidentcategory: { parent: { id: null } }, idx: 0, sum: 1000 }).then(function (response) {
- if (response.status == 200) {
- mydataCategoryone = response.list;
- for (var i = 0; i < mydataCategoryone.length; i++) {
- mydataCategoryone[i].value = mydataCategoryone[i].category;
- }
- $scope.MobileSelect.wheels[0] = { data: mydataCategoryone }
- $scope.getplacedata(mydataCategoryone[0].id);
- }
- })
- }
- $scope.getplacedata = function (oneid) {
- api_bpm_data.fetchDataList('incidentcategory', { incidentcategory: { parent: { id: oneid } }, idx: 0, sum: 1000 }).then(function (data) {
- if (data.status == 200) {
- mydataCategorytwo = data.list;
- for (var i = 0; i < mydataCategorytwo.length; i++) {
- mydataCategorytwo[i].value = mydataCategorytwo[i].category;
- }
- if (indexdata.length > 0) {
- $scope.getcum(1, mydataCategorytwo)
- } else {
- $scope.MobileSelect.wheels[1] = { data: mydataCategorytwo };
- }
- $scope.getlastdata(mydataCategorytwo[0].id);
- // $scope.gerdirect($scope.MobileSelect);
- }
- }, function () {
- // $scope.gerdirect();
- })
- }
- $scope.getlastdata = function (twoid) {
- api_bpm_data.fetchDataList('incidentcategory', { incidentcategory: { parent: { id: twoid } }, idx: 0, sum: 1000 }).then(function (data) {
- if (data.status == 200) {
- mydataCategorythree = data.list;
- for (var i = 0; i < mydataCategorythree.length; i++) {
- mydataCategorythree[i].value = mydataCategorythree[i].category;
- }
- if (indexdata.length > 0) {
- $scope.getcum(2, mydataCategorythree)
- } else {
- $scope.MobileSelect.wheels[2] = { data: mydataCategorythree };
- $scope.gerdirect($scope.MobileSelect);
- }
- }
- }, function () {
- // $scope.gerdirect();
- })
- }
- $scope.getareadata();
- $scope.MobileSelect = {
- trigger: '#triggerone',
- title: '事件分类',
- wheels: [{
- data: mydataCategoryone
- }, {
- data: mydataCategorytwo
- }, {
- data: mydataCategorythree
- }],
- transitionEnd: function (indexArr, data) {
- if (!indexdata || indexdata.length == 0) {
- angular.forEach(indexArr, function (item, index) {
- if (item != 0) {
- if (index == 0) {
- $scope.getplacedata(data[0].id)
- } else if (index == 1) {
- $scope.getlastdata(data[1].id)
- }
- }
- })
- } else {
- if (indexdata[0] != indexArr[0]) {
- $scope.getplacedata(data[0].id)
- } else if (indexdata[1] != indexArr[1]) {
- $scope.getlastdata(data[1].id)
- }
- }
- // api_bpm_data.fetchDataList('incidentcategory', { incidentcategory: { parent: { id: data[0].id } }, idx: 0, sum: 1000 }).then(function(data) {
- // if (data.status == 200) {
- // mydataCategorytwo = data.list;
- // for (var i = 0; i < mydataCategorytwo.length; i++) {
- // mydataCategorytwo[i].value = mydataCategorytwo[i].category;
- // }
- // $scope.getcum(1, mydataCategorytwo)
- // }
- // }, function() {
- // $scope.gerdirect();
- // })
- indexdata = indexArr;
- // this.updateWheel(1, mydataplace)
- },
- callback: function (indexArr, data) {
- console.log(data);
- }
- }
- }]
- });
- //待处理事件列表
- formlyConfigProvider.setType({
- name: 'ui-areaplace',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-inputright.html',
- // templateUrl: 'assets/views/customform/tpl/areaplace.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', '$aside', 'BpmRestangular', 'UserRestangular', 'WechatRestangular', 'api_user_data', function ($scope, $aside, BpmRestangular, UserRestangular, WechatRestangular, api_user_data) {
- // $scope.placelable = [];
- $scope.getselect = function (item) {
- if ($scope.model.incidentsign && $scope.model.incidentsign != null) {
- $scope.$parent.$parent.$parent.model.incident.area = item[0];
- $scope.model.area = item[0];
- $scope.model.place = item[1];
- $scope.$parent.$parent.$parent.model.incident.place = item[1];
- } else {
- $scope.model.areaId = item[0].id;
- $scope.$parent.$parent.$parent.model.incident.areaId = item[0].id;
- $scope.$parent.$parent.$parent.model.incident.placeId = item[1].id;
- $scope.model.placeId = item[1].id;
- }
- }
- var mydataarea = [{
- id: '1',
- value: '',
- }]
- var mydataplace = [{
- id: '1',
- value: '',
- }]
- $scope.getareadata = function () {
- api_user_data.fetchDataList('area', { area: { wechatArea: true }, idx: 0, sum: 1000 }).then(function (response) {
- if (response.status == 200) {
- mydataarea = response.list;
- for (var i = 0; i < mydataarea.length; i++) {
- mydataarea[i].value = mydataarea[i].area;
- }
- $scope.MobileSelect.wheels[0] = { data: mydataarea }
- $scope.getplacedata(mydataarea[0].id);
- }
- })
- }
- $scope.getplacedata = function (areaId) {
- api_user_data.fetchDataList('place', { place: { wechatAreaId: areaId }, idx: 0, sum: 1000 }).then(function (data) {
- if (data.status == 200) {
- mydataplace = data.list;
- for (var i = 0; i < mydataplace.length; i++) {
- mydataplace[i].value = mydataplace[i].place;
- }
- $scope.MobileSelect.wheels[1] = { data: mydataplace }
- $scope.gerdirect($scope.MobileSelect);
- }
- }, function () {
- // $scope.gerdirect();
- })
- }
- // $scope.getplacedataold = function(areaId) {
- // api_user_data.fetchDataList('place', { place: { areaId: areaId, selectType: "pinyin_qs" }, idx: 0, sum: 1000 }).then(function(data) {
- // if (data.status == 200) {
- // mydataplace = data.list;
- // // this.updateWheel(1, mydataplace)
- // }
- // }, function() {
- // // $scope.gerdirect();
- // })
- // }
- $scope.getareadata();
- // api_user_data.fetchDataList('area', { place: { wechatAreaId: 1 }, idx: 0, sum: 1000 }).then(function(response) {
- // if (response.status == 200) {
- // mydataarea = response.list;
- // }
- // })
- // api_user_data.fetchDataList('place', { place: { areaId: 1, selectType: "pinyin_qs" }, idx: 0, sum: 1000 }).then(function(data) {
- // if (data.status == 200) {
- // mydataarea[0].childs = data.list;
- // }
- // })
- $scope.MobileSelect = {
- trigger: '#trigger',
- title: '地区选择',
- wheels: [{
- data: mydataarea
- }, {
- data: mydataplace
- }],
- transitionEnd: function (indexArr, data) {
- // $scope.getplacedataold(data[0].id)
- api_user_data.fetchDataList('place', { place: { wechatAreaId: data[0].id }, idx: 0, sum: 1000 }).then(function (dataone) {
- if (dataone.status == 200) {
- mydataplace = dataone.list;
- for (var i = 0; i < mydataplace.length; i++) {
- mydataplace[i].value = mydataplace[i].place;
- }
- $scope.getcum(1, mydataplace)
- }
- })
- // this.updateWheel(1, mydataplace)
- },
- callback: function (indexArr, data) {
- console.log(data);
- }
- }
- }]
- });
- //待处理事件列表
- formlyConfigProvider.setType({
- name: 'ui-ngtable',
- templateUrl: 'assets/views/customform/tpl/ui-ngtable.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- // relationAction: function() {
- // options.hideExpression = true
- // }
- }
- };
- },
- controller: ['$scope', '$timeout', 'api_bpm_data', '$rootScope', 'ngTableParams', '$filter', function ($scope, $timeout, api_bpm_data, $rootScope, ngTableParams, $filter) {
- var filterData = {
- "assignee": $rootScope.user.id,
- "candidateGroups": $rootScope.user.group[0].id,
- "searchtype": "done",
- "idx": 0,
- "sum": 10
- };
- api_bpm_data.fetchDataList('incident', filterData).then(function (data) {
- if (data.status == 200) {
- $scope.myData = data.list
- }
- })
- }]
- });
- //报表列表
- formlyConfigProvider.setType({
- name: 'ui-ngreport',
- templateUrl: 'assets/views/customform/tpl/ui-ngtable.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- // relationAction: function() {
- // options.hideExpression = true
- // }
- }
- };
- },
- controller: ['$scope', '$timeout', 'api_bpm_data', '$rootScope', 'ngTableParams', '$filter', function ($scope, $timeout, api_bpm_data, $rootScope, ngTableParams, $filter) {
- var filterData = {
- "assignee": $rootScope.user.id,
- "candidateGroups": $rootScope.user.group[0].id,
- "searchtype": "done",
- "idx": 0,
- "sum": 10
- };
- // $scope.options.hideExpression = false;
- $scope.model.removereport = false;
- $scope.removes = function () {
- $scope.model.removereport = true;
- // $scope.options.templateOptions.relationAction();
- // $scope.palnes = false;
- // $scope.fields = {};
- }
- api_bpm_data.fetchDataList('incident', filterData).then(function (data) {
- if (data.status == 200) {
- $scope.myData = data.list
- }
- })
- }]
- });
- //请求人最近事件
- formlyConfigProvider.setType({
- name: 'ui-recentIncident',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- templateUrl: 'assets/views/customform/tpl/ui-recentincident.html',
- controller: ['$scope', 'api_solution', function ($scope, api_solution) {
- var filterData = {
- 'incident': {
- 'requester': {
- 'id': ''
- }
- },
- idx: 0,
- sum: 3
- };
- setInterval(function () {
- if (filterData.incident.requester.id == "" || filterData.incident.requester.id != $scope.model.requester.id) {
- var requester = $scope.model.requester;
- if (requester != null && angular.isDefined(requester.id)) {
- filterData.incident.requester.id = $scope.model.requester.id;
- $scope.options.templateOptions.getWorkernumber($scope.options.templateOptions.ApiService, filterData).then(function (result) {
- var modelData = $scope.options.templateOptions.Restangular.stripRestangular(result);
- if (modelData.status == 200) {
- $scope.lastrequst = modelData.list;
- }
- });
- requester = null
- } else { }
- } else { }
- }, 1000);
- $scope.detail = function (data) {
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/detailincident.html',
- controller: function ($scope, $modalInstance) {
- $scope.entity = {};
- $scope.entity = data;
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'lg',
- });
- }
- }]
- });
- //参数列表
- formlyConfigProvider.setType({
- name: "ui-listinput",
- templateUrl: 'assets/views/customform/tpl/ui-listinput.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', function ($scope) {
- }]
- });
- //时间段控件(分)
- formlyConfigProvider.setType({
- name: 'ui-timeslot',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-responsetime.html',
- controller: ['$scope', function ($scope) { }]
- });
- //优先级级联可编辑控件
- formlyConfigProvider.setType({
- name: 'ui-overtime',
- // extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-overtime.html',
- controller: ['$scope', 'api_bpm_domain', function ($scope, api_bpm_domain) {
- var filteData = {};
- var datas = {}
- setInterval(function () {
- if ($scope.model.priority && $scope.model.priority.id != null && filteData && datas != $scope.model.priority.id) {
- filteData = "L" + $scope.model.priority.id;
- datas = $scope.model.priority.id;
- // console.log($scope.options.templateOptions)
- api_bpm_domain.expectedTime(filteData).then(function (requester) {
- // var overtime=requester.date;
- if (requester.state == 200) {
- // if($scope.options.key=="date"){
- $scope.model[$scope.options.key] = requester.date
- // }
- }
- })
- }
- }, 1000);
- }]
- });
- formlyConfigProvider.setType({
- name: 'ui-responsetime',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-responsetime.html',
- controller: ['$scope', 'api_bpm_domain', function ($scope, api_bpm_domain) {
- var filteData = {};
- var datas = {}
- setInterval(function () {
- if ($scope.model.priority && $scope.model.priority.id != null && filteData && datas != $scope.model.priority.id) {
- filteData = "L" + $scope.model.priority.id;
- datas = $scope.model.priority.id;
- // console.log($scope.options.templateOptions)
- api_bpm_domain.expectedTime(filteData).then(function (requester) {
- // var overtime=requester.date;
- if (requester.state == 200) {
- var keyName = {};
- if ($scope.options.key == "expectIntroTime") {
- keyName = "resolveTime";
- } else if ($scope.options.key == "expectResponseTime") { keyName = "responseTime"; }
- $scope.model[$scope.options.key] = requester.serviceLevelAgreement[keyName];
- // }
- }
- })
- }
- }, 1000);
- }]
- });
- //知识库按钮组件
- formlyConfigProvider.setType({
- name: 'ui-discasecade',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-discasecade.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- relationAction: function (fields, modelscope, item) { }
- }
- }
- },
- controller: ['$scope', '$rootScope', 'api_bpm_data', 'api_solution', function ($scope, $rootScope, api_bpm_data, api_solution) {
- var titles = {}
- setInterval(function () {
- if ($scope.model.category != null && titles != $scope.model.category) {
- $scope.searchData = {};
- if ($scope.options.key == "title") {
- var filterData = { "idx": 0, "sum": 1000 };
- api_bpm_data.fetchDataList('incidentcategory', filterData).then(function (data) {
- var datalist = data.list;
- angular.forEach(datalist, function (item) {
- if (item.id == $scope.model.category.id) {
- $scope.model[$scope.options.key] = item.category
- $scope.titles = item.category;
- titles = $scope.model.category;
- }
- })
- })
- }
- }
- }, 1000);
- }]
- });
- // formlyConfigProvider.setType({
- // name: 'ui-discasecade',
- // extends: 'input',
- // templateUrl: 'assets/views/customform/tpl/ui-discasecade.html',
- // defaultOptions:function(options){
- // return{
- // templateOptions: {
- // refresh:function(){},
- // refreshDelay: 0,
- // linkage:function(modelName, data, model, modelKey, key){
- // console.log(model)
- // }
- // }
- // };
- // }
- // });
- //重构组件模板
- //获取当前人
- formlyConfigProvider.setType({
- name: 'ui-users',
- // extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-label.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- translate: '',
- refreshDelay: 0
- }
- }
- },
- controller: ['$scope', function ($scope) {
- // $scope.model[$scope.options.key]=$scope.$root.user.name;
- $scope.options.templateOptions.translate = $scope.$root.user.name;
- }]
- });
- //只读控件
- formlyConfigProvider.setType({
- name: 'ui-label',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-label.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- translate: '',
- refreshDelay: 0
- }
- }
- },
- controller: ['$scope', function ($scope) {
- console.log($scope.options.templateOptions)
- var value = $scope.model[$scope.options.key];
- function treeDesc(children, key, label) {
- if (label == "") {
- label = children[key];
- } else {
- label = children[key] + "-" + label;
- }
- if (angular.isDefined(children.parent)) {
- treeDesc(children.parent, key, label);
- } else {
- return label;
- }
- }
- if (angular.isArray(value)) {
- var tempValue = "";
- angular.forEach(value, function (item) {
- if (tempValue != "") {
- tempValue = tempValue + ",";
- }
- tempValue = tempValue + item[$scope.options.templateOptions.labelProp] || item;
- });
- $scope.options.templateOptions.translate = tempValue;
- } else if (angular.isObject(value)) {
- if (angular.isDefined(value.children) || angular.isDefined(value.parent)) {
- //tree
- // console.log("value.parent="+JSON.stringify(value.parent))
- var nameLabel = value[$scope.options.templateOptions.labelProp];
- nameLabel = treeDesc(value.parent, $scope.options.templateOptions.labelProp, nameLabel);
- $scope.options.templateOptions.translate = nameLabel;
- } else {
- $scope.options.templateOptions.translate = value;
- }
- } else if (angular.isString(value) && value.indexOf('yyyy-MM-ddTHH:mm:sssZ') > 0) {
- console.log("value=" + value);
- $scope.options.templateOptions.translate = value;
- // }else if(angular.isString(value)&&value.indexOf('yyyy-MM-ddTHH:mm:sssZ')>0){
- // console.log("value="+value);
- // $scope.options.templateOptions.translate = value;
- } else {
- // console.log("$scope.options.templateOptions.translate="+JSON.stringify($scope.options.templateOptions.translate))
- $scope.options.templateOptions.translate = value;
- }
- if (angular.isFunction($scope.options.templateOptions.transform)) {
- // console.log("$scope.options.templateOptions.transform22="+JSON.stringify($scope.options.templateOptions.transform))
- if ($scope.options.templateOptions.isSubmit) {
- if ($scope.options.templateOptions.transform($scope.$root.user, value).id) {
- $scope.options.templateOptions.translate = $scope.options.templateOptions.transform($scope.$root.user, value).value;
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.$root.user, value).id
- console.log($scope.options.templateOptions.transform($scope.$root.user, value));
- } else {
- $scope.options.templateOptions.translate = $scope.options.templateOptions.transform($scope.$root.user, value);
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.$root.user, value);
- console.log($scope.options.templateOptions.transform($scope.$root.user, value));
- }
- } else {
- $scope.options.templateOptions.translate = $scope.options.templateOptions.transform($scope.originalModel, value);
- }
- // var transform = function(model, value) {
- // if (model.account) {
- // return { value: model.name, id: model.account }
- // }
- // }
- }
- }]
- });
- //标题组件
- formlyConfigProvider.setType({
- name: 'ui-title',
- template: '<section id="page-title-form"><div class="row"><div class="col-sm-8"><h4 class="mainTitle" style="font-weight:bold">{{options.templateOptions.label}}</h1><span class="mainDescription">{{options.templateOptions.placeholder}}</span></div></div></section>'
- });
- //副标题baoxiuliebiao
- formlyConfigProvider.setType({
- name: 'ui-titlenew',
- template: ' <div class="row-leftright-16 font-color-black fz-14"><div class="col-xs-12" stlye="padding-left:8px;padding-right:8px"> <span class="pull-left padding-top-5 padding-bottom-5"><i class="icon iconfont dsit-baoxiuliebiao font-color-lightbluesmall"></i> {{to.label}}</span><span class="pull-right padding-top-5 padding-bottom-5">{{ model[options.key]}}<span class="margin-left-5 margin-right-5 pull-right {{statecolor}}" >{{$parent.$parent.$parent.model.inspectionProcessActual.stateName}}</span> </span> </div></div>',
- controller: ['$scope', function ($scope) {
- if ($scope.$parent.$parent.$parent.model.inspectionProcessActual) {
- if ($scope.$parent.$parent.$parent.model.inspectionProcessActual.state == 0) {
- $scope.statecolor = "state-wrap-basetwo"
- } else if ($scope.$parent.$parent.$parent.model.inspectionProcessActual.state == 1) {
- $scope.statecolor = "state-wrap-basethree"
- } else if ($scope.model.status == "待评价") {
- $scope.statecolor = "state-wrap-basefour"
- } else if ($scope.model.status == "已解决") {
- $scope.statecolor = "state-wrap-baseone"
- }
- } else {
- }
- }]
- });
- //副标题baoxiuliebiao
- formlyConfigProvider.setType({
- name: 'ui-titlenewincident',
- template: ' <div class="row-leftright-16 font-color-black fz-14"><div class="col-xs-12"> <span class="pull-left padding-top-5 padding-bottom-5 col-xs-5 rowlr"><i class="icon iconfont dsit-baoxiuliebiao font-color-lightbluesmall"></i> {{to.label}}</span><span class=" padding-top-5 padding-bottom-5 col-xs-7 rowlr">{{ model[options.key]}}<span class="margin-left-5 margin-right-5 pull-right {{statecolor}}" >{{model.state.name}}</span> </span> </div></div>',
- controller: ['$scope', function ($scope) {
- if ($scope.model.state.id == 2) {
- $scope.statecolor = "state-wrap-basetwo"
- } else if ($scope.model.state.id == 3) {
- $scope.statecolor = "state-wrap-basethree"
- } else if ($scope.model.state.id == 4) {
- $scope.statecolor = "state-wrap-basefour"
- } else if ($scope.model.state.id == 5) {
- $scope.statecolor = "state-wrap-baseone"
- } else if ($scope.model.state.id == 6) {
- $scope.statecolor = "state-wrap-basetwo"
- } else if ($scope.model.state.id == 7) {
- $scope.statecolor = "state-wrap-basethree"
- }
- }]
- });
- //图片查看-seimin
- formlyConfigProvider.setType({
- name: 'ui-imagewatch-seimin',
- template: '<div class="normal-label-wrap" style="padding:0;overflow:hidden;"><div class="normal-text rowlr col col-70 col-xs-12"><div class="ng-binding font-color-black">图片:<span class="font-color-gray"></span></div> <div style="margin-top:8px;display:flex;justify-content: space-between;"><img ng-repeat="it in imagelist" style="width:25%;" ng-src="{{serverIp}}/service/common/common/previewAttachmentImage/{{it.token}}" class="pitt"></div><div id="page1"></div></div></div>',
- controller: ['$rootScope', '$scope', 'api_wechatfile', function ($rootScope, $scope, api_wechatfile) {
- $scope.imagelist = [];
- $scope.serverIp = $rootScope.serverIp;
- api_wechatfile.listAttachments('wechatRequesterIncident', $scope.model.incident.processInstanceId).then(function (data) {
- var myData = data;
- angular.forEach(myData.data, function (item, index) {
- myData.data[index].token = item.token;
- $scope.imagelist.push(myData.data[index]);
- })
- });
- }]
- });
- //图片查看
- formlyConfigProvider.setType({
- name: 'ui-imagewatch',
- template: ' <div class="normal-label-wrap"><div class="normal-text rowlr col col-70 col-xs-12"><span class="ng-binding font-color-black pull-left">报修图片:<span class="font-color-gray"></span></span> <span ng-repeat="it in imagelist"><span><img ng-src={{it.previewUrl}} class="pitt"></span></span><div id="page1"></div></div></div>',
- controller: ['$scope', '$sce', 'api_bpm_domain', function ($scope, $sce, api_bpm_domain) {
- $scope.imagelist = [];
- api_bpm_domain.listAttachments($scope.model.incident.processInstanceId, { "idx": 0, "sum": 1000 }).then(function (data) {
- var myData = data;
- // for (var i = 0; i < myData.data.length; i++) {
- angular.forEach(myData.data, function (item, index) {
- api_bpm_domain.attachmentsPreviewUrl(item.id).then(function (data) {
- myData.data[index].previewUrl = $sce.trustAsResourceUrl(data.previewUrl);
- $scope.imagelist.push(myData.data[index]);
- });
- })
- // }
- });
- }]
- });
- //内容
- formlyConfigProvider.setType({
- name: 'ui-nection',
- template: ' <div class="row-leftright-4 titleStyleonly fz-14"><div class="col-xs-12 rowlr"> <div class="col-xs-12 titleStyleonly fz-14"> <div class="rowlr col-xs-5 pull-left padding-top-5 padding-bottom-5 font-color-black"><div class="onerow row rowlr" style="float:left"> {{to.label}}</div><div style="float:left">:</div></div><div class="rowlr pull-left padding-top-5 padding-bottom-5 col-xs-7">{{ model[options.key]}} </div> </div > </div></div>'
- });
- //巡检
- formlyConfigProvider.setType({
- name: 'ui-isok',
- template: '<div class="row-leftright-16 list-border-top fz-14"><div class="col-xs-12"> <label class="pull-left fz-14 padding-top-8 padding-bottom-8">{{to.label}}<span ng-if="to.required" style="color:red">*</span>:</label><div class="setting-box clearfix pull-right"><span class="setting-switch pull-left"><switch ng-model="model[options.key]" class="red" on="正常" off="异常"></switch></span></div></div></div>'
- });
- //巡检查看
- formlyConfigProvider.setType({
- name: 'ui-isoklook',
- template: ' <div class="row-leftright-16 font-color-black fz-14"><div class="col-xs-12"> <div class="col-xs-12 font-color-black fz-14"> <span class="pull-left padding-top-5 padding-bottom-5" style="width:12rem"> {{to.label}}:</span><span class="pull-left padding-top-5 padding-bottom-5">{{ model[options.key]}} </span> </div > </div></div>',
- controller: ['$scope', function ($scope) {
- if ($scope.model[$scope.options.key] == true) {
- $scope.model[$scope.options.key] = "异常"
- } else {
- $scope.model[$scope.options.key] = "正常"
- }
- }]
- });
- //巡检查看
- formlyConfigProvider.setType({
- name: 'ui-textlook',
- template: ' <div class="row-leftright-16 font-color-black fz-14"><div class="col-xs-12"> <div class="col-xs-12 font-color-black fz-14"> <span class="pull-left padding-top-5 padding-bottom-5" style="width:12rem"> {{to.label}}:</span><span class="pull-left padding-top-5 padding-bottom-5">{{ model[options.key]}} </span> </div > </div></div>',
- controller: ['$scope', function ($scope) {
- // if ($scope.model[$scope.options.key] == true) {
- // $scope.model[$scope.options.key] = "正常"
- // } else {
- // $scope.model[$scope.options.key] = "异常"
- // }
- }]
- });
- //事件
- formlyConfigProvider.setType({
- name: 'ui-isokincident',
- template: '<div class="row-leftright-16 list-border-top fz-14"><div class="col-xs-12"> <label class="pull-left fz-14 padding-top-8 padding-bottom-8">{{to.label}}<span ng-if="to.required" style="color:red">*</span>:</label><div class="setting-box clearfix pull-right"><span class="setting-switch pull-left"><switch ng-model="model[options.key]" class="red" on="是" off="否"></switch></span></div></div></div>',
- controller: ['$scope', function ($scope) {
- // console.log($scope.model[$scope.options.key]);
- }]
- });
- //分类标题组件
- formlyConfigProvider.setType({
- name: 'ui-typeTitle',
- templateUrl: 'assets/views/customform/tpl/ui-typeTitle.html'
- });
- //按钮组
- formlyConfigProvider.setType({
- name: 'ui-button',
- templateUrl: 'assets/views/customform/tpl/ui-button.html',
- defaultOptions: function (options) {
- return {
- noFormControl: true
- }
- }
- });
- //3d组link
- formlyConfigProvider.setType({
- name: 'ui-link',
- templateUrl: 'assets/views/customform/tpl/ui-link.html',
- defaultOptions: function (options) {
- return {
- noFormControl: true
- }
- }
- });
- //隐藏域组件
- formlyConfigProvider.setType({
- name: 'ui-hidden',
- extends: 'input',
- template: '<input type="text" ng-model="model[options.key]" style="display: none;"/ >',
- defaultOptions: function (options) {
- return {
- // noFormControl: true
- };
- }
- });
- //文本框组件
- formlyConfigProvider.setType({
- name: 'ui-input',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-input.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- transform: function (model, modelKey) {
- if (model[modelKey]) {
- // return {
- // value: model.name,
- // id: model[modelKey]
- // }
- return model[modelKey]
- }
- }
- }
- };
- },
- controller: ['$scope', function ($scope) {
- // setInterval(function() {
- // }, 1000);
- if (angular.isFunction($scope.options.templateOptions.linkData)) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.linkData($scope.model);
- }
- //赋值和别名转化
- if ($scope.options.templateOptions.modelKey) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.$root.user, $scope.options.templateOptions.modelKey);
- }
- if ($scope.options.templateOptions.transformdata) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transformdata($scope.originalModel, $scope.model[$scope.options.key]);
- }
- }]
- });
- //无html结构显示控件
- formlyConfigProvider.setType({
- name: 'ui-noTemplate',
- // templateUrl: 'assets/views/customform/tpl/ui-input.html',
- template: '<div ng-model="model[options.key]" style="display: none;"></div>',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- transform: function (model, modelKey) {
- if (model[modelKey]) {
- // return {
- // value: model.name,
- // id: model[modelKey]
- // }
- return model[modelKey]
- }
- }
- }
- };
- },
- controller: ['$scope', function ($scope) {
- console.log($scope.options.templateOptions)
- var value = $scope.model[$scope.options.key];
- function treeDesc(children, key, label) {
- if (label == "") {
- label = children[key];
- } else {
- label = children[key] + "-" + label;
- }
- if (angular.isDefined(children.parent)) {
- treeDesc(children.parent, key, label);
- } else {
- return label;
- }
- }
- if (angular.isArray(value)) {
- var tempValue = "";
- angular.forEach(value, function (item) {
- if (tempValue != "") {
- tempValue = tempValue + ",";
- }
- tempValue = tempValue + item[$scope.options.templateOptions.labelProp] || item;
- });
- $scope.options.templateOptions.translate = tempValue;
- } else if (angular.isObject(value)) {
- if (angular.isDefined(value.children) || angular.isDefined(value.parent)) {
- //tree
- // console.log("value.parent="+JSON.stringify(value.parent))
- var nameLabel = value[$scope.options.templateOptions.labelProp];
- nameLabel = treeDesc(value.parent, $scope.options.templateOptions.labelProp, nameLabel);
- $scope.options.templateOptions.translate = nameLabel;
- } else {
- $scope.options.templateOptions.translate = value;
- }
- } else if (angular.isString(value) && value.indexOf('yyyy-MM-ddTHH:mm:sssZ') > 0) {
- console.log("value=" + value);
- $scope.options.templateOptions.translate = value;
- // }else if(angular.isString(value)&&value.indexOf('yyyy-MM-ddTHH:mm:sssZ')>0){
- // console.log("value="+value);
- // $scope.options.templateOptions.translate = value;
- } else {
- // console.log("$scope.options.templateOptions.translate="+JSON.stringify($scope.options.templateOptions.translate))
- $scope.options.templateOptions.translate = value;
- }
- if (angular.isFunction($scope.options.templateOptions.transform)) {
- // console.log("$scope.options.templateOptions.transform22="+JSON.stringify($scope.options.templateOptions.transform))
- if ($scope.options.templateOptions.isSubmit) {
- if ($scope.options.templateOptions.transform($scope.$root.user, value).id) {
- $scope.options.templateOptions.translate = $scope.options.templateOptions.transform($scope.$root.user, value).value;
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.$root.user, value).id
- console.log($scope.options.templateOptions.transform($scope.$root.user, value));
- } else {
- $scope.options.templateOptions.translate = $scope.options.templateOptions.transform($scope.$root.user, value);
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.$root.user, value);
- console.log($scope.options.templateOptions.transform($scope.$root.user, value));
- }
- } else {
- $scope.options.templateOptions.translate = $scope.options.templateOptions.transform($scope.originalModel, value);
- }
- // var transform = function(model, value) {
- // if (model.account) {
- // return { value: model.name, id: model.account }
- // }
- // }
- }
- }]
- });
- //只读文本
- formlyConfigProvider.setType({
- name: 'ui-disableinput',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-disableinput.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- transform: function (value) {
- var ret = "";
- if (value) {
- ret = "已删除";
- } else {
- ret = "正常";
- }
- return ret;
- }
- }
- };
- }
- });
- formlyConfigProvider.setType({
- name: 'ui-disinput',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-disinput.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- }
- });
- //数字组件
- formlyConfigProvider.setType({
- name: 'ui-number',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-number.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', function ($scope) {
- console.log($scope.model[$scope.options.key]);
- }]
- });
- //普通下拉框
- // formlyConfigProvider.setType({
- // name: 'ui-select-prototype',
- // // extends: 'input',
- // templateUrl: 'assets/views/customform/tpl/ui-number.html',
- // defaultOptions: function(options) {
- // return {
- // templateOptions: {
- // // key: 'multiselectItem',
- // // type: 'ui-multi-select-tree',
- // // className: 'col-xs-6',
- // templateOptions: {
- // label: 'multiSelect',
- // placeholder: '请选择...',
- // isMultiSelect: false,
- // selLeafs: false, //只选叶子节点
- // refreshData: function(APIService) {
- // return APIService.fetchDataList('changeclassify', { 'idx': 0, 'sum': 100 });
- // },
- // APIService: api_bpm_data,
- // optionsDataKey: 'list',
- // refreshDelay: 1000,
- // onDataCallback: function(item, selectItems, options, field, model) {
- // model[options.key] = { id: item.id };
- // // console.log("item="+JSON.stringify(model))
- // }
- // }
- // }
- // };
- // },
- // controller: ['$scope', function($scope) {
- // console.log($scope.model[$scope.options.key]);
- // }]
- // });
- //下拉搜索框
- formlyConfigProvider.setType({
- name: 'ui-inputright',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-inputright.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- transform: function (model, modelKey) {
- if (model[modelKey]) {
- // return {
- // value: model.name,
- // id: model[modelKey]
- // }
- // return model[modelKey]
- }
- },
- getlistdata: function ($scope, key) {
- if (options.templateOptions.optionsUrl) {
- // if (options.templateOptions.ApiService) {
- var process = {};
- // }
- var datakey = { "idx": 0, "sum": 1000 };
- if (options.templateOptions.Restangular) {
- var process = options.templateOptions.Restangular.all("");
- }
- if (key) {
- angular.extend(datakey, { place: { areaId: $scope.$parent.$parent.$parent.model.incident.area.id, place: key, selectType: "pinyin_qs" } });
- }
- process.customPOST(datakey, options.templateOptions.optionsUrl).then(function (result) {
- if (!options.templateOptions.options) {
- $scope.to.options = [];
- }
- if (options.templateOptions.optionsDataKey) {
- $scope.to.options = result[options.templateOptions.optionsDataKey];
- } else {
- $scope.to.options = result;
- }
- });
- }
- }
- }
- };
- },
- controller: ['$scope', '$aside', 'BpmRestangular', 'UserRestangular', 'WechatRestangular', function ($scope, $aside, BpmRestangular, UserRestangular, WechatRestangular) {
- $scope.inputclick = function () {
- var modalInstance = $aside.open({
- templateUrl: 'assets/views/customform/tpl/searchright.html',
- placement: 'right',
- backdrop: false,
- controller: function ($scope, $modalInstance, scope) {
- $scope.search = {};
- $scope.options = scope.to.options;
- $scope.valueProp = scope.to.valueProp;
- $scope.labelProp = scope.to.labelProp;
- $scope.placeholder = scope.to.placeholder;
- $scope.ok = function (item) {
- $modalInstance.close(item);
- if (scope.options.templateOptions.translate) {
- scope.options.templateOptions.translate(item, scope);
- }
- }
- pushHistory();
- window.addEventListener("popstate", function (e) {
- // window.location = 'http://www.baidu.com';
- }, false);
- function pushHistory() {
- var state = {
- title: "title",
- url: "#"
- };
- window.history.pushState(state, "title", "#");
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- $scope.onChange = function (key) {
- if (scope.options.templateOptions.change) {
- scope.options.templateOptions.change($scope, scope, key);
- }
- }
- },
- size: 'lg',
- resolve: {
- scope: function () {
- return $scope;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- angular.extend($scope.model, selectedItem);
- $scope.model[$scope.options.key] = $scope.model[$scope.options.key];
- });
- }
- $scope.options.templateOptions.getlistdata($scope);
- }]
- });
- //微信树形下拉框
- formlyConfigProvider.setType({
- name: 'ui-selecttreewechat',
- extends: 'select',
- // template: '<div style="background:white" class="tabs-top fz-16"><div class="top-header"><div class="item item-icon-right height_3" ng-click="inputclick()" placeholder="{{to.placeholder}}"><a class="" ng-focus="inputclick()"> <i class="icon ion-ios-arrow-right font-color-gray" style="font-size: 2rem;"></i> </a><span class="">{{value[to.labelProp]}}</span></div></div> </div>',
- template: '<div class="contain" style="background:white" class="tabs-top fz-16">' +
- '<div class="fixWidth">' +
- '<a class="item item-icon-right bordo height_3" ng-click="inputclick()" placeholder="{{to.placeholder}}"><span ng-if="value[to.labelProp]" style="font-size:1.4rem;color:#666">{{value[to.labelProp]||to.placeholder}}</span><span ng-if="!value[to.labelProp]" style="font-size:1.4rem;color:#999">{{to.placeholder}}</span>' +
- '<i class="icon ion-ios-arrow-right font-color-gray" style="font-size: 2rem;"></i>' +
- '</a>' +
- '</div>' +
- '</div>',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- },
- };
- },
- controller: ['$scope', '$rootScope', '$aside', function ($scope, $rootScope, $aside) {
- $scope.inputclick = function () {
- var modalInstance = $aside.open({
- templateUrl: 'assets/views/customform/tpl/bottomlist.html',
- placement: 'bottom',
- backdrop: true,
- controller: function ($scope, $modalInstance, scope) {
- $scope.statuses = scope.to.options;
- $scope.to = scope.to;
- $scope.ok = function (item) {
- $modalInstance.close(item);
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- scope: function () {
- return $scope;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- $scope.value = selectedItem;
- $scope.model[$scope.options.key] = selectedItem[$scope.options.templateOptions.valueProp];
- });
- }
- if ($scope.options.templateOptions.optionsUrl) {
- $scope.options.templateOptions.refresh('', $scope.options);
- } else {
- }
- if ($scope.options.templateOptions.transform) {
- $scope.options.templateOptions.onChange($scope.model.id, $scope.options, $scope);
- }
- if (angular.isFunction($scope.options.templateOptions.translate)) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.translate($scope.model, $rootScope);
- }
- }]
- });
- //微信下拉框
- formlyConfigProvider.setType({
- name: 'ui-selectwechat',
- extends: 'select',
- // template: '<div style="background:white" class="tabs-top fz-16"><div class="top-header"><div class="item item-icon-right height_3" ng-click="inputclick()" placeholder="{{to.placeholder}}"><a class="" ng-focus="inputclick()"> <i class="icon ion-ios-arrow-right font-color-gray" style="font-size: 2rem;"></i> </a><span class="">{{value[to.labelProp]}}</span></div></div> </div>',
- template: '<div class="contain" style="background:white" class="tabs-top fz-16">' +
- '<div class="fixWidth">' +
- '<a class="item item-icon-right bordo height_3" ng-click="inputclick()" placeholder="{{to.placeholder}}"><span ng-if="value[to.labelProp]" style="font-size:1.4rem;color:#666">{{value[to.labelProp]||to.placeholder}}</span><span ng-if="!value[to.labelProp]" style="font-size:1.4rem;color:#999">{{to.placeholder}}</span>' +
- '<i class="icon ion-ios-arrow-right font-color-gray" style="font-size: 2rem;"></i>' +
- '</a>' +
- '</div>' +
- '</div>',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- },
- };
- },
- controller: ['$scope', '$rootScope', '$aside', function ($scope, $rootScope, $aside) {
- $scope.inputclick = function () {
- var modalInstance = $aside.open({
- templateUrl: 'assets/views/customform/tpl/bottomlist.html',
- placement: 'bottom',
- backdrop: true,
- controller: function ($scope, $modalInstance, scope) {
- $scope.statuses = scope.to.options;
- $scope.to = scope.to;
- $scope.ok = function (item) {
- $modalInstance.close(item);
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- scope: function () {
- return $scope;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- $scope.value = selectedItem;
- if ($scope.options.templateOptions.valueProp) {
- $scope.model[$scope.options.key] = selectedItem[$scope.options.templateOptions.valueProp];
- }
- });
- }
- if ($scope.model[$scope.options.key] && $scope.model[$scope.options.key] != null) {
- $scope.value = $scope.model;
- }
- if ($scope.options.templateOptions.optionsUrl) {
- $scope.options.templateOptions.refresh('', $scope.options);
- } else {
- }
- if ($scope.options.templateOptions.transform) {
- $scope.options.templateOptions.onChange($scope.model.id, $scope.options, $scope);
- }
- if (angular.isFunction($scope.options.templateOptions.translate)) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.translate($scope.model, $rootScope);
- }
- }]
- });
- //下拉框组件
- formlyConfigProvider.setType({
- name: 'ui-select',
- extends: 'select',
- templateUrl: 'assets/views/customform/tpl/ui-select.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- // refresh: function() {},
- // refreshDelay: 0,
- linkage: function (modelName, data, model, modelKey, key) {
- angular.extend(data, { "idx": 0, "sum": 1000 });
- options.templateOptions.APIService.fetchDataList(modelName, data).then(function (response) {
- var myData = options.templateOptions.Restangular.stripRestangular(response);
- var list = myData.list;
- if (list.length == 1) {
- angular.forEach(model.fields, function (item) {
- angular.forEach(model.fields, function (item) {
- if (item.templateOptions.pkey == modelKey + "." + key) {
- item.model.id = '';
- item.model.place = '';
- if (key == "place") {
- item.templateOptions.options = list;
- } else if (key == "placeDTO") {
- item.templateOptions.options = list;
- } else { item.value(list[0][key][item.key]); }
- }
- })
- })
- } else {
- angular.forEach(model.fields, function (item) {
- angular.forEach(model.fields, function (item) {
- if (item.templateOptions.pkey == modelKey + "." + key) {
- item.model.id = '';
- item.model.place = '';
- if (key == "place") { item.templateOptions.options = list; }
- if (key == "placeDTO") { item.templateOptions.options = list; }
- }
- })
- })
- }
- });
- }
- },
- };
- },
- controller: ['$scope', '$rootScope', function ($scope, $rootScope) {
- if ($scope.options.templateOptions.transform) {
- $scope.options.templateOptions.onChange($scope.model.id, $scope.options, $scope);
- }
- if (angular.isFunction($scope.options.templateOptions.translate)) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.translate($scope.model, $rootScope);
- }
- }]
- });
- //可修改下拉框组件
- formlyConfigProvider.setType({
- name: 'ui-selectchange',
- extends: 'select',
- templateUrl: 'assets/views/customform/tpl/ui-selectchange.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function () { },
- refreshDelay: 0,
- linkage: function (modelName, data, model, modelKey, key) {
- angular.extend(data, { "idx": 0, "sum": 1000 });
- options.templateOptions.APIService.fetchDataList(modelName, data).then(function (response) {
- var myData = options.templateOptions.Restangular.stripRestangular(response);
- var list = myData.list;
- if (list.length == 1) {
- angular.forEach(model.fields, function (item) {
- angular.forEach(model.fields, function (item) {
- if (item.templateOptions.pkey == modelKey + "." + key) {
- item.model.id = "";
- if (key == "place") {
- item.templateOptions.options = list;
- } else { item.value(list[0][key][item.key]); }
- }
- })
- })
- } else {
- angular.forEach(model.fields, function (item) {
- angular.forEach(model.fields, function (item) {
- if (item.templateOptions.pkey == modelKey + "." + key) {
- item.model.id = "";
- if (key == "place") {
- item.templateOptions.options = list;
- }
- }
- })
- })
- }
- });
- }
- },
- controller: ['$scope', function ($scope) {
- if (angular.isArray($scope.model[$scope.options.key])) {
- } else {
- $scope.model[$scope.options.key] = [];
- }
- }]
- };
- }
- });
- //下拉多选框组件
- formlyConfigProvider.setType({
- name: 'ui-multiselect',
- extends: 'select',
- templateUrl: 'assets/views/customform/tpl/ui-multiselect.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function () { },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', function ($scope) {
- $scope.model[$scope.options.key] = [];
- }]
- });
- //下拉多选框灵活组件
- formlyConfigProvider.setType({
- name: 'ui-multiselectplus',
- extends: 'select',
- templateUrl: 'assets/views/customform/tpl/ui-multiselectplus.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refreshData: function (search, options, model, that) {
- var process = options.templateOptions.ApiService.all("");
- if (search) {
- } else {
- }
- var postData = options.templateOptions.optionsPostData;
- if (angular.isFunction(options.templateOptions.optionsPostData)) {
- postData = options.templateOptions.optionsPostData(options, model, that);
- }
- process.customPOST(postData, options.templateOptions.optionsUrl).then(function (result) {
- if (!options.templateOptions.options) {
- options.templateOptions.options = [];
- }
- if (options.templateOptions.optionsDataKey) {
- options.templateOptions.options = result[options.templateOptions.optionsDataKey];
- } else {
- options.templateOptions.options = result;
- }
- if (options.templateOptions.optionsChecked) {
- options.value(options.templateOptions.options);
- }
- });
- },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', function ($scope) {
- if (angular.isArray($scope.model[$scope.options.key])) {
- } else {
- $scope.model[$scope.options.key] = [];
- }
- }]
- });
- //下拉树形多选组件
- formlyConfigProvider.setType({
- name: 'ui-multiselect-tree',
- extends: 'multiCheckbox',
- templateUrl: 'assets/views/customform/tpl/ui-multi-select-tree.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- linkage: function (modelName, data, model, modelKey, key) {
- angular.extend(data, { "idx": 0, "sum": 10 });
- options.templateOptions.APIService.fetchDataList(modelName, data).then(function (response) {
- var myData = options.templateOptions.Restangular.stripRestangular(response);
- var list = myData.list;
- if (list.length == 1) {
- angular.forEach(model.fields, function (item) {
- angular.forEach(model.fields, function (item) {
- if (item.templateOptions.pkey == modelKey + "." + key) {
- item.model.id = "";
- if (key == "place") {
- item.templateOptions.options = list;
- } else { item.value(list[0][key][item.key]); }
- }
- })
- })
- }
- });
- },
- // my_tree_handler : function(items) {
- // console.log('erytuiyewrutyuweyrutewru')
- // },
- // onFilterCallback : function(items) {
- // console.log('1341341234123')
- // },
- // onFilterCallback : function(items) {
- // console.log('134134weafaesesd')
- // },
- refresh: function (items) {
- var treedata = [];
- function convertListToTree(data, treeMap) {
- treedata = data;
- for (var i = 0; i < data.length; i++) {
- for (var j = 0; j < data.length; j++) {
- if (data[i].pid && data[i].id && data[i].pid != 0) {
- if (data[i].pid == data[j].id) {
- data[i].parent = data[j];
- }
- }
- }
- }
- var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
- var root = null; //Initially set our loop to null
- //loop over data
- for (var i = 0; i < data.length; i++) {
- var datum = data[i];
- //each node will have children, so let's give it a "children" poperty
- datum.children = [];
- //add an entry for this node to the map so that any future children can
- //lookup the parent
- idToNodeMap[datum.id] = datum;
- //Does this node have a parent?
- // console.log("datum="+JSON.stringify(datum))
- if (typeof datum.parent === "undefined" || datum.parent === null) {
- //Doesn't look like it, so this node is the root of the tree
- root = datum;
- treeMap[datum.id] = root;
- } else {
- //This node has a parent, so let's look it up using the id
- parentNode = idToNodeMap[datum.parent.id];
- //We don't need this property, so let's delete it.
- delete datum.parent;
- //Let's add the current node as a child of the parent node.
- parentNode.children.push(datum);
- }
- }
- return root;
- }
- function convertParentToChildList(data) {
- // console.log("data="+JSON.stringify(data))
- var treeMap = {};
- var list = [];
- convertListToTree(data, treeMap);
- angular.forEach(treeMap, function (item) {
- list.push(item);
- });
- return list;
- }
- function selectItem(pmodel, childrens) {
- if (angular.isArray(pmodel)) {
- angular.forEach(pmodel, function (index) {
- if (index && index.id) {
- angular.forEach(childrens, function (item) {
- if (item.id == index.id) {
- item.selected = true;
- }
- if (item && item.children) {
- selectItem(pmodel, item.children);
- }
- });
- }
- })
- } else {
- if (pmodel && pmodel.id) {
- angular.forEach(childrens, function (item) {
- if (item.id == pmodel.id) {
- item.selected = true;
- }
- if (item && item.children) {
- selectItem(pmodel, item.children);
- }
- });
- }
- }
- }
- // if(angular.isUndefined(options.model[options.key])||options.model[options.key]==null){
- options.templateOptions.refreshData(options.templateOptions.APIService).then(function (result) {
- if (!options.templateOptions.options) {
- options.templateOptions.options = [];
- }
- if (options.templateOptions.optionsDataKey) {
- options.templateOptions.options = convertParentToChildList(result[options.templateOptions.optionsDataKey]);
- } else {
- options.templateOptions.options = convertParentToChildList(result);
- }
- //set default value
- var pmodel, i = 0;
- if (options.templateOptions.pkey) {
- if (options.templateOptions.pkey.indexOf(".") > 0) {
- angular.forEach(options.templateOptions.pkey.split("."), function (p) {
- if (i == 0) {
- if (options.model[p] == null) {
- options.model[p] = {};
- }
- pmodel = options.model[p];
- i++;
- } else {
- if (pmodel[p] == null) {
- pmodel[p] = {};
- }
- pmodel = pmodel[p];
- }
- });
- } else {
- pmodel = options.model;
- }
- }
- if (pmodel) {
- pmodel = pmodel[options.key];
- } else if (options.model) {
- pmodel = options.model[options.key];
- } else {
- pmodel = options.templateOptions.options;
- }
- if (angular.isArray(pmodel)) {
- if (pmodel) {
- // if(options.templateOptions.isMultiSelect==true){
- // options.templateOptions.refreshData(options.templateOptions.APIService).then(function(rep){
- // selectParent(pmodel,rep[options.templateOptions.optionsDataKey]);
- // })
- // }else{
- selectItem(pmodel, options.templateOptions.options);
- // }
- }
- } else {
- if (pmodel && pmodel.id) {
- selectItem(pmodel, options.templateOptions.options);
- }
- }
- // for(var i=0;i<options.templateOptions.options.length;i++){
- // options.templateOptions.options[i]={'id':options.templateOptions.options[i].id,'recate':options.templateOptions.options[i].recate}
- // }
- items.inputModel = options.templateOptions.options;
- // console.log(model);
- // console.log(options);
- });
- }
- },
- validators: {
- required: {
- expression: function (viewValue, modelValue) {
- var value = modelValue || viewValue;
- if (angular.isArray(value)) {
- for (var i = 0; i < value.length; i++) {
- value[i] = { id: value[i].id }
- }
- return value.length > 0
- } else {
- // console.log(options)
- return value = "true";
- // return value != null;
- }
- }
- }
- }
- }
- },
- controller: ['$scope', 'api_configure_form', function ($scope, api_configure_form) {
- if ($scope.options.templateOptions.isMultiSelect) {
- // console.log($scope);
- } else {
- if ($scope.model[$scope.options.key]) {
- }
- }
- }]
- });
- //多选下拉框组件
- formlyConfigProvider.setType({
- name: 'ui-multi-select-tree',
- extends: 'multiCheckbox',
- templateUrl: 'assets/views/customform/tpl/ui-multi-select-tree.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- linkage: function (modelName, data, model, modelKey, key) {
- angular.extend(data, { "idx": 0, "sum": 10 });
- options.templateOptions.APIService.fetchDataList(modelName, data).then(function (response) {
- var myData = options.templateOptions.Restangular.stripRestangular(response);
- var list = myData.list;
- if (list.length == 1) {
- angular.forEach(model.fields, function (item) {
- angular.forEach(model.fields, function (item) {
- if (item.templateOptions.pkey == modelKey + "." + key) {
- item.model.id = "";
- if (key == "place") {
- item.templateOptions.options = list;
- } else { item.value(list[0][key][item.key]); }
- }
- })
- })
- }
- });
- },
- getparentdata: function (items) {
- console.log(items)
- },
- refresh: function (items) {
- //console.log(items);
- var treedata = [];
- function convertListToTree(data, treeMap) {
- treedata = data;
- for (var i = 0; i < data.length; i++) {
- for (var j = 0; j < data.length; j++) {
- if (data[i].pid && data[i].id && data[i].pid != 0) {
- if (data[i].pid == data[j].id) {
- data[i].parent = data[j];
- }
- }
- }
- }
- var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
- var root = null; //Initially set our loop to null
- //loop over data
- for (var i = 0; i < data.length; i++) {
- var datum = data[i];
- //each node will have children, so let's give it a "children" poperty
- datum.children = [];
- //add an entry for this node to the map so that any future children can
- //lookup the parent
- idToNodeMap[datum.id] = datum;
- //Does this node have a parent?
- // console.log("datum="+JSON.stringify(datum))
- if (typeof datum.parent === "undefined" || datum.parent === null) {
- //Doesn't look like it, so this node is the root of the tree
- root = datum;
- treeMap[datum.id] = root;
- } else {
- //This node has a parent, so let's look it up using the id
- parentNode = idToNodeMap[datum.parent.id];
- //We don't need this property, so let's delete it.
- delete datum.parent;
- //Let's add the current node as a child of the parent node.
- parentNode.children.push(datum);
- }
- }
- return root;
- }
- function convertParentToChildList(data) {
- // console.log("data="+JSON.stringify(data))
- var treeMap = {};
- var list = [];
- convertListToTree(data, treeMap);
- angular.forEach(treeMap, function (item) {
- // console.log("item="+JSON.stringify(item))
- list.push(item);
- });
- return list;
- }
- function selectItem(pmodel, childrens) {
- if (angular.isArray(pmodel)) {
- angular.forEach(pmodel, function (index) {
- if (index && index.id) {
- angular.forEach(childrens, function (item) {
- if (item.id == index.id) {
- item.selected = true;
- }
- if (item && item.children) {
- selectItem(pmodel, item.children);
- }
- });
- // angular.forEach(treedata,function(parentdata){
- // if(parentdata.id == index.id){
- // if(parentdata.parent&&parentdata.parent.id){
- // parentdata.parent.$
- // }
- // item.selected = true;
- // }
- // if (item && item.children) {
- // selectItem(pmodel ,item.children);
- // }
- // });
- }
- })
- } else {
- if (pmodel && pmodel.id) {
- angular.forEach(childrens, function (item) {
- if (item.id == pmodel.id) {
- item.selected = true;
- delete item.children;
- }
- if (item && item.children) {
- selectItem(pmodel, item.children);
- }
- });
- }
- }
- }
- // if(angular.isUndefined(options.model[options.key])||options.model[options.key]==null){
- options.templateOptions.refreshData(options.templateOptions.APIService).then(function (result) {
- if (!options.templateOptions.options) {
- options.templateOptions.options = [];
- }
- if (options.templateOptions.optionsDataKey) {
- options.templateOptions.options = convertParentToChildList(result[options.templateOptions.optionsDataKey]);
- } else {
- options.templateOptions.options = convertParentToChildList(result);
- }
- //set default value
- var pmodel, i = 0;
- if (options.templateOptions.pkey || options.templateOptions.pkey != "") {
- if (options.templateOptions.pkey.indexOf(".") > 0) {
- angular.forEach(options.templateOptions.pkey.split("."), function (p) {
- if (i == 0) {
- if (options.model[p] == null) {
- options.model[p] = {};
- }
- pmodel = options.model[p];
- i++;
- } else {
- if (pmodel[p] == null) {
- pmodel[p] = {};
- }
- pmodel = pmodel[p];
- }
- });
- } else {
- pmodel = options.model;
- }
- }
- if (pmodel) {
- pmodel = pmodel[options.key];
- } else if (options.model) {
- pmodel = options.model[options.key];
- }
- // else if ($stateParams.model) {
- // pmodel = $stateParams.model[options.key];
- // }
- if (angular.isArray(pmodel)) {
- if (pmodel) {
- selectItem(pmodel, options.templateOptions.options);
- }
- } else {
- if (pmodel && pmodel.id) {
- selectItem(pmodel, options.templateOptions.options);
- }
- }
- // for(var i=0;i<options.templateOptions.options.length;i++){
- // options.templateOptions.options[i]={'id':options.templateOptions.options[i].id,'recate':options.templateOptions.options[i].recate}
- // }
- items.inputModel = options.templateOptions.options;
- // console.log(model);
- // console.log(options);
- });
- }
- },
- validators: {
- required: {
- expression: function (viewValue, modelValue) {
- var value = modelValue || viewValue;
- if (angular.isArray(value)) {
- return value.length > 0
- } else {
- console.log(options)
- if (options.templateOptions.required) {
- return value != null;
- } else {
- return value = "true";
- }
- // return value = "true";
- }
- }
- }
- }
- }
- },
- controller: ['$scope', 'api_configure_form', function ($scope, api_configure_form) {
- if ($scope.options.templateOptions.isMultiSelect) {
- // console.log($scope);
- } else {
- if ($scope.model[$scope.options.key]) {
- }
- }
- // $scope.options.templateOptions.onDataCallback=function(item,selectItems,options, field, model){
- // console.log(item)
- // // if(){
- // // }
- // // $scope.model[$scope.options.key]=item.id;
- // api_configure_form.renderTabForm(item.prefix).then(function(data){
- // $scope.propTypeOptions = data;
- // });
- // }
- // $scope.model[$scope.options.key]=[];
- }]
- });
- //勾选组件
- formlyConfigProvider.setType({
- name: 'ui-checkbox',
- extends: 'checkbox',
- templateUrl: 'assets/views/customform/tpl/ui-checkbox.html'
- });
- //没有边框的勾选组件
- formlyConfigProvider.setType({
- name: 'ui-checkbox-noBorder',
- // extends: 'checkbox',
- templateUrl: 'assets/views/customform/tpl/ui-checkbox-noBorder.html',
- controller: ['$scope', function ($scope) {
- if ($scope.model[$scope.options.key] == true) {
- $scope.checkIconfont = 'dsit-dui fontGreen';
- } else {
- $scope.checkIconfont = 'dsit-false-circle fontRed';
- }
- $scope.checked = function () {
- $scope.model[$scope.options.key] = !$scope.model[$scope.options.key];
- if ($scope.model[$scope.options.key] == true) {
- $scope.checkIconfont = 'dsit-dui fontGreen';
- } else {
- $scope.checkIconfont = 'dsit-false-circle fontRed';
- }
- }
- }]
- });
- //换行组件
- formlyConfigProvider.setType({
- name: 'ui-nextLine',
- /*extends: 'input',*/
- template: '<div></div>',
- });
- //多选框组件
- formlyConfigProvider.setType({
- name: 'ui-checklist',
- extends: 'multiCheckbox',
- templateUrl: 'assets/views/customform/tpl/ui-checklist.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function () { },
- refreshDelay: 0
- }
- };
- }
- });
- //单选框组件
- formlyConfigProvider.setType({
- name: 'ui-radio',
- extends: 'radio',
- templateUrl: 'assets/views/customform/tpl/ui-radio.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function () { },
- refreshDelay: 0
- }
- };
- }
- });
- //微信二选一框组件
- formlyConfigProvider.setType({
- name: 'ui-radiowechat',
- // extends: 'radio',
- templateUrl: 'assets/views/customform/tpl/ui-radiowechat.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function () { },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', function ($scope) {
- if (angular.isDefined($scope.$parent.$parent.$parent.model[$scope.options.key])) {
- angular.forEach($scope.to.options, function (items) {
- if ($scope.$parent.$parent.$parent.model[$scope.options.key] == items.value) {
- $scope.isok = items.name;
- }
- })
- }
- // $scope.isok = $scope.$parent.$parent.$parent.model[$scope.options.key];
- $scope.ok = function (item) {
- $scope.isok = item.name;
- $scope.$parent.$parent.$parent.model[$scope.options.key] = item.value;
- $scope.options.templateOptions.onChange(item, $scope.option, this, '', $scope.model);
- }
- }]
- });
- //微信多个单选框组件
- formlyConfigProvider.setType({
- name: 'ui-allcheckwechat',
- // extends: 'radio',
- templateUrl: 'assets/views/customform/tpl/ui-radiowechat.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function () { },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', function ($scope) {
- if (angular.isDefined($scope.$parent.$parent.$parent.model[$scope.options.key])) {
- angular.forEach($scope.to.options, function (items) {
- if ($scope.$parent.$parent.$parent.model[$scope.options.key] == items.value) {
- $scope.isok = items.name;
- }
- })
- }
- // $scope.isok = $scope.$parent.$parent.$parent.model[$scope.options.key];
- $scope.ok = function (item) {
- $scope.isok = item.name;
- $scope.$parent.$parent.$parent.model[$scope.options.key] = item.value;
- // $scope.options.templateOptions.onChange(item, $scope.option, this, even, $scope.model);
- }
- }]
- });
- //文本域组件
- formlyConfigProvider.setWrapper({
- name: 'validation',
- types: ['ui-textarea'],
- template: "<formly-transclude></formly-transclude><div class=\"has-error\" ng-messages=\"fc.$error\" ng-if=\"options.formControl.$touched\"><div class=\"error\" ng-message=\"{{::name}}\" ng-repeat=\"(name, message) in ::options.validation.messages\">{{message(fc.$viewValue, fc.$modelValue, this)}}</div></div>"
- });
- formlyConfigProvider.setType({
- name: 'ui-textarea',
- extends: 'textarea',
- templateUrl: 'assets/views/customform/tpl/ui-textarea.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- transform: function (model, value) {
- return value;
- },
- },
- validation: {
- messages: {
- maxlength: function (viewValue, modelValue, scope) {
- if (viewValue != null) {
- if (viewValue.length > scope.to.maxlength) {
- return scope.to.label + ' 字数(' + viewValue.length + ')超限(' + scope.to.maxlength + ')'
- } else {
- return "";
- }
- }
- },
- }
- }
- }
- },
- controller: ['$scope', function ($scope) {
- var value = $scope.model[$scope.options.key];
- if (angular.isFunction($scope.options.templateOptions.transform)) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.$root.user, value);
- }
- }]
- });
- //改动的组件 ckeditor封装后的组件
- formlyConfigProvider.setType({
- name: 'ui-text-check',
- extends: 'textarea',
- templateUrl: 'assets/views/customform/tpl/ui-text-check.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- extraPlugins: 'uploadimage',
- uploadimageConfig: {
- backend: 'basic',
- settings: {
- uploadUrl: options.templateOptions.APIService.upload().getRequestedUrl(),
- headers: '',
- downloadUrl: options.templateOptions.APIService.uploadResponseUri().getRequestedUrl()
- }
- },
- refresh: function (APIService, contentId, data) {
- return APIService.fetchDataList(contentId, data);
- },
- downloadUri: function (APIService, contentId) {
- return APIService.downloadAttachment(contentId).getRequestedUrl();
- },
- upload: function (APIService, contentId) {
- return APIService.getSolutionDowpath(contentId);
- },
- view: function (attachmentId) {
- // return APIService.attachmentsPreviewUrl(contentId);
- },
- refreshDelay: 0,
- transform: function (model, value) {
- return value;
- },
- },
- validation: {
- messages: {
- maxlength: function (viewValue, modelValue, scope) {
- if (viewValue != null) {
- if (viewValue.length > scope.to.maxlength) {
- return scope.to.label + ' 字数(' + viewValue.length + ')超限(' + scope.to.maxlength + ')'
- } else {
- return "";
- }
- }
- },
- }
- }
- }
- },
- controller: ['$scope', '$rootScope', function ($scope, $rootScope) {
- var value = $scope.model[$scope.options.key];
- if (angular.isFunction($scope.options.templateOptions.transform)) {
- $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.originalModel, value);
- }
- $scope.options.templateOptions.uploadimageConfig.settings.headers = $rootScope.getSession();
- //var expiry={'expiry':14804244006};
- //angular.extend($scope.options.templateOptions.uploadimageConfig.settings.headers,expiry)
- //$scope.options.templateOptions.uploadimageConfig.settings.headers
- $scope.upload = function (contentId, filename) {
- var filename = filename;
- $scope.options.templateOptions.upload($scope.options.templateOptions.ApiService, contentId).then(function (response) {
- var file = new Blob([response], { type: 'application/octet-stream' });
- // var filename = filename;
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement('a');
- a.href = fileURL;
- a.target = '_blank';
- a.download = filename;
- document.body.appendChild(a);
- a.click();
- })
- };
- }]
- });
- //ui-grid展示控件
- formlyConfigProvider.setType({
- name: 'ui-grid-show',
- extends: 'multiCheckbox',
- templateUrl: 'assets/views/customform/tpl/ui-grid-show.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- linkage: function () {
- },
- },
- };
- },
- controller: function ($scope, $rootScope, i18nService, Restangular, api_bpm_data) {
- var loginUser = $rootScope.user;
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.enableColumnResizing = true;
- // $scope.gridOptions.enableFiltering = true;
- $scope.gridOptions.enableGridMenu = false;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = false;
- $scope.gridOptions.fastWatch = true;
- $scope.gridOptions.useExternalFiltering = true;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
- $scope.gridOptions.rowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function (row) {
- return row.id;
- };
- //{"id":1,"phone":"15071189091","name":"管理员","gender":"男","flag":1,"email":"asda@qq.com","account":"000001","group":[{"id":3,"groupName":"运行监控科"}]}
- $scope.gridOptions.columnDefs = [
- // { name:'id', width:80, enableFiltering:false},
- // { name: 'item', displayName: '序号', width: 50, enableFiltering: false },
- // { name: 'inspectionDTO.title', displayName: '计划主题', width: 150, enableFiltering: false },
- // { name: 'startDate', displayName: '巡检执行时间', width: 200, enableFiltering: false },
- // { name: 'inspectionDTO.executeUser.name', displayName: '计划执行人', width: 100, enableFiltering: false },
- // { name: 'inspectionDTO.createTime', displayName: '巡检创建时间', width: 200, enableFiltering: false },
- { name: 'inspection.title', displayName: '计划主题', width: 120, enableFiltering: false },
- { name: 'stateName', displayName: '状态', width: 80, enableFiltering: false },
- { name: 'processUser.name', displayName: '处理人', width: 80, enableFiltering: false },
- { name: 'startDate', displayName: '开始时间', width: 160, enableFiltering: false },
- { name: 'overdueTime', displayName: '逾期时间', width: 160, enableFiltering: false },
- ];
- var defaultFilterData = {
- "idx": 0,
- "sum": 10
- };
- //分页控制
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- var filtersData = $scope.memoryfilterData;
- filtersData.idx = newPage - 1;
- filtersData.sum = pageSize;
- $scope.refreshData('expand-right', filtersData);
- });
- gridApi.selection.on.rowSelectionChanged($scope, function (data) {
- data.grid.appScope.selected.items = data.entity
- });
- };
- //页面获取数据
- $scope.refreshData = function (style, filterData) {
- // $scope.ldloading[style.replace('-', '_')] = true;
- if (angular.isUndefined(filterData)) {
- filterData = defaultFilterData;
- }
- $scope.myData = [];
- angular.extend(filterData, { inspectionProcessActual: { "inspectionid": $scope.model.id } })
- api_bpm_data.fetchDataList('inspectionProcessActual', filterData).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions.totalItems = myData.totalNum;
- $scope.myData = myData.list;
- for (var i = 0; i < $scope.myData.length; i++) {
- //添加序号
- $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
- }
- // $scope.ldloading[style.replace('-', '_')] = false;
- }, function () {
- // $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- // formlyConfigProvider.setType({
- // name: 'ui-mentio',
- // extends: 'textarea',
- // templateUrl : 'assets/views/customform/tpl/mentio.html',
- // defaultOptions:function(options){
- // return {
- // templateOptions: {
- // transform:function(model, value){
- // return value;
- // },
- // },
- // validation: {
- // messages: {
- // maxlength: function(viewValue, modelValue, scope) {
- // if(viewValue!=null){
- // if(viewValue.length>scope.to.maxlength){
- // return scope.to.label + ' 字数('+ viewValue.length +')超限('+scope.to.maxlength+')'
- // }else{
- // return "";
- // }
- // }
- // },
- // }
- // }
- // }
- // },
- // controller: ['$scope',function($scope){
- // $scope.people = [
- // { label: 'Joe'},
- // { label: 'Mike'},
- // { label: 'Diane'}
- // ]
- // var value = $scope.model[$scope.options.key];
- // if(angular.isFunction($scope.options.templateOptions.transform)){
- // $scope.model[$scope.options.key] = $scope.options.templateOptions.transform($scope.originalModel, value);
- // }
- // }]
- // });
- //文本框自定义选择面板组件
- formlyConfigProvider.setType({
- name: 'ui-input-selectmodal',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-input-selectmodal.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- openModal: function (size, options, modal) {
- var modalInstance = modal.open({
- templateUrl: 'assets/views/customform/tpl/modal-content.html',
- controller: 'ModalInstanceCtrl', //'CustomformCtrl',//
- size: size,
- resolve: options.templateOptions.modalParam
- });
- modalInstance.result.then(function (selectedItem) {
- options.value(selectedItem);
- }, function () {
- //console.log('Modal dismissed at: ' + new Date());
- });
- }
- }
- };
- }
- });
- //日期控件
- var datepicker_attr = [
- 'date-disabled',
- 'custom-class',
- 'show-weeks',
- 'starting-day',
- 'init-date',
- 'min-mode',
- 'max-mode',
- 'format-day',
- 'format-month',
- 'format-year',
- 'format-day-header',
- 'format-day-title',
- 'format-month-title',
- 'year-range',
- 'shortcut-propagation',
- 'datepicker-popup',
- 'show-button-bar',
- 'current-text',
- 'clear-text',
- 'close-text',
- 'close-on-date-selection',
- 'datepicker-append-to-body'
- ];
- var datepicker_bindings = [
- 'datepicker-mode',
- 'min-date',
- 'max-date'
- ];
- formlyConfigProvider.setType({
- name: 'ui-datetime',
- templateUrl: 'assets/views/customform/tpl/ui-datetime.html',
- extends: 'input',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: {
- ngModelAttrs: getNgModelAttr(datepicker_attr, datepicker_bindings),
- templateOptions: {
- datepickerPopup: 'yyyy-MM-dd HH:mm:ss'
- }
- },
- controller: ['$scope', '$filter', function ($scope, $filter) {
- $scope.model[$scope.options.key] = $filter('date')(new Date(), $scope.options.templateOptions.datepickerPopup);
- $scope.options.initialValue = $scope.model[$scope.options.key];
- }]
- });
- //日期控件
- formlyConfigProvider.setType({
- name: 'ui-datepicker',
- templateUrl: 'assets/views/customform/tpl/ui-datepicker.html',
- extends: 'input',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: {
- ngModelAttrs: getNgModelAttr(datepicker_attr, datepicker_bindings),
- templateOptions: {
- datepickerPopup: 'yyyy-MM-dd HH:mm:ss'
- }
- },
- controller: ['$scope', '$filter', function ($scope, $filter) {
- // $scope.mindata=new Date(new Date().getTime() + 24*60*60*1000);
- if ($scope.model[$scope.options.key]) {
- } else {
- $scope.model[$scope.options.key] = $filter('date')(new Date(), $scope.options.templateOptions.datepickerPopup);
- }
- $scope.options.initialValue = $scope.model[$scope.options.key];
- $scope.endOpen = true;
- $scope.datepicker = {};
- $scope.datepicker.opened = false;
- $scope.datepicker.open = function ($event) {
- $scope.datepicker.opened = true;
- };
- }]
- });
- //含有周的日期
- formlyConfigProvider.setType({
- name: 'ui-datepickerweek',
- templateUrl: 'assets/views/customform/tpl/ui-datepicker.html',
- extends: 'input',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: {
- ngModelAttrs: getNgModelAttr(datepicker_attr, datepicker_bindings),
- templateOptions: {
- datepickerPopup: 'yyyy-MM-dd HH:mm:ss'
- }
- },
- controller: ['$scope', '$filter', function ($scope, $filter) {
- $scope.mindata = new Date($scope.options.templateOptions.transform($scope.model).getTime() + 5 * 60 * 1000);
- if ($scope.model[$scope.options.key]) {
- } else {
- $scope.model[$scope.options.key] = $filter('date')(new Date(new Date().getTime()), $scope.options.templateOptions.datepickerPopup);
- }
- $scope.options.initialValue = $scope.model[$scope.options.key];
- $scope.endOpen = true;
- $scope.datepicker = {};
- $scope.datepicker.opened = false;
- $scope.datepicker.open = function ($event) {
- $scope.datepicker.opened = true;
- };
- }]
- });
- //时分控件
- formlyConfigProvider.setType({
- name: 'ui-datehourtime',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-datehourtime.html',
- defaultOptions: function (options) {
- return {
- noFormControl: true,
- // validators:{
- // required:{
- // expression:function(viewValue, modelValue){
- // console.log(options)
- // var value = modelValue.getHours().toString()+":"+modelValue.getMinutes().toString()+":"+"59"||viewValue.getHours().toString()+":"+viewValue.getMinutes().toString()+":"+"59"
- // // var value = modelValue.getHours() || viewValue.getHours();
- // return value.length>=1;
- // }
- // }
- // }
- }
- },
- controller: ['$scope', '$log', function ($scope, $log) {
- $scope.hstep = (new Date(Date.parse($scope.model[$scope.options.key]))).getHours();
- $scope.minutes = (new Date(Date.parse($scope.model[$scope.options.key]))).getMinutes();
- $scope.model[$scope.options.key] = new Date(Date.parse($scope.model[$scope.options.key]))
- }]
- });
- //状态追踪
- formlyConfigProvider.setType({
- name: 'ui-followStatus',
- templateUrl: 'assets/views/customform/tpl/ui-followStatus.html',
- controller: ['$scope', 'api_bpm_data', 'Restangular', function ($scope, api_bpm_data, Restangular) {
- setTimeout(function () {
- var pkey = $scope.options.templateOptions.pkey;
- var dataId = $scope.model.id;
- api_bpm_data.fetchData(pkey, dataId).then(function (response) {
- if (response) {
- var myData = Restangular.stripRestangular(response);
- var processInstanceId = myData.data.processInstanceId;
- $scope.options.templateOptions.getData($scope.model, $scope.options.templateOptions.ApiService, processInstanceId).then(function (result) {
- if (result.status == 200) {
- var newData = Restangular.stripRestangular(result);
- $scope.followData = newData.data;
- }
- });
- }
- })
- }, 10);
- }]
- });
- //历史记录
- formlyConfigProvider.setType({
- name: 'ui-history',
- templateUrl: 'assets/views/customform/tpl/ui-history.html',
- controller: ['$scope', 'api_bpm_data', 'Restangular', function ($scope, api_bpm_data, Restangular) {
- setTimeout(function () {
- var pkey = $scope.options.templateOptions.pkey;
- var dataId = $scope.model.id;
- api_bpm_data.fetchData(pkey, dataId).then(function (response) {
- if (response) {
- var myData = Restangular.stripRestangular(response);
- var processInstanceId = myData.data.processInstanceId;
- $scope.options.templateOptions.getData($scope.model, $scope.options.templateOptions.ApiService, processInstanceId).then(function (result) {
- if (result.status == 200) {
- var newData = Restangular.stripRestangular(result);
- var long = newData.data.length - 1;
- $scope.followData = newData.data[long];
- }
- });
- }
- })
- }, 10);
- }]
- });
- //请求人信息显示
- formlyConfigProvider.setType({
- name: "ui-disrequester",
- templateUrl: 'assets/views/customform/tpl/ui-disrequester.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', function ($scope) {
- $scope.options.templateOptions.that = $scope;
- }]
- });
- //退回人信息显示
- formlyConfigProvider.setType({
- name: "ui-returnperson",
- templateUrl: 'assets/views/customform/tpl/ui-returnperson.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', function ($scope) {
- $scope.group = "";
- $scope.role = "";
- if (angular.isDefined($scope.model.handlingPersonnelUser.group) && $scope.model.handlingPersonnelUser.group.length == 1) {
- $scope.group = $scope.model.handlingPersonnelUser.group[0].groupName;
- } else {
- for (var i = 0; i < $scope.model.handlingPersonnelUser.group.length; i++) {
- $scope.group += $scope.model.handlingPersonnelUser.group[i].groupName + ",";
- }
- }
- if (angular.isDefined($scope.model.handlingPersonnelUser.role) && $scope.model.handlingPersonnelUser.role.length == 1) {
- $scope.role = $scope.model.handlingPersonnelUser.role[0].role;
- } else {
- for (var i = 0; i < $scope.model.handlingPersonnelUser.role.length; i++) {
- $scope.role += $scope.model.handlingPersonnelUser.role[i].role + ",";
- }
- }
- $scope.options.templateOptions.that = $scope;
- $scope.options.templateOptions.that = $scope;
- }]
- });
- //指派技术人员
- formlyConfigProvider.setType({
- name: "ui-apiontperson",
- templateUrl: 'assets/views/customform/tpl/ui-apiontperson.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {
- transtlara: function (value, $scope) { }
- }
- };
- },
- controller: ['$scope', 'api_user_data', 'Restangular', function ($scope, api_user_data, Restangular) {
- var filterData = { "idx": 0, "sum": 1000 }
- api_user_data.fetchDataList('group', filterData).then(function (response) {
- if (response.status == 200) {
- $scope.select = {};
- $scope.multipleDemo = {};
- $scope.userdata = {};
- var data = response.list;
- var item = [];
- $scope.multipleDemo = data;
- $scope.multipleDemo;
- }
- })
- $scope.options.templateOptions.onChange = function (id, options, groupdata, $event, model) {
- if (groupdata.option) {
- $scope.model[$scope.options.key] = {};
- var fildate = {
- "idx": 0,
- "sum": 1000,
- "user": {
- "roledata": { "rolecode": model.currentRole },
- "selectType": "1",
- "groupdata": { "id": groupdata.option.id }
- }
- }
- api_user_data.fetchDataList('user', fildate).then(function (response) {
- if (response.status == 200) {
- $scope.userdata = {};
- $scope.userdata = response.list;
- }
- })
- } else {
- $scope.model[$scope.options.key] = { id: groupdata.id.id }
- $scope.options.templateOptions.transtlara($scope.model[$scope.options.key], $scope);
- }
- }
- // }
- }]
- });
- // 请求人选控件
- formlyConfigProvider.setType({
- name: "ui-requesterselect",
- templateUrl: 'assets/views/customform/tpl/ui-requester.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- controller: ['$scope', 'api_user_data', function ($scope, api_user_data) {
- api_user_data.fetchDataList('requester', { "idx": 0, "sum": 10, "requester": { "account": $scope.$root.user.account } }).then(function (response) {
- if (response.status == 200) {
- $scope.model[$scope.options.key] = response.list[0];
- }
- })
- }]
- });
- // 请求人选控件
- // formlyConfigProvider.setType({
- // name: "ui-requesterselect",
- // templateUrl: 'assets/views/customform/tpl/ui-requester.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- // defaultOptions: function(options, $scope) {
- // return {
- // templateOptions: {
- // checkform: function(options) {
- // if (options.model.requester) {
- // options.value(options.model.requester);
- // }
- // },
- // linkage: function(searchtype, opt) {
- // var filterData = {
- // 'requester': {
- // 'searchKey': searchtype,
- // },
- // idx: 0,
- // sum: 10
- // };
- // if (opt.model.requester && opt.model.requester != null && opt.model.requester.requesterTypeDTO) {
- // angular.extend(filterData.requester, { 'requesterTypeDTO': opt.model.requester.requesterTypeDTO })
- // }
- // $scope.searchKey = searchtype;
- // // $scope.nameshow=false;
- // $scope.accountshow = false;
- // if (angular.isDefined(searchtype) && searchtype != '') {
- // $scope.accountshow = true;
- // options.templateOptions.ApiService.fetchDataList('requester', filterData).then(function(response) {
- // var myData = options.templateOptions.Restangular.stripRestangular(response);
- // $scope.myData = myData.list;
- // if (myData.list.length >= 0) {
- // if (myData.list.length == 1) {
- // $scope.accountshow = false;
- // if ($scope.model) {
- // if ($scope.model.place) {
- // $scope.model.place.id = '';
- // }
- // if ($scope.model.area) {
- // $scope.model.area.id = '';
- // }
- // options.model.houseNumber = '';
- // }
- // // $scope.model.place.id = '';
- // // $scope.model.area.id = '';
- // // $scope.model.houseNumber = '';
- // options.value(myData.list[0]);
- // if ($scope.myData[0].placeDTO && $scope.myData[0].placeDTO.id) {
- // $scope.model.place.id = $scope.myData[0].placeDTO.id
- // }
- // if ($scope.myData[0].areaDTO && $scope.myData[0].areaDTO.id) {
- // $scope.model.area.id = $scope.myData[0].areaDTO.id
- // }
- // if ($scope.myData[0].houseNumber) {
- // $scope.model.houseNumber = $scope.myData[0].houseNumber;
- // }
- // } else if (myData.list.length == 0) {
- // $scope.accountshow = false;
- // if ($scope.model) {
- // if ($scope.model.place) {
- // $scope.model.place.id = '';
- // }
- // if ($scope.model.area) {
- // $scope.model.area.id = '';
- // }
- // options.model.houseNumber = '';
- // }
- // if (opt.model.requester && opt.model.requester != null && opt.model.requester.requesterTypeDTO) {
- // // $scope.model[requesterTypeDTO]=opt.model.requester.requesterTypeDTO;
- // options.value({ 'requesterTypeDTO': opt.model.requester.requesterTypeDTO });
- // }
- // } else if (myData.list.length > 1) {
- // $scope.accountshow = true;
- // // var requesternum={};
- // // requesternum['searchKey']=searchtype;
- // // options.value(requesternum);
- // }
- // }
- // });
- // $scope.show = function(filitem) {
- // // $scope.nameshow=false;
- // $scope.accountshow = false;
- // if ($scope.model) {
- // if ($scope.model.place) {
- // $scope.model.place.id = '';
- // }
- // if ($scope.model.area) {
- // $scope.model.area.id = '';
- // }
- // options.model.houseNumber = '';
- // }
- // options.value(filitem);
- // $scope.searchKey = filitem.account;
- // if (filitem.placeDTO && filitem.placeDTO.id) {
- // $scope.model.place.id = filitem.placeDTO.id
- // }
- // if (filitem.areaDTO && filitem.areaDTO.id) {
- // $scope.model.area.id = filitem.areaDTO.id
- // }
- // if (filitem.houseNumber) {
- // $scope.model.houseNumber = filitem.houseNumber;
- // }
- // }
- // } else {
- // $scope.accountshow = false;
- // searchtype = ''
- // }
- // },
- // openModal: function(size, options, modal) {
- // var modelObject = options.value();
- // var searchModal = function(filterSearchData) {
- // var modalInstance = modal.open({
- // templateUrl: 'assets/views/customform/tpl/checktable-modal-content.html',
- // controller: function($scope, i18nService, $modalInstance, items, title, Restangular, APIService, language, searchData, api_bpm_data) {
- // $scope.langs = i18nService.getAllLangs();
- // $scope.lang = 'zh-cn';
- // i18nService.setCurrentLang($scope.lang);
- // $scope.gridOptions = {};
- // $scope.gridOptions.data = 'myData';
- // $scope.gridOptions.enableColumnResizing = true;
- // $scope.gridOptions.enableFiltering = true;
- // $scope.gridOptions.enableGridMenu = false;
- // $scope.gridOptions.enableRowSelection = true;
- // $scope.gridOptions.showGridFooter = true;
- // $scope.gridOptions.showColumnFooter = true;
- // $scope.gridOptions.fastWatch = true;
- // $scope.gridOptions.useExternalFiltering = true;
- // $scope.gridOptions.useExternalPagination = true;
- // $scope.gridOptions.paginationPageSizes = [10];
- // $scope.gridOptions.paginationPageSize = 10;
- // $scope.gridOptions.multiSelect = false;
- // $scope.gridOptions.rowIdentity = function(row) {
- // return row.id;
- // };
- // $scope.gridOptions.getRowIdentity = function(row) {
- // return row.id;
- // };
- // $scope.gridOptions.columnDefs = [
- // { name: 'account', displayName: '一卡通号', width: 140 },
- // { name: 'studentNo', displayName: '学工号', width: 140 },
- // { name: 'name', displayName: '姓名', width: 100 },
- // { name: 'gender', displayName: '性别', width: 80, enableFiltering: false },
- // { name: 'mphone', displayName: '电话', width: 100, enableFiltering: false },
- // // { name:'email', displayName:'邮件', width:100},
- // { name: 'areaDTO.area', displayName: '区域', width: 100, enableFiltering: false },
- // { name: 'placeDTO.place', displayName: '地点', width: 100, enableFiltering: false }
- // ];
- // $scope.gridOptions.onRegisterApi = function(gridApi) {
- // $scope.gridApi = gridApi;
- // // var filtersData = $scope.memoryfilterData;
- // // filtersData.idx = newPage - 1;
- // // filtersData.sum = pageSize;
- // gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
- // var filtersData = $scope.memoryfilterData;
- // filtersData.idx = newPage - 1;
- // filtersData.sum = pageSize;
- // $scope.loadData(filtersData);
- // });
- // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
- // // if(angular.isDefined(data.entity.account)&&data.entity.account.length==6){
- // $scope.selected.item = data.entity;
- // // }else{alert ("请求人工号格式不对,账号应为6位数,请重新填写!")}
- // });
- // gridApi.core.on.filterChanged($scope, function() {
- // var grid = this.grid;
- // var filtersData = {
- // idx: 0,
- // sum: 10
- // };
- // angular.forEach(grid.columns, function(item) {
- // if (item.enableFiltering) {
- // if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- // if (angular.isUndefined(filtersData['requester'])) {
- // filtersData['requester'] = {};
- // }
- // filtersData['requester'][item.field] = item.filters[0].term;
- // }
- // }
- // });
- // $scope.memoryfilterData = filtersData;
- // $scope.loadData(filtersData);
- // });
- // };
- // $scope.memoryfilterData = defaultFilterData = {
- // "idx": 0,
- // "sum": 10
- // };
- // $scope.loadData = function(filterData) {
- // items.fetchItems(filterData, APIService).then(function(data) {
- // var myData = Restangular.stripRestangular(data);
- // $scope.gridOptions.totalItems = myData.totalNum;
- // $scope.myData = myData.list;
- // });
- // };
- // $scope.title = title;
- // if (searchData) {
- // $scope.loadData(searchData);
- // } else {
- // $scope.loadData({
- // idx: 0,
- // sum: 10
- // });
- // }
- // $scope.selected = {
- // item: {}
- // };
- // $scope.ok = function() {
- // $modalInstance.close($scope.selected.item);
- // };
- // $scope.cancel = function() {
- // $modalInstance.dismiss('cancel');
- // };
- // },
- // size: size,
- // resolve: {
- // items: function() {
- // return {
- // fetchItems: function(filterData, APIService) {
- // filterData = filterData || {};
- // if (angular.isUndefined(filterData.idx) || filterData.idx == null) {
- // filterData = {
- // idx: 0,
- // sum: 10
- // };
- // }
- // return options.templateOptions.fetchItems(filterData, APIService);
- // }
- // };
- // },
- // title: function() {
- // return options.templateOptions.modalTitle;
- // },
- // Restangular: function() {
- // return options.templateOptions.Restangular;
- // },
- // APIService: function() {
- // return options.templateOptions.ApiService;
- // },
- // language: function() {
- // return options.templateOptions.language;
- // },
- // searchData: function() {
- // return filterSearchData;
- // }
- // }
- // });
- // modalInstance.result.then(function(selectedItem) {
- // if (options.model) {
- // if (options.model.place) {
- // options.model.place.id = '';
- // }
- // if (options.model.area) {
- // options.model.area.id = '';
- // }
- // options.model.houseNumber = '';
- // }
- // options.value(selectedItem);
- // $scope.searchKey = selectedItem.account;
- // if (selectedItem.placeDTO && selectedItem.placeDTO.id) {
- // options.model.place.id = selectedItem.placeDTO.id
- // }
- // if (selectedItem.areaDTO && selectedItem.areaDTO.id) {
- // options.model.area.id = selectedItem.areaDTO.id
- // }
- // if (selectedItem.houseNumber) {
- // options.model.houseNumber = selectedItem.houseNumber;
- // }
- // if (options.templateOptions.callback && angular.isFunction(options.templateOptions.callback)) {
- // options.templateOptions.callback(selectedItem, options);
- // }
- // }, function() {
- // //console.log('Modal dismissed at: ' + new Date());
- // });
- // }
- // searchModal();
- // // }
- // },
- // addRequeter: function(size, options, modal) {
- // var modalInstance = modal.open({
- // templateUrl: 'assets/views/customform/tpl/modal-add-requester.html',
- // controller: function($scope, $modalInstance, items, SweetAlert, title, Restangular, APIService, UserService, api_user_data) {
- // $scope.title = "新增请求人";
- // $scope.requester = {
- // };
- // api_user_data.fetchDataList('area', { idx: 0, sum: 1000 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.areas = response.list;
- // }
- // })
- // api_user_data.fetchDataList('requesterType', { idx: 0, sum: 100 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.networktypes = response.list;
- // }
- // })
- // $scope.onChange = function(item) {
- // // console.log(item)
- // $scope.requester.placeDTO = {};
- // api_user_data.fetchDataList('place', { place: { areaId: item.id }, idx: 0, sum: 1000 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.places = response.list;
- // }
- // })
- // }
- // $scope.refreshDepts = function(key) {
- // var filterData = {
- // 'idx': 0,
- // 'sum': 5,
- // 'dept': {
- // 'name': key
- // }
- // };
- // UserService.fetchDataList('department', filterData).then(function(response) {
- // if (response.status == 200) {
- // $scope.depts = response.list;
- // }
- // })
- // }
- // $scope.ok = function() {
- // if (angular.isUndefined($scope.requester.name) || $scope.requester.name == null || $scope.requester.name == "") {
- // // SweetAlert.swal("请求人姓名未填!", "请填写请求人姓名", "error");
- // $ionicPopup.alert({
- // title: '请求人姓名未填!',
- // });
- // } else if (angular.isUndefined($scope.requester.account) || $scope.requester.account == null || $scope.requester.account == "") {
- // // SweetAlert.swal("请求人一卡通号未填!", "请填写请求人一卡通号", "error");
- // $ionicPopup.alert({
- // title: '请求人一卡通号未填!',
- // });
- // } else if (angular.isUndefined($scope.requester.requesterTypeDTO) || $scope.requester.requesterTypeDTO == null || $scope.requester.requesterTypeDTO == "") {
- // // SweetAlert.swal("请求人职务!", "请填写请求人职务", "error");
- // $ionicPopup.alert({
- // title: '请求人职务未填!',
- // });
- // } else {
- // $modalInstance.close($scope.requester);
- // }
- // };
- // $scope.cancel = function() {
- // $modalInstance.dismiss('cancel');
- // };
- // },
- // size: size,
- // resolve: {
- // items: function() {
- // return {
- // fetchItems: function(filterData, APIService) {
- // filterData = filterData || {};
- // if (!filterData.idx) {
- // filterData = {
- // idx: 0,
- // sum: 10
- // };
- // }
- // return options.templateOptions.fetchItems(filterData, APIService);
- // }
- // };
- // },
- // title: function() {
- // return options.templateOptions.modalTitle;
- // },
- // Restangular: function() {
- // return options.templateOptions.Restangular;
- // },
- // APIService: function() {
- // return options.templateOptions.ApiService;
- // },
- // UserService: function() {
- // return options.templateOptions.UserService;
- // }
- // }
- // });
- // modalInstance.result.then(function(selectedItem) {
- // if (selectedItem) {
- // var data = {
- // 'requester': selectedItem
- // };
- // $scope.searchKey = selectedItem.account;
- // options.templateOptions.UserService.addData('requester', data).then(function(response) {
- // if (response.status == 200) {
- // if (options.model) {
- // if (options.model.place) {
- // options.model.place.id = '';
- // }
- // if (options.model.area) {
- // options.model.area.id = '';
- // }
- // options.model.houseNumber = '';
- // }
- // options.value(response.data);
- // if (selectedItem.placeDTO && selectedItem.placeDTO.id) {
- // options.model.place.id = selectedItem.placeDTO.id
- // }
- // if (selectedItem.areaDTO && selectedItem.areaDTO.id) {
- // options.model.area.id = selectedItem.areaDTO.id
- // }
- // if (selectedItem.houseNumber) {
- // options.model.houseNumber = selectedItem.houseNumber;
- // }
- // }
- // })
- // }
- // }, function() {
- // //console.log('Modal dismissed at: ' + new Date());
- // });
- // },
- // changeRequeter: function(size, options, modal) {
- // var modalInstance = modal.open({
- // templateUrl: 'assets/views/customform/tpl/modal-change-requester.html',
- // controller: function($scope, $modalInstance, items, SweetAlert, title, Restangular, APIService, UserService, api_user_data) {
- // $scope.title = "修改请求人";
- // $scope.requester = {
- // id: options.model.requester.id,
- // account: options.model.requester.account,
- // name: options.model.requester.name,
- // gender: options.model.requester.gender,
- // email: options.model.requester.email,
- // deptName: options.model.requester.deptName,
- // mphone: options.model.requester.mphone,
- // telephone: options.model.requester.telephone,
- // studentNo: options.model.requester.studentNo,
- // areaDTO: options.model.requester.areaDTO,
- // placeDTO: options.model.requester.placeDTO,
- // requesterTypeDTO: options.model.requester.requesterTypeDTO
- // };
- // api_user_data.fetchDataList('area', { idx: 0, sum: 1000 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.areas = response.list;
- // }
- // })
- // api_user_data.fetchDataList('requesterType', { idx: 0, sum: 100 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.networktypes = response.list;
- // }
- // })
- // if ($scope.requester.areaDTO && $scope.requester.areaDTO.id && $scope.requester.areaDTO.id != "") {
- // api_user_data.fetchDataList('place', { place: { areaId: $scope.requester.areaDTO.id }, idx: 0, sum: 1000 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.places = response.list;
- // }
- // })
- // }
- // $scope.onChange = function(item) {
- // // console.log(item)
- // $scope.requester.placeDTO = {};
- // api_user_data.fetchDataList('place', { place: { areaId: item.id }, idx: 0, sum: 1000 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.places = response.list;
- // }
- // })
- // }
- // $scope.refreshDepts = function(key) {
- // var filterData = {
- // 'idx': 0,
- // 'sum': 5,
- // 'dept': {
- // 'name': key
- // }
- // };
- // UserService.fetchDataList('department', filterData).then(function(response) {
- // if (response.status == 200) {
- // $scope.depts = response.list;
- // }
- // })
- // }
- // $scope.ok = function() {
- // if ($scope.requester.account == "" || $scope.requester.name == "") {
- // // SweetAlert.swal("请求人姓名或一卡通号未填!", "请补全请求人信息", "error");
- // $ionicPopup.alert({
- // title: '请求人姓名或一卡通号未填!',
- // });
- // } else {
- // $modalInstance.close($scope.requester);
- // }
- // };
- // $scope.cancel = function() {
- // $modalInstance.dismiss('cancel');
- // };
- // },
- // size: size,
- // resolve: {
- // items: function() {
- // return {
- // fetchItems: function(filterData, APIService) {
- // filterData = filterData || {};
- // if (!filterData.idx) {
- // filterData = {
- // idx: 0,
- // sum: 10
- // };
- // }
- // return options.templateOptions.fetchItems(filterData, APIService);
- // }
- // };
- // },
- // title: function() {
- // return options.templateOptions.modalTitle;
- // },
- // Restangular: function() {
- // return options.templateOptions.Restangular;
- // },
- // APIService: function() {
- // return options.templateOptions.ApiService;
- // },
- // UserService: function() {
- // return options.templateOptions.UserService;
- // }
- // }
- // });
- // modalInstance.result.then(function(selectedItem) {
- // if (selectedItem) {
- // var data = {
- // 'requester': selectedItem
- // };
- // options.templateOptions.UserService.addData('requester', data).then(function(response) {
- // if (response.status == 200) {
- // options.value(response.data);
- // // SweetAlert.swal("修改成功!", "", "error");
- // } else {
- // // SweetAlert.swal("修改失败!", "请重试", "error");
- // }
- // })
- // // }
- // }
- // }, function() {
- // //console.log('Modal dismissed at: ' + new Date());
- // });
- // }
- // }
- // };
- // },
- // controller: ['$scope', function($scope) {
- // $scope.options.templateOptions.ApiService.fetchDataList('requesterType', { idx: 0, sum: 100 }).then(function(response) {
- // if (response.status == 200) {
- // $scope.networktypes = response.list;
- // } else {
- // // SweetAlert.swal("系统错误!", "请刷新重试", "error");
- // $ionicPopup.alert({
- // title: '系统错误!',
- // });
- // }
- // })
- // // $scope.options.templateOptions.that = $scope;
- // }]
- // });
- //处理人信息
- formlyConfigProvider.setType({
- name: "ui-userinformation",
- templateUrl: 'assets/views/customform/tpl/ui-userinformation.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', function ($scope) {
- $scope.group = "";
- $scope.role = "";
- // if (angular.isDefined($scope.model.handlingPersonnelUser.group) && $scope.model.handlingPersonnelUser.group.length == 1) {
- // $scope.group = $scope.model.handlingPersonnelUser.group[0].groupName;
- // } else {
- // for (var i = 0; i < $scope.model.handlingPersonnelUser.group.length; i++) {
- // $scope.group += $scope.model.handlingPersonnelUser.group[i].groupName + ",";
- // }
- // }
- // if (angular.isDefined($scope.model.handlingPersonnelUser.role) && $scope.model.handlingPersonnelUser.role.length == 1) {
- // $scope.role = $scope.model.handlingPersonnelUser.role[0].role;
- // } else {
- // for (var i = 0; i < $scope.model.handlingPersonnelUser.role.length; i++) {
- // $scope.role += $scope.model.handlingPersonnelUser.role[i].role + ",";
- // }
- // }
- $scope.options.templateOptions.that = $scope;
- }]
- });
- //处理界面处理人信息
- formlyConfigProvider.setType({
- name: "ui-handler",
- templateUrl: 'assets/views/customform/tpl/ui-handler.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', function ($scope) {
- $scope.group = "";
- // $scope.role="";
- if (angular.isDefined($scope.model.handlingPersonnelUser.group) && $scope.model.handlingPersonnelUser.group.length == 1) {
- $scope.group = $scope.model.handlingPersonnelUser.group[0].groupName;
- } else {
- for (var i = 0; i < $scope.model.handlingPersonnelUser.group.length; i++) {
- $scope.group += $scope.model.handlingPersonnelUser.group[i].groupName + ",";
- }
- }
- // if(angular.isDefined($scope.model.handlingPersonnelUser.role) &&$scope.model.handlingPersonnelUser.role.length==1){
- // $scope.role=$scope.model.handlingPersonnelUser.role[0].role;
- // }else{
- // for(var i=0;i<$scope.model.handlingPersonnelUser.role.length;i++){
- // $scope.role += $scope.model.handlingPersonnelUser.role[i].role +",";
- // }
- // }
- $scope.options.templateOptions.that = $scope;
- }]
- });
- //关闭界面处理人信息
- formlyConfigProvider.setType({
- name: "ui-closehandler",
- templateUrl: 'assets/views/customform/tpl/ui-closehandler.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {}
- };
- },
- controller: ['$scope', '$rootScope', 'api_text', function ($scope, $rootScope, api_text) {
- $scope.dialout = function (teleno) {
- var gid = "@0"
- var telephone = '9' + teleno
- api_text.dialout($rootScope.takes, gid, telephone).then(function (data) {
- if (data.errno == 0) {
- $rootScope.status = 6;
- }
- })
- }
- $scope.options.templateOptions.that = $scope;
- }]
- });
- // formlyConfigProvider.setType({
- // name: "ui-closehandler",
- // templateUrl: 'assets/views/customform/tpl/ui-closehandler.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- // defaultOptions:function(options){
- // return {
- // templateOptions: {
- // }
- // };
- // },
- // controller:['$scope','$rootScope','SweetAlert','api_text', function($scope,$rootScope,SweetAlert,api_text){
- // $scope.group="";
- // // $scope.role="";
- // if(angular.isDefined($scope.model.handlingPersonnelUser.group) &&$scope.model.handlingPersonnelUser.group.length==1){
- // $scope.group=$scope.model.handlingPersonnelUser.group[0].groupName;
- // }else{
- // for(var i=0;i<$scope.model.handlingPersonnelUser.group.length;i++){
- // $scope.group += $scope.model.handlingPersonnelUser.group[i].groupName +",";
- // }
- // }
- // // if(angular.isDefined($scope.model.handlingPersonnelUser.role) &&$scope.model.handlingPersonnelUser.role.length==1){
- // // $scope.role=$scope.model.handlingPersonnelUser.role[0].role;
- // // }else{
- // // for(var i=0;i<$scope.model.handlingPersonnelUser.role.length;i++){
- // // $scope.role += $scope.model.handlingPersonnelUser.role[i].role +",";
- // // }
- // // }
- // $scope.options.templateOptions.that = $scope;
- // $scope.dialout = function(teleno){
- // api_text.callout($rootScope.takes,teleno).then(function(data){
- // if(data.errno==0){
- // SweetAlert.swal({
- // title: "呼叫成功",
- // text: "呼叫中心呼叫成功!",
- // type: "success"
- // });
- // }else{SweetAlert.swal({
- // title: "呼叫失败",
- // text: "请重新呼叫!",
- // type: "error"
- // });
- // }
- // })
- // }
- // }]
- // });
- //用户单选控件
- // formlyConfigProvider.setType({
- // name: "ui-userselect",
- // templateUrl: 'assets/views/customform/tpl/ui-userselect.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- // defaultOptions: function(options) {
- // return {
- // templateOptions: {
- // openModal: function(size, options, modal) {
- // var modalInstance = modal.open({
- // templateUrl: 'assets/views/customform/tpl/checktable-modal-content.html',
- // controller: function($scope, i18nService, $modalInstance, items, title, Restangular, APIService, onDataCallback, parentScope) {
- // $scope.langs = i18nService.getAllLangs();
- // $scope.lang = 'zh-cn';
- // i18nService.setCurrentLang($scope.lang);
- // $scope.gridOptions = {};
- // $scope.gridOptions.data = 'myData';
- // $scope.gridOptions.enableColumnResizing = true;
- // $scope.gridOptions.enableFiltering = true;
- // $scope.gridOptions.enableGridMenu = true;
- // $scope.gridOptions.enableRowSelection = true;
- // $scope.gridOptions.showGridFooter = true;
- // $scope.gridOptions.showColumnFooter = true;
- // $scope.gridOptions.fastWatch = true;
- // $scope.gridOptions.useExternalFiltering = true;
- // $scope.gridOptions.useExternalPagination = true;
- // $scope.gridOptions.paginationPageSizes = [10];
- // $scope.gridOptions.paginationPageSize = 10;
- // $scope.gridOptions.multiSelect = false;
- // $scope.gridOptions.rowIdentity = function(row) {
- // return row.id;
- // };
- // $scope.gridOptions.getRowIdentity = function(row) {
- // return row.id;
- // };
- // //{"id":1,"phone":"15071189091","name":"管理员","gender":"男","flag":1,"email":"asda@qq.com","account":"000001","group":[{"id":3,"groupName":"运行监控科"}]}
- // $scope.gridOptions.columnDefs = [
- // // { name:'id', width:80, enableFiltering:false},
- // { name: 'account', displayName: '学工号', width: 120 },
- // { name: 'name', displayName: '名称', width: 100 },
- // { name: 'gender', displayName: '性别', width: 80, enableFiltering: false },
- // { name: 'phone', displayName: '电话', width: 100, enableFiltering: false },
- // { name: 'email', displayName: '邮件', width: 120, enableFiltering: false },
- // { name: 'dept.dept', displayName: '部门', width: 100, enableFiltering: false },
- // { name: 'role[0].role', displayName: '角色', width: 100, enableFiltering: false },
- // { name: 'taskCount', displayName: '处理中事件数', width: 100, enableFiltering: false }
- // ];
- // $scope.gridOptions.onRegisterApi = function(gridApi) {
- // $scope.gridApi = gridApi;
- // gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
- // var filtersData = $scope.memoryfilterData;
- // filtersData.idx = newPage - 1;
- // filtersData.sum = pageSize;
- // $scope.loadData(filtersData);
- // //console.log(pageSize);
- // // $scope.loadData({"idx":newPage-1,"sum":pageSize});
- // });
- // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
- // $scope.selected.item = data.entity;
- // //console.log(data);
- // });
- // gridApi.core.on.filterChanged($scope, function() {
- // var grid = this.grid;
- // var filtersData = {
- // idx: 0,
- // sum: 10,
- // "user": { "roledata": { "rolecode": options.model.currentRole }, "selectType": "1" }
- // };
- // angular.forEach(grid.columns, function(item) {
- // if (item.enableFiltering) {
- // console.log("item.filters[0]=" + JSON.stringify(item.filters));
- // if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- // if (angular.isUndefined(filtersData['user'])) {
- // filtersData['user'] = {};
- // }
- // filtersData['user'][item.field] = item.filters[0].term;
- // }
- // }
- // });
- // $scope.memoryfilterData = filtersData;
- // $scope.loadData(filtersData);
- // });
- // };
- // if (!options.model) {
- // var mouse = { "model": { "currentRole": "" } };
- // angular.extend(options, mouse);
- // }
- // $scope.memoryfilterData = {
- // "idx": 0,
- // "sum": 10,
- // "user": { "roledata": { "rolecode": options.model.currentRole }, "selectType": "1" }
- // }
- // $scope.loadData = function(filterData) {
- // console.log("filtersData=111" + JSON.stringify(filterData))
- // items.fetchItems(filterData, APIService).then(function(data) {
- // var myData = Restangular.stripRestangular(data);
- // $scope.gridOptions.totalItems = myData.totalNum;
- // $scope.myData = myData.list;
- // });
- // };
- // $scope.title = title;
- // $scope.loadData({
- // idx: 0,
- // sum: 10,
- // "user": { "roledata": { "rolecode": options.model.currentRole }, "selectType": "1" }
- // });
- // $scope.selected = {
- // item: {}
- // };
- // $scope.ok = function() {
- // // if(onDataCallback&&angular.isFunction(onDataCallback)){
- // // onDataCallback($scope.selected.item, parentScope);
- // // }
- // $modalInstance.close($scope.selected.item);
- // };
- // $scope.cancel = function() {
- // $modalInstance.dismiss('cancel');
- // };
- // },
- // size: size,
- // resolve: {
- // items: function() {
- // return {
- // fetchItems: function(filterData, APIService) {
- // filterData = filterData || {};
- // console.log(options)
- // if (angular.isDefined(filterData.idx) && filterData.idx == null) {
- // filterData = {
- // idx: 0,
- // sum: 10,
- // "user": { "roledata": { "rolecode": options.model.incident.currentRole }, "selectType": "1" }
- // };
- // }
- // // function (filterData, APIService){filterData.user.roledata.rolecode='question investigation';return APIService.fetchDataList('user',filterData);}
- // return options.templateOptions.fetchItems(filterData, APIService);
- // }
- // };
- // },
- // title: function() {
- // return options.templateOptions.modalTitle;
- // },
- // Restangular: function() {
- // return options.templateOptions.Restangular;
- // },
- // APIService: function() {
- // return options.templateOptions.ApiService;
- // },
- // onDataCallback: function() {
- // return options.templateOptions.callback;
- // },
- // parentScope: function() {
- // return options.templateOptions.that;
- // }
- // }
- // });
- // modalInstance.result.then(function(selectedItem) {
- // // console.log(selectedItem);
- // options.value(selectedItem);
- // if (options.templateOptions.callback && angular.isFunction(options.templateOptions.callback)) {
- // options.templateOptions.callback(selectedItem, options.templateOptions.that);
- // }
- // }, function() {
- // //console.log('Modal dismissed at: ' + new Date());
- // });
- // }
- // }
- // };
- // },
- // controller: ['$scope', function($scope) {
- // $scope.model[$scope.options.key] = [];
- // $scope.options.templateOptions.that = $scope;
- // }]
- // });
- //处理人控件 10#
- formlyConfigProvider.setType({
- name: "ui-userselect",
- templateUrl: 'assets/views/customform/tpl/ui-userselect.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- // defaultOptions: function(options) {
- // return {
- // templateOptions: {
- // refresh: function(filterData, APIService) {
- // return APIService.fetchDataList('user', filterData);
- // }
- // }
- // };
- // },
- controller: ['$scope', function ($scope) {
- // $scope.model[$scope.options.key] = [];
- // var filterData = {
- // idx: 0,
- // sum: 10,
- // "user": { "roledata": { "rolecode": $scope.model.currentRole }, "selectType": "1" }
- // };
- // $scope.options.templateOptions.refresh(filterData, $scope.options.templateOptions.ApiService).then(function(data) {
- // var myData = data.list;
- // $scope.myData = myData;
- // // $scope.model[$scope.options.key] = myData;
- // // $scope.options.value(myData);
- // // $scope.options.formControl.$validate();
- // });
- // $scope.getItem = function(item) {
- // $scope.model[$scope.options.key] = item;
- // $scope.options.value(item);
- // $scope.pl = item.name;
- // if ($scope.model.closecode) {
- // delete $scope.model.closecode
- // };
- // if ($scope.model.degree) {
- // delete $scope.model.degree
- // };
- // }
- // $scope.addlist = function() {
- // $scope.editId = 6;
- // $scope.model[$scope.options.key].push("");
- // }
- // $scope.editId = -1;
- // $scope.setEditId = function(pid, usersdata) {
- // $scope.usersdata = {};
- // $scope.editId = pid;
- // angular.extend($scope.usersdata, usersdata)
- // };
- // $scope.savelist = function(usersdata, pid) {
- // // console.log($scope.model[$scope.options.key])
- // for (i = 0; i < $scope.model[$scope.options.key].length; i++) {
- // if (usersdata.account == $scope.model[$scope.options.key][i].account) {
- // $scope.model[$scope.options.key][i] = $scope.usersdata;
- // }
- // }
- // $scope.editId = pid;
- // };
- // $scope.remove = function(itemId) {
- // angular.forEach($scope.model[$scope.options.key], function(entry, index) {
- // if (entry.id == itemId) {
- // $scope.model[$scope.options.key].splice(index, 1);
- // console.log($scope.options.formControl)
- // $scope.options.formControl.$validate();
- // } else {
- // }
- // });
- // }
- // if ($scope.options.templateOptions.transform) {
- // $scope.options.templateOptions.onChange($scope.model.id, $scope.options, $scope);
- // }
- // if (angular.isFunction($scope.options.templateOptions.translate)) {
- // $scope.model[$scope.options.key] = $scope.options.templateOptions.translate($scope.options, $rootScope);
- // }
- // $scope.$select.disabled = $scope.to.readOnly;
- $scope.to['onChange'] = function (item, opts, ts, event, model) {
- $scope.model[$scope.options.key] = ts.$select.selected;
- }
- }]
- });
- //可编辑列表控件
- // formlyConfigProvider.setType({
- // name: "ui-multiuserselectchange",
- // templateUrl: 'assets/views/customform/tpl/ui-multiuserselectchange.html',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- // defaultOptions:function(options){
- // return {
- // templateOptions: {
- // refresh:function(filterData,APIService){
- // return APIService.fetchDataList('user',filterData);
- // }
- // },
- // validators:{
- // required:{
- // expression:function(viewValue, modelValue){
- // var value = modelValue || viewValue;
- // return value.length>=1;
- // }
- // }
- // }
- // };
- // },
- // controller:['$scope','$filter', function($scope,$filter){
- // $scope.model[$scope.options.key] = [];
- // var filterData = {
- // idx:0,
- // sum:10,
- // "user":{"roledata":{"rolecode":$scope.model.currentRole},"selectType":"1"}
- // };
- // $scope.options.templateOptions.refresh(filterData, $scope.options.templateOptions.ApiService).then(function(data){
- // var myData = data.list;
- // $scope.model[$scope.options.key]=myData;
- // $scope.options.value(myData);
- // $scope.options.formControl.$validate();
- // });
- // $scope.addlist = function(){
- // $scope.editId =6;
- // $scope.model[$scope.options.key].push("");
- // }
- // // $scope.tableParams = new ngTableParams({
- // // page: 1,
- // // count: 10
- // // }, {
- // // total: data.length,
- // // getData: function ($defer, params) {
- // // var orderedData = params.sorting() ? $filter('orderBy')(data, params.orderBy()) : data;
- // // $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
- // // }
- // // });
- // $scope.editId = -1;
- // $scope.setEditId = function (pid,usersdata) {
- // $scope.usersdata={};
- // $scope.editId = pid;
- // angular.extend($scope.usersdata,usersdata)
- // };
- // $scope.savelist = function (usersdata,pid) {
- // // console.log($scope.model[$scope.options.key])
- // for(i=0;i<$scope.model[$scope.options.key].length;i++){
- // if(usersdata.account==$scope.model[$scope.options.key][i].account){
- // $scope.model[$scope.options.key][i]=$scope.usersdata;
- // }
- // }
- // $scope.editId = pid;
- // };
- // $scope.remove = function(itemId){
- // angular.forEach($scope.model[$scope.options.key], function(entry,index){
- // if(entry.id == itemId){
- // $scope.model[$scope.options.key].splice(index,1);
- // console.log($scope.options.formControl)
- // $scope.options.formControl.$validate();
- // }else{
- // }
- // });
- // }
- // }]
- // });
- formlyConfigProvider.setType({
- name: "ui-multiuserselectchange",
- templateUrl: 'assets/views/customform/tpl/ui-multiuserselectchange.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {
- // refresh:function(filterData,APIService){
- // return APIService.fetchDataList('user',filterData);
- // }
- },
- validators: {
- required: {
- expression: function (viewValue, modelValue) {
- var value = modelValue || viewValue;
- return value.length >= 1;
- }
- }
- }
- };
- },
- controller: ['$scope', '$filter', function ($scope, $filter) {
- $scope.model[$scope.options.key] = [];
- var filterData = {
- idx: 0,
- sum: 10,
- "user": { "roledata": { "rolecode": $scope.model.currentRole }, "selectType": "1" }
- };
- $scope.options.templateOptions.refresh(filterData, $scope.options.templateOptions.ApiService).then(function (data) {
- var myData = data.list;
- $scope.model[$scope.options.key] = myData;
- $scope.options.value(myData);
- $scope.options.formControl.$validate();
- });
- $scope.addlist = function () {
- $scope.editId = 6;
- $scope.model[$scope.options.key].push("");
- }
- $scope.editId = -1;
- $scope.setEditId = function (pid, usersdata) {
- $scope.usersdata = {};
- $scope.editId = pid;
- angular.extend($scope.usersdata, usersdata)
- };
- $scope.savelist = function (usersdata, pid) {
- // console.log($scope.model[$scope.options.key])
- for (i = 0; i < $scope.model[$scope.options.key].length; i++) {
- if (usersdata.account == $scope.model[$scope.options.key][i].account) {
- $scope.model[$scope.options.key][i] = $scope.usersdata;
- }
- }
- $scope.editId = pid;
- };
- $scope.remove = function (itemId) {
- angular.forEach($scope.model[$scope.options.key], function (entry, index) {
- if (entry.id == itemId) {
- $scope.model[$scope.options.key].splice(index, 1);
- console.log($scope.options.formControl)
- $scope.options.formControl.$validate();
- } else {
- }
- });
- }
- }]
- });
- //用户多选控件
- formlyConfigProvider.setType({
- name: "ui-multiuserselect",
- templateUrl: 'assets/views/customform/tpl/ui-multiuserselect.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function (options) {
- return {
- templateOptions: {
- openModal: function (size, options, modal, model) {
- var modalInstance = modal.open({
- templateUrl: 'assets/views/customform/tpl/checktable-modal-content.html',
- controller: function ($scope, $modalInstance, i18nService, $timeout, items, title, Restangular, APIService, selectItems) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.enableColumnResizing = true;
- $scope.gridOptions.enableFiltering = true;
- $scope.gridOptions.enableGridMenu = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = true;
- $scope.gridOptions.fastWatch = true;
- $scope.gridOptions.useExternalFiltering = true;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
- $scope.gridOptions.rowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function (row) {
- return row.id;
- };
- //{"id":1,"phone":"15071189091","name":"管理员","gender":"男","flag":1,"email":"asda@qq.com","account":"000001","group":[{"id":3,"groupName":"运行监控科"}]}
- $scope.gridOptions.columnDefs = [
- // { name:'id', width:80, enableFiltering:false},
- { name: 'account', displayName: '账号', width: 140 },
- { name: 'name', displayName: '名称', width: 100 },
- { name: 'gender', displayName: '性别', width: 140, enableFiltering: false },
- { name: 'phone', displayName: '电话', width: 100, enableFiltering: false },
- { name: 'email', displayName: '邮件', width: 100, enableFiltering: false },
- { name: 'dept.dept', displayName: '部门', width: 100, enableFiltering: false },
- { name: 'group[0].groupName', displayName: '职位', width: 100, enableFiltering: false }
- ];
- $scope.selected = {
- items: selectItems
- };
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- $scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- var filtersData = $scope.memoryfilterData;
- filtersData.idx = newPage - 1;
- filtersData.sum = pageSize;
- $scope.loadData(filtersData);
- // $scope.loadData({"idx":newPage-1,"sum":pageSize});
- });
- gridApi.selection.on.rowSelectionChanged($scope, function (scope) {
- var j = 0;
- for (var i = 0; i <= scope.grid.appScope.selected.items.length; i++) {
- if (scope.grid.appScope.selected.items[i] == scope.entity) {
- j++;
- break;
- }
- }
- if (j == 1) {
- scope.grid.appScope.selected.items.splice(i, 1);
- } else {
- scope.grid.appScope.selected.items.push(scope.entity)
- for (var i = 0; i < scope.grid.appScope.selected.items.length; i++) {
- for (var z = 0; z < scope.grid.appScope.selected.items.length; z++) {
- // console.log("$scope.selected.items="+JSON.stringify($scope.selected.items));
- // console.log("scope.grid.appScope.selected.items="+JSON.stringify(scope.grid.appScope.selected.items))
- if (angular.isDefined(scope.grid.appScope.selected.items) && scope.grid.appScope.selected.items[i].id == scope.grid.appScope.selected.items[z].id && i != z) {
- scope.grid.appScope.selected.items.splice(i, 1);
- }
- }
- }
- }
- });
- // gridApi.selection.on.rowSelectionChanged($scope, function($scope, rows){
- // $scope.grid.appScope.selected.items.push($scope.entity);
- // });
- gridApi.core.on.filterChanged($scope, function () {
- var grid = this.grid;
- var filtersData = {
- idx: 0,
- sum: 10,
- "user": { "roledata": { "rolecode": options.model.currentRole }, "selectType": "1" }
- };
- angular.forEach(grid.columns, function (item) {
- if (item.enableFiltering) {
- //console.log("filtersData="+JSON.stringify(filtersData))
- if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- if (angular.isUndefined(filtersData['user'])) {
- filtersData['user'] = {};
- }
- filtersData['user'][item.field] = item.filters[0].term;
- }
- }
- });
- $scope.memoryfilterData = filtersData;
- $scope.loadData(filtersData);
- });
- };
- if (!options.model) {
- var mouse = { "model": { "currentRole": "" } };
- angular.extend(options, mouse);
- }
- $scope.memoryfilterData = {
- "idx": 0,
- "sum": 10,
- "user": { "roledata": { "rolecode": options.model.currentRole }, "selectType": "1" }
- }
- $scope.loadData = function (filterData) {
- // console.log(" filtersData['user'][item.field]=111"+JSON.stringify(filterData));
- items.fetchItems(filterData, APIService).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions.totalItems = myData.totalNum;
- $scope.myData = myData.list;
- //console.log($scope.gridOptions.pagination.getTotalPages());
- // if($scope.selected.items){
- // angular.forEach($scope.selected.items,function(selectItem){
- // $scope.gridApi.selection.selectRow(selectItem);
- // });
- // }
- });
- };
- $scope.title = title;
- $scope.loadData({
- idx: 0,
- sum: 10,
- "user": { "roledata": { "rolecode": options.model.currentRole }, "selectType": "1" }
- });
- // $timeout(function(){
- // if($scope.selected.items){
- // angular.forEach($scope.selected.items,function(selectItem){
- // $scope.gridApi.selection.selectRow(selectItem);
- // });
- // }
- // },2000)
- $scope.ok = function () {
- // $scope.selected.items = $scope.gridApi.selection.getSelectedRows();
- $modalInstance.close($scope.selected.items);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: size,
- resolve: {
- items: function () {
- return {
- fetchItems: function (filterData, APIService) {
- filterData = filterData || {};
- if (angular.isDefined(filterData.idx) && filterData.idx == null) {
- filterData = {
- idx: 0,
- sum: 10,
- "user": { "roledata": { "rolecode": options.model.incident.currentRole }, "selectType": "1" }
- };
- }
- return options.templateOptions.fetchItems(filterData, APIService);
- }
- };
- },
- title: function () {
- return options.templateOptions.modalTitle;
- },
- Restangular: function () {
- return options.templateOptions.Restangular;
- },
- APIService: function () {
- return options.templateOptions.ApiService;
- },
- selectItems: function () {
- return model || [];
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- options.value(selectedItem);
- options.formControl.$validate();
- }, function () {
- //console.log('Modal dismissed at: ' + new Date());
- });
- }
- },
- validators: {
- required: {
- expression: function (viewValue, modelValue) {
- var value = modelValue || viewValue;
- return value.length >= 1;
- }
- }
- }
- };
- },
- controller: ['$scope', function ($scope) {
- $scope.model[$scope.options.key] = [];
- $scope.remove = function (itemId) {
- angular.forEach($scope.model[$scope.options.key], function (entry, index) {
- if (entry.id == itemId) {
- $scope.model[$scope.options.key].splice(index, 1);
- console.log($scope.options.formControl)
- $scope.options.formControl.$validate();
- } else {
- }
- });
- }
- }]
- });
- //重复事件
- formlyConfigProvider.setType({
- name: "ui-incidentmodelselect",
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-modelselect.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- openModal: function (size, options, modal) {
- var modalInstance = modal.open({
- templateUrl: 'assets/views/customform/tpl/checktable-modal-content.html',
- controller: function ($scope, $modalInstance, items, title, Restangular, APIService, i18nService) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.enableColumnResizing = true;
- $scope.gridOptions.enableFiltering = true;
- $scope.gridOptions.enableGridMenu = true;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = true;
- $scope.gridOptions.fastWatch = true;
- $scope.gridOptions.useExternalFiltering = false;
- // $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = false;
- $scope.gridOptions.rowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.columnDefs = items.columnDefs();
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- $scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- // console.log(newPage);
- // console.log(pageSize);
- $scope.loadData({ "idx": newPage - 1, "sum": pageSize });
- });
- gridApi.core.on.filterChanged($scope, function () {
- var grid = this.grid;
- var filtersData = {
- idx: 0,
- sum: 10
- };
- angular.forEach(grid.columns, function (item) {
- if (item.enableFiltering) {
- if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- // console.log("filtersData="+JSON.stringify(filtersData))
- if (angular.isUndefined(filtersData['incident'])) {
- filtersData['incident'] = {};
- }
- filtersData['incident'][item.field] = item.filters[0].term;
- if (angular.isUndefined(filtersData['problem'])) {
- filtersData['problem'] = {};
- }
- filtersData['problem'][item.field] = item.filters[0].term;
- if (angular.isUndefined(filtersData['change'])) {
- filtersData['change'] = {};
- }
- filtersData['change'][item.field] = item.filters[0].term;
- if (angular.isUndefined(filtersData['release'])) {
- filtersData['release'] = {};
- }
- filtersData['release'][item.field] = item.filters[0].term;
- }
- }
- });
- $scope.loadData(filtersData);
- });
- gridApi.selection.on.rowSelectionChanged($scope, function (data) {
- $scope.selected.item = data.entity;
- //console.log(data);
- });
- };
- $scope.loadData = function (filterData) {
- items.fetchItems(filterData, APIService).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions.totalItems = myData.totalNum;
- $scope.myData = myData.list;
- });
- };
- $scope.title = title;
- $scope.loadData({
- idx: 0,
- sum: 10
- });
- $scope.selected = {
- item: {}
- };
- $scope.ok = function () {
- //console.log($scope.selected.item);
- $modalInstance.close($scope.selected.item);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: size,
- resolve: {
- items: function () {
- return {
- fetchItems: function (filterData, APIService) {
- filterData = filterData || {};
- // if(!filterData.idx){
- if (angular.isDefined(filterData.idx) && filterData.idx == null) {
- filterData = {
- idx: 0,
- sum: 10
- };
- }
- return options.templateOptions.fetchItems(filterData, APIService, options);
- },
- columnDefs: function () {
- return options.templateOptions.columnDefs;
- }
- };
- },
- title: function () {
- return options.templateOptions.modalTitle;
- },
- Restangular: function () {
- return options.templateOptions.Restangular;
- },
- APIService: function () {
- return options.templateOptions.ApiService;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- var selectitem = { title: selectedItem.title, description: selectedItem.description }
- angular.extend(options.model, selectitem);
- options.value(selectedItem);
- }, function () {
- //console.log('Modal dismissed at: ' + new Date());
- });
- }
- }
- };
- }
- });
- //选项选择控件
- formlyConfigProvider.setType({
- name: "ui-modelselect",
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-modelselect.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- openModal: function (size, options, modal) {
- var modalInstance = modal.open({
- templateUrl: 'assets/views/customform/tpl/checktable-modal-content.html',
- controller: function ($scope, $modalInstance, items, title, Restangular, APIService, i18nService) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.enableColumnResizing = true;
- $scope.gridOptions.enableFiltering = true;
- $scope.gridOptions.enableGridMenu = false;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = true;
- $scope.gridOptions.fastWatch = true;
- $scope.gridOptions.useExternalFiltering = true;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = false;
- $scope.gridOptions.rowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.columnDefs = items.columnDefs();
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- $scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- // console.log(newPage);
- // console.log(pageSize);
- $scope.loadData({ "idx": newPage - 1, "sum": pageSize });
- });
- gridApi.core.on.filterChanged($scope, function () {
- var grid = this.grid;
- var filtersData = {
- idx: 0,
- sum: 10
- };
- angular.forEach(grid.columns, function (item) {
- if (item.enableFiltering) {
- if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- // console.log("filtersData="+JSON.stringify(filtersData))
- if (angular.isUndefined(filtersData['incident'])) {
- filtersData['incident'] = {};
- }
- filtersData['incident'][item.field] = item.filters[0].term;
- if (angular.isUndefined(filtersData['problem'])) {
- filtersData['problem'] = {};
- }
- filtersData['problem'][item.field] = item.filters[0].term;
- if (angular.isUndefined(filtersData['change'])) {
- filtersData['change'] = {};
- }
- filtersData['change'][item.field] = item.filters[0].term;
- if (angular.isUndefined(filtersData['release'])) {
- filtersData['release'] = {};
- }
- filtersData['release'][item.field] = item.filters[0].term;
- }
- }
- });
- $scope.loadData(filtersData);
- });
- gridApi.selection.on.rowSelectionChanged($scope, function (data) {
- $scope.selected.item = data.entity;
- //console.log(data);
- });
- };
- $scope.loadData = function (filterData) {
- items.fetchItems(filterData, APIService).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions.totalItems = myData.totalNum;
- $scope.myData = myData.list;
- });
- };
- $scope.title = title;
- $scope.loadData({
- idx: 0,
- sum: 10
- });
- $scope.selected = {
- item: {}
- };
- $scope.ok = function () {
- //console.log($scope.selected.item);
- $modalInstance.close($scope.selected.item);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: size,
- resolve: {
- items: function () {
- return {
- fetchItems: function (filterData, APIService) {
- filterData = filterData || {};
- // if(!filterData.idx){
- if (angular.isDefined(filterData.idx) && filterData.idx == null) {
- filterData = {
- idx: 0,
- sum: 10
- };
- }
- return options.templateOptions.fetchItems(filterData, APIService, options);
- },
- columnDefs: function () {
- return options.templateOptions.columnDefs;
- }
- };
- },
- title: function () {
- return options.templateOptions.modalTitle;
- },
- Restangular: function () {
- return options.templateOptions.Restangular;
- },
- APIService: function () {
- return options.templateOptions.ApiService;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- options.value(selectedItem);
- }, function () {
- //console.log('Modal dismissed at: ' + new Date());
- });
- }
- }
- };
- }
- });
- formlyConfigProvider.setType({
- name: 'ui-requestform',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-requestform.html',
- controller: ['$scope', function ($scope) {
- setTimeout(function () {
- var filterData = {
- "idx": 0,
- "sum": 5,
- "incident": { "requester": { "id": "" } }
- }
- $scope.options.templateOptions.getWorkernumber($scope.options.templateOptions.ApiService, filterData).then(function (result) {
- var modelData = $scope.options.templateOptions.Restangular.stripRestangular(result);
- });
- }, 1000);
- }]
- });
- //工单控件
- formlyConfigProvider.setType({
- name: 'ui-workernumber',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-workernumber.html',
- controller: ['$scope', '$rootScope', function ($scope, $rootScope) {
- if ($scope.options.templateOptions.requester) {
- $scope.model.requester = $rootScope.user;
- }
- if (angular.isUndefined($scope.model[$scope.options.key]) || $scope.model[$scope.options.key] == null) {
- setTimeout(function () {
- $scope.options.templateOptions.getWorkernumber($scope.options.templateOptions.ApiService).then(function (result) {
- var modelData = $scope.options.templateOptions.Restangular.stripRestangular(result);
- if (modelData.status == 200) {
- $scope.model[$scope.options.key] = modelData.data;
- $scope.options.initialValue = $scope.model[$scope.options.key];
- }
- });
- }, 1000);
- }
- }]
- });
- //cmdb工单
- formlyConfigProvider.setType({
- name: 'ui-cmdbworkernumber',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-workernumber.html',
- controller: ['$scope', function ($scope) {
- if (angular.isUndefined($scope.model[$scope.options.key]) || $scope.model[$scope.options.key] == null) {
- setTimeout(function () {
- $scope.options.templateOptions.getWorkernumber($scope.options.templateOptions.ApiService, $scope.$parent.$parent.$parent.$parent.$parent.$parent.$parent.cifilter_classics.id).then(function (result) {
- var modelData = $scope.options.templateOptions.Restangular.stripRestangular(result);
- // if(modelData.status==200){
- $scope.model[$scope.options.key] = modelData[$scope.options.key];
- $scope.options.initialValue = $scope.model[$scope.options.key];
- // }
- });
- }, 1000);
- }
- }]
- });
- //无上传按钮附件上传组件
- formlyConfigProvider.setType({
- name: 'ui-dropfilenotup',
- templateUrl: 'assets/views/customform/tpl/ui-dropfilenotup.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- controller: ['$scope', 'FileUploader', '$rootScope', '$ionicPopup', function ($scope, FileUploader, $rootScope, $ionicPopup) {
- if (angular.isUndefined($scope.form.dropState)) {
- $scope.form.dropState = false;
- }
- //附件上传数据
- var uploader = $scope.uploader = $scope.options.templateOptions.fileUploader;
- //$scope.options.templateOptions.uploader();
- $scope.hideKeyboard = function () {
- document.activeElement.blur();
- $("input").blur();
- };
- // FILTERS
- uploader.filters.push({
- name: 'customFilter',
- // fn: function(item /*{File|FileLikeObject}*/ , options) {
- // return this.queue.length < 10;
- // },
- fn: function (item /*{File|FileLikeObject}*/, options) {
- var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
- if (item.size > 10 * 1024 * 1024) {
- $ionicPopup.alert({
- title: '图片超过了10M',
- okText: '确认'
- });
- }
- if ('|jpg|png|jpeg|'.indexOf(type) == -1) {
- $ionicPopup.alert({
- title: '图片格式错误',
- okText: '确认'
- });
- }
- return '|jpg|png|jpeg|'.indexOf(type) !== -1 && item.size < 10 * 1024 * 1024;
- // return '|jpg|png|jpeg|'.indexOf(type) !== -1 && this.queue.length < 3;
- },
- // fn: function(item, options) { return this.queue.length < 4; }
- });
- $scope.dropfile = function (APIService, processInstanceId, taskId, userId) {
- uploader.onBeforeUploadItem = function (item) {
- angular.extend(item.headers, $rootScope.getSession());
- item.url = APIService.uploadAttachment(processInstanceId, taskId, userId).getRequestedUrl();
- item.formData.push({ 'fileName': item.file.name });
- console.info('onBeforeUploadItem', item);
- };
- uploader.uploadAll();
- }
- // CALLBACKS
- uploader.onWhenAddingFileFailed = function (item /*{File|FileLikeObject}*/, filter, options) {
- console.info('onWhenAddingFileFailed', item, filter, options);
- };
- uploader.onAfterAddingFile = function (fileItem) {
- console.info('onAfterAddingFile', fileItem);
- };
- uploader.onAfterAddingAll = function (addedFileItems) {
- console.info('onAfterAddingAll', addedFileItems);
- };
- uploader.onBeforeUploadItem = function (item) {
- // if($scope.uploader.getNotUploadedItems().length>0&&response.data.processInstanceId){
- // // $scope.uploader.options.url();
- // $scope.uploader.onBeforeUploadItem = function(item) {
- // item.url = api_bpm_domain.saveAttachments($stateParams.processInstanceId,$stateParams.taskId,$scope.user.id).getRequestedUrl();
- // console.info('onBeforeUploadItem', item);
- // };
- // $scope.uploader.uploadAll();
- // }
- console.info('onBeforeUploadItem', item);
- };
- uploader.onProgressItem = function (fileItem, progress) {
- console.info('onProgressItem', fileItem, progress);
- };
- uploader.onProgressAll = function (progress) {
- console.info('onProgressAll', progress);
- };
- uploader.onSuccessItem = function (fileItem, response, status, headers) {
- console.info('onSuccessItem', fileItem, response, status, headers);
- };
- uploader.onErrorItem = function (fileItem, response, status, headers) {
- console.info('onErrorItem', fileItem, response, status, headers);
- };
- uploader.onCancelItem = function (fileItem, response, status, headers) {
- console.info('onCancelItem', fileItem, response, status, headers);
- };
- uploader.onCompleteItem = function (fileItem, response, status, headers) {
- console.info('onCompleteItem', fileItem, response, status, headers);
- };
- uploader.onCompleteAll = function () {
- console.info('onCompleteAll');
- };
- }]
- });
- //无按钮知识库上传
- formlyConfigProvider.setType({
- name: 'ui-dropfielkn',
- templateUrl: 'assets/views/customform/tpl/ui-dropfilenotup.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- controller: ['$scope', function ($scope) {
- if (angular.isUndefined($scope.form.dropState)) {
- $scope.form.dropState = false;
- }
- //附件上传数据
- var uploader = $scope.uploader = $scope.options.templateOptions.fileUploader;
- //$scope.options.templateOptions.uploader();
- // FILTERS
- uploader.filters.push({
- name: 'customFilter',
- fn: function (item /*{File|FileLikeObject}*/, options) {
- return this.queue.length < 10;
- }
- });
- $scope.dropfile = function (APIService, processInstanceId, taskId, userId) {
- uploader.onBeforeUploadItem = function (item) {
- angular.extend(item.headers, $rootScope.getSession());
- item.url = APIService.addFile(processInstanceId, taskId, userId).getRequestedUrl();
- item.formData.push({ 'fileName': item.file.name });
- console.info('onBeforeUploadItem', item);
- };
- uploader.uploadAll();
- }
- // CALLBACKS
- uploader.onWhenAddingFileFailed = function (item /*{File|FileLikeObject}*/, filter, options) {
- console.info('onWhenAddingFileFailed', item, filter, options);
- };
- uploader.onAfterAddingFile = function (fileItem) {
- console.info('onAfterAddingFile', fileItem);
- };
- uploader.onAfterAddingAll = function (addedFileItems) {
- console.info('onAfterAddingAll', addedFileItems);
- };
- uploader.onBeforeUploadItem = function (item) {
- // if($scope.uploader.getNotUploadedItems().length>0&&response.data.processInstanceId){
- // // $scope.uploader.options.url();
- // $scope.uploader.onBeforeUploadItem = function(item) {
- // item.url = api_bpm_domain.saveAttachments($stateParams.processInstanceId,$stateParams.taskId,$scope.user.id).getRequestedUrl();
- // console.info('onBeforeUploadItem', item);
- // };
- // $scope.uploader.uploadAll();
- // }
- console.info('onBeforeUploadItem', item);
- };
- uploader.onProgressItem = function (fileItem, progress) {
- console.info('onProgressItem', fileItem, progress);
- };
- uploader.onProgressAll = function (progress) {
- console.info('onProgressAll', progress);
- };
- uploader.onSuccessItem = function (fileItem, response, status, headers) {
- console.info('onSuccessItem', fileItem, response, status, headers);
- };
- uploader.onErrorItem = function (fileItem, response, status, headers) {
- console.info('onErrorItem', fileItem, response, status, headers);
- };
- uploader.onCancelItem = function (fileItem, response, status, headers) {
- console.info('onCancelItem', fileItem, response, status, headers);
- };
- uploader.onCompleteItem = function (fileItem, response, status, headers) {
- console.info('onCompleteItem', fileItem, response, status, headers);
- };
- uploader.onCompleteAll = function () {
- console.info('onCompleteAll');
- };
- }]
- });
- //附件上传列表组件
- formlyConfigProvider.setType({
- name: 'ui-dropfile',
- templateUrl: 'assets/views/customform/tpl/ui-dropfile.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- controller: ['$scope', '$rootScope', function ($scope, $rootScope) {
- if (angular.isUndefined($scope.form.dropState)) {
- $scope.form.dropState = false;
- }
- //附件上传数据
- var uploader = $scope.uploader = $scope.options.templateOptions.fileUploader;
- //$scope.options.templateOptions.uploader();
- // FILTERS
- uploader.filters.push({
- name: 'customFilter',
- fn: function (item /*{File|FileLikeObject}*/, options) {
- return this.queue.length < 10;
- }
- });
- $scope.dropfile = function (APIService, processInstanceId, taskId, userId) {
- uploader.onBeforeUploadItem = function (item) {
- angular.extend(item.headers, $rootScope.getSession());
- item.url = APIService.uploadAttachment(processInstanceId, taskId, userId).getRequestedUrl();
- item.formData.push({ 'fileName': item.file.name });
- console.info('onBeforeUploadItem', item);
- };
- uploader.uploadAll();
- }
- // CALLBACKS
- uploader.onWhenAddingFileFailed = function (item /*{File|FileLikeObject}*/, filter, options) {
- console.info('onWhenAddingFileFailed', item, filter, options);
- };
- uploader.onAfterAddingFile = function (fileItem) {
- console.info('onAfterAddingFile', fileItem);
- };
- uploader.onAfterAddingAll = function (addedFileItems) {
- console.info('onAfterAddingAll', addedFileItems);
- };
- uploader.onBeforeUploadItem = function (item) {
- // if($scope.uploader.getNotUploadedItems().length>0&&response.data.processInstanceId){
- // // $scope.uploader.options.url();
- // $scope.uploader.onBeforeUploadItem = function(item) {
- // item.url = api_bpm_domain.saveAttachments($stateParams.processInstanceId,$stateParams.taskId,$scope.user.id).getRequestedUrl();
- // console.info('onBeforeUploadItem', item);
- // };
- // $scope.uploader.uploadAll();
- // }
- console.info('onBeforeUploadItem', item);
- };
- uploader.onProgressItem = function (fileItem, progress) {
- console.info('onProgressItem', fileItem, progress);
- };
- uploader.onProgressAll = function (progress) {
- console.info('onProgressAll', progress);
- };
- uploader.onSuccessItem = function (fileItem, response, status, headers) {
- console.info('onSuccessItem', fileItem, response, status, headers);
- };
- uploader.onErrorItem = function (fileItem, response, status, headers) {
- console.info('onErrorItem', fileItem, response, status, headers);
- };
- uploader.onCancelItem = function (fileItem, response, status, headers) {
- console.info('onCancelItem', fileItem, response, status, headers);
- };
- uploader.onCompleteItem = function (fileItem, response, status, headers) {
- console.info('onCompleteItem', fileItem, response, status, headers);
- };
- uploader.onCompleteAll = function () {
- console.info('onCompleteAll');
- };
- }]
- });
- //知识库附件上传
- formlyConfigProvider.setType({
- name: 'ui-dropfielknow',
- templateUrl: 'assets/views/customform/tpl/ui-dropfile.html',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- controller: ['$scope', '$rootScope', function ($scope, $rootScope) {
- if (angular.isUndefined($scope.form.dropState)) {
- $scope.form.dropState = false;
- }
- //附件上传数据
- var uploader = $scope.uploader = $scope.options.templateOptions.fileUploader;
- //$scope.options.templateOptions.uploader();
- // FILTERS
- uploader.filters.push({
- name: 'customFilter',
- fn: function (item /*{File|FileLikeObject}*/, options) {
- return this.queue.length < 10;
- }
- });
- $scope.dropfile = function (APIService, processInstanceId, taskId, userId) {
- uploader.onBeforeUploadItem = function (item) {
- angular.extend(item.headers, $rootScope.getSession());
- item.url = APIService.upload(processInstanceId, taskId, userId).getRequestedUrl();
- item.formData.push({ 'fileName': item.file.name, 'type': 'solution', 'solutionId': $scope.model.knowledge.id });
- console.info('onBeforeUploadItem', item);
- };
- uploader.uploadAll();
- }
- // CALLBACKS
- uploader.onWhenAddingFileFailed = function (item /*{File|FileLikeObject}*/, filter, options) {
- console.info('onWhenAddingFileFailed', item, filter, options);
- };
- uploader.onAfterAddingFile = function (fileItem) {
- console.info('onAfterAddingFile', fileItem);
- };
- uploader.onAfterAddingAll = function (addedFileItems) {
- console.info('onAfterAddingAll', addedFileItems);
- };
- uploader.onBeforeUploadItem = function (item) {
- // if($scope.uploader.getNotUploadedItems().length>0&&response.data.processInstanceId){
- // // $scope.uploader.options.url();
- // $scope.uploader.onBeforeUploadItem = function(item) {
- // item.url = api_bpm_domain.saveAttachments($stateParams.processInstanceId,$stateParams.taskId,$scope.user.id).getRequestedUrl();
- // console.info('onBeforeUploadItem', item);
- // };
- // $scope.uploader.uploadAll();
- // }
- console.info('onBeforeUploadItem', item);
- };
- uploader.onProgressItem = function (fileItem, progress) {
- console.info('onProgressItem', fileItem, progress);
- };
- uploader.onProgressAll = function (progress) {
- console.info('onProgressAll', progress);
- };
- uploader.onSuccessItem = function (fileItem, response, status, headers) {
- console.info('onSuccessItem', fileItem, response, status, headers);
- };
- uploader.onErrorItem = function (fileItem, response, status, headers) {
- console.info('onErrorItem', fileItem, response, status, headers);
- };
- uploader.onCancelItem = function (fileItem, response, status, headers) {
- console.info('onCancelItem', fileItem, response, status, headers);
- };
- uploader.onCompleteItem = function (fileItem, response, status, headers) {
- console.info('onCompleteItem', fileItem, response, status, headers);
- };
- uploader.onCompleteAll = function () {
- console.info('onCompleteAll');
- };
- }]
- });
- //知识库附件下载列表
- formlyConfigProvider.setType({
- name: 'ui-dropfileknowledge',
- templateUrl: 'assets/views/customform/tpl/ui-dropfileknowledge.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function (APIService, contentId, data) {
- return APIService.fetchDataList(contentId, data);
- },
- downloadUri: function (APIService, contentId) {
- return APIService.downloadAttachment(contentId).getRequestedUrl();
- },
- download: function (APIService, contentId) {
- return APIService.getSolutionDowpath(contentId);
- },
- view: function (attachmentId) {
- // return APIService.attachmentsPreviewUrl(contentId);
- },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', '$timeout', '$rootScope', 'api_solution', '$http', function ($scope, $timeout, $rootScope, api_solution, $http) {
- var _refreshDelayPromise;
- $scope.downloadUrl = function (contentId) {
- return $scope.options.templateOptions.downloadUri($scope.options.templateOptions.ApiService, contentId) || '#';
- };
- $scope.download = function (contentId, filename) {
- $http({
- url: $scope.options.templateOptions.ApiService.getSolutionDowpath(contentId).getRequestedUrl(),
- method: 'GET',
- headers: {
- //'Content-type' : 'application/xls',
- 'Accept': '*/*'
- },
- responseType: 'arraybuffer'
- }).success(function (data, status, headers, config) {
- var file = new Blob([data], {
- type: 'application/octet-stream'
- });
- //trick to download store a file having its URL
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement('a');
- a.href = fileURL;
- a.target = '_blank';
- a.download = filename;
- document.body.appendChild(a);
- a.click();
- }).error(function (data, status, headers, config) {
- console.log(data);
- });
- }
- $scope._refresh = function (refreshAttr) {
- if (refreshAttr !== undefined) {
- if (_refreshDelayPromise) {
- $timeout.cancel(_refreshDelayPromise);
- }
- _refreshDelayPromise = $timeout(function () {
- $scope.options.templateOptions.refresh($scope.options.templateOptions.ApiService,
- 'file', { "file": { "solutionId": $scope.model.knowledge.id }, "idx": "0", "sum": "1000" }).then(function (response) {
- var myData = $scope.options.templateOptions.Restangular.stripRestangular(response);
- if (myData) {
- $scope.attachments = myData.list;
- $scope.view = function (attachmentId) {
- for (var i = 0; i < $scope.attachments.length; i++) {
- if ($scope.attachments[i].id == attachmentId) {
- window.open($scope.attachments[i].previewUrl);
- // var modalInstance = $modal.open({
- // templateUrl: 'assets/views/knowledge/tpl/detailknowledge.html',
- // controller: function($scope, $http,$modalInstance, APIService, uploader,tree_data, currentUser){
- // }
- // });
- }
- }
- };
- }
- });
- }, $scope.options.templateOptions.refreshDelay);
- }
- }
- $scope._refresh({});
- // $scope.attachments = $scope.model[$scope.options.key]
- }]
- });
- //附件下载列表组件
- formlyConfigProvider.setType({
- name: 'ui-dropfiletable',
- // wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- templateUrl: 'assets/views/customform/tpl/ui-dropfiletable.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function (APIService, processInstanceId, data) {
- return APIService.listAttachments(processInstanceId, data);
- },
- downloadUri: function (APIService, contentId) {
- return APIService.downloadAttachment(contentId).getRequestedUrl();
- },
- view: function (APIService, contentId) {
- return APIService.attachmentsPreviewUrl(contentId);
- },
- download: function (APIService, contentId, item) {
- var item = { 'url': APIService.download(contentId), 'headers': headers };
- return item;
- },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', '$state', '$timeout', '$rootScope', '$http', '$ionicPopup', function ($scope, $state, $timeout, $rootScope, $http, $ionicPopup) {
- var _refreshDelayPromise;
- var u = navigator.userAgent,
- app = navigator.appVersion;
- $scope.isiphone = false;
- if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))) {
- if (window.location.href.indexOf("?mobile") < 0) {
- try {
- if (/iPhone|mac|iPod|iPad/i.test(navigator.userAgent)) {
- // return '0';
- $scope.isiphone = true;
- } else {
- $scope.isiphone = false;
- }
- } catch (e) { }
- }
- } else if (u.indexOf('iPad') > -1) {
- // return '0';
- $scope.isiphone = true;
- } else {
- // return '1';
- $scope.isiphone = false;
- }
- $scope.download = function (item) {
- // $http({
- // url: $scope.options.templateOptions.ApiService.download(item.id).getRequestedUrl(),
- // method: 'GET',
- // headers: {
- // // 'Content-type': '"application/octet-stream"',
- // 'Accept': '*/*'
- // },
- // responseType: 'arraybuffer'
- // }).success(function(data, status, headers, config) {
- // // var file = new Blob([data], {
- // // type: 'application/octet-stream'
- // // });
- // // var src = window.URL.createObjectURL(file);
- // // var fileURL = URL.createObjectURL(file).replace('blob:', '');
- // // window.open(fileURL);
- // var file = new Blob([data], {
- // type: 'application/octet-stream'
- // });
- // var fileURL = URL.createObjectURL(file);
- // var a = document.createElement('a');
- // a.href = fileURL;
- // a.target = '_blank';
- // a.download = item.name;
- // document.body.appendChild(a);
- // a.click();
- // // var a = document.createElement('a');
- // // a.href = fileURL;
- // // a.target = '_blank';
- // // // a.download = filename;
- // // document.body.appendChild(a);
- // // a.click();
- // // a.id = 'ui-dropfiletable-download-a';
- // // if (!document.getElementById('ui-dropfiletable-download-a')) {
- // // document.getElementById('ui-dropfiletable-download').appendChild(a);
- // // // document.body.appendChild(a);
- // // }
- // // document.body.appendChild(a);
- // // if (!$("#ui-dropfiletable-download-a")) {
- // // $("#ui-dropfiletable-download").append(a);
- // // }
- // // if (document.getElementById('ui-dropfiletable-download-a')) {
- // // document.getElementById('ui-dropfiletable-download-a').click();
- // // }
- // // if ($("#ui-dropfiletable-download-a")) {
- // // $("#ui-dropfiletable-download-a").click(function() {
- // // alert('ui-dropfiletable-download-a');
- // // });
- // // }
- // // if ($("#ui-dropfiletable-download-a")) {
- // // console.log($("#ui-dropfiletable-download-a").attr("id"));
- // // $("#ui-dropfiletable-download-a").text('12345')
- // // // $("#ui-dropfiletable-download-a").click();
- // // }
- // }).error(function(data, status, headers, config) {
- // // console.log(data);
- // });
- $http({
- url: $scope.options.templateOptions.ApiService.download(item.id).getRequestedUrl(),
- method: 'GET',
- headers: {
- //'Content-type' : 'application/xls',
- 'Accept': '*/*'
- },
- responseType: 'arraybuffer'
- }).success(function (data, status, headers, config) {
- var file = new Blob([data], {
- type: 'application/octet-stream'
- });
- // var fileURL = URL.createObjectURL(file);
- // var a = document.createElement('a');
- // a.href = fileURL;
- // a.target = '_blank';
- // a.download = item.name;
- // document.body.appendChild(a);
- // a.click();
- var file = new Blob([data], {
- type: 'application/octet-stream'
- });
- var src = window.URL.createObjectURL(file);
- var fileURL = URL.createObjectURL(file).replace('blob:', '');
- window.open(fileURL);
- }).error(function (data, status, headers, config) {
- // console.log(data);
- });
- // $scope.options.templateOptions.ApiService.download(contentId).then(function(response){
- // // $scope.options.templateOptions.download($scope.options.templateOptions.ApiService,contentId).then(function(response){
- // var file = new Blob([response], {
- // type : 'application/octet-stream'
- // });
- // // var filename = filename;
- // //var file = new Blob([response], {type: 'application/pdf'});
- // var fileURL = URL.createObjectURL(file);
- // var a = document.createElement('a');
- // a.href = fileURL;
- // a.target = '_blank';
- // a.download = filename ;
- // document.body.appendChild(a);
- // a.click();
- // })
- };
- // $scope.view = function(contentId) {
- // $scope.options.templateOptions.view($scope.options.templateOptions.ApiService, contentId).then(function(response) {
- // if (response.state == 200) {
- // window.open(response.previewUrl);
- // }
- // })
- // };
- var is_weixin = (function () {
- return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
- })();
- window.onload = function () {
- var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; //兼容IOS,不需要的可以去掉
- var btn = document.getElementById('J_weixin');
- var tip = document.getElementById('weixin-tip');
- var close = document.getElementById('close');
- // if (is_weixin) {
- btn.onclick = function (e) {
- tip.style.height = winHeight + 'px'; //兼容IOS弹窗整屏
- tip.style.display = 'block';
- return false;
- }
- close.onclick = function () {
- tip.style.display = 'none';
- }
- // }
- }
- var viewopen = false;
- var isviewopen = false;
- $scope.view = function (item) {
- // var ua = navigator.userAgent.toLowerCase();
- // if (ua.match(/MicroMessenger/i) == "micromessenger") {
- // alert("是");
- // } else {
- // location.href = "http://emoji.adline.com.cn/"
- // }
- // var is_weixin = (function() { return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1 })();
- // window.onload = function() {
- // }
- // // $scope.is_weixin = (function() {
- // // return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
- // // })();
- // window.onload = function() {
- // var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; //兼容IOS,不需要的可以去掉
- // var btn = document.getElementById('J_weixin');
- // var tip = document.getElementById('weixin-tip');
- // var close = document.getElementById('close');
- // if (is_weixin) {
- // btn.onclick = function(e) {
- // tip.style.height = winHeight + 'px'; //兼容IOS弹窗整屏
- // tip.style.display = 'block';
- // return false;
- // }
- // close.onclick = function() {
- // tip.style.display = 'none';
- // }
- // }
- // }
- if (item.type == 'jpg' || item.type == 'png' || item.type == 'gif') {
- viewopen = true;
- isviewopen = true;
- $scope.imgUrl = $scope.options.templateOptions.ApiService.download(item.id).getRequestedUrl();
- // $ionicPopup.alert({
- // template: "<img src=" + $scope.imgUrl + " style='width: 100%;'>",
- // okText: '确认'
- // })
- window.addEventListener("popstate", function (e) {
- myPopup.close();
- // if (!isviewopen) {
- // window.history.back(-1);
- // }
- isviewopen = false;
- }, false);
- $(document).ready(function () {
- if (window.history && window.history.pushState && !isviewopen) {
- $(window).on('popstate', function () {
- window.history.pushState('forward', null, '#');
- window.history.forward(1);
- });
- }
- window.history.pushState('forward', null, '#'); //在IE中必须得有这两行
- window.history.forward(1);
- });
- var myPopup = $ionicPopup.show({
- template: "<img src=" + $scope.imgUrl + " style='width: 100%;'>",
- // title: 'Enter Wi-Fi Password',
- // subTitle: 'Please use normal things',
- scope: $scope,
- buttons: [
- // { text: '关闭' },
- // {
- // text: '<b>Save</b>',
- // type: 'button-positive',
- // onTap: function(e) {
- // if (!$scope.data.wifi) {
- // //不允许用户关闭,除非他键入wifi密码
- // e.preventDefault();
- // } else {
- // return $scope.data.wifi;
- // }
- // }
- // },
- ]
- });
- } else {
- var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; //兼容IOS,不需要的可以去掉
- var btn = document.getElementById('J_weixin');
- var tip = document.getElementById('weixin-tip');
- var close = document.getElementById('close');
- // if (is_weixin) {
- btn.onclick = function (e) {
- tip.style.height = winHeight + 'px'; //兼容IOS弹窗整屏
- tip.style.display = 'block';
- return false;
- }
- close.onclick = function () {
- tip.style.display = 'none';
- }
- // }
- // function downloaded() {
- // }
- // $scope.download(item);
- // $scope.options.templateOptions.view($scope.options.templateOptions.ApiService, item.id).then(function(response) {
- // if (response.state == 200) {
- // window.location.href = response.previewUrl;
- // var myFrame = document.createElement("iframe");
- // myFrame.src = response.previewUrl;
- // myFrame.style.display = "none";
- // document.body.appendChild(myFrame);
- // }
- // })
- }
- };
- /**
- * refresh
- */
- $scope.imageurl = "";
- $scope._refresh = function (refreshAttr) {
- if (refreshAttr !== undefined) {
- if (_refreshDelayPromise) {
- $timeout.cancel(_refreshDelayPromise);
- }
- _refreshDelayPromise = $timeout(function () {
- $scope.options.templateOptions.refresh($scope.options.templateOptions.ApiService,
- $scope.options.templateOptions.processInstanceId, { 'idx': 0, 'sum': 1000 }).then(function (response) {
- var myData = $scope.options.templateOptions.Restangular.stripRestangular(response);
- if (myData) {
- $scope.attachments = myData.data;
- }
- angular.forEach($scope.attachments, function (item, index) {
- $scope.attachments[index].downurl = 'http://testncc.hust.edu.cn/service/api/bpm/bpm/getAttachmentContent/' + item.id;
- // $scope.downurl = 'http://testncc.hust.edu.cn/service/api/bpm/bpm/getAttachmentContent/1092836'
- // if (item.type != 'jpg' && item.type != 'png' && item.type != 'gif' && item.type != 'jpeg') {
- // $scope.options.templateOptions.view($scope.options.templateOptions.ApiService, item.id).then(function(response) {
- // if (response.state == 200) {
- // $scope.imageurl = response.previewUrl;
- // // window.open(response.previewUrl);
- // }
- // })
- // }
- })
- });
- }, $scope.options.templateOptions.refreshDelay);
- }
- }
- $scope._refresh({});
- // $scope.attachments = $scope.model[$scope.options.key]
- }]
- });
- //微信附件下载列表组件
- formlyConfigProvider.setType({
- name: 'ui-dropfilewechat',
- templateUrl: 'assets/views/customform/tpl/ui-dropfilewechat.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- // refresh: function(APIService, processInstanceId, data) {
- // return APIService.listAttachments(processInstanceId, data);
- // },
- // downloadUri: function(APIService, contentId) {
- // return APIService.downloadAttachment(contentId).getRequestedUrl();
- // },
- view: function (APIService, contentId) {
- return APIService.attachmentsPreviewUrl(contentId);
- },
- // download: function(APIService, contentId, item) {
- // var item = { 'url': APIService.downloadAttachment(contentId), 'headers': headers };
- // return item;
- // },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', '$timeout', '$stateParams', '$rootScope', '$http', 'api_wechatfile', function ($scope, $timeout, $stateParams, $rootScope, $http, api_wechatfile) {
- var _refreshDelayPromise;
- // $scope.downloadUrl = function(contentId){
- // return $scope.options.templateOptions.downloadUri($scope.options.templateOptions.ApiService,contentId)||'#';
- // };
- $scope.attachments = {};
- $scope.download = function (token, filename) {
- // var headers=
- $http({
- url: $scope.options.templateOptions.ApiService.downloadAttachment(token).getRequestedUrl(),
- method: 'GET',
- headers: {
- //'Content-type' : 'application/xls',
- 'Accept': '*/*'
- },
- responseType: 'arraybuffer'
- }).success(function (data, status, headers, config) {
- var file = new Blob([data], {
- type: 'application/octet-stream'
- });
- //trick to download store a file having its URL
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement('a');
- a.href = fileURL;
- a.target = '_blank';
- a.download = filename;
- document.body.appendChild(a);
- a.click();
- }).error(function (data, status, headers, config) {
- // console.log(data);
- });
- };
- $scope.view = function (contentId) {
- $scope.options.templateOptions.view($scope.options.templateOptions.ApiService, contentId).then(function (response) {
- if (response.state == 200) {
- window.open(response.previewUrl);
- }
- })
- };
- /**
- * refresh
- */
- $scope._refresh = function (refreshAttr) {
- if (refreshAttr !== undefined) {
- if (_refreshDelayPromise) {
- $timeout.cancel(_refreshDelayPromise);
- }
- _refreshDelayPromise = $timeout(function () {
- // console.log(JSON.parse($stateParams.model))
- var incidentChart = {};
- if ($stateParams.model) {
- incidentChart = JSON.parse($stateParams.model).model;
- }
- $scope.options.templateOptions.refresh($scope.options.templateOptions.ApiService,
- $scope.model).then(function (response) {
- // $scope.options.templateOptions.refresh($scope.options.templateOptions.ApiService,
- // incidentChart.incident.type, incidentChart.flow).then(function(response) {
- var myData = $scope.options.templateOptions.Restangular.stripRestangular(response);
- if (myData) {
- $scope.attachments = myData.data;
- }
- });
- }, $scope.options.templateOptions.refreshDelay);
- }
- }
- $scope._refresh({});
- // $scope.attachments = $scope.model[$scope.options.key]
- }]
- });
- formlyConfigProvider.setType({
- name: 'ui-paralleltask',
- templateUrl: 'assets/views/customform/tpl/ui-paralleltask.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- refresh: function (APIService, processInstanceId, data) {
- //return APIService.listAttachments(processInstanceId, data);
- },
- refreshDelay: 0
- }
- };
- },
- controller: ['$scope', '$timeout', function ($scope, $timeout) { }]
- });
- //repeatSection
- //
- formlyConfigProvider.setType({
- name: 'ui-repeatSection',
- templateUrl: 'assets/views/customform/tpl/ui-repeatSection.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- unique: 1,
- initDisplay: false
- }
- };
- },
- controller: function ($scope) {
- //$scope.options.templateOptions.unique;
- $scope.formOptions = { formState: $scope.formState };
- $scope.addNew = addNew;
- $scope.copyFields = copyFields;
- function copyFields(fields) {
- fields = angular.copy(fields);
- addRandomIds(fields);
- return fields;
- }
- function addNew() {
- $scope.model[$scope.options.key] = $scope.model[$scope.options.key] || [];
- var repeatsection = $scope.model[$scope.options.key];
- var lastSection = repeatsection[repeatsection.length - 1];
- var newsection = {};
- repeatsection.push(newsection);
- }
- function addRandomIds(fields) {
- $scope.options.templateOptions.unique++;
- angular.forEach(fields, function (field, index) {
- if (field.fieldGroup) {
- addRandomIds(field.fieldGroup);
- return; // fieldGroups don't need an ID
- }
- if (field.templateOptions && field.templateOptions.fields) {
- addRandomIds(field.templateOptions.fields);
- }
- field.id = field.id || (field.key + '_' + index + '_' + $scope.options.templateOptions.unique + getRandomInt(0, 9999));
- });
- }
- function getRandomInt(min, max) {
- return Math.floor(Math.random() * (max - min)) + min;
- }
- if ($scope.options.templateOptions.initDisplay) {
- addNew();
- }
- }
- });
- //时间轴任务列表组件
- // //主题控件
- // formlyConfigProvider.setType({
- // name: 'ui-titlesearch',
- // templateUrl: 'assets/views/customform/tpl/ui-knowledge.html',
- // extends: 'input',
- // templateUrl : 'assets/views/system/tpl/asideContent.html',
- // defaultOptions:function(options){
- // return {
- // };
- // },
- // controller: ['$scope','$aside',function($scope,$aside){
- // $scope.openAside = function (position) {
- // $aside.open({
- // templateUrl: 'asideContent.html',
- // placement: position,
- // size: 'sm',
- // backdrop: true,
- // controller: function ($scope, $modalInstance) {
- // $scope.ok = function (e) {
- // $modalInstance.close();
- // e.stopPropagation();
- // };
- // $scope.cancel = function (e) {
- // $modalInstance.dismiss();
- // e.stopPropagation();
- // };
- // }
- // });
- // };
- // }]
- // })
- //知识库按钮组件
- formlyConfigProvider.setType({
- name: 'ui-search',
- templateUrl: 'assets/views/customform/tpl/ui-knowledge.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- search: function (size, options, modal, keys, fields, el) {
- var modalInstance = modal.open({
- templateUrl: 'assets/views/customform/tpl/search-knowledge.html',
- controller: function ($rootScope, $scope, $modalInstance, searchKey, title, Restangular, APIService, modelscope, relatedAction) {
- $scope.options = {
- language: 'zh-cn',
- allowedContent: true,
- entities: false
- };
- $scope.onReady = function () {
- // ...
- };
- $scope.searchKey = searchKey;
- $scope.search = function (key) {
- // var datas={'key':key}
- APIService.searchSolutionByKey(key, $rootScope.user.id).then(function (response) {
- var myData = Restangular.stripRestangular(response);
- // var status=myData.status;
- // if(status=="500"){
- // //toaster.pop('warning', '没有数据', '查询'+keys+'没有数据');
- // }else
- if (myData && myData.length > 0) {
- var data = myData;
- if (data.length > 0) {
- $scope.searchData = data;
- }
- }
- });
- };
- $scope.related = function (item) {
- // angular.forEach(fields, function(field){
- // if(field.key == 'directClose'){
- // field.value(true);
- // modelscope.$parent.$parent.$parent.model['start_code']='close';
- // }
- // if(field.key == 'handleDescription'){
- // field.model['handleDescription']=tentity.content;
- // }
- // });
- if (relatedAction && angular.isFunction(relatedAction)) {
- relatedAction(fields, modelscope, item);
- }
- $scope.cancel();
- // angular.forEach(fields,function(field){
- // });
- }
- $scope.title = title;
- $scope.search(searchKey);
- $scope.selected = {
- item: {}
- };
- $scope.ok = function () {
- //console.log($scope.selected.item);
- $modalInstance.close($scope.selected.item);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: size,
- resolve: {
- searchKey: function () {
- return keys;
- },
- title: function () {
- return options.templateOptions.modalTitle;
- },
- Restangular: function () {
- return options.templateOptions.Restangular;
- },
- APIService: function () {
- return options.templateOptions.ApiService;
- },
- modelscope: function () {
- return el.$parent;
- },
- relatedAction: function () {
- return options.templateOptions.relationAction;
- }
- }
- });
- // modalInstance.result.then(function(selectedItem) {
- // options.value(selectedItem);
- // }, function() {
- // //console.log('Modal dismissed at: ' + new Date());
- // });
- }
- }
- };
- },
- controller: ['$scope', function ($scope) {
- // $scope.searchModal = $scope.model[$scope.options.key];
- // $scope.$watch('searchModal',function(newValue, oldValue){
- // if (newValue === oldValue) { return; }
- // if (newValue.flag == oldValue.flag) { return; }
- // if (angular.isDefined(newValue.flag)&&(newValue.flag==true)){
- // if (newValue.searchKey!=''&&angular.isDefined(newValue.searchKey)){
- // $scope.options.templateOptions.search('lg',$scope.options,newValue.searchKey);
- // }
- // }
- // })
- //
- }]
- });
- //cmdb控件
- formlyConfigProvider.setType({
- name: 'ui-cmdb',
- extends: 'input',
- templateUrl: 'assets/views/customform/tpl/ui-cmdb.html',
- defaultOptions: function (options) {
- return {
- templateOptions: {
- onClick: function (size, options, modal, event, model) {
- var modalInstance = modal.open({
- templateUrl: 'assets/views/customform/tpl/cmdb-modal-content.html',
- controller: function ($scope, $modalInstance, title, Restangular, APIService, ConfigDataService, ConfigFormService, SweetAlert, Toaster) {
- var width = $scope.width = 600;
- var height = $scope.height = 400;
- var tree;
- var d3 = window.d3;
- $scope.my_tree_handler = function (branch) {
- //var _ref;
- var classify = $scope.classify = branch.prefix.toLowerCase() + branch.sign;
- APIService.query({ 'sign': classify }).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- console.log(myData.data.node);
- if (myData.data && myData.status == 200) {
- var ret = myData.data;
- redrawSvg(myData);
- }
- });
- };
- $scope.my_data = [];
- function convertListToTree(data, treeMap) {
- var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
- var root = null; //Initially set our loop to null
- var parentNode = null;
- //loop over data
- for (var i = 0; i < data.length; i++) {
- var datum = data[i];
- //each node will have children, so let's give it a "children" poperty
- datum.children = [];
- //add an entry for this node to the map so that any future children can
- //lookup the parent
- idToNodeMap[datum.id] = datum;
- //Does this node have a parent?
- if (typeof datum.parent === "undefined" || datum.parent == null) {
- //Doesn't look like it, so this node is the root of the tree
- root = datum;
- treeMap[datum.id] = root;
- } else {
- //This node has a parent, so let's look it up using the id
- parentNode = idToNodeMap[datum.parent.id];
- //We don't need this property, so let's delete it.
- delete datum.parent;
- //Let's add the current node as a child of the parent node.
- parentNode.children.push(datum);
- }
- }
- return root;
- }
- function convertParentToChildList(data) {
- var treeMap = {};
- var list = [];
- convertListToTree(data, treeMap);
- angular.forEach(treeMap, function (item) {
- list.push(item);
- });
- return list;
- }
- $scope.my_tree = tree = {};
- $scope.try_async_load = function () {
- $scope.my_data = [];
- $scope.select_treedata = [];
- $scope.doing_async = true;
- ConfigDataService.fetchDataList('ciclassify', { 'idx': 0, 'sum': 100 }).then(function (result) {
- $scope.select_treedata = $scope.my_data = convertParentToChildList(result['list']);
- $scope.doing_async = false;
- });
- };
- $scope.select_treedata = [];
- $scope.propTypeOptions = [];
- $scope.try_async_load();
- $scope.onFilterCallback = function (item) {
- //console.log(item);
- if (angular.isDefined(item.children) && item.children.length >= 1) {
- //not valid
- } else {
- var tempclassify = item.prefix.toLowerCase() + item.sign;
- $scope.cifilter_classic = tempclassify;
- ConfigFormService.renderTabForm(tempclassify).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.propTypeOptions = myData;
- });
- }
- }
- $scope.onPropTypeChange = function (form) {
- $scope.propOptions = form.fields;
- }
- $scope.onPropChange = function (prop) {
- $scope.cifilter_prop = prop;
- }
- $scope.searchCI = function (searchKey, propObj, ciclassify) {
- //if(searchKey!=null&&searchKey.length>1){
- var searchData = {};
- if (angular.isUndefined(propObj)) {
- propObj = $scope.cifilter_prop;
- }
- if (angular.isUndefined(ciclassify)) {
- ciclassify = $scope.cifilter_classic;
- }
- searchData['sign'] = ciclassify;
- if (angular.isDefined(propObj)) {
- searchData[propObj.key] = searchKey;
- }
- APIService.query(searchData).then(function (response) {
- var data = Restangular.stripRestangular(response);
- //此处不清空nodes
- var node = data.data.node;
- var tempNode = [];
- //nodes 或者links 要去重
- for (var i = 0; i < node.length; i++) {
- var tmp = 0;
- for (var j = 0; j < nodes.length; j++) {
- if (node[i].uuid == nodes[j].uuid) {
- tmp++;
- break;
- }
- }
- if (tmp == 0) {
- tempNode.push(node[i]);
- }
- }
- for (var i = 0; i < tempNode.length; i++) { //nodes 不清空
- nodes.push(tempNode[i]);
- }
- restart();
- })
- }
- $scope.refresh = function () {
- nodes.length = 0;
- links.length = 0;
- restart();
- }
- $scope.traversal = function () {
- if ($scope.selected_node == null) {
- // SweetAlert.swal({
- // title: "错误的操作!",
- // text: "没有配置项被选中!",
- // type: "error"
- // });
- $ionicPopup.alert({
- title: '没有配置项被选中!',
- okText: '确认'
- });
- } else {
- var uuid = $scope.selected_node.uuid;
- APIService.traversal(uuid).then(function (response) {
- var d = response.data;
- var node = d.node;
- var link = d.edge;
- var tempNode = [];
- var tempLink = [];
- //nodes 或者links 要去重
- for (var i = 0; i < node.length; i++) {
- var tmp = 0;
- for (var j = 0; j < nodes.length; j++) {
- if (node[i].id == nodes[j].id) {
- tmp++;
- break;
- }
- }
- if (tmp == 0) {
- tempNode.push(node[i]);
- }
- }
- for (var i = 0; i < link.length; i++) {
- var tmp = 0;
- for (var j = 0; j < links.length; j++) {
- if (link[i].id == links[j].id) {
- tmp++;
- break;
- }
- }
- if (tmp == 0) {
- tempLink.push(link[i]);
- }
- }
- //数据写入页面
- for (var i = 0; i < tempNode.length; i++) { //nodes 不清空
- nodes.push(tempNode[i]);
- }
- for (var i = 0; i < tempLink.length; i++) { //link 不清空
- links.push(tempLink[i]);
- }
- //links转换
- for (var i = 0; i < links.length; i++) {
- for (var j = 0; j < nodes.length; j++) {
- if (links[i].source == nodes[j].id) {
- links[i].source = nodes[j];
- }
- if (links[i].target == nodes[j].id) {
- links[i].target = nodes[j];
- }
- }
- }
- restart();
- })
- }
- }
- var svg;
- var force;
- var drag_line, path, circle;
- //var svg = d3.select(angular.element('div#cmdbSVG')).append('svg').attr('width', width).attr('height', height);
- //var svg = angular.element('div#cmdbSVG').append('svg').attr('width', width).attr('height', height);
- //var svg = d3.select('#cmdbSVG').append('svg').attr('width', width).attr('height', height);
- var nodes = [],
- links = [];
- var treeNodes = [];
- //读取labels (node)
- var labels = [];
- function redrawSvg(json) {
- nodes.length = 0; //先清空
- links.length = 0;
- var data = json.data;
- for (var i = 0; i < data.node.length; i++) {
- nodes.push(data.node[i]);
- }
- restart();
- }
- //读取status (节点 连线)
- var statuses = [];
- ConfigDataService.fetchDataList('cistatus', { 'idx': 0, 'sum': 100 }).then(function (result) {
- if (result && result.status == 200) {
- d3.select('#nodeStatus').selectAll('option')
- .data(statuses).enter()
- .append('option')
- .attr('value', function (d) { return d.code; })
- .html(function (d) { return d.desc; });
- } else {
- // SweetAlert.swal({
- // title: "提示!",
- // text: "服务器请求异常!",
- // type: "error"
- // });
- $ionicPopup.alert({
- title: '服务器请求异常!',
- okText: '确认'
- });
- }
- });
- //查询relationship_type表 name 为表里的type,label为显示值
- var linkType = [];
- function fetchEdgeTypes() {
- ConfigDataService.fetchDataList('ciedgetype', { 'idx': 0, 'sum': 100 }).then(function (response) {
- if (response) {
- if (response['list']) {
- linkType = response['list'];
- // d3.select('#linkName').selectAll('option')
- // .data(linkType).enter()
- // .append('option')
- // .attr('value',function(d){return d.type;})
- // .html(function(d){ return d.label;});
- } else {
- // SweetAlert.swal({
- // title: "提示!",
- // text: "服务器请求异常!",
- // type: "error"
- // });
- $ionicPopup.alert({
- title: '服务器请求异常!',
- okText: '确认'
- });
- }
- } else {
- // SweetAlert.swal({
- // title: "提示!",
- // text: "服务器请求异常!",
- // type: "error"
- // });
- $ionicPopup.alert({
- title: '服务器请求异常!',
- okText: '确认'
- });
- }
- })
- }
- fetchEdgeTypes();
- /*
- // init D3 force layout
- var force = d3.layout.force()
- .nodes(nodes)
- .links(links)
- .size([width, height])
- .gravity(.05)
- .linkDistance(150)
- .linkStrength(2)
- .charge(-500)
- .on('tick', tick);
- // define arrow markers for graph links
- svg.append('svg:defs').append('svg:marker')
- .attr('id', 'end-arrow')
- .attr('viewBox', '0 -5 10 10')
- .attr('refX', 6)
- .attr('markerWidth', 3)
- .attr('markerHeight', 3)
- .attr('orient', 'auto')
- .append('svg:path')
- .attr('d', 'M0,-5L10,0L0,5')
- .attr('fill', '#000');
- svg.append('svg:defs').append('svg:marker')
- .attr('id', 'start-arrow')
- .attr('viewBox', '0 -5 10 10')
- .attr('refX', 4)
- .attr('markerWidth', 3)
- .attr('markerHeight', 3)
- .attr('orient', 'auto')
- .append('svg:path')
- .attr('d', 'M10,-5L0,0L10,5')
- .attr('fill', '#000');
- // line displayed when dragging new nodes
- var drag_line = svg.append('svg:path')
- .attr('class', 'link dragline hidden')
- .attr('d', 'M0,0L0,0');
- // handles to link and node element groups
- //(1)var path = svg.append('svg:g').selectAll('g')
- var path = svg.append('svg:g').selectAll('g'),
- circle = svg.append('svg:g').selectAll('g');
- */
- // mouse event vars
- var selected_node = null,
- selected_link = null,
- mousedown_link = null,
- mousedown_node = null,
- mouseup_node = null;
- function resetMouseVars() {
- mousedown_node = null;
- mouseup_node = null;
- mousedown_link = null;
- }
- // update force layout (called automatically each iteration)
- function tick() {
- // draw directed edges with proper padding from node centers
- path.selectAll('path').attr('d', function (d) {
- var deltaX = d.target.x - d.source.x,
- deltaY = d.target.y - d.source.y,
- dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY),
- normX = deltaX / dist,
- normY = deltaY / dist,
- sourcePadding = d.left ? 27 : 22,
- targetPadding = d.right ? 27 : 22,
- sourceX = d.source.x + (sourcePadding * normX),
- sourceY = d.source.y + (sourcePadding * normY),
- targetX = d.target.x - (targetPadding * normX),
- targetY = d.target.y - (targetPadding * normY);
- return 'M' + sourceX + ',' + sourceY + 'L' + targetX + ',' + targetY;
- });
- circle.attr('transform', function (d) {
- return 'translate(' + d.x + ',' + d.y + ')';
- });
- }
- // update graph (called when needed)
- function restart() {
- //绑定link 数据
- path.datum(links);
- // path (link) group
- path = path.data(links, function (d) { return d.id; });
- var p = path.enter().append('svg:g');
- //update existing links
- path.selectAll('path').classed('selected', function (d) { return d === selected_link; })
- .style('marker-start', function (d) { return d.left ? 'url(#start-arrow)' : ''; })
- .style('marker-end', function (d) { return d.right ? 'url(#end-arrow)' : ''; });
- // add new links
- p.append('svg:path')
- .attr('class', 'link')
- .attr('id', function (d) { return "path_" + d.id; })
- // .attr('startOffset', '0%')
- .classed('selected', function (d) { return d === selected_link; })
- .style('marker-start', function (d) { return d.left ? 'url(#start-arrow)' : ''; })
- .style('marker-end', function (d) { return d.right ? 'url(#end-arrow)' : ''; })
- .on('mousedown', function (d) {
- if (d3.event.ctrlKey) return;
- //去除没有提交的连线
- for (var i = 0; i < links.length; i++) {
- if (links[i].id == -1 && d.id != -1) {
- links.splice(i, 1);
- }
- }
- // select link
- mousedown_link = d;
- if (mousedown_link === selected_link) {
- selected_link = $scope.selected_link = null;
- selected_node = $scope.selected_node = null;
- // d3.select("#linkDetail").attr('style','display:none');
- //hideLinkForm(true);//return ;
- } else {
- selected_link = $scope.selected_link = mousedown_link;
- selected_node = $scope.selected_node = null;
- }
- selected_node = $scope.selected_node = null;
- restart();
- });
- p.append('svg:text')
- .attr('x', 30)
- .attr('y', 20)
- .attr('class', 'fontM')
- .append('textPath')
- .attr('xlink:xlink:href', function (d, i) { return "#path_" + d.id; })
- .html(function (d) {
- for (var i = 0; i < linkType.length; i++) {
- if (linkType[i].type == d.name) {
- return linkType[i].label;
- }
- }
- });
- // remove old links
- path.exit().remove();
- // circle (node) group
- // NB: the function arg is crucial here! nodes are known by id, not by index!
- circle.datum(nodes);
- circle = circle.data(nodes, function (d) { return d.id; });
- // update existing nodes (reflexive & selected visual states)
- circle.selectAll('circle')
- .style('fill', function (d) { return (d === selected_node) ? d3.rgb(colors(d.label)).brighter().toString() : colors(d.label); })
- .style('fill-opacity', 0.75) // add by xi
- .classed('reflexive', function (d) { return d.reflexive; });
- // add new nodes
- var g = circle.enter().append('svg:g');
- //g.append('svg:circle').attr('r',22).style('fill','rgb(255,255,255)').style('stroke','rgb(255,255,255)').style('stroke-width','2');
- //g.append('svg:circle').attr('r',24).style('fill','rgb(255,255,255)').style('stroke', function(d) { return d3.rgb(colors(d.label)).darker().toString(); }).style('stroke-width','2');
- g.append('svg:circle').attr('r', 24).style('fill', function (d) { return (d === selected_node) ? 'rgb(153,153,153)' : 'rgb(255,255,255)'; }).style('stroke', function (d) { return d3.rgb(colors(d.label)).darker().toString(); }).style('stroke-width', '2');
- g.append('svg:circle')
- .attr('class', 'node')
- .attr('r', 18)
- .style('fill', function (d) { return (d === selected_node) ? d3.rgb(colors(d.label)).brighter().toString() : colors(d.label); })
- .style('stroke', function (d) { return d3.rgb(colors(d.label)).darker().toString(); })
- .style('fill-opacity', 0.25) //add by xj
- .style('stroke-opacity', 0.5) //add by xj
- .classed('reflexive', function (d) { return d.reflexive; });
- g.on('mouseover', function (d) {
- //if(!mousedown_node || d === mousedown_node) return;
- // enlarge target node
- //d3.select(this).attr('transform', 'scale(1.1)');
- })
- .on('mouseout', function (d) {
- //if(!mousedown_node || d === mousedown_node) return;
- // unenlarge target node
- //d3.select(this).attr('transform', '');
- })
- .on('mousedown', function (d) {
- if (d3.event.ctrlKey) return;
- //hideLinkForm(true);
- //去除没有提交的连线
- for (var i = 0; i < links.length; i++) {
- if (links[i].id == -1) {
- links.splice(i, 1);
- }
- }
- // select node
- mousedown_node = d;
- if (mousedown_node === selected_node) {
- selected_node = $scope.selected_node = null;
- } else {
- selected_node = $scope.selected_node = mousedown_node;
- selected_link = $scope.selected_link = null;
- // 点击节点 查询关系及节点 /traversal/{id}/{relation}
- APIService.findRefById(selected_node.id).then(function (result) {
- var d = result.data;
- var node = d.node;
- var link = d.edge;
- var tempNode = [];
- var tempLink = [];
- //nodes 或者links 要去重
- for (var i = 0; i < node.length; i++) {
- var tmp = 0;
- for (var j = 0; j < nodes.length; j++) {
- if (node[i].id == nodes[j].id) {
- tmp++;
- break;
- }
- }
- if (tmp == 0) {
- tempNode.push(node[i]);
- }
- }
- for (var i = 0; i < link.length; i++) {
- var tmp = 0;
- for (var j = 0; j < links.length; j++) {
- if (link[i].id == links[j].id) {
- tmp++;
- break;
- }
- }
- if (tmp == 0) {
- tempLink.push(link[i]);
- }
- }
- //数据写入页面
- for (var i = 0; i < tempNode.length; i++) { //nodes 不清空
- nodes.push(tempNode[i]);
- }
- for (var i = 0; i < tempLink.length; i++) { //link 不清空
- links.push(tempLink[i]);
- }
- //links转换
- for (var i = 0; i < links.length; i++) {
- for (var j = 0; j < nodes.length; j++) {
- if (links[i].source == nodes[j].id) {
- links[i].source = nodes[j];
- }
- if (links[i].target == nodes[j].id) {
- links[i].target = nodes[j];
- }
- }
- }
- restart();
- });
- }
- // reposition drag line
- drag_line
- .style('marker-end', 'url(#end-arrow)')
- .classed('hidden', false)
- .attr('d', 'M' + mousedown_node.x + ',' + mousedown_node.y + 'L' + mousedown_node.x + ',' + mousedown_node.y);
- restart();
- })
- .on('mouseup', function (d) {
- if (!mousedown_node) return;
- });
- // show node name
- g.append('svg:text')
- .attr('x', 0)
- .attr('y', 34)
- .attr('class', 'id')
- .text(function (d) { return d.name; }); //TODO 改为 d.name
- //设置图片
- g.append('svg:foreignObject')
- .attr("width", 32)
- .attr("height", 32)
- .attr('x', "-16px")
- .attr('y', "-11px")
- .html(function (d) {
- for (var i = 0; i < labels.length; i++) {
- if (d.label == labels[i].sign) {
- return '<i class="icon iconfont">' + labels[i].iconname + '</i>';
- }
- }
- });
- // remove old nodes
- circle.exit().remove();
- // set the graph in motion
- force.start();
- }
- function mousedown() {
- // prevent I-bar on drag
- //d3.event.preventDefault();
- // because :active only works in WebKit?
- svg.classed('active', true);
- if (mousedown_node) {
- viewNode(mousedown_node);
- }
- if (d3.event.ctrlKey || mousedown_node || mousedown_link) return;
- restart();
- }
- function mousemove() {
- if (!mousedown_node) return;
- // update drag line
- //drag_line.attr('d', 'M' + mousedown_node.x + ',' + mousedown_node.y + 'L' + d3.mouse(this)[0] + ',' + d3.mouse(this)[1]);
- //restart();
- }
- function mouseup() {
- if (mousedown_node) {
- // hide drag line
- drag_line
- .classed('hidden', true)
- .style('marker-end', '');
- }
- // because :active only works in WebKit?
- svg.classed('active', false);
- // clear mouse event vars
- resetMouseVars();
- }
- function spliceLinksForNode(node) {
- var toSplice = links.filter(function (l) {
- return (l.source === node || l.target === node);
- });
- toSplice.map(function (l) {
- links.splice(links.indexOf(l), 1);
- });
- }
- // only respond once per keydown
- var lastKeyDown = -1;
- function keydown() {
- //d3.event.preventDefault();
- if (lastKeyDown !== -1) return;
- lastKeyDown = d3.event.keyCode;
- // ctrl
- if (d3.event.keyCode === 17) {
- circle.call(force.drag);
- svg.classed('ctrl', true);
- }
- if (!selected_node && !selected_link) return;
- switch (d3.event.keyCode) {
- case 8: // backspace
- case 66: // B
- if (selected_link) {
- // set link direction to both left and right
- selected_link.left = true;
- selected_link.right = true;
- }
- restart();
- break;
- case 76: // L
- if (selected_link) {
- // set link direction to left only
- selected_link.left = true;
- selected_link.right = false;
- }
- restart();
- break;
- case 82: // R
- if (selected_node) {
- // toggle node reflexivity
- selected_node.reflexive = !selected_node.reflexive;
- } else if (selected_link) {
- // set link direction to right only
- selected_link.left = false;
- selected_link.right = true;
- }
- restart();
- break;
- }
- }
- function keyup() {
- lastKeyDown = -1;
- // ctrl
- if (d3.event.keyCode === 17) {
- circle
- .on('mousedown.drag', null)
- .on('touchstart.drag', null);
- svg.classed('ctrl', false);
- }
- }
- function viewNode(node) {
- console.log(svg.attr('left'));
- //var el = angular.element('div.modal-dialog')[0];
- var title = $scope.selected_node.name + "-[" + $scope.selected_node.uuid + "]";
- if (!$scope.selected_node.props.state) { $scope.selected_node.props.state = "空" } else if ($scope.selected_node.props.state) {
- if ($scope.selected_node.props.state == "1") { $scope.selected_node.props.state = "未审核" } else if ($scope.selected_node.props.state == "2") { $scope.selected_node.props.state = "已审核" } else if ($scope.selected_node.props.state == "3") { $scope.selected_node.props.state = "不匹配" } else if ($scope.selected_node.props.state == "4") { $scope.selected_node.props.state = "丢失" }
- };
- if (!$scope.selected_node.name) { $scope.selected_node.name = "空" }
- if (!$scope.selected_node.status) { $scope.selected_node.statu = "空" }
- if (!$scope.selected_node.props.useradmin) { $scope.selected_node.props.useradmin = "空" }
- Toaster.pop({
- // type: 'info',
- // title: title,
- body: '<br/><p>搜索代码:' + $scope.selected_node.uuid + '</p>' +
- '<p>配置标题:' + $scope.selected_node.name + '</p>' +
- '<p>状态:' + $scope.selected_node.status + '</p>' +
- '<p>审核状态:' + $scope.selected_node.props.state + '</p>' +
- '<p>维护人员:' + $scope.selected_node.props.useradmin + '</p>',
- bodyOutputType: 'trustedHtml',
- timeout: 3000
- })
- }
- //GT 颜色与数值对照表
- function colors(sign) {
- //num=num>20?num%20:parseInt(num);
- for (var i = 0; i < labels.length; i++) {
- var entity = labels[i];
- if (sign == entity.sign) {
- return entity.color;
- }
- if (i == labels.length - 1 && sign != entity.sign) {
- return '#ffeeee';
- }
- }
- }
- $scope.init = function () {
- svg = d3.select('#cmdbSVG').append('svg').attr('width', width).attr('height', height);
- // init D3 force layout
- force = d3.layout.force()
- .nodes(nodes)
- .links(links)
- .size([width, height])
- .gravity(.05)
- .linkDistance(150)
- .linkStrength(2)
- .charge(-500)
- .on('tick', tick);
- // define arrow markers for graph links
- svg.append('svg:defs').append('svg:marker')
- .attr('id', 'end-arrow')
- .attr('viewBox', '0 -5 10 10')
- .attr('refX', 6)
- .attr('markerWidth', 3)
- .attr('markerHeight', 3)
- .attr('orient', 'auto')
- .append('svg:path')
- .attr('d', 'M0,-5L10,0L0,5')
- .attr('fill', '#000');
- svg.append('svg:defs').append('svg:marker')
- .attr('id', 'start-arrow')
- .attr('viewBox', '0 -5 10 10')
- .attr('refX', 4)
- .attr('markerWidth', 3)
- .attr('markerHeight', 3)
- .attr('orient', 'auto')
- .append('svg:path')
- .attr('d', 'M10,-5L0,0L10,5')
- .attr('fill', '#000');
- // line displayed when dragging new nodes
- drag_line = svg.append('svg:path')
- .attr('class', 'link dragline hidden')
- .attr('d', 'M0,0L0,0');
- // handles to link and node element groups
- //(1)var path = svg.append('svg:g').selectAll('g')
- path = svg.append('svg:g').selectAll('g');
- circle = svg.append('svg:g').selectAll('g');
- svg.on('mousedown', mousedown)
- .on('mousemove', mousemove)
- .on('mouseup', mouseup);
- d3.select(window)
- .on('keydown', keydown)
- .on('keyup', keyup);
- }
- var CI = {};
- window.CI = CI;
- $scope.ok = function () {
- $modalInstance.close($scope.selected_node);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: size,
- resolve: {
- title: function () {
- return options.templateOptions.title;
- },
- Restangular: function () {
- return options.templateOptions.Restangular;
- },
- APIService: function () {
- return options.templateOptions.ApiService;
- },
- ConfigDataService: function () {
- return options.templateOptions.ConfigDataService;
- },
- ConfigFormService: function () {
- return options.templateOptions.ConfigFormService;
- },
- SweetAlert: function () {
- return options.templateOptions.Alert;
- },
- Toaster: function () {
- return options.templateOptions.toaster;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- options.value(selectedItem.name + '-' + selectedItem.uuid);
- }, function () {
- //console.log('Modal dismissed at: ' + new Date());
- });
- }
- }
- }
- },
- controller: ['$scope', function ($scope) {
- // setTimeout(function(){
- // $scope.options.templateOptions.getWorkernumber($scope.options.templateOptions.ApiService).then(function(result){
- // var modelData = $scope.options.templateOptions.Restangular.stripRestangular(result);
- // if(modelData.status==200){
- // $scope.model[$scope.options.key] = modelData.data;
- // $scope.options.initialValue = $scope.model[$scope.options.key];
- // }
- // });
- // },1000);
- }]
- });
- });
- appFormly.run(function (formlyConfig, $parse) {
- //formlyConfig.extras.fieldTransform=formlyConfig.extras.fieldTransform||[];
- var removeOnHideTransformer = function (fields, model) {
- return fields.map(function (field) {
- if (field.hideExpression && (!field.data || !field.data.dontRemoveOnHidden)) {
- addFieldRemoveOnHideWatcher(field);
- }
- if (field.type == "ui-title") {
- addFieldRemoveOnHideWatcher(field);
- }
- return field;
- });
- };
- formlyConfig.extras.fieldTransform = removeOnHideTransformer;
- function addFieldRemoveOnHideWatcher(field) {
- var watcher = getWatcher();
- if (field.watcher) {
- if (!angular.isArray(field.watcher)) {
- field.watcher = [field.watcher];
- }
- field.watcher.push(watcher);
- } else {
- field.watcher = watcher;
- }
- }
- function getWatcher() {
- return {
- expression: function (field) {
- return field.hide;
- },
- listener: function (field, newHide, oldHide, scope) {
- if (field.hide) {
- if (field.templateOptions.pkey) {
- if (field.key == 'transferuser') {
- $parse(field.templateOptions.pkey + "." + field.key).assign(scope.model, undefined);
- }
- } else {
- $parse(field.key).assign(scope.model, undefined);
- }
- }
- if (field.type == "ui-title") {
- $parse(field.key).assign(scope.model, undefined);
- }
- }
- };
- }
- });
- appFormly.controller('customFormIndexCtrl', ['$rootScope', '$scope', '$parse', '$injector', '$http', '$q', '$state', '$stateParams', '$timeout', '$interval', '$ionicPopup', 'FileUploader', 'Restangular', 'UserRestangular', 'BpmRestangular', 'api_configure_form', 'api_bpm_domain', 'api_bpm_data', 'api_user_data', 'WechatRestangular',
- function ($rootScope, $scope, $parse, $injector, $http, $q, $state, $stateParams, $timeout, $interval, $ionicPopup, FileUploader, Restangular, UserRestangular, BpmRestangular, api_configure_form, api_bpm_domain, api_bpm_data, api_user_data, WechatRestangular) {
- //console.log($parse('Restangular')($scope));
- //console.log($injector.get('Restangular'));
- //console.log($stateParams);
- // console.log('customFormIndexCtrl is loading');
- // alert(location.href);
- var vm = this;
- // $scope.vm = vm;
- vm.options = {};
- vm.exampleTitle = ['expressionProperties', 'model property'];
- vm.fields = [];
- vm.model = {};
- // $scope.langs = i18nService.getAllLangs();
- // $scope.lang = 'zh-cn';
- // i18nService.setCurrentLang($scope.lang);
- //alert($rootScope.user.id,null,2);
- //获取login中的数据
- var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
- var loginUser = sessionLogin.user;
- $rootScope.user = loginUser;
- // angular.extend(loginUser, {
- // areaDTO: {
- // 'area': '西区',
- // 'id': 3
- // },
- // placeDTO: {
- // 'place': '西区',
- // 'id': 5
- // },
- // houseNumber: 103,
- // mphone: '123456789'
- // });
- // vm.model["loginUser"] = $rootScope.user;
- // vm.model["loginUser"] = loginUser;
- var that = $injector;
- var parse = $parse;
- var formKey = "";
- var pdKey = "";
- var modelWatch = "";
- $scope.goBack = function () {
- history.go(-1);
- };
- if (angular.isDefined($stateParams.model) && $stateParams.model != "") {
- modelWatch = JSON.parse($stateParams.model);
- // console.log("modelWatch:"+ JSON.stringify(modelWatch));
- }
- if (angular.isDefined($state.current.pdKey) && $state.current.pdKey != "") {
- pdKey = $state.current.pdKey;
- } else if ($stateParams.pdKey) {
- pdKey = $stateParams.pdKey;
- }
- // console.log("pdKey::" + JSON.stringify($state.current.title));
- if (angular.isDefined($stateParams.formKey) && $stateParams.formKey != "") {
- formKey = $stateParams.formKey;
- // console.log("formKey::"+JSON.stringify($stateParams.formKey));
- }
- if (angular.isDefined($stateParams.model)) {
- var formModel = $stateParams.model;
- }
- //用户测试数据,后续从header的auth中获取
- // var userId = 2;
- var userId = $rootScope.user.id;
- // userId = loginUser.id;
- //==============处理表单设计数据 开始====================
- //处理组件加载后台数据选项的方法
- // function refreshSelectOptions(searchVal, field) {
- // if (field.templateOptions.optionsUrl) {
- // var process = BpmRestangular.all("");
- // if (field.templateOptions.ApiService) {
- // process = UserRestangular.all("");
- // }
- // process.customPOST({ "idx": 0, "sum": 1000 }, field.templateOptions.optionsUrl).then(function(result) {
- // if (!field.templateOptions.options) {
- // field.templateOptions.options = [];
- // }
- // if (field.templateOptions.optionsDataKey) {
- // field.templateOptions.options = result[field.templateOptions.optionsDataKey];
- // // field.selectLists = result[field.templateOptions.optionsDataKey];
- // // var lists = result[field.templateOptions.optionsDataKey];
- // // field.templateOptions.list = lists[0].name;
- // } else {
- // field.templateOptions.options = result;
- // }
- // });
- // }
- // }
- function refreshSelectOptions(searchVal, field) {
- if (field.templateOptions.optionsUrl) {
- var process = BpmRestangular.all("");
- if (field.templateOptions.ApiService) {
- process = UserRestangular.all("");
- }
- if (field.templateOptions.Apicommon) {
- process = WechatRestangular.all("");
- }
- var datakey = { "idx": 0, "sum": 1000 };
- if (field.templateOptions.modelreasondata) {
- datakey = field.templateOptions.modelreasondata
- }
- if (field.templateOptions.userSelect) {
- angular.extend(datakey, field.templateOptions.userSelect);
- }
- process.customPOST(datakey, field.templateOptions.optionsUrl).then(function (result) {
- if (!field.templateOptions.options) {
- field.templateOptions.options = [];
- }
- if (field.templateOptions.optionsDataKey) {
- field.templateOptions.options = result[field.templateOptions.optionsDataKey];
- } else {
- field.templateOptions.options = result;
- }
- });
- }
- }
- //解析自定义表单设计数据
- function decodeVMForm(vmForm) {
- var result = { model: {}, fields: [] };
- //设置模型实体数据 begin
- // var mdata = vmForm.model;
- //解析数据实体
- var mdata = angular.fromJson(vmForm.model); //JSON.parse(field.extjson);
- angular.extend(result.model, mdata);
- if (modelWatch != null && modelWatch != '') {
- //angular.extend(result.model.incident,modelWatch.incident);
- //result.model.alarmType = modelWatch.alarmType;
- // vmForm.cancelUrl = modelWatch.cancelUrl;
- console.log(modelWatch.cancelUrl)
- for (var index in modelWatch.model) {
- //console.log(JSON.stringify(index+" " +JSON.stringify( modelWatch.model[index])));
- if (result.model[index] != null) {
- angular.extend(result.model[index], modelWatch.model[index]);
- } else {
- result.model[index] = modelWatch.model[index];
- }
- }
- }
- //设置模型实体数据 end
- //解析设计数据生成表单项 begin
- var fields = [];
- //处理修改设计数据中展示设置
- angular.forEach(vmForm.fields, function (field) {
- if (field.key == "") {
- delete field.key;
- }
- if (angular.isDefined(field.extjson)) {
- var extObj = angular.fromJson(field.extjson); //JSON.parse(field.extjson);
- angular.extend(field.templateOptions, extObj.templateOptions);
- delete extObj.templateOptions;
- for (var prop in extObj) {
- if (new RegExp("Expression").test(prop)) {
- //var obj = $scope.$eval(extObj[prop]);
- //extObj[prop] = $scope.$eval(extObj[prop]);
- if (extObj[prop] != null) {
- if (new RegExp("function").test(extObj[prop])) {
- var propValue = eval(extObj[prop]);
- extObj[prop] = propValue;
- } else {
- //console.log(extObj[prop]);
- var obj = $scope.$eval(extObj[prop]);
- extObj[prop] = obj;
- //console.log(obj);
- }
- }
- } else if (new RegExp("expressionProperties").test(prop)) {
- for (var p in extObj[prop]) {
- if (new RegExp("function").test(extObj[prop][p])) {
- var propValue = eval(extObj[prop][p]);
- extObj[prop][p] = propValue;
- } else {
- //if(p.indexOf("'")>=0){
- // var obj = $scope.$eval(extObj[prop][p]);
- // extObj[prop][$scope.$eval(p)]=obj;
- //}
- }
- }
- } else if ("watcher" == prop) {
- if (angular.isArray(extObj[prop])) {
- angular.forEach(extObj[prop], function (item, index) {
- for (var p in item) {
- if (new RegExp("function").test(item[p])) {
- var propValue = eval(item[p]);
- extObj[prop][index][p] = propValue;
- }
- }
- });
- } else if (angular.isObject(extObj[prop])) {
- for (var p in extObj[prop]) {
- if (new RegExp("function").test(extObj[prop][p])) {
- var propValue = eval(extObj[prop][p]);
- extObj[prop][p] = propValue;
- }
- }
- }
- }
- }
- angular.extend(field, extObj);
- delete field.extjson;
- }
- if (angular.isDefined(field.templateOptions)) {
- var templateOs = field.templateOptions;
- for (var property in templateOs) {
- //console.log(angular.isString(templateOs[property]) +" "+property + " " + (!(new RegExp("[\u4e00-\u9fa5]").test(templateOs[property]))));
- if (angular.isString(templateOs[property])) { //&& !(new RegExp("[\u4e00-\u9fa5]").test(templateOs[property]))
- if (new RegExp("function").test(templateOs[property])) {
- var propValue = eval(templateOs[property]);
- field.templateOptions[property] = propValue;
- } else {
- if (that.has(templateOs[property])) {
- field.templateOptions[property] = that.get(templateOs[property]);
- } else {
- field.templateOptions[property] = templateOs[property];
- }
- }
- } else if (templateOs[property] == null) {
- //delete field.templateOptions[property];
- } else { }
- }
- }
- console.log(field);
- if (angular.isDefined(field.templateOptions) && angular.isDefined(field.templateOptions.extjson)) {
- var extObj = angular.fromJson(field.templateOptions.extjson); //JSON.parse(field.extjson);
- angular.extend(field.templateOptions, extObj);
- delete field.templateOptions.extjson;
- }
- // ...
- if (field.templateOptions) {
- //处理远程获取数据控件方法调用
- if (field.templateOptions.optionsUrl) {
- field.templateOptions.refresh = refreshSelectOptions;
- }
- //事件脚本处理
- // if(field.templateOptions.ngChangeScript){
- // if(!field.expressionProperties)field.expressionProperties={};
- // field.expressionProperties.ngChange = function(modelVal,viewVal,ev){
- //// console.log(ev);
- //// console.log("change>>"+ev.options.key);
- // eval(field.templateOptions.ngChangeScript);
- // }
- // }
- // if(field.templateOptions.ngClickScript){
- // if(!field.expressionProperties)field.expressionProperties={};
- // field.expressionProperties.ngClick = function(modelVal,viewVal,ev){
- //// console.log(ev);
- //// console.log("click>>"+ev.options.key);
- // eval(field.templateOptions.ngClickScript);
- // }
- // }
- //处理嵌套属性数据绑定/
- if (field.templateOptions.pkey) {
- var pmodel, i = 0;
- angular.forEach(field.templateOptions.pkey.split("."), function (p) {
- if (i == 0) {
- if (result.model[p] == null) {
- result.model[p] = {};
- }
- pmodel = result.model[p];
- i++;
- } else {
- if (pmodel[p] == null) {
- pmodel[p] = {};
- }
- pmodel = pmodel[p];
- }
- });
- if (pmodel != null) {
- field.model = pmodel;
- if (pmodel[field.key] == null) {
- pmodel[field.key] = null;
- }
- }
- } else {
- if (result.model[field.key] == null) {
- result.model[field.key] = null;
- }
- }
- //处理弹出框组件初始化
- if (field.type == "ui-input-selectmodal") {
- // field.templateOptions.modal = $modal;
- //field.templateOptions.Restangular = Restangular;
- } else if (field.type == "ui-requesterselect") {
- //field.templateOptions.language = $scope.lang;
- // field.templateOptions.modal = $modal;
- field.templateOptions.UserService = api_user_data;
- } else if (field.type == "ui-userselect") {
- // field.templateOptions.modal = $modal;
- //field.templateOptions.Restangular = Restangular;
- } else if (field.type == "ui-multiuserselect") {
- // field.templateOptions.modal = $modal;
- } else if (field.type == "ui-search") {
- // field.templateOptions.modal = $modal;
- } else if (field.type == "ui-modelselect") {
- // field.templateOptions.modal = $modal;
- //console.log("$rootScope.user:" + JSON.stringify($rootScope.user));
- field.templateOptions.loginUser = $rootScope.user;
- //field.templateOptions.Restangular = Restangular;
- } else if (field.type == "ui-incidentmodelselect") {
- // field.templateOptions.modal = $modal;
- //console.log("$rootScope.user:" + JSON.stringify($rootScope.user));
- // field.templateOptions.loginUser = $rootScope.user;
- //field.templateOptions.Restangular = Restangular;
- } else if (field.type == "ui-dropfile") {
- $scope.fileUploader = field.templateOptions.fileUploader = new FileUploader({
- url: '/uploader'
- });
- field.templateOptions.taskId = $stateParams.taskId;
- field.templateOptions.processInstanceId = $stateParams.processInstanceId;
- field.templateOptions.userId = $rootScope.user.id;
- } else if (field.type == "ui-areaplace") {
- field.templateOptions.userId = $rootScope.user.id;
- } else if (field.type == "ui-dropfielknow") {
- $scope.fileUploader = field.templateOptions.fileUploader = new FileUploader({
- url: '/uploader'
- });
- field.templateOptions.taskId = $stateParams.taskId;
- field.templateOptions.processInstanceId = $stateParams.processInstanceId;
- field.templateOptions.userId = $rootScope.user.id;
- } else if (field.type == "ui-dropfilenotup") {
- $scope.fileUploader = field.templateOptions.fileUploader = new FileUploader({
- url: '/uploader'
- });
- field.templateOptions.taskId = $stateParams.taskId;
- field.templateOptions.processInstanceId = $stateParams.processInstanceId;
- field.templateOptions.userId = $rootScope.user.id;
- //field.ApiService=api_bpm_domain;
- } else if (field.type == "ui-dropfiletable") {
- if (field.templateOptions.processInstanceId) {
- } else {
- field.templateOptions.processInstanceId = $stateParams.processInstanceId;
- }
- } else if (field.type == "ui-repeatSection") {
- var repeatForm = {
- model: {
- },
- fields: field.templateOptions.fields
- };
- repeatForm.model[field.key] = [];
- decodeVMForm(repeatForm);
- } else if (field.type == "ui-currentuser") {
- field.templateOptions.user = vm.model["loginUser"];
- // field.templateOptions.user = $rootScope.user;
- }
- }
- // console.log(field);
- result.fields.push(field);
- });
- angular.extend($scope.vm.fields, result.fields);
- angular.extend($scope.vm.model, result.model);
- // console.log("$scope.vm.model="+JSON.stringify($scope.vm.model));
- vm.model["loginUser"] = $rootScope.user;
- if (modelWatch != null && modelWatch != '' && modelWatch.cancelUrl != null && modelWatch.cancelUrl != '') {
- vmForm.cancelUrl = modelWatch.cancelUrl;
- }
- $scope.formData = vmForm;
- // console.log("$scope.formData="+JSON.stringify($scope.formData.url));
- if ($scope.formData.url == "start") {
- $scope.Reset = true;
- $scope.close = false;
- } else if ($scope.formData.url == "complete") {
- $scope.Reset = false;
- $scope.close = true;
- }
- //解析设计数据生成表单项 end
- return result;
- }
- //======================处理表单设计数据 结束========================
- $scope.ldloading = {};
- function filter(obj) {
- angular.forEach(obj, function (key, value) {
- if (value === "" || value === null) {
- delete obj[key];
- } else if (Object.prototype.toString.call(value) === '[object Object]') {
- filter(value);
- } else if (angular.isArray(value)) {
- angular.forEach(value, function (item) {
- filter(item);
- });
- }
- });
- }
- $scope.closeModel = function () {
- // console.log("pdKey="+pdKey);
- // if ($stateParams.pdKey) {
- // pdKey = $stateParams.pdKey;
- // }
- if (pdKey == "bpm_incident") {
- $state.go('app.incidentMobile.incidentListMobile', {});
- } else if (pdKey == "bpm_change") {
- $state.go('app.change.list', {});
- } else if (pdKey == "bpm_problem") {
- $state.go('app.problem.list', {});
- } else if (pdKey == "bpm_release") {
- $state.go('app.release.list', {});
- } else if (pdKey == "bpm_schedule") {
- $state.go('app.scheduling.list', {});
- } else if (pdKey == "bpm_configure") {
- $state.go('app.cmdb.plist', {});
- } else if (pdKey == "bpm_reService") {
- $state.go('app.reService.manager', {});
- } else if (pdKey == "inspectionListForm") {
- $state.go('app.inspection.inspectList', {});
- } else if (pdKey == "bpm_inspection") {
- $state.go('app.inspection.inspectList', {});
- } else if (pdKey == "bpm_service_request") {
- $state.go('app.reService.manager', {});
- }
- event.preventDefault();
- };
- $scope.save = function (data) {
- api_bpm_domain.save($stateParams.taskId, data).then(function (response) {
- if (response) {
- var resData = Restangular.stripRestangular(response);
- // SweetAlert.swal({
- // title: "暂存成功!",
- // confirmButtonColor: "#007AFF"
- // }, function() {
- // $state.go($scope.formData.cancelUrl);
- // });
- $ionicPopup.alert({
- title: '暂存成功!',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- // $state.go($scope.formData.cancelUrl);
- });
- } else {
- // SweetAlert.swal({
- // title: "系统错误",
- // text: "系统错误,请稍后重试!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- $ionicPopup.alert({
- title: '系统错误!',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- // $state.go($scope.formData.cancelUrl);
- });
- }
- });
- event.preventDefault();
- }
- $scope.click = false;
- vm.submit = function (data, style) {
- // var pdKey = $stateParams.pdKey;
- if ($scope.click) return;
- if (vm.model.bpm_activiti && (vm.model.bpm_activiti == {} || !vm.model.bpm_activiti.solutionType)) {
- delete vm.model.bpm_activiti;
- }
- if (vm.model.upgradeAuditor) {
- vm.model.examine.upgradeAuditor = vm.model.upgradeAuditor;
- delete vm.model.upgradeAuditor;
- }
- if (vm.model.examine && (vm.model.examine == {} || !vm.model.examine.upgradeAuditor)) {
- delete vm.model.examine;
- }
- // 重新指派必填
- if ($scope.formData.name == 'transferform_weChat' && vm.model.isHandler && !vm.model.assignee) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '指派人未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if ($scope.formData.name == 'transferform_weChat' && !vm.model.isHandler && !vm.model.incident.candidateGroup) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '指派人工作组未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- // 待处理必填
- if ($scope.formData.name == 'handlerform_weChat' && !vm.model.incident.handleCategory) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '处理方式未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if ($scope.formData.name == 'handlerform_weChat' && !vm.model.incident.closecode.id) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '结果类型未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if ($scope.formData.name == 'handlerform_weChat' && !vm.model.incident.handleResult) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '处理结果未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if ($scope.formData.name == 'handlerform_weChat' && !vm.model.incident.reason.id) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '故障原因未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if ($scope.formData.name == 'handlerform_weChat' && vm.model.handler_code == "forward" && !vm.model.incident.handlerUser.id) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '转派对象未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if ($scope.formData.name == 'handlerform_weChat' && vm.model.handler_code == "function" && (!vm.model.examine || vm.model.examine == {} || !vm.model.examine.upgradeAuditor)) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '审核人未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- // 已解决必填
- if ($scope.formData.name == 'closeform_weChat' && !vm.model.incident.closecode.id) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '结果类型未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if ($scope.formData.name == 'closeform_weChat' && !vm.model.isclose) {
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: '是否已解决未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- return;
- }
- if (vm.form.$valid) {
- // $scope.ldloading[style.replace('-', '_')] = true;
- // if($scope.ldloading[style.replace('-', '_')] == true){$scope.lng=true}
- // console.log("vm.options:"+ JSON.stringify(vm.options));
- vm.options.updateInitialValue();
- // console.log("dfjkasdhfkhskjf ")
- var _ = window._;
- vm.model = (function filter(obj) {
- var dateTransKeys = [];
- var filtered = _.pick(obj, function (v, k, obj) {
- if (_.isDate(v)) {
- dateTransKeys.push(k);
- }
- return angular.isDefined(v) && v !== null && (angular.isArray(v) ? v.length > 0 : true) && (_.isPlainObject(v) ? (!_.isEmpty(v)) : true);
- });
- return _.cloneDeep(filtered, function (v, index, object) {
- if (angular.isArray(dateTransKeys) && dateTransKeys.length > 0) {
- angular.forEach(dateTransKeys, function (item) {
- v[item] = moment(v[item]).format('YYYY-MM-DD HH:mm:ss');
- })
- dateTransKey = [];
- return v;
- }
- return !(_.isEmpty(filtered)) && v !== filtered && _.isPlainObject(v) ? filter(v) : undefined;
- });
- })(vm.model);
- if (pdKey != "") {
- if ($scope.oprcode == "save") { //保存
- api_bpm_domain.save(taskId, vm.model).then(function (response) {
- $scope.click = true;
- if (response) {
- var resData = Restangular.stripRestangular(response);
- // SweetAlert.swal({
- // title: "保存成功!",
- // confirmButtonColor: "#007AFF"
- // }, function() {
- // $state.go($scope.formData.cancelUri);
- // });
- $ionicPopup.alert({
- title: '保存成功!',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- // $state.go($scope.formData.cancelUrl);
- });
- } else {
- // SweetAlert.swal({
- // title: "系统错误",
- // text: "系统错误,请稍后重试!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- $ionicPopup.alert({
- title: '系统错误!',
- okText: '确认'
- })
- }
- // $scope.ldloading[style.replace('-', '_')] = false;
- });
- } else {
- switch ($scope.formData.url) {
- case "start":
- vm.model["initUser"] = $rootScope.user.id;
- if (vm.model["assignee"] || vm.model["candidateGroups"]) {
- } else {
- vm.model["assignee"] = $rootScope.user.id;
- // vm.model["assignee"] = vm.model.incident.handlerUser.id;
- };
- if (pdKey == 'bpm_service_request') {
- delete vm.model.serviceCatalogueProcessActual.houseNumber;
- angular.extend(vm.model.serviceCatalogueProcessActual, {
- 'category': {
- 'id': $stateParams.userId
- }
- });
- };
- if (pdKey == 'weChatApplyStart') {
- if (!vm.model.incident.areaId) {
- $ionicPopup.alert({
- title: '区域未填!',
- okText: '确认'
- })
- } else if (vm.model.incident.areaId && !vm.model.incident.placeId) {
- $ionicPopup.alert({
- title: '地点未填!',
- okText: '确认'
- })
- } else {
- if (vm.model.incident && vm.model.incident.placeId && angular.isObject(vm.model.incident.placeId)) {
- vm.model.incident.placeId = vm.model.incident.placeId.id
- }
- api_bpm_domain.weChatApplyStart('', vm.model).then(function (response) {
- $scope.click = true;
- if (response && response.state == 200) {
- var resData = Restangular.stripRestangular(response);
- if (resData) {
- // console.log("$scope.fileUploader="+$scope.fileUploader)
- if ($scope.fileUploader != null && $scope.fileUploader.getNotUploadedItems().length > 0 && resData.incident.id) {
- //$scope.uploader.options.url();
- $scope.fileUploader.onBeforeUploadItem = function (item) {
- angular.extend(item.headers, {
- 'access-token': sessionLogin.token,
- });
- //微信上传的用的是微信的事件id
- // item.url = api_bpm_domain.saveAttachments(resData.incident.id, '00000', $rootScope.user.id).getRequestedUrl();
- item.url = api_bpm_domain.uploadAttachment(resData.incident.id, '00000', $rootScope.user.id).getRequestedUrl();
- item.formData.push({ 'filename': item.file.name });
- console.log($scope.fileUploader);
- };
- $scope.fileUploader.uploadAll();
- }
- }
- if (resData.bool == "true") {
- $ionicPopup.alert({
- title: '提交成功!',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- });
- } else if (resData.bool == "false") {
- $ionicPopup.alert({
- title: '提交成功!',
- subTitle: '您反馈的问题我们已收到,我们将在工作时间第一时间予以处理。',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- });
- }
- } else {
- // SweetAlert.swal({
- // title: "系统错误",
- // text: "系统错误,请稍后重试!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- $ionicPopup.alert({
- title: '系统错误!',
- okText: '确认'
- })
- }
- // $scope.ldloading[style.replace('-', '_')] = false;
- });
- }
- } else {
- // angular.forEach(vm.fields, function(item) {
- var startsub = true;
- angular.forEach(vm.fields, function (index) {
- if (index.templateOptions.required && !index.hide) {
- if (index.model) {
- if (angular.isDefined(index.model[index.key]) && index.model[index.key] != null) {
- if (index.model[index.key].id && index.model[index.key].id == '') {
- startsub = false;
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: index.templateOptions.label + '未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- } else { }
- } else {
- startsub = false;
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: index.templateOptions.label + '未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- } else {
- if (vm.model[index.key] && vm.model[index.key] != '' && vm.model[index.key] != null) {
- } else {
- startsub = false;
- $scope.ldloading.expand_right = false;
- $ionicPopup.alert({
- title: index.templateOptions.label + '未填',
- text: "请填写此项!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- }
- }
- })
- // })
- if (startsub) {
- // vm.model.incident['requester'] = $rootScope.user;
- vm.model.incident['requester'] = { id: 1 };
- vm.model.incident.wechat = 1;
- api_bpm_domain.start(pdKey, vm.model).then(function (response) {
- $scope.click = true;
- if (response) {
- var resData = Restangular.stripRestangular(response);
- if (resData) {
- // console.log("$scope.fileUploader="+$scope.fileUploader)
- if ($scope.fileUploader != null && $scope.fileUploader.getNotUploadedItems().length > 0 && resData.id) {
- //$scope.uploader.options.url();
- $scope.fileUploader.onBeforeUploadItem = function (item) {
- angular.extend(item.headers, {
- 'access-token': sessionLogin.token,
- });
- //微信处理人上传的用的是流程id
- // angular.extend(item.headers, $rootScope.getSession());
- // item.url = api_bpm_domain.saveAttachments(resData.id, '00000', $rootScope.user.id).getRequestedUrl();
- item.url = api_bpm_domain.uploadAttachment(resData.id, '00000', $rootScope.user.id).getRequestedUrl();
- item.formData.push({ 'fileName': item.file.name });
- //console.log();
- };
- $scope.fileUploader.uploadAll();
- }
- }
- // SweetAlert.swal({
- // title: "提交成功!",
- // confirmButtonColor: "#007AFF"
- // }, function() {
- // $state.go($scope.formData.cancelUrl);
- // });
- $ionicPopup.alert({
- title: '提交成功!',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- // $state.go($scope.formData.cancelUrl);
- });
- } else {
- // SweetAlert.swal({
- // title: "系统错误",
- // text: "系统错误,请稍后重试!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- $ionicPopup.alert({
- title: '系统错误!',
- okText: '确认'
- })
- }
- // $scope.ldloading[style.replace('-', '_')] = false;
- });
- }
- }
- break;
- case "save":
- //weChatApplySave
- vm.model["initUser"] = $rootScope.user.id;
- if (vm.model["assignee"] || vm.model["candidateGroups"]) {
- } else {
- vm.model["assignee"] = $rootScope.user.id;
- };
- if (pdKey == 'bpm_service_request') {
- delete vm.model.serviceCatalogueProcessActual.houseNumber;
- angular.extend(vm.model.serviceCatalogueProcessActual, {
- 'category': {
- 'id': $stateParams.userId
- }
- });
- };
- if (pdKey == 'weChatApplySave') {
- api_bpm_domain.weChatApplySave($stateParams.incidentid, vm.model).then(function (response) {
- $scope.click = true;
- if (response) {
- var resData = Restangular.stripRestangular(response);
- if (resData) {
- if ($scope.fileUploader != null && $scope.fileUploader.getNotUploadedItems().length > 0 && resData.incident.id) {
- $scope.fileUploader.onBeforeUploadItem = function (item) {
- angular.extend(item.headers, {
- 'access-token': sessionLogin.token,
- });
- item.url = api_bpm_domain.saveAttachments(resData.id, '00000', $rootScope.user.id).getRequestedUrl();
- item.url = api_bpm_domain.uploadAttachment(resData.incident.id, '00000', $rootScope.user.id).getRequestedUrl();
- item.formData.push({ 'filename': item.file.name });
- console.log($scope.fileUploader);
- };
- $scope.fileUploader.uploadAll();
- }
- }
- $ionicPopup.alert({
- title: '提交成功!',
- okText: '确认'
- }).then(function (res) {
- history.go(-2);
- // $state.go($scope.formData.cancelUrl);
- });
- } else {
- $ionicPopup.alert({
- title: '系统错误!',
- okText: '确认'
- })
- }
- });
- } else {
- api_bpm_domain.save(pdKey, vm.model).then(function (response) {
- $scope.click = true;
- if (response) {
- var resData = Restangular.stripRestangular(response);
- if (resData) {
- if ($scope.fileUploader != null && $scope.fileUploader.getNotUploadedItems().length > 0 && resData.id) {
- $scope.fileUploader.onBeforeUploadItem = function (item) {
- item.url = api_bpm_domain.uploadAttachment(resData.id, '00000', $rootScope.user.id).getRequestedUrl();
- item.formData.push({ 'filename': item.file.name });
- };
- $scope.fileUploader.uploadAll();
- }
- }
- $ionicPopup.alert({
- title: '提交成功!',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- });
- } else {
- $ionicPopup.alert({
- title: '系统错误!',
- okText: '确认'
- })
- }
- });
- }
- break;
- case "complete":
- //api_bpm_domain.complete(pdKey, userId, vm.model).then(function(response){
- //console.log("complete taskId::"+$stateParams.taskId);
- api_bpm_domain.complete($stateParams.taskId, userId, vm.model).then(function (response) {
- $scope.click = true;
- if (response) {
- var resData = Restangular.stripRestangular(response);
- // SweetAlert.swal({
- // title: "提交成功!",
- // confirmButtonColor: "#007AFF"
- // }, function() {
- // $state.go($scope.formData.cancelUrl);
- // });
- $ionicPopup.alert({
- title: '提交成功!',
- okText: '确认'
- }).then(function (res) {
- history.go(-1);
- // $state.go($scope.formData.cancelUrl);
- });
- } else {
- // SweetAlert.swal({
- // title: "系统错误",
- // text: "系统错误,请稍后重试!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- $ionicPopup.alert({
- title: '系统错误!',
- okText: '确认'
- })
- }
- // $scope.ldloading[style.replace('-', '_')] = false;
- });
- break;
- case "back":
- $state.go($scope.formData.cancelUrl);
- break;
- default:
- // $scope.ldloading[style.replace('-', '_')] = false;
- break;
- }
- }
- // var submitFunc = api_bpm_domain[$scope.formData.url]
- // if(anuglar.isFunction(submitFunc)){
- // submitFunc.apply(null, pdKey)
- // }
- }
- } else {
- console.log(data)
- // angular.forEach(vm.form.$error.required, function(item){
- // var i=(item.$name).substring(item.$name.length-2)
- var i = Number((vm.form.$error.required[0].$name).split("_")[4]);
- // for(var i=0;i<vm.fields.length;i++){
- if (vm.fields[i].name == vm.form.$error.required[0].$name) {
- // SweetAlert.swal({
- // title: vm.fields[i].templateOptions.label + '未填',
- // text: "请填写此项!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- $ionicPopup.alert({
- title: vm.fields[i].templateOptions.label + '未填',
- okText: '确认'
- })
- }
- // }
- // angular.forEach(vm.fields,function(f){
- // if(f.name == item.$name){
- // f.validation.show = true;
- // SweetAlert.swal({
- // title: f.templateOptions.label+'未填',
- // text: "请填写此项!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- // }
- // });
- // })
- }
- $scope.click = true;
- setTimeout(() => {
- $scope.click = false;
- }, 5000);
- };
- $scope.vm = vm;
- $scope.reload = function () {
- if (angular.isDefined($stateParams.taskId) && $stateParams.taskId != "") {
- var processInstanceId = $stateParams.processInstanceId;
- if (angular.isDefined($stateParams.pdKey) && $stateParams.pdKey == "bpm_inspection") {
- api_configure_form.renderForm($stateParams.formUiEdit, userId, processInstanceId).then(function (responseData) {
- if (responseData) { //console.log("responseData>>>");//console.log(responseData);
- var vmForm = Restangular.stripRestangular(responseData);
- if (vmForm) { //console.log("vmForm>>>");//console.log(vmForm);
- decodeVMForm(vmForm);
- //console.log($scope);
- }
- }
- });
- } else if (angular.isDefined($stateParams.pdKey) && $stateParams.pdKey == "bpm_service_request") {
- api_configure_form.renderForm($stateParams.formUiEdit, userId, processInstanceId).then(function (responseData) {
- if (responseData) { //console.log("responseData>>>");//console.log(responseData);
- var vmForm = Restangular.stripRestangular(responseData);
- if (vmForm) { //console.log("vmForm>>>");//console.log(vmForm);
- decodeVMForm(vmForm);
- //console.log($scope);
- }
- }
- });
- } else {
- api_bpm_domain.taskformkey($stateParams.taskId).then(function (response) {
- if (response) {
- var myData = Restangular.stripRestangular(response); //console.log("myData>>>");console.log(myData);
- api_configure_form.renderForm(myData.data, userId, processInstanceId).then(function (responseData) {
- if (responseData) { //console.log("responseData>>>");//console.log(responseData);
- var vmForm = Restangular.stripRestangular(responseData);
- if (vmForm) { //console.log("vmForm>>>");//console.log(vmForm);
- decodeVMForm(vmForm);
- //console.log($scope);
- }
- }
- });
- }
- })
- }
- } else {
- // create process instance
- if (pdKey != "") { //for process
- if (pdKey == 'bpm_service_request') {
- api_configure_form.renderForm($stateParams.formUiStart, userId).then(function (responseData) {
- if (responseData) {
- var vmForm = Restangular.stripRestangular(responseData);
- if (vmForm) {
- decodeVMForm(vmForm);
- }
- }
- });
- } else if (pdKey == 'weChatApplyStart' || pdKey == 'weChatApplySave') {
- // alert('pdKey' + ':' + pdKey);
- // alert('formKey' + ':' + $stateParams.formKey);
- // alert(api_configure_form.renderForm($stateParams.formKey, '00000').getRequestedUrl());
- api_configure_form.renderForm($stateParams.formKey, '00000').then(function (responseData) {
- // var aa = Restangular.stripRestangular(responseData);
- // for (var i in aa) {
- // if (aa.hasOwnProperty(i)) { //filter,只输出man的私有属性
- // alert(i + ":" + aa[i]);
- // };
- // }
- if (responseData) {
- var vmForm = Restangular.stripRestangular(responseData);
- if (vmForm) {
- decodeVMForm(vmForm);
- }
- }
- // $state.go($scope.formData.cancelUrl);
- });
- } else {
- api_bpm_domain.startformkey(pdKey).then(function (response) {
- if (response) {
- var myData = Restangular.stripRestangular(response);
- //myData.data = "arrangeform";
- api_configure_form.renderForm(myData.data, userId).then(function (responseData) {
- if (responseData) {
- var vmForm = Restangular.stripRestangular(responseData);
- if (vmForm) {
- decodeVMForm(vmForm);
- //console.log($rootScope);
- }
- }
- });
- }
- });
- }
- }
- }
- }
- if (sessionStorage.sessionLogin) {
- var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
- var loginUser = sessionLogin.user;
- $rootScope.user = sessionLogin.user;
- //默认数据
- $scope.defaultData = {
- 'assignee': loginUser.id,
- 'idx': 0,
- 'sum': 10,
- };
- //填充数据
- $scope.filterData = {
- 'assignee': loginUser.id,
- 'idx': 0,
- 'sum': 10,
- };
- $scope.reload()
- }
- $scope.$on("loginComplete", function (event, data) {
- var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
- var loginUser = sessionLogin.user;
- $rootScope.user = sessionLogin.user;
- //默认数据
- $scope.defaultData = {
- 'assignee': loginUser.id,
- 'idx': 0,
- 'sum': 10,
- };
- //填充数据
- $scope.filterData = {
- 'assignee': loginUser.id,
- 'idx': 0,
- 'sum': 10,
- };
- $scope.reload()
- });
- //console.log("end decode");
- }
- ]);
|