yvan-ext.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter', 'modeler', 'bpmn-js-properties-panel', 'lay-excel'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, handlebars, xterm, xtermAddonFit, sqlFormat, BpmnModeler, bpmnJsPropertiesPanel, LAY_EXCEL) { 'use strict';
  2. var axios__default = 'default' in axios ? axios['default'] : axios;
  3. Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
  4. _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2;
  5. $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2;
  6. moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1;
  7. XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX;
  8. localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage;
  9. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  10. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  11. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  12. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. typeAheadDelay: 1,
  50. queryDelay: 1,
  51. };
  52. var comboGrid = {
  53. selectOnTab: true,
  54. pickerHeight: 500,
  55. pickerWidth: 850,
  56. editEnable: null,
  57. };
  58. var comboGridPicker = {
  59. xtype: 'yvgrid',
  60. layout: 'fit',
  61. selModel: {
  62. selType: 'rowmodel',
  63. mode: 'SINGLE'
  64. },
  65. };
  66. var comboGridMulti = {
  67. selectOnTab: true,
  68. pickerHeight: 500,
  69. pickerWidth: 850,
  70. editEnable: null,
  71. splitChar: ',',
  72. displayField: 'text',
  73. valueField: 'id',
  74. autoLoad: true,
  75. };
  76. var comboGridMultiPicker = {
  77. selType: 'checkboxmodel',
  78. selModel: {
  79. type: 'checkboxmodel',
  80. checkOnly: false
  81. },
  82. };
  83. var numberfield = {
  84. labelAlign: 'right',
  85. decimalPrecision: 6,
  86. labelWidth: labelWidth,
  87. };
  88. var checkbox = {
  89. labelAlign: 'right',
  90. labelWidth: labelWidth,
  91. checkedValue: true,
  92. uncheckedValue: false,
  93. };
  94. var checkboxgroup = {
  95. labelAlign: 'right',
  96. labelWidth: labelWidth,
  97. };
  98. var radio = {
  99. labelAlign: 'right',
  100. labelWidth: labelWidth,
  101. };
  102. var radiogroup = {
  103. labelAlign: 'right',
  104. labelWidth: labelWidth,
  105. simpleValue: true,
  106. layout: 'hbox',
  107. defaults: {
  108. xtype: 'radio',
  109. name: 'type',
  110. margin: '0 15 0 0'
  111. },
  112. };
  113. var form = {
  114. margin: '5 5 0 0',
  115. border: false,
  116. defaults: {
  117. margin: '0 0 5 0',
  118. border: false,
  119. },
  120. };
  121. var column = {
  122. filter: { type: 'string' },
  123. };
  124. var grid = {
  125. border: true,
  126. columnLines: true,
  127. rowLines: true,
  128. plugins: {
  129. cellediting: {
  130. clicksToEdit: 1,
  131. },
  132. gridfilters: true
  133. },
  134. multiColumnSort: true,
  135. viewConfig: {
  136. enableTextSelection: true,
  137. sortOnClick: false,
  138. emptyText: '没有数据'
  139. },
  140. selModel: {
  141. type: 'checkboxmodel',
  142. checkOnly: false
  143. },
  144. pagination: true,
  145. pageSize: 50,
  146. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  147. hideFootbar: false,
  148. hideRefresh: false,
  149. hideExport: false,
  150. hideAutoSize: false,
  151. hideClearFilter: false,
  152. hideSaveGridUIConfig: false,
  153. hideClearGridUIConfig: false,
  154. autoLoad: true,
  155. remoteSort: false,
  156. remoteFilter: false,
  157. enableLocking: true,
  158. syncRowHeight: false,
  159. enableColumnMove: true,
  160. enableColumnHide: true,
  161. enableColumnResize: true,
  162. hidden: false,
  163. disabled: false,
  164. exportExcelPageSize: 100,
  165. exportExcelCurrentPage: 1,
  166. exportExcelTotal: 0,
  167. cellTip: false,
  168. };
  169. var fieldContainer = {
  170. labelAlign: 'right',
  171. labelWidth: labelWidth,
  172. layout: 'hbox',
  173. defaults: {
  174. flex: 1,
  175. }
  176. };
  177. var tree = {
  178. autoLoad: true,
  179. hideFilter: false,
  180. hideToolbar: false,
  181. hideRefresh: false,
  182. hideExpand: false,
  183. hideCollapse: false,
  184. root: [],
  185. rootVisible: false,
  186. };
  187. var search = {
  188. labelAlign: 'right',
  189. labelWidth: labelWidth,
  190. };
  191. var text = {
  192. labelAlign: 'right',
  193. labelWidth: labelWidth,
  194. msgTarget: 'qtip',
  195. };
  196. var toolbar = {
  197. overflowHandler: 'menu',
  198. };
  199. var tbfill = {};
  200. var tbseparator = {};
  201. var button = {};
  202. var fieldSet = {
  203. margin: '5 5 0 0',
  204. border: false,
  205. defaults: {
  206. margin: '0 0 5 0',
  207. border: false,
  208. },
  209. };
  210. var storeAjax = {
  211. timeout: 60000
  212. };
  213. var panel = {};
  214. var splitter = {};
  215. var maintab = {};
  216. var rows = {};
  217. var cols = {
  218. defaults: {
  219. flex: 1
  220. },
  221. };
  222. var bpmn = {
  223. hideRefresh: false,
  224. autoLoad: true,
  225. dataSource: '',
  226. bpmnConfig: {}
  227. };
  228. //# sourceMappingURL=Defaults.js.map
  229. var Defaults = /*#__PURE__*/Object.freeze({
  230. __proto__: null,
  231. windows: windows,
  232. date: date,
  233. tagfield: tagfield,
  234. combo: combo,
  235. comboGrid: comboGrid,
  236. comboGridPicker: comboGridPicker,
  237. comboGridMulti: comboGridMulti,
  238. comboGridMultiPicker: comboGridMultiPicker,
  239. numberfield: numberfield,
  240. checkbox: checkbox,
  241. checkboxgroup: checkboxgroup,
  242. radio: radio,
  243. radiogroup: radiogroup,
  244. form: form,
  245. column: column,
  246. grid: grid,
  247. fieldContainer: fieldContainer,
  248. tree: tree,
  249. search: search,
  250. text: text,
  251. toolbar: toolbar,
  252. tbfill: tbfill,
  253. tbseparator: tbseparator,
  254. button: button,
  255. fieldSet: fieldSet,
  256. storeAjax: storeAjax,
  257. panel: panel,
  258. splitter: splitter,
  259. maintab: maintab,
  260. rows: rows,
  261. cols: cols,
  262. bpmn: bpmn
  263. });
  264. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  265. function createCommonjsModule(fn, module) {
  266. return module = { exports: {} }, fn(module, module.exports), module.exports;
  267. }
  268. var dist = createCommonjsModule(function (module, exports) {
  269. (function (global, factory) {
  270. module.exports = factory() ;
  271. }(commonjsGlobal, (function () {
  272. function createCommonjsModule(fn, module) {
  273. return module = { exports: {} }, fn(module, module.exports), module.exports;
  274. }
  275. var _global = createCommonjsModule(function (module) {
  276. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  277. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  278. ? window : typeof self != 'undefined' && self.Math == Math ? self
  279. // eslint-disable-next-line no-new-func
  280. : Function('return this')();
  281. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  282. });
  283. var _core = createCommonjsModule(function (module) {
  284. var core = module.exports = { version: '2.6.5' };
  285. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  286. });
  287. var _core_1 = _core.version;
  288. var _isObject = function (it) {
  289. return typeof it === 'object' ? it !== null : typeof it === 'function';
  290. };
  291. var _anObject = function (it) {
  292. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  293. return it;
  294. };
  295. var _fails = function (exec) {
  296. try {
  297. return !!exec();
  298. } catch (e) {
  299. return true;
  300. }
  301. };
  302. // Thank's IE8 for his funny defineProperty
  303. var _descriptors = !_fails(function () {
  304. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  305. });
  306. var document = _global.document;
  307. // typeof document.createElement is 'object' in old IE
  308. var is = _isObject(document) && _isObject(document.createElement);
  309. var _domCreate = function (it) {
  310. return is ? document.createElement(it) : {};
  311. };
  312. var _ie8DomDefine = !_descriptors && !_fails(function () {
  313. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  314. });
  315. // 7.1.1 ToPrimitive(input [, PreferredType])
  316. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  317. // and the second argument - flag - preferred type is a string
  318. var _toPrimitive = function (it, S) {
  319. if (!_isObject(it)) { return it; }
  320. var fn, val;
  321. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  323. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  324. throw TypeError("Can't convert object to primitive value");
  325. };
  326. var dP = Object.defineProperty;
  327. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  328. _anObject(O);
  329. P = _toPrimitive(P, true);
  330. _anObject(Attributes);
  331. if (_ie8DomDefine) { try {
  332. return dP(O, P, Attributes);
  333. } catch (e) { /* empty */ } }
  334. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  335. if ('value' in Attributes) { O[P] = Attributes.value; }
  336. return O;
  337. };
  338. var _objectDp = {
  339. f: f
  340. };
  341. var _propertyDesc = function (bitmap, value) {
  342. return {
  343. enumerable: !(bitmap & 1),
  344. configurable: !(bitmap & 2),
  345. writable: !(bitmap & 4),
  346. value: value
  347. };
  348. };
  349. var _hide = _descriptors ? function (object, key, value) {
  350. return _objectDp.f(object, key, _propertyDesc(1, value));
  351. } : function (object, key, value) {
  352. object[key] = value;
  353. return object;
  354. };
  355. var hasOwnProperty = {}.hasOwnProperty;
  356. var _has = function (it, key) {
  357. return hasOwnProperty.call(it, key);
  358. };
  359. var id = 0;
  360. var px = Math.random();
  361. var _uid = function (key) {
  362. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  363. };
  364. var _shared = createCommonjsModule(function (module) {
  365. var SHARED = '__core-js_shared__';
  366. var store = _global[SHARED] || (_global[SHARED] = {});
  367. (module.exports = function (key, value) {
  368. return store[key] || (store[key] = value !== undefined ? value : {});
  369. })('versions', []).push({
  370. version: _core.version,
  371. mode: 'global',
  372. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  373. });
  374. });
  375. var _functionToString = _shared('native-function-to-string', Function.toString);
  376. var _redefine = createCommonjsModule(function (module) {
  377. var SRC = _uid('src');
  378. var TO_STRING = 'toString';
  379. var TPL = ('' + _functionToString).split(TO_STRING);
  380. _core.inspectSource = function (it) {
  381. return _functionToString.call(it);
  382. };
  383. (module.exports = function (O, key, val, safe) {
  384. var isFunction = typeof val == 'function';
  385. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  386. if (O[key] === val) { return; }
  387. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  388. if (O === _global) {
  389. O[key] = val;
  390. } else if (!safe) {
  391. delete O[key];
  392. _hide(O, key, val);
  393. } else if (O[key]) {
  394. O[key] = val;
  395. } else {
  396. _hide(O, key, val);
  397. }
  398. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  399. })(Function.prototype, TO_STRING, function toString() {
  400. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  401. });
  402. });
  403. var _aFunction = function (it) {
  404. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  405. return it;
  406. };
  407. // optional / simple context binding
  408. var _ctx = function (fn, that, length) {
  409. _aFunction(fn);
  410. if (that === undefined) { return fn; }
  411. switch (length) {
  412. case 1: return function (a) {
  413. return fn.call(that, a);
  414. };
  415. case 2: return function (a, b) {
  416. return fn.call(that, a, b);
  417. };
  418. case 3: return function (a, b, c) {
  419. return fn.call(that, a, b, c);
  420. };
  421. }
  422. return function (/* ...args */) {
  423. return fn.apply(that, arguments);
  424. };
  425. };
  426. var PROTOTYPE = 'prototype';
  427. var $export = function (type, name, source) {
  428. var IS_FORCED = type & $export.F;
  429. var IS_GLOBAL = type & $export.G;
  430. var IS_STATIC = type & $export.S;
  431. var IS_PROTO = type & $export.P;
  432. var IS_BIND = type & $export.B;
  433. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  434. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  435. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  436. var key, own, out, exp;
  437. if (IS_GLOBAL) { source = name; }
  438. for (key in source) {
  439. // contains in native
  440. own = !IS_FORCED && target && target[key] !== undefined;
  441. // export native or passed
  442. out = (own ? target : source)[key];
  443. // bind timers to global for call from export context
  444. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  445. // extend global
  446. if (target) { _redefine(target, key, out, type & $export.U); }
  447. // export
  448. if (exports[key] != out) { _hide(exports, key, exp); }
  449. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  450. }
  451. };
  452. _global.core = _core;
  453. // type bitmap
  454. $export.F = 1; // forced
  455. $export.G = 2; // global
  456. $export.S = 4; // static
  457. $export.P = 8; // proto
  458. $export.B = 16; // bind
  459. $export.W = 32; // wrap
  460. $export.U = 64; // safe
  461. $export.R = 128; // real proto method for `library`
  462. var _export = $export;
  463. // 7.1.4 ToInteger
  464. var ceil = Math.ceil;
  465. var floor = Math.floor;
  466. var _toInteger = function (it) {
  467. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  468. };
  469. // 7.2.1 RequireObjectCoercible(argument)
  470. var _defined = function (it) {
  471. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  472. return it;
  473. };
  474. // true -> String#at
  475. // false -> String#codePointAt
  476. var _stringAt = function (TO_STRING) {
  477. return function (that, pos) {
  478. var s = String(_defined(that));
  479. var i = _toInteger(pos);
  480. var l = s.length;
  481. var a, b;
  482. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  483. a = s.charCodeAt(i);
  484. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  485. ? TO_STRING ? s.charAt(i) : a
  486. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  487. };
  488. };
  489. var $at = _stringAt(false);
  490. _export(_export.P, 'String', {
  491. // 21.1.3.3 String.prototype.codePointAt(pos)
  492. codePointAt: function codePointAt(pos) {
  493. return $at(this, pos);
  494. }
  495. });
  496. var codePointAt = _core.String.codePointAt;
  497. var max = Math.max;
  498. var min = Math.min;
  499. var _toAbsoluteIndex = function (index, length) {
  500. index = _toInteger(index);
  501. return index < 0 ? max(index + length, 0) : min(index, length);
  502. };
  503. var fromCharCode = String.fromCharCode;
  504. var $fromCodePoint = String.fromCodePoint;
  505. // length should be 1, old FF problem
  506. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  507. // 21.1.2.2 String.fromCodePoint(...codePoints)
  508. fromCodePoint: function fromCodePoint(x) {
  509. var arguments$1 = arguments;
  510. // eslint-disable-line no-unused-vars
  511. var res = [];
  512. var aLen = arguments.length;
  513. var i = 0;
  514. var code;
  515. while (aLen > i) {
  516. code = +arguments$1[i++];
  517. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  518. res.push(code < 0x10000
  519. ? fromCharCode(code)
  520. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  521. );
  522. } return res.join('');
  523. }
  524. });
  525. var fromCodePoint = _core.String.fromCodePoint;
  526. // This is a generated file. Do not edit.
  527. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  528. var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  529. var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  530. var unicode = {
  531. Space_Separator: Space_Separator,
  532. ID_Start: ID_Start,
  533. ID_Continue: ID_Continue
  534. };
  535. var util = {
  536. isSpaceSeparator: function isSpaceSeparator (c) {
  537. return typeof c === 'string' && unicode.Space_Separator.test(c)
  538. },
  539. isIdStartChar: function isIdStartChar (c) {
  540. return typeof c === 'string' && (
  541. (c >= 'a' && c <= 'z') ||
  542. (c >= 'A' && c <= 'Z') ||
  543. (c === '$') || (c === '_') ||
  544. unicode.ID_Start.test(c)
  545. )
  546. },
  547. isIdContinueChar: function isIdContinueChar (c) {
  548. return typeof c === 'string' && (
  549. (c >= 'a' && c <= 'z') ||
  550. (c >= 'A' && c <= 'Z') ||
  551. (c >= '0' && c <= '9') ||
  552. (c === '$') || (c === '_') ||
  553. (c === '\u200C') || (c === '\u200D') ||
  554. unicode.ID_Continue.test(c)
  555. )
  556. },
  557. isDigit: function isDigit (c) {
  558. return typeof c === 'string' && /[0-9]/.test(c)
  559. },
  560. isHexDigit: function isHexDigit (c) {
  561. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  562. },
  563. };
  564. var source;
  565. var parseState;
  566. var stack;
  567. var pos;
  568. var line;
  569. var column;
  570. var token;
  571. var key;
  572. var root;
  573. var parse = function parse (text, reviver) {
  574. source = String(text);
  575. parseState = 'start';
  576. stack = [];
  577. pos = 0;
  578. line = 1;
  579. column = 0;
  580. token = undefined;
  581. key = undefined;
  582. root = undefined;
  583. do {
  584. token = lex();
  585. // This code is unreachable.
  586. // if (!parseStates[parseState]) {
  587. // throw invalidParseState()
  588. // }
  589. parseStates[parseState]();
  590. } while (token.type !== 'eof')
  591. if (typeof reviver === 'function') {
  592. return internalize({'': root}, '', reviver)
  593. }
  594. return root
  595. };
  596. function internalize (holder, name, reviver) {
  597. var value = holder[name];
  598. if (value != null && typeof value === 'object') {
  599. for (var key in value) {
  600. var replacement = internalize(value, key, reviver);
  601. if (replacement === undefined) {
  602. delete value[key];
  603. } else {
  604. value[key] = replacement;
  605. }
  606. }
  607. }
  608. return reviver.call(holder, name, value)
  609. }
  610. var lexState;
  611. var buffer;
  612. var doubleQuote;
  613. var sign;
  614. var c;
  615. function lex () {
  616. lexState = 'default';
  617. buffer = '';
  618. doubleQuote = false;
  619. sign = 1;
  620. for (;;) {
  621. c = peek();
  622. // This code is unreachable.
  623. // if (!lexStates[lexState]) {
  624. // throw invalidLexState(lexState)
  625. // }
  626. var token = lexStates[lexState]();
  627. if (token) {
  628. return token
  629. }
  630. }
  631. }
  632. function peek () {
  633. if (source[pos]) {
  634. return String.fromCodePoint(source.codePointAt(pos))
  635. }
  636. }
  637. function read () {
  638. var c = peek();
  639. if (c === '\n') {
  640. line++;
  641. column = 0;
  642. } else if (c) {
  643. column += c.length;
  644. } else {
  645. column++;
  646. }
  647. if (c) {
  648. pos += c.length;
  649. }
  650. return c
  651. }
  652. var lexStates = {
  653. default: function default$1 () {
  654. switch (c) {
  655. case '\t':
  656. case '\v':
  657. case '\f':
  658. case ' ':
  659. case '\u00A0':
  660. case '\uFEFF':
  661. case '\n':
  662. case '\r':
  663. case '\u2028':
  664. case '\u2029':
  665. read();
  666. return
  667. case '/':
  668. read();
  669. lexState = 'comment';
  670. return
  671. case undefined:
  672. read();
  673. return newToken('eof')
  674. }
  675. if (util.isSpaceSeparator(c)) {
  676. read();
  677. return
  678. }
  679. // This code is unreachable.
  680. // if (!lexStates[parseState]) {
  681. // throw invalidLexState(parseState)
  682. // }
  683. return lexStates[parseState]()
  684. },
  685. comment: function comment () {
  686. switch (c) {
  687. case '*':
  688. read();
  689. lexState = 'multiLineComment';
  690. return
  691. case '/':
  692. read();
  693. lexState = 'singleLineComment';
  694. return
  695. }
  696. throw invalidChar(read())
  697. },
  698. multiLineComment: function multiLineComment () {
  699. switch (c) {
  700. case '*':
  701. read();
  702. lexState = 'multiLineCommentAsterisk';
  703. return
  704. case undefined:
  705. throw invalidChar(read())
  706. }
  707. read();
  708. },
  709. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  710. switch (c) {
  711. case '*':
  712. read();
  713. return
  714. case '/':
  715. read();
  716. lexState = 'default';
  717. return
  718. case undefined:
  719. throw invalidChar(read())
  720. }
  721. read();
  722. lexState = 'multiLineComment';
  723. },
  724. singleLineComment: function singleLineComment () {
  725. switch (c) {
  726. case '\n':
  727. case '\r':
  728. case '\u2028':
  729. case '\u2029':
  730. read();
  731. lexState = 'default';
  732. return
  733. case undefined:
  734. read();
  735. return newToken('eof')
  736. }
  737. read();
  738. },
  739. value: function value () {
  740. switch (c) {
  741. case '{':
  742. case '[':
  743. return newToken('punctuator', read())
  744. case 'n':
  745. read();
  746. literal('ull');
  747. return newToken('null', null)
  748. case 't':
  749. read();
  750. literal('rue');
  751. return newToken('boolean', true)
  752. case 'f':
  753. read();
  754. literal('alse');
  755. return newToken('boolean', false)
  756. case '-':
  757. case '+':
  758. if (read() === '-') {
  759. sign = -1;
  760. }
  761. lexState = 'sign';
  762. return
  763. case '.':
  764. buffer = read();
  765. lexState = 'decimalPointLeading';
  766. return
  767. case '0':
  768. buffer = read();
  769. lexState = 'zero';
  770. return
  771. case '1':
  772. case '2':
  773. case '3':
  774. case '4':
  775. case '5':
  776. case '6':
  777. case '7':
  778. case '8':
  779. case '9':
  780. buffer = read();
  781. lexState = 'decimalInteger';
  782. return
  783. case 'I':
  784. read();
  785. literal('nfinity');
  786. return newToken('numeric', Infinity)
  787. case 'N':
  788. read();
  789. literal('aN');
  790. return newToken('numeric', NaN)
  791. case '"':
  792. case "'":
  793. doubleQuote = (read() === '"');
  794. buffer = '';
  795. lexState = 'string';
  796. return
  797. }
  798. throw invalidChar(read())
  799. },
  800. identifierNameStartEscape: function identifierNameStartEscape () {
  801. if (c !== 'u') {
  802. throw invalidChar(read())
  803. }
  804. read();
  805. var u = unicodeEscape();
  806. switch (u) {
  807. case '$':
  808. case '_':
  809. break
  810. default:
  811. if (!util.isIdStartChar(u)) {
  812. throw invalidIdentifier()
  813. }
  814. break
  815. }
  816. buffer += u;
  817. lexState = 'identifierName';
  818. },
  819. identifierName: function identifierName () {
  820. switch (c) {
  821. case '$':
  822. case '_':
  823. case '\u200C':
  824. case '\u200D':
  825. buffer += read();
  826. return
  827. case '\\':
  828. read();
  829. lexState = 'identifierNameEscape';
  830. return
  831. }
  832. if (util.isIdContinueChar(c)) {
  833. buffer += read();
  834. return
  835. }
  836. return newToken('identifier', buffer)
  837. },
  838. identifierNameEscape: function identifierNameEscape () {
  839. if (c !== 'u') {
  840. throw invalidChar(read())
  841. }
  842. read();
  843. var u = unicodeEscape();
  844. switch (u) {
  845. case '$':
  846. case '_':
  847. case '\u200C':
  848. case '\u200D':
  849. break
  850. default:
  851. if (!util.isIdContinueChar(u)) {
  852. throw invalidIdentifier()
  853. }
  854. break
  855. }
  856. buffer += u;
  857. lexState = 'identifierName';
  858. },
  859. sign: function sign$1 () {
  860. switch (c) {
  861. case '.':
  862. buffer = read();
  863. lexState = 'decimalPointLeading';
  864. return
  865. case '0':
  866. buffer = read();
  867. lexState = 'zero';
  868. return
  869. case '1':
  870. case '2':
  871. case '3':
  872. case '4':
  873. case '5':
  874. case '6':
  875. case '7':
  876. case '8':
  877. case '9':
  878. buffer = read();
  879. lexState = 'decimalInteger';
  880. return
  881. case 'I':
  882. read();
  883. literal('nfinity');
  884. return newToken('numeric', sign * Infinity)
  885. case 'N':
  886. read();
  887. literal('aN');
  888. return newToken('numeric', NaN)
  889. }
  890. throw invalidChar(read())
  891. },
  892. zero: function zero () {
  893. switch (c) {
  894. case '.':
  895. buffer += read();
  896. lexState = 'decimalPoint';
  897. return
  898. case 'e':
  899. case 'E':
  900. buffer += read();
  901. lexState = 'decimalExponent';
  902. return
  903. case 'x':
  904. case 'X':
  905. buffer += read();
  906. lexState = 'hexadecimal';
  907. return
  908. }
  909. return newToken('numeric', sign * 0)
  910. },
  911. decimalInteger: function decimalInteger () {
  912. switch (c) {
  913. case '.':
  914. buffer += read();
  915. lexState = 'decimalPoint';
  916. return
  917. case 'e':
  918. case 'E':
  919. buffer += read();
  920. lexState = 'decimalExponent';
  921. return
  922. }
  923. if (util.isDigit(c)) {
  924. buffer += read();
  925. return
  926. }
  927. return newToken('numeric', sign * Number(buffer))
  928. },
  929. decimalPointLeading: function decimalPointLeading () {
  930. if (util.isDigit(c)) {
  931. buffer += read();
  932. lexState = 'decimalFraction';
  933. return
  934. }
  935. throw invalidChar(read())
  936. },
  937. decimalPoint: function decimalPoint () {
  938. switch (c) {
  939. case 'e':
  940. case 'E':
  941. buffer += read();
  942. lexState = 'decimalExponent';
  943. return
  944. }
  945. if (util.isDigit(c)) {
  946. buffer += read();
  947. lexState = 'decimalFraction';
  948. return
  949. }
  950. return newToken('numeric', sign * Number(buffer))
  951. },
  952. decimalFraction: function decimalFraction () {
  953. switch (c) {
  954. case 'e':
  955. case 'E':
  956. buffer += read();
  957. lexState = 'decimalExponent';
  958. return
  959. }
  960. if (util.isDigit(c)) {
  961. buffer += read();
  962. return
  963. }
  964. return newToken('numeric', sign * Number(buffer))
  965. },
  966. decimalExponent: function decimalExponent () {
  967. switch (c) {
  968. case '+':
  969. case '-':
  970. buffer += read();
  971. lexState = 'decimalExponentSign';
  972. return
  973. }
  974. if (util.isDigit(c)) {
  975. buffer += read();
  976. lexState = 'decimalExponentInteger';
  977. return
  978. }
  979. throw invalidChar(read())
  980. },
  981. decimalExponentSign: function decimalExponentSign () {
  982. if (util.isDigit(c)) {
  983. buffer += read();
  984. lexState = 'decimalExponentInteger';
  985. return
  986. }
  987. throw invalidChar(read())
  988. },
  989. decimalExponentInteger: function decimalExponentInteger () {
  990. if (util.isDigit(c)) {
  991. buffer += read();
  992. return
  993. }
  994. return newToken('numeric', sign * Number(buffer))
  995. },
  996. hexadecimal: function hexadecimal () {
  997. if (util.isHexDigit(c)) {
  998. buffer += read();
  999. lexState = 'hexadecimalInteger';
  1000. return
  1001. }
  1002. throw invalidChar(read())
  1003. },
  1004. hexadecimalInteger: function hexadecimalInteger () {
  1005. if (util.isHexDigit(c)) {
  1006. buffer += read();
  1007. return
  1008. }
  1009. return newToken('numeric', sign * Number(buffer))
  1010. },
  1011. string: function string () {
  1012. switch (c) {
  1013. case '\\':
  1014. read();
  1015. buffer += escape();
  1016. return
  1017. case '"':
  1018. if (doubleQuote) {
  1019. read();
  1020. return newToken('string', buffer)
  1021. }
  1022. buffer += read();
  1023. return
  1024. case "'":
  1025. if (!doubleQuote) {
  1026. read();
  1027. return newToken('string', buffer)
  1028. }
  1029. buffer += read();
  1030. return
  1031. case '\n':
  1032. case '\r':
  1033. throw invalidChar(read())
  1034. case '\u2028':
  1035. case '\u2029':
  1036. separatorChar(c);
  1037. break
  1038. case undefined:
  1039. throw invalidChar(read())
  1040. }
  1041. buffer += read();
  1042. },
  1043. start: function start () {
  1044. switch (c) {
  1045. case '{':
  1046. case '[':
  1047. return newToken('punctuator', read())
  1048. // This code is unreachable since the default lexState handles eof.
  1049. // case undefined:
  1050. // return newToken('eof')
  1051. }
  1052. lexState = 'value';
  1053. },
  1054. beforePropertyName: function beforePropertyName () {
  1055. switch (c) {
  1056. case '$':
  1057. case '_':
  1058. buffer = read();
  1059. lexState = 'identifierName';
  1060. return
  1061. case '\\':
  1062. read();
  1063. lexState = 'identifierNameStartEscape';
  1064. return
  1065. case '}':
  1066. return newToken('punctuator', read())
  1067. case '"':
  1068. case "'":
  1069. doubleQuote = (read() === '"');
  1070. lexState = 'string';
  1071. return
  1072. }
  1073. if (util.isIdStartChar(c)) {
  1074. buffer += read();
  1075. lexState = 'identifierName';
  1076. return
  1077. }
  1078. throw invalidChar(read())
  1079. },
  1080. afterPropertyName: function afterPropertyName () {
  1081. if (c === ':') {
  1082. return newToken('punctuator', read())
  1083. }
  1084. throw invalidChar(read())
  1085. },
  1086. beforePropertyValue: function beforePropertyValue () {
  1087. lexState = 'value';
  1088. },
  1089. afterPropertyValue: function afterPropertyValue () {
  1090. switch (c) {
  1091. case ',':
  1092. case '}':
  1093. return newToken('punctuator', read())
  1094. }
  1095. throw invalidChar(read())
  1096. },
  1097. beforeArrayValue: function beforeArrayValue () {
  1098. if (c === ']') {
  1099. return newToken('punctuator', read())
  1100. }
  1101. lexState = 'value';
  1102. },
  1103. afterArrayValue: function afterArrayValue () {
  1104. switch (c) {
  1105. case ',':
  1106. case ']':
  1107. return newToken('punctuator', read())
  1108. }
  1109. throw invalidChar(read())
  1110. },
  1111. end: function end () {
  1112. // This code is unreachable since it's handled by the default lexState.
  1113. // if (c === undefined) {
  1114. // read()
  1115. // return newToken('eof')
  1116. // }
  1117. throw invalidChar(read())
  1118. },
  1119. };
  1120. function newToken (type, value) {
  1121. return {
  1122. type: type,
  1123. value: value,
  1124. line: line,
  1125. column: column,
  1126. }
  1127. }
  1128. function literal (s) {
  1129. for (var i = 0, list = s; i < list.length; i += 1) {
  1130. var c = list[i];
  1131. var p = peek();
  1132. if (p !== c) {
  1133. throw invalidChar(read())
  1134. }
  1135. read();
  1136. }
  1137. }
  1138. function escape () {
  1139. var c = peek();
  1140. switch (c) {
  1141. case 'b':
  1142. read();
  1143. return '\b'
  1144. case 'f':
  1145. read();
  1146. return '\f'
  1147. case 'n':
  1148. read();
  1149. return '\n'
  1150. case 'r':
  1151. read();
  1152. return '\r'
  1153. case 't':
  1154. read();
  1155. return '\t'
  1156. case 'v':
  1157. read();
  1158. return '\v'
  1159. case '0':
  1160. read();
  1161. if (util.isDigit(peek())) {
  1162. throw invalidChar(read())
  1163. }
  1164. return '\0'
  1165. case 'x':
  1166. read();
  1167. return hexEscape()
  1168. case 'u':
  1169. read();
  1170. return unicodeEscape()
  1171. case '\n':
  1172. case '\u2028':
  1173. case '\u2029':
  1174. read();
  1175. return ''
  1176. case '\r':
  1177. read();
  1178. if (peek() === '\n') {
  1179. read();
  1180. }
  1181. return ''
  1182. case '1':
  1183. case '2':
  1184. case '3':
  1185. case '4':
  1186. case '5':
  1187. case '6':
  1188. case '7':
  1189. case '8':
  1190. case '9':
  1191. throw invalidChar(read())
  1192. case undefined:
  1193. throw invalidChar(read())
  1194. }
  1195. return read()
  1196. }
  1197. function hexEscape () {
  1198. var buffer = '';
  1199. var c = peek();
  1200. if (!util.isHexDigit(c)) {
  1201. throw invalidChar(read())
  1202. }
  1203. buffer += read();
  1204. c = peek();
  1205. if (!util.isHexDigit(c)) {
  1206. throw invalidChar(read())
  1207. }
  1208. buffer += read();
  1209. return String.fromCodePoint(parseInt(buffer, 16))
  1210. }
  1211. function unicodeEscape () {
  1212. var buffer = '';
  1213. var count = 4;
  1214. while (count-- > 0) {
  1215. var c = peek();
  1216. if (!util.isHexDigit(c)) {
  1217. throw invalidChar(read())
  1218. }
  1219. buffer += read();
  1220. }
  1221. return String.fromCodePoint(parseInt(buffer, 16))
  1222. }
  1223. var parseStates = {
  1224. start: function start () {
  1225. if (token.type === 'eof') {
  1226. throw invalidEOF()
  1227. }
  1228. push();
  1229. },
  1230. beforePropertyName: function beforePropertyName () {
  1231. switch (token.type) {
  1232. case 'identifier':
  1233. case 'string':
  1234. key = token.value;
  1235. parseState = 'afterPropertyName';
  1236. return
  1237. case 'punctuator':
  1238. // This code is unreachable since it's handled by the lexState.
  1239. // if (token.value !== '}') {
  1240. // throw invalidToken()
  1241. // }
  1242. pop();
  1243. return
  1244. case 'eof':
  1245. throw invalidEOF()
  1246. }
  1247. // This code is unreachable since it's handled by the lexState.
  1248. // throw invalidToken()
  1249. },
  1250. afterPropertyName: function afterPropertyName () {
  1251. // This code is unreachable since it's handled by the lexState.
  1252. // if (token.type !== 'punctuator' || token.value !== ':') {
  1253. // throw invalidToken()
  1254. // }
  1255. if (token.type === 'eof') {
  1256. throw invalidEOF()
  1257. }
  1258. parseState = 'beforePropertyValue';
  1259. },
  1260. beforePropertyValue: function beforePropertyValue () {
  1261. if (token.type === 'eof') {
  1262. throw invalidEOF()
  1263. }
  1264. push();
  1265. },
  1266. beforeArrayValue: function beforeArrayValue () {
  1267. if (token.type === 'eof') {
  1268. throw invalidEOF()
  1269. }
  1270. if (token.type === 'punctuator' && token.value === ']') {
  1271. pop();
  1272. return
  1273. }
  1274. push();
  1275. },
  1276. afterPropertyValue: function afterPropertyValue () {
  1277. // This code is unreachable since it's handled by the lexState.
  1278. // if (token.type !== 'punctuator') {
  1279. // throw invalidToken()
  1280. // }
  1281. if (token.type === 'eof') {
  1282. throw invalidEOF()
  1283. }
  1284. switch (token.value) {
  1285. case ',':
  1286. parseState = 'beforePropertyName';
  1287. return
  1288. case '}':
  1289. pop();
  1290. }
  1291. // This code is unreachable since it's handled by the lexState.
  1292. // throw invalidToken()
  1293. },
  1294. afterArrayValue: function afterArrayValue () {
  1295. // This code is unreachable since it's handled by the lexState.
  1296. // if (token.type !== 'punctuator') {
  1297. // throw invalidToken()
  1298. // }
  1299. if (token.type === 'eof') {
  1300. throw invalidEOF()
  1301. }
  1302. switch (token.value) {
  1303. case ',':
  1304. parseState = 'beforeArrayValue';
  1305. return
  1306. case ']':
  1307. pop();
  1308. }
  1309. // This code is unreachable since it's handled by the lexState.
  1310. // throw invalidToken()
  1311. },
  1312. end: function end () {
  1313. // This code is unreachable since it's handled by the lexState.
  1314. // if (token.type !== 'eof') {
  1315. // throw invalidToken()
  1316. // }
  1317. },
  1318. };
  1319. function push () {
  1320. var value;
  1321. switch (token.type) {
  1322. case 'punctuator':
  1323. switch (token.value) {
  1324. case '{':
  1325. value = {};
  1326. break
  1327. case '[':
  1328. value = [];
  1329. break
  1330. }
  1331. break
  1332. case 'null':
  1333. case 'boolean':
  1334. case 'numeric':
  1335. case 'string':
  1336. value = token.value;
  1337. break
  1338. // This code is unreachable.
  1339. // default:
  1340. // throw invalidToken()
  1341. }
  1342. if (root === undefined) {
  1343. root = value;
  1344. } else {
  1345. var parent = stack[stack.length - 1];
  1346. if (Array.isArray(parent)) {
  1347. parent.push(value);
  1348. } else {
  1349. parent[key] = value;
  1350. }
  1351. }
  1352. if (value !== null && typeof value === 'object') {
  1353. stack.push(value);
  1354. if (Array.isArray(value)) {
  1355. parseState = 'beforeArrayValue';
  1356. } else {
  1357. parseState = 'beforePropertyName';
  1358. }
  1359. } else {
  1360. var current = stack[stack.length - 1];
  1361. if (current == null) {
  1362. parseState = 'end';
  1363. } else if (Array.isArray(current)) {
  1364. parseState = 'afterArrayValue';
  1365. } else {
  1366. parseState = 'afterPropertyValue';
  1367. }
  1368. }
  1369. }
  1370. function pop () {
  1371. stack.pop();
  1372. var current = stack[stack.length - 1];
  1373. if (current == null) {
  1374. parseState = 'end';
  1375. } else if (Array.isArray(current)) {
  1376. parseState = 'afterArrayValue';
  1377. } else {
  1378. parseState = 'afterPropertyValue';
  1379. }
  1380. }
  1381. // This code is unreachable.
  1382. // function invalidParseState () {
  1383. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1384. // }
  1385. // This code is unreachable.
  1386. // function invalidLexState (state) {
  1387. // return new Error(`JSON5: invalid lex state '${state}'`)
  1388. // }
  1389. function invalidChar (c) {
  1390. if (c === undefined) {
  1391. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1392. }
  1393. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1394. }
  1395. function invalidEOF () {
  1396. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1397. }
  1398. // This code is unreachable.
  1399. // function invalidToken () {
  1400. // if (token.type === 'eof') {
  1401. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1402. // }
  1403. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1404. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1405. // }
  1406. function invalidIdentifier () {
  1407. column -= 5;
  1408. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1409. }
  1410. function separatorChar (c) {
  1411. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1412. }
  1413. function formatChar (c) {
  1414. var replacements = {
  1415. "'": "\\'",
  1416. '"': '\\"',
  1417. '\\': '\\\\',
  1418. '\b': '\\b',
  1419. '\f': '\\f',
  1420. '\n': '\\n',
  1421. '\r': '\\r',
  1422. '\t': '\\t',
  1423. '\v': '\\v',
  1424. '\0': '\\0',
  1425. '\u2028': '\\u2028',
  1426. '\u2029': '\\u2029',
  1427. };
  1428. if (replacements[c]) {
  1429. return replacements[c]
  1430. }
  1431. if (c < ' ') {
  1432. var hexString = c.charCodeAt(0).toString(16);
  1433. return '\\x' + ('00' + hexString).substring(hexString.length)
  1434. }
  1435. return c
  1436. }
  1437. function syntaxError (message) {
  1438. var err = new SyntaxError(message);
  1439. err.lineNumber = line;
  1440. err.columnNumber = column;
  1441. return err
  1442. }
  1443. var stringify = function stringify (value, replacer, space) {
  1444. var stack = [];
  1445. var indent = '';
  1446. var propertyList;
  1447. var replacerFunc;
  1448. var gap = '';
  1449. var quote;
  1450. if (
  1451. replacer != null &&
  1452. typeof replacer === 'object' &&
  1453. !Array.isArray(replacer)
  1454. ) {
  1455. space = replacer.space;
  1456. quote = replacer.quote;
  1457. replacer = replacer.replacer;
  1458. }
  1459. if (typeof replacer === 'function') {
  1460. replacerFunc = replacer;
  1461. } else if (Array.isArray(replacer)) {
  1462. propertyList = [];
  1463. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1464. var v = list[i];
  1465. var item = (void 0);
  1466. if (typeof v === 'string') {
  1467. item = v;
  1468. } else if (
  1469. typeof v === 'number' ||
  1470. v instanceof String ||
  1471. v instanceof Number
  1472. ) {
  1473. item = String(v);
  1474. }
  1475. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1476. propertyList.push(item);
  1477. }
  1478. }
  1479. }
  1480. if (space instanceof Number) {
  1481. space = Number(space);
  1482. } else if (space instanceof String) {
  1483. space = String(space);
  1484. }
  1485. if (typeof space === 'number') {
  1486. if (space > 0) {
  1487. space = Math.min(10, Math.floor(space));
  1488. gap = ' '.substr(0, space);
  1489. }
  1490. } else if (typeof space === 'string') {
  1491. gap = space.substr(0, 10);
  1492. }
  1493. return serializeProperty('', {'': value})
  1494. function serializeProperty (key, holder) {
  1495. var value = holder[key];
  1496. if (value != null) {
  1497. if (typeof value.toJSON5 === 'function') {
  1498. value = value.toJSON5(key);
  1499. } else if (typeof value.toJSON === 'function') {
  1500. value = value.toJSON(key);
  1501. }
  1502. }
  1503. if (replacerFunc) {
  1504. value = replacerFunc.call(holder, key, value);
  1505. }
  1506. if (value instanceof Number) {
  1507. value = Number(value);
  1508. } else if (value instanceof String) {
  1509. value = String(value);
  1510. } else if (value instanceof Boolean) {
  1511. value = value.valueOf();
  1512. }
  1513. switch (value) {
  1514. case null: return 'null'
  1515. case true: return 'true'
  1516. case false: return 'false'
  1517. }
  1518. if (typeof value === 'string') {
  1519. return quoteString(value)
  1520. }
  1521. if (typeof value === 'number') {
  1522. return String(value)
  1523. }
  1524. if (typeof value === 'object') {
  1525. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1526. }
  1527. return undefined
  1528. }
  1529. function quoteString (value) {
  1530. var quotes = {
  1531. "'": 0.1,
  1532. '"': 0.2,
  1533. };
  1534. var replacements = {
  1535. "'": "\\'",
  1536. '"': '\\"',
  1537. '\\': '\\\\',
  1538. '\b': '\\b',
  1539. '\f': '\\f',
  1540. '\n': '\\n',
  1541. '\r': '\\r',
  1542. '\t': '\\t',
  1543. '\v': '\\v',
  1544. '\0': '\\0',
  1545. '\u2028': '\\u2028',
  1546. '\u2029': '\\u2029',
  1547. };
  1548. var product = '';
  1549. for (var i = 0; i < value.length; i++) {
  1550. var c = value[i];
  1551. switch (c) {
  1552. case "'":
  1553. case '"':
  1554. quotes[c]++;
  1555. product += c;
  1556. continue
  1557. case '\0':
  1558. if (util.isDigit(value[i + 1])) {
  1559. product += '\\x00';
  1560. continue
  1561. }
  1562. }
  1563. if (replacements[c]) {
  1564. product += replacements[c];
  1565. continue
  1566. }
  1567. if (c < ' ') {
  1568. var hexString = c.charCodeAt(0).toString(16);
  1569. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1570. continue
  1571. }
  1572. product += c;
  1573. }
  1574. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1575. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1576. return quoteChar + product + quoteChar
  1577. }
  1578. function serializeObject (value) {
  1579. if (stack.indexOf(value) >= 0) {
  1580. throw TypeError('Converting circular structure to JSON5')
  1581. }
  1582. stack.push(value);
  1583. var stepback = indent;
  1584. indent = indent + gap;
  1585. var keys = propertyList || Object.keys(value);
  1586. var partial = [];
  1587. for (var i = 0, list = keys; i < list.length; i += 1) {
  1588. var key = list[i];
  1589. var propertyString = serializeProperty(key, value);
  1590. if (propertyString !== undefined) {
  1591. var member = serializeKey(key) + ':';
  1592. if (gap !== '') {
  1593. member += ' ';
  1594. }
  1595. member += propertyString;
  1596. partial.push(member);
  1597. }
  1598. }
  1599. var final;
  1600. if (partial.length === 0) {
  1601. final = '{}';
  1602. } else {
  1603. var properties;
  1604. if (gap === '') {
  1605. properties = partial.join(',');
  1606. final = '{' + properties + '}';
  1607. } else {
  1608. var separator = ',\n' + indent;
  1609. properties = partial.join(separator);
  1610. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1611. }
  1612. }
  1613. stack.pop();
  1614. indent = stepback;
  1615. return final
  1616. }
  1617. function serializeKey (key) {
  1618. if (key.length === 0) {
  1619. return quoteString(key)
  1620. }
  1621. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1622. if (!util.isIdStartChar(firstChar)) {
  1623. return quoteString(key)
  1624. }
  1625. for (var i = firstChar.length; i < key.length; i++) {
  1626. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1627. return quoteString(key)
  1628. }
  1629. }
  1630. return key
  1631. }
  1632. function serializeArray (value) {
  1633. if (stack.indexOf(value) >= 0) {
  1634. throw TypeError('Converting circular structure to JSON5')
  1635. }
  1636. stack.push(value);
  1637. var stepback = indent;
  1638. indent = indent + gap;
  1639. var partial = [];
  1640. for (var i = 0; i < value.length; i++) {
  1641. var propertyString = serializeProperty(String(i), value);
  1642. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1643. }
  1644. var final;
  1645. if (partial.length === 0) {
  1646. final = '[]';
  1647. } else {
  1648. if (gap === '') {
  1649. var properties = partial.join(',');
  1650. final = '[' + properties + ']';
  1651. } else {
  1652. var separator = ',\n' + indent;
  1653. var properties$1 = partial.join(separator);
  1654. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1655. }
  1656. }
  1657. stack.pop();
  1658. indent = stepback;
  1659. return final
  1660. }
  1661. };
  1662. var JSON5 = {
  1663. parse: parse,
  1664. stringify: stringify,
  1665. };
  1666. var lib = JSON5;
  1667. var es5 = lib;
  1668. return es5;
  1669. })));
  1670. });
  1671. /*! *****************************************************************************
  1672. Copyright (c) Microsoft Corporation.
  1673. Permission to use, copy, modify, and/or distribute this software for any
  1674. purpose with or without fee is hereby granted.
  1675. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1676. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1677. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1678. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1679. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1680. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1681. PERFORMANCE OF THIS SOFTWARE.
  1682. ***************************************************************************** */
  1683. /* global Reflect, Promise */
  1684. var extendStatics = function(d, b) {
  1685. extendStatics = Object.setPrototypeOf ||
  1686. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1687. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1688. return extendStatics(d, b);
  1689. };
  1690. function __extends(d, b) {
  1691. extendStatics(d, b);
  1692. function __() { this.constructor = d; }
  1693. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1694. }
  1695. var __assign = function() {
  1696. __assign = Object.assign || function __assign(t) {
  1697. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1698. s = arguments[i];
  1699. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1700. }
  1701. return t;
  1702. };
  1703. return __assign.apply(this, arguments);
  1704. };
  1705. function __decorate(decorators, target, key, desc) {
  1706. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1707. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1708. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  1709. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1710. }
  1711. function __param(paramIndex, decorator) {
  1712. return function (target, key) { decorator(target, key, paramIndex); }
  1713. }
  1714. function __metadata(metadataKey, metadataValue) {
  1715. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1716. }
  1717. function __values(o) {
  1718. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1719. if (m) return m.call(o);
  1720. if (o && typeof o.length === "number") return {
  1721. next: function () {
  1722. if (o && i >= o.length) o = void 0;
  1723. return { value: o && o[i++], done: !o };
  1724. }
  1725. };
  1726. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1727. }
  1728. function __read(o, n) {
  1729. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1730. if (!m) return o;
  1731. var i = m.call(o), r, ar = [], e;
  1732. try {
  1733. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1734. }
  1735. catch (error) { e = { error: error }; }
  1736. finally {
  1737. try {
  1738. if (r && !r.done && (m = i["return"])) m.call(i);
  1739. }
  1740. finally { if (e) throw e.error; }
  1741. }
  1742. return ar;
  1743. }
  1744. function __spread() {
  1745. for (var ar = [], i = 0; i < arguments.length; i++)
  1746. ar = ar.concat(__read(arguments[i]));
  1747. return ar;
  1748. }
  1749. var PropertyDescription = /** @class */ (function () {
  1750. function PropertyDescription() {
  1751. var _this = this;
  1752. var args = [];
  1753. for (var _i = 0; _i < arguments.length; _i++) {
  1754. args[_i] = arguments[_i];
  1755. }
  1756. this.propertyes = {
  1757. props: [],
  1758. events: []
  1759. };
  1760. _$2.each(args, function (arg) {
  1761. _this.merge(arg);
  1762. });
  1763. }
  1764. PropertyDescription.prototype.merge = function (pd) {
  1765. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1766. if (pd.events) {
  1767. if (this.propertyes.events) {
  1768. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1769. }
  1770. else {
  1771. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1772. }
  1773. }
  1774. };
  1775. /**
  1776. * 根据分组名 获取属性定义
  1777. */
  1778. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1779. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1780. };
  1781. /**
  1782. * 获取全部事件
  1783. */
  1784. PropertyDescription.prototype.getEvents = function () {
  1785. return this.propertyes.events;
  1786. };
  1787. return PropertyDescription;
  1788. }());
  1789. //# sourceMappingURL=PropertyDescription.js.map
  1790. var PropertyDescriptionTable = new Map();
  1791. var width = {
  1792. name: 'width',
  1793. default: '',
  1794. group: 'common',
  1795. desc: '宽',
  1796. type: 'string'
  1797. };
  1798. var height = {
  1799. name: 'height',
  1800. default: '',
  1801. group: 'common',
  1802. desc: '高',
  1803. type: 'string'
  1804. };
  1805. var fieldLabel = {
  1806. name: 'fieldLabel',
  1807. default: '',
  1808. group: 'common',
  1809. desc: '文本描述',
  1810. type: 'string',
  1811. expr: true,
  1812. };
  1813. var text$1 = {
  1814. name: 'text',
  1815. default: '',
  1816. group: 'common',
  1817. desc: '文本描述',
  1818. type: 'string',
  1819. expr: true,
  1820. };
  1821. var iconCls = {
  1822. name: 'iconCls',
  1823. default: '',
  1824. group: 'common',
  1825. desc: '图标',
  1826. type: 'string',
  1827. expr: true,
  1828. };
  1829. var disabled = {
  1830. name: 'disabled',
  1831. default: false,
  1832. group: 'common',
  1833. desc: '禁用',
  1834. type: 'boolean',
  1835. expr: true,
  1836. };
  1837. var value = {
  1838. name: 'value',
  1839. default: '',
  1840. group: 'common',
  1841. desc: '字段值',
  1842. type: 'string',
  1843. expr: true,
  1844. };
  1845. var template = {
  1846. name: 'template',
  1847. default: '',
  1848. group: 'common',
  1849. desc: 'HTML内容',
  1850. type: 'string',
  1851. expr: true,
  1852. };
  1853. var reference = {
  1854. name: 'reference',
  1855. default: '',
  1856. group: 'common',
  1857. desc: '组件句柄',
  1858. type: 'string',
  1859. expr: true,
  1860. };
  1861. var tooltip = {
  1862. name: 'tooltip',
  1863. default: '',
  1864. group: 'common',
  1865. desc: '悬停提示',
  1866. type: 'string'
  1867. };
  1868. // =============事件 ==============
  1869. var click = {
  1870. name: 'click',
  1871. default: '',
  1872. group: 'listeners',
  1873. desc: '点击事件',
  1874. eventParamter: [
  1875. 'sender',
  1876. 'e: any'
  1877. ],
  1878. type: 'listeners'
  1879. };
  1880. var change = {
  1881. name: 'change',
  1882. default: '',
  1883. group: 'listeners',
  1884. desc: 'value change事件',
  1885. eventParamter: [
  1886. 'sender',
  1887. 'e: any'
  1888. ],
  1889. type: 'listeners'
  1890. };
  1891. var keyup = {
  1892. name: 'keyup',
  1893. default: '',
  1894. group: 'listeners',
  1895. desc: '键盘按键抬起事件',
  1896. eventParamter: [
  1897. 'sender',
  1898. 'e'
  1899. ],
  1900. type: 'listeners'
  1901. };
  1902. var afterrender = {
  1903. name: 'afterrender',
  1904. default: '',
  1905. group: 'listeners',
  1906. desc: '控件渲染后触发',
  1907. eventParamter: [
  1908. 'sender',
  1909. 'e'
  1910. ],
  1911. type: 'listeners'
  1912. };
  1913. // =============特性 ==============
  1914. var fix = {
  1915. name: 'fix',
  1916. default: '',
  1917. group: 'fix',
  1918. desc: '特性',
  1919. type: 'fix',
  1920. expr: true,
  1921. };
  1922. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1923. props: [
  1924. height
  1925. ]
  1926. }));
  1927. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1928. props: [
  1929. {
  1930. name: 'borderless',
  1931. default: true,
  1932. group: 'css',
  1933. desc: '有无边框',
  1934. type: 'boolean'
  1935. },
  1936. {
  1937. name: 'type',
  1938. default: '',
  1939. group: 'css',
  1940. desc: '布局类型',
  1941. type: ['line', 'clean', 'wide', 'space', 'form']
  1942. },
  1943. {
  1944. name: '_designMode',
  1945. default: 'module',
  1946. group: 'common',
  1947. desc: '设计类型',
  1948. type: ['none', 'module', 'scroll-module']
  1949. }
  1950. ]
  1951. }));
  1952. var YvBase = {
  1953. props: [
  1954. width, height, reference, afterrender, fix
  1955. ],
  1956. events: [
  1957. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1958. ]
  1959. };
  1960. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1961. props: [
  1962. template
  1963. ]
  1964. }));
  1965. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1966. props: [
  1967. {
  1968. name: 'label',
  1969. default: '',
  1970. group: 'common',
  1971. desc: '字段组标题',
  1972. type: 'string'
  1973. }
  1974. ]
  1975. }));
  1976. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1977. props: [
  1978. {
  1979. name: 'src',
  1980. default: '',
  1981. group: 'common',
  1982. desc: '地址路径',
  1983. type: 'string'
  1984. }
  1985. ]
  1986. }));
  1987. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1988. props: [
  1989. width, height,
  1990. {
  1991. name: 'value',
  1992. default: '上传',
  1993. group: 'common',
  1994. desc: '文本描述',
  1995. type: 'string'
  1996. },
  1997. {
  1998. name: 'upload',
  1999. default: '/upload',
  2000. group: 'common',
  2001. desc: '上传地址',
  2002. type: 'string'
  2003. },
  2004. ],
  2005. events: [
  2006. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2007. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2008. ]
  2009. }));
  2010. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2011. props: [
  2012. value,
  2013. {
  2014. name: 'imgWidth',
  2015. default: '',
  2016. group: 'common',
  2017. desc: '图片宽',
  2018. type: 'string'
  2019. },
  2020. {
  2021. name: 'imgHeight',
  2022. default: '',
  2023. group: 'common',
  2024. desc: '图片高',
  2025. type: 'string'
  2026. }
  2027. ]
  2028. }));
  2029. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2030. props: [
  2031. value,
  2032. {
  2033. name: 'imgWidth',
  2034. default: '',
  2035. group: 'common',
  2036. desc: '图片宽',
  2037. type: 'string'
  2038. },
  2039. {
  2040. name: 'imgHeight',
  2041. default: '',
  2042. group: 'common',
  2043. desc: '图片高',
  2044. type: 'string'
  2045. }
  2046. ]
  2047. }));
  2048. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2049. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2050. }));
  2051. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2052. props: [
  2053. fieldLabel, value, disabled,
  2054. tooltip, width, height
  2055. ],
  2056. }));
  2057. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2058. props: [
  2059. fieldLabel, value, disabled,
  2060. tooltip, width, height, keyup, afterrender, change
  2061. ],
  2062. }));
  2063. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2064. props: [
  2065. fieldLabel, value, disabled,
  2066. tooltip, width, height, keyup, afterrender, change
  2067. ],
  2068. }));
  2069. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2070. props: [
  2071. fieldLabel, value, disabled,
  2072. tooltip, width, height, keyup, afterrender, change
  2073. ],
  2074. }));
  2075. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2076. props: [
  2077. fieldLabel, value, disabled,
  2078. tooltip, width, height, keyup, afterrender, change
  2079. ],
  2080. }));
  2081. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2082. props: [
  2083. fieldLabel, value, disabled,
  2084. tooltip, width, height, keyup, afterrender, change
  2085. ],
  2086. }));
  2087. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2088. props: [
  2089. fieldLabel, value, disabled,
  2090. tooltip, width, height, keyup, afterrender, change
  2091. ],
  2092. }));
  2093. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2094. props: [
  2095. fieldLabel, value, disabled,
  2096. tooltip, width, height, keyup, afterrender, change
  2097. ],
  2098. }));
  2099. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2100. props: [
  2101. fieldLabel, value, disabled,
  2102. tooltip, width, height, keyup, afterrender, change
  2103. ],
  2104. }));
  2105. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2106. props: [
  2107. fieldLabel, value, disabled,
  2108. tooltip, width, height
  2109. ],
  2110. }));
  2111. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2112. props: [
  2113. fieldLabel, value, disabled,
  2114. tooltip, width, height, keyup, afterrender, change
  2115. ],
  2116. }));
  2117. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2118. props: [
  2119. fieldLabel, value, disabled,
  2120. tooltip, width, height, keyup, afterrender, change
  2121. ],
  2122. }));
  2123. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2124. props: [
  2125. fieldLabel, value, disabled,
  2126. tooltip, width, height, keyup, afterrender, change
  2127. ],
  2128. }));
  2129. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2130. props: [
  2131. fieldLabel, value, disabled,
  2132. tooltip, width, height, afterrender, change
  2133. ],
  2134. }));
  2135. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2136. /**
  2137. * 弹出输入框,输入文字
  2138. * @param message 提示文字
  2139. * @param defaultValue 默认值
  2140. * @param multiLine 是否多行输入
  2141. */
  2142. function prompt$1(message, defaultValue, multiLine) {
  2143. if (defaultValue === void 0) { defaultValue = ""; }
  2144. if (multiLine === void 0) { multiLine = false; }
  2145. return new Promise(function (resolve) {
  2146. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2147. if (button === 'ok') {
  2148. resolve(value);
  2149. }
  2150. }, null, multiLine, defaultValue);
  2151. });
  2152. }
  2153. /**
  2154. * 显示错误异常信息
  2155. * @param msg 错误内容
  2156. * @param sender 发送者按钮(可以为空)
  2157. */
  2158. function showErrorDialog(msg, sender) {
  2159. console.error(msg);
  2160. Ext.MessageBox.show({
  2161. title: '错误',
  2162. msg: msg,
  2163. buttons: Ext.MessageBox.OK,
  2164. animateTarget: sender,
  2165. icon: 'error',
  2166. cls: 'show-icon-messagebox',
  2167. });
  2168. }
  2169. /**
  2170. * 显示错误异常信息
  2171. * @param msg 错误内容
  2172. * @param sender 发送者按钮(可以为空)
  2173. */
  2174. function showInfoDialogSimple(msg, sender) {
  2175. console.info(msg);
  2176. Ext.MessageBox.show({
  2177. title: '提示',
  2178. msg: msg,
  2179. buttons: Ext.MessageBox.OK,
  2180. animateTarget: sender,
  2181. icon: 'info',
  2182. cls: 'show-icon-messagebox',
  2183. });
  2184. }
  2185. function msgError(msg, sender) {
  2186. showErrorDialog(msg, sender);
  2187. }
  2188. /**
  2189. * 中间灰底白字提示
  2190. */
  2191. function msg(message) {
  2192. console.log(message);
  2193. var t = { message: message };
  2194. var WMSTranslate = window["WMSTranslate"];
  2195. if (WMSTranslate) {
  2196. if (typeof window['viewTranslate'] === 'function') {
  2197. window['viewTranslate'](t, message, "message");
  2198. }
  2199. }
  2200. var $body = $$2('body');
  2201. $body.find('[xtype=tooltip]').remove();
  2202. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2203. ' <div class="yvan-msg-content">' +
  2204. _$2.escape(t.message) +
  2205. '</div></div>');
  2206. $body.append($w);
  2207. var iframeWidth = $w.parent().width();
  2208. var iframeHeight = $w.parent().height();
  2209. var windowWidth = $w.width();
  2210. var windowHeight = $w.height();
  2211. var setWidth = (iframeWidth - windowWidth) / 2;
  2212. var setHeight = (iframeHeight - windowHeight) / 2;
  2213. if (iframeHeight < windowHeight || setHeight < 0) {
  2214. setHeight = 0;
  2215. }
  2216. if (iframeWidth < windowWidth || setWidth < 0) {
  2217. setWidth = 0;
  2218. }
  2219. $w.css({ left: setWidth, top: setHeight });
  2220. setTimeout(function () {
  2221. $w.remove();
  2222. }, 3000);
  2223. }
  2224. //# sourceMappingURL=message.js.map
  2225. localforage.config({
  2226. name: "studio",
  2227. storeName: "item",
  2228. });
  2229. function getItem(key, callback) {
  2230. localforage.getItem(key).then(function (value) {
  2231. if (callback) {
  2232. callback(value);
  2233. }
  2234. });
  2235. }
  2236. function setItem(key, value, callback) {
  2237. localforage.setItem(key, value).then(function (val) {
  2238. if (callback) {
  2239. callback();
  2240. }
  2241. });
  2242. }
  2243. var native = {
  2244. /**
  2245. * 读取文件
  2246. */
  2247. loadFile: function (fileName, callback) {
  2248. console.log('loadFile', fileName);
  2249. getItem('NATIVE_' + fileName, callback);
  2250. },
  2251. /**
  2252. * 保存文件
  2253. */
  2254. saveFile: function (fileName, content) {
  2255. console.log('saveFile', fileName, content);
  2256. setItem('NATIVE_' + fileName, content);
  2257. },
  2258. openInIdea: function (path) {
  2259. msg(path);
  2260. },
  2261. /**
  2262. * 初始化 native 工具类
  2263. */
  2264. init: function () {
  2265. var ClipboardJS = window['ClipboardJS'];
  2266. if (!ClipboardJS) {
  2267. msg('没有引入 ClipboardJS');
  2268. return;
  2269. }
  2270. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2271. var clipboard = new ClipboardJS('.__btnClipboard');
  2272. },
  2273. /**
  2274. * 设置剪切板
  2275. */
  2276. clipboardSet: function (c) {
  2277. var $btn = $('.__btnClipboard');
  2278. $btn.attr('data-clipboard-text', c);
  2279. $btn.trigger("click");
  2280. },
  2281. };
  2282. /**
  2283. * 判断变量是否有值 value === null || value === undefined
  2284. * @param value 目标变量
  2285. */
  2286. var noValue = function (value) {
  2287. return value === null || value === undefined;
  2288. };
  2289. //# sourceMappingURL=Utils.js.map
  2290. function initStateTree () {
  2291. Ext.define('com.yvan.studio.StateTree', {
  2292. extend: 'Ext.tree.Panel',
  2293. _saveStateFlag: true,
  2294. _filterText: '',
  2295. fbar: [
  2296. {
  2297. xtype: 'textfield',
  2298. flex: 1,
  2299. emptyText: '搜索过滤',
  2300. enableKeyEvents: true,
  2301. listeners: {
  2302. change: function (sender) {
  2303. var tree = sender.up("treepanel");
  2304. tree.filterByText(this.getRawValue());
  2305. },
  2306. keyup: function (sender, e) {
  2307. var tree = sender.up("treepanel");
  2308. if (e.ESC === e.getKey()) {
  2309. sender.setValue('');
  2310. tree.filterByText('');
  2311. }
  2312. }
  2313. }
  2314. },
  2315. ],
  2316. getStateFilename: function () {
  2317. throw Error('没有实现这个函数');
  2318. },
  2319. initComponent: function () {
  2320. var me = this;
  2321. this.on({
  2322. afterrender: function () {
  2323. var _this = this;
  2324. // 回车后打开节点
  2325. $(me.el.dom).keydown(function (event) {
  2326. if (event.keyCode === 13) {
  2327. event.preventDefault();
  2328. _this.fireEvent('itemverify');
  2329. return;
  2330. }
  2331. });
  2332. },
  2333. afteritemexpand: {
  2334. fn: function (node, index, item, eOpts) {
  2335. this.saveState();
  2336. },
  2337. buffer: 100,
  2338. },
  2339. afteritemcollapse: {
  2340. fn: function (node, index, item, eOpts) {
  2341. this.saveState();
  2342. },
  2343. buffer: 100,
  2344. },
  2345. itemdblclick: function (sender, record) {
  2346. this.fireEvent('itemverify');
  2347. },
  2348. itemclick: {
  2349. fn: function (node, index, item, eOpts) {
  2350. this.saveState();
  2351. },
  2352. buffer: 100,
  2353. }
  2354. });
  2355. this.superclass.superclass.initComponent.apply(this, arguments);
  2356. },
  2357. restoreState: function () {
  2358. var _this = this;
  2359. native.loadFile(this.getStateFilename(), function (content) {
  2360. if (!content)
  2361. return;
  2362. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2363. _this._saveStateFlag = false;
  2364. if (_.isArray(expands)) {
  2365. _.forEach(expands, function (p) {
  2366. _this.expandPath(p);
  2367. });
  2368. }
  2369. if (_.isArray(selections) && selections[0]) {
  2370. try {
  2371. _this.selectPath(selections[0]);
  2372. }
  2373. catch (e) {
  2374. }
  2375. }
  2376. if (scrollPosition && scrollSize) {
  2377. var size = _this.scrollable.getSize();
  2378. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2379. try {
  2380. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2381. }
  2382. catch (e) {
  2383. }
  2384. }
  2385. }
  2386. setTimeout(function () {
  2387. _this._saveStateFlag = true;
  2388. }, 200);
  2389. });
  2390. },
  2391. saveState: function () {
  2392. if (!this._saveStateFlag) {
  2393. return;
  2394. }
  2395. if (this._filterText) {
  2396. // 有筛选,不保存展开状态
  2397. return;
  2398. }
  2399. var expands = [];
  2400. var selections = [];
  2401. var selection = this.getSelection();
  2402. _.forEach(selection, function (item) {
  2403. selections.push(item.getPath());
  2404. });
  2405. var data = this.getStore().data;
  2406. _.forEach(data.items, function (item) {
  2407. if (item.data.expanded === true) {
  2408. expands.push(item.getPath());
  2409. }
  2410. });
  2411. var scrollPosition = this.scrollable.position;
  2412. var scrollSize = this.scrollable.getSize();
  2413. native.saveFile(this.getStateFilename(), {
  2414. selections: selections,
  2415. expands: expands,
  2416. scrollPosition: scrollPosition,
  2417. scrollSize: scrollSize
  2418. });
  2419. },
  2420. filterByText: function (text) {
  2421. this._filterText = text;
  2422. this._filterBy(this, text, 'text');
  2423. },
  2424. _filterBy: _.debounce(function (me, text, by) {
  2425. var view = me.getView();
  2426. me.store.clearFilter();
  2427. if (!me._filterText) {
  2428. // 没有筛选内容,还原状态
  2429. var selections = me.getSelection();
  2430. var selectionPaths_1 = [];
  2431. _.forEach(me.getSelection(), function (item) {
  2432. selectionPaths_1.push(item.getPath());
  2433. });
  2434. me.collapseAll();
  2435. me.restoreState();
  2436. _.forEach(selectionPaths_1, function (path) {
  2437. me.expandPath(path);
  2438. });
  2439. me.setSelection(selections);
  2440. return;
  2441. }
  2442. // 递归查找所有需要可见的节点 id 数组
  2443. var nodesAndParents = [];
  2444. var expandPaths = [];
  2445. me.getRootNode().cascadeBy(function (tree, view) {
  2446. var currNode = this;
  2447. currNode.collapse();
  2448. if (currNode && currNode.data[by] &&
  2449. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2450. // 展开到匹配的路径
  2451. // me.expandPath(currNode.getPath());
  2452. expandPaths.push(currNode.getPath());
  2453. // 沿途父节点全部设定为可见
  2454. while (currNode.parentNode) {
  2455. nodesAndParents.push(currNode.id);
  2456. currNode = currNode.parentNode;
  2457. }
  2458. }
  2459. }, null, [me, view]);
  2460. me.store.filterBy(function (r) {
  2461. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2462. });
  2463. _.forEach(expandPaths, function (path) {
  2464. me.expandPath(path);
  2465. });
  2466. }, 1000),
  2467. });
  2468. }
  2469. //# sourceMappingURL=StateTree.js.map
  2470. function initDashboard () {
  2471. Ext.define('com.yvan.studio.Dashboard', {
  2472. extend: 'Ext.panel.Panel',
  2473. alias: 'widget.dashboard',
  2474. xtype: 'dashboard',
  2475. html: ''
  2476. });
  2477. }
  2478. //# sourceMappingURL=dashboard.js.map
  2479. var handles$1 = {
  2480. mainWindow: undefined,
  2481. fileTree: undefined,
  2482. dbTree: undefined,
  2483. viewoutlinetree: undefined,
  2484. statusbar: undefined,
  2485. dictTree: undefined,
  2486. property: undefined,
  2487. dbcode: undefined,
  2488. report: undefined,
  2489. widget: undefined,
  2490. whLayout: undefined,
  2491. };
  2492. window['handles'] = handles$1;
  2493. function setDictTree(value) {
  2494. handles$1.dictTree = value;
  2495. }
  2496. function setMainWindow(value) {
  2497. handles$1.mainWindow = value;
  2498. }
  2499. function setReport(value) {
  2500. handles$1.report = value;
  2501. }
  2502. function setStatusbar(statusbar) {
  2503. handles$1.statusbar = statusbar;
  2504. }
  2505. function setFileTree(value) {
  2506. handles$1.fileTree = value;
  2507. }
  2508. function setDbTree(value) {
  2509. handles$1.dbTree = value;
  2510. }
  2511. function setWidget(value) {
  2512. handles$1.widget = value;
  2513. }
  2514. function setWhLayout(value) {
  2515. handles$1.whLayout = value;
  2516. }
  2517. function setViewoutlinetree(value) {
  2518. handles$1.viewoutlinetree = value;
  2519. }
  2520. function setPropertyPanel(value) {
  2521. handles$1.property = value;
  2522. }
  2523. function setDbCode(value) {
  2524. handles$1.dbcode = value;
  2525. }
  2526. //# sourceMappingURL=Handles.js.map
  2527. /**
  2528. * 获取当前打开的项目资料
  2529. */
  2530. function getCurrentProject() {
  2531. // const value = sessionStorage.getItem('CurrentProject');
  2532. // if (value) {
  2533. // project = JSON.parse(value)
  2534. // if (!project.url) {
  2535. // project = undefined
  2536. // }
  2537. // }
  2538. // return project
  2539. return {
  2540. uuid: '00000000',
  2541. name: '本服项目',
  2542. url: '',
  2543. };
  2544. }
  2545. /**
  2546. * 设置当前打开的项目资料(全局)
  2547. */
  2548. function setCurrentProject(value) {
  2549. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  2550. }
  2551. //# sourceMappingURL=Project.js.map
  2552. var CacheStore = /** @class */ (function () {
  2553. function CacheStore() {
  2554. // 订阅
  2555. this.subscribeList = [];
  2556. this.apiResponse = undefined;
  2557. }
  2558. /**
  2559. * 订阅结果集
  2560. */
  2561. CacheStore.prototype.registe = function (fn) {
  2562. this.subscribeList.push(fn);
  2563. };
  2564. /**
  2565. * 取消订阅
  2566. */
  2567. CacheStore.prototype.unregiste = function (fn) {
  2568. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  2569. };
  2570. /**
  2571. * 尝试取数据(先读缓存)
  2572. */
  2573. CacheStore.prototype.reloadIfNeed = function (param) {
  2574. var _this = this;
  2575. if (typeof this.apiResponse === 'undefined') {
  2576. // 从未有获取过值
  2577. var cacheKey = this.getCacheKey(param);
  2578. if (cacheKey) {
  2579. // 可以从缓存读
  2580. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2581. native.loadFile(fileName, function (res) {
  2582. if (res) {
  2583. // 缓存有值
  2584. _this.apiResponse = res;
  2585. _this.notifyRefresh();
  2586. }
  2587. else {
  2588. // 缓存没值
  2589. _this.reloadForce(param).then(function (res) {
  2590. });
  2591. }
  2592. });
  2593. }
  2594. else {
  2595. // 不能从缓存读
  2596. this.reloadForce(param).then(function (res) {
  2597. });
  2598. }
  2599. return true;
  2600. }
  2601. return false;
  2602. };
  2603. /**
  2604. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  2605. */
  2606. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  2607. var _this = this;
  2608. return new Promise(function (resolve, reject) {
  2609. if (typeof _this.apiResponse === 'undefined') {
  2610. // 从未有获取过值
  2611. var cacheKey = _this.getCacheKey(param);
  2612. if (cacheKey) {
  2613. // 可以从缓存读
  2614. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2615. native.loadFile(fileName, function (res) {
  2616. if (res) {
  2617. // 缓存有值
  2618. _this.apiResponse = res;
  2619. _this.notifyRefresh();
  2620. resolve(_this.apiResponse);
  2621. }
  2622. else {
  2623. // 缓存没值
  2624. _this.reloadForce(param).then(function (res) {
  2625. resolve(_this.apiResponse);
  2626. });
  2627. }
  2628. });
  2629. }
  2630. else {
  2631. // 不能从缓存读
  2632. _this.reloadForce(param).then(function (res) {
  2633. resolve(_this.apiResponse);
  2634. });
  2635. }
  2636. }
  2637. else {
  2638. // 有值,获取过
  2639. resolve(_this.apiResponse);
  2640. }
  2641. });
  2642. };
  2643. /**
  2644. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  2645. */
  2646. CacheStore.prototype.reloadForce = function (param) {
  2647. var _this = this;
  2648. _$2.forEach(this.subscribeList, function (fn) {
  2649. fn(true);
  2650. });
  2651. return this.invokeApi(param)
  2652. .then(function (res) {
  2653. _this.apiResponse = res;
  2654. var cacheKey = _this.getCacheKey(param);
  2655. if (cacheKey) {
  2656. // 可以保存到缓存
  2657. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  2658. native.saveFile(fileName, res);
  2659. }
  2660. // 通知订阅者刷新
  2661. _this.notifyRefresh();
  2662. })
  2663. .finally(function () {
  2664. _$2.forEach(_this.subscribeList, function (fn) {
  2665. fn(false);
  2666. });
  2667. });
  2668. };
  2669. /**
  2670. * 通知组件,isLoading状态被更改
  2671. */
  2672. CacheStore.prototype.notifyLoading = function (isLoading) {
  2673. var _this = this;
  2674. _$2.forEach(this.subscribeList, function (fn) {
  2675. fn(_this.apiResponse);
  2676. });
  2677. };
  2678. /**
  2679. * 通知数据更改,需要刷新
  2680. */
  2681. CacheStore.prototype.notifyRefresh = function () {
  2682. var _this = this;
  2683. _$2.forEach(this.subscribeList, function (fn) {
  2684. fn(_this.apiResponse);
  2685. });
  2686. };
  2687. return CacheStore;
  2688. }());
  2689. //# sourceMappingURL=CacheStore.js.map
  2690. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  2691. function createEmptyModule(path, filename) {
  2692. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  2693. }
  2694. function createFolder(parentPath, filename) {
  2695. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  2696. }
  2697. function getModuleFileContent(module) {
  2698. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  2699. }
  2700. function saveFile(fileFullPath, fileContent) {
  2701. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  2702. // @ts-ignore
  2703. system.msg("保存成功");
  2704. return res;
  2705. });
  2706. }
  2707. function getQueryDslInfo(tableName) {
  2708. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  2709. args: [
  2710. { tableName: tableName }
  2711. ]
  2712. }).catch(function (e) {
  2713. var _a, _b;
  2714. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  2715. showErrorDialog(msg);
  2716. console.error(msg, e);
  2717. });
  2718. }
  2719. function invokeServer(url, param) {
  2720. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  2721. return request.post(url, {
  2722. args: [
  2723. param
  2724. ]
  2725. }).catch(function (e) {
  2726. var _a, _b;
  2727. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  2728. showErrorDialog(msg);
  2729. console.error(msg, e);
  2730. });
  2731. }
  2732. function parseSqlApi(sql) {
  2733. return request.post(getBaseUrl() + "@parseSqlApi", {
  2734. args: [sql]
  2735. }).catch(function (e) {
  2736. var _a, _b;
  2737. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  2738. showErrorDialog(msg);
  2739. console.error(msg, e);
  2740. });
  2741. }
  2742. function saveModuleFiles(param) {
  2743. return request.post(getBaseUrl() + "@saveModuleFiles", {
  2744. args: [
  2745. param
  2746. ]
  2747. }).catch(function (e) {
  2748. var _a, _b;
  2749. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  2750. showErrorDialog(msg);
  2751. console.error(msg, e);
  2752. });
  2753. }
  2754. function createQueryDSLFile(_a) {
  2755. var schema_name = _a.schema_name, table_name = _a.table_name;
  2756. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  2757. args: [{ schema_name: schema_name, table_name: table_name }]
  2758. }).catch(function (e) {
  2759. var _a, _b;
  2760. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  2761. showErrorDialog(msg);
  2762. console.error(msg, e);
  2763. });
  2764. }
  2765. function dbToMeta(param) {
  2766. if (typeof param === 'undefined') {
  2767. param = { datasource: 'master' };
  2768. }
  2769. else if (typeof param.datasource === 'undefined') {
  2770. param.datasource = 'master';
  2771. }
  2772. return request.post(getBaseUrl() + "@dbToMeta", {
  2773. args: [
  2774. param
  2775. ]
  2776. }).catch(function (e) {
  2777. var _a, _b;
  2778. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  2779. showErrorDialog(msg);
  2780. console.error(msg, e);
  2781. });
  2782. }
  2783. function getColumnDomainApi(param) {
  2784. if (typeof param === 'undefined') {
  2785. param = { datasource: 'master' };
  2786. }
  2787. else if (typeof param.datasource === 'undefined') {
  2788. param.datasource = 'master';
  2789. }
  2790. return request.post(getBaseUrl() + "@getColumnDomain", {
  2791. args: [
  2792. param
  2793. ]
  2794. }).catch(function (e) {
  2795. var _a, _b;
  2796. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  2797. showErrorDialog(msg);
  2798. console.error(msg, e);
  2799. });
  2800. }
  2801. function getMateData(param) {
  2802. if (typeof param === 'undefined') {
  2803. param = { datasource: 'master' };
  2804. }
  2805. else if (typeof param.datasource === 'undefined') {
  2806. param.datasource = 'master';
  2807. }
  2808. return request.post(getBaseUrl() + "@getMateData", {
  2809. args: [
  2810. param
  2811. ]
  2812. }).catch(function (e) {
  2813. var _a, _b;
  2814. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  2815. showErrorDialog(msg);
  2816. console.error(msg, e);
  2817. });
  2818. }
  2819. function getMateDataByTableName(param) {
  2820. if (typeof param === 'undefined') {
  2821. param = { datasource: 'master' };
  2822. }
  2823. else if (typeof param.datasource === 'undefined') {
  2824. param.datasource = 'master';
  2825. }
  2826. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  2827. args: [
  2828. param
  2829. ]
  2830. }).catch(function (e) {
  2831. var _a, _b;
  2832. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  2833. showErrorDialog(msg);
  2834. console.error(msg, e);
  2835. });
  2836. }
  2837. function saveMetaTableChanges(param) {
  2838. if (typeof param === 'undefined') {
  2839. param = { datasource: 'master' };
  2840. }
  2841. else if (typeof param.datasource === 'undefined') {
  2842. param.datasource = 'master';
  2843. }
  2844. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  2845. args: [
  2846. param
  2847. ]
  2848. }).catch(function (e) {
  2849. var _a, _b;
  2850. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  2851. showErrorDialog(msg);
  2852. console.error(msg, e);
  2853. });
  2854. }
  2855. function getModifyTableDDL(param) {
  2856. if (typeof param === 'undefined') {
  2857. param = { datasource: 'master' };
  2858. }
  2859. else if (typeof param.datasource === 'undefined') {
  2860. param.datasource = 'master';
  2861. }
  2862. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  2863. args: [
  2864. param
  2865. ]
  2866. }).catch(function (e) {
  2867. var _a, _b;
  2868. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  2869. showErrorDialog(msg);
  2870. console.error(msg, e);
  2871. });
  2872. }
  2873. function pushToDbCommitApi(param) {
  2874. if (typeof param === 'undefined') {
  2875. param = { datasource: 'master' };
  2876. }
  2877. else if (typeof param.datasource === 'undefined') {
  2878. param.datasource = 'master';
  2879. }
  2880. return request.post(getBaseUrl() + "@pushToDbCommit", {
  2881. args: [
  2882. param
  2883. ]
  2884. }).catch(function (e) {
  2885. var _a, _b;
  2886. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  2887. showErrorDialog(msg);
  2888. console.error(msg, e);
  2889. });
  2890. }
  2891. /**
  2892. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  2893. */
  2894. function saveMetaExBuildDDL(param) {
  2895. if (typeof param === 'undefined') {
  2896. param = { datasource: 'master' };
  2897. }
  2898. else if (typeof param.datasource === 'undefined') {
  2899. param.datasource = 'master';
  2900. }
  2901. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  2902. args: [
  2903. param
  2904. ]
  2905. }).catch(function (e) {
  2906. var _a, _b;
  2907. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  2908. showErrorDialog(msg);
  2909. console.error(msg, e);
  2910. });
  2911. }
  2912. function registerResource(params) {
  2913. return request.post(getBaseUrl() + "@registerResource", {
  2914. args: [params]
  2915. }).catch(function (e) {
  2916. var _a, _b;
  2917. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  2918. showErrorDialog(msg);
  2919. console.error(msg, e);
  2920. });
  2921. }
  2922. function getMenuTree(params) {
  2923. return request.post(getBaseUrl() + "@getMenuTree", {
  2924. args: [params]
  2925. }).catch(function (e) {
  2926. var _a, _b;
  2927. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  2928. showErrorDialog(msg);
  2929. console.error(msg, e);
  2930. });
  2931. }
  2932. function moduleTree() {
  2933. return request.post(getBaseUrl() + "@moduleTree")
  2934. .catch(function (e) {
  2935. var _a, _b;
  2936. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  2937. showErrorDialog(msg);
  2938. console.error(msg, e);
  2939. });
  2940. }
  2941. function dropTableDDL(schemaName, tableName) {
  2942. return request.post(getBaseUrl() + "@dropTableDDL", {
  2943. args: [
  2944. { schemaName: schemaName, tableName: tableName },
  2945. ]
  2946. }).catch(function (e) {
  2947. var _a, _b;
  2948. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  2949. showErrorDialog(msg);
  2950. console.error(msg, e);
  2951. });
  2952. }
  2953. function renameTableDDL(schemaName, tableName, reTableName) {
  2954. return request.post(getBaseUrl() + "@renameTableDDL", {
  2955. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  2956. }).catch(function (e) {
  2957. var _a, _b;
  2958. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  2959. showErrorDialog(msg);
  2960. console.error(msg, e);
  2961. });
  2962. }
  2963. function executeModifyProcedureSQL(param) {
  2964. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  2965. args: [
  2966. param,
  2967. ]
  2968. }).catch(function (e) {
  2969. var _a, _b;
  2970. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  2971. showErrorDialog(msg);
  2972. console.error(msg, e);
  2973. });
  2974. }
  2975. function parseDynamicSqlApi(sql, dataSource) {
  2976. return request.post(getBaseUrl() + "@parseDynamicSql", {
  2977. args: [
  2978. { sql: sql, dataSource: dataSource },
  2979. ]
  2980. }).catch(function (e) {
  2981. var _a, _b;
  2982. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  2983. showErrorDialog(msg);
  2984. console.error(msg, e);
  2985. });
  2986. }
  2987. function exporerList() {
  2988. return request.post(getBaseUrl() + "@exporerList", {
  2989. args: [{}]
  2990. }).catch(function (e) {
  2991. var _a, _b;
  2992. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  2993. showErrorDialog(msg);
  2994. console.error(msg, e);
  2995. });
  2996. }
  2997. function reportListApi() {
  2998. return request.post(getBaseUrl() + "@reportList", {
  2999. args: []
  3000. }).catch(function (e) {
  3001. var _a, _b;
  3002. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  3003. showErrorDialog(msg);
  3004. console.error(msg, e);
  3005. });
  3006. }
  3007. function reportByIdApi(reportId) {
  3008. return request.post(getBaseUrl() + "@reportById", {
  3009. args: [
  3010. { reportId: reportId },
  3011. ]
  3012. }).catch(function (e) {
  3013. var _a, _b;
  3014. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  3015. showErrorDialog(msg);
  3016. console.error(msg, e);
  3017. });
  3018. }
  3019. function createReportApi(reportName) {
  3020. return request.post(getBaseUrl() + "@createReport", {
  3021. args: [
  3022. { reportName: reportName },
  3023. ]
  3024. }).catch(function (e) {
  3025. var _a, _b;
  3026. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  3027. showErrorDialog(msg);
  3028. console.error(msg, e);
  3029. });
  3030. }
  3031. function saveReportApi(param) {
  3032. return request.post(getBaseUrl() + "@saveReport", {
  3033. args: [
  3034. param,
  3035. ]
  3036. }).catch(function (e) {
  3037. var _a, _b;
  3038. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  3039. showErrorDialog(msg);
  3040. console.error(msg, e);
  3041. });
  3042. }
  3043. function delReportApi(report_id) {
  3044. return request.post(getBaseUrl() + "@delReport", {
  3045. args: [{ report_id: report_id },]
  3046. }).catch(function (e) {
  3047. var _a, _b;
  3048. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  3049. showErrorDialog(msg);
  3050. console.error(msg, e);
  3051. });
  3052. }
  3053. function getDict(param) {
  3054. if (typeof param === 'undefined') {
  3055. param = { datasource: 'master' };
  3056. }
  3057. else if (typeof param.datasource === 'undefined') {
  3058. param.datasource = 'master';
  3059. }
  3060. return request.post(getBaseUrl() + "@getDict", {
  3061. args: [
  3062. param
  3063. ]
  3064. });
  3065. }
  3066. function saveDictApi(param) {
  3067. if (typeof param === 'undefined') {
  3068. param = { datasource: 'master' };
  3069. }
  3070. else if (typeof param.datasource === 'undefined') {
  3071. param.datasource = 'master';
  3072. }
  3073. return request.post(getBaseUrl() + "@saveDict", {
  3074. args: [
  3075. param
  3076. ]
  3077. }).catch(function (e) {
  3078. var _a, _b;
  3079. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  3080. showErrorDialog(msg);
  3081. console.error(msg, e);
  3082. });
  3083. }
  3084. function saveDictItemsApi(param) {
  3085. if (typeof param === 'undefined') {
  3086. param = { datasource: 'master' };
  3087. }
  3088. else if (typeof param.datasource === 'undefined') {
  3089. param.datasource = 'master';
  3090. }
  3091. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  3092. args: [
  3093. param
  3094. ]
  3095. }).catch(function (e) {
  3096. var _a, _b;
  3097. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  3098. showErrorDialog(msg);
  3099. console.error(msg, e);
  3100. });
  3101. }
  3102. function createDictEnum(param) {
  3103. return request.post(getBaseUrl() + "@createDictEnum", {
  3104. args: [
  3105. param
  3106. ]
  3107. }).catch(function (e) {
  3108. var _a, _b;
  3109. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  3110. showErrorDialog(msg);
  3111. console.error(msg, e);
  3112. });
  3113. }
  3114. function loadSqlContentApi(url) {
  3115. return request.post(getBaseUrl() + "@loadSqlContent", {
  3116. args: [
  3117. {
  3118. url: GLOBAL_NAMESPACE_PREFIX + url,
  3119. }
  3120. ]
  3121. }).catch(function (e) {
  3122. var _a, _b;
  3123. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  3124. showErrorDialog(msg);
  3125. console.error(msg, e);
  3126. });
  3127. }
  3128. function saveSqlContentApi(url, content) {
  3129. return request.post(getBaseUrl() + "@saveSqlContent", {
  3130. args: [
  3131. {
  3132. url: GLOBAL_NAMESPACE_PREFIX + url,
  3133. content: content,
  3134. }
  3135. ]
  3136. }).catch(function (e) {
  3137. var _a, _b;
  3138. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  3139. showErrorDialog(msg);
  3140. console.error(msg, e);
  3141. });
  3142. }
  3143. function readBpmn(param) {
  3144. return request.post(getBaseUrl() + "@readBpmn", {
  3145. args: [param]
  3146. }).catch(function (e) {
  3147. var _a, _b;
  3148. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3149. showErrorDialog(msg);
  3150. console.error(msg, e);
  3151. });
  3152. }
  3153. function createBpmn(path, filename) {
  3154. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3155. var _a, _b;
  3156. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  3157. showErrorDialog(msg);
  3158. console.error(msg, e);
  3159. });
  3160. }
  3161. function saveBpmn(fileFullPath, fileContent) {
  3162. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  3163. // @ts-ignore
  3164. system.msg("保存成功");
  3165. return res;
  3166. });
  3167. }
  3168. function deleteBpmn(path, filename) {
  3169. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3170. var _a, _b;
  3171. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  3172. showErrorDialog(msg);
  3173. console.error(msg, e);
  3174. });
  3175. }
  3176. function createDevForm(param) {
  3177. return request.post(getBaseUrl() + "@createDevForm", {
  3178. args: [param]
  3179. }).catch(function (e) {
  3180. var _a, _b;
  3181. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3182. showErrorDialog(msg);
  3183. console.error(msg, e);
  3184. });
  3185. }
  3186. function readDevForm(param) {
  3187. return request.post(getBaseUrl() + "@readDevForm", {
  3188. args: [param]
  3189. }).catch(function (e) {
  3190. var _a, _b;
  3191. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3192. showErrorDialog(msg);
  3193. console.error(msg, e);
  3194. });
  3195. }
  3196. function calcColumnForm(param) {
  3197. return request.post(getBaseUrl() + "@calcColumnForm", {
  3198. args: [param]
  3199. }).catch(function (e) {
  3200. var _a, _b;
  3201. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  3202. showErrorDialog(msg);
  3203. console.error(msg, e);
  3204. });
  3205. }
  3206. function widgetListApi(param) {
  3207. return request.post(getBaseUrl() + "@widgetListApi", {
  3208. args: [param]
  3209. }).catch(function (e) {
  3210. var _a, _b;
  3211. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  3212. showErrorDialog(msg);
  3213. console.error(msg, e);
  3214. });
  3215. }
  3216. function readWidget(param) {
  3217. return request.post(getBaseUrl() + "@readWidget", {
  3218. args: [param]
  3219. }).catch(function (e) {
  3220. var _a, _b;
  3221. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3222. showErrorDialog(msg);
  3223. console.error(msg, e);
  3224. });
  3225. }
  3226. function saveWidget(param) {
  3227. return request.post(getBaseUrl() + "@saveWidget", {
  3228. args: [param]
  3229. }).catch(function (e) {
  3230. var _a, _b;
  3231. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  3232. showErrorDialog(msg);
  3233. console.error(msg, e);
  3234. });
  3235. }
  3236. function deleteWidget(param) {
  3237. return request.post(getBaseUrl() + "@deleteWidget", {
  3238. args: [param]
  3239. }).catch(function (e) {
  3240. var _a, _b;
  3241. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  3242. showErrorDialog(msg);
  3243. console.error(msg, e);
  3244. });
  3245. }
  3246. function getDataBaseNameApi() {
  3247. return request.post(getBaseUrl() + "@getDataBaseName", {
  3248. args: []
  3249. }).catch(function (e) {
  3250. var _a, _b;
  3251. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3252. showErrorDialog(msg);
  3253. console.error(msg, e);
  3254. });
  3255. }
  3256. function getDiffDDLApi(param) {
  3257. return request.post(getBaseUrl() + "@getDiffDDL", {
  3258. args: [
  3259. param
  3260. ]
  3261. }).catch(function (e) {
  3262. var _a, _b;
  3263. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  3264. showErrorDialog(msg);
  3265. console.error(msg, e);
  3266. });
  3267. }
  3268. function dataSyncApi(param) {
  3269. return request.post(getBaseUrl() + "@dataSync", {
  3270. args: [
  3271. param
  3272. ]
  3273. }).catch(function (e) {
  3274. var _a, _b;
  3275. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  3276. showErrorDialog(msg);
  3277. console.error(msg, e);
  3278. });
  3279. }
  3280. function dataSyncInfoApi(param) {
  3281. return request.post(getBaseUrl() + "@dataSyncInfo", {
  3282. args: [
  3283. param
  3284. ]
  3285. }).catch(function (e) {
  3286. var _a, _b;
  3287. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  3288. showErrorDialog(msg);
  3289. console.error(msg, e);
  3290. });
  3291. }
  3292. function saveColumnDomain(param) {
  3293. if (typeof param === 'undefined') {
  3294. param = { datasource: 'master' };
  3295. }
  3296. else if (typeof param.datasource === 'undefined') {
  3297. param.datasource = 'master';
  3298. }
  3299. return request.post(getBaseUrl() + "@saveColumnDomain", {
  3300. args: [
  3301. param
  3302. ]
  3303. }).catch(function (e) {
  3304. var _a, _b;
  3305. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  3306. showErrorDialog('发生错误:' + msg);
  3307. console.error(msg, e);
  3308. });
  3309. }
  3310. function devOpsList() {
  3311. return request.post(getBaseUrl() + "@devOpsList", {
  3312. args: [{}]
  3313. }).catch(function (e) {
  3314. var _a, _b;
  3315. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  3316. showErrorDialog('发生错误:' + msg);
  3317. console.error(msg, e);
  3318. });
  3319. }
  3320. function devOpsById(opsId) {
  3321. return request.post(getBaseUrl() + "@devOpsById", {
  3322. args: [{ opsId: opsId }]
  3323. }).catch(function (e) {
  3324. var _a, _b;
  3325. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  3326. showErrorDialog('发生错误:' + msg);
  3327. console.error(msg, e);
  3328. });
  3329. }
  3330. function metricsRequestApi() {
  3331. return request.get("/api/metrics/request")
  3332. .catch(function (e) {
  3333. var _a, _b;
  3334. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  3335. showErrorDialog('发生错误:' + msg);
  3336. console.error(msg, e);
  3337. });
  3338. }
  3339. function metricsJdbcApi() {
  3340. return request.get("/api/metrics/jdbc")
  3341. .catch(function (e) {
  3342. var _a, _b;
  3343. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  3344. showErrorDialog('发生错误:' + msg);
  3345. console.error(msg, e);
  3346. });
  3347. }
  3348. function executeDDL(param) {
  3349. return request.post(getBaseUrl() + "@executeDDL", {
  3350. args: [
  3351. param,
  3352. ]
  3353. }).catch(function (e) {
  3354. var _a, _b;
  3355. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  3356. showErrorDialog('发生错误:' + msg);
  3357. console.error(msg, e);
  3358. });
  3359. }
  3360. function getModifyIdxDDL(param) {
  3361. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  3362. args: [
  3363. param,
  3364. ]
  3365. }).catch(function (e) {
  3366. var _a, _b;
  3367. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  3368. showErrorDialog('发生错误:' + msg);
  3369. console.error(msg, e);
  3370. });
  3371. }
  3372. function getModifyProcedureSQL(param) {
  3373. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  3374. args: [
  3375. param,
  3376. ]
  3377. }).catch(function (e) {
  3378. var _a, _b;
  3379. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  3380. showErrorDialog('发生错误:' + msg);
  3381. console.error(msg, e);
  3382. });
  3383. }
  3384. function saveWhLayout(param) {
  3385. return request.post(getLayoutUrl() + "@saveWhLayout", {
  3386. args: [
  3387. param,
  3388. ]
  3389. }).catch(function (e) {
  3390. var _a, _b;
  3391. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  3392. showErrorDialog('发生错误:' + msg);
  3393. console.error(msg, e);
  3394. });
  3395. }
  3396. function deleteWhLayout(param) {
  3397. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  3398. args: [
  3399. param,
  3400. ]
  3401. }).catch(function (e) {
  3402. var _a, _b;
  3403. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  3404. showErrorDialog('发生错误:' + msg);
  3405. console.error(msg, e);
  3406. });
  3407. }
  3408. function loadWhLayoutAll() {
  3409. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  3410. args: []
  3411. }).catch(function (e) {
  3412. var _a, _b;
  3413. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  3414. showErrorDialog('发生错误:' + msg);
  3415. console.error(msg, e);
  3416. });
  3417. }
  3418. function loadWhLayout(param) {
  3419. return request.post(getLayoutUrl() + "@loadWhLayout", {
  3420. args: [
  3421. param,
  3422. ]
  3423. }).catch(function (e) {
  3424. var _a, _b;
  3425. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  3426. showErrorDialog('发生错误:' + msg);
  3427. console.error(msg, e);
  3428. });
  3429. }
  3430. var baseUrl = "/api/com/yvan/studio/FileManager";
  3431. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  3432. function getBaseUrl() {
  3433. // return getCurrentProject().url + baseUrl
  3434. return baseUrl;
  3435. }
  3436. function getLayoutUrl() {
  3437. // return getCurrentProject().url + baseUrl
  3438. return layoutUrl;
  3439. }
  3440. var Request = /** @class */ (function () {
  3441. function Request(axiosInstance) {
  3442. this.axiosInstance = axiosInstance;
  3443. }
  3444. // 全局响应数据转换处理
  3445. Request.transformResponse = function (response) {
  3446. var _a;
  3447. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  3448. };
  3449. Request.prototype.get = function (url, config) {
  3450. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  3451. };
  3452. Request.prototype.delete = function (url, config) {
  3453. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  3454. };
  3455. Request.prototype.head = function (url, config) {
  3456. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  3457. };
  3458. Request.prototype.options = function (url, config) {
  3459. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  3460. };
  3461. Request.prototype.post = function (url, data, config) {
  3462. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3463. };
  3464. Request.prototype.put = function (url, data, config) {
  3465. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3466. };
  3467. Request.prototype.patch = function (url, data, config) {
  3468. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3469. };
  3470. Request.prototype.request = function (config) {
  3471. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  3472. };
  3473. return Request;
  3474. }());
  3475. /** 创建一个axios实例对象 */
  3476. function axiosCreate(config) {
  3477. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  3478. }
  3479. var axiosInstance;
  3480. function init() {
  3481. axiosInstance = axiosCreate({
  3482. validateStatus: function (status) { return (status >= 200 && status < 400); },
  3483. });
  3484. request = new Request(axiosInstance);
  3485. }
  3486. var request;
  3487. //# sourceMappingURL=Api.js.map
  3488. // ------------------------------------------------------------------------------------------ types
  3489. /** 订阅消息key类型 */
  3490. var EventType;
  3491. (function (EventType) {
  3492. /** FileTree打开Module */
  3493. EventType["ModuleOpen"] = "ModuleOpen";
  3494. /** ModulePage 创建 */
  3495. EventType["ModulePageCreate"] = "ModulePageCreate";
  3496. /** ModuleItem内容变化 */
  3497. EventType["ModuleItemChange"] = "ModuleItemChange";
  3498. /** ModuleItem的 jsView 内容变化 */
  3499. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3500. /** 设置 vjson */
  3501. EventType["SetVjson"] = "SetVjson";
  3502. /** 更新 vjson */
  3503. EventType["UpdateVjson"] = "UpdateVjson";
  3504. /** 更新 组件vjson */
  3505. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3506. /** Component 选中内容变化 */
  3507. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3508. /** Component 选中内容变化 */
  3509. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3510. /** Component 删除事件 */
  3511. EventType["ComponentDelete"] = "ComponentDelete";
  3512. /** MainTab 选中改变事件 */
  3513. EventType["MainTabChange"] = "MainTabChange";
  3514. /** ModuleTab 选中改变事件 */
  3515. EventType["ModuleTabChange"] = "ModuleTabChange";
  3516. /** 保存事件 */
  3517. EventType["SaveCall"] = "SaveCall";
  3518. /** 撤销 */
  3519. EventType["Undo"] = "Undo";
  3520. /** 还原 */
  3521. EventType["Redo"] = "Redo";
  3522. /** 剪切 */
  3523. EventType["Cut"] = "Cut";
  3524. /** 复制 */
  3525. EventType["Copy"] = "Copy";
  3526. /** 粘贴 */
  3527. EventType["Paste"] = "Paste";
  3528. /** 全选 */
  3529. EventType["SelectAll"] = "SelectAll";
  3530. /** 读取剪切板 */
  3531. EventType["ClipboardRead"] = "ClipboardRead";
  3532. /** 检查模块更新 */
  3533. EventType["RunCheckModule"] = "RunCheckModule";
  3534. /** 停止检查模块更新 */
  3535. EventType["StopCheckModule"] = "StopCheckModule";
  3536. })(EventType || (EventType = {}));
  3537. // ------------------------------------------------------------------------------------------ impls
  3538. var EventBus = /** @class */ (function () {
  3539. function EventBus() {
  3540. /** 事件数据 */
  3541. this.store = {};
  3542. /** 事件订阅者注册表 */
  3543. this.observeStoreTable = {};
  3544. this.init();
  3545. }
  3546. EventBus.prototype.init = function () {
  3547. var _this = this;
  3548. // 更改store值就会自动publish消息 - 实现
  3549. this.store = new Proxy({}, {
  3550. get: function (target, key) {
  3551. return target[key];
  3552. },
  3553. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3554. set: function (target, key, data) {
  3555. if (noValue(key))
  3556. return false;
  3557. target[key] = data;
  3558. // 消息通知订阅者
  3559. var observerArr = _this.observeStoreTable[key];
  3560. if (noValue(observerArr) || observerArr.length <= 0)
  3561. return true;
  3562. observerArr.forEach(function (handler) {
  3563. //try {
  3564. handler(data, key);
  3565. // } catch (err) {
  3566. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3567. // }
  3568. });
  3569. return true;
  3570. },
  3571. });
  3572. };
  3573. /** 取消注册订阅者 */
  3574. EventBus.prototype.unregisterObserver = function (key, handler) {
  3575. var _this = this;
  3576. var observerArr = this.observeStoreTable[key];
  3577. if (noValue(observerArr) || observerArr.length <= 0)
  3578. return;
  3579. if (noValue(handler)) {
  3580. this.observeStoreTable[key] = [];
  3581. }
  3582. else {
  3583. observerArr.forEach(function (obsHandler, index) {
  3584. if (obsHandler !== handler)
  3585. return;
  3586. _this.observeStoreTable[key].splice(index, 1);
  3587. });
  3588. }
  3589. };
  3590. /** 注册订阅者 */
  3591. EventBus.prototype.registerObserver = function (key, handler) {
  3592. var observerArr = this.observeStoreTable[key];
  3593. if (noValue(observerArr) || observerArr.length <= 0) {
  3594. observerArr = [];
  3595. this.observeStoreTable[key] = observerArr;
  3596. }
  3597. observerArr.push(handler);
  3598. // if (noValue(key)) return;
  3599. // const sourceValue = this.store[key];
  3600. // if (noValue(sourceValue)) return;
  3601. // handler(sourceValue, key);
  3602. };
  3603. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3604. EventBus.prototype.getStore = function () {
  3605. return this.store;
  3606. };
  3607. /**
  3608. * 取消订阅
  3609. * @param key 订阅的消息key
  3610. * @param handler 指定取消的监听函数
  3611. */
  3612. EventBus.prototype.unsubscribe = function (key, handler) {
  3613. var _this = this;
  3614. if (key instanceof Array) {
  3615. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3616. }
  3617. else {
  3618. this.unregisterObserver(key, handler);
  3619. }
  3620. };
  3621. /**
  3622. * 消息订阅
  3623. * @param key 订阅的消息key
  3624. * @param handler 监听函数
  3625. */
  3626. EventBus.prototype.subscribe = function (key, handler) {
  3627. var _this = this;
  3628. var cancelSubscribe = {
  3629. key: key,
  3630. cancel: function () {
  3631. },
  3632. };
  3633. if (key instanceof Array) {
  3634. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3635. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3636. }
  3637. else {
  3638. this.registerObserver(key, handler);
  3639. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3640. }
  3641. return cancelSubscribe;
  3642. };
  3643. /**
  3644. * 消息订阅(只订阅一次)
  3645. * @param key 订阅的消息key
  3646. * @param handler 监听函数
  3647. */
  3648. EventBus.prototype.subscribeOnce = function (key, handler) {
  3649. var cancelSubscribe = this.subscribe(key, function (data) {
  3650. // try {
  3651. handler(data, key);
  3652. // } catch (err) {
  3653. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3654. // }
  3655. cancelSubscribe.cancel();
  3656. });
  3657. };
  3658. /**
  3659. * 发送消息(触发订阅监听函数)
  3660. * @param key 消息key
  3661. * @param eventData 消息值
  3662. */
  3663. EventBus.prototype.publish = function (key, eventData) {
  3664. var _this = this;
  3665. if (key instanceof Array) {
  3666. key.forEach(function (k) { return _this.store[k] = eventData; });
  3667. }
  3668. else {
  3669. this.store[key] = eventData;
  3670. }
  3671. };
  3672. return EventBus;
  3673. }());
  3674. // ------------------------------------------------------------------------------------------ use
  3675. var eventBus = new EventBus();
  3676. //# sourceMappingURL=EventBus.js.map
  3677. var idPrefix = "_ds_";
  3678. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  3679. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  3680. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  3681. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  3682. var layoutOrXtypeNameMap = {
  3683. fit: 'fit布局',
  3684. border: 'border布局',
  3685. center: '中部',
  3686. north: '上部',
  3687. south: '下部',
  3688. west: '左部',
  3689. east: '右部',
  3690. yvgrid: '表格',
  3691. tree: '树',
  3692. tabpanel: '标签页',
  3693. form: '表单',
  3694. fieldset: '字段组',
  3695. tbar: '顶部工具栏',
  3696. fbar: '底部工具栏',
  3697. toolbar: '工具栏',
  3698. cols: '列容器',
  3699. rows: '行容器',
  3700. textfield: '文本框',
  3701. textareafield: '长文本框',
  3702. numberfield: '数字框',
  3703. label: "文本",
  3704. combo: "下拉框",
  3705. combobox: "下拉框",
  3706. combotree: "下拉树",
  3707. combogrid: "下拉表",
  3708. datefield: "日期框",
  3709. searchfield: "搜索框",
  3710. button: "按钮",
  3711. checkbox: "勾选",
  3712. checkboxgroup: "勾选组",
  3713. radio: "点选",
  3714. radiogroup: "点选组",
  3715. container: "占位"
  3716. };
  3717. /**
  3718. * 从 VJSON 中找到 rows/cols 的数组
  3719. */
  3720. function findArrayContainer(vjson, id) {
  3721. var parentVJson = getSuperVjson(vjson, id);
  3722. if (_$2.isArray(parentVJson)) {
  3723. return parentVJson;
  3724. }
  3725. if (parentVJson.hasOwnProperty('items')) {
  3726. return parentVJson.items;
  3727. }
  3728. }
  3729. /**
  3730. * 根据id查找上级vjson
  3731. * @param vjson 原始 vjson 视图
  3732. * @param targetId 子元素的id
  3733. */
  3734. function getSuperVjson(vjson, targetId) {
  3735. return deepTravFindSuper(vjson, vjson, targetId);
  3736. }
  3737. /**
  3738. * 根据id查找上级vjson id
  3739. * @param vjson 原始 vjson 视图
  3740. * @param targetId 子元素的id
  3741. */
  3742. function getSuperVjsonId(vjson, targetId) {
  3743. var vj = getSuperVjson(vjson, targetId);
  3744. return vj.id;
  3745. }
  3746. function deepTravFindSuper(superVjson, vjson, targetId) {
  3747. var rObj = null;
  3748. _$2.forOwn(vjson, function (value, key) {
  3749. if (rObj) {
  3750. return;
  3751. }
  3752. if (typeof value !== "object") {
  3753. return;
  3754. }
  3755. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  3756. if (key !== 'items') {
  3757. return;
  3758. }
  3759. }
  3760. else {
  3761. // 模型、数据、数据源不扫描
  3762. if (key === 'data' ||
  3763. key === 'dataSource' ||
  3764. key === 'suggest' ||
  3765. key === 'options' ||
  3766. key === 'config' ||
  3767. key === 'columns' ||
  3768. key === 'viewModel' ||
  3769. key === 'store') {
  3770. return;
  3771. }
  3772. }
  3773. //事件不扫描
  3774. if (key === "on" && _$2.isObject(value)) {
  3775. return;
  3776. }
  3777. if (key.startsWith("on") && _$2.size(key) > 2) {
  3778. return;
  3779. }
  3780. if (value.id === targetId) {
  3781. if (_$2.isArray(vjson)) {
  3782. rObj = superVjson;
  3783. }
  3784. else {
  3785. rObj = vjson;
  3786. }
  3787. return;
  3788. }
  3789. rObj = deepTravFindSuper(vjson, value, targetId);
  3790. });
  3791. return rObj;
  3792. }
  3793. /**
  3794. * 深度遍历 vjson
  3795. * @param vjson 视图JSON
  3796. * @param resolver 分析函数
  3797. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  3798. */
  3799. function deepTravVJson(vjson, resolver, propDeep) {
  3800. if (propDeep === void 0) { propDeep = false; }
  3801. var markerList = [];
  3802. deepTrav1(vjson, resolver, markerList, propDeep);
  3803. return markerList;
  3804. }
  3805. function deepTrav1(obj, resolver, marker, propDeep) {
  3806. if (propDeep === void 0) { propDeep = false; }
  3807. var isMarker = resolver(obj);
  3808. if (marker && isMarker === true) {
  3809. marker.unshift({ id: 0, keyName: '', object: obj });
  3810. }
  3811. _$2.forOwn(obj, function (value, key) {
  3812. if (typeof value !== 'object') {
  3813. return;
  3814. }
  3815. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3816. if (key !== 'items' && key !== 'children') {
  3817. return;
  3818. }
  3819. }
  3820. else {
  3821. // 模型、数据、数据源不扫描
  3822. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3823. return;
  3824. }
  3825. if (!propDeep &&
  3826. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3827. key === 'listeners' || key === 'bind')) {
  3828. return;
  3829. }
  3830. }
  3831. //事件不扫描
  3832. if (key === 'on' && _$2.isObject(value)) {
  3833. return;
  3834. }
  3835. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3836. return;
  3837. }
  3838. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3839. if (marker && isMarkerChild === true) {
  3840. isMarker = true;
  3841. marker.unshift({ id: obj.id, keyName: key, object: value });
  3842. }
  3843. });
  3844. // @ts-ignore 删除作废对象
  3845. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3846. return isMarker;
  3847. }
  3848. /**
  3849. * 在代码中找到 reference 对应的对象
  3850. */
  3851. function findInCode(code, id) {
  3852. try {
  3853. deepTravVJson(code, function (child) {
  3854. if (child.id === id) {
  3855. throw child;
  3856. }
  3857. });
  3858. return undefined;
  3859. }
  3860. catch (err) {
  3861. return err;
  3862. }
  3863. }
  3864. function replaceVjsonById(vjson, itemVjson, itemId) {
  3865. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3866. msgError('无法定位组件!');
  3867. debugger;
  3868. return;
  3869. }
  3870. var id = itemId || itemVjson.id;
  3871. deepTravVJson(vjson, function (obj) {
  3872. if (obj.id == id) {
  3873. _$2.assign(obj, itemVjson, { id: id });
  3874. }
  3875. });
  3876. }
  3877. function deepTravDeleteVjson(obj, targetId) {
  3878. var isDelete = false;
  3879. _$2.forOwn(obj, function (value, key) {
  3880. if (isDelete) {
  3881. return;
  3882. }
  3883. if (typeof value !== 'object') {
  3884. return;
  3885. }
  3886. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3887. if (key !== 'items') {
  3888. return;
  3889. }
  3890. }
  3891. else {
  3892. // 模型、数据、数据源不扫描
  3893. if (key === 'data' ||
  3894. key === 'dataSource' ||
  3895. key === 'suggest' ||
  3896. key === 'options' ||
  3897. key === 'config' ||
  3898. key === 'columns' ||
  3899. key === 'viewModel' ||
  3900. key === 'store') {
  3901. return;
  3902. }
  3903. }
  3904. //事件不扫描
  3905. if (key === 'on' && _$2.isObject(value)) {
  3906. return;
  3907. }
  3908. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3909. return;
  3910. }
  3911. if (value.id === targetId) {
  3912. isDelete = true;
  3913. /** 如果是数组的元素*/
  3914. if (_$2.isArray(obj)) {
  3915. obj.splice(key, 1);
  3916. }
  3917. else {
  3918. delete obj[key];
  3919. }
  3920. return;
  3921. }
  3922. isDelete = deepTravDeleteVjson(value, targetId);
  3923. });
  3924. return isDelete;
  3925. }
  3926. /**
  3927. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3928. * @param obj 原始 vjson 视图
  3929. * @param targetId 子元素的id
  3930. */
  3931. function deletVjsonById(vjson, targetId) {
  3932. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3933. // if (_.isArray(obj)) {
  3934. // if (obj.length <= 0) {
  3935. // let T: any = {
  3936. // view: "template",
  3937. // template: "拖动任何组件到此处",
  3938. // role: "placeholder",
  3939. // id: webix.uid()
  3940. // }
  3941. // obj.push(T);
  3942. // }
  3943. // }
  3944. return isDeleted;
  3945. }
  3946. function removeDesignProp(vjson) {
  3947. deepTravVJson(vjson, function (obj) {
  3948. if (obj.hasOwnProperty('id')) {
  3949. delete obj.id;
  3950. }
  3951. if (obj.hasOwnProperty("designMode")) {
  3952. delete obj.designMode;
  3953. }
  3954. });
  3955. if (vjson.hasOwnProperty("cls")) {
  3956. delete vjson.cls;
  3957. }
  3958. if (vjson.hasOwnProperty("viewModel")) {
  3959. delete vjson.viewModel;
  3960. }
  3961. if (vjson.hasOwnProperty("store")) {
  3962. delete vjson.store;
  3963. }
  3964. }
  3965. function getLayoutOutline(vjson) {
  3966. deepTravVJson(vjson, function (obj) {
  3967. if (!Array.isArray(obj)) {
  3968. _$2.forOwn(obj, function (value, key) {
  3969. if (key === 'id' || key === 'region' || key === 'layoutName'
  3970. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3971. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3972. if (key === 'region'
  3973. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3974. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3975. if (!_$2.has(obj, 'layoutName')) {
  3976. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3977. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3978. // console.log(obj.layoutName, obj.layoutNameDesc)
  3979. }
  3980. }
  3981. }
  3982. else {
  3983. if (key === 'items') {
  3984. obj.children = obj[key];
  3985. }
  3986. if (key === 'tbar') {
  3987. var t = obj[key];
  3988. t.layoutName = key;
  3989. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3990. // console.log(t.layoutName, t.layoutNameDesc)
  3991. if (_$2.has(obj, "items")) {
  3992. obj.items.splice(0, 0, t);
  3993. }
  3994. else if (_$2.has(obj, "children")) {
  3995. obj.children.splice(0, 0, t);
  3996. }
  3997. else {
  3998. obj.children = [t];
  3999. }
  4000. }
  4001. if (key === 'fbar') {
  4002. var t = obj[key];
  4003. t.layoutName = key;
  4004. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  4005. // console.log(t.layoutName, t.layoutNameDesc)
  4006. if (_$2.has(obj, "items")) {
  4007. obj.items.push(t);
  4008. }
  4009. else if (_$2.has(obj, "children")) {
  4010. obj.children.push(t);
  4011. }
  4012. else {
  4013. obj.children = [t];
  4014. }
  4015. }
  4016. delete obj[key];
  4017. }
  4018. });
  4019. if (!obj.hasOwnProperty("children")) {
  4020. obj.leaf = true;
  4021. }
  4022. if (!obj.hasOwnProperty("expanded")) {
  4023. obj.expanded = true;
  4024. }
  4025. }
  4026. });
  4027. return vjson;
  4028. }
  4029. //# sourceMappingURL=ViewHelper.js.map
  4030. var checkFlags = {};
  4031. // ------------------------------------------------------------------------------------------ impls
  4032. function jsViewToVJson(modulePage, jsView) {
  4033. if (!jsView)
  4034. return {};
  4035. jsView = jsView.replace(/^\s*export\s+default/, "");
  4036. jsView = _$2.trim(jsView) || "{}";
  4037. try {
  4038. var json = dist.parse(jsView);
  4039. return modulePage.addViewId(json);
  4040. }
  4041. catch (e) {
  4042. //@ts-ignore
  4043. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  4044. }
  4045. }
  4046. function stringToJsonObj(jsonStr) {
  4047. if (!jsonStr)
  4048. return {};
  4049. try {
  4050. return dist.parse(jsonStr);
  4051. }
  4052. catch (e) {
  4053. return {};
  4054. }
  4055. }
  4056. /**
  4057. * 获取view.js 文件 string
  4058. */
  4059. function vjsonTojsView(vjson) {
  4060. var reVjson = _$2.cloneDeep(vjson);
  4061. removeDesignProp(reVjson);
  4062. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  4063. }
  4064. var ModuleStore = /** @class */ (function (_super) {
  4065. __extends(ModuleStore, _super);
  4066. function ModuleStore() {
  4067. var _this = _super.call(this) || this;
  4068. _this.store = {};
  4069. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  4070. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  4071. _this.addModule(id, module, modulePage);
  4072. });
  4073. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  4074. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  4075. _this.onMainTabChange(moduleId, oldModuleId, from);
  4076. });
  4077. return _this;
  4078. }
  4079. ModuleStore.prototype.getCacheKey = function (param) {
  4080. return "filetree_data.json";
  4081. };
  4082. ModuleStore.prototype.invokeApi = function (param) {
  4083. return moduleTree();
  4084. };
  4085. ModuleStore.prototype.reloadModule = function (id) {
  4086. var moduleObject = this.store[id];
  4087. if (!moduleObject)
  4088. return;
  4089. var module = moduleObject.module;
  4090. getModuleFileContent(module).then(function (_a) {
  4091. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4092. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  4093. moduleObject.lastModifyTime = lastModifyTime;
  4094. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  4095. // 触发事件 ModuleItemChange
  4096. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4097. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  4098. vjson: moduleObject.moduleObj.vjson,
  4099. from: "reloadModule"
  4100. });
  4101. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  4102. });
  4103. };
  4104. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  4105. var _this = this;
  4106. window['mainWindow'].setLoading(true);
  4107. getModuleFileContent(module)
  4108. .then(function (_a) {
  4109. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4110. var moduleObject = {
  4111. id: id, module: module,
  4112. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  4113. lastModifyTime: lastModifyTime,
  4114. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  4115. modulePage: modulePage,
  4116. moduleEventBus: modulePage.moduleEventBus
  4117. };
  4118. _this.store[id] = moduleObject;
  4119. // 触发事件 ModuleItemChange
  4120. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4121. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  4122. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  4123. })
  4124. .finally(function () {
  4125. window['mainWindow'].setLoading(false);
  4126. });
  4127. };
  4128. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  4129. if (this.store[moduleId]) {
  4130. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  4131. }
  4132. };
  4133. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  4134. var moduleObject = this.store[id];
  4135. moduleObject.fileContent.jsController = codeValue;
  4136. };
  4137. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  4138. var moduleObject = this.store[id];
  4139. moduleObject.fileContent.jsView = codeValue;
  4140. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  4141. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  4142. vjson: moduleObject.moduleObj.vjson,
  4143. from: from
  4144. });
  4145. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  4146. };
  4147. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  4148. var moduleObject = this.store[id];
  4149. moduleObject.fileContent.jsModel = codeValue;
  4150. };
  4151. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  4152. var moduleObject = this.store[id];
  4153. moduleObject.fileContent.groovy = codeValue;
  4154. };
  4155. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  4156. var moduleObject = this.store[id];
  4157. moduleObject.fileContent.mybatis = codeValue;
  4158. };
  4159. ModuleStore.prototype.getModuleObject = function (id) {
  4160. return this.store[id];
  4161. };
  4162. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  4163. if (checkFlags[moduleId] === 1) {
  4164. // @ts-ignore
  4165. system.msg("正在检测文件是否有外部修改,请稍后操作");
  4166. }
  4167. eventBus.publish(EventType.StopCheckModule, {});
  4168. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  4169. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  4170. saveFile(fileFullPath, fileContent).then(function (res) {
  4171. if (res.data && res.data.lastModified) {
  4172. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  4173. }
  4174. }).finally(function () {
  4175. eventBus.publish(EventType.RunCheckModule, {});
  4176. });
  4177. };
  4178. ModuleStore.prototype.check = function (moduleId) {
  4179. {
  4180. return;
  4181. }
  4182. };
  4183. return ModuleStore;
  4184. }(CacheStore));
  4185. // ------------------------------------------------------------------------------------------ use
  4186. var moduleStore = new ModuleStore();
  4187. //# sourceMappingURL=ModuleStore.js.map
  4188. /**
  4189. * 调用方法
  4190. */
  4191. function invokeMethod(fn, sender, args) {
  4192. if (typeof fn === 'function') {
  4193. fn.apply.apply(fn, __spread([sender], args));
  4194. }
  4195. }
  4196. /**
  4197. * 判断事件是否为有效的输入字符
  4198. * @param e
  4199. */
  4200. function isChartEvent(e) {
  4201. if (e.key === 'Shift' ||
  4202. e.key === 'Control' ||
  4203. e.key === 'Alt' ||
  4204. e.key === 'Escape' ||
  4205. e.key === 'ArrowRight' ||
  4206. e.key === 'Tab' ||
  4207. e.key === 'ArrowLeft') {
  4208. return false;
  4209. }
  4210. if (e.keyCode >= 48 && e.keyCode <= 57) {
  4211. // 0-9
  4212. return true;
  4213. }
  4214. if (e.keyCode >= 65 && e.keyCode <= 90) {
  4215. // a-z
  4216. return true;
  4217. }
  4218. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  4219. // 小键盘 0-9
  4220. return true;
  4221. }
  4222. return false;
  4223. }
  4224. if (!window["time_offset"]) {
  4225. window["time_offset"] = 0;
  4226. }
  4227. function syncDate(date) {
  4228. if (date && date.setTime && date.getTime) {
  4229. date.setTime(date.getTime() + window["time_offset"]);
  4230. }
  4231. return date;
  4232. }
  4233. //# sourceMappingURL=utils.js.map
  4234. function isDesignMode(control, config) {
  4235. var _a, _b;
  4236. if (window["IS_DESIGN_MODE"]) {
  4237. return true;
  4238. }
  4239. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  4240. return true;
  4241. }
  4242. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  4243. return true;
  4244. }
  4245. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  4246. return true;
  4247. }
  4248. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  4249. return true;
  4250. }
  4251. return false;
  4252. }
  4253. function toString(value) {
  4254. if (typeof value === 'undefined' || value === null) {
  4255. return "";
  4256. }
  4257. if (typeof value === 'number' && isNaN(value)) {
  4258. return "";
  4259. }
  4260. if (value == 'N/A') {
  4261. return "";
  4262. }
  4263. return ("" + value);
  4264. }
  4265. function isEmpty(value) {
  4266. if (typeof value === 'undefined' || value === null) {
  4267. return true;
  4268. }
  4269. if (typeof value === 'number' && isNaN(value)) {
  4270. return true;
  4271. }
  4272. if (value == 'N/A') {
  4273. return true;
  4274. }
  4275. return ("" + value).trim().length <= 0;
  4276. }
  4277. function createUUID() {
  4278. //@ts-ignore
  4279. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  4280. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  4281. });
  4282. }
  4283. function getRegList() {
  4284. var regList = _$2.get(window, 'yvanLib.regList');
  4285. if (!regList) {
  4286. regList = [];
  4287. _$2.set(window, 'yvanLib.regList', regList);
  4288. }
  4289. return regList;
  4290. }
  4291. function getRegParamList(methodName) {
  4292. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  4293. if (!regParamList) {
  4294. regParamList = {};
  4295. _$2.set(window, 'yvanLib.regParamList', regParamList);
  4296. }
  4297. if (!_$2.has(regParamList, methodName)) {
  4298. regParamList[methodName] = [];
  4299. }
  4300. return regParamList[methodName];
  4301. }
  4302. /**
  4303. * 模拟点击按钮
  4304. */
  4305. function raiseClick(buttonHandle) {
  4306. if (!buttonHandle) {
  4307. return false;
  4308. }
  4309. if (buttonHandle.disabled) {
  4310. // 按钮是禁止状态
  4311. return false;
  4312. }
  4313. if (buttonHandle.hidden) {
  4314. // 按钮是隐藏状态
  4315. return false;
  4316. }
  4317. // 按钮点击
  4318. buttonHandle.click();
  4319. return true;
  4320. }
  4321. /**
  4322. * 标注系统全局函数的参数
  4323. * @param title 函数名称
  4324. * @param type 函数类型
  4325. * @param allowEmpty 可否为空
  4326. */
  4327. function LibParam(title, type, allowEmpty) {
  4328. if (allowEmpty === void 0) { allowEmpty = false; }
  4329. return function (target, methodName, paramsIndex) {
  4330. var systemFnArgs = getRegParamList(methodName);
  4331. systemFnArgs[paramsIndex] = {
  4332. type: type,
  4333. title: title,
  4334. name: methodName,
  4335. allowEmpty: allowEmpty,
  4336. };
  4337. };
  4338. }
  4339. /**
  4340. * 标注函数变成"系统全局函数"
  4341. */
  4342. function Lib(registe) {
  4343. return function (target, propertyKey, descriptor) {
  4344. var libList = getRegList();
  4345. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  4346. if (registe.type === 'system') {
  4347. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  4348. }
  4349. else if (registe.type === 'format') {
  4350. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  4351. }
  4352. return target;
  4353. };
  4354. }
  4355. /**
  4356. * 解析事件
  4357. * 'scope.私有方法名'
  4358. * 'system.系统函数名'
  4359. * 'format.格式化名'
  4360. */
  4361. function lookupFn(scope, event, errorWho) {
  4362. if (isDesignMode(scope, undefined)) {
  4363. return Ext.emptyFn;
  4364. }
  4365. if (!_$2.startsWith(event, 'scope.') &&
  4366. !_$2.startsWith(event, 'system.') &&
  4367. !_$2.startsWith(event, 'format.')) {
  4368. console.error('无法识别的事件响应类型', event);
  4369. throw new TypeError('无法识别的事件响应类型');
  4370. }
  4371. // 为 eval 准备环境
  4372. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  4373. var data = scope.viewModel.data;
  4374. var keys = [];
  4375. var values = [];
  4376. _$2.forOwn(data, function (value, key) {
  4377. var idxKey = key.indexOf('//');
  4378. if (idxKey >= 0) {
  4379. keys.push(key.substr(0, idxKey));
  4380. }
  4381. else {
  4382. keys.push(key);
  4383. }
  4384. values.push(value);
  4385. });
  4386. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  4387. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  4388. if (typeof funcResult !== 'function') {
  4389. console.error('无法识别的事件响应类型', event, func, errorWho);
  4390. throw new TypeError('无法识别的事件响应类型');
  4391. }
  4392. return funcResult;
  4393. }
  4394. /**
  4395. * 从 ext.element 获取 scope 对象
  4396. */
  4397. function lookupScope(extHandle) {
  4398. if (!extHandle) {
  4399. // @ts-ignore
  4400. return;
  4401. }
  4402. if (extHandle.isScope) {
  4403. return extHandle;
  4404. }
  4405. if (extHandle.column) {
  4406. // 列上的组件
  4407. return extHandle.column.lookupReferenceHolder().yvanScope;
  4408. }
  4409. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  4410. if (typeof extHandle.lookupViewModel === 'function') {
  4411. var vm = extHandle.lookupViewModel();
  4412. return vm.yvanScope;
  4413. }
  4414. return;
  4415. }
  4416. //# sourceMappingURL=lib.js.map
  4417. /**
  4418. * 全局 ajax 方法
  4419. */
  4420. var ajax = {};
  4421. /**
  4422. * 计算拼音的函数
  4423. */
  4424. var pinyinFunc = function (str) { return (str); };
  4425. exports.scopeOnLoad = null;
  4426. exports.apiConvert = undefined;
  4427. var baseConfigProcessList = [];
  4428. /**
  4429. * 在基类添加 Config 的处理方法
  4430. */
  4431. function baseConfigProcess(option) {
  4432. return function (target, propertyKey) {
  4433. baseConfigProcessList.push(target[propertyKey]);
  4434. };
  4435. }
  4436. // let designMode: boolean = false
  4437. //
  4438. // export function isDesignMode(): boolean {
  4439. // return designMode
  4440. // }
  4441. //
  4442. // export function setDesignMode(v: boolean) {
  4443. // designMode = v
  4444. // }
  4445. /**
  4446. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  4447. */
  4448. function serverInvokeUrlTransform(url, option) {
  4449. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  4450. }
  4451. /**
  4452. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  4453. */
  4454. function sqlUrlTransform(url) {
  4455. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  4456. }
  4457. /**
  4458. * YvanUI 全局扩展配置
  4459. */
  4460. function extend(option) {
  4461. if (option.ajax) {
  4462. ajax.func = option.ajax;
  4463. }
  4464. if (option.serverInvokeUrlTransform) {
  4465. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  4466. }
  4467. if (option.sqlUrlTransform) {
  4468. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  4469. }
  4470. if (option.pinyinFunction) {
  4471. pinyinFunc = option.pinyinFunction;
  4472. }
  4473. if (option.scopeOnLoad) {
  4474. exports.scopeOnLoad = option.scopeOnLoad;
  4475. }
  4476. if (option.scopeOnCreate) {
  4477. exports.scopeOnCreate = option.scopeOnCreate;
  4478. }
  4479. if (option.apiConvert) {
  4480. exports.apiConvert = option.apiConvert;
  4481. }
  4482. // if (typeof option.designMode !== 'undefined') {
  4483. // setDesignMode(option.designMode)
  4484. // }
  4485. }
  4486. function getApiConvert() {
  4487. return exports.apiConvert;
  4488. }
  4489. function getScopeOnCreate() {
  4490. return exports.scopeOnCreate;
  4491. }
  4492. function getPinyin(v) {
  4493. return pinyinFunc(v);
  4494. }
  4495. /**
  4496. * 适用于 Select / Tree 等,作筛选的通用方法.
  4497. * 1.首字母模糊匹配(不区分大小写)
  4498. * 2.标识的模糊匹配(不区分大小写)
  4499. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  4500. */
  4501. function keywordFilter(keyword, label, value) {
  4502. if (!keyword) {
  4503. return true;
  4504. }
  4505. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  4506. // const labelPy = _.toLower(getPinyin(label))
  4507. //@ts-ignore
  4508. var labelPy = _$2.toLower(getFirstPinyin2(label));
  4509. value = _$2.toLower(_$2.trim(value));
  4510. var found = 0;
  4511. _$2.some(ws, function (word) {
  4512. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  4513. found++;
  4514. return;
  4515. }
  4516. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  4517. found++;
  4518. return;
  4519. }
  4520. });
  4521. return found >= ws.length;
  4522. }
  4523. //# sourceMappingURL=config.js.map
  4524. var Scope = /** @class */ (function () {
  4525. function Scope(args) {
  4526. /**
  4527. * 业务模块的唯一编号
  4528. */
  4529. this.id = _$2.uniqueId('scope_');
  4530. this.IS_DESIGN_MODE = false;
  4531. /**
  4532. * onload 运行完成之后才会设置本标记为 true
  4533. */
  4534. this.isLoadFinish = false;
  4535. this._isLoading = false;
  4536. var model = args.model, vjson = args.vjson, i18n = args.i18n;
  4537. this.model = model;
  4538. if (typeof vjson.layout === 'undefined') {
  4539. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  4540. var ret = buildPlus({ model: model, vjson: vjson });
  4541. model = ret.model;
  4542. vjson = ret.vjson;
  4543. }
  4544. this.originalVjson = _$2.cloneDeep(vjson);
  4545. this.vjson = this.originalVjson; // this.buildVjson()
  4546. var WMSTranslate = window["WMSTranslate"];
  4547. if (WMSTranslate) {
  4548. var i18nPath_1 = this.constructor.name;
  4549. if (i18n) {
  4550. WMSTranslate[i18nPath_1] = i18n;
  4551. }
  4552. this.vjson.i18nPath = i18nPath_1;
  4553. deepTravVJson(this.vjson, function (obj) {
  4554. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  4555. return;
  4556. }
  4557. obj.i18nPath = i18nPath_1;
  4558. });
  4559. }
  4560. var extScope = getScopeOnCreate();
  4561. if (typeof extScope === 'function') {
  4562. extScope({ vjson: vjson, model: model }, this);
  4563. }
  4564. }
  4565. Scope.prototype._addWatch = function (tplExpress, fn) {
  4566. if (!this._watchList) {
  4567. this._watchList = [];
  4568. }
  4569. this._watchList.push({ watch: tplExpress, fn: fn });
  4570. };
  4571. Scope.prototype._applyWatchList = function () {
  4572. var _this = this;
  4573. _$2.forEach(this._watchList, function (item) {
  4574. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  4575. });
  4576. };
  4577. Object.defineProperty(Scope.prototype, "isScope", {
  4578. get: function () {
  4579. return true;
  4580. },
  4581. enumerable: true,
  4582. configurable: true
  4583. });
  4584. /**
  4585. * 产生一个当前模块有效的唯一id
  4586. * @param key 唯一编号
  4587. */
  4588. Scope.prototype.uid = function (key) {
  4589. return this.id + key;
  4590. };
  4591. /**
  4592. * 对话框"保存"成功.
  4593. * 关闭对话框,并响应 success 方法
  4594. * @param data 要傳回的數據(可以為空)
  4595. */
  4596. Scope.prototype.dialogSuccess = function (data) {
  4597. this._handle.fireEvent('success', this, data);
  4598. var sender = this._handle.config.animateTarget;
  4599. var scope = lookupScope(sender);
  4600. if (typeof this['success'] === 'function') {
  4601. this['success'].call(scope, sender, data);
  4602. }
  4603. this.close();
  4604. };
  4605. /**
  4606. * 设置等待状态
  4607. * @param value
  4608. * @param msg
  4609. */
  4610. Scope.prototype.setLoading = function (value) {
  4611. var _a;
  4612. var scope = this;
  4613. this._isLoading = value;
  4614. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  4615. };
  4616. Scope.prototype.getLoading = function () {
  4617. return this._isLoading;
  4618. };
  4619. /**
  4620. * 以对话框模式打开当前模块
  4621. * @param sender 发送者(按钮或Scope对象)
  4622. * @param vjsonOption 界面覆盖选项(可以为空)
  4623. * @param dataOption 数据覆盖选项(可以为空)
  4624. */
  4625. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  4626. var _a;
  4627. var that = this;
  4628. var vmodel = _$2.defaultsDeep({
  4629. //
  4630. }, dataOption, that.model);
  4631. this.viewModel = new Ext.app.ViewModel(vmodel);
  4632. this.viewModel.yvanScope = this;
  4633. this._applyWatchList();
  4634. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4635. var config = _$2.defaultsDeep({
  4636. animateTarget: sender,
  4637. viewModel: this.viewModel,
  4638. yvanScope: this,
  4639. referenceHolder: true,
  4640. }, vjsonOption, that.vjson, windows);
  4641. if (config.height === 'unset') {
  4642. delete config.height;
  4643. }
  4644. if (config.width === 'unset') {
  4645. delete config.width;
  4646. }
  4647. // const holder = sender?.lookupReferenceHolder()
  4648. // delete config.constrain
  4649. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  4650. if (topScope) {
  4651. config.constrain = true;
  4652. this.topScope = topScope;
  4653. }
  4654. var win = new Ext.Window(config);
  4655. // if (holder) {
  4656. // holder.add(win)
  4657. // }
  4658. if (topScope) {
  4659. topScope._handle.add(win);
  4660. }
  4661. win.addListener('beforerender', function (sender) {
  4662. // 记录句柄
  4663. if (sender && !that._handle) {
  4664. that._handle = sender;
  4665. }
  4666. });
  4667. win.addListener('afterrender', function (sender) {
  4668. // 调用onLoad回调
  4669. try {
  4670. that._onLoad();
  4671. }
  4672. catch (e) {
  4673. console.error('errorAt onLoad', e);
  4674. }
  4675. window['cw'] = that;
  4676. });
  4677. win.addListener('destroy', this._destroy.bind(this));
  4678. win.show();
  4679. };
  4680. /**
  4681. * 以标签模式打开当前模块
  4682. * @param vjsonOption 界面覆盖选项(可以为空)
  4683. * @param dataOption 数据覆盖选项(可以为空)
  4684. */
  4685. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  4686. var _this = this;
  4687. var that = this;
  4688. this._vjsonOption = vjsonOption;
  4689. this._dataOption = dataOption;
  4690. var vmodel = _$2.defaultsDeep({
  4691. data: {}
  4692. }, dataOption, that.model);
  4693. this.viewModel = new Ext.app.ViewModel(vmodel);
  4694. this.viewModel.yvanScope = this;
  4695. this._applyWatchList();
  4696. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4697. // 根级不能设置id
  4698. delete that.vjson.id;
  4699. var config = _$2.defaultsDeep({
  4700. viewModel: this.viewModel,
  4701. yvanScope: this,
  4702. referenceHolder: true,
  4703. }, vjsonOption, that.vjson);
  4704. var tt = Ext.getCmp('TT');
  4705. var handle = tt.addScope(this, config, function (handle) {
  4706. handle.addListener('added', function (sender) {
  4707. // 记录句柄
  4708. if (sender && !that._handle) {
  4709. that._handle = sender;
  4710. }
  4711. });
  4712. handle.addListener('afterrender', function (sender) {
  4713. // 调用onLoad回调
  4714. try {
  4715. that._onLoad();
  4716. }
  4717. catch (e) {
  4718. console.error('errorAt onLoad', e);
  4719. }
  4720. });
  4721. handle.addListener('destroy', _this._destroy.bind(_this));
  4722. });
  4723. return handle;
  4724. };
  4725. /**
  4726. * 直接渲染到元素
  4727. * @param element 渲染目标
  4728. * @param vjsonOption 界面覆盖选项(可以为空)
  4729. * @param dataOption 数据覆盖选项(可以为空)
  4730. */
  4731. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  4732. var that = this;
  4733. this._vjsonOption = vjsonOption;
  4734. this._dataOption = dataOption;
  4735. var vmodel = _$2.defaultsDeep({
  4736. data: {}
  4737. }, that.model, dataOption);
  4738. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4739. this.viewModel = new Ext.app.ViewModel(vmodel);
  4740. this.viewModel.yvanScope = this;
  4741. this._applyWatchList();
  4742. var config = _$2.defaultsDeep({
  4743. viewModel: this.viewModel,
  4744. yvanScope: this,
  4745. referenceHolder: true,
  4746. renderTo: element,
  4747. listeners: {
  4748. afterrender: function (sender) {
  4749. var _a;
  4750. // 记录句柄
  4751. if (sender && !that._handle) {
  4752. that._handle = sender;
  4753. }
  4754. // 调用onLoad回调
  4755. that._onLoad();
  4756. // 如果vjson中配置了 afterrender ,需要恢复状态
  4757. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4758. },
  4759. },
  4760. }, vjsonOption, that.vjson);
  4761. new Ext.container.Viewport(config);
  4762. };
  4763. Scope.prototype.showDesigner = function (designer, option) {
  4764. var that = this;
  4765. var vmodel = _$2.defaultsDeep({
  4766. data: {
  4767. IS_DESIGN_MODE: true,
  4768. }
  4769. }, that.model);
  4770. this.IS_DESIGN_MODE = true;
  4771. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  4772. this.viewModel = new Ext.app.ViewModel(vmodel);
  4773. this.viewModel.yvanScope = this;
  4774. this._applyWatchList();
  4775. var config = _$2.defaultsDeep({
  4776. viewModel: this.viewModel,
  4777. yvanScope: this,
  4778. referenceHolder: true,
  4779. listeners: {
  4780. afterrender: function (sender) {
  4781. var _a;
  4782. // 记录句柄
  4783. if (sender && !that._handle) {
  4784. that._handle = sender;
  4785. }
  4786. // 调用onLoad回调
  4787. that._onLoad();
  4788. // 如果vjson中配置了 afterrender ,需要恢复状态
  4789. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4790. },
  4791. },
  4792. }, that.vjson);
  4793. designer.removeAll(true);
  4794. designer.add(config);
  4795. };
  4796. /**
  4797. * 关闭对话框(或标签页)
  4798. */
  4799. Scope.prototype.close = function () {
  4800. this._handle.close();
  4801. };
  4802. Object.defineProperty(Scope.prototype, "data", {
  4803. /**
  4804. * 获取 viewModel 里包含的数据(只读)
  4805. */
  4806. get: function () {
  4807. return this.viewModel.getData();
  4808. },
  4809. enumerable: true,
  4810. configurable: true
  4811. });
  4812. /**
  4813. * 设置 viewModel 中的数据
  4814. * 可以是 key, value 模式
  4815. * 也可以是 {key:value} 模式
  4816. */
  4817. Scope.prototype.set = function (path, value) {
  4818. return this.viewModel.set(path, value);
  4819. };
  4820. /**
  4821. * 寻找模块内所有的 xtype 对应的对象
  4822. * @param xtypeKey
  4823. */
  4824. Scope.prototype.down = function (xtypeKey) {
  4825. return this._handle.down(xtypeKey);
  4826. };
  4827. Object.defineProperty(Scope.prototype, "refs", {
  4828. /**
  4829. * 获取所有设置过 Reference 名称的组件
  4830. */
  4831. get: function () {
  4832. var _a, _b;
  4833. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  4834. },
  4835. enumerable: true,
  4836. configurable: true
  4837. });
  4838. Scope.prototype._destroy = function () {
  4839. var that = this;
  4840. that.onDestroy();
  4841. delete that._watchList;
  4842. delete that._handle;
  4843. this.isLoadFinish = false;
  4844. };
  4845. /**
  4846. * 私有渲染完成后的回调
  4847. */
  4848. Scope.prototype._onLoad = function () {
  4849. var _this = this;
  4850. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  4851. exports.scopeOnLoad(this);
  4852. }
  4853. this.onLoad();
  4854. _$2.defer(function () {
  4855. _this.isLoadFinish = true;
  4856. });
  4857. };
  4858. /**
  4859. * 默认 渲染完成之后调用的函数
  4860. */
  4861. Scope.prototype.onLoad = function () {
  4862. };
  4863. /**
  4864. * 组件卸载之后的回调
  4865. */
  4866. Scope.prototype.onDestroy = function () {
  4867. };
  4868. return Scope;
  4869. }());
  4870. /**
  4871. * 观察装饰器,viewModel 属性更改时触发成员方法
  4872. * @param tplExpress tpl表达式,例如 "{form.f1}"
  4873. */
  4874. function watch(tplExpress, deep) {
  4875. if (deep === void 0) { deep = false; }
  4876. return function (target, propertyKey, pd) {
  4877. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  4878. return target[propertyKey];
  4879. };
  4880. }
  4881. // 获取vjson的hash值
  4882. function getVjsonHash(str) {
  4883. var hash = 3465217896, i, ch;
  4884. for (i = str.length - 1; i >= 0; i--) {
  4885. ch = str.charCodeAt(i);
  4886. hash ^= ((hash << 5) + ch + (hash >> 2));
  4887. }
  4888. return (hash & 0x7FFFFFFF) + "";
  4889. }
  4890. function buildPlus(_a) {
  4891. var model = _a.model, vjson = _a.vjson;
  4892. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  4893. {
  4894. layout: 'border',
  4895. // tbar: vjson.action,
  4896. items: vjson.items,
  4897. },
  4898. ] });
  4899. if (_$2.isArray(vjson.action)) {
  4900. vjsonNew.items[0].tbar = vjson.action;
  4901. }
  4902. return { model: model, vjson: vjsonNew };
  4903. }
  4904. //# sourceMappingURL=Scope.js.map
  4905. var model = {
  4906. data: {
  4907. form: {
  4908. resource_parent: '',
  4909. resource_name: '',
  4910. resource_icon: '',
  4911. scope_url: '',
  4912. scope_params: '',
  4913. resource_order: '',
  4914. permission_code: '',
  4915. },
  4916. }
  4917. };
  4918. //# sourceMappingURL=RegisterModule.model.js.map
  4919. var vjson = {
  4920. title: '注册模块',
  4921. layout: 'fit',
  4922. width: "40%",
  4923. height: "50%",
  4924. fbar: {
  4925. xtype: 'toolbar',
  4926. items: [
  4927. {
  4928. xtype: "button",
  4929. text: "确定",
  4930. iconCls: 'x-fa fa-check',
  4931. listeners: {
  4932. click: 'scope.saveNode',
  4933. }
  4934. },
  4935. {
  4936. xtype: "button",
  4937. text: "关闭",
  4938. iconCls: 'x-fa fa-times',
  4939. listeners: {
  4940. click: 'system.closeMe()',
  4941. }
  4942. },
  4943. ]
  4944. },
  4945. items: [
  4946. {
  4947. layout: 'border',
  4948. items: [
  4949. {
  4950. region: 'west',
  4951. layout: 'fit',
  4952. xtype: 'tabpanel',
  4953. reference: 'tabs',
  4954. width: "50%",
  4955. split: true,
  4956. listeners: {
  4957. tabchange: 'scope.tabchange',
  4958. },
  4959. items: [
  4960. {
  4961. region: 'center',
  4962. layout: 'fit',
  4963. title: 'PC菜单',
  4964. key: "1",
  4965. items: [
  4966. {
  4967. xtype: 'treepanel',
  4968. layout: 'fit',
  4969. region: 'west',
  4970. rootVisible: false,
  4971. useArrows: true,
  4972. reference: 'tree1',
  4973. listeners: {
  4974. itemclick: "scope.tree1NodeClick",
  4975. }
  4976. },
  4977. ]
  4978. },
  4979. {
  4980. region: 'center',
  4981. layout: 'fit',
  4982. title: 'PDA菜单',
  4983. key: "2",
  4984. items: [
  4985. {
  4986. xtype: 'treepanel',
  4987. layout: 'fit',
  4988. region: 'west',
  4989. reference: 'tree2',
  4990. rootVisible: false,
  4991. useArrows: true,
  4992. listeners: {
  4993. itemclick: "scope.tree1NodeClick",
  4994. }
  4995. },
  4996. ]
  4997. },
  4998. ]
  4999. },
  5000. {
  5001. region: 'center',
  5002. xtype: 'form',
  5003. margin: '0 0 0 0',
  5004. split: true,
  5005. width: '50%',
  5006. items: [
  5007. {
  5008. xtype: 'cols',
  5009. items: [
  5010. {
  5011. xtype: 'textfield',
  5012. fieldLabel: '上级资源ID',
  5013. bind: {
  5014. readOnly: true,
  5015. disabled: true,
  5016. value: '{form.resource_parent}'
  5017. },
  5018. },
  5019. ],
  5020. },
  5021. {
  5022. xtype: 'cols',
  5023. items: [
  5024. {
  5025. xtype: 'textfield',
  5026. fieldLabel: '资源名称',
  5027. bind: {
  5028. value: '{form.resource_name}'
  5029. },
  5030. allowBlank: false,
  5031. },
  5032. ],
  5033. },
  5034. {
  5035. xtype: 'cols',
  5036. items: [
  5037. {
  5038. xtype: 'numberfield',
  5039. fieldLabel: '资源排序',
  5040. bind: {
  5041. value: '{form.resource_order}'
  5042. },
  5043. allowBlank: false,
  5044. },
  5045. ],
  5046. },
  5047. {
  5048. xtype: 'cols',
  5049. items: [
  5050. {
  5051. xtype: 'textfield',
  5052. fieldLabel: '功能URL',
  5053. bind: {
  5054. disabled: true,
  5055. value: '{form.scope_url}'
  5056. },
  5057. },
  5058. ]
  5059. },
  5060. {
  5061. xtype: 'cols',
  5062. items: [
  5063. {
  5064. xtype: 'textfield',
  5065. fieldLabel: '权限编码',
  5066. bind: {
  5067. value: '{form.permission_code}'
  5068. }
  5069. },
  5070. ],
  5071. },
  5072. {
  5073. xtype: 'cols',
  5074. items: [
  5075. {
  5076. xtype: 'textfield',
  5077. fieldLabel: '功能参数',
  5078. bind: {
  5079. value: '{form.scope_params}'
  5080. }
  5081. },
  5082. ],
  5083. },
  5084. ],
  5085. },
  5086. ],
  5087. },
  5088. ],
  5089. referenceHolder: true,
  5090. };
  5091. //# sourceMappingURL=RegisterModule.view.js.map
  5092. var RegisterModule = /** @class */ (function (_super) {
  5093. __extends(RegisterModule, _super);
  5094. function RegisterModule() {
  5095. return _super.call(this, { model: model, vjson: vjson }) || this;
  5096. }
  5097. RegisterModule.prototype.onLoad = function () {
  5098. this.reloadTree("PC");
  5099. };
  5100. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  5101. var currTabKey = b.key;
  5102. if (currTabKey === '1') {
  5103. this.viewModel.set('form', '');
  5104. this.reloadTree("PC");
  5105. }
  5106. else {
  5107. this.viewModel.set('form', '');
  5108. this.reloadTree("PDA");
  5109. }
  5110. };
  5111. RegisterModule.prototype.reloadTree = function (type) {
  5112. var _this = this;
  5113. if ("PC" === type) {
  5114. this.setLoading(true);
  5115. getMenuTree({ type: "PC" }).then(function (res) {
  5116. if (res.success) {
  5117. _this.refs.tree1.store.setRootNode({
  5118. expanded: true,
  5119. children: res.data
  5120. });
  5121. }
  5122. }).finally(function () {
  5123. _this.setLoading(false);
  5124. });
  5125. }
  5126. else {
  5127. this.setLoading(true);
  5128. getMenuTree({ type: "PDA" }).then(function (res) {
  5129. if (res.success) {
  5130. _this.refs.tree2.store.setRoot({
  5131. expanded: true,
  5132. children: res.data
  5133. });
  5134. }
  5135. }).finally(function () {
  5136. _this.setLoading(false);
  5137. });
  5138. }
  5139. };
  5140. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  5141. var id = _$2.split(node.data.id, '_')[1];
  5142. if (!id) {
  5143. return;
  5144. }
  5145. this.viewModel.set('form.resource_parent', id);
  5146. };
  5147. RegisterModule.prototype.saveNode = function () {
  5148. var _this = this;
  5149. var tabKey = this.refs.tabs.activeTab.key;
  5150. // 检验菜单数据
  5151. var param = this.viewModel.get('form');
  5152. if (!param.resource_parent) {
  5153. msg('请选择一个父节点');
  5154. return;
  5155. }
  5156. if (!param.resource_name) {
  5157. msg('资源名称不能为空');
  5158. return;
  5159. }
  5160. if (!param.scope_url) {
  5161. msg('功能URL不能为空');
  5162. return;
  5163. }
  5164. var type;
  5165. if (tabKey === '1') {
  5166. type = 'PC';
  5167. }
  5168. else {
  5169. type = 'PDA';
  5170. }
  5171. this.setLoading(true);
  5172. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  5173. if (res.success) {
  5174. msg("注册成功");
  5175. _this.close();
  5176. }
  5177. }).finally(function () {
  5178. _this.setLoading(false);
  5179. });
  5180. };
  5181. return RegisterModule;
  5182. }(Scope));
  5183. //# sourceMappingURL=RegisterModule.js.map
  5184. var model$1 = {
  5185. data: {
  5186. title: "模板选择",
  5187. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  5188. moduleType: 1,
  5189. // 当前模块包路径 "com/galaxis/wms/bas/area"
  5190. packagePath: "",
  5191. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  5192. fileSavePath: "",
  5193. // 模块名称 "Dict"
  5194. moduleName: "NewModule",
  5195. // 页面标题 "字典维护"
  5196. pageTitle: "新模块",
  5197. // 单表查询
  5198. singleTable: {
  5199. sql: "select * from bas_dict",
  5200. // 新增或者删除所用的表
  5201. tableName: "",
  5202. // 是否分页查询
  5203. pagination: true,
  5204. // 是否需要删除
  5205. delete: true,
  5206. // 删除条件字段
  5207. deleteWhereColumn: "",
  5208. // 删除提示语
  5209. deleteTips: "确定要删除?",
  5210. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  5211. editType: 2,
  5212. },
  5213. singleTableView: {
  5214. tableNameList: [
  5215. // { value: "aaa"},
  5216. ],
  5217. columnList: [
  5218. // { value: "aaa"},
  5219. ],
  5220. }
  5221. }
  5222. };
  5223. //# sourceMappingURL=CreateModule.model.js.map
  5224. var vjson$1 = {
  5225. bind: {
  5226. title: '新建模块-{title}',
  5227. },
  5228. width: "55%",
  5229. height: "60%",
  5230. minWidth: 500,
  5231. minHeight: 400,
  5232. modal: true,
  5233. frame: true,
  5234. layout: 'card',
  5235. bbar: [
  5236. '->',
  5237. {
  5238. itemId: 'card-prev',
  5239. text: '&laquo; 上一步',
  5240. disabled: true,
  5241. listeners: {
  5242. click: 'scope.showPrevious',
  5243. },
  5244. },
  5245. {
  5246. itemId: 'card-next',
  5247. text: '下一步 &raquo;',
  5248. listeners: {
  5249. click: 'scope.showNext',
  5250. },
  5251. },
  5252. {
  5253. itemId: 'card-finish',
  5254. text: '立刻执行',
  5255. iconCls: 'x-fa fa-flash',
  5256. hidden: true,
  5257. listeners: {
  5258. click: 'scope.finish',
  5259. },
  5260. },
  5261. ],
  5262. items: [
  5263. {
  5264. vtitle: '模板选择',
  5265. reference: 'templateSelection',
  5266. layout: {
  5267. type: 'hbox',
  5268. pack: 'start',
  5269. align: 'stretch'
  5270. },
  5271. listeners: {
  5272. cardEnter: 'scope.templateEnter',
  5273. cardLevel: 'scope.templateLevel'
  5274. },
  5275. items: [
  5276. {
  5277. width: 150,
  5278. xtype: 'form',
  5279. border: false,
  5280. layout: {
  5281. type: 'vbox',
  5282. align: 'stretch'
  5283. },
  5284. defaults: {
  5285. border: false,
  5286. anchor: '100%',
  5287. margin: '5',
  5288. },
  5289. items: [
  5290. {
  5291. xtype: 'radiogroup',
  5292. bind: {
  5293. value: '{moduleType}'
  5294. },
  5295. layout: 'vbox',
  5296. defaults: {
  5297. border: false,
  5298. anchor: '100%',
  5299. margin: '5',
  5300. },
  5301. items: [
  5302. { boxLabel: '单表查询', inputValue: 1 },
  5303. { boxLabel: '主/明细查询', inputValue: 2 },
  5304. { boxLabel: '树/明细查询', inputValue: 3 },
  5305. { boxLabel: '卡片表单', inputValue: 4 },
  5306. { boxLabel: '主/详情查询', inputValue: 5 },
  5307. ]
  5308. },
  5309. ]
  5310. },
  5311. {
  5312. flex: 1,
  5313. region: 'center',
  5314. xtype: "panel",
  5315. border: false,
  5316. frame: true,
  5317. padding: "4px 8px",
  5318. html: "描述...",
  5319. }
  5320. ]
  5321. },
  5322. {
  5323. vtitle: '模块名称',
  5324. reference: 'moduleName',
  5325. layout: 'fit',
  5326. listeners: {
  5327. cardEnter: 'scope.moduleEnter',
  5328. cardLevel: 'scope.moduleLevel'
  5329. },
  5330. items: [
  5331. {
  5332. xtype: 'form',
  5333. border: false,
  5334. layout: {
  5335. type: 'vbox',
  5336. align: 'stretch'
  5337. },
  5338. defaults: {
  5339. border: false,
  5340. anchor: '100%',
  5341. margin: '5',
  5342. },
  5343. items: [
  5344. {
  5345. xtype: 'textfield',
  5346. fieldLabel: '包路径',
  5347. allowBlank: false,
  5348. bind: { value: '{packagePath}' },
  5349. },
  5350. {
  5351. xtype: 'textfield',
  5352. fieldLabel: '文件路径',
  5353. allowBlank: false,
  5354. bind: { value: '{fileSavePath}' },
  5355. },
  5356. {
  5357. xtype: 'textfield',
  5358. fieldLabel: '模块名',
  5359. allowBlank: false,
  5360. bind: { value: '{moduleName}' },
  5361. },
  5362. {
  5363. xtype: 'textfield',
  5364. fieldLabel: '菜单名',
  5365. allowBlank: false,
  5366. bind: { value: '{pageTitle}' },
  5367. },
  5368. ]
  5369. },
  5370. ]
  5371. },
  5372. {
  5373. vtitle: '确认结果',
  5374. reference: 'confirmResult',
  5375. layout: 'fit',
  5376. listeners: {
  5377. cardEnter: 'scope.optionEnter',
  5378. cardLevel: 'scope.optionLevel',
  5379. },
  5380. items: [
  5381. {
  5382. xtype: 'jsoneditor',
  5383. reference: 'jsoneditor'
  5384. }
  5385. ]
  5386. },
  5387. // ---------------------------------------------------------------------------------- 单表查询
  5388. {
  5389. vtitle: '查询SQL',
  5390. reference: 'singleTable_1',
  5391. layout: 'fit',
  5392. listeners: {
  5393. cardEnter: 'scope.editorEnter',
  5394. cardLevel: 'scope.editorLevel'
  5395. },
  5396. items: [
  5397. {
  5398. xtype: 'sqleditor',
  5399. }
  5400. ],
  5401. },
  5402. {
  5403. vtitle: '字段选项',
  5404. reference: 'singleTable_2',
  5405. layout: 'fit',
  5406. listeners: {
  5407. cardEnter: 'scope.columnEnter',
  5408. cardLevel: 'scope.columnLevel',
  5409. },
  5410. items: [
  5411. {
  5412. xtype: 'yvgrid',
  5413. border: false,
  5414. selModel: {
  5415. type: 'spreadsheet',
  5416. columnSelect: true,
  5417. pruneRemoved: false,
  5418. extensible: 'y'
  5419. },
  5420. plugins: {
  5421. clipboard: true,
  5422. selectionreplicator: true
  5423. },
  5424. reference: 'grid1',
  5425. idField: 'column_name',
  5426. hideFootbar: true,
  5427. tbar: {
  5428. xtype: 'toolbar',
  5429. items: [
  5430. {
  5431. xtype: 'button',
  5432. text: '添加',
  5433. iconCls: 'x-fa fa-plus-circle',
  5434. listeners: {
  5435. click: 'scope.addField'
  5436. }
  5437. },
  5438. {
  5439. xtype: 'button',
  5440. text: '删除',
  5441. iconCls: 'x-fa fa-minus-circle',
  5442. listeners: {
  5443. click: 'scope.removeField'
  5444. }
  5445. },
  5446. {
  5447. xtype: 'button',
  5448. text: '分析SQL',
  5449. iconCls: 'x-fa fa-refresh',
  5450. listeners: {
  5451. click: 'scope.parseSQL'
  5452. }
  5453. },
  5454. ]
  5455. },
  5456. columns: [
  5457. {
  5458. text: '字段名', dataIndex: 'column_name',
  5459. sortable: false,
  5460. menuDisabled: true,
  5461. width: 150,
  5462. editor: {
  5463. allowBlank: true,
  5464. selectOnFocus: false,
  5465. }
  5466. },
  5467. {
  5468. text: '字段中文', dataIndex: 'column_comment',
  5469. width: 150,
  5470. sortable: false,
  5471. menuDisabled: true,
  5472. editor: {
  5473. allowBlank: true,
  5474. selectOnFocus: false,
  5475. }
  5476. },
  5477. {
  5478. dataIndex: "column_useto",
  5479. // fix: ['system.getDict("column_useto")'],
  5480. header: "用途",
  5481. editor: {
  5482. xtype: 'combo',
  5483. allowBlank: false,
  5484. },
  5485. },
  5486. {
  5487. text: '主键', dataIndex: 'is_primary_key',
  5488. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5489. width: 48, resizable: false,
  5490. },
  5491. {
  5492. text: '必填', dataIndex: 'not_null',
  5493. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5494. width: 48, resizable: false,
  5495. },
  5496. {
  5497. text: '长度', dataIndex: 'column_size',
  5498. sortable: false, menuDisabled: true,
  5499. xtype: 'numbercolumn', format: '0',
  5500. editor: { allowBlank: true, selectOnFocus: true }
  5501. },
  5502. {
  5503. text: '字典', dataIndex: 'column_dict',
  5504. sortable: false, menuDisabled: true,
  5505. width: 200,
  5506. editor: {
  5507. allowBlank: true,
  5508. }
  5509. },
  5510. {
  5511. text: 'UI组件', dataIndex: 'column_ui',
  5512. sortable: false, menuDisabled: true,
  5513. // fix: ['system.getDict("column_ui")'],
  5514. width: 150,
  5515. editor: {
  5516. xtype: 'combo',
  5517. allowBlank: true,
  5518. }
  5519. },
  5520. {
  5521. dataIndex: 'data_type',
  5522. hidden: true,
  5523. },
  5524. ]
  5525. }
  5526. ],
  5527. },
  5528. {
  5529. vtitle: '其他选项',
  5530. reference: 'singleTable_3',
  5531. isEnd: true,
  5532. listeners: {
  5533. cardEnter: 'scope.extendEnter',
  5534. cardLevel: 'scope.extendLevel',
  5535. },
  5536. layout: 'fit',
  5537. items: [
  5538. {
  5539. xtype: 'form',
  5540. border: false,
  5541. layout: {
  5542. type: 'vbox',
  5543. align: 'stretch'
  5544. },
  5545. defaults: {
  5546. border: false,
  5547. anchor: '100%',
  5548. margin: '5',
  5549. },
  5550. items: [
  5551. {
  5552. xtype: 'checkbox',
  5553. fieldLabel: '需要分页',
  5554. labelWidth: 100,
  5555. bind: {
  5556. value: '{singleTable.pagination}',
  5557. },
  5558. },
  5559. {
  5560. xtype: 'combobox',
  5561. fieldLabel: '操作数据库表',
  5562. labelWidth: 100,
  5563. publishes: 'singleTable.tableName',
  5564. displayField: 'value',
  5565. valueField: 'value',
  5566. bind: {
  5567. data: '{singleTableView.tableNameList}',
  5568. value: '{singleTable.tableName}',
  5569. },
  5570. },
  5571. {
  5572. xtype: 'checkboxfield',
  5573. fieldLabel: '需要删除',
  5574. labelWidth: 100,
  5575. bind: {
  5576. value: '{singleTable.delete}',
  5577. },
  5578. },
  5579. {
  5580. xtype: 'combobox',
  5581. fieldLabel: '删除条件字段',
  5582. labelWidth: 100,
  5583. publishes: 'singleTable.deleteWhereColumn',
  5584. displayField: 'value',
  5585. valueField: 'value',
  5586. bind: {
  5587. data: '{singleTableView.columnList}',
  5588. hidden: '{!singleTable.delete}',
  5589. value: '{singleTable.deleteWhereColumn}',
  5590. },
  5591. },
  5592. {
  5593. xtype: 'textfield',
  5594. fieldLabel: '删除提示语句',
  5595. labelWidth: 100,
  5596. bind: {
  5597. hidden: '{!singleTable.delete}',
  5598. value: '{singleTable.deleteTips}',
  5599. },
  5600. },
  5601. {
  5602. fieldLabel: '新增与编辑',
  5603. labelWidth: 100,
  5604. xtype: 'radiogroup',
  5605. bind: {
  5606. value: '{singleTable.editType}'
  5607. },
  5608. layout: 'vbox',
  5609. defaults: {
  5610. border: false,
  5611. anchor: '100%',
  5612. margin: '5',
  5613. },
  5614. items: [
  5615. { boxLabel: '不要新增和编辑', inputValue: 1 },
  5616. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  5617. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  5618. ]
  5619. },
  5620. ]
  5621. }
  5622. ]
  5623. },
  5624. // ---------------------------------------------------------------------------------- 主/明细查询
  5625. {
  5626. vtitle: '主表查询SQL',
  5627. reference: 'mainDetailTable_1',
  5628. layout: 'fit',
  5629. listeners: {},
  5630. items: [],
  5631. },
  5632. {
  5633. vtitle: '主表字段选项',
  5634. reference: 'mainDetailTable_2',
  5635. layout: 'fit',
  5636. listeners: {},
  5637. items: [],
  5638. },
  5639. {
  5640. vtitle: '主表其他选项',
  5641. reference: 'mainDetailTable_3',
  5642. layout: 'fit',
  5643. listeners: {},
  5644. items: [],
  5645. },
  5646. {
  5647. vtitle: '子表查询SQL',
  5648. reference: 'mainDetailTable_4',
  5649. layout: 'fit',
  5650. listeners: {},
  5651. items: [],
  5652. },
  5653. {
  5654. vtitle: '子表字段选项',
  5655. reference: 'mainDetailTable_5',
  5656. layout: 'fit',
  5657. listeners: {},
  5658. items: [],
  5659. },
  5660. {
  5661. vtitle: '子表其他选项',
  5662. reference: 'mainDetailTable_6',
  5663. isEnd: true,
  5664. layout: 'fit',
  5665. listeners: {},
  5666. items: [],
  5667. },
  5668. // ---------------------------------------------------------------------------------- 树/明细查询
  5669. // ---------------------------------------------------------------------------------- 卡片表单
  5670. {
  5671. vtitle: '表单字段',
  5672. reference: 'cardForm_1',
  5673. layout: 'fit',
  5674. listeners: {},
  5675. items: [],
  5676. },
  5677. {
  5678. vtitle: '表单初始化',
  5679. reference: 'cardForm_2',
  5680. isEnd: true,
  5681. layout: 'fit',
  5682. listeners: {},
  5683. items: [],
  5684. },
  5685. ]
  5686. };
  5687. //# sourceMappingURL=CreateModule.view.js.map
  5688. var DbStore = /** @class */ (function (_super) {
  5689. __extends(DbStore, _super);
  5690. function DbStore() {
  5691. return _super !== null && _super.apply(this, arguments) || this;
  5692. }
  5693. DbStore.prototype.getCacheKey = function (param) {
  5694. return "db_data.json";
  5695. };
  5696. DbStore.prototype.invokeApi = function (param) {
  5697. return getMateData(param);
  5698. };
  5699. /**
  5700. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  5701. */
  5702. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  5703. return new Promise(function (resolve, reject) {
  5704. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  5705. resolve(res1);
  5706. // TODO 好像不需要,先跳过
  5707. // reloadByTableName(schema_name, table_name).then(res2 => {
  5708. // resolve(res1)
  5709. // }).catch(e => {
  5710. // reject(e)
  5711. // })
  5712. }).catch(function (e) {
  5713. reject(e);
  5714. });
  5715. });
  5716. };
  5717. /**
  5718. * 保存元数据至表格
  5719. */
  5720. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  5721. var _this = this;
  5722. return new Promise(function (resolve, reject) {
  5723. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  5724. // 保存后重新刷新
  5725. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  5726. resolve({
  5727. data: res2,
  5728. msg: res1.msg
  5729. });
  5730. }).catch(function (e) {
  5731. reject(e);
  5732. });
  5733. }).catch(function (e) {
  5734. reject(e);
  5735. });
  5736. });
  5737. };
  5738. /**
  5739. * 预览生成的 DDL 语句
  5740. */
  5741. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  5742. return new Promise(function (resolve, reject) {
  5743. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  5744. .then(function (res) {
  5745. resolve(res);
  5746. });
  5747. });
  5748. };
  5749. /**
  5750. * 执行 DDL
  5751. */
  5752. DbStore.prototype.pushToDbCommit = function (arg) {
  5753. return new Promise(function (resolve, reject) {
  5754. pushToDbCommitApi(arg).then(function (res) {
  5755. resolve(res);
  5756. }).catch(function (e) {
  5757. reject(e);
  5758. });
  5759. });
  5760. };
  5761. /**
  5762. * 重读某一个表格的 meta 元数据
  5763. */
  5764. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  5765. var _this = this;
  5766. return new Promise(function (resolve, reject) {
  5767. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  5768. if (!res[0] || !res[0].table_list[0]) {
  5769. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  5770. return;
  5771. }
  5772. var tableRow = _this.getTableByName(schema_name, table_name);
  5773. if (!tableRow) {
  5774. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  5775. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  5776. if (!schemaRow) {
  5777. showErrorDialog$1('没有找到 schema:' + schema_name);
  5778. return;
  5779. }
  5780. schemaRow.table_list.push(res[0].table_list[0]);
  5781. }
  5782. else {
  5783. // 找到了目标表格,就吧 table 所有属性都赋值过去
  5784. Object.assign(tableRow, res[0].table_list[0]);
  5785. }
  5786. // 所有界面通知一遍刷新
  5787. _this.notifyRefresh();
  5788. resolve(res);
  5789. }).catch(function (e) {
  5790. reject(e);
  5791. });
  5792. });
  5793. };
  5794. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  5795. var result = undefined;
  5796. _$2.forEach(this.apiResponse, function (schemaRow) {
  5797. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  5798. if (tableRow) {
  5799. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  5800. if (columnRow) {
  5801. result = columnRow;
  5802. return false;
  5803. }
  5804. }
  5805. });
  5806. return result;
  5807. };
  5808. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  5809. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  5810. if (!schemaRow) {
  5811. showErrorDialog$1('没有找到 schema:' + schemaName);
  5812. return;
  5813. }
  5814. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  5815. if (!schemaRow) {
  5816. showErrorDialog$1('没有找到 table:' + tableName);
  5817. return;
  5818. }
  5819. return tableRow;
  5820. };
  5821. /**
  5822. * 添加一个新表格
  5823. */
  5824. DbStore.prototype.appendNewTable = function (tableInfo) {
  5825. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  5826. if (!schemaRow) {
  5827. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  5828. return;
  5829. }
  5830. schemaRow.table_list.push(tableInfo);
  5831. };
  5832. /**
  5833. * 从数据库结构重新生成元数据
  5834. */
  5835. DbStore.prototype.dbToMetaAndReload = function () {
  5836. var _this = this;
  5837. this.notifyLoading(true);
  5838. dbToMeta().then(function () {
  5839. _this.reloadForce(undefined);
  5840. }).catch(function (e) {
  5841. _this.notifyLoading(false);
  5842. });
  5843. };
  5844. DbStore.prototype.getSchemaDbType = function (schemaName) {
  5845. var dbType = undefined;
  5846. _$2.forEach(this.apiResponse, function (schemaRow) {
  5847. if (schemaRow.schema_name === schemaName) {
  5848. dbType = schemaRow.db_type;
  5849. return false;
  5850. }
  5851. });
  5852. return dbType;
  5853. };
  5854. return DbStore;
  5855. }(CacheStore));
  5856. function syncQueryDSL(_a) {
  5857. var schema_name = _a.schema_name, table_name = _a.table_name;
  5858. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  5859. }
  5860. var instance = new DbStore();
  5861. // // 字段域数据
  5862. // let columnDomain = undefined
  5863. // // 元数据
  5864. // let apiResponse = []
  5865. //
  5866. // // 订阅
  5867. // const subscribeList = []
  5868. // /**
  5869. // * 获取全部元数据
  5870. // */
  5871. // export function getApiResponse() {
  5872. // return apiResponse
  5873. // }
  5874. //
  5875. // export function getColumnDomain() {
  5876. // return columnDomain
  5877. // }
  5878. // window['getApiResponse'] = getApiResponse
  5879. // window['getColumnDomain'] = getColumnDomain
  5880. // window['getDbTreeStore'] = function () {
  5881. // return apiResponse
  5882. // }
  5883. //
  5884. // /**
  5885. // * 订阅结果集
  5886. // */
  5887. // export function subscribe(fn) {
  5888. // subscribeList.push(fn)
  5889. // }
  5890. //
  5891. // /**
  5892. // * 取消订阅
  5893. // */
  5894. // export function describe(fn) {
  5895. // _.remove(subscribeList, item => item === fn)
  5896. // }
  5897. //
  5898. // /**
  5899. // * 刷新,如果前端从来没有取到过结果的话
  5900. // * 如果强制刷新成功,就返回 true
  5901. // * 如果没有被强制刷新,返回 false
  5902. // */
  5903. // export function reloadIfNeed() {
  5904. // if (_.size(apiResponse) <= 0) {
  5905. // reloadForce()
  5906. // return true
  5907. // }
  5908. // return false
  5909. // }
  5910. //
  5911. // export function reloadIfNeedPromise() {
  5912. // return new Promise((resolve, reject) => {
  5913. // if (_.size(apiResponse) <= 0) {
  5914. // // 从未有获取过值
  5915. // reloadForce().then(res => {
  5916. // resolve(apiResponse)
  5917. // })
  5918. // return
  5919. // }
  5920. // resolve(apiResponse)
  5921. // return
  5922. // })
  5923. // }
  5924. //
  5925. // /**
  5926. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  5927. // */
  5928. // export function reloadForce() {
  5929. // _.forEach(subscribeList, fn => {
  5930. // fn(true)
  5931. // })
  5932. //
  5933. // return getMateData().then((content) => {
  5934. // apiResponse = content
  5935. // _.forEach(subscribeList, fn => {
  5936. // fn(apiResponse)
  5937. // })
  5938. // }).finally(() => {
  5939. // _.forEach(subscribeList, fn => {
  5940. // fn(false)
  5941. // })
  5942. // })
  5943. // }
  5944. //
  5945. // /**
  5946. // * 通知刷新元数据
  5947. // */
  5948. // export function notifyRefresh() {
  5949. // _.forEach(subscribeList, fn => {
  5950. // fn(apiResponse)
  5951. // })
  5952. // }
  5953. // export function getAllDomain() {
  5954. // return new Promise((resolve, reject) => {
  5955. // getColumnDomainApi()
  5956. // .then(res => {
  5957. // if (res.success) {
  5958. // columnDomain = res.data
  5959. // resolve(res.data)
  5960. // } else {
  5961. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  5962. // console.error('getColumnDomain', res.msg)
  5963. // }
  5964. //
  5965. // })
  5966. // .catch(e => {
  5967. // showErrorDialog('getColumnDomain error!')
  5968. // console.error('getColumnDomain', e)
  5969. // reject(e)
  5970. // })
  5971. // })
  5972. // }
  5973. //# sourceMappingURL=DbStore.js.map
  5974. // noinspection TypeScriptCheckImport
  5975. function getSingleTableData(origin) {
  5976. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  5977. var _a, _b, _c;
  5978. var data = {
  5979. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  5980. package: _$2.replace(origin.packagePath, /\//g, "."),
  5981. groovyClass: origin.moduleName,
  5982. qClass: queryDslInfo.qClass,
  5983. qClassTable: queryDslInfo.qClassTable,
  5984. queryColumns: [],
  5985. insertColumns: [],
  5986. updateColumns: [],
  5987. updateWheres: [],
  5988. deleteWheres: [],
  5989. gridColumns: [],
  5990. sql: origin.sql,
  5991. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  5992. addButton: origin.editType !== 1,
  5993. saveButton: origin.editType === 2,
  5994. deleteButton: true,
  5995. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  5996. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  5997. fileSavePath: origin.fileSavePath,
  5998. };
  5999. origin.columnList.forEach(function (column) {
  6000. var column_name = column.column_name, column_comment = column.column_comment, is_primary_key = column.is_primary_key, column_dict = column.column_dict, column_ui = column.column_ui;
  6001. var query = origin.queryColumns.indexOf(column_name) >= 0;
  6002. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  6003. var update = origin.updateColumns.indexOf(column_name) >= 0;
  6004. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  6005. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  6006. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  6007. if (query) {
  6008. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  6009. }
  6010. if (insert) {
  6011. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  6012. }
  6013. if (update) {
  6014. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  6015. }
  6016. if (grid) {
  6017. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  6018. if (column_dict) {
  6019. gridColumn.fix = { dictName: column_dict };
  6020. }
  6021. if (origin.editType == 2 && (insert || update)) {
  6022. gridColumn.editor = { xtype: column_ui, fix: undefined };
  6023. if (column_dict) {
  6024. gridColumn.editor.fix = { dictName: column_dict };
  6025. }
  6026. }
  6027. data.gridColumns.push(gridColumn);
  6028. }
  6029. if (is_primary_key) {
  6030. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6031. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6032. }
  6033. });
  6034. return data;
  6035. });
  6036. }
  6037. // noinspection HttpUrlsUsage
  6038. var urlPrefix = "/static/studio-template/single_table";
  6039. function generateCode(data) {
  6040. return Promise.all([
  6041. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  6042. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  6043. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  6044. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  6045. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  6046. ]).then(function (values) {
  6047. var groovy = handlebars.compile(values[0]);
  6048. var mybatis = handlebars.compile(values[1]);
  6049. var controller = handlebars.compile(values[2]);
  6050. var view = handlebars.compile(values[3]);
  6051. var model = handlebars.compile(values[4]);
  6052. var code = {
  6053. groovy: groovy(data),
  6054. mybatis: mybatis(data),
  6055. controller: controller(data),
  6056. view: view(data),
  6057. model: model(data),
  6058. };
  6059. return code;
  6060. });
  6061. }
  6062. //# sourceMappingURL=SingleTableCodegen.js.map
  6063. var CreateModule = /** @class */ (function (_super) {
  6064. __extends(CreateModule, _super);
  6065. function CreateModule() {
  6066. var _this = _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  6067. _this.columns = [];
  6068. return _this;
  6069. }
  6070. CreateModule.prototype.onLoad = function () {
  6071. this.refs.grid1.setData([]);
  6072. };
  6073. CreateModule.prototype.addField = function () {
  6074. this.refs.grid1.appendEditRow({
  6075. column_name: '',
  6076. column_comment: '',
  6077. is_primary_key: false,
  6078. not_null: true,
  6079. column_domain: '',
  6080. data_type: '',
  6081. column_size: 0,
  6082. decimal_digits: 0,
  6083. default_value: '',
  6084. column_dict: '',
  6085. column_ui: '',
  6086. column_note: '',
  6087. }, 0);
  6088. };
  6089. CreateModule.prototype.removeField = function () {
  6090. var _this = this;
  6091. var rows = [];
  6092. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6093. rows.push(r);
  6094. });
  6095. _$2.forEach(rows, function (r) {
  6096. _this.refs.grid1.getStore().remove(r);
  6097. });
  6098. };
  6099. CreateModule.prototype.parseSQL = function (sender) {
  6100. var _this = this;
  6101. var sql = this.viewModel.get('singleTable.sql');
  6102. sender.up('window').setLoading(true);
  6103. instance.reloadIfNeedPromise(undefined).then(function (res) {
  6104. parseSqlApi(sql).then(function (parseResult) {
  6105. if (!parseResult.success) {
  6106. msg(parseResult.msg);
  6107. return;
  6108. }
  6109. var tableNameList = [];
  6110. var columnList = [];
  6111. var singleTableTableName;
  6112. var singleTableDeleteWhereColumn;
  6113. _this.refs.grid1.setData([]);
  6114. var rows = _this.refs.grid1.getDataRows();
  6115. _$2.forEach(parseResult.data, function (parseRetColumn) {
  6116. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  6117. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  6118. return;
  6119. }
  6120. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  6121. tableNameList.push({ value: tableName });
  6122. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  6123. columnList.push({ value: columnName });
  6124. if (!singleTableTableName)
  6125. singleTableTableName = tableName;
  6126. if (!singleTableDeleteWhereColumn)
  6127. singleTableDeleteWhereColumn = columnName;
  6128. // 已经加过这个列了
  6129. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  6130. if (rowExists) {
  6131. return;
  6132. }
  6133. var columnRow = instance.getColumnByTableNameColumnName(tableName, columnName);
  6134. if (columnRow) {
  6135. _this.refs.grid1.appendEditRow({
  6136. table_name: tableName,
  6137. column_name: columnRow.column_name,
  6138. column_comment: columnRow.column_comment,
  6139. column_useto: 2,
  6140. is_primary_key: columnRow.is_primary_key,
  6141. not_null: columnRow.not_null,
  6142. column_size: columnRow.column_size,
  6143. column_dict: columnRow.column_dict,
  6144. column_ui: columnRow.column_ui,
  6145. data_type: columnRow.data_type,
  6146. });
  6147. if (columnRow.is_primary_key)
  6148. singleTableDeleteWhereColumn = columnName;
  6149. }
  6150. else {
  6151. _this.refs.grid1.appendEditRow({
  6152. table_name: tableName,
  6153. column_name: columnName,
  6154. column_useto: 2,
  6155. });
  6156. }
  6157. });
  6158. _this.viewModel.set("singleTableView.columnList", columnList);
  6159. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  6160. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  6161. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  6162. }).finally(function () {
  6163. sender.up('window').setLoading(false);
  6164. });
  6165. }).catch(function () {
  6166. sender.up('window').setLoading(false);
  6167. });
  6168. };
  6169. CreateModule.prototype.templateEnter = function (sender) {
  6170. };
  6171. CreateModule.prototype.templateLevel = function (sender, opt) {
  6172. if (!this.viewModel.get('moduleType')) {
  6173. msg('请选择模板类型');
  6174. opt.cancel = true;
  6175. return;
  6176. }
  6177. };
  6178. CreateModule.prototype.moduleEnter = function (sender) {
  6179. };
  6180. CreateModule.prototype.moduleLevel = function (sender, opt) {
  6181. if (!sender.down('form').isValid()) {
  6182. opt.cancel = true;
  6183. return;
  6184. }
  6185. };
  6186. CreateModule.prototype.editorEnter = function (sender) {
  6187. var editor = sender.down('sqleditor');
  6188. editor.setValue(this.viewModel.get('singleTable.sql'));
  6189. };
  6190. CreateModule.prototype.editorLevel = function (sender, opt) {
  6191. var editor = sender.down('sqleditor');
  6192. var sql = editor.getValue();
  6193. if (!sql) {
  6194. msg('查询SQL语句必填');
  6195. opt.cancel = true;
  6196. return;
  6197. }
  6198. this.viewModel.set('singleTable.sql', sql);
  6199. };
  6200. CreateModule.prototype.columnEnter = function (sender) {
  6201. };
  6202. CreateModule.prototype.columnLevel = function (sender, opt) {
  6203. };
  6204. CreateModule.prototype.extendEnter = function (sender) {
  6205. };
  6206. CreateModule.prototype.extendLevel = function (sender, opt) {
  6207. };
  6208. // 确认结果 - Enter
  6209. CreateModule.prototype.optionEnter = function (sender) {
  6210. var _this = this;
  6211. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6212. var moduleType = this.viewModel.get("moduleType");
  6213. var data = this.viewModel.getData();
  6214. var code = "";
  6215. var origin = {};
  6216. if (moduleType === 1) {
  6217. var singleTable = data.singleTable;
  6218. var editColumns = this.refs.grid1.getDataRows();
  6219. origin.moduleType = data.moduleType;
  6220. origin.packagePath = data.packagePath;
  6221. origin.fileSavePath = data.fileSavePath;
  6222. origin.moduleName = data.moduleName;
  6223. origin.pageTitle = data.pageTitle;
  6224. if (singleTable) {
  6225. origin.sql = singleTable.sql;
  6226. origin.tableName = singleTable.tableName;
  6227. origin.pagination = singleTable.pagination;
  6228. origin.delete = singleTable.delete;
  6229. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  6230. origin.deleteTips = singleTable.deleteTips;
  6231. origin.editType = singleTable.editType;
  6232. }
  6233. origin.columnList = [];
  6234. origin.queryColumns = [];
  6235. origin.insertColumns = [];
  6236. origin.updateColumns = [];
  6237. origin.gridColumns = [];
  6238. editColumns.forEach(function (column) {
  6239. var row = {
  6240. table_name: column.table_name,
  6241. column_name: column.column_name,
  6242. column_comment: column.column_comment,
  6243. is_primary_key: column.is_primary_key,
  6244. not_null: column.not_null,
  6245. column_size: column.column_size,
  6246. column_dict: column.column_dict,
  6247. column_ui: column.column_ui,
  6248. data_type: column.data_type,
  6249. column_type: column.column_type,
  6250. };
  6251. origin.columnList.push(row);
  6252. // 1:查询条件; 2:查询结果; 3:条件+结果;
  6253. var column_name = column.column_name, column_useto = column.column_useto;
  6254. switch (column_useto) {
  6255. case 1:
  6256. origin.queryColumns.push(column_name);
  6257. break;
  6258. case 2:
  6259. origin.gridColumns.push(column_name);
  6260. break;
  6261. case 3:
  6262. origin.queryColumns.push(column_name);
  6263. origin.gridColumns.push(column_name);
  6264. break;
  6265. }
  6266. origin.insertColumns.push(column_name);
  6267. origin.updateColumns.push(column_name);
  6268. });
  6269. }
  6270. this.setLoading(true);
  6271. getSingleTableData(origin).then(function (data) {
  6272. code = JSON.stringify(data, null, 4);
  6273. window['lastTemplateData'] = code;
  6274. var editor = _this.refs.jsoneditor;
  6275. editor.setCode(code);
  6276. }).finally(function () { return _this.setLoading(false); });
  6277. };
  6278. // 确认结果 - Level
  6279. CreateModule.prototype.optionLevel = function (sender, opt) {
  6280. };
  6281. // 上一步
  6282. CreateModule.prototype.showPrevious = function () {
  6283. this.doCardNavigation(false);
  6284. };
  6285. // 下一步
  6286. CreateModule.prototype.showNext = function () {
  6287. this.doCardNavigation(true, true);
  6288. };
  6289. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  6290. if (isNext === void 0) { isNext = true; }
  6291. if (isCancelable === void 0) { isCancelable = false; }
  6292. var layout = this._handle.getLayout();
  6293. var activeItem = layout.activeItem;
  6294. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  6295. if (isNext)
  6296. this.prevCard = reference;
  6297. var activeCard;
  6298. if (reference === "templateSelection") {
  6299. if (isNext) {
  6300. activeCard = this.refs['moduleName'];
  6301. }
  6302. }
  6303. else if (reference === "moduleName") {
  6304. if (isNext) {
  6305. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6306. var moduleType = this.viewModel.get("moduleType");
  6307. switch (moduleType) {
  6308. case 1:
  6309. activeCard = this.refs['singleTable_1'];
  6310. break;
  6311. case 2:
  6312. activeCard = this.refs['mainDetailTable_1'];
  6313. break;
  6314. case 3:
  6315. // activeCard =
  6316. break;
  6317. case 4:
  6318. activeCard = this.refs['cardForm_1'];
  6319. break;
  6320. }
  6321. }
  6322. else {
  6323. activeCard = this.refs['templateSelection'];
  6324. }
  6325. }
  6326. else if (reference === "confirmResult") {
  6327. if (!isNext) {
  6328. activeCard = this.refs[this.prevCard];
  6329. }
  6330. }
  6331. else {
  6332. var name = reference.split('_')[0];
  6333. var idx = parseInt(reference.split('_')[1], 10);
  6334. if (isNext) {
  6335. if (isEnd) {
  6336. activeCard = this.refs['confirmResult'];
  6337. }
  6338. else {
  6339. idx += 1;
  6340. }
  6341. }
  6342. else {
  6343. idx -= 1;
  6344. }
  6345. if (idx <= 0) {
  6346. activeCard = this.refs['moduleName'];
  6347. }
  6348. else if (!activeCard) {
  6349. activeCard = this.refs[name + "_" + idx];
  6350. }
  6351. }
  6352. // 按钮状态
  6353. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  6354. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  6355. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  6356. // 设置下一页显示
  6357. if (activeCard) {
  6358. var optCancel = { cancel: false };
  6359. // 发出 cardLevel 事件
  6360. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  6361. if (isCancelable && optCancel.cancel) {
  6362. // 取消了
  6363. return;
  6364. }
  6365. layout.setActiveItem(activeCard);
  6366. this.viewModel.set('title', layout.activeItem.vtitle);
  6367. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  6368. }
  6369. };
  6370. // 立刻执行
  6371. CreateModule.prototype.finish = function (sender) {
  6372. var _this = this;
  6373. var parent = sender.up('window');
  6374. var editor = this.refs.jsoneditor;
  6375. var data = JSON.parse(editor.getCode());
  6376. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6377. var moduleType = this.viewModel.get("moduleType");
  6378. if (moduleType === 1) {
  6379. this.setLoading(true);
  6380. generateCode(data).then(function (code) {
  6381. console.log("===> ", code);
  6382. _this.setLoading(true);
  6383. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  6384. .then(function () {
  6385. msg("创建成功!");
  6386. parent.close();
  6387. handles$1.fileTree.reload();
  6388. }).finally(function () { return _this.setLoading(false); });
  6389. }).finally(function () { return _this.setLoading(false); });
  6390. }
  6391. };
  6392. return CreateModule;
  6393. }(Scope));
  6394. //# sourceMappingURL=CreateModule.js.map
  6395. function getModuleId(path) {
  6396. var separator = "/";
  6397. var sps = path.split(separator);
  6398. var joinSps = sps.join('$');
  6399. if (!joinSps) {
  6400. return "ROOT";
  6401. }
  6402. return joinSps;
  6403. }
  6404. /**
  6405. * Module数据转换成Tree数据
  6406. */
  6407. function modulesToTreeData(modules) {
  6408. var separator = "/";
  6409. var treeNodeMap = new Map();
  6410. var root = {
  6411. type: "Dir",
  6412. path: "",
  6413. expanded: true,
  6414. leaf: false,
  6415. children: [],
  6416. };
  6417. root.id = getModuleId(root.path);
  6418. treeNodeMap.set(root.path, root);
  6419. modules.forEach(function (module) {
  6420. var _a;
  6421. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  6422. if (paths.length <= 0)
  6423. return;
  6424. var path = [];
  6425. var parent = root;
  6426. paths.forEach(function (dirName, idx) {
  6427. var parentPath = path.join(separator);
  6428. parent = treeNodeMap.get(parentPath);
  6429. path.push(dirName);
  6430. var currentPath = path.join(separator);
  6431. var child = treeNodeMap.get(currentPath);
  6432. if (child == null) {
  6433. // 获取当前path 绝对路径
  6434. var indexLength = module.absolutePath.indexOf(currentPath);
  6435. var currentAbsolutePath = "";
  6436. if (indexLength > 0) {
  6437. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  6438. }
  6439. child = {
  6440. type: "Dir",
  6441. path: currentPath,
  6442. absolutePath: currentAbsolutePath,
  6443. leaf: false,
  6444. children: [],
  6445. text: dirName
  6446. };
  6447. child.id = getModuleId(child.path);
  6448. parent.children.push(child);
  6449. treeNodeMap.set(child.path, child);
  6450. }
  6451. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  6452. var leaf = {
  6453. type: "Module",
  6454. path: module.path + separator + module.name,
  6455. absolutePath: module.absolutePath,
  6456. leaf: true,
  6457. text: module.name,
  6458. module: module,
  6459. };
  6460. leaf.id = getModuleId(leaf.path);
  6461. child.children.push(leaf);
  6462. treeNodeMap.set(leaf.path, leaf);
  6463. }
  6464. });
  6465. });
  6466. // 排序处理
  6467. treeNodeMap.forEach(function (module) {
  6468. if (module.children) {
  6469. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  6470. module.children.length = 0;
  6471. children.forEach(function (item) { return module.children.push(item); });
  6472. }
  6473. });
  6474. return root;
  6475. }
  6476. function showDialog(sender, option) {
  6477. var _a, _b;
  6478. var win = new Ext.Window({
  6479. autoDestroy: true,
  6480. title: option.title,
  6481. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  6482. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  6483. resizable: false,
  6484. closable: true,
  6485. modal: true,
  6486. maximizable: false,
  6487. minimizable: false,
  6488. // constrainHeader: true,
  6489. constrain: true,
  6490. layout: 'fit',
  6491. animateTarget: sender,
  6492. buttonAlign: 'center',
  6493. items: [
  6494. {
  6495. xtype: "form",
  6496. layout: "hbox",
  6497. margin: '10px 20px',
  6498. border: 0,
  6499. items: option.items
  6500. }
  6501. ],
  6502. //窗口按钮
  6503. fbar: [
  6504. {
  6505. xtype: 'button', text: '保存', handler: function (btn) {
  6506. //窗口获取表单
  6507. var form = win.down('form');
  6508. var vaildSuccess = form.isValid();
  6509. if (!vaildSuccess) {
  6510. return;
  6511. }
  6512. option.submitFunc(form);
  6513. }
  6514. },
  6515. {
  6516. xtype: 'button', text: '取消', handler: function (btn) {
  6517. //窗口关闭
  6518. btn.up('window').close();
  6519. }
  6520. }
  6521. ],
  6522. });
  6523. win.show();
  6524. }
  6525. function showCreateFolderWin(sender, parentPath) {
  6526. showDialog(sender, {
  6527. title: '新建文件夹',
  6528. height: 150,
  6529. items: [
  6530. {
  6531. xtype: "textfield",
  6532. name: "filename",
  6533. fieldLabel: "文件夹名称",
  6534. allowBlank: false,
  6535. selectOnFocus: true,
  6536. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  6537. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  6538. labelWidth: 80,
  6539. width: "100%",
  6540. listeners: {
  6541. afterrender: function (sender) {
  6542. _$2.defer(function () {
  6543. sender.focus();
  6544. });
  6545. }
  6546. }
  6547. },
  6548. ],
  6549. submitFunc: function (form) {
  6550. var filename = form.down('textfield[name="filename"]').getValue();
  6551. createFolder(parentPath, filename).then(function (res) {
  6552. if (res.success) {
  6553. msg$1('创建成功');
  6554. handles$1.fileTree.reload();
  6555. form.up('window').close();
  6556. }
  6557. else {
  6558. showErrorDialog$1(res.msg);
  6559. }
  6560. }).catch(function (e) {
  6561. showErrorDialog$1(e.responseJSON.msg);
  6562. });
  6563. }
  6564. });
  6565. }
  6566. function showCreateModuleCrudWin(sender, path, absolutePath) {
  6567. var dlg = new CreateModule();
  6568. dlg.showDialog(sender, {}, {
  6569. data: {
  6570. packagePath: path,
  6571. fileSavePath: absolutePath,
  6572. }
  6573. });
  6574. }
  6575. function registerModule$1(sender, path, name, icon) {
  6576. // 前缀 com/galaxis/wms 写死了
  6577. var dlg = new RegisterModule();
  6578. dlg.showDialog(sender, {}, {
  6579. data: {
  6580. form: {
  6581. scope_url: path.replace("com/galaxis/wms", "."),
  6582. resource_name: name,
  6583. resource_icon: icon,
  6584. }
  6585. }
  6586. });
  6587. }
  6588. function showCreateEmptyModule(sender, path) {
  6589. var win = new Ext.Window({
  6590. autoDestroy: true,
  6591. title: "新建空模块",
  6592. width: 400,
  6593. height: 150,
  6594. resizable: true,
  6595. closable: true,
  6596. maximizable: true,
  6597. minimizable: true,
  6598. plain: true,
  6599. // constrainHeader: true,
  6600. constrain: true,
  6601. layout: 'fit',
  6602. animateTarget: sender,
  6603. buttonAlign: 'center',
  6604. items: [
  6605. {
  6606. xtype: "form",
  6607. layout: "hbox",
  6608. margin: '10px 20px',
  6609. border: 0,
  6610. items: [
  6611. {
  6612. flex: 1,
  6613. layout: 'vbox',
  6614. items: [
  6615. {
  6616. xtype: "textfield",
  6617. name: "filename",
  6618. fieldLabel: "模块名",
  6619. flex: 1,
  6620. allowBlank: false,
  6621. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  6622. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  6623. labelWidth: 50,
  6624. width: "100%",
  6625. },
  6626. ]
  6627. },
  6628. ]
  6629. }
  6630. ],
  6631. //窗口按钮
  6632. buttons: [
  6633. {
  6634. xtype: 'button', text: '保存', handler: function (btn) {
  6635. //窗口获取表单
  6636. var form = win.down('form');
  6637. var vaildSuccess = form.isValid();
  6638. if (!vaildSuccess) {
  6639. return;
  6640. }
  6641. var filename = form.down('textfield[name="filename"]').getValue();
  6642. createEmptyModule(path, filename).then(function (res) {
  6643. if (res.success) {
  6644. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  6645. handles$1.fileTree.reload();
  6646. win.close();
  6647. }
  6648. else {
  6649. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  6650. }
  6651. }).catch(function (e) {
  6652. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  6653. });
  6654. }
  6655. },
  6656. {
  6657. xtype: 'button', text: '取消', handler: function (btn) {
  6658. //窗口关闭
  6659. win.close();
  6660. }
  6661. }
  6662. ]
  6663. });
  6664. win.show();
  6665. }
  6666. //# sourceMappingURL=FileHelp.js.map
  6667. function initFileTree () {
  6668. Ext.define('com.yvan.studio.FileTree', {
  6669. extend: 'com.yvan.studio.StateTree',
  6670. xtype: 'filetree',
  6671. tooltip: '文件',
  6672. iconCls: 'x-fa fa-file',
  6673. rootVisible: false,
  6674. useArrows: true,
  6675. colspan: 2,
  6676. lines: true,
  6677. reference: 'filetree',
  6678. multiSelect: true,
  6679. getStateFilename: function () {
  6680. return getCurrentProject().uuid + "/filetree.json";
  6681. },
  6682. openNode: function () {
  6683. var selection = this.getSelection();
  6684. var _a = __read(selection, 1), record = _a[0];
  6685. if (!record) {
  6686. return;
  6687. }
  6688. var raw = record.raw;
  6689. if (raw.type === 'Dir') {
  6690. return;
  6691. }
  6692. if (raw.type === "Module" && raw.module) {
  6693. eventBus.publish(EventType.ModuleOpen, raw);
  6694. }
  6695. },
  6696. openInIdea: function () {
  6697. var _a = __read(this.getSelection(), 1), record = _a[0];
  6698. if (record) {
  6699. var data = record.data;
  6700. if (data.type === "Module") {
  6701. if (data.module.groovyFile && data.module.groovyFile.exists) {
  6702. native.openInIdea(data.module.groovyFile.absolutePath);
  6703. }
  6704. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  6705. native.openInIdea(data.module.jsControllerFile.absolutePath);
  6706. }
  6707. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  6708. native.openInIdea(data.module.jsViewFile.absolutePath);
  6709. }
  6710. return;
  6711. }
  6712. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  6713. }
  6714. },
  6715. deleteSelection: function () {
  6716. var selection = this.getSelection();
  6717. var pathList = [];
  6718. _.forEach(selection, function (item) {
  6719. if (item.data.type === "Dir") {
  6720. pathList.push({ path: item.data.path, isFolder: true });
  6721. }
  6722. else {
  6723. pathList.push({ path: item.data.path, isFolder: false });
  6724. }
  6725. });
  6726. {
  6727. return;
  6728. }
  6729. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  6730. //
  6731. // Ext.Msg.confirm('提示', title, (btn) => {
  6732. // if (btn === 'yes') {
  6733. // deleteFileOrFolder(raw.path, title, true)
  6734. // }
  6735. // })
  6736. // const title = '您确定要删除(' + raw.path + ')吗?'
  6737. // deleteFileOrFolder(raw.path, title, false)
  6738. },
  6739. listeners: {
  6740. itemverify: function () {
  6741. this.openNode();
  6742. },
  6743. afterrender: function (me) {
  6744. console.log('filetree_afterrender', 'reloadIfNeed');
  6745. moduleStore.registe(me.subscribeModule.bind(this));
  6746. moduleStore.reloadIfNeed("PC");
  6747. },
  6748. destroy: function (me) {
  6749. console.log('filetree_destroy');
  6750. moduleStore.unregiste(me.subscribeModule.bind(this));
  6751. },
  6752. itemcontextmenu: function (sender, node, element, idx, e) {
  6753. e.preventDefault();
  6754. var raw = node.raw;
  6755. var option = {};
  6756. if (raw.type === 'Dir') {
  6757. // 文件夹右键
  6758. option = {
  6759. shadow: 'frame', allowOtherMenus: true,
  6760. items: [
  6761. {
  6762. text: '新建空模块',
  6763. iconCls: 'x-fa fa-plus-circle',
  6764. handler: function (sender) {
  6765. showCreateEmptyModule(sender, raw.path);
  6766. }
  6767. },
  6768. {
  6769. text: '新建模块',
  6770. iconCls: 'x-fa fa-plus-circle',
  6771. handler: function (sender) {
  6772. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  6773. }
  6774. },
  6775. '-',
  6776. {
  6777. text: '新建文件夹',
  6778. iconCls: 'x-fa fa-folder-o',
  6779. handler: function (sender) {
  6780. var parentPath = raw.path;
  6781. showCreateFolderWin(sender, parentPath);
  6782. }
  6783. },
  6784. {
  6785. text: '复制路径',
  6786. iconCls: 'x-fa fa-external-link',
  6787. handler: function (sender) {
  6788. native.clipboardSet(raw.path);
  6789. }
  6790. },
  6791. ]
  6792. };
  6793. }
  6794. else {
  6795. // 文件右键
  6796. option = {
  6797. shadow: 'frame', allowOtherMenus: true,
  6798. items: [
  6799. // {
  6800. // text: '重命名',
  6801. // iconCls: 'x-fa fa-terminal',
  6802. // handler(sender) {
  6803. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  6804. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  6805. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  6806. // }
  6807. // },
  6808. // {
  6809. // text: '另存为',
  6810. // iconCls: 'x-fa fa-exchange',
  6811. // handler(sender) {
  6812. // console.error('没做')
  6813. // }
  6814. // },
  6815. {
  6816. text: '复制路径',
  6817. iconCls: 'x-fa fa-external-link',
  6818. handler: function (sender) {
  6819. native.clipboardSet(raw.path);
  6820. }
  6821. },
  6822. '-',
  6823. {
  6824. text: '注册模块',
  6825. iconCls: 'x-fa fa-sign-in',
  6826. handler: function (sender) {
  6827. registerModule$1(sender, raw.path);
  6828. }
  6829. },
  6830. ]
  6831. };
  6832. }
  6833. var treeMenu = new Ext.menu.Menu(option);
  6834. treeMenu.showAt(e.getXY());
  6835. },
  6836. },
  6837. tbar: [
  6838. {
  6839. xtype: 'button',
  6840. iconCls: 'x-fa fa-crosshairs',
  6841. tooltip: '选中当前打开的文件',
  6842. handler: function (sender) {
  6843. msg$1('没做');
  6844. }
  6845. },
  6846. {
  6847. xtype: 'button',
  6848. iconCls: 'x-fa fa-link',
  6849. tooltip: '在IDEA中打开',
  6850. handler: function (sender) {
  6851. var scope = sender.up("filetree");
  6852. scope.openInIdea();
  6853. }
  6854. },
  6855. {
  6856. xtype: 'button',
  6857. iconCls: 'x-fa fa-refresh',
  6858. tooltip: '刷新',
  6859. handler: function (sender) {
  6860. var scope = sender.up("filetree");
  6861. scope.reload();
  6862. }
  6863. },
  6864. {
  6865. xtype: 'button',
  6866. iconCls: 'x-fa fa-percent',
  6867. tooltip: '监控',
  6868. handler: function (sender) {
  6869. // handles.mainWindow.showPerform()
  6870. }
  6871. },
  6872. ],
  6873. initComponent: function () {
  6874. setFileTree(this);
  6875. this.superclass.initComponent.apply(this, arguments);
  6876. // super.initComponent.apply(this, arguments)
  6877. },
  6878. subscribeModule: function (res) {
  6879. if (typeof res === 'object') {
  6880. var rootNode = modulesToTreeData(res.data);
  6881. this.setRootNode(rootNode);
  6882. this.restoreState();
  6883. handles$1.mainWindow.modules = res.data;
  6884. }
  6885. else if (typeof res === 'boolean') {
  6886. this.setLoading(res);
  6887. }
  6888. },
  6889. reload: function () {
  6890. console.log('filetree_reloadForce');
  6891. moduleStore.reloadForce("PC").then(function (res) {
  6892. });
  6893. }
  6894. });
  6895. }
  6896. //# sourceMappingURL=FileTree.js.map
  6897. function initDbTree () {
  6898. var define = {
  6899. extend: 'com.yvan.studio.StateTree',
  6900. xtype: 'dbtree',
  6901. tooltip: '数据库',
  6902. iconCls: 'x-fa fa-database',
  6903. rootVisible: false,
  6904. useArrows: true,
  6905. reference: 'dbtree',
  6906. multiSelect: true,
  6907. getStateFilename: function () {
  6908. return getCurrentProject().uuid + "/dbtree.json";
  6909. },
  6910. tbar: [
  6911. {
  6912. xtype: 'button',
  6913. iconCls: 'x-fa fa-crosshairs',
  6914. tooltip: '选中当前打开的表',
  6915. handler: function (sender) {
  6916. var _a;
  6917. // 获取当前选中的活动标签 tableColumn_bas_car
  6918. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  6919. if (!locatPath) {
  6920. return;
  6921. }
  6922. handles$1.dbTree.selectPath(locatPath);
  6923. }
  6924. },
  6925. {
  6926. xtype: 'button',
  6927. iconCls: 'x-fa fa-refresh',
  6928. tooltip: '刷新',
  6929. handler: function (sender) {
  6930. handles$1.dbTree.reload();
  6931. }
  6932. },
  6933. {
  6934. xtype: 'button',
  6935. iconCls: 'x-fa fa-cloud-download',
  6936. tooltip: '重新拉取生成元数据(耗时很长!)',
  6937. handler: function (sender) {
  6938. handles$1.dbTree.dbToMetaAndReload(sender);
  6939. }
  6940. },
  6941. // {
  6942. // xtype: 'button',
  6943. // iconCls: 'x-fa fa-files-o',
  6944. // tooltip: '数据同步',
  6945. // handler(sender) {
  6946. //
  6947. // }
  6948. // },
  6949. {
  6950. xtype: 'button',
  6951. iconCls: 'x-fa fa-exchange',
  6952. tooltip: '数据结构同步',
  6953. handler: function (sender) {
  6954. // handles.mainWindow.showDataSync(sender)
  6955. }
  6956. },
  6957. {
  6958. xtype: 'button',
  6959. iconCls: 'x-fa fa-window-maximize',
  6960. tooltip: 'SQL查询分析器',
  6961. handler: function (sender) {
  6962. // handles.mainWindow.showDbCodeTemplate(sender)
  6963. }
  6964. },
  6965. {
  6966. xtype: 'button',
  6967. iconCls: 'x-fa fa-cubes',
  6968. tooltip: '数据域管理',
  6969. handler: function (sender) {
  6970. // handles.mainWindow.showColumnDomain()
  6971. }
  6972. },
  6973. {
  6974. xtype: 'button',
  6975. iconCls: 'x-fa fa-edit',
  6976. tooltip: '修改结构',
  6977. handler: function (sender) {
  6978. var tree = sender.up("treepanel");
  6979. var selection = tree.getSelection();
  6980. var _a = __read(selection, 1), node = _a[0];
  6981. if (!node) {
  6982. msg$1('请选择一个表');
  6983. return;
  6984. }
  6985. var raw = node.data.raw;
  6986. if (node.get('type') === 'table') ;
  6987. else if (node.get('type') === 'column') ;
  6988. }
  6989. },
  6990. ],
  6991. listeners: {
  6992. afterrender: function (me) {
  6993. setDbTree(this);
  6994. // 找管理器订阅刷新的事件
  6995. instance.registe(this.refreshData.bind(this));
  6996. instance.reloadIfNeed(undefined);
  6997. },
  6998. destory: function (me) {
  6999. setDbTree(undefined);
  7000. instance.unregiste(this.refreshData.bind(this));
  7001. },
  7002. itemcontextmenu: function (sender, node, element, idx, e) {
  7003. var _this = this;
  7004. e.preventDefault();
  7005. var option = {};
  7006. var raw = node.raw.raw;
  7007. if (node.get('type') === 'column') {
  7008. option = {
  7009. shadow: 'frame', allowOtherMenus: true,
  7010. items: [
  7011. {
  7012. text: '设计结构',
  7013. iconCls: 'x-fa fa-edit',
  7014. handler: function (sender) {
  7015. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  7016. }
  7017. },
  7018. ]
  7019. };
  7020. }
  7021. else if (node.get('type') === 'table') {
  7022. option = {
  7023. shadow: 'frame', allowOtherMenus: true,
  7024. items: [
  7025. {
  7026. text: '新建',
  7027. iconCls: 'x-fa fa-plus',
  7028. handler: function (sender) {
  7029. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  7030. }
  7031. },
  7032. {
  7033. text: '设计结构',
  7034. iconCls: 'x-fa fa-edit',
  7035. handler: function (sender) {
  7036. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  7037. }
  7038. },
  7039. {
  7040. text: '重命名',
  7041. iconCls: 'x-fa fa-pencil',
  7042. handler: function (sender) {
  7043. _this.renameTable(sender, node.data.raw);
  7044. }
  7045. },
  7046. '-',
  7047. {
  7048. text: '删除',
  7049. iconCls: 'x-fa fa-minus',
  7050. handler: function (sender) {
  7051. _this.removeTable(sender, node.data.raw);
  7052. }
  7053. },
  7054. ]
  7055. };
  7056. }
  7057. var treeMenu = new Ext.menu.Menu(option);
  7058. treeMenu.showAt(e.getXY());
  7059. }
  7060. },
  7061. // DbTreeStore 刷新时,会回调到这个方法
  7062. refreshData: function (isLoadingState) {
  7063. var me = this;
  7064. if (typeof isLoadingState === 'boolean') {
  7065. me.setLoading(isLoadingState);
  7066. return;
  7067. }
  7068. var rootNode = getDbTree(instance.apiResponse);
  7069. me.setRootNode(rootNode);
  7070. this.restoreState();
  7071. },
  7072. renameTable: function (sender, tableRow) {
  7073. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  7074. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  7075. if (!res.data)
  7076. return;
  7077. var window = Ext.create('Ext.window.Window', {
  7078. title: 'SQL 预览',
  7079. height: 400,
  7080. width: 600,
  7081. modal: true,
  7082. animateTarget: sender,
  7083. maximizable: true,
  7084. layout: 'fit',
  7085. items: {
  7086. xtype: 'sqleditor',
  7087. value: res.data,
  7088. },
  7089. buttons: [
  7090. {
  7091. xtype: 'button',
  7092. text: '执行',
  7093. iconCls: 'x-fa fa-save',
  7094. handler: function (sender) {
  7095. var editor = sender.up('window').down('sqleditor');
  7096. var ddl = editor.getValue();
  7097. window.setLoading(true);
  7098. instance.pushToDbCommit({
  7099. schema_name: tableRow.schema_name,
  7100. table_name: name,
  7101. old_table_name: tableRow.table_name,
  7102. ddl: ddl,
  7103. }).then(function () {
  7104. handles$1.dbTree.reload();
  7105. window.close();
  7106. }).finally(function () { return window.setLoading(false); });
  7107. },
  7108. },
  7109. {
  7110. xtype: 'button',
  7111. text: '取消',
  7112. iconCls: 'x-fa fa-times',
  7113. handler: function () {
  7114. window.close();
  7115. }
  7116. },
  7117. ]
  7118. }).show();
  7119. });
  7120. });
  7121. },
  7122. removeTable: function (sender, tableRow) {
  7123. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  7124. if (!res.data)
  7125. return;
  7126. var window = Ext.create('Ext.window.Window', {
  7127. title: 'SQL 预览',
  7128. height: 400,
  7129. width: 600,
  7130. modal: true,
  7131. animateTarget: sender,
  7132. maximizable: true,
  7133. layout: 'fit',
  7134. items: {
  7135. xtype: 'sqleditor',
  7136. value: res.data,
  7137. },
  7138. buttons: [
  7139. {
  7140. xtype: 'button',
  7141. text: '执行',
  7142. iconCls: 'x-fa fa-save',
  7143. handler: function (sender) {
  7144. var editor = sender.up('window').down('sqleditor');
  7145. var ddl = editor.getValue();
  7146. window.setLoading(true);
  7147. instance.pushToDbCommit({
  7148. schema_name: tableRow.schema_name,
  7149. table_name: tableRow.table_name,
  7150. ddl: ddl
  7151. })
  7152. .then(function () {
  7153. handles$1.dbTree.reload();
  7154. window.close();
  7155. }).finally(function () { return window.setLoading(false); });
  7156. }
  7157. },
  7158. {
  7159. xtype: 'button',
  7160. text: '取消',
  7161. iconCls: 'x-fa fa-times',
  7162. handler: function () {
  7163. window.close();
  7164. }
  7165. }
  7166. ]
  7167. }).show();
  7168. });
  7169. },
  7170. // hideHeaders: true,
  7171. // columns: [
  7172. // {
  7173. // xtype: 'treecolumn',
  7174. // text: '名称',
  7175. // dataIndex: 'text',
  7176. // flex: 2,
  7177. // }, {
  7178. // text: '描述',
  7179. // dataIndex: 'comment',
  7180. // flex: 1,
  7181. // }
  7182. // ],
  7183. reload: function () {
  7184. // 强制刷新 DbManager
  7185. instance.reloadForce(undefined);
  7186. },
  7187. dbToMetaAndReload: function () {
  7188. // 从数据库结构重新生成元数据
  7189. instance.dbToMetaAndReload();
  7190. }
  7191. };
  7192. Ext.define('com.yvan.studio.DbTree', define);
  7193. }
  7194. /**
  7195. * 将数据构建成 dbTree 需要的格式
  7196. */
  7197. function getDbTree(apiResponse) {
  7198. var rootNode = {
  7199. children: [],
  7200. expanded: true,
  7201. id: "ROOT",
  7202. leaf: false,
  7203. };
  7204. _$2.forEach(apiResponse, function (schemaRow) {
  7205. var schemaNode = {
  7206. id: 'schema$' + schemaRow.schema_name,
  7207. type: "schema",
  7208. expanded: true,
  7209. leaf: false,
  7210. iconCls: 'x-fa fa-th-large ',
  7211. text: schemaRow.schema_name,
  7212. raw: __assign({}, schemaRow),
  7213. children: [],
  7214. };
  7215. delete schemaNode.raw.table_list;
  7216. rootNode.children.push(schemaNode);
  7217. _$2.forEach(schemaRow.table_list, function (tableRow) {
  7218. var _a;
  7219. var tableNode = {
  7220. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  7221. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  7222. comment: tableRow.description,
  7223. type: "table",
  7224. iconCls: 'x-fa fa-table',
  7225. expanded: false,
  7226. leaf: false,
  7227. children: [],
  7228. raw: __assign({}, tableRow)
  7229. };
  7230. delete tableNode.raw.column_list;
  7231. schemaNode.children.push(tableNode);
  7232. _$2.forEach(tableRow.column_list, function (columnRow) {
  7233. var _a;
  7234. var iconCls = 'x-fa fa-square-o';
  7235. if (columnRow.is_primary_key) {
  7236. iconCls = 'x-fa fa-key';
  7237. }
  7238. else if (columnRow.not_null) {
  7239. iconCls = 'x-fa fa-check-square';
  7240. }
  7241. var columnNode = {
  7242. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  7243. type: "column",
  7244. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  7245. comment: columnRow.column_comment,
  7246. leaf: true,
  7247. iconCls: iconCls,
  7248. raw: __assign({}, columnRow)
  7249. };
  7250. tableNode.children.push(columnNode);
  7251. }); // column
  7252. }); // table
  7253. }); // schema
  7254. return rootNode;
  7255. }
  7256. //# sourceMappingURL=DbTree.js.map
  7257. var ReportGridController = /** @class */ (function () {
  7258. function ReportGridController() {
  7259. }
  7260. ReportGridController.prototype.onLoad = function (sender) {
  7261. this.reload();
  7262. setReport(this);
  7263. };
  7264. ReportGridController.prototype.showSingle = function (sender) {
  7265. var _this = this;
  7266. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7267. if (record) {
  7268. handles.mainWindow.showFormSingle(record.data, function () {
  7269. _this.reload();
  7270. });
  7271. }
  7272. };
  7273. ReportGridController.prototype.filterChanged = function (sender, value) {
  7274. console.log('filterChange', sender, value);
  7275. this.view.store.clearFilter();
  7276. if (value) {
  7277. this.view.store.filterBy(function (record) {
  7278. var code = _.lowerCase(record.get('report_name'));
  7279. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  7280. return (code.includes(value) ||
  7281. dict_desc_py.includes(value));
  7282. });
  7283. }
  7284. };
  7285. ReportGridController.prototype.onClearClick = function () {
  7286. var _a, _b;
  7287. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  7288. };
  7289. ReportGridController.prototype.reload = function () {
  7290. var me = this;
  7291. me.getView().setLoading(true);
  7292. reportListApi().then(function (res) {
  7293. _.forEach(res.data, function (r) {
  7294. r.report_enable = r.report_enable === 1;
  7295. });
  7296. me.getView().setStore(new Ext.data.Store({
  7297. fields: ['report_id', 'report_name', 'report_enable'],
  7298. data: res.data,
  7299. }));
  7300. }).finally(function () {
  7301. me.getView().setLoading(false);
  7302. });
  7303. };
  7304. ReportGridController.prototype.reportAdd = function () {
  7305. var _this = this;
  7306. prompt$2('请输入报表名称').then(function (name) {
  7307. createReportApi(name).then(function (res) {
  7308. if (res.success) {
  7309. msg$1('添加成功');
  7310. handles.mainWindow.showReport(res.data, name, function () {
  7311. _this.reload();
  7312. });
  7313. }
  7314. _this.reload();
  7315. });
  7316. });
  7317. };
  7318. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  7319. e.preventDefault();
  7320. var me = sender.up('grid').ownerGrid.getController();
  7321. var option = {
  7322. shadow: 'frame', allowOtherMenus: true,
  7323. items: [
  7324. {
  7325. text: '添加',
  7326. iconCls: 'x-fa fa-plus-circle',
  7327. handler: function (sender) {
  7328. me.reportAdd();
  7329. }
  7330. },
  7331. {
  7332. text: '编辑',
  7333. iconCls: 'x-fa fa-edit',
  7334. handler: function (sender) {
  7335. me.reportEdit();
  7336. }
  7337. },
  7338. {
  7339. text: '删除',
  7340. iconCls: 'x-fa fa-minus-circle',
  7341. handler: function (sender) {
  7342. me.reportRemove();
  7343. }
  7344. },
  7345. '-',
  7346. {
  7347. text: '注册(至菜单)',
  7348. iconCls: 'x-fa fa-sign-in',
  7349. handler: function (sender) {
  7350. me.reportRegiste(sender);
  7351. }
  7352. },
  7353. {
  7354. text: '卸载',
  7355. iconCls: 'x-fa fa-sign-out',
  7356. handler: function (sender) {
  7357. console.error('没做');
  7358. }
  7359. },
  7360. ]
  7361. };
  7362. var treeMenu = new Ext.menu.Menu(option);
  7363. treeMenu.showAt(e.getXY());
  7364. };
  7365. ReportGridController.prototype.reportRegiste = function (sender) {
  7366. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7367. if (record) {
  7368. var reportName = record.get('report_name');
  7369. var reportId = record.get('report_id');
  7370. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  7371. }
  7372. };
  7373. ReportGridController.prototype.reportRemove = function () {
  7374. var _this = this;
  7375. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7376. if (record) {
  7377. var reportName = record.get('report_name');
  7378. var reportId_1 = record.get('report_id');
  7379. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  7380. delReportApi(reportId_1).then(function (res) {
  7381. if (res.success) {
  7382. msg$1('删除成功');
  7383. _this.reload();
  7384. }
  7385. });
  7386. });
  7387. }
  7388. };
  7389. ReportGridController.prototype.reportEdit = function () {
  7390. var _this = this;
  7391. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7392. if (record) {
  7393. var reportName = record.get('report_name');
  7394. var reportId = record.get('report_id');
  7395. handles.mainWindow.showReport(reportId, reportName, function () {
  7396. _this.reload();
  7397. });
  7398. }
  7399. };
  7400. ReportGridController.prototype.onDblClick = function (sender) {
  7401. this.reportEdit();
  7402. };
  7403. return ReportGridController;
  7404. }());
  7405. //# sourceMappingURL=ReportGridController.js.map
  7406. function initReportGrid () {
  7407. var controller = new ReportGridController();
  7408. Ext.define('com.yvan.studio.ReportGrid', {
  7409. extend: 'Ext.grid.Panel',
  7410. xtype: 'reportGrid',
  7411. controller: controller,
  7412. scope: controller,
  7413. referenceHolder: true,
  7414. tooltip: '查询报表',
  7415. iconCls: 'x-fa fa-bar-chart',
  7416. useArrows: true,
  7417. reference: 'reportgrid',
  7418. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  7419. listeners: {
  7420. itemdblclick: 'onDblClick',
  7421. afterrender: 'onLoad',
  7422. },
  7423. viewConfig: {
  7424. enableTextSelection: true,
  7425. listeners: {
  7426. itemcontextmenu: 'onGridContextMenu',
  7427. },
  7428. },
  7429. tbar: {
  7430. xtype: 'toolbar',
  7431. items: [
  7432. {
  7433. xtype: 'button',
  7434. tooltip: '测试',
  7435. iconCls: 'x-fa fa-bars',
  7436. listeners: {
  7437. click: 'showSingle'
  7438. }
  7439. },
  7440. {
  7441. xtype: 'button',
  7442. tooltip: '刷新',
  7443. iconCls: 'x-fa fa-refresh',
  7444. listeners: {
  7445. click: 'reload'
  7446. }
  7447. },
  7448. {
  7449. xtype: 'button',
  7450. tooltip: '添加',
  7451. iconCls: 'x-fa fa-plus-circle',
  7452. listeners: {
  7453. click: 'reportAdd'
  7454. }
  7455. },
  7456. {
  7457. xtype: 'button',
  7458. tooltip: '删除',
  7459. iconCls: 'x-fa fa-minus-circle',
  7460. listeners: {
  7461. click: 'reportRemove'
  7462. }
  7463. },
  7464. {
  7465. xtype: 'textfield',
  7466. flex: 1,
  7467. reference: "txtFilter",
  7468. emptyText: '搜索过滤',
  7469. enableKeyEvents: true,
  7470. listeners: {
  7471. change: {
  7472. fn: 'filterChanged',
  7473. buffer: 50
  7474. }
  7475. }
  7476. },
  7477. ]
  7478. },
  7479. columns: [
  7480. {
  7481. text: 'ID', dataIndex: 'report_id',
  7482. hidden: true,
  7483. },
  7484. {
  7485. text: '报表名称', dataIndex: 'report_name',
  7486. flex: 1,
  7487. },
  7488. ]
  7489. });
  7490. }
  7491. //# sourceMappingURL=ReportGrid.js.map
  7492. /** 所有变量类型 */
  7493. var TypeEnum;
  7494. (function (TypeEnum) {
  7495. TypeEnum["string"] = "string";
  7496. TypeEnum["number"] = "number";
  7497. TypeEnum["object"] = "object";
  7498. TypeEnum["array"] = "array";
  7499. TypeEnum["function"] = "function";
  7500. TypeEnum["null"] = "null";
  7501. TypeEnum["boolean"] = "boolean";
  7502. TypeEnum["symbol"] = "symbol";
  7503. TypeEnum["json"] = "json";
  7504. TypeEnum["math"] = "math";
  7505. TypeEnum["regexp"] = "regexp";
  7506. TypeEnum["date"] = "date";
  7507. TypeEnum["undefined"] = "undefined";
  7508. TypeEnum["nan"] = "nan";
  7509. TypeEnum["reactNode"] = "react_node";
  7510. })(TypeEnum || (TypeEnum = {}));
  7511. /**
  7512. * 判断对象类型
  7513. * @param object 对象
  7514. */
  7515. var variableTypeOf = function (object) {
  7516. var typeStr = Object.prototype.toString.call(object);
  7517. var typeName;
  7518. switch (("" + typeStr).toLowerCase()) {
  7519. case '[object string]':
  7520. typeName = TypeEnum.string;
  7521. break;
  7522. case '[object number]':
  7523. if (Number.isNaN(object)) {
  7524. return TypeEnum.nan;
  7525. }
  7526. typeName = TypeEnum.number;
  7527. break;
  7528. case '[object object]':
  7529. if (object.$$typeof && object.props) {
  7530. var type = variableTypeOf(object.$$typeof);
  7531. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  7532. return TypeEnum.reactNode;
  7533. }
  7534. }
  7535. typeName = TypeEnum.object;
  7536. break;
  7537. case '[object array]':
  7538. typeName = TypeEnum.array;
  7539. break;
  7540. case '[object function]':
  7541. typeName = TypeEnum.function;
  7542. break;
  7543. case '[object null]':
  7544. typeName = TypeEnum.null;
  7545. break;
  7546. case '[object boolean]':
  7547. typeName = TypeEnum.boolean;
  7548. break;
  7549. case '[object date]':
  7550. typeName = TypeEnum.date;
  7551. break;
  7552. // 不常用
  7553. case '[object symbol]':
  7554. typeName = TypeEnum.symbol;
  7555. break;
  7556. case '[object json]':
  7557. typeName = TypeEnum.json;
  7558. break;
  7559. case '[object math]':
  7560. typeName = TypeEnum.math;
  7561. break;
  7562. case '[object regexp]':
  7563. typeName = TypeEnum.regexp;
  7564. break;
  7565. // 貌似不会走的分支
  7566. case '[object undefined]':
  7567. typeName = TypeEnum.undefined;
  7568. break;
  7569. // 无法识别
  7570. default:
  7571. if (object === undefined) {
  7572. return TypeEnum.undefined;
  7573. }
  7574. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  7575. typeName = TypeEnum.object;
  7576. }
  7577. return typeName;
  7578. };
  7579. //# sourceMappingURL=typeof.js.map
  7580. function initGroovyEditor () {
  7581. Ext.define('com.yvan.studio.GroovyEditor', {
  7582. extend: 'Ext.panel.Panel',
  7583. alias: 'widget.groovyeditor',
  7584. xtype: 'groovyeditor',
  7585. layout: 'fit',
  7586. border: false,
  7587. html: "<div class=\"editor\"/>",
  7588. config: {
  7589. value: ''
  7590. },
  7591. codeChange: undefined,
  7592. isChangeFromOuter: false,
  7593. getCode: function () {
  7594. if (this.editor) {
  7595. return this.editor.getValue();
  7596. }
  7597. else {
  7598. return this.code;
  7599. }
  7600. },
  7601. setCode: function (value) {
  7602. var _this = this;
  7603. this.code = value;
  7604. this.value = value;
  7605. _$2.defer(function () {
  7606. _this.isChangeFromOuter = true;
  7607. if (_this.editor) {
  7608. _this.editor.setValue(value);
  7609. }
  7610. });
  7611. },
  7612. applyPosition: function () {
  7613. var _this = this;
  7614. if (this.autoFocusMethod) {
  7615. if (this.editor) {
  7616. _$2.defer(function () {
  7617. if (_this.autoFocusStartLine) {
  7618. _this.editor.setPosition({
  7619. lineNumber: _this.autoFocusStartLine,
  7620. column: _this.autoFocusStartColumn
  7621. });
  7622. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7623. }
  7624. _this.editor.focus();
  7625. });
  7626. delete this.autoFocusMethod;
  7627. }
  7628. }
  7629. this.editor.layout();
  7630. },
  7631. getValue: function () {
  7632. return this.value;
  7633. },
  7634. setValue: function (value, fromEditor) {
  7635. var me = this;
  7636. if (me.value === value) {
  7637. // 值相等,不需要变化
  7638. return;
  7639. }
  7640. if (fromEditor !== true && me.editor) {
  7641. // 不是来源于编辑器的变化,才设置编辑器的值
  7642. me.editor.setValue(value);
  7643. }
  7644. // 通知mixins setValue
  7645. me.value = value;
  7646. me.fireEvent('change', value);
  7647. },
  7648. initComponent: function () {
  7649. var that = this;
  7650. this.superclass.initComponent.call(this, arguments);
  7651. that.on({
  7652. resize: function () {
  7653. if (that.editor) {
  7654. that.editor.layout();
  7655. }
  7656. },
  7657. destory: function () {
  7658. if (that.editor) {
  7659. that.editor.dispose();
  7660. delete that.editor;
  7661. }
  7662. },
  7663. afterrender: function (sender) {
  7664. var $dom = $(that.el.dom).find('.editor');
  7665. attach_3($dom[0], {
  7666. value: that.code
  7667. }).then(function (editor) {
  7668. that.editor = editor;
  7669. that.applyPosition();
  7670. that.editor.onDidChangeModelContent(function (e) {
  7671. that.fireEvent('change', that.editor, e);
  7672. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  7673. that.codeChange(that.editor.getValue(), that.name, e);
  7674. }
  7675. that.isChangeFromOuter = false;
  7676. });
  7677. });
  7678. }
  7679. });
  7680. }
  7681. });
  7682. }
  7683. function attach_3(element, opts) {
  7684. return new Promise(function (resolve) {
  7685. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  7686. enabled: false
  7687. } }));
  7688. editor.onKeyUp(function (e) {
  7689. // console.log(e)
  7690. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7691. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7692. }
  7693. });
  7694. resolve(editor);
  7695. });
  7696. }
  7697. //# sourceMappingURL=GroovyEditor.js.map
  7698. function initJsEditor () {
  7699. Ext.define('com.yvan.studio.JsEditor', {
  7700. extend: 'Ext.panel.Panel',
  7701. alias: 'widget.jseditor',
  7702. xtype: 'jseditor',
  7703. layout: 'fit',
  7704. border: false,
  7705. html: "<div class=\"editor\"/>",
  7706. autoFocusMethod: true,
  7707. autoFocusStartLine: 0,
  7708. autoFocusStartColumn: 0,
  7709. codeChange: undefined,
  7710. funcArr: [],
  7711. modulePage: null,
  7712. isChangeFromOuter: false,
  7713. name: "",
  7714. /**
  7715. * 设置代码
  7716. */
  7717. setCode: function (value) {
  7718. var _this = this;
  7719. this.code = value;
  7720. _$2.defer(function () {
  7721. _this.isChangeFromOuter = true;
  7722. if (_this.editor) {
  7723. _this.editor.setValue(value);
  7724. if (_this.name === "controllerEditor") {
  7725. _this.funcArr = _this.getAllFunction();
  7726. }
  7727. }
  7728. });
  7729. },
  7730. getCode: function () {
  7731. var _a;
  7732. if (!this.editor) {
  7733. return this.code;
  7734. }
  7735. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7736. },
  7737. applyPosition: function () {
  7738. var _this = this;
  7739. if (this.autoFocusMethod) {
  7740. if (this.editor) {
  7741. _$2.defer(function () {
  7742. if (_this.autoFocusStartLine) {
  7743. _this.editor.setPosition({
  7744. lineNumber: _this.autoFocusStartLine,
  7745. column: _this.autoFocusStartColumn
  7746. });
  7747. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7748. }
  7749. _this.editor.focus();
  7750. });
  7751. delete this.autoFocusMethod;
  7752. }
  7753. }
  7754. this.editor.layout();
  7755. },
  7756. initComponent: function () {
  7757. var that = this;
  7758. this.superclass.initComponent.apply(this, arguments);
  7759. this.on({
  7760. resize: function (sender, width, height) {
  7761. if (that.editor) {
  7762. that.editor.layout();
  7763. }
  7764. },
  7765. destory: function () {
  7766. if (that.editor) {
  7767. that.editor.dispose();
  7768. delete that.editor;
  7769. }
  7770. },
  7771. afterrender: function () {
  7772. var $dom = $(that.el.dom).find('.editor');
  7773. attach_1($dom[0], {
  7774. value: that.code
  7775. }).then(function (editor) {
  7776. that.editor = editor;
  7777. that.applyPosition();
  7778. that.editor.onDidChangeModelContent(function (e) {
  7779. that.fireEvent('change', that.editor, e);
  7780. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7781. that.codeChange(that.editor.getValue(), that.name, e);
  7782. }
  7783. that.isChangeFromOuter = false;
  7784. });
  7785. });
  7786. }
  7787. });
  7788. },
  7789. getAllFunction: function () {
  7790. var funcArr = [];
  7791. var ast = window['YvanUI'].recast.parse(this.code);
  7792. if (ast && ast.program && ast.program.body) {
  7793. if (Array.isArray(ast.program.body)) {
  7794. for (var i = 0; i < ast.program.body.length; i++) {
  7795. var m = ast.program.body[i];
  7796. if (m.type === "ExportDefaultDeclaration") {
  7797. if (m.declaration.type === "ClassDeclaration") {
  7798. if (m.declaration.body.type === "ClassBody") {
  7799. if (Array.isArray(m.declaration.body.body)) {
  7800. for (var j = 0; j < m.declaration.body.body.length; j++) {
  7801. var ob = m.declaration.body.body[j];
  7802. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  7803. var funcItem = { name: ob.key.name, args: [] };
  7804. if (Array.isArray(ob.value.params)) {
  7805. for (var k = 0; k < ob.value.params.length; k++) {
  7806. var p = ob.value.params[k];
  7807. funcItem.args.push(p.name);
  7808. }
  7809. }
  7810. funcArr.push(funcItem);
  7811. }
  7812. }
  7813. }
  7814. }
  7815. }
  7816. }
  7817. }
  7818. }
  7819. }
  7820. return funcArr;
  7821. }
  7822. });
  7823. }
  7824. var isInited = false;
  7825. function attach_1(element, opts) {
  7826. return new Promise(function (resolve) {
  7827. var monaco = window['monaco'];
  7828. if (!isInited) {
  7829. isInited = true;
  7830. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  7831. noSemanticValidation: true,
  7832. noSyntaxValidation: false
  7833. });
  7834. // compiler options
  7835. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  7836. target: monaco.languages.typescript.ScriptTarget.ES2016,
  7837. allowNonTsExtensions: true,
  7838. });
  7839. // extra libraries
  7840. var libSource = [
  7841. 'declare class Facts {',
  7842. ' /**',
  7843. ' * Returns the next fact',
  7844. ' */',
  7845. ' static next():string',
  7846. ' static next222():string',
  7847. '}',
  7848. "\n declare namespace WotuUI {\n export class Text {\n label: string\n }\n\n export function wrapText(n1: string): Text\n export function render(element:HTMLElement, vjson:any): void\n }\n ",
  7849. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  7850. ].join('\n');
  7851. var libUri = 'file:///index.d.ts';
  7852. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  7853. // When resolving definitions and references, the editor will try to use created models.
  7854. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  7855. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  7856. }
  7857. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  7858. resolve(editor);
  7859. });
  7860. }
  7861. //# sourceMappingURL=JsEditor.js.map
  7862. function initJsonEditor () {
  7863. Ext.define('com.yvan.studio.JsonEditor', {
  7864. extend: 'Ext.panel.Panel',
  7865. alias: 'widget.jsoneditor',
  7866. xtype: 'jsoneditor',
  7867. layout: 'fit',
  7868. border: false,
  7869. html: "<div class=\"editor\"/>",
  7870. autoFocusMethod: true,
  7871. autoFocusStartLine: 0,
  7872. autoFocusStartColumn: 0,
  7873. codeChange: undefined,
  7874. funcArr: [],
  7875. modulePage: null,
  7876. isChangeFromOuter: false,
  7877. name: "",
  7878. /**
  7879. * 设置代码
  7880. */
  7881. setCode: function (value) {
  7882. var _this = this;
  7883. this.code = value;
  7884. _$2.defer(function () {
  7885. _this.isChangeFromOuter = true;
  7886. if (_this.editor) {
  7887. _this.editor.setValue(value);
  7888. }
  7889. });
  7890. },
  7891. updateOptions: function (options) {
  7892. if (this.editor && options) {
  7893. this.editor.updateOptions(options);
  7894. }
  7895. },
  7896. setLanguage: function (lang) {
  7897. if (this.editor && lang) {
  7898. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  7899. }
  7900. },
  7901. getCode: function () {
  7902. var _a;
  7903. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7904. },
  7905. applyPosition: function () {
  7906. var _this = this;
  7907. if (this.autoFocusMethod) {
  7908. if (this.editor) {
  7909. _$2.defer(function () {
  7910. if (_this.autoFocusStartLine) {
  7911. _this.editor.setPosition({
  7912. lineNumber: _this.autoFocusStartLine,
  7913. column: _this.autoFocusStartColumn
  7914. });
  7915. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7916. }
  7917. _this.editor.focus();
  7918. });
  7919. delete this.autoFocusMethod;
  7920. }
  7921. }
  7922. this.editor.layout();
  7923. },
  7924. initComponent: function () {
  7925. var that = this;
  7926. this.superclass.initComponent.apply(this, arguments);
  7927. this.on({
  7928. resize: function (sender, width, height) {
  7929. if (that.editor) {
  7930. that.editor.layout();
  7931. }
  7932. },
  7933. destory: function () {
  7934. if (that.editor) {
  7935. that.editor.dispose();
  7936. delete that.editor;
  7937. }
  7938. },
  7939. afterrender: function (sender) {
  7940. var $dom = $(that.el.dom).find('.editor');
  7941. attach_116($dom[0], {
  7942. value: that.code
  7943. }).then(function (editor) {
  7944. that.editor = editor;
  7945. that.applyPosition();
  7946. that.editor.onDidChangeModelContent(function (e) {
  7947. that.fireEvent('change', that.editor, e);
  7948. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7949. that.codeChange(that.editor.getValue(), that.name, e);
  7950. }
  7951. that.isChangeFromOuter = false;
  7952. });
  7953. });
  7954. }
  7955. });
  7956. },
  7957. });
  7958. }
  7959. function attach_116(element, opts) {
  7960. return new Promise(function (resolve) {
  7961. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  7962. enabled: false
  7963. } }));
  7964. editor.onKeyUp(function (e) {
  7965. // console.log(e)
  7966. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7967. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7968. }
  7969. });
  7970. resolve(editor);
  7971. });
  7972. }
  7973. //# sourceMappingURL=JsonEditor.js.map
  7974. function initSqlEditor () {
  7975. Ext.define('com.yvan.studio.SqlEditor', {
  7976. extend: 'Ext.panel.Panel',
  7977. alias: 'widget.sqleditor',
  7978. xtype: 'sqleditor',
  7979. layout: 'fit',
  7980. border: false,
  7981. html: "<div class=\"editor\"/>",
  7982. config: {
  7983. value: ''
  7984. },
  7985. codeChange: undefined,
  7986. isChangeFromOuter: false,
  7987. setCode: function (value) {
  7988. var _this = this;
  7989. this.code = value;
  7990. this.value = value;
  7991. _$2.defer(function () {
  7992. _this.isChangeFromOuter = true;
  7993. if (_this.editor) {
  7994. _this.editor.setValue(value);
  7995. }
  7996. });
  7997. },
  7998. getCode: function () {
  7999. return this.getValue();
  8000. },
  8001. updateOptions: function (options) {
  8002. if (this.editor && options) {
  8003. this.editor.updateOptions(options);
  8004. }
  8005. },
  8006. getValue: function () {
  8007. if (!this.editor) {
  8008. return this.code;
  8009. }
  8010. return this.editor.getValue();
  8011. },
  8012. applyPosition: function () {
  8013. var _this = this;
  8014. if (this.autoFocusMethod) {
  8015. if (this.editor) {
  8016. _$2.defer(function () {
  8017. if (_this.autoFocusStartLine) {
  8018. _this.editor.setPosition({
  8019. lineNumber: _this.autoFocusStartLine,
  8020. column: _this.autoFocusStartColumn
  8021. });
  8022. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  8023. }
  8024. _this.editor.focus();
  8025. });
  8026. delete this.autoFocusMethod;
  8027. }
  8028. }
  8029. this.editor.layout();
  8030. },
  8031. setValue: function (value, fromEditor) {
  8032. this.setCode(value);
  8033. var me = this;
  8034. if (me.value === value) {
  8035. // 值相等,不需要变化
  8036. return;
  8037. }
  8038. if (fromEditor !== true && me.editor) {
  8039. // 不是来源于编辑器的变化,才设置编辑器的值
  8040. me.editor.setValue(value);
  8041. }
  8042. // 通知mixins setValue
  8043. me.value = value;
  8044. me.fireEvent('change', value);
  8045. },
  8046. initComponent: function () {
  8047. var that = this;
  8048. this.superclass.initComponent.call(this);
  8049. that.on({
  8050. resize: function () {
  8051. if (that.editor) {
  8052. that.editor.layout();
  8053. }
  8054. },
  8055. destory: function () {
  8056. if (that.editor) {
  8057. that.editor.dispose();
  8058. delete that.editor;
  8059. }
  8060. },
  8061. afterrender: function (sender) {
  8062. var $dom = $(that.el.dom).find('.editor');
  8063. attach_2($dom[0], {
  8064. value: that.code
  8065. }).then(function (editor) {
  8066. that.editor = editor;
  8067. that.applyPosition();
  8068. that.editor.onDidChangeModelContent(function (e) {
  8069. that.fireEvent('change', that.editor, e);
  8070. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  8071. that.codeChange(that.editor.getValue(), that.name, e);
  8072. }
  8073. that.isChangeFromOuter = false;
  8074. });
  8075. });
  8076. }
  8077. });
  8078. }
  8079. });
  8080. }
  8081. function attach_2(element, opts) {
  8082. return new Promise(function (resolve) {
  8083. var monaco = window['monaco'];
  8084. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  8085. enabled: false
  8086. } }));
  8087. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  8088. // const sql = editor.getValue()
  8089. // if (_.trim(sql).length > 0) {
  8090. // editor.setValue(format(sql, {
  8091. // indent: ' ',
  8092. // uppercase: true,
  8093. // }))
  8094. // }
  8095. msg$1('没做');
  8096. });
  8097. editor.onKeyUp(function (e) {
  8098. // console.log(e)
  8099. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8100. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8101. }
  8102. });
  8103. resolve(editor);
  8104. });
  8105. }
  8106. //# sourceMappingURL=SqlEditor.js.map
  8107. function initTemplateEditor () {
  8108. Ext.define('com.yvan.studio.TemplateEditor', {
  8109. extend: 'Ext.panel.Panel',
  8110. alias: 'widget.templateeditor',
  8111. xtype: 'templateeditor',
  8112. layout: 'fit',
  8113. border: false,
  8114. html: "<div class=\"editor\"/>",
  8115. autoFocusMethod: true,
  8116. autoFocusStartLine: 0,
  8117. autoFocusStartColumn: 0,
  8118. codeChange: undefined,
  8119. funcArr: [],
  8120. modulePage: null,
  8121. isChangeFromOuter: false,
  8122. name: "",
  8123. /**
  8124. * 设置代码
  8125. */
  8126. setCode: function (value) {
  8127. var _this = this;
  8128. this.code = value;
  8129. _$2.defer(function () {
  8130. _this.isChangeFromOuter = true;
  8131. if (_this.editor) {
  8132. _this.editor.setValue(value);
  8133. }
  8134. });
  8135. },
  8136. getCode: function () {
  8137. var _a;
  8138. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  8139. },
  8140. applyPosition: function () {
  8141. var _this = this;
  8142. if (this.autoFocusMethod) {
  8143. if (this.editor) {
  8144. _$2.defer(function () {
  8145. if (_this.autoFocusStartLine) {
  8146. _this.editor.setPosition({
  8147. lineNumber: _this.autoFocusStartLine,
  8148. column: _this.autoFocusStartColumn
  8149. });
  8150. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  8151. }
  8152. _this.editor.focus();
  8153. });
  8154. delete this.autoFocusMethod;
  8155. }
  8156. }
  8157. this.editor.layout();
  8158. },
  8159. initComponent: function () {
  8160. var that = this;
  8161. this.superclass.initComponent.apply(this, arguments);
  8162. this.on({
  8163. resize: function (sender, width, height) {
  8164. if (that.editor) {
  8165. that.editor.layout();
  8166. }
  8167. },
  8168. destory: function () {
  8169. if (that.editor) {
  8170. that.editor.dispose();
  8171. delete that.editor;
  8172. }
  8173. },
  8174. afterrender: function (sender) {
  8175. var $dom = $(that.el.dom).find('.editor');
  8176. attach_117($dom[0], {
  8177. value: that.code
  8178. }).then(function (editor) {
  8179. that.editor = editor;
  8180. that.applyPosition();
  8181. that.editor.onDidChangeModelContent(function (e) {
  8182. that.fireEvent('change', that.editor, e);
  8183. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  8184. that.codeChange(that.editor.getValue(), that.name, e);
  8185. }
  8186. that.isChangeFromOuter = false;
  8187. });
  8188. });
  8189. }
  8190. });
  8191. },
  8192. });
  8193. }
  8194. function attach_117(element, opts) {
  8195. return new Promise(function (resolve) {
  8196. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  8197. enabled: false
  8198. } }));
  8199. editor.onKeyUp(function (e) {
  8200. // console.log(e)
  8201. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8202. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8203. }
  8204. });
  8205. resolve(editor);
  8206. });
  8207. }
  8208. //# sourceMappingURL=TemplateEditor.js.map
  8209. var DictStore = /** @class */ (function (_super) {
  8210. __extends(DictStore, _super);
  8211. function DictStore() {
  8212. return _super !== null && _super.apply(this, arguments) || this;
  8213. }
  8214. DictStore.prototype.getCacheKey = function (param) {
  8215. return "dict_data.json";
  8216. };
  8217. DictStore.prototype.invokeApi = function (param) {
  8218. return getDict(param);
  8219. };
  8220. DictStore.prototype.getDicts = function () {
  8221. return this.apiResponse.data.dict;
  8222. };
  8223. DictStore.prototype.getDictCodes = function () {
  8224. return new Promise(function (resolve) {
  8225. // reloadIfNeedPromise().then(() => {
  8226. // const result = []
  8227. // _.forEach(this.getDicts(), dictRow => {
  8228. // result.push({
  8229. // id: dictRow.dict_code,
  8230. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  8231. // })
  8232. // })
  8233. // resolve(result)
  8234. // })
  8235. });
  8236. };
  8237. DictStore.prototype.saveDict = function (param) {
  8238. return saveDictApi(param);
  8239. };
  8240. DictStore.prototype.saveDictItems = function (param) {
  8241. return saveDictItemsApi(param);
  8242. };
  8243. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  8244. var results = [];
  8245. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  8246. if (dictItemRow.dict_code === dict_code) {
  8247. results.push(_$2.clone(dictItemRow));
  8248. }
  8249. });
  8250. return results;
  8251. };
  8252. return DictStore;
  8253. }(CacheStore));
  8254. var instance$1 = new DictStore();
  8255. //# sourceMappingURL=DictStore.js.map
  8256. var DictTreeController = /** @class */ (function () {
  8257. function DictTreeController() {
  8258. this._saveStateFlag = true;
  8259. }
  8260. DictTreeController.prototype.dictSave = function () {
  8261. var _this = this;
  8262. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8263. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  8264. if (err) {
  8265. // 如果有异常就不保存
  8266. return;
  8267. }
  8268. // 进行业务上的逻辑校验,比如说必填校验等等
  8269. var hasError = false;
  8270. _$2.forEach(rows, function (row, i) {
  8271. if (isEmpty(row.dict_code)) {
  8272. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  8273. hasError = true;
  8274. return false;
  8275. }
  8276. });
  8277. if (hasError) {
  8278. return;
  8279. }
  8280. // 设置当前界面为 "保存中..." 状态
  8281. this.view.setLoading(true);
  8282. instance$1.saveDict({
  8283. newRows: newRows,
  8284. modifyRows: modifyRows,
  8285. removeRecords: removeRecords,
  8286. }).then(function (res) {
  8287. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8288. msg$1(res.msg);
  8289. _this.reload();
  8290. }).finally(function () {
  8291. // 无论正常异常,关闭 "保存中..." 状态
  8292. _this.view.setLoading(false);
  8293. });
  8294. };
  8295. DictTreeController.prototype.dictItemSave = function () {
  8296. var _this = this;
  8297. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8298. var currentDictCode = undefined;
  8299. if (record) {
  8300. currentDictCode = record.get('dict_code');
  8301. }
  8302. if (!currentDictCode) {
  8303. msg$1('请选择一个字典');
  8304. return;
  8305. }
  8306. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8307. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  8308. if (err) {
  8309. // 如果有异常就不保存
  8310. return;
  8311. }
  8312. // 进行业务上的逻辑校验,比如说必填校验等等
  8313. var hasError = false;
  8314. _$2.forEach(rows, function (row, i) {
  8315. if (!row.dict_value && row.dict_value !== 0) {
  8316. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  8317. hasError = true;
  8318. return false;
  8319. }
  8320. });
  8321. if (hasError) {
  8322. return;
  8323. }
  8324. // 设置当前界面为 "保存中..." 状态
  8325. this.view.setLoading(true);
  8326. instance$1.saveDictItems({
  8327. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  8328. newRows: newRows,
  8329. modifyRows: modifyRows,
  8330. removeRecords: removeRecords,
  8331. dict_code: currentDictCode
  8332. }).then(function (res) {
  8333. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8334. msg$1(res.msg);
  8335. _this.reload();
  8336. }).finally(function () {
  8337. // 无论正常异常,关闭 "保存中..." 状态
  8338. _this.view.setLoading(false);
  8339. });
  8340. };
  8341. DictTreeController.prototype.createDictEnum = function () {
  8342. var _this = this;
  8343. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8344. var currentDictCode = undefined;
  8345. if (record) {
  8346. currentDictCode = record.get('dict_code');
  8347. }
  8348. if (!currentDictCode) {
  8349. msg$1('请选择一个字典');
  8350. return;
  8351. }
  8352. // 设置当前界面为 "保存中..." 状态
  8353. this.view.setLoading(true);
  8354. createDictEnum({ dictCode: currentDictCode })
  8355. .then(function () { return _this.reload(); })
  8356. .finally(function () { return _this.view.setLoading(false); });
  8357. };
  8358. DictTreeController.prototype.onLoad = function () {
  8359. setDictTree(this);
  8360. this.grid1 = this.view.lookupReference('grid1');
  8361. this.grid2 = this.view.lookupReference('grid2');
  8362. this.grid1.setData([]);
  8363. this.grid2.setData([]);
  8364. // this.grid1.columns[0].hide()
  8365. this.grid2.columns[0].hide();
  8366. // 找管理器订阅刷新的事件
  8367. instance$1.registe(this.refreshData.bind(this));
  8368. // 非强制性刷新 DbManager
  8369. instance$1.reloadIfNeed(undefined);
  8370. };
  8371. DictTreeController.prototype.onDestory = function () {
  8372. instance$1.unregiste(this.refreshData.bind(this));
  8373. };
  8374. // dictStore 刷新时,会回调到这个方法
  8375. DictTreeController.prototype.refreshData = function (isLoadingState) {
  8376. var me = this;
  8377. if (typeof isLoadingState === 'boolean') {
  8378. me.view.setLoading(isLoadingState);
  8379. return;
  8380. }
  8381. this.grid1.setData(instance$1.getDicts());
  8382. this.restoreState();
  8383. };
  8384. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  8385. var _this = this;
  8386. _$2.defer(function () {
  8387. _this.saveState();
  8388. });
  8389. if (!record) {
  8390. this.grid2.setData([]);
  8391. return;
  8392. }
  8393. var dict_code = record.get('dict_code');
  8394. var data = instance$1.getDictItemByDictcode(dict_code);
  8395. this.grid2.setData(data);
  8396. };
  8397. DictTreeController.prototype.reload = function () {
  8398. var _this = this;
  8399. // 强制刷新 DbManager
  8400. instance$1.reloadForce(undefined).then(function (res) {
  8401. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  8402. });
  8403. };
  8404. DictTreeController.prototype.dictAdd = function () {
  8405. this.grid1.appendEditRow({
  8406. _createFlag: true,
  8407. dict_code: '',
  8408. dict_desc: '',
  8409. }, 0);
  8410. };
  8411. DictTreeController.prototype.dictRemove = function () {
  8412. this.grid1.removeEditRow();
  8413. };
  8414. DictTreeController.prototype.dictItemAdd = function () {
  8415. var _a, _b;
  8416. var dict_code = (_b = (_a = this.grid1.selection) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.dict_code;
  8417. if (!dict_code) {
  8418. msg$1('请先保存字典');
  8419. return;
  8420. }
  8421. this.grid2.appendEditRow({
  8422. dict_code: dict_code,
  8423. dict_text: '',
  8424. dict_value: '',
  8425. }, 0);
  8426. };
  8427. DictTreeController.prototype.dictItemRemove = function () {
  8428. var _this = this;
  8429. var rows = [];
  8430. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  8431. rows.push(r);
  8432. });
  8433. _$2.forEach(rows, function (r) {
  8434. _this.grid2.getStore().remove(r);
  8435. });
  8436. };
  8437. DictTreeController.prototype.clearSearch1 = function () {
  8438. this.grid1.store.clearFilter();
  8439. };
  8440. DictTreeController.prototype.search1 = function (sender) {
  8441. this.grid1.store.clearFilter();
  8442. this.getViewModel().set('grid1.selection', null);
  8443. this.grid1.fireEvent('itemselect');
  8444. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8445. if (!value) {
  8446. return;
  8447. }
  8448. this.grid1.store.filterBy(function (record) {
  8449. if (record.get('_createFlag')) {
  8450. return true;
  8451. }
  8452. var dict_code = _$2.lowerCase(record.get('dict_code'));
  8453. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  8454. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  8455. return (dict_code.includes(value) ||
  8456. dict_desc.includes(value) ||
  8457. dict_desc_py.includes(value));
  8458. });
  8459. };
  8460. DictTreeController.prototype.clearSearch2 = function () {
  8461. this.grid2.store.clearFilter();
  8462. };
  8463. DictTreeController.prototype.search2 = function (sender) {
  8464. this.grid2.store.clearFilter();
  8465. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8466. if (!value) {
  8467. return;
  8468. }
  8469. this.grid2.store.filterBy(function (record) {
  8470. var dict_text = _$2.lowerCase(record.get('dict_text'));
  8471. var dict_value = _$2.lowerCase(record.get('dict_value'));
  8472. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  8473. return (dict_text.includes(value) ||
  8474. dict_value === value ||
  8475. dict_text_py.includes(value));
  8476. });
  8477. };
  8478. DictTreeController.prototype.getStateFilename = function () {
  8479. return getCurrentProject().uuid + "/dicttree.json";
  8480. };
  8481. DictTreeController.prototype.restoreState = function () {
  8482. var _this = this;
  8483. var grid = this.grid1;
  8484. native.loadFile(this.getStateFilename(), function (content) {
  8485. if (!content)
  8486. return;
  8487. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  8488. _this._saveStateFlag = false;
  8489. if (selection) {
  8490. var idx = grid.store.findExact('dict_code', selection);
  8491. if (idx >= 0) {
  8492. var record = grid.store.getAt(idx);
  8493. if (record) {
  8494. grid.setSelection([record]);
  8495. }
  8496. }
  8497. }
  8498. if (scrollPosition && scrollSize) {
  8499. var size = grid.scrollable.getSize();
  8500. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  8501. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  8502. }
  8503. }
  8504. setTimeout(function () {
  8505. _this._saveStateFlag = true;
  8506. }, 200);
  8507. });
  8508. };
  8509. DictTreeController.prototype.saveState = function () {
  8510. if (!this._saveStateFlag) {
  8511. return;
  8512. }
  8513. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8514. var selection = undefined;
  8515. if (record) {
  8516. selection = record.get('dict_code');
  8517. }
  8518. var scrollPosition = this.grid1.scrollable.position;
  8519. var scrollSize = this.grid1.scrollable.getSize();
  8520. native.saveFile(this.getStateFilename(), {
  8521. selection: selection,
  8522. scrollPosition: scrollPosition,
  8523. scrollSize: scrollSize
  8524. });
  8525. };
  8526. return DictTreeController;
  8527. }());
  8528. //# sourceMappingURL=DictTreeController.js.map
  8529. function initDict () {
  8530. var controller = new DictTreeController();
  8531. Ext.define('com.yvan.studio.DictTree', {
  8532. extend: 'Ext.panel.Panel',
  8533. xtype: 'dicttree',
  8534. controller: controller,
  8535. scope: controller,
  8536. referenceHolder: true,
  8537. tooltip: '字典',
  8538. iconCls: 'x-fa fa-book',
  8539. rootVisible: false,
  8540. useArrows: true,
  8541. reference: 'dicttree',
  8542. layout: 'border',
  8543. listeners: {
  8544. afterrender: 'onLoad',
  8545. destory: 'onDestory',
  8546. },
  8547. items: [
  8548. {
  8549. region: 'center',
  8550. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  8551. _mode: 'select',
  8552. tbar: [
  8553. {
  8554. xtype: 'button',
  8555. tooltip: '刷新',
  8556. iconCls: 'x-fa fa-refresh',
  8557. listeners: {
  8558. click: 'reload'
  8559. }
  8560. },
  8561. {
  8562. xtype: 'button',
  8563. tooltip: '添加',
  8564. iconCls: 'x-fa fa-plus-circle',
  8565. listeners: {
  8566. click: 'dictAdd'
  8567. }
  8568. },
  8569. {
  8570. xtype: 'button',
  8571. tooltip: '删除',
  8572. iconCls: 'x-fa fa-minus-circle',
  8573. bind: {
  8574. disabled: '{!grid1.selection}'
  8575. },
  8576. listeners: {
  8577. click: 'dictRemove'
  8578. }
  8579. },
  8580. {
  8581. xtype: 'button',
  8582. tooltip: '保存',
  8583. iconCls: 'x-fa fa-save',
  8584. bind: {
  8585. disabled: '{!grid1.ischanged}'
  8586. },
  8587. listeners: {
  8588. click: 'dictSave'
  8589. }
  8590. },
  8591. {
  8592. xtype: 'textfield',
  8593. hideClear: true,
  8594. triggers: {
  8595. clear: {
  8596. cls: 'x-form-clear-trigger',
  8597. handler: 'clearSearch1'
  8598. },
  8599. },
  8600. flex: 1,
  8601. emptyText: '搜索过滤',
  8602. enableKeyEvents: true,
  8603. listeners: {
  8604. keyup: {
  8605. fn: 'search1',
  8606. buffer: 50
  8607. }
  8608. }
  8609. },
  8610. ],
  8611. listeners: {
  8612. itemselect: 'grid1Selected',
  8613. },
  8614. idField: 'dict_code',
  8615. columns: [
  8616. {
  8617. text: '字典编号', dataIndex: 'dict_code',
  8618. menuDisabled: true, flex: 1,
  8619. editor: {
  8620. allowBlank: true,
  8621. selectOnFocus: false
  8622. }
  8623. },
  8624. {
  8625. text: '中文描述', dataIndex: 'dict_desc',
  8626. menuDisabled: true, flex: 1,
  8627. editor: {
  8628. allowBlank: true,
  8629. selectOnFocus: false
  8630. }
  8631. },
  8632. ]
  8633. },
  8634. {
  8635. region: 'south', height: '50%',
  8636. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  8637. split: true,
  8638. _mode: 'edit1',
  8639. listeners: {},
  8640. tbar: [
  8641. {
  8642. xtype: 'button',
  8643. tooltip: '添加',
  8644. iconCls: 'x-fa fa-plus-circle',
  8645. bind: {
  8646. disabled: '{!grid1.selection}'
  8647. },
  8648. listeners: {
  8649. click: 'dictItemAdd'
  8650. }
  8651. },
  8652. {
  8653. xtype: 'button',
  8654. tooltip: '删除',
  8655. iconCls: 'x-fa fa-minus-circle',
  8656. bind: {
  8657. disabled: '{!grid1.selection}'
  8658. },
  8659. listeners: {
  8660. click: 'dictItemRemove'
  8661. }
  8662. },
  8663. {
  8664. xtype: 'button',
  8665. tooltip: '保存',
  8666. iconCls: 'x-fa fa-save',
  8667. bind: {
  8668. disabled: '{!grid2.ischanged}'
  8669. },
  8670. listeners: {
  8671. click: 'dictItemSave'
  8672. }
  8673. },
  8674. {
  8675. xtype: 'button',
  8676. tooltip: '刷新代码',
  8677. iconCls: 'x-fa fa-code',
  8678. bind: {
  8679. disabled: '{!grid1.selection}'
  8680. },
  8681. listeners: {
  8682. click: 'createDictEnum'
  8683. }
  8684. },
  8685. ],
  8686. columns: [
  8687. {
  8688. text: '字典项', dataIndex: 'dict_text',
  8689. menuDisabled: true, flex: 1,
  8690. editor: {
  8691. allowBlank: true,
  8692. selectOnFocus: false
  8693. }
  8694. },
  8695. {
  8696. text: '字典值', dataIndex: 'dict_value',
  8697. menuDisabled: true, flex: 1,
  8698. dataType: 'int',
  8699. editor: {
  8700. xtype: 'numberfield',
  8701. allowBlank: true,
  8702. selectOnFocus: false
  8703. }
  8704. },
  8705. {
  8706. text: '激活', dataIndex: 'is_enable',
  8707. xtype: 'checkcolumn', menuDisabled: true,
  8708. },
  8709. {
  8710. text: '变量名', dataIndex: 'var_name',
  8711. menuDisabled: true, flex: 1,
  8712. editor: {
  8713. allowBlank: true,
  8714. selectOnFocus: false
  8715. }
  8716. },
  8717. ]
  8718. }
  8719. ]
  8720. });
  8721. }
  8722. //# sourceMappingURL=DictTree.js.map
  8723. var model$2 = {
  8724. data: {
  8725. form: {
  8726. path: "",
  8727. requestBody: "",
  8728. responseBody: "",
  8729. }
  8730. }
  8731. };
  8732. var vjson$2 = {
  8733. title: '接口信息',
  8734. layout: 'fit',
  8735. width: 800,
  8736. height: 500,
  8737. items: [
  8738. {
  8739. xtype: 'form',
  8740. layout: {
  8741. type: 'vbox',
  8742. pack: 'start',
  8743. align: 'stretch'
  8744. },
  8745. defaults: {
  8746. border: false,
  8747. anchor: '100%',
  8748. margin: '5',
  8749. },
  8750. items: [
  8751. {
  8752. xtype: 'textfield',
  8753. fieldLabel: '接口路径',
  8754. bind: {
  8755. value: "{form.path}",
  8756. },
  8757. },
  8758. {
  8759. xtype: 'textareafield',
  8760. // height: 150,
  8761. flex: 2,
  8762. fieldLabel: '请求数据',
  8763. bind: {
  8764. value: "{form.requestBody}",
  8765. },
  8766. },
  8767. {
  8768. xtype: 'textareafield',
  8769. // height: 150,
  8770. flex: 5,
  8771. fieldLabel: '响应数据',
  8772. bind: {
  8773. value: "{form.responseBody}",
  8774. },
  8775. },
  8776. ]
  8777. }
  8778. ]
  8779. };
  8780. var ApiInfoDialog = /** @class */ (function (_super) {
  8781. __extends(ApiInfoDialog, _super);
  8782. function ApiInfoDialog() {
  8783. return _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  8784. }
  8785. return ApiInfoDialog;
  8786. }(Scope));
  8787. //# sourceMappingURL=apiInfoDialog.js.map
  8788. var model$3 = {
  8789. data: {
  8790. query: {
  8791. role_id: '',
  8792. resource_id: '',
  8793. },
  8794. form: {},
  8795. form2: {
  8796. key: "",
  8797. start_at: "",
  8798. end_at: "",
  8799. }
  8800. }
  8801. };
  8802. var vjson$3 = {
  8803. title: '接口信息',
  8804. layout: 'fit',
  8805. items: [
  8806. {
  8807. layout: 'border',
  8808. border: false,
  8809. items: [
  8810. {
  8811. region: 'center',
  8812. layout: 'border',
  8813. items: [
  8814. {
  8815. region: 'north',
  8816. bind: {
  8817. title: '{form.title}',
  8818. },
  8819. xtype: 'form',
  8820. scrollable: true,
  8821. layout: {
  8822. type: 'vbox',
  8823. pack: 'start',
  8824. align: 'stretch'
  8825. },
  8826. defaults: {
  8827. border: false,
  8828. anchor: '100%',
  8829. margin: '5',
  8830. },
  8831. tbar: {
  8832. xtype: 'toolbar',
  8833. items: [
  8834. {
  8835. xtype: 'button',
  8836. text: '查询',
  8837. iconCls: 'x-fa fa-search',
  8838. listeners: {
  8839. click: 'scope.requestLogs'
  8840. },
  8841. },
  8842. {
  8843. xtype: 'button',
  8844. text: '保存',
  8845. iconCls: 'x-fa fa-save',
  8846. listeners: {},
  8847. },
  8848. {
  8849. xtype: 'button',
  8850. text: '禁用',
  8851. iconCls: 'x-fa fa-stop-circle',
  8852. bind: {},
  8853. listeners: {},
  8854. },
  8855. {
  8856. xtype: 'button',
  8857. text: '启用',
  8858. iconCls: 'x-fa fa-play-circle',
  8859. bind: {},
  8860. listeners: {},
  8861. },
  8862. ],
  8863. },
  8864. items: [
  8865. {
  8866. xtype: 'cols',
  8867. defaults: { labelWidth: 120 },
  8868. items: [
  8869. {
  8870. xtype: 'textfield',
  8871. fieldLabel: 'URL',
  8872. bind: {
  8873. value: '{form.api_url}',
  8874. },
  8875. readOnly: true,
  8876. },
  8877. {
  8878. xtype: 'textfield',
  8879. fieldLabel: '名称',
  8880. bind: {
  8881. value: '{form.api_name}',
  8882. },
  8883. readOnly: true,
  8884. },
  8885. ],
  8886. },
  8887. {
  8888. xtype: 'cols',
  8889. defaults: { labelWidth: 120 },
  8890. items: [
  8891. {
  8892. xtype: 'textfield',
  8893. fieldLabel: '实现类',
  8894. bind: {
  8895. value: '{form.api_class}',
  8896. },
  8897. readOnly: true,
  8898. },
  8899. {
  8900. border: false,
  8901. flex: 1
  8902. },
  8903. ]
  8904. },
  8905. {
  8906. xtype: 'cols',
  8907. defaults: { labelWidth: 120 },
  8908. items: [
  8909. {
  8910. xtype: 'textfield',
  8911. fieldLabel: '超时时间',
  8912. bind: {
  8913. value: '{form.timeout}',
  8914. },
  8915. readOnly: true,
  8916. },
  8917. {
  8918. border: false,
  8919. flex: 1
  8920. },
  8921. ]
  8922. },
  8923. {
  8924. xtype: 'cols',
  8925. defaults: { labelWidth: 120 },
  8926. items: [
  8927. {
  8928. xtype: 'textfield',
  8929. fieldLabel: 'Remote IP',
  8930. bind: {
  8931. value: '{form.remote_ip}',
  8932. },
  8933. readOnly: true,
  8934. },
  8935. {
  8936. border: false,
  8937. flex: 1
  8938. },
  8939. ]
  8940. },
  8941. {
  8942. xtype: 'cols',
  8943. defaults: { labelWidth: 120 },
  8944. items: [
  8945. {
  8946. xtype: 'textfield',
  8947. fieldLabel: '解析表单',
  8948. bind: {
  8949. value: '{form.chandi}',
  8950. },
  8951. readOnly: true,
  8952. },
  8953. {
  8954. border: false,
  8955. flex: 1
  8956. },
  8957. ]
  8958. },
  8959. ],
  8960. },
  8961. {
  8962. region: 'center',
  8963. // title: 'Request',
  8964. layout: 'border',
  8965. items: [
  8966. {
  8967. region: 'north',
  8968. xtype: 'form',
  8969. reference: 'form2',
  8970. split: true,
  8971. items: [
  8972. {
  8973. xtype: 'cols',
  8974. width: 700,
  8975. items: [
  8976. {
  8977. xtype: 'textfield',
  8978. fieldLabel: '关键字',
  8979. bind: {
  8980. value: "{form2.key}"
  8981. },
  8982. },
  8983. {
  8984. xtype: 'datefield',
  8985. fieldLabel: '开始时间',
  8986. bind: {
  8987. value: "{form2.start_at}"
  8988. },
  8989. },
  8990. {
  8991. xtype: 'datefield',
  8992. fieldLabel: '结束时间',
  8993. bind: {
  8994. value: "{form2.end_at}"
  8995. },
  8996. },
  8997. ]
  8998. }
  8999. ]
  9000. },
  9001. {
  9002. region: 'center',
  9003. xtype: 'yvgrid',
  9004. layout: 'fit',
  9005. reference: 'grid1',
  9006. pagination: true,
  9007. autoLoad: false,
  9008. selModel: {
  9009. selType: 'rowmodel',
  9010. mode: 'SINGLE',
  9011. },
  9012. dataSource: {
  9013. method: 'invoke',
  9014. url: '/sys/api/Api@requestLogs',
  9015. params: {
  9016. formData: '{form2}',
  9017. path: '{form.api_url}',
  9018. },
  9019. },
  9020. listeners: {
  9021. rowdblclick: 'scope.showDialog',
  9022. },
  9023. columns: [
  9024. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9025. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  9026. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  9027. { dataIndex: "size", header: "大小", width: 80 },
  9028. { dataIndex: "path", header: "path", flex: 1 },
  9029. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  9030. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  9031. ]
  9032. }
  9033. ]
  9034. },
  9035. ],
  9036. },
  9037. ],
  9038. },
  9039. ],
  9040. referenceHolder: true,
  9041. };
  9042. var Api = /** @class */ (function (_super) {
  9043. __extends(Api, _super);
  9044. function Api() {
  9045. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  9046. }
  9047. Api.prototype.onLoad = function () {
  9048. _super.prototype.onLoad.call(this);
  9049. this.requestLogs();
  9050. };
  9051. Api.prototype.selectList = function (sender, selected, eOpts) {
  9052. this.viewModel.set("form", selected.data);
  9053. if (selected.data.api_type === '1') {
  9054. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  9055. }
  9056. else {
  9057. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  9058. }
  9059. };
  9060. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  9061. var sel = [];
  9062. _$2.forEach(records, function (item) {
  9063. if (item.data.flg === 'Y') {
  9064. sel.push(item);
  9065. }
  9066. });
  9067. this.refs.methodGrid.selModel.select(sel);
  9068. };
  9069. Api.prototype.saveAll = function () {
  9070. var _this = this;
  9071. var _a, _b, _c;
  9072. var role_id = this.viewModel.get("query.role_id");
  9073. if (!role_id) {
  9074. msg$1("请先选择一个角色");
  9075. return;
  9076. }
  9077. var wh_id = this.viewModel.get("form.wh_id");
  9078. if (!wh_id) {
  9079. msg$1("请先选择一个仓库");
  9080. return;
  9081. }
  9082. var menus = this.refs.theTree.getChecked();
  9083. var rowsMenus = [];
  9084. _$2.forEach(menus, function (m) {
  9085. if (m.data.resource_id) {
  9086. rowsMenus.push(m.data.resource_id);
  9087. }
  9088. });
  9089. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  9090. var methodsArry = (_c = (_b = this.refs.methodGrid.selModel.selected) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.map(function (r) { return r.data.resource_id; });
  9091. _$2.remove(mm, function (x) {
  9092. return methodsArry.includes(x.resource_id);
  9093. });
  9094. var rowsBtn = [];
  9095. _$2.forEach(mm, function (m) {
  9096. rowsBtn.push({ resource_id: m.resource_id });
  9097. });
  9098. this.setLoading(true);
  9099. invokeServer$1('/sys/role/Role@saveAll', {
  9100. wh_id: wh_id,
  9101. role_id: role_id,
  9102. rowsMenus: rowsMenus,
  9103. rowsBtn: rowsBtn,
  9104. }).then(function (res) {
  9105. msg$1(res.msg);
  9106. if (res.success) {
  9107. _this.reloadTree();
  9108. // this.viewModel.set('query.role_id', '')
  9109. _this.viewModel.set('query.resource_id', '');
  9110. _this.refs.methodGrid.reload();
  9111. }
  9112. }).finally(function () {
  9113. _this.setLoading(false);
  9114. });
  9115. };
  9116. Api.prototype.editRoleSuccess = function (sender, data) {
  9117. if (data.success) {
  9118. this.refs.roleGrid.reload();
  9119. this.viewModel.set("query.JIAOS_ID", "");
  9120. this.reloadTree();
  9121. this.viewModel.set("query.CAID_ID", "");
  9122. this.refs.methodGrid.reload();
  9123. }
  9124. };
  9125. Api.prototype.deleteRole = function (sender) {
  9126. var _this = this;
  9127. var role_id = this.viewModel.get("query.role_id");
  9128. if (!role_id) {
  9129. msg$1("请先选择一个角色");
  9130. return;
  9131. }
  9132. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  9133. if (btn === 'yes') {
  9134. invokeServer$1('/sys/role/Role@deleteRole', {
  9135. role_id: role_id,
  9136. wh_id: window['whId']
  9137. }).then(function (res) {
  9138. msg$1(res.msg);
  9139. if (res.success) {
  9140. _this.refs.roleGrid.reload();
  9141. _this.viewModel.set("query.role_id", "");
  9142. _this.reloadTree();
  9143. _this.refs.methodGrid.reload();
  9144. }
  9145. });
  9146. }
  9147. });
  9148. };
  9149. Api.prototype.reloadTree = function () {
  9150. showErrorDialog$1('reloadTree 不存在');
  9151. };
  9152. Api.prototype.whChange = function (sender, value) {
  9153. this.viewModel.set("form.wh_id", value);
  9154. this.reloadTree();
  9155. this.refs.methodGrid.reload();
  9156. };
  9157. Api.prototype.requestLogs = function () {
  9158. var path = this.viewModel.get("form.api_url");
  9159. if (!path)
  9160. return;
  9161. this.refs.grid1.reload();
  9162. };
  9163. Api.prototype.showDialog = function (sender) {
  9164. var _a, _b;
  9165. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  9166. if (!rows || rows.length <= 0)
  9167. return;
  9168. var dialog = new ApiInfoDialog();
  9169. dialog.showDialog(null, {}, {
  9170. data: {
  9171. form: __assign({}, rows[0])
  9172. }
  9173. });
  9174. };
  9175. return Api;
  9176. }(Scope));
  9177. //# sourceMappingURL=ApiPage.js.map
  9178. var Controller = /** @class */ (function () {
  9179. function Controller() {
  9180. }
  9181. Controller.prototype.selectList = function (sender, selected, eOpts) {
  9182. var _a, _b, _c, _d, _e, _f, _g, _h;
  9183. // @ts-ignore
  9184. var rows = (_b = (_a = this.getReferences()['roleGrid'].selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  9185. if (!rows || rows.length <= 0)
  9186. return;
  9187. var apiPage = new Api();
  9188. apiPage.showPage({
  9189. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  9190. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  9191. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  9192. }, {
  9193. data: {
  9194. form: __assign({}, rows[0])
  9195. }
  9196. });
  9197. };
  9198. return Controller;
  9199. }());
  9200. var controller = new Controller();
  9201. function initApiTree () {
  9202. Ext.define('com.yvan.studio.ApiGrid', {
  9203. extend: 'Ext.Panel',
  9204. xtype: 'apigrid',
  9205. controller: controller,
  9206. scope: controller,
  9207. referenceHolder: true,
  9208. layout: 'fit',
  9209. items: [
  9210. {
  9211. width: 400,
  9212. split: true,
  9213. xtype: 'yvgrid',
  9214. reference: 'roleGrid',
  9215. border: false,
  9216. pagination: false,
  9217. autoLoad: true,
  9218. remoteFilter: false,
  9219. selModel: {
  9220. selType: 'rowmodel',
  9221. mode: 'SINGLE',
  9222. },
  9223. tbar: {
  9224. xtype: 'toolbar',
  9225. items: [
  9226. {
  9227. xtype: 'button',
  9228. text: '新增',
  9229. iconCls: 'x-fa fa-plus-circle',
  9230. listeners: {},
  9231. },
  9232. {
  9233. xtype: 'button',
  9234. text: '删除',
  9235. iconCls: 'x-fa fa-trash',
  9236. bind: {
  9237. disabled: '{roleGrid.selection==null}',
  9238. },
  9239. listeners: {},
  9240. },
  9241. ],
  9242. },
  9243. dataSource: {
  9244. url: '/sys/api/Api@getApiList',
  9245. method: 'invoke',
  9246. params: {},
  9247. },
  9248. listeners: {
  9249. itemdblclick: "selectList",
  9250. },
  9251. columns: [
  9252. {
  9253. dataIndex: 'api_name',
  9254. header: '接口名称',
  9255. filter: { type: 'string' },
  9256. flex: 1,
  9257. },
  9258. ],
  9259. },
  9260. ]
  9261. });
  9262. }
  9263. //# sourceMappingURL=ApiTree.js.map
  9264. var model$4 = {
  9265. data: {
  9266. iframeSrc: ''
  9267. }
  9268. };
  9269. var vjson$4 = {
  9270. layout: 'fit',
  9271. border: false,
  9272. iconCls: 'x-fa fa-newspaper-o',
  9273. referenceHolder: true,
  9274. items: [
  9275. {
  9276. // title: 'view.design',
  9277. xtype: 'uxiframe',
  9278. layout: 'fit',
  9279. // cls: 'module_page_iframe',
  9280. reference: 'iframe',
  9281. listeners: {
  9282. afterrender: 'scope.iframeRender'
  9283. }
  9284. },
  9285. ]
  9286. };
  9287. var Iframe = /** @class */ (function (_super) {
  9288. __extends(Iframe, _super);
  9289. function Iframe(path) {
  9290. var _this = _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  9291. _this.path = "";
  9292. _this.path = path;
  9293. return _this;
  9294. }
  9295. Iframe.prototype.iframeRender = function (sender) {
  9296. var $dom = $(sender.el.dom).find('iframe');
  9297. var iframe = $dom[0];
  9298. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  9299. iframe.onload = function () {
  9300. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  9301. };
  9302. };
  9303. return Iframe;
  9304. }(Scope));
  9305. //# sourceMappingURL=Iframe.js.map
  9306. var Controller$1 = /** @class */ (function () {
  9307. function Controller() {
  9308. }
  9309. Controller.prototype.onDblClick = function (sender, record) {
  9310. var data = record.raw;
  9311. if (data.text === "运行报表") {
  9312. this.openIframe("/xxl-job/index", "运行报表");
  9313. }
  9314. else if (data.text === "任务管理") {
  9315. this.openIframe("/xxl-job/jobinfo", "任务管理");
  9316. }
  9317. else if (data.text === "调度日志") {
  9318. this.openIframe("/xxl-job/joblog", "调度日志");
  9319. }
  9320. else if (data.text === "执行器管理") {
  9321. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  9322. }
  9323. };
  9324. Controller.prototype.openIframe = function (path, title) {
  9325. var page = new Iframe(path);
  9326. page.showPage({
  9327. title: title,
  9328. id: 'xxljob__' + path.replaceAll("/", "_"),
  9329. path: 'xxljob__' + path.replaceAll("/", "_"),
  9330. }, {});
  9331. };
  9332. Controller.prototype.onLoad = function () {
  9333. var me = this;
  9334. me.getView().setRootNode({
  9335. expanded: true,
  9336. leaf: false,
  9337. children: [
  9338. { leaf: true, text: '运行报表' },
  9339. { leaf: true, text: '任务管理' },
  9340. { leaf: true, text: '调度日志' },
  9341. { leaf: true, text: '执行器管理' },
  9342. ]
  9343. });
  9344. };
  9345. return Controller;
  9346. }());
  9347. var controller$1 = new Controller$1();
  9348. function initTaskTree () {
  9349. Ext.define('com.yvan.studio.TaskTree', {
  9350. extend: 'Ext.tree.Panel',
  9351. xtype: 'tasktree',
  9352. controller: controller$1,
  9353. scope: controller$1,
  9354. reference: 'roleGrid',
  9355. tooltip: '表单定义',
  9356. iconCls: 'x-fa fa-bar-chart',
  9357. useArrows: true,
  9358. rootVisible: false,
  9359. colspan: 2,
  9360. lines: true,
  9361. multiSelect: false,
  9362. referenceHolder: true,
  9363. // openNode() {
  9364. // const selection = this.getSelection()
  9365. // const [record] = selection
  9366. // if (!record) {
  9367. // return
  9368. // }
  9369. //
  9370. // const {raw} = record;
  9371. // if (raw.type === 'Dir') {
  9372. // return
  9373. // }
  9374. // if (raw.type === "Module" && raw.module) {
  9375. // // eventBus.publish(EventType.ModuleOpen, raw)
  9376. // }
  9377. // },
  9378. listeners: {
  9379. itemdblclick: 'onDblClick',
  9380. afterrender: "onLoad",
  9381. },
  9382. });
  9383. }
  9384. //# sourceMappingURL=TaskTree.js.map
  9385. var model$5 = {
  9386. data: {
  9387. form: {
  9388. address: "",
  9389. level: "",
  9390. logger: "",
  9391. message: "",
  9392. nodeName: "",
  9393. serverName: "",
  9394. thread: "",
  9395. whId: "",
  9396. userId: "",
  9397. }
  9398. }
  9399. };
  9400. var vjson$5 = {
  9401. title: '接口信息',
  9402. layout: 'fit',
  9403. width: 800,
  9404. height: 600,
  9405. items: [
  9406. {
  9407. xtype: 'form',
  9408. layout: {
  9409. type: 'vbox',
  9410. pack: 'start',
  9411. align: 'stretch'
  9412. },
  9413. defaults: {
  9414. border: false,
  9415. anchor: '100%',
  9416. margin: '5',
  9417. },
  9418. items: [
  9419. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  9420. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  9421. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  9422. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  9423. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  9424. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  9425. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  9426. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  9427. {
  9428. xtype: 'textareafield',
  9429. flex: 5,
  9430. fieldLabel: '响应数据',
  9431. bind: {
  9432. value: "{form.message}",
  9433. },
  9434. },
  9435. ]
  9436. }
  9437. ]
  9438. };
  9439. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  9440. __extends(ApiInfoDialog, _super);
  9441. function ApiInfoDialog() {
  9442. return _super.call(this, { model: model$5, vjson: vjson$5 }) || this;
  9443. }
  9444. return ApiInfoDialog;
  9445. }(Scope));
  9446. //# sourceMappingURL=LogPageDialog.js.map
  9447. var model$6 = {
  9448. data: {
  9449. form2: {}
  9450. }
  9451. };
  9452. var vjson$6 = {
  9453. title: '日志查询',
  9454. layout: 'fit',
  9455. width: "70%",
  9456. height: "80%",
  9457. items: [
  9458. {
  9459. region: 'center',
  9460. xtype: 'yvgrid',
  9461. layout: 'fit',
  9462. reference: 'grid1',
  9463. pagination: false,
  9464. autoLoad: false,
  9465. selModel: {
  9466. selType: 'rowmodel',
  9467. mode: 'SINGLE',
  9468. },
  9469. dataSource: {
  9470. method: 'invoke',
  9471. url: '/sys/api/Api@aroundLogs',
  9472. params: {
  9473. formData: '{form2}',
  9474. },
  9475. },
  9476. listeners: {
  9477. rowdblclick: 'scope.showDialog2',
  9478. },
  9479. columns: [
  9480. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9481. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9482. { dataIndex: "thread", header: "thread", width: 150 },
  9483. { dataIndex: "message", header: "message", flex: 1 },
  9484. ]
  9485. }
  9486. ]
  9487. };
  9488. var AroundLog = /** @class */ (function (_super) {
  9489. __extends(AroundLog, _super);
  9490. function AroundLog() {
  9491. return _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  9492. }
  9493. AroundLog.prototype.onLoad = function () {
  9494. _super.prototype.onLoad.call(this);
  9495. this.queryLog();
  9496. };
  9497. AroundLog.prototype.queryLog = function () {
  9498. this.refs.grid1.reload();
  9499. };
  9500. AroundLog.prototype.showDialog2 = function () {
  9501. var _a, _b;
  9502. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  9503. if (!rows || rows.length <= 0)
  9504. return;
  9505. var dialog = new ApiInfoDialog$1();
  9506. dialog.showDialog(null, {}, {
  9507. data: {
  9508. form: __assign({}, rows[0])
  9509. }
  9510. });
  9511. };
  9512. return AroundLog;
  9513. }(Scope));
  9514. //# sourceMappingURL=AroundLog.js.map
  9515. var model$7 = {
  9516. data: {
  9517. form2: {
  9518. key: "",
  9519. start_at: "",
  9520. end_at: "",
  9521. }
  9522. }
  9523. };
  9524. var vjson$7 = {
  9525. title: '日志查询',
  9526. layout: 'fit',
  9527. tbar: {
  9528. xtype: 'toolbar',
  9529. items: [
  9530. {
  9531. xtype: 'button',
  9532. text: '刷新',
  9533. listeners: {
  9534. click: 'scope.queryLog'
  9535. },
  9536. },
  9537. {
  9538. xtype: 'button',
  9539. text: '周围日志',
  9540. bind: {},
  9541. listeners: {
  9542. click: 'scope.aroundLogs'
  9543. },
  9544. },
  9545. ],
  9546. },
  9547. items: [
  9548. {
  9549. region: 'center',
  9550. xtype: 'yvgrid',
  9551. layout: 'fit',
  9552. reference: 'grid1',
  9553. pagination: true,
  9554. autoLoad: false,
  9555. selModel: {
  9556. selType: 'rowmodel',
  9557. mode: 'SINGLE',
  9558. },
  9559. dataSource: {
  9560. method: 'invoke',
  9561. url: '/sys/api/Api@queryLog',
  9562. params: {
  9563. formData: '{form2}',
  9564. path: '{form.api_url}',
  9565. },
  9566. },
  9567. listeners: {
  9568. rowdblclick: 'scope.showDialog',
  9569. },
  9570. columns: [
  9571. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9572. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9573. { dataIndex: "thread", header: "thread", width: 150 },
  9574. { dataIndex: "message", header: "message", flex: 1 },
  9575. ]
  9576. }
  9577. ]
  9578. };
  9579. var LogPage = /** @class */ (function (_super) {
  9580. __extends(LogPage, _super);
  9581. function LogPage() {
  9582. return _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  9583. }
  9584. LogPage.prototype.onLoad = function () {
  9585. _super.prototype.onLoad.call(this);
  9586. this.queryLog();
  9587. };
  9588. LogPage.prototype.queryLog = function () {
  9589. this.refs.grid1.reload();
  9590. };
  9591. LogPage.prototype.showDialog = function () {
  9592. var _a, _b;
  9593. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  9594. if (!rows || rows.length <= 0)
  9595. return;
  9596. var dialog = new ApiInfoDialog$1();
  9597. dialog.showDialog(null, {}, {
  9598. data: {
  9599. form: __assign({}, rows[0])
  9600. }
  9601. });
  9602. };
  9603. LogPage.prototype.aroundLogs = function () {
  9604. var _a, _b;
  9605. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  9606. if (!rows || rows.length <= 0)
  9607. return;
  9608. var dialog = new AroundLog();
  9609. dialog.showDialog(null, {}, {
  9610. data: {
  9611. form2: __assign({}, rows[0])
  9612. }
  9613. });
  9614. };
  9615. return LogPage;
  9616. }(Scope));
  9617. //# sourceMappingURL=LogPage.js.map
  9618. var Controller$2 = /** @class */ (function () {
  9619. function Controller() {
  9620. }
  9621. Controller.prototype.queryLog = function () {
  9622. var form2 = this.getViewModel().get("form2");
  9623. var logPage = new LogPage();
  9624. logPage.showPage({}, {
  9625. data: {
  9626. form2: __assign({}, form2)
  9627. }
  9628. });
  9629. };
  9630. return Controller;
  9631. }());
  9632. var controller$2 = new Controller$2();
  9633. function initLogsTree () {
  9634. Ext.define('com.yvan.studio.LogsTree', {
  9635. extend: 'Ext.panel.Panel',
  9636. xtype: 'logstree',
  9637. controller: controller$2,
  9638. scope: controller$2,
  9639. viewModel: {
  9640. data: {
  9641. form2: {
  9642. key: "",
  9643. start_at: "",
  9644. end_at: "",
  9645. }
  9646. }
  9647. },
  9648. reference: 'logstree',
  9649. tooltip: '表单定义',
  9650. iconCls: 'x-fa fa-bar-chart',
  9651. useArrows: true,
  9652. rootVisible: false,
  9653. colspan: 2,
  9654. lines: true,
  9655. multiSelect: false,
  9656. referenceHolder: true,
  9657. items: [
  9658. {
  9659. region: 'north',
  9660. xtype: 'form',
  9661. reference: 'form2',
  9662. split: true,
  9663. items: [
  9664. {
  9665. xtype: 'textfield',
  9666. fieldLabel: '关键字',
  9667. bind: {
  9668. value: "{form2.key}"
  9669. },
  9670. },
  9671. {
  9672. xtype: 'datefield',
  9673. fieldLabel: '开始时间',
  9674. bind: {
  9675. value: "{form2.start_at}"
  9676. },
  9677. },
  9678. {
  9679. xtype: 'datefield',
  9680. fieldLabel: '结束时间',
  9681. bind: {
  9682. value: "{form2.end_at}"
  9683. },
  9684. },
  9685. ]
  9686. },
  9687. {
  9688. xtype: "cols",
  9689. items: [
  9690. {
  9691. xtype: "box",
  9692. },
  9693. {
  9694. xtype: "button",
  9695. text: '查询',
  9696. listeners: {
  9697. click: 'queryLog'
  9698. },
  9699. },
  9700. {
  9701. xtype: "box",
  9702. },
  9703. ]
  9704. },
  9705. ],
  9706. });
  9707. }
  9708. //# sourceMappingURL=LogsTree.js.map
  9709. var model$8 = {
  9710. data: {
  9711. // opsId: "",
  9712. // name: "",
  9713. running: false,
  9714. }
  9715. };
  9716. //# sourceMappingURL=DevOpsTerminal.model.js.map
  9717. var vjson$8 = {
  9718. bind: {
  9719. title: '运维-{name}',
  9720. },
  9721. layout: 'fit',
  9722. items: [
  9723. {
  9724. layout: 'border',
  9725. items: [
  9726. {
  9727. region: 'north',
  9728. items: [
  9729. {
  9730. xtype: 'toolbar',
  9731. border: false,
  9732. items: [
  9733. {
  9734. xtype: 'button',
  9735. text: '执行',
  9736. iconCls: 'x-fa fa-play',
  9737. bind: {
  9738. hidden: "{running}",
  9739. },
  9740. listeners: {
  9741. click: 'scope.start'
  9742. }
  9743. },
  9744. {
  9745. xtype: 'button',
  9746. text: '停止',
  9747. iconCls: 'x-fa fa-stop',
  9748. bind: {
  9749. hidden: "{!running}",
  9750. },
  9751. listeners: {
  9752. click: 'scope.stop'
  9753. }
  9754. },
  9755. ],
  9756. },
  9757. ]
  9758. },
  9759. {
  9760. region: 'center',
  9761. reference: 'terminal',
  9762. xtype: 'terminal',
  9763. },
  9764. ],
  9765. },
  9766. ],
  9767. };
  9768. //# sourceMappingURL=DevOpsTerminal.view.js.map
  9769. var DevOpsTerminal = /** @class */ (function (_super) {
  9770. __extends(DevOpsTerminal, _super);
  9771. function DevOpsTerminal() {
  9772. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  9773. _this.websocket = undefined;
  9774. return _this;
  9775. }
  9776. DevOpsTerminal.prototype.onLoad = function () {
  9777. this.load();
  9778. };
  9779. DevOpsTerminal.prototype.onDestroy = function () {
  9780. if (this.websocket) {
  9781. this.websocket.close();
  9782. this.websocket = undefined;
  9783. }
  9784. };
  9785. DevOpsTerminal.prototype.load = function () {
  9786. var _this = this;
  9787. var opsId = this.viewModel.get('opsId');
  9788. this.setLoading(true);
  9789. devOpsById(opsId).then(function (res) {
  9790. _this.viewModel.set('devOps', res.data);
  9791. }).finally(function () {
  9792. _this.setLoading(false);
  9793. });
  9794. };
  9795. DevOpsTerminal.prototype.start = function () {
  9796. var me = this;
  9797. var running = this.viewModel.get('running');
  9798. var devOps = this.viewModel.get('devOps');
  9799. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  9800. return;
  9801. var devopsServer = "ws://122.9.140.63:9999";
  9802. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  9803. this.websocket.addEventListener('open', function () {
  9804. me.viewModel.set('running', true);
  9805. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  9806. });
  9807. this.websocket.addEventListener('message', function (event) {
  9808. me.refs.terminal.write(event.data);
  9809. });
  9810. this.websocket.addEventListener('close', function () {
  9811. me.stop();
  9812. });
  9813. this.websocket.addEventListener('error', function () {
  9814. me.stop();
  9815. });
  9816. };
  9817. DevOpsTerminal.prototype.stop = function () {
  9818. if (this.websocket) {
  9819. this.websocket.close();
  9820. this.websocket = undefined;
  9821. }
  9822. this.viewModel.set('running', false);
  9823. };
  9824. return DevOpsTerminal;
  9825. }(Scope));
  9826. //# sourceMappingURL=DevOpsTerminal.js.map
  9827. var Controller$3 = /** @class */ (function () {
  9828. function Controller() {
  9829. }
  9830. Controller.prototype.onLoad = function (sender) {
  9831. this.reload();
  9832. };
  9833. Controller.prototype.reload = function () {
  9834. var me = this;
  9835. // @ts-ignore
  9836. var view = me.getView();
  9837. view.setLoading(true);
  9838. devOpsList().then(function (res) {
  9839. view.setStore(new Ext.data.Store({
  9840. fields: ['ops_id', 'host', 'name'],
  9841. data: res.data,
  9842. }));
  9843. }).finally(function () {
  9844. view.setLoading(false);
  9845. });
  9846. };
  9847. Controller.prototype.onDblClick = function (sender) {
  9848. this.devOpsTerminal();
  9849. };
  9850. Controller.prototype.devOpsTerminal = function () {
  9851. // @ts-ignore
  9852. var view = this.getView();
  9853. var _a = __read(view.getSelection(), 1), record = _a[0];
  9854. if (record) {
  9855. var name = record.get('name');
  9856. var opsId = record.get('ops_id');
  9857. var instance = new DevOpsTerminal();
  9858. instance.showPage({
  9859. id: 'ops_' + opsId,
  9860. path: 'ops_' + opsId,
  9861. }, {
  9862. data: {
  9863. opsId: opsId,
  9864. name: name,
  9865. }
  9866. });
  9867. instance.dialogSuccess = function () {
  9868. };
  9869. }
  9870. };
  9871. return Controller;
  9872. }());
  9873. var controller$3 = new Controller$3();
  9874. function initDevOpsTree () {
  9875. Ext.define('com.yvan.studio.DevOpsGrid', {
  9876. extend: 'Ext.grid.Panel',
  9877. xtype: 'devopsgrid',
  9878. controller: controller$3,
  9879. scope: controller$3,
  9880. referenceHolder: true,
  9881. tooltip: '运维',
  9882. iconCls: 'x-fa fa-terminal',
  9883. useArrows: true,
  9884. reference: 'devopsgrid',
  9885. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  9886. listeners: {
  9887. afterrender: 'onLoad',
  9888. itemdblclick: 'onDblClick',
  9889. },
  9890. viewConfig: {
  9891. // listeners: {
  9892. // itemcontextmenu: 'onGridContextMenu',
  9893. // },
  9894. },
  9895. tbar: {
  9896. xtype: 'toolbar',
  9897. items: [
  9898. {
  9899. xtype: 'button',
  9900. tooltip: '刷新',
  9901. iconCls: 'x-fa fa-refresh',
  9902. listeners: {
  9903. click: 'reload'
  9904. }
  9905. },
  9906. {
  9907. xtype: 'textfield',
  9908. flex: 1,
  9909. emptyText: '搜索过滤',
  9910. enableKeyEvents: true,
  9911. listeners: {
  9912. change: {
  9913. fn: 'filterChanged',
  9914. buffer: 50
  9915. }
  9916. }
  9917. },
  9918. ]
  9919. },
  9920. columns: [
  9921. {
  9922. text: 'ID', dataIndex: 'report_id',
  9923. hidden: true,
  9924. },
  9925. {
  9926. text: '服务器',
  9927. dataIndex: 'host',
  9928. width: 100,
  9929. menuDisabled: true,
  9930. },
  9931. {
  9932. text: '操作名称',
  9933. dataIndex: 'name',
  9934. flex: 1,
  9935. menuDisabled: true,
  9936. },
  9937. ]
  9938. });
  9939. }
  9940. //# sourceMappingURL=DevOpsTree.js.map
  9941. function initTerminal () {
  9942. Ext.define('com.yvan.studio.Terminal', {
  9943. extend: 'Ext.panel.Panel',
  9944. alias: 'widget.terminal',
  9945. xtype: 'terminal',
  9946. layout: 'fit',
  9947. border: false,
  9948. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  9949. config: {},
  9950. write: function (str) {
  9951. if (this.term) {
  9952. this.term.write(str);
  9953. }
  9954. },
  9955. initComponent: function () {
  9956. var that = this;
  9957. this.superclass.initComponent.call(this, arguments);
  9958. that.on({
  9959. resize: function () {
  9960. var _a;
  9961. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  9962. that.fitAddon.fit();
  9963. }
  9964. },
  9965. destory: function () {
  9966. if (that.term) {
  9967. that.term.dispose();
  9968. delete that.term;
  9969. }
  9970. if (that.fitAddon) {
  9971. that.fitAddon.dispose();
  9972. delete that.fitAddon;
  9973. }
  9974. },
  9975. afterrender: function (sender) {
  9976. _.defer(function () {
  9977. var $dom = $(that.el.dom).find('.terminal');
  9978. that.term = new xterm.Terminal({
  9979. // cursorBlink: false,
  9980. // cursorStyle: 'bar', // block underline bar
  9981. // enableBold: false,
  9982. // bellStyle: "sound",
  9983. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  9984. // scrollback: 10000,
  9985. // tabStopWidth: 4,
  9986. disableStdin: true,
  9987. theme: {
  9988. // foreground: "#111",
  9989. // background: "#fdfdfd",
  9990. // background: "#fafafa",
  9991. },
  9992. });
  9993. that.fitAddon = new xtermAddonFit.FitAddon();
  9994. that.term.loadAddon(that.fitAddon);
  9995. that.term.open($dom[0]);
  9996. that.fitAddon.fit();
  9997. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  9998. });
  9999. }
  10000. });
  10001. }
  10002. });
  10003. }
  10004. //# sourceMappingURL=Terminal.js.map
  10005. var vjson$9 = {
  10006. title: '接口统计',
  10007. layout: 'fit',
  10008. items: [
  10009. {
  10010. title: '接口统计',
  10011. xtype: 'yvgrid',
  10012. enableLocking: false,
  10013. reference: 'grid1',
  10014. pagination: false,
  10015. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10016. tbar: {
  10017. xtype: 'form',
  10018. items: [
  10019. {
  10020. xtype: 'cols',
  10021. items: [
  10022. {
  10023. xtype: 'textfield',
  10024. fieldLabel: '搜索',
  10025. listeners: {
  10026. change: 'scope.requestFilterChange'
  10027. }
  10028. },
  10029. ]
  10030. },
  10031. ]
  10032. },
  10033. columns: [
  10034. { text: '地址', dataIndex: 'url', flex: 1 },
  10035. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  10036. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10037. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10038. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10039. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10040. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10041. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10042. ],
  10043. leadingBufferZone: 8,
  10044. trailingBufferZone: 8,
  10045. viewConfig: {
  10046. listeners: {
  10047. expandbody: 'scope.onChildExpand'
  10048. }
  10049. },
  10050. listeners: {
  10051. itemdblclick: 'scope.itemClick1'
  10052. },
  10053. plugins: {
  10054. rowwidget: {
  10055. widget: {
  10056. xtype: 'yvgrid',
  10057. hideFootbar: true,
  10058. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10059. listeners: {
  10060. itemdblclick: 'scope.itemClick1'
  10061. },
  10062. columns: [
  10063. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10064. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10065. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10066. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10067. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10068. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10069. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10070. ]
  10071. }
  10072. }
  10073. }
  10074. },
  10075. ]
  10076. };
  10077. //# sourceMappingURL=InterfaceStatistics.view.js.map
  10078. var model$9 = {
  10079. data: {
  10080. count: 0,
  10081. dataSourceName: '',
  10082. sql: "",
  10083. histogram: '',
  10084. maxCost: 0,
  10085. minCost: 0,
  10086. avgCost: '',
  10087. sumCost: 0,
  10088. histogramInfos: [
  10089. // count: 1
  10090. // gteCost: 20
  10091. // ltCost: 50
  10092. // sql: "select sys_resource.resource_id, sys_resource.resource_name, sys_resource.resource_parent, sys_resource.resource_type, sys_resource.resource_icon, sys_resource.scope_url, sys_resource.scope_params, sys_resource.resource_order, sys_resource.permission_code, sys_resource.is_user_relation, sys_resource.is_role_relation, sys_resource.is_enable, sys_resource.create_by, sys_resource.create_at, sys_resource.update_by, sys_resource.update_at\nfrom sys_resource sys_resource\nwhere sys_resource.resource_type = ?\norder by sys_resource.resource_order asc"
  10093. // topN: [
  10094. // cost: 24
  10095. // occurrenceTime: "1648004895171"
  10096. // sql: "select sys_resource.resource_id, sys_resource.resource_name, sys_resource.resource_parent, sys_resource.resource_type, sys_resource.resource_icon, sys_resource.scope_url, sys_resource.scope_params, sys_resource.resource_order, sys_resource.permission_code, sys_resource.is_user_relation, sys_resource.is_role_relation, sys_resource.is_enable, sys_resource.create_by, sys_resource.create_at, sys_resource.update_by, sys_resource.update_at\nfrom sys_resource sys_resource\nwhere sys_resource.resource_type = 3\norder by sys_resource.resource_order asc"
  10097. // ]
  10098. ]
  10099. }
  10100. };
  10101. //# sourceMappingURL=PerformDialog.model.js.map
  10102. var vjson$a = {
  10103. title: '性能统计详情',
  10104. height: 400,
  10105. width: 800,
  10106. modal: true,
  10107. layout: 'fit',
  10108. items: [
  10109. {
  10110. xtype: 'tabpanel',
  10111. items: [
  10112. {
  10113. title: '摘要',
  10114. key: "1",
  10115. layout: 'border',
  10116. items: [
  10117. {
  10118. region: 'north',
  10119. border: false,
  10120. defaults: {
  10121. margin: '8 0 0 0'
  10122. },
  10123. items: [
  10124. {
  10125. xtype: 'cols',
  10126. defaultType: 'displayfield',
  10127. defaults: {
  10128. labelWidth: 70,
  10129. },
  10130. items: [
  10131. {
  10132. fieldLabel: 'count',
  10133. bind: {
  10134. value: '{count}'
  10135. }
  10136. },
  10137. {
  10138. fieldLabel: 'maxCost',
  10139. bind: {
  10140. value: '{maxCost}'
  10141. }
  10142. },
  10143. {
  10144. fieldLabel: 'minCost',
  10145. bind: {
  10146. value: '{minCost}'
  10147. }
  10148. },
  10149. {
  10150. fieldLabel: 'avgCost',
  10151. bind: {
  10152. value: '{avgCost}'
  10153. }
  10154. },
  10155. {
  10156. fieldLabel: 'sumCost',
  10157. bind: {
  10158. value: '{sumCost}'
  10159. }
  10160. },
  10161. ]
  10162. },
  10163. {
  10164. xtype: 'cols',
  10165. items: [
  10166. {
  10167. flex: 5,
  10168. border: false,
  10169. items: [
  10170. {
  10171. xtype: 'segmentedbutton',
  10172. reference: 'histogram',
  10173. allowToggle: false,
  10174. border: false,
  10175. items: []
  10176. }
  10177. ]
  10178. },
  10179. ]
  10180. },
  10181. ],
  10182. },
  10183. {
  10184. region: 'center',
  10185. xtype: 'sqleditor',
  10186. reference: 'sqlEditor',
  10187. },
  10188. ]
  10189. },
  10190. {
  10191. title: '直方图',
  10192. key: "2",
  10193. }
  10194. ]
  10195. }
  10196. ]
  10197. };
  10198. //# sourceMappingURL=PerformDialog.view.js.map
  10199. var PerformDialog = /** @class */ (function (_super) {
  10200. __extends(PerformDialog, _super);
  10201. function PerformDialog() {
  10202. return _super.call(this, { model: model$9, vjson: vjson$a }) || this;
  10203. }
  10204. PerformDialog.prototype.onLoad = function () {
  10205. var _this = this;
  10206. var sql = this.viewModel.get('sql');
  10207. var sql2 = sqlFormat.format(sql, {
  10208. indent: ' ',
  10209. uppercase: true,
  10210. });
  10211. var histogramInfos = this.viewModel.get('histogramInfos');
  10212. var vs = _$2.map(histogramInfos, function (v) {
  10213. if (v.ltCost > 2100000000) {
  10214. return {
  10215. text: "[" + v.gteCost + ", \u221E):" + v.count
  10216. };
  10217. }
  10218. return {
  10219. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  10220. };
  10221. });
  10222. this.refs.sqlEditor.setCode(sql2);
  10223. _$2.forEach(vs, function (v) {
  10224. _this.refs.histogram.add(v);
  10225. });
  10226. };
  10227. return PerformDialog;
  10228. }(Scope));
  10229. //# sourceMappingURL=PerformDialog.js.map
  10230. var model$a = {
  10231. data: {}
  10232. };
  10233. var PerformStats = /** @class */ (function (_super) {
  10234. __extends(PerformStats, _super);
  10235. function PerformStats() {
  10236. var _this = _super.call(this, { model: model$a, vjson: vjson$9 }) || this;
  10237. _this.requestFilterChange = _.debounce(function (sender, value) {
  10238. var store = _this.refs.grid1.store;
  10239. store.clearFilter();
  10240. if (value) {
  10241. store.filterBy(function (record, id) {
  10242. var text = toString(record.get('url'));
  10243. // 用拼音筛选的方式
  10244. return text.includes(value);
  10245. });
  10246. }
  10247. }, 100);
  10248. return _this;
  10249. }
  10250. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10251. widget.setData(record.data.children);
  10252. };
  10253. PerformStats.prototype.itemClick1 = function (sender, record) {
  10254. console.log('itemClick1', record.data);
  10255. new PerformDialog().showDialog(sender, {}, {
  10256. data: record.data
  10257. });
  10258. };
  10259. PerformStats.prototype.onLoad = function () {
  10260. var _this = this;
  10261. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10262. .then(function (_a) {
  10263. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10264. var resData = reqRes.data;
  10265. var jdbcData = jdbcRes.data;
  10266. _.forEach(jdbcData, function (item) {
  10267. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10268. });
  10269. _.forEach(resData, function (item) {
  10270. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10271. if (_.isArray(item.sqls)) {
  10272. item.children = _.map(item.sqls, function (sql) {
  10273. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10274. }).filter(function (v) { return !!v; });
  10275. }
  10276. item.jdbcCount = _.size(item.children);
  10277. });
  10278. _this.refs.grid1.setData(resData);
  10279. // this.refs.grid2.setData(jdbcData)
  10280. });
  10281. };
  10282. return PerformStats;
  10283. }(Scope));
  10284. //# sourceMappingURL=InterfaceStatistics.js.map
  10285. var vjson$b = {
  10286. title: '性能统计',
  10287. layout: 'fit',
  10288. items: [
  10289. {
  10290. title: '数据库统计',
  10291. xtype: 'yvgrid',
  10292. enableLocking: false,
  10293. reference: 'grid2',
  10294. pagination: false,
  10295. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10296. tbar: {
  10297. xtype: 'form',
  10298. items: [
  10299. {
  10300. xtype: 'cols',
  10301. items: [
  10302. {
  10303. fieldLabel: '搜索',
  10304. listeners: {
  10305. change: 'scope.jdbcFilterChange'
  10306. }
  10307. },
  10308. ]
  10309. },
  10310. ]
  10311. },
  10312. listeners: {
  10313. itemdblclick: 'scope.itemClick1'
  10314. },
  10315. columns: [
  10316. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10317. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10318. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10319. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10320. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10321. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10322. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10323. ]
  10324. },
  10325. ]
  10326. };
  10327. //# sourceMappingURL=DatabaseStatistics.view.js.map
  10328. var model$b = {
  10329. data: {}
  10330. };
  10331. var PerformStats$1 = /** @class */ (function (_super) {
  10332. __extends(PerformStats, _super);
  10333. function PerformStats() {
  10334. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  10335. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  10336. var store = _this.refs.grid2.store;
  10337. store.clearFilter();
  10338. if (value) {
  10339. store.filterBy(function (record, id) {
  10340. var text = toString(record.get('sql'));
  10341. // 用拼音筛选的方式
  10342. return text.includes(value);
  10343. });
  10344. }
  10345. }, 100);
  10346. return _this;
  10347. }
  10348. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10349. widget.setData(record.data.children);
  10350. };
  10351. PerformStats.prototype.itemClick1 = function (sender, record) {
  10352. console.log('itemClick1', record.data);
  10353. new PerformDialog().showDialog(sender, {}, {
  10354. data: record.data
  10355. });
  10356. };
  10357. PerformStats.prototype.onLoad = function () {
  10358. var _this = this;
  10359. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10360. .then(function (_a) {
  10361. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10362. var resData = reqRes.data;
  10363. var jdbcData = jdbcRes.data;
  10364. _.forEach(jdbcData, function (item) {
  10365. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10366. });
  10367. _.forEach(resData, function (item) {
  10368. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10369. if (_.isArray(item.sqls)) {
  10370. item.children = _.map(item.sqls, function (sql) {
  10371. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10372. }).filter(function (v) { return !!v; });
  10373. }
  10374. item.jdbcCount = _.size(item.children);
  10375. });
  10376. _this.refs.grid2.setData(jdbcData);
  10377. });
  10378. };
  10379. return PerformStats;
  10380. }(Scope));
  10381. //# sourceMappingURL=DatabaseStatistics.js.map
  10382. var Controller$4 = /** @class */ (function () {
  10383. function Controller() {
  10384. }
  10385. Controller.prototype.onDblClick = function (sender, record) {
  10386. var data = record.raw;
  10387. if (data.text === "接口统计") {
  10388. var page = new PerformStats();
  10389. page.showPage({
  10390. title: "接口统计",
  10391. id: '_InterfaceStatistics',
  10392. path: '_InterfaceStatistics',
  10393. }, {});
  10394. }
  10395. else if (data.text === "数据库统计") {
  10396. var page = new PerformStats$1();
  10397. page.showPage({
  10398. title: "数据库统计",
  10399. id: '_DatabaseStatistics',
  10400. path: '_DatabaseStatistics',
  10401. }, {});
  10402. }
  10403. };
  10404. Controller.prototype.onLoad = function () {
  10405. var me = this;
  10406. //@ts-ignore
  10407. var view = me.getView();
  10408. view.setRootNode({
  10409. expanded: true,
  10410. leaf: false,
  10411. children: [
  10412. { leaf: true, text: '接口统计' },
  10413. { leaf: true, text: '数据库统计' },
  10414. ]
  10415. });
  10416. };
  10417. return Controller;
  10418. }());
  10419. var controller$4 = new Controller$4();
  10420. function initMonitorTree () {
  10421. Ext.define('com.yvan.studio.MonitorTree', {
  10422. extend: 'Ext.tree.Panel',
  10423. xtype: 'monitortree',
  10424. controller: controller$4,
  10425. scope: controller$4,
  10426. reference: 'roleGrid',
  10427. tooltip: '表单定义',
  10428. iconCls: 'x-fa fa-bar-chart',
  10429. useArrows: true,
  10430. rootVisible: false,
  10431. colspan: 2,
  10432. lines: true,
  10433. multiSelect: false,
  10434. referenceHolder: true,
  10435. // openNode() {
  10436. // const selection = this.getSelection()
  10437. // const [record] = selection
  10438. // if (!record) {
  10439. // return
  10440. // }
  10441. //
  10442. // const {raw} = record;
  10443. // if (raw.type === 'Dir') {
  10444. // return
  10445. // }
  10446. // if (raw.type === "Module" && raw.module) {
  10447. // // eventBus.publish(EventType.ModuleOpen, raw)
  10448. // }
  10449. // },
  10450. listeners: {
  10451. itemdblclick: 'onDblClick',
  10452. afterrender: "onLoad",
  10453. },
  10454. });
  10455. }
  10456. //# sourceMappingURL=MonitorTree.js.map
  10457. var Controller$5 = /** @class */ (function () {
  10458. function Controller() {
  10459. }
  10460. return Controller;
  10461. }());
  10462. var controller$5 = new Controller$5();
  10463. function initHomeTree () {
  10464. Ext.define('com.yvan.studio.HomeTree', {
  10465. extend: 'Ext.Panel',
  10466. xtype: 'hometree',
  10467. controller: controller$5,
  10468. scope: controller$5,
  10469. referenceHolder: true,
  10470. bodyCls: 'home',
  10471. // layout: 'fit',
  10472. tbar: {
  10473. xtype: 'toolbar',
  10474. items: [
  10475. {
  10476. xtype: 'button',
  10477. iconCls: 'x-fa fa-exchange',
  10478. text: '数据结构同步',
  10479. handler: function (sender) {
  10480. handles$1.mainWindow.showDataSync(sender);
  10481. }
  10482. },
  10483. {
  10484. xtype: 'button',
  10485. iconCls: 'x-fa fa-cubes',
  10486. text: '数据域管理',
  10487. handler: function (sender) {
  10488. handles$1.mainWindow.showColumnDomain();
  10489. }
  10490. },
  10491. ],
  10492. },
  10493. // items: [
  10494. //
  10495. // ],
  10496. layout: {
  10497. type: 'vbox',
  10498. pack: 'start',
  10499. align: 'stretch',
  10500. },
  10501. items: [
  10502. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  10503. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  10504. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  10505. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  10506. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  10507. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  10508. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  10509. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  10510. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  10511. ],
  10512. });
  10513. }
  10514. //# sourceMappingURL=HomeTree.js.map
  10515. var WidgetStore = /** @class */ (function (_super) {
  10516. __extends(WidgetStore, _super);
  10517. function WidgetStore() {
  10518. return _super !== null && _super.apply(this, arguments) || this;
  10519. }
  10520. WidgetStore.prototype.getCacheKey = function (param) {
  10521. return "widget_data.json";
  10522. };
  10523. /*invokeApi(param: any): Promise<any> {
  10524. return new Promise<any>(resolve => {
  10525. //@ts-ignore
  10526. require(["../../widget/all"], function (res) {
  10527. const widgetList = res.default
  10528. resolve(widgetList)
  10529. })
  10530. })
  10531. }*/
  10532. WidgetStore.prototype.invokeApi = function (param) {
  10533. return widgetListApi(param);
  10534. };
  10535. return WidgetStore;
  10536. }(CacheStore));
  10537. var instance$2 = new WidgetStore();
  10538. //# sourceMappingURL=WidgetStore.js.map
  10539. var WidgetGridController = /** @class */ (function () {
  10540. function WidgetGridController() {
  10541. }
  10542. WidgetGridController.prototype.onLoad = function (sender) {
  10543. var me = this;
  10544. setWidget(me);
  10545. instance$2.registe(me.reloadData.bind(this));
  10546. instance$2.reloadIfNeed(undefined);
  10547. };
  10548. WidgetGridController.prototype.widgetAdd = function (sender) {
  10549. var me = this;
  10550. var win = new Ext.Window({
  10551. autoDestroy: true,
  10552. title: "新建弹框",
  10553. width: 400,
  10554. height: 220,
  10555. resizable: true,
  10556. closable: true,
  10557. maximizable: true,
  10558. minimizable: true,
  10559. plain: true,
  10560. // constrainHeader: true,
  10561. constrain: true,
  10562. layout: 'fit',
  10563. animateTarget: sender,
  10564. buttonAlign: 'center',
  10565. items: [
  10566. {
  10567. xtype: "form",
  10568. layout: "hbox",
  10569. margin: '10px 20px',
  10570. border: 0,
  10571. items: [
  10572. {
  10573. flex: 1,
  10574. layout: 'vbox',
  10575. items: [
  10576. {
  10577. xtype: "textfield",
  10578. name: "widgetcode",
  10579. fieldLabel: "弹窗文件",
  10580. flex: 1,
  10581. allowBlank: false,
  10582. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  10583. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  10584. labelWidth: 80,
  10585. width: "100%",
  10586. },
  10587. {
  10588. xtype: "textfield",
  10589. name: "widgetname",
  10590. fieldLabel: "弹窗名称",
  10591. flex: 1,
  10592. allowBlank: false,
  10593. labelWidth: 80,
  10594. width: "100%",
  10595. },
  10596. ]
  10597. },
  10598. ]
  10599. }
  10600. ],
  10601. //窗口按钮
  10602. buttons: [
  10603. {
  10604. xtype: 'button', text: '保存', handler: function (btn) {
  10605. //窗口获取表单
  10606. var form = win.down('form');
  10607. var vaildSuccess = form.isValid();
  10608. if (!vaildSuccess) {
  10609. return;
  10610. }
  10611. var title = form.down('textfield[name="widgetname"]').getValue();
  10612. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  10613. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  10614. if (res.success) {
  10615. msg$1('添加成功');
  10616. // 添加
  10617. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  10618. me.reload();
  10619. });
  10620. win.close();
  10621. }
  10622. });
  10623. }
  10624. },
  10625. {
  10626. xtype: 'button', text: '取消', handler: function (btn) {
  10627. //窗口关闭
  10628. win.close();
  10629. }
  10630. }
  10631. ]
  10632. });
  10633. win.show();
  10634. };
  10635. WidgetGridController.prototype.widgetRemove = function (sender) {
  10636. var _this = this;
  10637. //@ts-ignore
  10638. var record = this.getView().selection.data;
  10639. if (!record) {
  10640. msg$1('请选择一行');
  10641. return;
  10642. }
  10643. var widgetPath = record.widget_path;
  10644. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  10645. if (btn === 'yes') {
  10646. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  10647. if (res.success) {
  10648. msg$1(res.msg);
  10649. _this.reload();
  10650. }
  10651. });
  10652. }
  10653. });
  10654. };
  10655. WidgetGridController.prototype.widgetEdit = function (record) {
  10656. var _this = this;
  10657. if (record) {
  10658. var widgetPath = record.widget_path;
  10659. var widgetName = record.widget_name;
  10660. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  10661. _this.reload();
  10662. });
  10663. }
  10664. };
  10665. WidgetGridController.prototype.onDestory = function (sender) {
  10666. var me = this;
  10667. setWidget(undefined);
  10668. instance$2.unregiste(me.reloadData.bind(this));
  10669. };
  10670. WidgetGridController.prototype.reloadData = function (res) {
  10671. var me = this;
  10672. //@ts-ignore
  10673. var view = me.getView();
  10674. if (typeof res === 'object') {
  10675. // const data = []
  10676. // _.forOwn(res, (v, k) => {
  10677. // data.push({
  10678. // widget_path: k,
  10679. // widget_name: v.title,
  10680. // vjson : v
  10681. // })
  10682. // })
  10683. view.setStore(new Ext.data.Store({
  10684. fields: ['widget_path', 'widget_name'],
  10685. data: res.data,
  10686. }));
  10687. }
  10688. else if (typeof res === 'boolean') {
  10689. view.setLoading(res);
  10690. }
  10691. };
  10692. WidgetGridController.prototype.reload = function () {
  10693. instance$2.reloadForce(undefined);
  10694. };
  10695. WidgetGridController.prototype.filterChanged = function (sender, value) {
  10696. //@ts-ignore
  10697. this.view.store.clearFilter();
  10698. if (value) {
  10699. //@ts-ignore
  10700. this.view.store.filterBy(function (record) {
  10701. var widget_path = record.get('widget_path');
  10702. var widget_name = record.get('widget_name');
  10703. return (window['system'].pinyinMatch(widget_name, value) ||
  10704. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10705. });
  10706. }
  10707. };
  10708. WidgetGridController.prototype.onClearClick = function () {
  10709. var _a, _b;
  10710. //@ts-ignore
  10711. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10712. };
  10713. WidgetGridController.prototype.onDblClick = function (sender, record) {
  10714. this.widgetEdit(record.data);
  10715. };
  10716. return WidgetGridController;
  10717. }());
  10718. //# sourceMappingURL=WidgetGridController.js.map
  10719. function initWidget () {
  10720. var controller = new WidgetGridController();
  10721. Ext.define('com.yvan.studio.WidgetGrid', {
  10722. extend: 'Ext.grid.Panel',
  10723. xtype: 'widgetgrid',
  10724. controller: controller,
  10725. scope: controller,
  10726. referenceHolder: true,
  10727. tooltip: '检索窗口',
  10728. iconCls: 'x-fa fa-search',
  10729. useArrows: true,
  10730. reference: 'widgetgrid',
  10731. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10732. listeners: {
  10733. itemdblclick: 'onDblClick',
  10734. afterrender: 'onLoad',
  10735. destory: 'onDestory',
  10736. },
  10737. viewConfig: {
  10738. listeners: {
  10739. itemcontextmenu: 'onGridContextMenu',
  10740. },
  10741. },
  10742. tbar: [
  10743. {
  10744. xtype: 'button',
  10745. tooltip: '刷新',
  10746. iconCls: 'x-fa fa-refresh',
  10747. listeners: {
  10748. click: 'reload'
  10749. }
  10750. },
  10751. {
  10752. xtype: 'button',
  10753. tooltip: '添加',
  10754. iconCls: 'x-fa fa-plus-circle',
  10755. listeners: {
  10756. click: 'widgetAdd'
  10757. }
  10758. },
  10759. {
  10760. xtype: 'button',
  10761. tooltip: '删除',
  10762. iconCls: 'x-fa fa-minus-circle',
  10763. listeners: {
  10764. click: 'widgetRemove'
  10765. }
  10766. },
  10767. ],
  10768. fbar: [
  10769. {
  10770. xtype: 'textfield',
  10771. flex: 1,
  10772. reference: "txtFilter",
  10773. emptyText: '搜索过滤',
  10774. enableKeyEvents: true,
  10775. listeners: {
  10776. change: {
  10777. fn: 'filterChanged',
  10778. buffer: 50
  10779. }
  10780. }
  10781. },
  10782. ],
  10783. columns: [
  10784. {
  10785. text: '弹窗文件', dataIndex: 'widget_path',
  10786. menuDisabled: true, flex: 1,
  10787. },
  10788. {
  10789. text: '弹窗名称', dataIndex: 'widget_name',
  10790. menuDisabled: true, flex: 1,
  10791. },
  10792. ]
  10793. });
  10794. }
  10795. //# sourceMappingURL=WidgetGrid.js.map
  10796. var WhLayoutController = /** @class */ (function () {
  10797. function WhLayoutController() {
  10798. }
  10799. WhLayoutController.prototype.onLoad = function (sender) {
  10800. var _this = this;
  10801. var me = this;
  10802. setWhLayout(me);
  10803. _$2.defer(function () {
  10804. _this.reload();
  10805. });
  10806. };
  10807. WhLayoutController.prototype.reload = function () {
  10808. //@ts-ignore
  10809. var view = this.getView();
  10810. view.setLoading(true);
  10811. loadWhLayoutAll().then(function (res) {
  10812. view.setStore(new Ext.data.Store({
  10813. fields: ['layout_code', 'layout_name'],
  10814. data: res.data,
  10815. }));
  10816. }).finally(function () {
  10817. view.setLoading(false);
  10818. });
  10819. };
  10820. WhLayoutController.prototype.add = function () {
  10821. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  10822. };
  10823. WhLayoutController.prototype.edit = function (data) {
  10824. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  10825. };
  10826. WhLayoutController.prototype.remove = function () {
  10827. var _this = this;
  10828. var _a;
  10829. //@ts-ignore
  10830. var view = this.getView();
  10831. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  10832. if (!record) {
  10833. msg$1('请选择一行数据');
  10834. return;
  10835. }
  10836. var layoutCode = record.layout_code;
  10837. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  10838. if (btn === 'yes') {
  10839. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  10840. if (res.success) {
  10841. msg$1(res.msg);
  10842. _this.reload();
  10843. }
  10844. });
  10845. }
  10846. });
  10847. };
  10848. WhLayoutController.prototype.onDblClick = function () {
  10849. var _a;
  10850. //@ts-ignore
  10851. var view = this.getView();
  10852. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  10853. if (!record) {
  10854. msg$1('请选择一行数据');
  10855. return;
  10856. }
  10857. this.edit(record);
  10858. };
  10859. WhLayoutController.prototype.filterChanged = function (sender, value) {
  10860. //@ts-ignore
  10861. this.view.store.clearFilter();
  10862. if (value) {
  10863. //@ts-ignore
  10864. this.view.store.filterBy(function (record) {
  10865. var widget_path = record.get('widget_path');
  10866. var widget_name = record.get('widget_name');
  10867. return (window['system'].pinyinMatch(widget_name, value) ||
  10868. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10869. });
  10870. }
  10871. };
  10872. WhLayoutController.prototype.onClearClick = function () {
  10873. var _a, _b;
  10874. //@ts-ignore
  10875. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10876. };
  10877. return WhLayoutController;
  10878. }());
  10879. //# sourceMappingURL=WhLayoutController.js.map
  10880. function initWhLayout () {
  10881. var controller = new WhLayoutController();
  10882. Ext.define('com.yvan.studio.WhLayout', {
  10883. extend: 'Ext.grid.Panel',
  10884. xtype: 'whlayout',
  10885. alias: 'widget.whlayout',
  10886. controller: controller,
  10887. scope: controller,
  10888. referenceHolder: true,
  10889. tooltip: '检索窗口',
  10890. iconCls: 'x-fa fa-search',
  10891. useArrows: true,
  10892. reference: 'whlayout',
  10893. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10894. listeners: {
  10895. itemdblclick: 'onDblClick',
  10896. afterrender: 'onLoad',
  10897. destory: 'onDestory',
  10898. },
  10899. viewConfig: {
  10900. listeners: {
  10901. itemcontextmenu: 'onGridContextMenu',
  10902. },
  10903. },
  10904. tbar: [
  10905. {
  10906. xtype: 'button',
  10907. tooltip: '刷新',
  10908. iconCls: 'x-fa fa-refresh',
  10909. listeners: {
  10910. click: 'reload'
  10911. }
  10912. },
  10913. {
  10914. xtype: 'button',
  10915. tooltip: '添加',
  10916. iconCls: 'x-fa fa-plus-circle',
  10917. listeners: {
  10918. click: 'add'
  10919. }
  10920. },
  10921. {
  10922. xtype: 'button',
  10923. tooltip: '删除',
  10924. iconCls: 'x-fa fa-minus-circle',
  10925. listeners: {
  10926. click: 'remove'
  10927. }
  10928. },
  10929. ],
  10930. fbar: [
  10931. {
  10932. xtype: 'textfield',
  10933. flex: 1,
  10934. reference: "txtFilter",
  10935. emptyText: '搜索过滤',
  10936. enableKeyEvents: true,
  10937. listeners: {
  10938. change: {
  10939. fn: 'filterChanged',
  10940. buffer: 50
  10941. }
  10942. }
  10943. },
  10944. ],
  10945. columns: [
  10946. {
  10947. text: '图编号', dataIndex: 'layout_code',
  10948. menuDisabled: true, flex: 1,
  10949. },
  10950. {
  10951. text: '图名称', dataIndex: 'layout_name',
  10952. menuDisabled: true, flex: 1,
  10953. },
  10954. ]
  10955. });
  10956. }
  10957. //# sourceMappingURL=WhLayout.js.map
  10958. var BpmnTreeController = /** @class */ (function () {
  10959. function BpmnTreeController() {
  10960. }
  10961. BpmnTreeController.prototype.onLoad = function (sender) {
  10962. this.reload();
  10963. };
  10964. BpmnTreeController.prototype.reload = function () {
  10965. var me = this;
  10966. me.getView().setLoading(true);
  10967. exporerList().then(function (res) {
  10968. // handles.mainWindow.modules = res.data
  10969. // const rootNode = modulesToTreeData(res.data)
  10970. var rootNode = res.data.tree;
  10971. me.getView().setRootNode({
  10972. expanded: true,
  10973. leaf: false,
  10974. children: rootNode
  10975. });
  10976. // const lastId = window.location.hash.substring(1);
  10977. // file.selectPath(lastId)
  10978. // if (lastId) {
  10979. // const node = getModuleById(rootNode, lastId)
  10980. // if (node) {
  10981. // showDesign(node.id, node.path, node.text, node.module)
  10982. // }
  10983. // }
  10984. // this.restoreState()
  10985. }).finally(function () {
  10986. me.getView().setLoading(false);
  10987. });
  10988. };
  10989. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  10990. var _this = this;
  10991. e.preventDefault();
  10992. var raw = node.raw;
  10993. //const me = sender.up("treepanel").scope
  10994. var option;
  10995. if (raw.exporerType === 1) ;
  10996. else if (raw.exporerType === 21) {
  10997. if (raw.type === 'Dir') {
  10998. option = {
  10999. shadow: 'frame', allowOtherMenus: true,
  11000. items: [
  11001. {
  11002. text: '添加',
  11003. iconCls: 'x-fa fa-plus-circle',
  11004. handler: function (sender) {
  11005. var dirPath = raw.dirPath;
  11006. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  11007. }
  11008. },
  11009. '-',
  11010. {
  11011. text: '新建文件夹',
  11012. iconCls: 'x-fa fa-folder-o',
  11013. handler: function (sender) {
  11014. }
  11015. }
  11016. ]
  11017. };
  11018. }
  11019. else if (raw.type === 'Model') {
  11020. option = {
  11021. shadow: 'frame', allowOtherMenus: true,
  11022. items: [
  11023. {
  11024. text: '编辑',
  11025. iconCls: 'x-fa fa-edit',
  11026. handler: function (sender) {
  11027. }
  11028. },
  11029. {
  11030. text: '删除',
  11031. iconCls: 'x-fa fa-minus-circle',
  11032. handler: function (sender) {
  11033. }
  11034. },
  11035. '-',
  11036. {
  11037. text: '注册(至菜单)',
  11038. iconCls: 'x-fa fa-sign-in',
  11039. handler: function (sender) {
  11040. }
  11041. },
  11042. {
  11043. text: '新建文件夹',
  11044. iconCls: 'x-fa fa-folder-o',
  11045. handler: function (sender) {
  11046. }
  11047. }
  11048. ]
  11049. };
  11050. }
  11051. }
  11052. else if (raw.exporerType === 22) {
  11053. if (raw.type === 'Dir') {
  11054. option = {
  11055. shadow: 'frame', allowOtherMenus: true,
  11056. items: [
  11057. {
  11058. text: '添加',
  11059. iconCls: 'x-fa fa-plus-circle',
  11060. handler: function (sender) {
  11061. var dirPath = raw.dirPath;
  11062. handles$1.mainWindow.showFormBill();
  11063. }
  11064. },
  11065. '-',
  11066. {
  11067. text: '新建文件夹',
  11068. iconCls: 'x-fa fa-folder-o',
  11069. handler: function (sender) {
  11070. }
  11071. }
  11072. ]
  11073. };
  11074. }
  11075. else if (raw.type === 'Model') {
  11076. option = {
  11077. shadow: 'frame', allowOtherMenus: true,
  11078. items: [
  11079. {
  11080. text: '编辑',
  11081. iconCls: 'x-fa fa-edit',
  11082. handler: function (sender) {
  11083. }
  11084. },
  11085. {
  11086. text: '删除',
  11087. iconCls: 'x-fa fa-minus-circle',
  11088. handler: function (sender) {
  11089. }
  11090. },
  11091. '-',
  11092. {
  11093. text: '注册(至菜单)',
  11094. iconCls: 'x-fa fa-sign-in',
  11095. handler: function (sender) {
  11096. }
  11097. },
  11098. {
  11099. text: '新建文件夹',
  11100. iconCls: 'x-fa fa-folder-o',
  11101. handler: function (sender) {
  11102. }
  11103. }
  11104. ]
  11105. };
  11106. }
  11107. }
  11108. else if (raw.exporerType === 3) ;
  11109. else if (raw.exporerType === 50) {
  11110. option = {
  11111. shadow: 'frame', allowOtherMenus: true,
  11112. items: [
  11113. {
  11114. text: '新建流程',
  11115. iconCls: 'x-fa fa-new',
  11116. handler: function (sender) {
  11117. _this.bpmnAdd(sender);
  11118. }
  11119. },
  11120. ]
  11121. };
  11122. }
  11123. else if (raw.exporerType === 51) {
  11124. option = {
  11125. shadow: 'frame', allowOtherMenus: true,
  11126. items: [
  11127. {
  11128. text: '新建流程',
  11129. iconCls: 'x-fa fa-new',
  11130. handler: function (sender) {
  11131. _this.bpmnAdd(sender);
  11132. }
  11133. },
  11134. {
  11135. text: '删除',
  11136. iconCls: 'x-fa fa-minus-circle',
  11137. handler: function (sender) {
  11138. _this.bpmnDelete(sender, raw);
  11139. }
  11140. },
  11141. ]
  11142. };
  11143. }
  11144. else {
  11145. throw Error('暂时不支持!');
  11146. }
  11147. if (option) {
  11148. var treeMenu = new Ext.menu.Menu(option);
  11149. treeMenu.showAt(e.getXY());
  11150. }
  11151. };
  11152. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  11153. var _this = this;
  11154. prompt$2('输入工作流名称').then(function (name) {
  11155. createBpmn("", name).then(function (res) {
  11156. if (res.success) {
  11157. msg$1('添加成功');
  11158. }
  11159. _this.reload();
  11160. });
  11161. });
  11162. };
  11163. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  11164. var _this = this;
  11165. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  11166. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  11167. if (res.success) {
  11168. msg$1('添加成功');
  11169. }
  11170. _this.reload();
  11171. });
  11172. });
  11173. };
  11174. BpmnTreeController.prototype.reportAdd = function (sender) {
  11175. var _this = this;
  11176. prompt$2('请输入报表名称').then(function (name) {
  11177. createReportApi(name).then(function (res) {
  11178. if (res.success) {
  11179. msg$1('添加成功');
  11180. handles$1.mainWindow.showReport(res.data, name, function () {
  11181. _this.reload();
  11182. });
  11183. }
  11184. _this.reload();
  11185. });
  11186. });
  11187. };
  11188. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  11189. if (record) {
  11190. var reportName = record.get('report_name');
  11191. var reportId = record.get('report_id');
  11192. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  11193. }
  11194. };
  11195. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  11196. var _this = this;
  11197. if (record) {
  11198. var reportName = record.get('report_name');
  11199. var reportId_1 = record.get('report_id');
  11200. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  11201. delReportApi(reportId_1).then(function (res) {
  11202. if (res.success) {
  11203. msg$1('删除成功');
  11204. _this.reload();
  11205. }
  11206. });
  11207. });
  11208. }
  11209. };
  11210. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  11211. var _this = this;
  11212. if (!record || record.type !== 'Module') {
  11213. return;
  11214. }
  11215. var reportName = record.text;
  11216. var reportId = record.target;
  11217. handles$1.mainWindow.showReport(reportId, reportName, function () {
  11218. _this.reload();
  11219. });
  11220. };
  11221. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  11222. var data = record.raw;
  11223. if (data.type !== 'Module' && data.type !== 'Dir') {
  11224. return;
  11225. }
  11226. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  11227. if (data.exporerType === 10) { // 表单
  11228. // this.reportEdit(sender, data)
  11229. handles$1.mainWindow.showReport();
  11230. }
  11231. else if (data.exporerType === 21) {
  11232. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  11233. }
  11234. else if (data.exporerType === 22) {
  11235. handles$1.mainWindow.showFormBill();
  11236. }
  11237. else if (data.exporerType === 30) {
  11238. handles$1.mainWindow.showWidgetDesign();
  11239. }
  11240. else if (data.exporerType === 51) {
  11241. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  11242. }
  11243. else {
  11244. throw Error('暂时不支持!');
  11245. }
  11246. };
  11247. return BpmnTreeController;
  11248. }());
  11249. var controller$6 = new BpmnTreeController();
  11250. function initBpmnTree () {
  11251. Ext.define('com.yvan.studio.BpmnTree', {
  11252. extend: 'Ext.tree.Panel',
  11253. //extend: 'com.yvan.studio.StateTree',
  11254. xtype: 'bpmntree',
  11255. controller: controller$6,
  11256. scope: controller$6,
  11257. tooltip: '表单定义',
  11258. iconCls: 'x-fa fa-random',
  11259. useArrows: true,
  11260. rootVisible: false,
  11261. colspan: 2,
  11262. lines: true,
  11263. multiSelect: true,
  11264. reload: function () {
  11265. this.controller.reload.call(this, arguments);
  11266. },
  11267. openNode: function () {
  11268. var selection = this.getSelection();
  11269. var _a = __read(selection, 1), record = _a[0];
  11270. if (!record) {
  11271. return;
  11272. }
  11273. var raw = record.raw;
  11274. if (raw.type === 'Dir') {
  11275. return;
  11276. }
  11277. if (raw.type === "Module" && raw.module) ;
  11278. },
  11279. listeners: {
  11280. itemdblclick: 'onDblClick',
  11281. afterrender: 'onLoad',
  11282. // itemverify() {
  11283. // this.openNode()
  11284. // },
  11285. itemcontextmenu: 'onLisenContextMenu'
  11286. },
  11287. tbar: {
  11288. xtype: 'toolbar',
  11289. items: [
  11290. {
  11291. xtype: 'button',
  11292. tooltip: '刷新',
  11293. iconCls: 'x-fa fa-refresh',
  11294. listeners: {
  11295. click: 'reload'
  11296. }
  11297. },
  11298. /*{
  11299. xtype: 'button',
  11300. tooltip: '添加',
  11301. iconCls: 'x-fa fa-plus-circle',
  11302. menu: [
  11303. {
  11304. text: '类别',
  11305. listeners: {
  11306. click: 'classAdd'
  11307. }
  11308. },
  11309. {
  11310. text: '查询',
  11311. listeners: {
  11312. click: 'reportAdd'
  11313. }
  11314. },
  11315. '-',
  11316. {
  11317. text: '单表定义',
  11318. listeners: {
  11319. click: 'singleTableAdd'
  11320. }
  11321. },
  11322. {
  11323. text: '多表定义',
  11324. listeners: {
  11325. click: 'complexTableAdd'
  11326. }
  11327. },
  11328. {
  11329. text: '查询窗口定义',
  11330. listeners: {
  11331. click: 'widgetAdd'
  11332. }
  11333. },
  11334. ],
  11335. },
  11336. {
  11337. xtype: 'button',
  11338. tooltip: '删除',
  11339. iconCls: 'x-fa fa-minus-circle',
  11340. listeners: {
  11341. click: 'reportRemove'
  11342. }
  11343. },*/
  11344. {
  11345. xtype: 'textfield',
  11346. flex: 1,
  11347. reference: "txtFilter",
  11348. emptyText: '搜索过滤',
  11349. enableKeyEvents: true,
  11350. listeners: {
  11351. change: {
  11352. fn: 'filterChanged',
  11353. buffer: 50
  11354. }
  11355. }
  11356. },
  11357. ]
  11358. },
  11359. });
  11360. }
  11361. //# sourceMappingURL=BpmnTree.js.map
  11362. // export const idPrefix = "_ds_"
  11363. var _designInstance;
  11364. function setDesignInstance(instance) {
  11365. _designInstance = instance;
  11366. }
  11367. function getDesignInstance() {
  11368. return _designInstance;
  11369. }
  11370. function delegateDragmove(node, source, info) {
  11371. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  11372. //@ts-ignore
  11373. _designInstance.dragmove(node, source, info);
  11374. }
  11375. }
  11376. function delegateDragend(node, source, info) {
  11377. if (_designInstance && typeof _designInstance.dragend === 'function') {
  11378. //@ts-ignore
  11379. _designInstance.dragend(node, source, info);
  11380. }
  11381. }
  11382. //# sourceMappingURL=DropHelper.js.map
  11383. function initToolBox () {
  11384. Ext.define('com.yvan.studio.ToolBox', {
  11385. extend: 'Ext.panel.Panel',
  11386. xtype: 'toolbox',
  11387. tooltip: '工具箱',
  11388. layout: 'fit',
  11389. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  11390. border: false,
  11391. beforeRender: function () {
  11392. console.log('beforeRender', this);
  11393. },
  11394. afterRender: function () {
  11395. var $dom = $(this.body.dom).children('div');
  11396. $dom.append(createComponent());
  11397. $dom.css("height", '100%');
  11398. // @ts-ignore
  11399. $('#_toolbox_list').find('li').each(function () {
  11400. var id = $(this).children(':first').attr('drag_id');
  11401. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  11402. setDrag(this, node);
  11403. });
  11404. }
  11405. });
  11406. }
  11407. function setDrag(el, node) {
  11408. new Ext.drag.Source({
  11409. element: el,
  11410. proxy: {
  11411. type: 'placeholder',
  11412. getElement: function (info) {
  11413. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  11414. return Ext.getBody().createChild({
  11415. html: html
  11416. });
  11417. }
  11418. },
  11419. listeners: {
  11420. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  11421. dragend: delegateDragend.bind(getDesignInstance(), node),
  11422. },
  11423. sourceVjson: node.code,
  11424. dragType: node.dragType
  11425. });
  11426. }
  11427. function createComponent() {
  11428. var template = [];
  11429. for (var i = 0; i < codeLines.length; i++) {
  11430. var item = codeLines[i];
  11431. if (!item.dragHtml) {
  11432. continue;
  11433. }
  11434. var $ele = $("<li>" + item.dragHtml + "</li>");
  11435. $ele.children(':first').attr('drag_id', item.id);
  11436. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  11437. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  11438. }
  11439. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  11440. return html;
  11441. }
  11442. var codeLines = [
  11443. {
  11444. id: '$label',
  11445. value: layoutOrXtypeNameMap.label + ' - label',
  11446. icon: "fa fa-font",
  11447. dragType: "col-item",
  11448. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11449. code: {
  11450. xtype: 'label',
  11451. text: '文本' + _$2.uniqueId('_l')
  11452. }
  11453. },
  11454. {
  11455. id: '$text',
  11456. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  11457. icon: "fa fa-edit",
  11458. dragType: "col-item",
  11459. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11460. code: {
  11461. xtype: 'textfield',
  11462. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11463. }
  11464. },
  11465. {
  11466. id: '$textarea',
  11467. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  11468. icon: "fa fa-edit",
  11469. dragType: "col-item",
  11470. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11471. code: {
  11472. xtype: 'textareafield',
  11473. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11474. }
  11475. },
  11476. {
  11477. id: '$number',
  11478. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  11479. icon: "fa fa-edit",
  11480. dragType: "col-item",
  11481. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11482. code: {
  11483. xtype: 'numberfield',
  11484. fieldLabel: '数字框' + _$2.uniqueId('_n')
  11485. }
  11486. },
  11487. {
  11488. id: '$combo',
  11489. value: layoutOrXtypeNameMap.combo + ' - combo',
  11490. icon: "fa fa-angle-double-down",
  11491. dragType: "col-item",
  11492. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11493. code: {
  11494. xtype: 'combo',
  11495. fieldLabel: '请选择',
  11496. data: [
  11497. { id: 'id1', text: '选项1' },
  11498. { id: 'id2', text: '选项2' },
  11499. { id: 'id3', text: '选项3' },
  11500. ],
  11501. }
  11502. },
  11503. {
  11504. id: '$datebox',
  11505. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  11506. icon: "fa fa-calendar",
  11507. dragType: "col-item",
  11508. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11509. code: {
  11510. xtype: "datefield",
  11511. fieldLabel: '日期',
  11512. }
  11513. },
  11514. {
  11515. id: '$searchbox',
  11516. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  11517. icon: "fa fa-search",
  11518. dragType: "col-item",
  11519. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11520. code: {
  11521. xtype: 'searchfield',
  11522. fieldLabel: '搜索框',
  11523. }
  11524. },
  11525. {
  11526. id: '$combogrid',
  11527. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  11528. icon: "fa fa-table",
  11529. dragType: "col-item",
  11530. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11531. code: {
  11532. xtype: 'combogrid',
  11533. fieldLabel: '下拉表'
  11534. }
  11535. },
  11536. {
  11537. id: '$combotree',
  11538. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  11539. icon: "fa fa-tree",
  11540. dragType: "col-item",
  11541. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11542. code: {
  11543. xtype: 'combotree',
  11544. fieldLabel: '下拉树',
  11545. displayField: 'text',
  11546. rootVisible: false
  11547. }
  11548. },
  11549. {
  11550. id: '$button',
  11551. value: layoutOrXtypeNameMap.button + ' - button',
  11552. icon: 'fa fa-sign-in',
  11553. dragType: "col-item",
  11554. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11555. code: {
  11556. text: '按钮',
  11557. iconCls: 'x-fa fa-bars',
  11558. xtype: 'button'
  11559. }
  11560. },
  11561. {
  11562. id: '$checkbox',
  11563. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  11564. icon: 'fa fa-check-square',
  11565. dragType: "col-item",
  11566. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11567. code: {
  11568. xtype: 'checkbox',
  11569. boxLabel: '勾选框',
  11570. hideLabel: true,
  11571. margin: '0 0 0 15',
  11572. flex: 0,
  11573. }
  11574. },
  11575. {
  11576. id: '$checkboxgroup',
  11577. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  11578. icon: 'fa fa-check-square',
  11579. dragType: "col-item",
  11580. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11581. code: {
  11582. xtype: 'checkboxgroup',
  11583. fieldLabel: '勾选组',
  11584. items: [
  11585. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11586. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11587. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11588. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11589. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11590. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11591. ]
  11592. }
  11593. },
  11594. {
  11595. id: '$radio',
  11596. value: layoutOrXtypeNameMap.radio + ' - radio',
  11597. icon: 'fa fa-dot-circle-o',
  11598. dragType: "col-item",
  11599. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11600. code: {
  11601. xtype: "radio",
  11602. fieldLabel: "请选择",
  11603. }
  11604. },
  11605. {
  11606. id: '$radiogroup',
  11607. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  11608. icon: 'fa fa-dot-circle-o',
  11609. dragType: "col-item",
  11610. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11611. code: {
  11612. xtype: "radiogroup",
  11613. fieldLabel: "请选择",
  11614. items: [
  11615. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11616. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11617. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11618. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11619. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11620. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11621. ]
  11622. }
  11623. },
  11624. {
  11625. id: '$cols',
  11626. value: layoutOrXtypeNameMap.cols + ' - cols',
  11627. icon: 'fa fa-list-alt',
  11628. dragType: "cols-container",
  11629. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11630. code: {
  11631. xtype: 'cols',
  11632. items: [
  11633. {
  11634. xtype: 'textfield',
  11635. fieldLabel: '输入框',
  11636. },
  11637. ],
  11638. }
  11639. },
  11640. {
  11641. id: '$container',
  11642. value: layoutOrXtypeNameMap.container + ' - container',
  11643. icon: 'fa fa-flag',
  11644. dragType: "col-item",
  11645. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11646. code: {
  11647. xtype: 'container',
  11648. border: false,
  11649. layout: 'hbox',
  11650. }
  11651. },
  11652. {
  11653. id: '$fit',
  11654. value: layoutOrXtypeNameMap.fit + ' - fit',
  11655. icon: 'fa fa-flag',
  11656. dragType: "rows-container",
  11657. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11658. code: {
  11659. border: false,
  11660. layout: 'fit',
  11661. items: [
  11662. {
  11663. xtype: 'container',
  11664. border: false,
  11665. layout: 'hbox',
  11666. }
  11667. ]
  11668. }
  11669. },
  11670. ];
  11671. // @ts-ignore
  11672. // export default ToolBoxCmp
  11673. //# sourceMappingURL=ToolBox.js.map
  11674. var that = undefined;
  11675. function initPropertyDesign () {
  11676. Ext.define('com.yvan.studio.PropertyDesign', {
  11677. extend: 'Ext.panel.Panel',
  11678. xtype: 'propertydesign',
  11679. name: "PropertyDesign",
  11680. tooltip: '属性',
  11681. iconCls: 'x-fa fa-newspaper-o',
  11682. reference: 'propertygrid',
  11683. layout: 'border',
  11684. border: false,
  11685. moduleId: null,
  11686. currentComponentVJson: null,
  11687. currentComponentPropertyEditSource: null,
  11688. vjson: null,
  11689. propertyHandle: null,
  11690. moduleSubscribe: null,
  11691. items: [
  11692. new Ext.grid.property.Grid({
  11693. sortableColumns: false,
  11694. region: 'center',
  11695. listeners: {
  11696. propertychange: function (source, propName, value, oldValue, eOpts) {
  11697. value = _.trim(value);
  11698. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  11699. return item.label === propName;
  11700. });
  11701. if (a.type === 'listeners') {
  11702. if (value) {
  11703. if (that.currentComponentVJson.listeners) {
  11704. that.currentComponentVJson.listeners[propName] = value;
  11705. }
  11706. else {
  11707. var t = {};
  11708. t[propName] = value;
  11709. that.currentComponentVJson.listeners = t;
  11710. }
  11711. }
  11712. else {
  11713. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  11714. if (!value1) {
  11715. delete that.currentComponentVJson.listeners[key];
  11716. }
  11717. else if (key === propName) {
  11718. delete that.currentComponentVJson.listeners[key];
  11719. }
  11720. });
  11721. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  11722. delete that.currentComponentVJson.listeners;
  11723. }
  11724. }
  11725. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11726. vjson: that.vjson,
  11727. from: that.name,
  11728. ignoreRenderUI: true
  11729. });
  11730. }
  11731. else if (a.type === 'fix') {
  11732. if (!value) {
  11733. delete that.currentComponentVJson[propName];
  11734. }
  11735. else {
  11736. that.currentComponentVJson[propName] = value.split("\r\n");
  11737. }
  11738. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11739. vjson: that.vjson,
  11740. from: that.name,
  11741. ignoreRenderUI: true
  11742. });
  11743. }
  11744. else if (a.type === 'bind') {
  11745. var bind_1 = that.currentComponentVJson.bind;
  11746. if (typeof bind_1 === 'string' && a.id === "value") {
  11747. if (value) {
  11748. that.currentComponentVJson.bind = value;
  11749. }
  11750. else {
  11751. delete that.currentComponentVJson.bind;
  11752. }
  11753. }
  11754. else {
  11755. // 转成bind对象
  11756. if (typeof bind_1 === 'string') {
  11757. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  11758. }
  11759. if (value) {
  11760. if (bind_1) {
  11761. bind_1[a.id] = value;
  11762. }
  11763. else {
  11764. var t = {};
  11765. t[a.id] = value;
  11766. that.currentComponentVJson.bind = t;
  11767. }
  11768. }
  11769. else {
  11770. _.forOwn(bind_1, function (value1, key) {
  11771. if (!value1) {
  11772. delete bind_1[key];
  11773. }
  11774. else if (key === a.id) {
  11775. delete bind_1[key];
  11776. }
  11777. });
  11778. if (Object.keys(bind_1).length <= 0) {
  11779. delete that.currentComponentVJson.bind;
  11780. }
  11781. }
  11782. }
  11783. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11784. vjson: that.vjson,
  11785. from: that.name,
  11786. ignoreRenderUI: true
  11787. });
  11788. }
  11789. else if (a.type === 'boolean') {
  11790. if (!value) {
  11791. delete that.currentComponentVJson[propName];
  11792. }
  11793. else if (value === 'false') {
  11794. that.currentComponentVJson[propName] = false;
  11795. }
  11796. else if (value === 'true') {
  11797. that.currentComponentVJson[propName] = true;
  11798. }
  11799. else {
  11800. that.currentComponentVJson[propName] = value;
  11801. }
  11802. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11803. vjson: that.vjson,
  11804. from: that.name
  11805. });
  11806. }
  11807. else {
  11808. that.currentComponentVJson[propName] = value;
  11809. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11810. vjson: that.vjson,
  11811. from: that.name
  11812. });
  11813. }
  11814. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  11815. },
  11816. }
  11817. })
  11818. ],
  11819. listeners: {
  11820. // afterrender() {
  11821. // this.propertyHandle.setSource({
  11822. // "(name)": "My Object",
  11823. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  11824. // "Available": false, // boolean type
  11825. // "Version": .01, // decimal type
  11826. // "Description": "A test object"
  11827. // });
  11828. // }
  11829. },
  11830. initComponent: function () {
  11831. var _this = this;
  11832. this.propertyHandle = this.items[0];
  11833. setPropertyPanel(this);
  11834. that = this;
  11835. eventBus.subscribe(EventType.SetVjson, function (_a) {
  11836. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11837. _this.setVjson(moduleId, from, ignoreRenderUI);
  11838. });
  11839. return this.superclass.initComponent.apply(this, arguments);
  11840. },
  11841. setVjson: function (moduleId, from, ignoreRenderUI) {
  11842. var _this = this;
  11843. // if (this.moduleId === null && moduleId) {
  11844. // this.moduleId = moduleId
  11845. // }
  11846. if (moduleId !== this.moduleId || from === this.name) {
  11847. return;
  11848. }
  11849. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  11850. if (!moduleObj) {
  11851. return;
  11852. }
  11853. this.vjson = moduleObj.moduleObj.vjson;
  11854. this.setPropertyAndEventSource();
  11855. if (this.componentSelectionChangeSubscribe) {
  11856. this.componentSelectionChangeSubscribe.cancel();
  11857. this.componentSelectionChangeSubscribe = null;
  11858. }
  11859. if (this.updateVjsonChangeSubscribe) {
  11860. this.updateVjsonChangeSubscribe.cancel();
  11861. this.updateVjsonChangeSubscribe = null;
  11862. }
  11863. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11864. var id = _a.id, from = _a.from;
  11865. _this.onComponentSelectionChange(id, from);
  11866. });
  11867. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11868. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11869. _this.updateVjson(vjson, from, ignoreRenderUI);
  11870. });
  11871. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11872. this.onComponentSelectionChange(id, from);
  11873. },
  11874. updateVjson: function (vjson, from, ignoreRenderUI) {
  11875. if (!vjson || from === this.name) {
  11876. return;
  11877. }
  11878. this.vjson = vjson;
  11879. this.setPropertyAndEventSource();
  11880. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11881. this.onComponentSelectionChange(id, from);
  11882. },
  11883. onComponentSelectionChange: function (id, from) {
  11884. if (from !== this.name) {
  11885. this.currentComponentVJson = findInCode(this.vjson, id);
  11886. this.setPropertyAndEventSource();
  11887. }
  11888. },
  11889. setPropertyAndEventSource: function () {
  11890. var _this = this;
  11891. this.propertyHandle.setSource({});
  11892. if (!this.currentComponentVJson) {
  11893. return;
  11894. }
  11895. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  11896. var v = xtype;
  11897. // 选中的对象可能是组
  11898. if (!v) {
  11899. if (_.has(this.currentComponentVJson, "cols")) {
  11900. v = "cols";
  11901. }
  11902. else if (_.has(this.currentComponentVJson, "rows")) {
  11903. v = "rows";
  11904. }
  11905. }
  11906. var pd = YvanUI.PropertyDescriptionTable.get(v);
  11907. if (!pd) {
  11908. // 这个组件没有属性
  11909. this.propertyHandle.setSource({});
  11910. return;
  11911. }
  11912. var funcArr = this.getAllfuncs();
  11913. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  11914. // disabled: true,
  11915. displayField: 'name',
  11916. valueField: 'name',
  11917. store: funcArr,
  11918. }); };
  11919. // ====================== 属性
  11920. var elements = [];
  11921. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  11922. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  11923. var props = pd.getPropsByGroup(group);
  11924. if (props.length <= 0)
  11925. return; //没有这一组属性
  11926. // 显示 group 的中文名
  11927. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  11928. if (caption[i] === '绑定') {
  11929. _.each(props, function (prop) {
  11930. elements.push({
  11931. label: "_" + prop.name,
  11932. type: "bind",
  11933. id: prop.name,
  11934. desc: prop.desc,
  11935. editor: new Ext.form.field.Text()
  11936. });
  11937. });
  11938. }
  11939. else {
  11940. _.each(props, function (prop) {
  11941. if (_.isArray(prop.type)) {
  11942. elements.push({
  11943. label: prop.name,
  11944. type: "combo",
  11945. options: prop.type,
  11946. id: prop.name,
  11947. desc: prop.desc
  11948. });
  11949. return;
  11950. }
  11951. switch (prop.type) {
  11952. case 'boolean': {
  11953. elements.push({
  11954. label: prop.name,
  11955. id: prop.name,
  11956. desc: prop.desc,
  11957. type: 'boolean',
  11958. editor: new Ext.form.field.ComboBox({
  11959. displayField: 'text',
  11960. valueField: 'id',
  11961. store: new Ext.data.Store({
  11962. field: ['id', 'text'],
  11963. data: [
  11964. { id: 'true', text: 'True' },
  11965. { id: 'false', text: 'False' },
  11966. ]
  11967. })
  11968. }),
  11969. });
  11970. break;
  11971. }
  11972. case 'number': {
  11973. elements.push({
  11974. label: prop.name,
  11975. type: "number",
  11976. id: prop.name,
  11977. isNum: true,
  11978. desc: prop.desc,
  11979. editor: new Ext.form.field.Number()
  11980. });
  11981. break;
  11982. }
  11983. case 'string': {
  11984. elements.push({
  11985. label: prop.name,
  11986. type: "string",
  11987. id: prop.name,
  11988. desc: prop.desc,
  11989. editor: new Ext.form.field.Text()
  11990. });
  11991. break;
  11992. }
  11993. case 'listeners': {
  11994. elements.push({
  11995. label: prop.name,
  11996. type: "listeners",
  11997. id: prop.name,
  11998. desc: prop.desc,
  11999. editor: createFuncEditor()
  12000. });
  12001. break;
  12002. }
  12003. case 'fix': {
  12004. elements.push({
  12005. label: prop.name,
  12006. type: "fix",
  12007. id: prop.name,
  12008. desc: prop.desc,
  12009. editor: new Ext.form.field.Text()
  12010. });
  12011. break;
  12012. }
  12013. case 'object': {
  12014. break;
  12015. }
  12016. // case 'dataSource' : {
  12017. // break;
  12018. // }
  12019. case 'valid': {
  12020. break;
  12021. }
  12022. default:
  12023. elements.push({
  12024. label: prop.name,
  12025. type: prop.type,
  12026. id: prop.name,
  12027. desc: prop.desc,
  12028. editor: new Ext.form.field.Text({ disabled: true })
  12029. });
  12030. console.error('不支持的编辑类型', prop);
  12031. }
  12032. });
  12033. }
  12034. });
  12035. this.currentComponentPropertyEditSource = elements;
  12036. var panel1Source = {};
  12037. var panel1SourceConfig = {};
  12038. _.each(elements, function (item) {
  12039. var _a;
  12040. if (item.type === "listeners") {
  12041. var listeners = _this.currentComponentVJson.listeners;
  12042. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  12043. }
  12044. else if (item.type === "fix") {
  12045. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  12046. }
  12047. else if (item.type === "bind") {
  12048. var bind = _this.currentComponentVJson.bind;
  12049. if (typeof bind === 'string' && item.id === 'value') {
  12050. panel1Source[item.label] = bind;
  12051. }
  12052. else {
  12053. panel1Source[item.label] = bind ? bind[item.id] : '';
  12054. }
  12055. }
  12056. else {
  12057. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  12058. }
  12059. panel1Source[item.label] = panel1Source[item.label] || '';
  12060. panel1SourceConfig[item.label] = { editor: item.editor };
  12061. });
  12062. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  12063. },
  12064. getAllfuncs: function () {
  12065. var _a, _b;
  12066. var arr = (_b = (_a = handles$1.mainWindow.activeModulePage.refs) === null || _a === void 0 ? void 0 : _a.controllerEditor) === null || _b === void 0 ? void 0 : _b.funcArr;
  12067. var scopeFuncs = [];
  12068. _.forEach(arr, function (item) {
  12069. scopeFuncs.push({ name: "scope." + item.name });
  12070. });
  12071. return scopeFuncs;
  12072. }
  12073. });
  12074. }
  12075. //# sourceMappingURL=PropertyDesign.js.map
  12076. function initViewOutlineTree () {
  12077. Ext.define('com.yvan.studio.ViewOutlineTree', {
  12078. extend: 'Ext.tree.Panel',
  12079. xtype: 'viewoutlinetree',
  12080. name: "ViewOutlineTree",
  12081. tooltip: '设计大纲',
  12082. iconCls: 'x-fa fa-list',
  12083. rootVisible: false,
  12084. useArrows: true,
  12085. allowDeselect: true,
  12086. colspan: 2,
  12087. lines: false,
  12088. reference: 'viewoutlinetree',
  12089. multiSelect: true,
  12090. _saveStateFlag: true,
  12091. keyMapEnabled: true,
  12092. moduleId: null,
  12093. vjson: null,
  12094. columns: [
  12095. {
  12096. xtype: 'treecolumn',
  12097. text: '布局',
  12098. dataIndex: 'layoutNameDesc',
  12099. flex: 2,
  12100. sortable: true
  12101. }, {
  12102. text: '组件',
  12103. dataIndex: 'xtype',
  12104. flex: 1,
  12105. sortable: true,
  12106. align: 'center',
  12107. }
  12108. ],
  12109. listeners: {
  12110. itemcontextmenu: function (sender, node, element, idx, e) {
  12111. e.preventDefault();
  12112. this.rightClickTreeNode(sender, node, element, idx, e);
  12113. },
  12114. select: function (sender, node, index, e) {
  12115. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  12116. },
  12117. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  12118. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  12119. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  12120. }
  12121. }
  12122. },
  12123. initComponent: function () {
  12124. var _this = this;
  12125. setViewoutlinetree(this);
  12126. eventBus.subscribe(EventType.SetVjson, function (_a) {
  12127. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12128. return _this.setVjson(moduleId, from, ignoreRenderUI);
  12129. });
  12130. return this.superclass.initComponent.apply(this, arguments);
  12131. },
  12132. clear: function () {
  12133. this.setRootNode(null);
  12134. },
  12135. onChangModule: function (moduleId, oldModuleId, from) {
  12136. if (!moduleId || moduleId !== this.moduleId) {
  12137. return;
  12138. }
  12139. if (moduleStore.getModuleObject(moduleId)) {
  12140. this.setVjson(moduleId, from);
  12141. }
  12142. },
  12143. setVjson: function (moduleId, from, ignoreRenderUI) {
  12144. var _this = this;
  12145. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  12146. return;
  12147. }
  12148. this.moduleId = moduleId;
  12149. // if (from === this.name) {
  12150. // return
  12151. // }
  12152. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  12153. this.setTreeValue();
  12154. if (this.componentSelectionChangeSubscribe) {
  12155. this.componentSelectionChangeSubscribe.cancel();
  12156. this.componentSelectionChangeSubscribe = null;
  12157. }
  12158. if (this.setVjsonChangeSubscribe) {
  12159. this.setVjsonChangeSubscribe.cancel();
  12160. this.setVjsonChangeSubscribe = null;
  12161. }
  12162. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  12163. var id = _a.id, from = _a.from;
  12164. return _this.onComponentSelectionChange(id, from);
  12165. });
  12166. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  12167. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12168. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  12169. });
  12170. },
  12171. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  12172. if (!vjson || from === this.name) {
  12173. return;
  12174. }
  12175. this.vjson = vjson;
  12176. this.setTreeValue();
  12177. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  12178. if (id) {
  12179. this.selectPath(id);
  12180. }
  12181. },
  12182. onComponentSelectionChange: function (id, from) {
  12183. if (from !== this.name) {
  12184. if (id) {
  12185. this.selectPath(id);
  12186. }
  12187. else {
  12188. this.setTreeValue();
  12189. }
  12190. }
  12191. },
  12192. setTreeValue: function () {
  12193. var outlineVj = {};
  12194. _.forOwn(this.vjson, function (obj, key) {
  12195. if (key !== 'viewModel' && key !== 'store') {
  12196. outlineVj[key] = _.cloneDeep(obj);
  12197. }
  12198. });
  12199. getLayoutOutline(outlineVj);
  12200. this.setRootNode(outlineVj);
  12201. },
  12202. rightClickTreeNode: function (sender, node, element, idx, e) {
  12203. var raw = node.data;
  12204. var option = {};
  12205. // 右键
  12206. option = {
  12207. shadow: 'frame',
  12208. allowOtherMenus: true,
  12209. items: []
  12210. };
  12211. var switchType = raw.layoutName;
  12212. if (raw.layoutName === 'north' ||
  12213. raw.layoutName === 'south' ||
  12214. raw.layoutName === 'west' ||
  12215. raw.layoutName === 'east' ||
  12216. raw.layoutName === 'center' ||
  12217. raw.layoutName === 'tbar' ||
  12218. raw.layoutName === 'fbar') {
  12219. switchType = raw.xtype || raw.layout;
  12220. }
  12221. var itemArr = [];
  12222. var hasTbar = false, hasFbar = false, hasBody = false;
  12223. if (raw.hasOwnProperty("children")) {
  12224. _.forEach(raw.children, function (value) {
  12225. if (value.layoutName === 'tbar') {
  12226. hasTbar = true;
  12227. }
  12228. else if (value.layoutName === 'fbar') {
  12229. hasFbar = true;
  12230. }
  12231. else {
  12232. hasBody = true;
  12233. }
  12234. });
  12235. }
  12236. switch (switchType) {
  12237. case 'fit':
  12238. if (!hasTbar) {
  12239. itemArr.push('tbar');
  12240. }
  12241. if (!hasFbar) {
  12242. itemArr.push('fbar');
  12243. }
  12244. if (!hasBody) {
  12245. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12246. }
  12247. option.items = this.menuNew(itemArr, raw);
  12248. break;
  12249. case 'border':
  12250. if (!hasTbar) {
  12251. itemArr.push('tbar');
  12252. }
  12253. if (!hasFbar) {
  12254. itemArr.push('fbar');
  12255. }
  12256. itemArr.push('cnsew');
  12257. option.items = this.menuNew(itemArr, raw);
  12258. break;
  12259. // case 'tbar':
  12260. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  12261. // break;
  12262. // case 'fbar':
  12263. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  12264. // break;
  12265. case 'tabpanel':
  12266. if (!hasTbar) {
  12267. itemArr.push('tbar');
  12268. }
  12269. if (!hasFbar) {
  12270. itemArr.push('fbar');
  12271. }
  12272. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12273. option.items = this.menuNew(itemArr, raw);
  12274. break;
  12275. case 'yvgrid':
  12276. if (!hasTbar) {
  12277. itemArr.push('tbar');
  12278. }
  12279. option.items = this.menuNew(itemArr, raw);
  12280. break;
  12281. case 'tree':
  12282. if (!hasTbar) {
  12283. itemArr.push('tbar');
  12284. }
  12285. if (!hasFbar) {
  12286. itemArr.push('fbar');
  12287. }
  12288. option.items = this.menuNew(itemArr, raw);
  12289. break;
  12290. case 'fieldset':
  12291. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  12292. break;
  12293. case 'form':
  12294. if (!hasTbar) {
  12295. itemArr.push('tbar');
  12296. }
  12297. if (!hasFbar) {
  12298. itemArr.push('fbar');
  12299. }
  12300. itemArr.push('form', 'fieldset', 'cols');
  12301. option.items = this.menuNew(itemArr, raw);
  12302. break;
  12303. case 'toolbar':
  12304. itemArr.push('button', 'textfield', 'label', 'combo');
  12305. option.items = this.menuNew(itemArr, raw);
  12306. break;
  12307. // case 'fbar':
  12308. // itemArr.push('button', 'textfield', 'label', 'combo')
  12309. // option.items = this.menuNew(itemArr, raw)
  12310. // break
  12311. default:
  12312. option.items = this.menuNew(itemArr, raw);
  12313. break;
  12314. }
  12315. var treeMenu = new Ext.menu.Menu(option);
  12316. treeMenu.showAt(e.getXY());
  12317. },
  12318. newItem: function (viewType, raw, region) {
  12319. var itemVjson = {};
  12320. switch (viewType) {
  12321. case 'fit':
  12322. itemVjson.layout = 'fit';
  12323. itemVjson.items = [];
  12324. break;
  12325. case 'border':
  12326. itemVjson.layout = 'border';
  12327. itemVjson.items = [];
  12328. break;
  12329. case 'toolbar':
  12330. itemVjson.xtype = 'toolbar';
  12331. itemVjson.title = 'toolbar';
  12332. itemVjson.items = [
  12333. {
  12334. xtype: 'button',
  12335. text: 'button'
  12336. }
  12337. ];
  12338. break;
  12339. case 'tabpanel':
  12340. itemVjson.xtype = 'tabpanel';
  12341. itemVjson.layout = 'fit';
  12342. itemVjson.items = [];
  12343. break;
  12344. case 'yvgrid':
  12345. itemVjson.xtype = 'yvgrid';
  12346. itemVjson.layout = 'fit';
  12347. itemVjson.pagination = false;
  12348. itemVjson.columns = [
  12349. {
  12350. dataIndex: "skuId",
  12351. header: "SKU_ID",
  12352. },
  12353. ];
  12354. break;
  12355. case 'tree':
  12356. itemVjson.xtype = 'treepanel';
  12357. itemVjson.layout = 'fit';
  12358. break;
  12359. case 'fieldset':
  12360. case 'form':
  12361. itemVjson.xtype = viewType;
  12362. itemVjson.title = viewType;
  12363. itemVjson.items = [
  12364. {
  12365. xtype: 'cols',
  12366. items: [
  12367. {
  12368. xtype: 'textfield',
  12369. fieldLabel: '输入框'
  12370. }
  12371. ]
  12372. }
  12373. ];
  12374. break;
  12375. case 'cols':
  12376. itemVjson.xtype = 'cols';
  12377. itemVjson.items = [
  12378. {
  12379. xtype: 'textfield',
  12380. fieldLabel: '输入框'
  12381. }
  12382. ];
  12383. break;
  12384. case 'button':
  12385. itemVjson.xtype = 'button';
  12386. itemVjson.text = '按钮';
  12387. itemVjson.iconCls = 'x-fa fa-plus';
  12388. break;
  12389. case 'textfield':
  12390. itemVjson.xtype = 'textfield';
  12391. itemVjson.fieldLabel = '输入框';
  12392. break;
  12393. case 'combo':
  12394. itemVjson.xtype = 'combo';
  12395. itemVjson.fieldLabel = '下拉框';
  12396. break;
  12397. case 'label':
  12398. itemVjson.xtype = 'label';
  12399. itemVjson.text = '文本';
  12400. break;
  12401. }
  12402. var target = findInCode(this.vjson, raw.id);
  12403. if (region) {
  12404. if (region === 'tbar' || region === 'fbar') {
  12405. target[region] = itemVjson;
  12406. }
  12407. else {
  12408. itemVjson.region = region;
  12409. itemVjson.split = true;
  12410. if (region === 'north' || region === 'south') {
  12411. itemVjson.height = '30%';
  12412. itemVjson.collapsible = true;
  12413. }
  12414. else if (region === 'west' || region === 'east') {
  12415. itemVjson.width = '30%';
  12416. itemVjson.collapsible = true;
  12417. }
  12418. target.items.push(itemVjson);
  12419. }
  12420. }
  12421. else {
  12422. if (target.xtype === 'tabpanel') {
  12423. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  12424. }
  12425. target.items.push(itemVjson);
  12426. }
  12427. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12428. },
  12429. menuNew: function (typeArr, raw, region) {
  12430. var that = this;
  12431. var reArr = [];
  12432. typeArr.forEach(function (value) {
  12433. if (value === 'cnsew') {
  12434. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  12435. }
  12436. else if (value === 'tbar' || value === 'fbar') {
  12437. reArr.push(that.menuNewTFBar(value, raw));
  12438. }
  12439. else {
  12440. reArr.push({
  12441. text: '新建' + layoutOrXtypeNameMap[value],
  12442. iconCls: 'x-fa fa-plus',
  12443. handler: function (sender) {
  12444. that.newItem(value, raw, region);
  12445. }
  12446. });
  12447. }
  12448. reArr.push("-");
  12449. });
  12450. if (region) {
  12451. reArr.pop();
  12452. return reArr;
  12453. }
  12454. reArr.push({
  12455. text: '高级属性',
  12456. iconCls: 'x-fa fa-cog',
  12457. handler: function (sender) {
  12458. var vj = findInCode(that.vjson, raw.id);
  12459. that.advancedSettingWindow(vj);
  12460. }
  12461. }, {
  12462. text: '上移',
  12463. iconCls: 'x-fa fa-trash',
  12464. handler: function (sender) {
  12465. that.moveCmp(raw.id, 'up');
  12466. }
  12467. }, {
  12468. text: '置顶',
  12469. iconCls: 'x-fa fa-trash',
  12470. handler: function (sender) {
  12471. that.moveCmp(raw.id, 'top');
  12472. }
  12473. }, {
  12474. text: '置底',
  12475. iconCls: 'x-fa fa-trash',
  12476. handler: function (sender) {
  12477. that.moveCmp(raw.id, 'bottom');
  12478. }
  12479. }, {
  12480. text: '下移',
  12481. iconCls: 'x-fa fa-trash',
  12482. handler: function (sender) {
  12483. that.moveCmp(raw.id, 'down');
  12484. }
  12485. }, {
  12486. text: '删除',
  12487. iconCls: 'x-fa fa-trash',
  12488. handler: function (sender) {
  12489. deletVjsonById(that.vjson, raw.id);
  12490. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  12491. }
  12492. });
  12493. return reArr;
  12494. },
  12495. menuNewCNSEW: function (raw) {
  12496. var that = this;
  12497. var arr = ['center', 'north', 'south', 'west', 'east'];
  12498. if (raw.hasOwnProperty("children")) {
  12499. _.forEach(raw.children, function (value) {
  12500. _.remove(arr, function (it) {
  12501. return it === value.layoutName;
  12502. });
  12503. });
  12504. }
  12505. var reArr = [];
  12506. arr.forEach(function (value) {
  12507. reArr.push({
  12508. text: layoutOrXtypeNameMap[value],
  12509. iconCls: 'x-fa fa-plus',
  12510. menu: {
  12511. showSeparator: true,
  12512. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  12513. }
  12514. });
  12515. reArr.push("-");
  12516. });
  12517. reArr.pop();
  12518. return reArr;
  12519. },
  12520. menuNewTFBar: function (barType, raw) {
  12521. var that = this;
  12522. var reObj = {
  12523. text: layoutOrXtypeNameMap[barType],
  12524. iconCls: 'x-fa fa-plus',
  12525. menu: {
  12526. showSeparator: true,
  12527. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  12528. }
  12529. };
  12530. return reObj;
  12531. },
  12532. moveCmp: function (id, moveType) {
  12533. var arr = findArrayContainer(this.vjson, id);
  12534. var index = _.findIndex(arr, function (v) { return v.id === id; });
  12535. if (index < 0) {
  12536. return;
  12537. }
  12538. switch (moveType) {
  12539. case 'up':
  12540. if (index > 0) {
  12541. var o = arr[index];
  12542. arr[index] = arr[index - 1];
  12543. arr[index - 1] = o;
  12544. }
  12545. else {
  12546. return;
  12547. }
  12548. break;
  12549. case 'down':
  12550. if (index < arr.length - 1) {
  12551. var o = arr[index];
  12552. arr[index] = arr[index + 1];
  12553. arr[index + 1] = o;
  12554. }
  12555. else {
  12556. return;
  12557. }
  12558. break;
  12559. case 'top':
  12560. if (index > 0) {
  12561. var o = arr[index];
  12562. arr[index] = arr[0];
  12563. arr[0] = o;
  12564. }
  12565. else {
  12566. return;
  12567. }
  12568. break;
  12569. case 'bottom':
  12570. if (index < arr.length - 1) {
  12571. var o = arr[index];
  12572. arr[index] = arr[arr.length - 1];
  12573. arr[arr.length - 1] = o;
  12574. }
  12575. else {
  12576. return;
  12577. }
  12578. break;
  12579. }
  12580. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12581. }
  12582. });
  12583. }
  12584. //# sourceMappingURL=ViewOutlineTree.js.map
  12585. // 字段域数据
  12586. var columnDomain = undefined;
  12587. var DomainStore = /** @class */ (function (_super) {
  12588. __extends(DomainStore, _super);
  12589. function DomainStore() {
  12590. return _super !== null && _super.apply(this, arguments) || this;
  12591. }
  12592. DomainStore.prototype.getCacheKey = function (param) {
  12593. return "domain_data.json";
  12594. };
  12595. DomainStore.prototype.invokeApi = function (param) {
  12596. return getColumnDomainApi();
  12597. };
  12598. /**
  12599. * 设置全局可访问的 字段域数据
  12600. */
  12601. DomainStore.prototype.getColumnDomainComboData = function () {
  12602. var _this = this;
  12603. return new Promise(function (resolve) {
  12604. _this.reloadIfNeedPromise(undefined).then(function (res) {
  12605. resolve(_this.apiResponse.data.map(function (v) {
  12606. return { id: v.domain_id, text: v.domain_name };
  12607. }));
  12608. });
  12609. });
  12610. };
  12611. /**
  12612. * 设置全局可访问的 字段域数据
  12613. */
  12614. DomainStore.prototype.getColumnDomainById = function (value) {
  12615. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  12616. };
  12617. DomainStore.prototype.getAllDomain = function () {
  12618. return new Promise(function (resolve, reject) {
  12619. getColumnDomainApi()
  12620. .then(function (res) {
  12621. if (res.success) {
  12622. if (res.success) {
  12623. var tt = _$2.map(res.data, function (row) {
  12624. return {
  12625. text: row.domain_name,
  12626. id: row.domain_id,
  12627. };
  12628. });
  12629. _$2.set(window, 'DICT_CACHE.column_domain', tt);
  12630. }
  12631. columnDomain = res.data;
  12632. resolve(res.data);
  12633. }
  12634. else {
  12635. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  12636. console.error('getColumnDomain', res.msg);
  12637. }
  12638. })
  12639. .catch(function (e) {
  12640. window['showErrorDialog']('getColumnDomain error!');
  12641. console.error('getColumnDomain', e);
  12642. reject(e);
  12643. });
  12644. });
  12645. };
  12646. return DomainStore;
  12647. }(CacheStore));
  12648. var instance$3 = new DomainStore();
  12649. //# sourceMappingURL=DomainStore.js.map
  12650. function init$1 () {
  12651. window['native'] = native;
  12652. native.init();
  12653. init();
  12654. instance$3.getAllDomain().finally(function () {
  12655. });
  12656. initStateTree();
  12657. initDashboard();
  12658. initFileTree();
  12659. initDbTree();
  12660. initReportGrid();
  12661. initGroovyEditor();
  12662. initJsEditor();
  12663. initJsonEditor();
  12664. initSqlEditor();
  12665. initTemplateEditor();
  12666. initDict();
  12667. initBpmnTree();
  12668. initToolBox();
  12669. initPropertyDesign();
  12670. initViewOutlineTree();
  12671. initWidget();
  12672. initWhLayout();
  12673. initApiTree();
  12674. initTaskTree();
  12675. initLogsTree();
  12676. initDevOpsTree();
  12677. initTerminal();
  12678. initMonitorTree();
  12679. initHomeTree();
  12680. }
  12681. //# sourceMappingURL=init.js.map
  12682. var model$c = {
  12683. data: {
  12684. leftTabTitle: ''
  12685. }
  12686. };
  12687. //# sourceMappingURL=Workbench.model.js.map
  12688. var vjson$c = {
  12689. frame: false,
  12690. layout: 'border',
  12691. width: '100%',
  12692. height: '100%',
  12693. border: false,
  12694. defaults: {
  12695. border: false
  12696. },
  12697. items: [
  12698. {
  12699. region: 'north',
  12700. height: 60,
  12701. cls: 'main-header',
  12702. reference: 'mainTop',
  12703. layout: 'hbox',
  12704. items: [
  12705. {
  12706. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  12707. flex: 1,
  12708. border: false
  12709. },
  12710. {
  12711. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  12712. menu: [
  12713. {
  12714. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  12715. reference: 'commonSetting'
  12716. },
  12717. {
  12718. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  12719. listeners: {
  12720. // click: 'scope.ready_api_click'
  12721. }
  12722. },
  12723. ]
  12724. },
  12725. {
  12726. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  12727. cls: 'header-menu',
  12728. menu: [
  12729. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  12730. ]
  12731. },
  12732. ]
  12733. },
  12734. {
  12735. region: 'west',
  12736. bind: {
  12737. title: '{leftTabTitle}',
  12738. },
  12739. titleAlign: 'center',
  12740. border: true, split: true, width: 340, collapsible: true,
  12741. reference: 'leftTab',
  12742. xtype: 'tabpanel',
  12743. tabPosition: 'left',
  12744. tabRotation: 0,
  12745. tabBar: {
  12746. border: false
  12747. },
  12748. listeners: {
  12749. tabchange: 'scope.leftTabChange',
  12750. },
  12751. items: [
  12752. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  12753. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  12754. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  12755. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  12756. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  12757. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  12758. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  12759. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  12760. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  12761. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  12762. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  12763. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  12764. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  12765. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  12766. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  12767. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  12768. ]
  12769. },
  12770. {
  12771. region: 'east',
  12772. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  12773. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  12774. },
  12775. {
  12776. region: 'center',
  12777. split: true, border: true,
  12778. xtype: 'maintab', reference: 'tt', id: 'TT',
  12779. plain: true,
  12780. listeners: {
  12781. restorypage: 'scope.openScope',
  12782. tabchange: 'scope.tabchange'
  12783. },
  12784. items: []
  12785. },
  12786. ],
  12787. };
  12788. //# sourceMappingURL=Workbench.view.js.map
  12789. var model$d = {
  12790. data: {
  12791. dataSync_isStart: false,
  12792. dataSync: {
  12793. skipError: false,
  12794. clearData: false,
  12795. tables: []
  12796. },
  12797. dataSyncResult: {
  12798. jobId: ''
  12799. },
  12800. dataSource1: '',
  12801. dataSource2: '',
  12802. schema1: '',
  12803. schema2: '',
  12804. hasDiff: false,
  12805. }
  12806. };
  12807. //# sourceMappingURL=DbSync.model.js.map
  12808. var vjson$d = {
  12809. title: '数据库同步',
  12810. layout: 'fit',
  12811. items: [
  12812. {
  12813. reference: 'wizard1',
  12814. layout: 'card',
  12815. items: [
  12816. {
  12817. reference: 'first',
  12818. layout: 'fit',
  12819. bbar: [
  12820. '->',
  12821. {
  12822. xtype: 'button',
  12823. iconCls: 'x-fa fa-road',
  12824. text: '结构同步 &raquo;',
  12825. bind: {
  12826. disabled: '{!hasDiff}'
  12827. },
  12828. listeners: {
  12829. click: 'scope.structCopyTo',
  12830. }
  12831. },
  12832. {
  12833. xtype: 'button',
  12834. iconCls: 'x-fa fa-files-o',
  12835. text: '数据同步 &raquo;',
  12836. bind: {
  12837. disabled: '{!hasDiff}'
  12838. },
  12839. listeners: {
  12840. click: 'scope.dataCopyTo',
  12841. }
  12842. },
  12843. {
  12844. xtype: 'button',
  12845. iconCls: 'x-fa fa-sort-alpha-desc',
  12846. text: '索引同步 &raquo;',
  12847. bind: {
  12848. disabled: '{!hasDiff}'
  12849. },
  12850. listeners: {
  12851. click: 'scope.indexCopyTo',
  12852. }
  12853. },
  12854. {
  12855. xtype: 'button',
  12856. iconCls: 'x-fa fa-product-hunt',
  12857. text: '存储过程同步 &raquo;',
  12858. bind: {
  12859. disabled: '{!hasDiff}'
  12860. },
  12861. listeners: {
  12862. click: 'scope.procedureCopyTo',
  12863. }
  12864. },
  12865. ],
  12866. items: [
  12867. {
  12868. title: '数据库对比',
  12869. reference: 'grid1',
  12870. xtype: 'yvgrid',
  12871. pagination: false,
  12872. border: false,
  12873. cellTip: true,
  12874. selModel: {
  12875. type: 'checkboxmodel',
  12876. mode: 'MULTI',
  12877. },
  12878. tbar: {
  12879. xtype: 'toolbar',
  12880. items: [
  12881. {
  12882. xtype: 'combo',
  12883. fieldLabel: '源数据库',
  12884. bind: {
  12885. value: '{dataSource1}'
  12886. },
  12887. dataSource: 'scope.getDataBaseName'
  12888. },
  12889. {
  12890. xtype: 'combo',
  12891. fieldLabel: '目标数据库',
  12892. bind: {
  12893. value: '{dataSource2}'
  12894. },
  12895. dataSource: 'scope.getDataBaseName'
  12896. },
  12897. {
  12898. xtype: 'button',
  12899. iconCls: 'x-fa fa-flash',
  12900. text: '对比',
  12901. bind: {
  12902. disabled: '{!dataSource1 || !dataSource2}'
  12903. },
  12904. listeners: {
  12905. click: 'scope.diff',
  12906. }
  12907. },
  12908. {
  12909. xtype: 'button',
  12910. iconCls: 'x-fa fa-cloud-download',
  12911. text: '重新拉取结构(耗时!)',
  12912. bind: {
  12913. disabled: '{!dataSource1 || !dataSource2}'
  12914. },
  12915. listeners: {
  12916. click: 'scope.dbToMeta',
  12917. }
  12918. },
  12919. ]
  12920. },
  12921. columns: [
  12922. {
  12923. dataIndex: 'table_name1',
  12924. header: '源表',
  12925. width: 300,
  12926. },
  12927. {
  12928. dataIndex: 'table_name2',
  12929. header: '目标表',
  12930. width: 300,
  12931. },
  12932. {
  12933. dataIndex: 'diff',
  12934. header: '对比结果',
  12935. width: 100,
  12936. },
  12937. {
  12938. xtype: 'actioncolumn',
  12939. width: 30,
  12940. sortable: false,
  12941. menuDisabled: true,
  12942. items: [
  12943. {
  12944. iconCls: 'x-fa fa-bars',
  12945. text: '打开',
  12946. handler: 'scope.showDetail',
  12947. }
  12948. ]
  12949. },
  12950. {
  12951. dataIndex: 'remark',
  12952. header: '详情',
  12953. width: 200,
  12954. sortable: true,
  12955. },
  12956. ],
  12957. },
  12958. ]
  12959. },
  12960. {
  12961. reference: 'ddl',
  12962. layout: {
  12963. type: 'vbox',
  12964. pack: 'start',
  12965. align: 'stretch'
  12966. },
  12967. items: [
  12968. {
  12969. xtype: 'sqleditor',
  12970. reference: 'ddleditor',
  12971. flex: 1,
  12972. },
  12973. {
  12974. xtype: 'toolbar',
  12975. items: [
  12976. '->',
  12977. {
  12978. xtype: 'button',
  12979. text: '&laquo; 上一步',
  12980. listeners: {
  12981. click: 'scope.back'
  12982. }
  12983. },
  12984. {
  12985. xtype: 'button',
  12986. iconCls: 'x-fa fa-flash',
  12987. text: '执行',
  12988. listeners: {
  12989. click: 'scope.executeDDL'
  12990. }
  12991. },
  12992. ]
  12993. }
  12994. ]
  12995. },
  12996. {
  12997. reference: 'ddl_idx',
  12998. layout: {
  12999. type: 'vbox',
  13000. pack: 'start',
  13001. align: 'stretch'
  13002. },
  13003. items: [
  13004. {
  13005. xtype: 'sqleditor',
  13006. reference: 'ddleditor_idx',
  13007. flex: 1,
  13008. },
  13009. {
  13010. xtype: 'toolbar',
  13011. items: [
  13012. '->',
  13013. {
  13014. xtype: 'button',
  13015. text: '&laquo; 上一步',
  13016. listeners: {
  13017. click: 'scope.back'
  13018. }
  13019. },
  13020. {
  13021. xtype: 'button',
  13022. iconCls: 'x-fa fa-flash',
  13023. text: '执行',
  13024. listeners: {
  13025. click: 'scope.executeDDLIdx'
  13026. }
  13027. },
  13028. ]
  13029. }
  13030. ]
  13031. },
  13032. {
  13033. reference: 'ddl_procedure',
  13034. layout: {
  13035. type: 'vbox',
  13036. pack: 'start',
  13037. align: 'stretch'
  13038. },
  13039. items: [
  13040. {
  13041. xtype: 'sqleditor',
  13042. reference: 'ddleditor_procedure',
  13043. flex: 1,
  13044. },
  13045. {
  13046. xtype: 'toolbar',
  13047. items: [
  13048. '->',
  13049. {
  13050. xtype: 'button',
  13051. text: '&laquo; 上一步',
  13052. listeners: {
  13053. click: 'scope.back'
  13054. }
  13055. },
  13056. {
  13057. xtype: 'button',
  13058. iconCls: 'x-fa fa-flash',
  13059. text: '执行',
  13060. listeners: {
  13061. click: 'scope.executeProcedureSQL'
  13062. }
  13063. },
  13064. ]
  13065. }
  13066. ]
  13067. },
  13068. {
  13069. reference: 'datacopy',
  13070. xtype: 'yvgrid',
  13071. pagination: false,
  13072. tbar: {
  13073. xtype: 'toolbar',
  13074. items: [
  13075. {
  13076. xtype: 'checkbox',
  13077. fieldLabel: '忽略错误',
  13078. bind: {
  13079. value: '{dataSync.skipError}'
  13080. },
  13081. },
  13082. {
  13083. xtype: 'checkbox',
  13084. fieldLabel: '清空数据',
  13085. bind: {
  13086. value: '{dataSync.clearData}'
  13087. },
  13088. },
  13089. {
  13090. xtype: 'button',
  13091. iconCls: 'x-fa fa-play-circle',
  13092. text: '开始',
  13093. bind: {
  13094. disabled: '{dataSync_isStart}'
  13095. },
  13096. listeners: { click: 'scope.dataSync_start' }
  13097. },
  13098. {
  13099. xtype: 'button',
  13100. iconCls: 'x-fa fa-stop-circle',
  13101. text: '停止',
  13102. bind: {
  13103. disabled: '{!dataSync_isStart}'
  13104. },
  13105. listeners: { click: 'scope.dataSync_stop' }
  13106. },
  13107. ]
  13108. },
  13109. columns: [
  13110. {
  13111. dataIndex: 'tableName', header: '表名',
  13112. width: 300,
  13113. },
  13114. {
  13115. dataIndex: 'dataCount', header: '总记录数',
  13116. width: 150,
  13117. },
  13118. {
  13119. dataIndex: 'currentIdx', header: '当前记录数',
  13120. width: 150,
  13121. },
  13122. {
  13123. dataIndex: 'syncCount', header: '同步数',
  13124. width: 150,
  13125. },
  13126. {
  13127. dataIndex: 'deleteCount', header: '删除',
  13128. width: 150,
  13129. },
  13130. {
  13131. dataIndex: 'syncProgress', header: '进度',
  13132. width: 150, dataType: 'int', formatter: 'percentRenderer'
  13133. },
  13134. ]
  13135. }
  13136. ]
  13137. }
  13138. ]
  13139. };
  13140. //# sourceMappingURL=DbSync.view.js.map
  13141. /**
  13142. * 对比两个列 是否存在不一致
  13143. */
  13144. function compareColumn(t1, c1, t2, c2) {
  13145. if (typeof c2 === 'undefined') {
  13146. return 'column_name';
  13147. }
  13148. if (c1.column_name !== c2.column_name) {
  13149. return 'column_name';
  13150. }
  13151. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  13152. return 'default_value';
  13153. }
  13154. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  13155. return 'column_comment';
  13156. }
  13157. if (c1.is_primary_key !== c2.is_primary_key) {
  13158. return 'is_primary_key';
  13159. }
  13160. if (c1.not_null !== c2.not_null) {
  13161. return 'not_null';
  13162. }
  13163. var symbol1 = getDataTypeSymbol(t1, c1);
  13164. var symbol2 = getDataTypeSymbol(t2, c2);
  13165. if (symbol1 !== symbol2) {
  13166. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13167. return 'data_type';
  13168. }
  13169. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13170. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  13171. // 只关注长度
  13172. if (c1.column_size != c2.column_size) {
  13173. return 'column_size';
  13174. }
  13175. }
  13176. else {
  13177. // 其他情况,长度和精度都要关注
  13178. if (c1.column_size != c2.column_size) {
  13179. return 'column_size';
  13180. }
  13181. if (c1.decimal_digits !== c2.decimal_digits) {
  13182. return 'decimal_digits';
  13183. }
  13184. }
  13185. }
  13186. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  13187. var symbol1 = getDataTypeSymbol(tableInfo, column);
  13188. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  13189. if (symbol1 !== symbol2) {
  13190. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13191. return 'data_type';
  13192. }
  13193. if (is_fix_size) {
  13194. // 字段域吧大小限制住了
  13195. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13196. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  13197. // 只关注长度
  13198. if (column.column_size != domain.column_size) {
  13199. return 'column_size';
  13200. }
  13201. }
  13202. else {
  13203. // 其他情况,长度和精度都要关注
  13204. if (column.column_size != domain.column_size) {
  13205. return 'column_size';
  13206. }
  13207. if (column.decimal_digits !== domain.decimal_digits) {
  13208. return 'decimal_digits';
  13209. }
  13210. }
  13211. }
  13212. }
  13213. function checkColumn(table, col) {
  13214. if (isEmpty(col.column_name)) {
  13215. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  13216. }
  13217. if (isKeyword(col.column_name)) {
  13218. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  13219. }
  13220. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  13221. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  13222. }
  13223. return undefined;
  13224. }
  13225. function applyDomain(dbType, domain) {
  13226. var editRow = {
  13227. data_type: domain[dbType + '_datatype'],
  13228. };
  13229. domain = _$2.cloneDeep(domain);
  13230. if (!editRow.data_type) {
  13231. throw Error('字段域没有定义数据类型!');
  13232. }
  13233. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  13234. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  13235. if (match) {
  13236. // 类型里面包含括号
  13237. var sz = parseInt(match[2]);
  13238. if (isNaN(sz)) {
  13239. throw Error('字段域的定义错误:' + editRow.data_type);
  13240. }
  13241. domain.is_fix_size = true;
  13242. editRow.data_type = match[1];
  13243. domain.column_size = sz;
  13244. domain.decimal_digits = 0;
  13245. }
  13246. else {
  13247. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  13248. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  13249. if (match2) {
  13250. // 类型里面包含括号
  13251. var sz = parseInt(match2[2]);
  13252. if (isNaN(sz)) {
  13253. throw Error('字段域的定义错误:' + editRow.data_type);
  13254. }
  13255. var dg = parseInt(match2[3]);
  13256. if (isNaN(dg)) {
  13257. throw Error('字段域的定义错误:' + editRow.data_type);
  13258. }
  13259. domain.is_fix_size = true;
  13260. editRow.data_type = match[1];
  13261. domain.column_size = sz;
  13262. domain.decimal_digits = dg;
  13263. }
  13264. }
  13265. if (domain.domain_column_ui) {
  13266. _$2.extend(editRow, {
  13267. column_ui: domain.domain_column_ui,
  13268. });
  13269. }
  13270. if (domain.domain_column_dict) {
  13271. _$2.extend(editRow, {
  13272. column_dict: domain.domain_column_dict,
  13273. });
  13274. }
  13275. if (domain.is_fix_size) {
  13276. _$2.extend(editRow, {
  13277. column_size: domain.column_size,
  13278. decimal_digits: domain.decimal_digits
  13279. });
  13280. }
  13281. if (domain.is_fix_default_value) {
  13282. _$2.extend(editRow, {
  13283. default_value: domain.default_value,
  13284. });
  13285. }
  13286. return editRow;
  13287. }
  13288. /**
  13289. * 获取字段类型代号(用于做跨数据库数据类型对比)
  13290. */
  13291. function getDataTypeSymbol(table, col) {
  13292. if (table.db_type === 'oracle') {
  13293. switch (col.data_type) {
  13294. case 'number':
  13295. if (col.column_size <= 10 && !col.decimal_digits) {
  13296. return 'integer';
  13297. }
  13298. else if (col.column_size <= 19 && !col.decimal_digits) {
  13299. return 'long';
  13300. }
  13301. return 'bigdecimal';
  13302. case 'char':
  13303. if (col.column_size > 3000) {
  13304. return 'clob';
  13305. }
  13306. return 'char';
  13307. case 'integer':
  13308. return 'integer';
  13309. case 'varchar':
  13310. case 'varchar2':
  13311. if (col.column_size > 3000) {
  13312. return 'clob';
  13313. }
  13314. return 'varchar';
  13315. case 'clob':
  13316. return 'clob';
  13317. case 'blob':
  13318. return 'blob';
  13319. case 'date':
  13320. case 'timestamp':
  13321. case 'timestamp(6)':
  13322. case 'timestamp with local time zone':
  13323. case 'timestamp(6) with local time zone':
  13324. case 'timestamp(6) with time zone':
  13325. return 'timestamp';
  13326. }
  13327. return "undefined";
  13328. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  13329. }
  13330. if (table.db_type === 'pgsql') {
  13331. switch (col.data_type) {
  13332. case 'int4':
  13333. return 'integer';
  13334. case 'int8':
  13335. return 'long';
  13336. case 'char':
  13337. return 'char';
  13338. case 'varchar':
  13339. case 'varchar2':
  13340. if (col.column_size > 3000) {
  13341. return 'clob';
  13342. }
  13343. return 'varchar';
  13344. case 'numeric':
  13345. if (col.column_size <= 10 && !col.decimal_digits) {
  13346. return 'integer';
  13347. }
  13348. else if (col.column_size <= 19 && !col.decimal_digits) {
  13349. return 'long';
  13350. }
  13351. return 'bigdecimal';
  13352. case 'timestamp':
  13353. case 'timestamptz':
  13354. return 'timestamp';
  13355. case 'bytea':
  13356. return 'blob';
  13357. }
  13358. return "undefined";
  13359. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  13360. }
  13361. throw Error('未知数据库类型:' + table.db_type);
  13362. }
  13363. /**
  13364. * 判断对象名称是不是数据库关键字(保留字)
  13365. */
  13366. function isKeyword(word) {
  13367. if (!word || typeof word !== 'string') {
  13368. return false;
  13369. }
  13370. var kk = ['access',
  13371. 'add',
  13372. 'all',
  13373. 'alter',
  13374. 'and',
  13375. 'any',
  13376. 'as',
  13377. 'asc',
  13378. 'audit',
  13379. 'between',
  13380. 'by',
  13381. 'char',
  13382. 'check',
  13383. 'cluster',
  13384. 'column',
  13385. 'comment',
  13386. 'compress',
  13387. 'connect',
  13388. 'create',
  13389. 'current',
  13390. 'date',
  13391. 'decimal',
  13392. 'default',
  13393. 'delete',
  13394. 'desc',
  13395. 'distinct',
  13396. 'drop',
  13397. 'else',
  13398. 'exclusive',
  13399. 'exists',
  13400. 'file',
  13401. 'float',
  13402. 'for',
  13403. 'from',
  13404. 'grant',
  13405. 'group',
  13406. 'having',
  13407. 'identified',
  13408. 'immediate',
  13409. 'in',
  13410. 'increment',
  13411. 'index',
  13412. 'initial',
  13413. 'insert',
  13414. 'integer',
  13415. 'intersect',
  13416. 'into',
  13417. 'is',
  13418. 'level',
  13419. 'like',
  13420. 'lock',
  13421. 'long',
  13422. 'maxextents',
  13423. 'minus',
  13424. 'mlslabel',
  13425. 'mode',
  13426. 'modify',
  13427. 'noaudit',
  13428. 'nocompress',
  13429. 'not',
  13430. 'nowait',
  13431. 'null',
  13432. 'number',
  13433. 'of',
  13434. 'offline',
  13435. 'on',
  13436. 'online',
  13437. 'option',
  13438. 'or',
  13439. 'order',
  13440. 'p',
  13441. 'ctfree',
  13442. 'prior',
  13443. 'privileges',
  13444. 'public',
  13445. 'raw',
  13446. 'rename',
  13447. 'resource',
  13448. 'revoke',
  13449. 'row',
  13450. 'rowid',
  13451. 'rownum',
  13452. 'rows',
  13453. 'select',
  13454. 'session',
  13455. 'set',
  13456. 'share',
  13457. 'size',
  13458. 'smallint',
  13459. 'start',
  13460. 'successful',
  13461. 'synonym',
  13462. 'sysdate',
  13463. 'table',
  13464. 'then',
  13465. 'to',
  13466. 'trigger',
  13467. 'uid',
  13468. 'union',
  13469. 'unique',
  13470. 'update',
  13471. 'user',
  13472. 'validate',
  13473. 'values',
  13474. 'varchar',
  13475. 'varchar2',
  13476. 'view',
  13477. 'whenever',
  13478. 'where',
  13479. 'with'];
  13480. return _$2.includes(kk, word.toLowerCase());
  13481. }
  13482. //# sourceMappingURL=DbUtils.js.map
  13483. var DbSync = /** @class */ (function (_super) {
  13484. __extends(DbSync, _super);
  13485. function DbSync() {
  13486. return _super.call(this, { model: model$d, vjson: vjson$d }) || this;
  13487. }
  13488. DbSync.prototype.onLoad = function () {
  13489. };
  13490. DbSync.prototype.getDataBaseName = function (sender, _a) {
  13491. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  13492. getDataBaseNameApi().then(function (res) {
  13493. successCallback(res.data.map(function (name) {
  13494. return {
  13495. id: name, text: name
  13496. };
  13497. }));
  13498. });
  13499. };
  13500. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  13501. showInfoDialog(record.get('remark'));
  13502. };
  13503. DbSync.prototype.diff = function () {
  13504. var _this = this;
  13505. var promise1 = getMateData({
  13506. datasource: this.viewModel.get('dataSource1')
  13507. });
  13508. var promise2 = getMateData({
  13509. datasource: this.viewModel.get('dataSource2')
  13510. });
  13511. this.viewModel.set('schema1', '');
  13512. this.viewModel.set('schema2', '');
  13513. this.refs.grid1.setLoading(true);
  13514. Promise.all([promise1, promise2]).then(function (_a) {
  13515. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13516. var rows = [];
  13517. if (_$2.size(res1) > 0) {
  13518. // res1 起码有一个 schema
  13519. _this.viewModel.set('schema1', res1[0].schema_name);
  13520. _this.viewModel.set('schema2', res2[0].schema_name);
  13521. if (!_this.viewModel.get('schema1')) {
  13522. msg$1('datasource1 最起码需要一张表');
  13523. return;
  13524. }
  13525. if (!_this.viewModel.get('schema2')) {
  13526. msg$1('datasource2 最起码需要一张表');
  13527. return;
  13528. }
  13529. _$2.forEach(res1[0].table_list, function (table1) {
  13530. var _a;
  13531. var table2 = _$2.find((_a = res2[0]) === null || _a === void 0 ? void 0 : _a.table_list, function (r) { return r.table_name === table1.table_name; });
  13532. if (table1.schema_name) {
  13533. _this.viewModel.set('schema1', table1.schema_name);
  13534. }
  13535. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  13536. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  13537. }
  13538. var row = {
  13539. table_name1: table1.table_name,
  13540. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  13541. table_info: table1
  13542. };
  13543. if (!table2) {
  13544. row.diff = '不一致';
  13545. row.remark = '目标表缺失';
  13546. }
  13547. else if (table1.column_list.length !== table2.column_list.length) {
  13548. row.diff = '不一致';
  13549. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  13550. }
  13551. else {
  13552. row.diff = '一致';
  13553. var remark_1 = [];
  13554. _$2.forEach(table1.column_list, function (col1) {
  13555. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  13556. if (!col2) {
  13557. row.diff = '不一致';
  13558. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  13559. }
  13560. else {
  13561. var colDiff = compareColumn(table1, col1, table2, col2);
  13562. if (colDiff) {
  13563. row.diff = '不一致';
  13564. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  13565. }
  13566. }
  13567. });
  13568. row.remark = remark_1.join('\n');
  13569. }
  13570. rows.push(row);
  13571. });
  13572. }
  13573. _this.refs.grid1.setData(rows);
  13574. _this.viewModel.set('hasDiff', true);
  13575. }).finally(function () {
  13576. _this.refs.grid1.setLoading(false);
  13577. });
  13578. };
  13579. DbSync.prototype.structCopyTo = function () {
  13580. var _this = this;
  13581. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13582. msg$1('选择数据源!');
  13583. return;
  13584. }
  13585. var recordList = this.refs.grid1.getSelection();
  13586. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13587. if (_$2.size(tableNameList) <= 0) {
  13588. msg$1('请选择要同步的表');
  13589. return;
  13590. }
  13591. var error = undefined;
  13592. _$2.forEach(tableNameList, function (tableInfo) {
  13593. _$2.forEach(tableInfo.column_list, function (col) {
  13594. error = checkColumn(tableInfo, col);
  13595. return false;
  13596. });
  13597. if (error) {
  13598. return false;
  13599. }
  13600. });
  13601. if (error) {
  13602. msg$1(error);
  13603. return;
  13604. }
  13605. var schema1 = this.viewModel.get('schema1');
  13606. var schema2 = this.viewModel.get('schema2');
  13607. if (!schema1 || !schema2) {
  13608. msg$1('无法识别 schema 名称');
  13609. return;
  13610. }
  13611. this.refs.grid1.setLoading(true);
  13612. getDiffDDLApi({
  13613. datasource1: this.viewModel.get('dataSource1'),
  13614. datasource2: this.viewModel.get('dataSource2'),
  13615. schema1: this.viewModel.get('schema1'),
  13616. schema2: this.viewModel.get('schema2'),
  13617. tables: tableNameList,
  13618. }).then(function (res) {
  13619. if (res.success) {
  13620. _this.refs.ddleditor.setCode(res.data);
  13621. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  13622. }
  13623. }).finally(function () {
  13624. _this.refs.grid1.setLoading(false);
  13625. });
  13626. };
  13627. DbSync.prototype.indexCopyTo = function () {
  13628. var _this = this;
  13629. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13630. msg$1('选择数据源!');
  13631. return;
  13632. }
  13633. var recordList = this.refs.grid1.getSelection();
  13634. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13635. if (_$2.size(tableNameList) <= 0) {
  13636. msg$1('请选择要同步的表');
  13637. return;
  13638. }
  13639. var schema1 = this.viewModel.get('schema1');
  13640. var schema2 = this.viewModel.get('schema2');
  13641. if (!schema1 || !schema2) {
  13642. msg$1('无法识别 schema 名称');
  13643. return;
  13644. }
  13645. this.refs.grid1.setLoading(true);
  13646. getModifyIdxDDL({
  13647. datasource1: this.viewModel.get('dataSource1'),
  13648. datasource2: this.viewModel.get('dataSource2'),
  13649. schema1: this.viewModel.get('schema1'),
  13650. schema2: this.viewModel.get('schema2'),
  13651. tables: tableNameList,
  13652. }).then(function (res) {
  13653. if (res.success) {
  13654. _this.refs.ddleditor_idx.setCode(res.data);
  13655. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  13656. }
  13657. }).finally(function () {
  13658. _this.refs.grid1.setLoading(false);
  13659. });
  13660. };
  13661. DbSync.prototype.procedureCopyTo = function () {
  13662. var _this = this;
  13663. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13664. msg$1('选择数据源!');
  13665. return;
  13666. }
  13667. var schema1 = this.viewModel.get('schema1');
  13668. var schema2 = this.viewModel.get('schema2');
  13669. if (!schema1 || !schema2) {
  13670. msg$1('无法识别 schema 名称');
  13671. return;
  13672. }
  13673. this.refs.grid1.setLoading(true);
  13674. getModifyProcedureSQL({
  13675. datasource1: this.viewModel.get('dataSource1'),
  13676. datasource2: this.viewModel.get('dataSource2'),
  13677. schema1: this.viewModel.get('schema1'),
  13678. schema2: this.viewModel.get('schema2'),
  13679. }).then(function (res) {
  13680. if (res.success) {
  13681. _this.refs.ddleditor_procedure.setCode(res.data);
  13682. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  13683. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  13684. }
  13685. }).finally(function () {
  13686. _this.refs.grid1.setLoading(false);
  13687. });
  13688. };
  13689. DbSync.prototype.dataSync_start = function () {
  13690. var _this = this;
  13691. this.viewModel.set('dataSync_isStart', true);
  13692. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  13693. this.refs.datacopy.setLoading(true);
  13694. dataSyncApi(dataSync)
  13695. .then(function (res) {
  13696. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  13697. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  13698. })
  13699. .finally(function () {
  13700. _this.refs.datacopy.setLoading(false);
  13701. });
  13702. };
  13703. DbSync.prototype.dataSync_process = function () {
  13704. var _this = this;
  13705. var jobId = this.viewModel.get('dataSyncResult.jobId');
  13706. dataSyncInfoApi({ jobId: jobId })
  13707. .then(function (res) {
  13708. if (_$2.isArray(res.tableSyncInfos)) {
  13709. var scrollPosition = _this.refs.datacopy.scrollable.position;
  13710. _this.refs.datacopy.setData(res.tableSyncInfos);
  13711. try {
  13712. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  13713. }
  13714. catch (e) {
  13715. }
  13716. }
  13717. if (res.endTime) {
  13718. // 已经结束
  13719. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  13720. if (res.success) {
  13721. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13722. }
  13723. else {
  13724. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13725. }
  13726. _this.dataSync_stop();
  13727. }
  13728. })
  13729. .catch(function (e) {
  13730. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  13731. console.error(e);
  13732. // this.dataSync_stop()
  13733. })
  13734. .finally(function () {
  13735. _this.refs.datacopy.setLoading(false);
  13736. });
  13737. };
  13738. DbSync.prototype.dataSync_stop = function () {
  13739. this.viewModel.set('dataSync_isStart', false);
  13740. clearInterval(this.dataSyncInterval);
  13741. delete this.dataSyncInterval;
  13742. };
  13743. DbSync.prototype.dataCopyTo = function () {
  13744. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13745. msg$1('选择数据源!');
  13746. return;
  13747. }
  13748. var recordList = this.refs.grid1.getSelection();
  13749. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13750. if (_$2.size(tableNameList) <= 0) {
  13751. msg$1('请选择要同步的表');
  13752. return;
  13753. }
  13754. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  13755. this.viewModel.set('dataSync.tables', tableNameList);
  13756. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  13757. };
  13758. DbSync.prototype.next = function () {
  13759. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  13760. };
  13761. DbSync.prototype.back = function () {
  13762. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  13763. };
  13764. DbSync.prototype.dbToMeta = function () {
  13765. var _this = this;
  13766. var dataSource1 = this.viewModel.get('dataSource1');
  13767. var dataSource2 = this.viewModel.get('dataSource2');
  13768. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  13769. var promise1 = dbToMeta({ datasource: dataSource1 });
  13770. var promise2 = dbToMeta({ datasource: dataSource2 });
  13771. _this.refs.grid1.setLoading(true);
  13772. Promise.all([promise1, promise2]).then(function (_a) {
  13773. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13774. _this.diff();
  13775. }).catch(function (res) {
  13776. _this.refs.grid1.setLoading(false);
  13777. showErrorDialog$1(res);
  13778. });
  13779. });
  13780. };
  13781. DbSync.prototype.executeDDL = function () {
  13782. var _this = this;
  13783. var code = this.refs.ddleditor.getValue();
  13784. var dataSource2 = this.viewModel.get('dataSource2');
  13785. var target_schema_name = this.viewModel.get('schema2');
  13786. var recordList = this.refs.grid1.getSelection();
  13787. var table_infos = _$2.map(recordList, function (r) {
  13788. return r.get('table_info');
  13789. });
  13790. this.setLoading(true);
  13791. pushToDbCommitApi({
  13792. datasource: dataSource2,
  13793. ddl: code,
  13794. table_infos: table_infos,
  13795. target_schema_name: target_schema_name,
  13796. }).then(function (res) {
  13797. if (res === null || res === void 0 ? void 0 : res.success) {
  13798. msg$1('执行成功');
  13799. _this.back();
  13800. _this.diff();
  13801. return;
  13802. }
  13803. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13804. }).finally(function () {
  13805. _this.setLoading(false);
  13806. });
  13807. };
  13808. DbSync.prototype.executeDDLIdx = function () {
  13809. var _this = this;
  13810. var code = this.refs.ddleditor_idx.getValue();
  13811. var dataSource2 = this.viewModel.get('dataSource2');
  13812. this.setLoading(true);
  13813. executeDDL({
  13814. datasource: dataSource2,
  13815. ddl: code,
  13816. }).then(function (res) {
  13817. if (res === null || res === void 0 ? void 0 : res.success) {
  13818. msg$1('执行成功');
  13819. _this.back();
  13820. return;
  13821. }
  13822. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13823. }).finally(function () {
  13824. _this.setLoading(false);
  13825. });
  13826. };
  13827. DbSync.prototype.executeProcedureSQL = function () {
  13828. var _this = this;
  13829. this.setLoading(true);
  13830. executeModifyProcedureSQL({
  13831. datasource1: this.viewModel.get('dataSource1'),
  13832. datasource2: this.viewModel.get('dataSource2'),
  13833. schema1: this.viewModel.get('schema1'),
  13834. schema2: this.viewModel.get('schema2'),
  13835. }).then(function (res) {
  13836. if (res === null || res === void 0 ? void 0 : res.success) {
  13837. msg$1('执行成功');
  13838. _this.back();
  13839. return;
  13840. }
  13841. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13842. }).finally(function () {
  13843. _this.setLoading(false);
  13844. });
  13845. };
  13846. return DbSync;
  13847. }(Scope));
  13848. //# sourceMappingURL=DbSync.js.map
  13849. var model$e = {
  13850. data: {}
  13851. };
  13852. //# sourceMappingURL=DbCodeTemplate.model.js.map
  13853. var vjson$e = {
  13854. title: '示例代码',
  13855. layout: 'fit',
  13856. items: [
  13857. {
  13858. layout: 'border',
  13859. items: [
  13860. {
  13861. region: 'north',
  13862. split: true,
  13863. height: 200,
  13864. title: '表格数据',
  13865. reference: 'dataeditor',
  13866. xtype: 'jsoneditor',
  13867. listeners: {
  13868. change: 'scope.dataChanged'
  13869. },
  13870. },
  13871. {
  13872. region: 'west',
  13873. split: true,
  13874. width: 230,
  13875. title: '模板',
  13876. reference: 'tree1',
  13877. xtype: 'treepanel',
  13878. rootVisible: false,
  13879. useArrows: true,
  13880. colspan: 2,
  13881. lines: true,
  13882. multiSelect: false,
  13883. listeners: {
  13884. itemclick: 'scope.templateChange',
  13885. },
  13886. },
  13887. {
  13888. region: 'center',
  13889. title: '参考代码',
  13890. reference: 'preview',
  13891. xtype: 'jsoneditor',
  13892. },
  13893. ]
  13894. }
  13895. ]
  13896. };
  13897. //# sourceMappingURL=DbCodeTemplate.view.js.map
  13898. var rootNode = {
  13899. id: 'ROOT',
  13900. type: "ROOT",
  13901. path: "",
  13902. expanded: true,
  13903. leaf: false,
  13904. children: [
  13905. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  13906. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  13907. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  13908. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  13909. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  13910. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  13911. ],
  13912. };
  13913. var TemplateDev = /** @class */ (function (_super) {
  13914. __extends(TemplateDev, _super);
  13915. function TemplateDev() {
  13916. var _this = _super.call(this, { model: model$e, vjson: vjson$e }) || this;
  13917. _this.dataChanged = _$2.debounce(function () {
  13918. var me = _this;
  13919. if (me.refs.tree1.selection) {
  13920. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  13921. }
  13922. }, 50);
  13923. return _this;
  13924. }
  13925. TemplateDev.prototype.onDestroy = function () {
  13926. setDbCode(undefined);
  13927. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  13928. };
  13929. TemplateDev.prototype.onLoad = function () {
  13930. setDbCode(this);
  13931. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  13932. this.refs.tree1.setRootNode(rootNode);
  13933. getColumnDomainApi({}).then(function (_a) {
  13934. var data = _a.data;
  13935. return window['dev_column_domain'] = data;
  13936. });
  13937. };
  13938. TemplateDev.prototype.dbTreeNodeChange = function () {
  13939. var me = handles$1.dbcode;
  13940. var tables = [];
  13941. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  13942. var raw = _$2.cloneDeep(r.get('raw'));
  13943. raw.id = r.get('id');
  13944. if (r.get('type') === 'table') {
  13945. tables.push(raw);
  13946. return;
  13947. }
  13948. if (r.get('type') === 'column') {
  13949. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  13950. if (!tableInfo) {
  13951. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  13952. tables.push(tableInfo);
  13953. }
  13954. if (!tableInfo.column_list) {
  13955. tableInfo.column_list = [raw];
  13956. }
  13957. else {
  13958. tableInfo.column_list.push(raw);
  13959. }
  13960. }
  13961. });
  13962. // 对于没有选择列的表格,默认加上所有列
  13963. _$2.forEach(tables, function (tableInfo) {
  13964. if (typeof tableInfo.column_list === 'undefined') {
  13965. tableInfo.column_list = [];
  13966. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  13967. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  13968. });
  13969. }
  13970. });
  13971. var code = JSON.stringify(tables, null, ' ');
  13972. me.refs.dataeditor.setCode(code);
  13973. };
  13974. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  13975. var url = record.data.url;
  13976. var rd = _$2.uniqueId('db_code_request');
  13977. if (url) {
  13978. var data = void 0;
  13979. try {
  13980. data = JSON.parse(this.refs.dataeditor.getCode());
  13981. }
  13982. catch (e) {
  13983. return;
  13984. }
  13985. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  13986. // if (typeof node.default === "function") {
  13987. // const v = toString(node.default(data))
  13988. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  13989. // this.refs.preview.setLanguage("plaintext")
  13990. // this.refs.preview.setCode(v)
  13991. // }
  13992. // })
  13993. showErrorDialog$1('没做这里');
  13994. }
  13995. };
  13996. return TemplateDev;
  13997. }(Scope));
  13998. //# sourceMappingURL=DbCodeTemplate.js.map
  13999. var model$f = {
  14000. data: {
  14001. hasChanged: false,
  14002. }
  14003. };
  14004. //# sourceMappingURL=DbDomain.model.js.map
  14005. var vjson$f = {
  14006. bind: {
  14007. title: '字段域{grid1.ischanged?" *":""}',
  14008. },
  14009. layout: 'fit',
  14010. items: [
  14011. {
  14012. layout: 'border',
  14013. items: [
  14014. {
  14015. region: 'center',
  14016. xtype: 'yvgrid',
  14017. selModel: {
  14018. type: 'spreadsheet',
  14019. columnSelect: true,
  14020. pruneRemoved: false,
  14021. extensible: 'y'
  14022. },
  14023. plugins: {
  14024. clipboard: true,
  14025. selectionreplicator: true
  14026. },
  14027. reference: 'grid1',
  14028. pagination: false,
  14029. tbar: {
  14030. xtype: 'toolbar',
  14031. items: [
  14032. {
  14033. xtype: 'button',
  14034. text: '添加',
  14035. iconCls: 'x-fa fa-plus-circle',
  14036. listeners: {
  14037. click: 'scope.addField'
  14038. }
  14039. },
  14040. {
  14041. xtype: 'button',
  14042. text: '删除',
  14043. iconCls: 'x-fa fa-minus-circle',
  14044. listeners: {
  14045. click: 'scope.removeField'
  14046. }
  14047. },
  14048. {
  14049. xtype: 'button',
  14050. text: '保存',
  14051. iconCls: 'x-fa fa-save',
  14052. bind: {
  14053. disabled: '{!grid1.ischanged}'
  14054. },
  14055. listeners: {
  14056. click: 'scope.save'
  14057. }
  14058. },
  14059. ]
  14060. },
  14061. listeners: {
  14062. editfinish: 'scope.gridEditFinish',
  14063. },
  14064. columns: [
  14065. {
  14066. text: '字段域名称', dataIndex: 'domain_name',
  14067. sortable: false,
  14068. menuDisabled: true,
  14069. locked: true,
  14070. editor: {
  14071. selectOnFocus: true
  14072. }
  14073. },
  14074. {
  14075. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  14076. sortable: false, menuDisabled: true,
  14077. editor: {
  14078. selectOnFocus: true
  14079. }
  14080. },
  14081. {
  14082. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  14083. sortable: false, menuDisabled: true,
  14084. editor: {
  14085. selectOnFocus: true
  14086. }
  14087. },
  14088. {
  14089. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  14090. sortable: false, menuDisabled: true,
  14091. editor: {
  14092. selectOnFocus: true
  14093. }
  14094. },
  14095. {
  14096. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  14097. sortable: false, menuDisabled: true,
  14098. editor: {
  14099. selectOnFocus: true
  14100. }
  14101. },
  14102. {
  14103. text: 'Java类型', dataIndex: 'java_datatype',
  14104. sortable: false, menuDisabled: true,
  14105. editor: {
  14106. selectOnFocus: true
  14107. }
  14108. },
  14109. {
  14110. text: '固定长度', dataIndex: 'is_fix_size',
  14111. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14112. width: 88, resizable: false,
  14113. },
  14114. {
  14115. text: '长度', dataIndex: 'column_size',
  14116. sortable: false, menuDisabled: true, dataType: 'int',
  14117. xtype: 'numbercolumn', format: '0',
  14118. editor: { selectOnFocus: true }
  14119. },
  14120. {
  14121. text: '小数位', dataIndex: 'decimal_digits',
  14122. sortable: false, menuDisabled: true, dataType: 'int',
  14123. xtype: 'numbercolumn', format: '0',
  14124. editor: { selectOnFocus: true }
  14125. },
  14126. {
  14127. text: '字典', dataIndex: 'domain_column_dict',
  14128. sortable: false, menuDisabled: true,
  14129. // fix: ['system.getDict("DICT")'],
  14130. width: 200,
  14131. editor: {
  14132. xtype: 'combo',
  14133. listConfig: {
  14134. minWidth: 350
  14135. },
  14136. }
  14137. },
  14138. {
  14139. text: '固定默认值', dataIndex: 'is_fix_default_value',
  14140. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14141. width: 88, resizable: false,
  14142. },
  14143. {
  14144. text: '默认值', dataIndex: 'default_value',
  14145. sortable: false, menuDisabled: true,
  14146. editor: {
  14147. selectOnFocus: true
  14148. }
  14149. },
  14150. {
  14151. text: 'UI建议', dataIndex: 'domain_column_ui',
  14152. sortable: false, menuDisabled: true,
  14153. // fix: ['system.getDict("column_ui")'],
  14154. editor: {
  14155. xtype: 'combo',
  14156. allowBlank: true,
  14157. listConfig: {
  14158. minWidth: 200
  14159. },
  14160. }
  14161. },
  14162. {
  14163. text: '详细描述', dataIndex: 'domain_note',
  14164. sortable: false, menuDisabled: true,
  14165. editor: {}
  14166. },
  14167. {
  14168. text: '责任人', dataIndex: 'domain_person',
  14169. sortable: false, menuDisabled: true,
  14170. editor: {
  14171. selectOnFocus: true
  14172. }
  14173. },
  14174. {
  14175. text: '版本', dataIndex: 'domain_version',
  14176. sortable: false, menuDisabled: true,
  14177. editor: {
  14178. selectOnFocus: true
  14179. }
  14180. },
  14181. ]
  14182. }
  14183. ]
  14184. },
  14185. ]
  14186. };
  14187. //# sourceMappingURL=DbDomain.view.js.map
  14188. var DbDomain = /** @class */ (function (_super) {
  14189. __extends(DbDomain, _super);
  14190. function DbDomain() {
  14191. return _super.call(this, { model: model$f, vjson: vjson$f }) || this;
  14192. }
  14193. DbDomain.prototype.onLoad = function () {
  14194. var _this = this;
  14195. instance$3.getAllDomain().then(function (data) {
  14196. _this.refs.grid1.setData(data);
  14197. });
  14198. };
  14199. DbDomain.prototype.gridEditFinish = function () {
  14200. this.viewModel.set('hasChanged', true);
  14201. };
  14202. DbDomain.prototype.addField = function () {
  14203. this.refs.grid1.appendEditRow({
  14204. domainName: '',
  14205. pgSqlDataType: '',
  14206. mysqlDataType: '',
  14207. oracleDataType: '',
  14208. sqlserverDataType: '',
  14209. javaDataType: '',
  14210. isFixSize: true,
  14211. size: '',
  14212. decimalDigits: '',
  14213. isFixDefaultValue: false,
  14214. defaultValue: null,
  14215. domainColumnDict: '',
  14216. domainColumnUI: '',
  14217. note: '',
  14218. domainPerson: '',
  14219. domainVersion: '',
  14220. }, 0);
  14221. };
  14222. DbDomain.prototype.removeField = function () {
  14223. var _this = this;
  14224. var rows = [];
  14225. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  14226. rows.push(r);
  14227. });
  14228. _.forEach(rows, function (r) {
  14229. _this.refs.grid1.getStore().remove(r);
  14230. });
  14231. };
  14232. DbDomain.prototype.save = function () {
  14233. var _this = this;
  14234. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  14235. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  14236. if (err) {
  14237. // 如果有异常就不保存
  14238. return;
  14239. }
  14240. // 进行业务上的逻辑校验,比如说必填校验等等
  14241. var hasError = false;
  14242. _.forEach(rows, function (row, i) {
  14243. if (isEmpty(row.domain_name)) {
  14244. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  14245. hasError = true;
  14246. return false;
  14247. }
  14248. if (isEmpty(row.pgsql_datatype) ||
  14249. isEmpty(row.mysql_datatype) ||
  14250. isEmpty(row.oracle_datatype) ||
  14251. isEmpty(row.sqlserver_datatype)) {
  14252. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  14253. hasError = true;
  14254. return false;
  14255. }
  14256. });
  14257. if (hasError) {
  14258. return;
  14259. }
  14260. // 设置当前界面为 "保存中..." 状态
  14261. this.setLoading(true);
  14262. saveColumnDomain({
  14263. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  14264. newRows: newRows,
  14265. modifyRows: modifyRows,
  14266. removeRecords: removeRecords,
  14267. }).then(function (res) {
  14268. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  14269. system.msg(res.msg);
  14270. instance$3.reloadForce({}).then(function () {
  14271. instance$3.getAllDomain().then(function (data) {
  14272. _this.refs.grid1.setData(data);
  14273. });
  14274. }).finally(function () {
  14275. // 无论正常异常,关闭 "保存中..." 状态
  14276. _this.setLoading(false);
  14277. });
  14278. }).catch(function (e) {
  14279. // 无论正常异常,关闭 "保存中..." 状态
  14280. _this.setLoading(false);
  14281. });
  14282. };
  14283. return DbDomain;
  14284. }(Scope));
  14285. //# sourceMappingURL=DbDomain.js.map
  14286. var model$g = {
  14287. data: {
  14288. report_id: '',
  14289. report_name: '',
  14290. report_enable: false,
  14291. report: {
  14292. dataSource: '',
  14293. grid: {
  14294. pagination: true,
  14295. },
  14296. query: [],
  14297. columns: [],
  14298. summary: [],
  14299. },
  14300. querySql: '',
  14301. summarySql: '',
  14302. createAt: '',
  14303. createBy: '',
  14304. updateAt: '',
  14305. updateBy: '',
  14306. }
  14307. };
  14308. //# sourceMappingURL=ReportDesign.model.js.map
  14309. var vjson$g = {
  14310. bind: {
  14311. title: '报表-{report_name}',
  14312. },
  14313. layout: 'fit',
  14314. items: [
  14315. {
  14316. layout: 'border',
  14317. items: [
  14318. {
  14319. region: 'north',
  14320. items: [
  14321. {
  14322. xtype: 'toolbar',
  14323. border: false,
  14324. items: [
  14325. {
  14326. xtype: 'button',
  14327. text: '刷新',
  14328. iconCls: 'x-fa fa-refresh',
  14329. listeners: {
  14330. click: 'scope.load'
  14331. }
  14332. },
  14333. {
  14334. xtype: 'button',
  14335. text: '保存',
  14336. iconCls: 'x-fa fa-save',
  14337. listeners: {
  14338. click: 'scope.save'
  14339. }
  14340. },
  14341. {
  14342. xtype: 'button',
  14343. text: '预览',
  14344. iconCls: 'x-fa fa-play-circle-o',
  14345. listeners: {
  14346. click: 'scope.preview'
  14347. }
  14348. },
  14349. {
  14350. xtype: 'textfield',
  14351. fieldLabel: '报表名称',
  14352. flex: 1,
  14353. bind: {
  14354. value: '{report_name}'
  14355. }
  14356. },
  14357. {
  14358. xtype: 'checkbox',
  14359. fieldLabel: '启用报表',
  14360. checkedValue: 1,
  14361. uncheckedValue: 0,
  14362. bind: {
  14363. value: '{report_enable}'
  14364. }
  14365. },
  14366. {
  14367. xtype: 'checkbox',
  14368. fieldLabel: '启用分页',
  14369. bind: {
  14370. value: '{report.grid.pagination}'
  14371. }
  14372. },
  14373. {
  14374. xtype: 'textfield',
  14375. fieldLabel: '数据源',
  14376. flex: 1,
  14377. bind: {
  14378. value: '{report.dataSource}'
  14379. }
  14380. },
  14381. ]
  14382. }
  14383. ]
  14384. },
  14385. {
  14386. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  14387. items: [
  14388. {
  14389. title: 'SQL和查询条件',
  14390. layout: 'border',
  14391. border: false,
  14392. items: [
  14393. {
  14394. region: 'north',
  14395. height: 200,
  14396. border: false,
  14397. split: true,
  14398. xtype: 'yvgrid',
  14399. reference: 'gridCondition',
  14400. pagination: false,
  14401. hideFootbar: true,
  14402. plugins: {
  14403. clipboard: true,
  14404. selectionreplicator: true
  14405. },
  14406. selModel: {
  14407. type: 'spreadsheet',
  14408. columnSelect: false,
  14409. pruneRemoved: false,
  14410. extensible: 'y'
  14411. },
  14412. tbar: {
  14413. xtype: 'toolbar',
  14414. border: false,
  14415. items: [
  14416. {
  14417. xtype: 'button',
  14418. text: '添加条件',
  14419. iconCls: 'x-fa fa-plus-circle',
  14420. listeners: {
  14421. click: 'scope.addCondition'
  14422. }
  14423. },
  14424. {
  14425. xtype: 'button',
  14426. text: '删除条件',
  14427. iconCls: 'x-fa fa-minus-circle',
  14428. listeners: {
  14429. click: 'scope.removeCondition'
  14430. }
  14431. },
  14432. '-',
  14433. {
  14434. xtype: 'button',
  14435. text: '自动分析条件变量',
  14436. iconCls: 'x-fa fa-code-fork',
  14437. listeners: {
  14438. click: 'scope.calcCondition'
  14439. }
  14440. },
  14441. {
  14442. xtype: 'button',
  14443. text: '上移',
  14444. iconCls: 'x-fa fa-arrow-up',
  14445. listeners: {
  14446. click: 'scope.moveUp'
  14447. }
  14448. },
  14449. {
  14450. xtype: 'button',
  14451. text: '下移',
  14452. iconCls: 'x-fa fa-arrow-down',
  14453. listeners: {
  14454. click: 'scope.moveDown'
  14455. }
  14456. },
  14457. ]
  14458. },
  14459. columns: [
  14460. {
  14461. text: '条件变量',
  14462. dataIndex: 'conditionFieldBind',
  14463. width: 140,
  14464. sortable: false,
  14465. menuDisabled: true,
  14466. editor: {
  14467. selectOnFocus: true
  14468. },
  14469. },
  14470. {
  14471. text: '中文标题',
  14472. dataIndex: 'conditionFieldLabel',
  14473. width: 120,
  14474. sortable: false,
  14475. menuDisabled: true,
  14476. editor: {
  14477. selectOnFocus: true
  14478. },
  14479. },
  14480. {
  14481. text: '编辑类型',
  14482. dataIndex: 'conditionFieldXtype',
  14483. width: 80,
  14484. sortable: false,
  14485. menuDisabled: true,
  14486. editor: {
  14487. xtype: 'combo',
  14488. typeAhead: true,
  14489. triggerAction: 'all',
  14490. selectOnFocus: true,
  14491. store: [
  14492. ['textfield', 'textfield'],
  14493. ['combo', 'combo'],
  14494. ['datefield', 'datefield'],
  14495. ['datetimefield', 'datetimefield'],
  14496. ['numberfield', 'numberfield'],
  14497. ['multiplesearch', 'multiplesearch'],
  14498. ]
  14499. }
  14500. },
  14501. {
  14502. text: '权重',
  14503. dataIndex: 'conditionFieldFlex',
  14504. align: 'right',
  14505. width: 60,
  14506. sortable: false,
  14507. menuDisabled: true,
  14508. editor: {
  14509. xtype: 'numberfield',
  14510. selectOnFocus: false,
  14511. minValue: 0,
  14512. maxValue: 10
  14513. },
  14514. },
  14515. {
  14516. text: '字典',
  14517. dataIndex: 'conditionFieldDict',
  14518. width: 160,
  14519. sortable: false,
  14520. menuDisabled: true,
  14521. editor: {
  14522. selectOnFocus: false
  14523. },
  14524. },
  14525. {
  14526. xtype: 'checkcolumn',
  14527. dataIndex: "conditionFieldWrap", header: "换行",
  14528. width: 65,
  14529. sortable: false,
  14530. menuDisabled: true,
  14531. },
  14532. {
  14533. text: '扩展参数',
  14534. dataIndex: 'conditionFieldExtend',
  14535. sortable: false,
  14536. menuDisabled: true,
  14537. editor: {
  14538. selectOnFocus: false
  14539. },
  14540. },
  14541. ]
  14542. },
  14543. {
  14544. region: 'center',
  14545. xtype: 'sqleditor',
  14546. layout: 'fit',
  14547. reference: 'sqlEditor',
  14548. split: true,
  14549. },
  14550. ]
  14551. },
  14552. {
  14553. title: '查询结果字段',
  14554. xtype: 'yvgrid',
  14555. reference: 'gridColumn',
  14556. pagination: false,
  14557. hideFootbar: true,
  14558. border: false,
  14559. plugins: {
  14560. clipboard: true,
  14561. selectionreplicator: true
  14562. },
  14563. selModel: {
  14564. type: 'spreadsheet',
  14565. columnSelect: false,
  14566. pruneRemoved: false,
  14567. extensible: 'y'
  14568. },
  14569. tbar: {
  14570. xtype: 'toolbar',
  14571. items: [
  14572. {
  14573. xtype: 'button',
  14574. text: '添加',
  14575. iconCls: 'x-fa fa-plus-circle',
  14576. listeners: {
  14577. click: 'scope.addColumn'
  14578. }
  14579. },
  14580. {
  14581. xtype: 'button',
  14582. text: '删除',
  14583. iconCls: 'x-fa fa-minus-circle',
  14584. listeners: {
  14585. click: 'scope.removeColumn'
  14586. }
  14587. },
  14588. '-',
  14589. {
  14590. xtype: 'button',
  14591. text: '自动分析',
  14592. iconCls: 'x-fa fa-code-fork',
  14593. listeners: {
  14594. click: 'scope.calcColumn'
  14595. }
  14596. },
  14597. {
  14598. xtype: 'button',
  14599. text: '上移',
  14600. iconCls: 'x-fa fa-arrow-up',
  14601. listeners: {
  14602. click: 'scope.moveUp'
  14603. }
  14604. },
  14605. {
  14606. xtype: 'button',
  14607. text: '下移',
  14608. iconCls: 'x-fa fa-arrow-down',
  14609. listeners: {
  14610. click: 'scope.moveDown'
  14611. }
  14612. },
  14613. ]
  14614. },
  14615. columns: [
  14616. { xtype: 'rownumberer' },
  14617. {
  14618. text: '字段',
  14619. dataIndex: 'dataIndex',
  14620. width: 140,
  14621. sortable: false,
  14622. menuDisabled: true,
  14623. editor: {
  14624. selectOnFocus: true
  14625. },
  14626. },
  14627. {
  14628. text: '标题',
  14629. dataIndex: 'header',
  14630. width: 120,
  14631. sortable: false,
  14632. menuDisabled: true,
  14633. editor: {
  14634. selectOnFocus: true
  14635. },
  14636. },
  14637. {
  14638. text: '显示类型',
  14639. dataIndex: 'xtype',
  14640. width: 90,
  14641. sortable: false,
  14642. menuDisabled: true,
  14643. editor: {
  14644. xtype: 'combo',
  14645. typeAhead: true,
  14646. triggerAction: 'all',
  14647. selectOnFocus: true,
  14648. store: [
  14649. ['', ''],
  14650. ['rownum', 'rownum'],
  14651. ['button', 'button'],
  14652. ['checkbox', 'checkbox'],
  14653. ['progres', 'progres'],
  14654. ]
  14655. }
  14656. },
  14657. {
  14658. text: '数据类型',
  14659. dataIndex: 'dataType',
  14660. width: 90,
  14661. sortable: false,
  14662. menuDisabled: true,
  14663. editor: {
  14664. xtype: 'combo',
  14665. typeAhead: true,
  14666. triggerAction: 'all',
  14667. selectOnFocus: true,
  14668. store: [
  14669. ['', ''],
  14670. ['string', 'string'],
  14671. ['number', 'number'],
  14672. ['date', 'date'],
  14673. ]
  14674. }
  14675. },
  14676. {
  14677. text: '宽度',
  14678. dataIndex: 'width',
  14679. align: 'right',
  14680. width: 60,
  14681. sortable: false,
  14682. menuDisabled: true,
  14683. editor: {
  14684. xtype: 'numberfield',
  14685. selectOnFocus: true,
  14686. minValue: 0,
  14687. maxValue: 1000
  14688. },
  14689. },
  14690. {
  14691. text: '权重',
  14692. dataIndex: 'flex',
  14693. align: 'right',
  14694. width: 60,
  14695. sortable: false,
  14696. menuDisabled: true,
  14697. editor: {
  14698. xtype: 'numberfield',
  14699. selectOnFocus: true,
  14700. minValue: 0,
  14701. maxValue: 10
  14702. },
  14703. },
  14704. {
  14705. text: '字典',
  14706. dataIndex: 'dict',
  14707. sortable: false,
  14708. menuDisabled: true,
  14709. width: 120,
  14710. editor: {
  14711. selectOnFocus: true,
  14712. },
  14713. },
  14714. {
  14715. text: '对齐',
  14716. dataIndex: 'align',
  14717. width: 60,
  14718. sortable: false,
  14719. menuDisabled: true,
  14720. editor: {
  14721. xtype: 'combo',
  14722. typeAhead: true,
  14723. triggerAction: 'all',
  14724. selectOnFocus: false,
  14725. store: [
  14726. ['', ''],
  14727. ['start', 'start'],
  14728. ['center', 'center'],
  14729. ['end', 'end'],
  14730. ]
  14731. },
  14732. },
  14733. {
  14734. text: '过滤',
  14735. dataIndex: 'filterable',
  14736. xtype: 'checkcolumn',
  14737. width: 50,
  14738. resizable: false,
  14739. sortable: false,
  14740. menuDisabled: true,
  14741. },
  14742. {
  14743. text: '隐藏',
  14744. dataIndex: 'hidden',
  14745. xtype: 'checkcolumn',
  14746. width: 50,
  14747. resizable: false,
  14748. sortable: false,
  14749. menuDisabled: true,
  14750. },
  14751. {
  14752. text: '排序',
  14753. dataIndex: 'sortable',
  14754. xtype: 'checkcolumn',
  14755. width: 50,
  14756. resizable: false,
  14757. sortable: false,
  14758. menuDisabled: true,
  14759. },
  14760. {
  14761. text: '扩展参数',
  14762. dataIndex: 'fieldExtend',
  14763. sortable: false,
  14764. menuDisabled: true,
  14765. editor: {
  14766. selectOnFocus: false
  14767. },
  14768. },
  14769. ],
  14770. },
  14771. {
  14772. title: '汇总和汇总逻辑',
  14773. layout: 'border',
  14774. border: false,
  14775. items: [
  14776. {
  14777. xtype: 'yvgrid', region: 'north', layout: 'fit',
  14778. reference: 'gridSum',
  14779. pagination: false,
  14780. hideFootbar: true,
  14781. height: 200,
  14782. split: true,
  14783. border: false,
  14784. plugins: {
  14785. clipboard: true,
  14786. selectionreplicator: true
  14787. },
  14788. selModel: {
  14789. type: 'spreadsheet',
  14790. columnSelect: false,
  14791. pruneRemoved: false,
  14792. extensible: 'y'
  14793. },
  14794. tbar: {
  14795. xtype: 'toolbar',
  14796. border: false,
  14797. items: [
  14798. {
  14799. xtype: 'button',
  14800. text: '添加',
  14801. iconCls: 'x-fa fa-plus-circle',
  14802. listeners: {
  14803. click: 'scope.addSum'
  14804. }
  14805. },
  14806. {
  14807. xtype: 'button',
  14808. text: '删除',
  14809. iconCls: 'x-fa fa-minus-circle',
  14810. listeners: {
  14811. click: 'scope.removeSum'
  14812. }
  14813. },
  14814. '-',
  14815. {
  14816. xtype: 'button',
  14817. text: '自动分析',
  14818. iconCls: 'x-fa fa-code-fork',
  14819. listeners: {
  14820. click: 'scope.calcSum'
  14821. }
  14822. },
  14823. {
  14824. xtype: 'button',
  14825. text: '上移',
  14826. iconCls: 'x-fa fa-arrow-up',
  14827. listeners: {
  14828. click: 'scope.moveUp'
  14829. }
  14830. },
  14831. {
  14832. xtype: 'button',
  14833. text: '下移',
  14834. iconCls: 'x-fa fa-arrow-down',
  14835. listeners: {
  14836. click: 'scope.moveDown'
  14837. }
  14838. },
  14839. ]
  14840. },
  14841. columns: [
  14842. {
  14843. text: '字段名',
  14844. dataIndex: 'sumFieldBind',
  14845. width: 140,
  14846. sortable: false,
  14847. menuDisabled: true,
  14848. editor: {
  14849. selectOnFocus: true
  14850. },
  14851. },
  14852. {
  14853. text: '标题',
  14854. dataIndex: 'sumFieldLabel',
  14855. width: 120,
  14856. sortable: false,
  14857. menuDisabled: true,
  14858. editor: {
  14859. selectOnFocus: true
  14860. },
  14861. },
  14862. {
  14863. text: '权重',
  14864. dataIndex: 'sumFieldFlex',
  14865. align: 'right',
  14866. width: 60,
  14867. sortable: false,
  14868. menuDisabled: true,
  14869. editor: {
  14870. xtype: 'numberfield',
  14871. selectOnFocus: false,
  14872. allowBlank: true,
  14873. minValue: 0,
  14874. maxValue: 10
  14875. },
  14876. },
  14877. {
  14878. xtype: 'checkcolumn',
  14879. dataIndex: "sumFieldWrap", header: "换行",
  14880. sortable: false,
  14881. menuDisabled: true,
  14882. width: 65,
  14883. },
  14884. {
  14885. text: '扩展参数',
  14886. dataIndex: 'sumFieldExtend',
  14887. sortable: false,
  14888. menuDisabled: true,
  14889. editor: {
  14890. selectOnFocus: false
  14891. },
  14892. },
  14893. ]
  14894. },
  14895. {
  14896. region: 'center',
  14897. xtype: 'sqleditor',
  14898. layout: 'fit',
  14899. reference: 'sqlSumEditor',
  14900. },
  14901. ]
  14902. },
  14903. ]
  14904. }
  14905. ]
  14906. }
  14907. ]
  14908. }; //
  14909. //
  14910. //# sourceMappingURL=ReportDesign.view.js.map
  14911. var PROJECT_DICT_CACHE = {};
  14912. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  14913. /**
  14914. *项目运行时构建
  14915. **/
  14916. function createRuntime() {
  14917. {
  14918. // 已经构建过了
  14919. return new Promise(function (resolve) {
  14920. resolve();
  14921. });
  14922. }
  14923. }
  14924. //# sourceMappingURL=ProjectRuntime.js.map
  14925. function ReportRunner(reportId, setLoadingFn) {
  14926. return new Promise(function (resolve) {
  14927. setLoadingFn(true);
  14928. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  14929. // const {model, vjson, report} = buildVjson(res.data)
  14930. // const ret = new ReportScope({model, vjson})
  14931. // ret.report_id = reportId
  14932. // ret.report = report
  14933. // resolve(ret)
  14934. var _b = __read(_a, 1), res = _b[0];
  14935. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  14936. resolve(ret);
  14937. }).finally(function () {
  14938. setLoadingFn(false);
  14939. });
  14940. });
  14941. }
  14942. //# sourceMappingURL=ReportRunner.js.map
  14943. //gridCondition
  14944. //gridColumn
  14945. //gridSum
  14946. //sqlSumEditor
  14947. //sqlEditor
  14948. var ReportDesign = /** @class */ (function (_super) {
  14949. __extends(ReportDesign, _super);
  14950. function ReportDesign() {
  14951. return _super.call(this, { model: model$g, vjson: vjson$g }) || this;
  14952. }
  14953. ReportDesign.prototype.onLoad = function () {
  14954. this.load();
  14955. };
  14956. ReportDesign.prototype.save = function (sender) {
  14957. var _this = this;
  14958. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  14959. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  14960. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  14961. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  14962. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  14963. var report = this.viewModel.get('report');
  14964. var data = {
  14965. report_id: this.viewModel.get('report_id'),
  14966. report_name: this.viewModel.get('report_name'),
  14967. report_enable: this.viewModel.get('report_enable'),
  14968. query_sql: this.viewModel.get('querySql'),
  14969. summary_sql: this.viewModel.get('summarySql'),
  14970. report: json5.stringify(report, null, ' '),
  14971. };
  14972. sender.setLoading(true);
  14973. saveReportApi(data).then(function (res) {
  14974. if (res.success) {
  14975. msg$1('保存成功');
  14976. _this.dialogSuccess(data);
  14977. _this.load();
  14978. }
  14979. }).finally(function () {
  14980. sender.setLoading(false);
  14981. });
  14982. };
  14983. ReportDesign.prototype.preview = function (sender) {
  14984. var reportId = this.viewModel.get('report_id');
  14985. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  14986. handles.mainWindow.showReportPreview(reportId, scope);
  14987. });
  14988. };
  14989. ReportDesign.prototype.load = function () {
  14990. var _this = this;
  14991. var reportId = this.viewModel.get('report_id');
  14992. this.setLoading(true);
  14993. reportByIdApi(reportId).then(function (res) {
  14994. var _a = res.data, query_sql = _a.query_sql, report = _a.report, report_enable = _a.report_enable, report_name = _a.report_name, summary_sql = _a.summary_sql;
  14995. if (report) {
  14996. report = json5.parse(report);
  14997. }
  14998. else {
  14999. report = {};
  15000. }
  15001. _this.viewModel.set('report_enable', report_enable);
  15002. _this.viewModel.set('report_name', report_name);
  15003. _this.viewModel.set('querySql', query_sql || '');
  15004. _this.viewModel.set('summarySql', summary_sql || '');
  15005. system.mergeViewModel(_this.viewModel, 'report', report, false);
  15006. var query = _this.viewModel.get('report.query') || [];
  15007. var columns = _this.viewModel.get('report.columns') || [];
  15008. var summary = _this.viewModel.get('report.summary') || [];
  15009. var querySql = _this.viewModel.get('querySql');
  15010. var summarySql = _this.viewModel.get('summarySql');
  15011. _this.refs.gridCondition.setData(query);
  15012. _this.refs.gridColumn.setData(columns);
  15013. _this.refs.gridSum.setData(summary);
  15014. _this.refs.sqlEditor.setCode(querySql);
  15015. _this.refs.sqlSumEditor.setCode(summarySql);
  15016. }).finally(function () {
  15017. _this.setLoading(false);
  15018. });
  15019. };
  15020. ReportDesign.prototype.addCondition = function () {
  15021. this.refs.gridCondition.appendEditRow({
  15022. conditionFieldBind: '',
  15023. conditionFieldLabel: '',
  15024. conditionFieldXtype: 'textfield',
  15025. conditionFieldFlex: 1,
  15026. conditionFieldDict: '',
  15027. conditionFieldWrap: false,
  15028. conditionFieldExtend: '{}',
  15029. }, 'conditionFieldBind');
  15030. };
  15031. ReportDesign.prototype.removeCondition = function () {
  15032. var _this = this;
  15033. var rows = [];
  15034. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  15035. rows.push(r);
  15036. });
  15037. _.forEach(rows, function (r) {
  15038. _this.refs.gridCondition.getStore().remove(r);
  15039. });
  15040. };
  15041. ReportDesign.prototype.moveUp = function (sender) {
  15042. var grid = sender.up('grid');
  15043. grid.rowMoveUp();
  15044. };
  15045. ReportDesign.prototype.moveDown = function (sender) {
  15046. var grid = sender.up('grid');
  15047. grid.rowMoveDown();
  15048. };
  15049. ReportDesign.prototype.calcCondition = function () {
  15050. var _this = this;
  15051. var sql = this.refs.sqlEditor.getCode();
  15052. var re = sql.matchAll(/#{(.+?)}/gi);
  15053. var rows = this.refs.gridCondition.getDataRows();
  15054. this.refs.gridCondition.setLoading(true);
  15055. Promise.all([
  15056. parseDynamicSqlApi(sql),
  15057. instance.reloadIfNeedPromise(),
  15058. ]).then(function (_a) {
  15059. var e_1, _b;
  15060. var _c = __read(_a, 1), res1 = _c[0];
  15061. if (res1.success) {
  15062. var tables_1 = [];
  15063. _.forEach(res1.data, function (parseItem) {
  15064. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  15065. if (tableName && !_.includes(tables_1, tableName)) {
  15066. tables_1.push(tableName);
  15067. }
  15068. });
  15069. var _loop_1 = function (m) {
  15070. var e_2, _a;
  15071. var columnName = m[1];
  15072. // 没有这个列才添加
  15073. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  15074. var meta = undefined;
  15075. try {
  15076. for (var tables_2 = (e_2 = void 0, __values(tables_1)), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
  15077. var tableName = tables_2_1.value;
  15078. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  15079. if (meta) {
  15080. break;
  15081. }
  15082. }
  15083. }
  15084. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  15085. finally {
  15086. try {
  15087. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  15088. }
  15089. finally { if (e_2) throw e_2.error; }
  15090. }
  15091. if (meta) {
  15092. // 找到元数据
  15093. var r = {
  15094. conditionFieldBind: meta.column_name,
  15095. conditionFieldLabel: meta.column_comment,
  15096. conditionFieldXtype: 'textfield',
  15097. conditionFieldFlex: 1,
  15098. conditionFieldDict: '',
  15099. conditionFieldWrap: false,
  15100. conditionFieldExtend: '{}',
  15101. };
  15102. if (meta.column_ui === 'combo' && meta.column_dict) {
  15103. r.conditionFieldXtype = 'combo';
  15104. r.conditionFieldDict = meta.column_dict;
  15105. }
  15106. else if (meta.column_ui === "checkbox") {
  15107. r.conditionFieldXtype = 'checkbox';
  15108. }
  15109. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15110. r.conditionFieldXtype = 'numberfield';
  15111. }
  15112. _this.refs.gridCondition.appendEditRow(r);
  15113. }
  15114. else {
  15115. // 没找到元数据,直接添加
  15116. _this.refs.gridCondition.appendEditRow({
  15117. conditionFieldBind: columnName,
  15118. conditionFieldLabel: '',
  15119. conditionFieldXtype: 'textfield',
  15120. conditionFieldFlex: 1,
  15121. conditionFieldDict: '',
  15122. conditionFieldWrap: false,
  15123. conditionFieldExtend: '{}',
  15124. });
  15125. }
  15126. }
  15127. };
  15128. try {
  15129. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  15130. var m = re_1_1.value;
  15131. _loop_1(m);
  15132. }
  15133. }
  15134. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  15135. finally {
  15136. try {
  15137. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  15138. }
  15139. finally { if (e_1) throw e_1.error; }
  15140. }
  15141. }
  15142. }).finally(function () {
  15143. _this.refs.gridCondition.setLoading(false);
  15144. });
  15145. };
  15146. ReportDesign.prototype.addColumn = function () {
  15147. this.refs.gridColumn.appendEditRow({
  15148. dataIndex: '',
  15149. header: '',
  15150. xtype: '',
  15151. dataType: '',
  15152. width: '',
  15153. dict: '',
  15154. align: '',
  15155. filterable: true,
  15156. hidden: false,
  15157. sortable: true,
  15158. fieldExtend: '{}',
  15159. }, 'header');
  15160. };
  15161. ReportDesign.prototype.removeColumn = function () {
  15162. var _this = this;
  15163. var rows = [];
  15164. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  15165. rows.push(r);
  15166. });
  15167. _.forEach(rows, function (r) {
  15168. _this.refs.gridColumn.getStore().remove(r);
  15169. });
  15170. };
  15171. ReportDesign.prototype.calcColumn = function () {
  15172. var _this = this;
  15173. var sql = this.refs.sqlEditor.getCode();
  15174. this.refs.gridColumn.setLoading(true);
  15175. var rows = this.refs.gridColumn.getDataRows();
  15176. Promise.all([
  15177. parseDynamicSqlApi(sql),
  15178. instance.reloadIfNeedPromise(),
  15179. ]).then(function (_a) {
  15180. var _b = __read(_a, 1), res1 = _b[0];
  15181. if (res1.success) {
  15182. _.forEach(res1.data, function (parseItem) {
  15183. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  15184. // 是否找到重复字段
  15185. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  15186. if (exists) {
  15187. if ((columnTypeName || "").toLowerCase() === "number") {
  15188. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  15189. if (record) {
  15190. record.set("dataType", "number");
  15191. record.set("align", "end");
  15192. }
  15193. }
  15194. return;
  15195. }
  15196. if (tableName) {
  15197. // 解出表格名和字段名
  15198. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  15199. if (meta) {
  15200. // 找到了元数据
  15201. var r = {
  15202. dataIndex: meta.column_name,
  15203. header: meta.column_comment,
  15204. xtype: '',
  15205. dataType: '',
  15206. width: '',
  15207. dict: '',
  15208. align: '',
  15209. filterable: true,
  15210. hidden: false,
  15211. sortable: true,
  15212. fieldExtend: '{}',
  15213. };
  15214. if (meta.column_ui === 'combo' && meta.column_dict) {
  15215. r.dict = meta.column_dict;
  15216. }
  15217. else if (meta.column_ui === "checkbox") {
  15218. r.xtype = 'checkbox';
  15219. }
  15220. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15221. r.dataType = meta.data_type;
  15222. r.align = 'end';
  15223. }
  15224. if ((columnTypeName || "").toLowerCase() === "number") {
  15225. r.dataType = "number";
  15226. r.align = 'end';
  15227. }
  15228. _this.refs.gridColumn.appendEditRow(r);
  15229. return;
  15230. }
  15231. }
  15232. if (columnName) {
  15233. // 解出字段名
  15234. var r = {
  15235. dataIndex: columnName,
  15236. header: columnName,
  15237. xtype: '',
  15238. dataType: '',
  15239. width: '',
  15240. dict: '',
  15241. align: '',
  15242. filterable: true,
  15243. hidden: false,
  15244. sortable: true,
  15245. fieldExtend: '{}',
  15246. };
  15247. if ((columnTypeName || "").toLowerCase() === "number") {
  15248. r.dataType = "number";
  15249. r.align = 'end';
  15250. }
  15251. _this.refs.gridColumn.appendEditRow(r);
  15252. }
  15253. });
  15254. }
  15255. }).finally(function () {
  15256. _this.refs.gridColumn.setLoading(false);
  15257. });
  15258. };
  15259. ReportDesign.prototype.addSum = function () {
  15260. this.refs.gridSum.appendEditRow({
  15261. sumFieldBind: '',
  15262. sumFieldLabel: '',
  15263. sumFieldFlex: 1,
  15264. sumFieldWrap: false,
  15265. sumFieldExtend: '{}',
  15266. }, 'sumFieldBind');
  15267. };
  15268. ReportDesign.prototype.removeSum = function () {
  15269. var _this = this;
  15270. var rows = [];
  15271. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  15272. rows.push(r);
  15273. });
  15274. _.forEach(rows, function (r) {
  15275. _this.refs.gridSum.getStore().remove(r);
  15276. });
  15277. };
  15278. ReportDesign.prototype.calcSum = function () {
  15279. var _this = this;
  15280. var sql = this.refs.sqlSumEditor.getCode();
  15281. var rows = this.refs.gridSum.getDataRows();
  15282. this.refs.gridSum.setLoading(true);
  15283. parseDynamicSqlApi(sql).then(function (res1) {
  15284. if (res1.success) {
  15285. _.forEach(res1.data, function (parseItem) {
  15286. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  15287. // 是否找到重复字段
  15288. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  15289. return;
  15290. }
  15291. if (columnName) {
  15292. // 解出字段名
  15293. _this.refs.gridSum.appendEditRow({
  15294. sumFieldBind: columnName,
  15295. sumFieldLabel: columnName,
  15296. sumFieldFlex: 1,
  15297. sumFieldWrap: false,
  15298. sumFieldExtend: '{}',
  15299. });
  15300. }
  15301. });
  15302. }
  15303. }).finally(function () {
  15304. _this.refs.gridSum.setLoading(false);
  15305. });
  15306. };
  15307. Object.defineProperty(ReportDesign.prototype, "reportId", {
  15308. get: function () {
  15309. return this.viewModel.get('report_id');
  15310. },
  15311. enumerable: true,
  15312. configurable: true
  15313. });
  15314. return ReportDesign;
  15315. }(Scope));
  15316. //# sourceMappingURL=ReportDesign.js.map
  15317. var model$h = {
  15318. data: {
  15319. originalTableInfo: {
  15320. table_name: '',
  15321. description: '',
  15322. },
  15323. hasChanged: false,
  15324. schema_name: undefined,
  15325. table_name: undefined,
  15326. column_name: undefined,
  15327. tableInfo: {
  15328. schema_name: '',
  15329. table_name: '',
  15330. description: '',
  15331. biz_category: '',
  15332. note: '',
  15333. archive_enable: false,
  15334. archive_cron: '',
  15335. archive_condition: '',
  15336. column_list: []
  15337. },
  15338. },
  15339. formulas: {
  15340. shouldSave: function (get) {
  15341. // console.log("-->", get('grid1.ischanged'))
  15342. return get('grid1.ischanged')
  15343. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  15344. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  15345. },
  15346. },
  15347. };
  15348. //# sourceMappingURL=DbColumn.model.js.map
  15349. var vjson$h = {
  15350. bind: {
  15351. title: '{tableName}{shouldSave?" *":""}',
  15352. },
  15353. layout: 'fit',
  15354. items: [
  15355. {
  15356. layout: 'border',
  15357. tbar: {
  15358. xtype: 'toolbar',
  15359. items: [
  15360. // {
  15361. // xtype: 'button',
  15362. // text: '拉取库结构',
  15363. // iconCls: 'x-fa fa-cloud-download',
  15364. // listeners: {
  15365. // click: 'scope.pullFromDb'
  15366. // }
  15367. // },
  15368. {
  15369. xtype: 'button',
  15370. text: '保存至数据库',
  15371. iconCls: 'x-fa fa-save',
  15372. bind: {
  15373. disabled: '{!shouldSave}'
  15374. },
  15375. listeners: {
  15376. click: 'scope.pushToDb'
  15377. }
  15378. },
  15379. '-',
  15380. {
  15381. xtype: 'button',
  15382. text: '刷新 QueryDSL',
  15383. iconCls: 'x-fa fa-refresh',
  15384. listeners: {
  15385. click: 'scope.syncQueryDSL'
  15386. }
  15387. },
  15388. {
  15389. xtype: 'button',
  15390. text: '生成 DDL',
  15391. iconCls: 'x-fa fa-file-text',
  15392. listeners: {
  15393. click: 'scope.buildDDL'
  15394. }
  15395. }
  15396. ]
  15397. },
  15398. items: [
  15399. {
  15400. region: 'center',
  15401. xtype: 'tabpanel',
  15402. items: [
  15403. {
  15404. title: '字段',
  15405. xtype: 'yvgrid',
  15406. selModel: {
  15407. type: 'spreadsheet',
  15408. columnSelect: true,
  15409. pruneRemoved: false,
  15410. extensible: 'y'
  15411. },
  15412. enableLocking: false,
  15413. idField: 'column_name',
  15414. plugins: {
  15415. clipboard: true,
  15416. selectionreplicator: true
  15417. },
  15418. reference: 'grid1',
  15419. pagination: false,
  15420. // hideFootbar: true,
  15421. tbar: {
  15422. xtype: 'form',
  15423. items: [
  15424. {
  15425. xtype: 'cols',
  15426. items: [
  15427. {
  15428. xtype: 'textfield',
  15429. fieldLabel: '表格名',
  15430. reference: 'text_table_name',
  15431. readOnly: true,
  15432. bind: {
  15433. value: '{tableInfo.table_name}'
  15434. }
  15435. },
  15436. {
  15437. xtype: 'textfield',
  15438. fieldLabel: '描述',
  15439. // readOnly: true,
  15440. bind: {
  15441. value: '{tableInfo.description}'
  15442. }
  15443. },
  15444. ]
  15445. },
  15446. {
  15447. xtype: 'toolbar',
  15448. items: [
  15449. {
  15450. xtype: 'button',
  15451. text: '添加',
  15452. iconCls: 'x-fa fa-plus-circle',
  15453. listeners: {
  15454. click: 'scope.addField'
  15455. }
  15456. },
  15457. {
  15458. xtype: 'button',
  15459. text: '删除',
  15460. iconCls: 'x-fa fa-minus-circle',
  15461. listeners: {
  15462. click: 'scope.removeField'
  15463. }
  15464. },
  15465. ]
  15466. },
  15467. ]
  15468. },
  15469. listeners: {
  15470. editbefore: 'scope.gridEditBefore'
  15471. },
  15472. columns: [
  15473. {
  15474. text: '字段名', dataIndex: 'column_name',
  15475. sortable: false,
  15476. menuDisabled: true,
  15477. width: 120,
  15478. editor: {
  15479. allowBlank: true,
  15480. selectOnFocus: false
  15481. }
  15482. },
  15483. {
  15484. text: '字段中文', dataIndex: 'column_comment',
  15485. width: 130,
  15486. sortable: false,
  15487. menuDisabled: true,
  15488. editor: {
  15489. allowBlank: true,
  15490. selectOnFocus: false
  15491. }
  15492. },
  15493. {
  15494. text: '主键', dataIndex: 'is_primary_key',
  15495. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15496. width: 48, resizable: false,
  15497. },
  15498. {
  15499. text: '必填', dataIndex: 'not_null',
  15500. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15501. width: 48, resizable: false,
  15502. },
  15503. {
  15504. text: '字段域', dataIndex: 'column_domain',
  15505. sortable: false, menuDisabled: true,
  15506. width: 148,
  15507. dict: 'column_domain',
  15508. editor: {
  15509. xtype: 'combo',
  15510. allowBlank: true,
  15511. selectOnFocus: true,
  15512. // fix: ['system.getDict("column_domain")'],
  15513. dict: 'column_domain',
  15514. listConfig: {
  15515. minWidth: 200
  15516. },
  15517. listeners: {
  15518. change: 'scope.columnDomainChange',
  15519. }
  15520. }
  15521. },
  15522. {
  15523. text: '数据类型', dataIndex: 'data_type',
  15524. sortable: false, menuDisabled: true,
  15525. editor: { allowBlank: true, selectOnFocus: true }
  15526. },
  15527. {
  15528. text: '长度', dataIndex: 'column_size',
  15529. sortable: false, menuDisabled: true,
  15530. xtype: 'numbercolumn', format: '0',
  15531. editor: { allowBlank: true, selectOnFocus: true }
  15532. },
  15533. {
  15534. text: '小数位', dataIndex: 'decimal_digits',
  15535. sortable: false, menuDisabled: true,
  15536. xtype: 'numbercolumn', format: '0',
  15537. editor: { allowBlank: true, selectOnFocus: true }
  15538. },
  15539. {
  15540. text: '默认值', dataIndex: 'default_value',
  15541. sortable: false, menuDisabled: true,
  15542. editor: { allowBlank: true, selectOnFocus: true }
  15543. },
  15544. {
  15545. text: '字典', dataIndex: 'column_dict',
  15546. sortable: false, menuDisabled: true,
  15547. // fix: ['system.getDict("DICT")'],
  15548. width: 200,
  15549. editor: {
  15550. xtype: 'combo',
  15551. allowBlank: true,
  15552. listConfig: {
  15553. minWidth: 350
  15554. },
  15555. }
  15556. },
  15557. {
  15558. text: 'UI建议', dataIndex: 'column_ui',
  15559. sortable: false, menuDisabled: true,
  15560. // fix: ['system.getDict("column_ui")'],
  15561. editor: {
  15562. xtype: 'combo',
  15563. allowBlank: true,
  15564. listConfig: {
  15565. minWidth: 200
  15566. },
  15567. }
  15568. },
  15569. {
  15570. text: '详细描述', dataIndex: 'column_note',
  15571. sortable: false, menuDisabled: true,
  15572. editor: { allowBlank: true, }
  15573. },
  15574. ]
  15575. },
  15576. {
  15577. title: '高级属性',
  15578. xtype: 'form',
  15579. items: [
  15580. // {
  15581. // xtype: 'textfield',
  15582. // fieldLabel: '表格名',
  15583. // bind: {
  15584. // value: '{tableName}'
  15585. // }
  15586. // },
  15587. // {
  15588. // xtype: 'textfield',
  15589. // fieldLabel: '中文含义',
  15590. // bind: {
  15591. // value: '{tableInfo.description}'
  15592. // }
  15593. // },
  15594. {
  15595. xtype: 'combo',
  15596. fieldLabel: '业务类型',
  15597. bind: {
  15598. value: '{tableInfo.biz_category}'
  15599. },
  15600. store: [
  15601. '基础资料',
  15602. '系统',
  15603. '账目与库存',
  15604. '单据',
  15605. '指令',
  15606. '规则与流程',
  15607. '开发辅助',
  15608. ]
  15609. },
  15610. {
  15611. xtype: 'textfield',
  15612. fieldLabel: '详细描述',
  15613. bind: {
  15614. value: '{tableInfo.note}'
  15615. },
  15616. },
  15617. {
  15618. xtype: 'checkbox',
  15619. fieldLabel: '允许归档',
  15620. bind: "{tableInfo.archive_enable}",
  15621. },
  15622. {
  15623. xtype: 'textfield',
  15624. fieldLabel: '归档周期',
  15625. bind: {
  15626. value: '{tableInfo.archive_cron}',
  15627. hidden: '{!tableInfo.archive_enable}',
  15628. }
  15629. },
  15630. {
  15631. xtype: 'textfield',
  15632. fieldLabel: '归档条件',
  15633. bind: {
  15634. value: '{tableInfo.archive_condition}',
  15635. hidden: '{!tableInfo.archive_enable}',
  15636. }
  15637. },
  15638. ]
  15639. },
  15640. ]
  15641. }
  15642. ]
  15643. },
  15644. ]
  15645. };
  15646. //# sourceMappingURL=DbColumn.view.js.map
  15647. var DbColumn = /** @class */ (function (_super) {
  15648. __extends(DbColumn, _super);
  15649. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  15650. var _this = _super.call(this, {
  15651. model: getModel(model$h, schemaName, tableName, columnName, isCreateTable),
  15652. vjson: vjson$h
  15653. }) || this;
  15654. _this.isCreate = false;
  15655. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  15656. return _this;
  15657. }
  15658. DbColumn.prototype.onLoad = function () {
  15659. var _this = this;
  15660. var _a, _b, _c, _d, _e, _f, _g, _h;
  15661. console.log('me', this);
  15662. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  15663. this.refs.grid1.autoSizeColumns();
  15664. // this.refs.grid1.columns[0].hide()
  15665. // 自动定位到选定的列
  15666. if (this.viewModel.get('column_name')) {
  15667. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  15668. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  15669. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  15670. return;
  15671. }
  15672. }
  15673. }
  15674. instance$3.getColumnDomainComboData().then(function () {
  15675. _this.checkDomain();
  15676. });
  15677. this.viewModel.set('originalTableInfo.table_name', (_c = (_b = (_a = this.viewModel.data) === null || _a === void 0 ? void 0 : _a.tableInfo) === null || _b === void 0 ? void 0 : _b.table_name) !== null && _c !== void 0 ? _c : "");
  15678. this.viewModel.set('originalTableInfo.description', (_f = (_e = (_d = this.viewModel.data) === null || _d === void 0 ? void 0 : _d.tableInfo) === null || _e === void 0 ? void 0 : _e.description) !== null && _f !== void 0 ? _f : "");
  15679. if (this.isCreate)
  15680. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  15681. };
  15682. DbColumn.prototype.checkDomain = function () {
  15683. // 走查一遍 domain
  15684. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15685. var dbType = this.viewModel.get('tableInfo.db_type');
  15686. var diffColumnName = [];
  15687. var tableInfo = this.viewModel.get('tableInfo');
  15688. this.refs.grid1.store.data.items.forEach(function (record) {
  15689. var data = record.data;
  15690. var column_domain = data.column_domain;
  15691. var domain = instance$3.getColumnDomainById(column_domain);
  15692. if (!domain) {
  15693. // 没有找到 domain
  15694. return;
  15695. }
  15696. var editRow = applyDomain(dbType, domain);
  15697. // 字段跟领域做对比
  15698. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  15699. if (typeof compareResult === 'string') {
  15700. // 不一样的情况下,要改成一致
  15701. _$2.forOwn(editRow, function (value, key) {
  15702. // 改成与 domain 一致
  15703. record.set(key, value);
  15704. });
  15705. diffColumnName.push(data.column_name + '.' + compareResult);
  15706. }
  15707. });
  15708. if (diffColumnName.length > 0) {
  15709. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  15710. }
  15711. };
  15712. DbColumn.prototype.addField = function () {
  15713. this.refs.grid1.appendEditRow({
  15714. column_name: '',
  15715. column_comment: '',
  15716. is_primary_key: false,
  15717. not_null: true,
  15718. column_domain: '',
  15719. data_type: '',
  15720. column_size: 0,
  15721. decimal_digits: 0,
  15722. default_value: '',
  15723. column_dict: '',
  15724. column_ui: '',
  15725. column_note: '',
  15726. }, 'column_name');
  15727. };
  15728. DbColumn.prototype.removeField = function () {
  15729. var _this = this;
  15730. var rows = [];
  15731. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  15732. rows.push(r);
  15733. });
  15734. _$2.forEach(rows, function (r) {
  15735. _this.refs.grid1.getStore().remove(r);
  15736. });
  15737. };
  15738. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  15739. instance$3.getColumnDomainComboData().then(function (data) {
  15740. editor.cmp.columns[5].getEditor().setStore({ data: data });
  15741. });
  15742. // 被字段域锁定的内容,不允许修改
  15743. var record = context.record, field = context.field;
  15744. var domainId = record.get('column_domain');
  15745. if (!domainId) {
  15746. return;
  15747. }
  15748. var domain = instance$3.getColumnDomainById(domainId);
  15749. if (!domain) {
  15750. msg$1('没有找到字段域' + domainId);
  15751. return;
  15752. }
  15753. if (field === "data_type") {
  15754. // 字段类型不允许修改
  15755. context.cancel = true;
  15756. return;
  15757. }
  15758. if (domain.is_fix_size &&
  15759. (field === "column_size" ||
  15760. field === "decimal_digits")) {
  15761. // 锁定长度的情况下,大小不允许修改
  15762. context.cancel = true;
  15763. return;
  15764. }
  15765. if (domain.is_fix_default_value && field === "default_value") {
  15766. // 锁定默认值的情况下,默认值不允许修改
  15767. context.cancel = true;
  15768. return;
  15769. }
  15770. };
  15771. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  15772. if (!newValue) {
  15773. return;
  15774. }
  15775. var grid = editor.up('grid').ownerGrid;
  15776. var domain = instance$3.getColumnDomainById(newValue);
  15777. if (!domain) {
  15778. msg$1('没有找到 domain:' + newValue);
  15779. return;
  15780. }
  15781. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15782. var dbType = this.viewModel.get('tableInfo.db_type');
  15783. var editRow = applyDomain(dbType, domain);
  15784. grid.setEditRow(editRow);
  15785. };
  15786. DbColumn.prototype.pullFromDb = function () {
  15787. };
  15788. DbColumn.prototype.pushToDb = function (sender) {
  15789. var _this = this;
  15790. // 设置当前界面为 "保存中..." 状态
  15791. var me = this;
  15792. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  15793. this.viewModel.set('tableInfo.table_name', table_name);
  15794. this.viewModel.set('tableInfo.schema_name', schema_name);
  15795. var tableInfo = this.viewModel.get('tableInfo');
  15796. var column_list = this.refs.grid1.getDataRows();
  15797. var hasError = false;
  15798. if (column_list.length <= 0) {
  15799. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  15800. hasError = true;
  15801. }
  15802. var columnNameExistsCheck = {};
  15803. _$2.forEach(column_list, function (row, i) {
  15804. var checkResult = checkColumn(tableInfo, row);
  15805. if (typeof checkResult !== 'undefined') {
  15806. msg$1(checkResult);
  15807. hasError = true;
  15808. _this.refs.grid1.beginEdit(i, 'column_name');
  15809. return false;
  15810. }
  15811. if (!row.column_domain || row.column_domain === '0') {
  15812. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  15813. hasError = true;
  15814. _this.refs.grid1.beginEdit(i, 'column_domain');
  15815. return false;
  15816. }
  15817. if (isEmpty(row.data_type)) {
  15818. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  15819. hasError = true;
  15820. _this.refs.grid1.beginEdit(i, 'data_type');
  15821. return false;
  15822. }
  15823. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  15824. // 列名已存在
  15825. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  15826. hasError = true;
  15827. _this.refs.grid1.beginEdit(i, 'column_name');
  15828. return false;
  15829. }
  15830. columnNameExistsCheck[row.column_name] = true;
  15831. });
  15832. if (hasError)
  15833. return;
  15834. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  15835. me.setLoading(true);
  15836. instance.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  15837. .then(function (res) {
  15838. var _a;
  15839. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  15840. // 返回 DDL 就要显示出来
  15841. var window_1 = Ext.create('Ext.window.Window', {
  15842. title: 'SQL 预览',
  15843. height: 400,
  15844. width: 600,
  15845. modal: true,
  15846. animateTarget: sender,
  15847. maximizable: true,
  15848. layout: 'fit',
  15849. items: {
  15850. xtype: 'sqleditor',
  15851. value: res.data.ddl
  15852. },
  15853. buttons: [
  15854. {
  15855. xtype: 'button',
  15856. text: '执行',
  15857. iconCls: 'x-fa fa-save',
  15858. handler: function (sender) {
  15859. var editor = sender.up('window').down('sqleditor');
  15860. var ddl = editor.getValue();
  15861. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  15862. }
  15863. },
  15864. {
  15865. xtype: 'button',
  15866. text: '取消',
  15867. iconCls: 'x-fa fa-times',
  15868. handler: function () {
  15869. window_1.close();
  15870. }
  15871. }
  15872. ]
  15873. }).show();
  15874. return;
  15875. }
  15876. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15877. var tableRow = instance.getTableByName(schema_name, table_name);
  15878. if (!tableRow) {
  15879. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15880. console.log('这是一个新 table');
  15881. instance.appendNewTable(tableInfo);
  15882. }
  15883. _this.viewModel.set('schema_name', schema_name);
  15884. _this.viewModel.set('table_name', table_name);
  15885. _this.viewModel.set('tableInfo', tableInfo);
  15886. _this.refs.grid1.setData(tableInfo.column_list);
  15887. if (tableRow)
  15888. Object.assign(tableRow, tableInfo);
  15889. msg$1('保存成功');
  15890. _this.viewModel.set('hasChanged', false);
  15891. })
  15892. .finally(function () {
  15893. me.setLoading(false);
  15894. });
  15895. };
  15896. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  15897. var _this = this;
  15898. window.setLoading(true);
  15899. instance.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  15900. .then(function (res) {
  15901. var _a, _b, _c, _d;
  15902. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15903. // 保存成功就提示一下,并重新载入数据
  15904. msg$1(res.msg);
  15905. instance.reloadForce(undefined);
  15906. var tableRow = instance.getTableByName(schema_name, table_name);
  15907. if (!tableRow) {
  15908. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15909. console.log('这是一个新 table');
  15910. instance.appendNewTable(tableInfo);
  15911. }
  15912. _this.viewModel.set('schema_name', schema_name);
  15913. _this.viewModel.set('table_name', table_name);
  15914. _this.viewModel.set('tableInfo', tableInfo);
  15915. _this.refs.grid1.setData(tableInfo.column_list);
  15916. if (tableRow)
  15917. Object.assign(tableRow, tableInfo);
  15918. instance.notifyRefresh();
  15919. window.close();
  15920. _this.viewModel.set('hasChanged', false);
  15921. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  15922. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  15923. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  15924. })
  15925. .finally(function () {
  15926. // 无论正常异常,关闭 "保存中..." 状态
  15927. window.setLoading(false);
  15928. });
  15929. };
  15930. DbColumn.prototype.syncQueryDSL = function () {
  15931. var _this = this;
  15932. var tableInfo = this.viewModel.get("tableInfo");
  15933. this.setLoading(true);
  15934. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  15935. .then(function () {
  15936. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  15937. })
  15938. .finally(function () {
  15939. _this.setLoading(false);
  15940. });
  15941. };
  15942. DbColumn.prototype.buildDDL = function () {
  15943. };
  15944. return DbColumn;
  15945. }(Scope));
  15946. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  15947. model.data.schema_name = schemaName;
  15948. model.data.table_name = tableName;
  15949. model.data.column_name = columnName;
  15950. if (isCreateTable) {
  15951. var dbType = instance.getSchemaDbType(schemaName);
  15952. if (!dbType) {
  15953. throw Error('无法识别数据库类型' + schemaName);
  15954. }
  15955. model.data.tableInfo.schema_name = model.data.schema_name;
  15956. model.data.tableInfo.table_name = model.data.table_name;
  15957. model.data.tableInfo.db_type = dbType;
  15958. model.data.tableInfo.column_list = [];
  15959. model.data.tableInfo.is_create = true;
  15960. return model;
  15961. }
  15962. var tableRow = instance.getTableByName(schemaName, tableName);
  15963. if (!tableRow) {
  15964. throw Error('没有找到 table' + schemaName + tableName + columnName);
  15965. }
  15966. model.data.tableInfo = _$2.cloneDeep(tableRow);
  15967. model.data.tableInfo.is_create = false;
  15968. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  15969. return model;
  15970. }
  15971. //# sourceMappingURL=DbColumn.js.map
  15972. var model$i = {
  15973. data: {
  15974. id: '',
  15975. path: '',
  15976. form: {
  15977. title: '',
  15978. sqlId: '',
  15979. }
  15980. }
  15981. };
  15982. //# sourceMappingURL=WidgetDesign.model.js.map
  15983. var vjson$i = {
  15984. bind: {
  15985. title: '{title}',
  15986. },
  15987. layout: 'fit',
  15988. items: [
  15989. {
  15990. layout: 'border',
  15991. items: [
  15992. {
  15993. region: 'center',
  15994. layout: 'border',
  15995. items: [
  15996. {
  15997. region: 'north',
  15998. items: [
  15999. {
  16000. xtype: 'toolbar',
  16001. border: false,
  16002. items: [
  16003. {
  16004. xtype: 'button',
  16005. text: '刷新',
  16006. iconCls: 'x-fa fa-refresh',
  16007. listeners: {
  16008. click: 'scope.load'
  16009. }
  16010. },
  16011. {
  16012. xtype: 'button',
  16013. text: '保存',
  16014. iconCls: 'x-fa fa-save',
  16015. listeners: {
  16016. click: 'scope.widgetSave'
  16017. }
  16018. },
  16019. {
  16020. xtype: 'button',
  16021. text: '预览',
  16022. iconCls: 'x-fa fa-play-circle-o',
  16023. listeners: {
  16024. //click: 'scope.preview'
  16025. }
  16026. },
  16027. {
  16028. xtype: 'textfield',
  16029. fieldLabel: '弹窗文件',
  16030. reference: "wPath",
  16031. labelWidth: 80,
  16032. //width: 200,
  16033. bind: {
  16034. value: '{widgetPath}',
  16035. },
  16036. readOnly: true,
  16037. },
  16038. {
  16039. xtype: 'textfield',
  16040. fieldLabel: '弹窗名称',
  16041. reference: "wTitle",
  16042. labelWidth: 80,
  16043. //width: 200,
  16044. bind: {
  16045. value: '{form.title}',
  16046. },
  16047. readOnly: true,
  16048. },
  16049. {
  16050. xtype: 'textfield',
  16051. fieldLabel: 'sqlId',
  16052. bind: {
  16053. value: '{form.sqlId}',
  16054. },
  16055. readOnly: true,
  16056. },
  16057. ]
  16058. },
  16059. ]
  16060. },
  16061. {
  16062. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  16063. items: [
  16064. {
  16065. title: "SQL和条件",
  16066. layout: 'border',
  16067. border: false,
  16068. items: [
  16069. {
  16070. region: 'north',
  16071. height: 200,
  16072. xtype: 'yvgrid',
  16073. reference: "grid2",
  16074. split: true,
  16075. selModel: {
  16076. selType: 'rowmodel',
  16077. mode: 'SINGLE',
  16078. },
  16079. store: {},
  16080. pagination: false,
  16081. hideFootbar: true,
  16082. tbar: {
  16083. xtype: 'toolbar',
  16084. items: [
  16085. {
  16086. xtype: 'button',
  16087. text: '添加',
  16088. iconCls: 'x-fa fa-plus-circle',
  16089. listeners: {}
  16090. },
  16091. {
  16092. xtype: 'button',
  16093. text: '删除',
  16094. iconCls: 'x-fa fa-minus-circle',
  16095. listeners: {
  16096. click: 'scope.delCondition'
  16097. }
  16098. },
  16099. '-',
  16100. {
  16101. xtype: 'button',
  16102. text: '上移',
  16103. iconCls: 'x-fa fa-refresh',
  16104. listeners: {
  16105. //click: 'scope.saveAll'
  16106. }
  16107. },
  16108. {
  16109. xtype: 'button',
  16110. text: '下移',
  16111. iconCls: 'x-fa fa-refresh',
  16112. listeners: {
  16113. //click: 'scope.saveAll'
  16114. }
  16115. },
  16116. '-',
  16117. {
  16118. xtype: 'button',
  16119. text: '自动分析',
  16120. iconCls: 'x-fa fa-refresh',
  16121. listeners: {
  16122. click: 'scope.calcCondition'
  16123. }
  16124. },
  16125. ]
  16126. },
  16127. columns: [
  16128. {
  16129. text: '条件变量',
  16130. dataIndex: 'conditionFieldBind',
  16131. width: 140,
  16132. sortable: false,
  16133. menuDisabled: true,
  16134. editor: {
  16135. selectOnFocus: true
  16136. },
  16137. },
  16138. {
  16139. text: '中文标题',
  16140. dataIndex: 'conditionFieldLabel',
  16141. width: 120,
  16142. sortable: false,
  16143. menuDisabled: true,
  16144. editor: {
  16145. selectOnFocus: true
  16146. },
  16147. },
  16148. {
  16149. text: '编辑类型',
  16150. dataIndex: 'xtype',
  16151. sortable: false,
  16152. menuDisabled: true,
  16153. editor: {
  16154. xtype: 'combo',
  16155. typeAhead: true,
  16156. triggerAction: 'all',
  16157. selectOnFocus: true,
  16158. store: [
  16159. ['textfield', 'textfield'],
  16160. ['combo', 'combo'],
  16161. ['datefield', 'datefield'],
  16162. ['datetimefield', 'datetimefield'],
  16163. ['numberfield', 'numberfield'],
  16164. ['multiplesearch', 'multiplesearch'],
  16165. ]
  16166. }
  16167. },
  16168. {
  16169. text: '权重',
  16170. dataIndex: 'conditionFieldFlex',
  16171. align: 'right',
  16172. sortable: false,
  16173. menuDisabled: true,
  16174. editor: {
  16175. xtype: 'numberfield',
  16176. selectOnFocus: false,
  16177. minValue: 0,
  16178. maxValue: 10
  16179. },
  16180. },
  16181. {
  16182. text: '字典',
  16183. dataIndex: 'conditionFieldDict',
  16184. width: 160,
  16185. sortable: false,
  16186. menuDisabled: true,
  16187. editor: {
  16188. selectOnFocus: false
  16189. },
  16190. },
  16191. {
  16192. xtype: 'checkcolumn',
  16193. dataIndex: "conditionFieldWrap", header: "换行",
  16194. width: 65,
  16195. sortable: false,
  16196. menuDisabled: true,
  16197. },
  16198. ]
  16199. },
  16200. {
  16201. region: 'center',
  16202. xtype: 'sqleditor',
  16203. layout: 'fit',
  16204. reference: 'sqlEditor',
  16205. split: true,
  16206. bind: {
  16207. value: "{form.sql}"
  16208. },
  16209. },
  16210. ]
  16211. },
  16212. {
  16213. title: "结果字段定义",
  16214. border: false,
  16215. xtype: 'yvgrid',
  16216. reference: "grid3",
  16217. selModel: {
  16218. selType: 'rowmodel',
  16219. mode: 'SINGLE',
  16220. },
  16221. store: {},
  16222. pagination: false,
  16223. hideFootbar: true,
  16224. tbar: {
  16225. xtype: 'toolbar',
  16226. items: [
  16227. {
  16228. xtype: 'button',
  16229. text: '添加',
  16230. iconCls: 'x-fa fa-plus-circle',
  16231. listeners: {}
  16232. },
  16233. {
  16234. xtype: 'button',
  16235. text: '删除',
  16236. iconCls: 'x-fa fa-minus-circle',
  16237. listeners: {
  16238. click: 'scope.delColumn'
  16239. }
  16240. },
  16241. '-',
  16242. {
  16243. xtype: 'button',
  16244. text: '上移',
  16245. iconCls: 'x-fa fa-refresh',
  16246. listeners: {
  16247. //click: 'scope.saveAll'
  16248. }
  16249. },
  16250. {
  16251. xtype: 'button',
  16252. text: '下移',
  16253. iconCls: 'x-fa fa-refresh',
  16254. listeners: {
  16255. //click: 'scope.saveAll'
  16256. }
  16257. },
  16258. '-',
  16259. {
  16260. xtype: 'button',
  16261. text: '自动分析',
  16262. iconCls: 'x-fa fa-refresh',
  16263. listeners: {
  16264. click: 'scope.calcColumn'
  16265. }
  16266. },
  16267. ]
  16268. },
  16269. columns: [
  16270. { xtype: 'rownumberer' },
  16271. {
  16272. text: '字段',
  16273. dataIndex: 'dataIndex',
  16274. width: 140,
  16275. sortable: false,
  16276. menuDisabled: true,
  16277. editor: {
  16278. selectOnFocus: true
  16279. },
  16280. },
  16281. {
  16282. text: '标题',
  16283. dataIndex: 'header',
  16284. width: 120,
  16285. sortable: false,
  16286. menuDisabled: true,
  16287. editor: {
  16288. selectOnFocus: true
  16289. },
  16290. },
  16291. {
  16292. text: '显示类型',
  16293. dataIndex: 'xtype',
  16294. width: 90,
  16295. sortable: false,
  16296. menuDisabled: true,
  16297. editor: {
  16298. xtype: 'combo',
  16299. typeAhead: true,
  16300. triggerAction: 'all',
  16301. selectOnFocus: true,
  16302. store: [
  16303. ['', ''],
  16304. ['rownum', 'rownum'],
  16305. ['button', 'button'],
  16306. ['checkbox', 'checkbox'],
  16307. ['progres', 'progres'],
  16308. ]
  16309. }
  16310. },
  16311. {
  16312. text: '数据类型',
  16313. dataIndex: 'dataType',
  16314. width: 90,
  16315. sortable: false,
  16316. menuDisabled: true,
  16317. editor: {
  16318. xtype: 'combo',
  16319. typeAhead: true,
  16320. triggerAction: 'all',
  16321. selectOnFocus: true,
  16322. store: [
  16323. ['', ''],
  16324. ['string', 'string'],
  16325. ['number', 'number'],
  16326. ['date', 'date'],
  16327. ]
  16328. }
  16329. },
  16330. {
  16331. text: '数据字典',
  16332. dataIndex: 'dict',
  16333. sortable: false,
  16334. menuDisabled: true,
  16335. width: 120,
  16336. editor: {
  16337. selectOnFocus: true,
  16338. },
  16339. },
  16340. ],
  16341. },
  16342. ]
  16343. },
  16344. ]
  16345. },
  16346. ]
  16347. }
  16348. ]
  16349. }; //
  16350. //
  16351. //# sourceMappingURL=WidgetDesign.view.js.map
  16352. var WidgetDesign = /** @class */ (function (_super) {
  16353. __extends(WidgetDesign, _super);
  16354. function WidgetDesign(widgetPath, widgetName) {
  16355. var _this = _super.call(this, { model: model$i, vjson: vjson$i }) || this;
  16356. _this.widgetPath = widgetPath;
  16357. _this.widgetName = widgetName;
  16358. return _this;
  16359. }
  16360. WidgetDesign.prototype.onLoad = function () {
  16361. if (this.widgetPath) {
  16362. this.loadForm(this.widgetPath);
  16363. this.viewModel.set("widgetPath", this.widgetPath);
  16364. this.refs.wTitle.setReadOnly(true);
  16365. this.refs.wPath.setReadOnly(true);
  16366. }
  16367. else {
  16368. this.refs.wTitle.setReadOnly(false);
  16369. this.refs.wPath.setReadOnly(false);
  16370. }
  16371. };
  16372. WidgetDesign.prototype.load = function () {
  16373. var widgetPath = this.viewModel.get("widgetPath");
  16374. if (widgetPath) {
  16375. this.loadForm(widgetPath);
  16376. }
  16377. };
  16378. WidgetDesign.prototype.loadForm = function (widgetPath) {
  16379. var _this = this;
  16380. var me = this;
  16381. me.setLoading(true);
  16382. readWidget({ widgetPath: widgetPath }).then(function (res) {
  16383. msg$1(res.msg);
  16384. if (res.success) {
  16385. _this.viewModel.set("widgetPath", widgetPath);
  16386. me.refs.grid3.getStore().removeAll();
  16387. if (res.data.form.columns) {
  16388. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  16389. }
  16390. _this.viewModel.set("form.title", res.data.form.title);
  16391. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  16392. // set sql
  16393. _this.refs.sqlEditor.setCode(res.data.sql);
  16394. }
  16395. }).finally(function () {
  16396. me.setLoading(false);
  16397. });
  16398. };
  16399. WidgetDesign.prototype.widgetAdd = function (sender) {
  16400. var _this = this;
  16401. var title = this.viewModel.get("form.title");
  16402. if (title) {
  16403. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  16404. if (btn == 'yes') {
  16405. alert(1);
  16406. }
  16407. else {
  16408. alert(2);
  16409. }
  16410. });
  16411. }
  16412. else {
  16413. var me_1 = this;
  16414. var win_1 = new Ext.Window({
  16415. autoDestroy: true,
  16416. title: "新建弹框",
  16417. width: 400,
  16418. height: 220,
  16419. resizable: true,
  16420. closable: true,
  16421. maximizable: true,
  16422. minimizable: true,
  16423. plain: true,
  16424. // constrainHeader: true,
  16425. constrain: true,
  16426. layout: 'fit',
  16427. animateTarget: sender,
  16428. buttonAlign: 'center',
  16429. items: [
  16430. {
  16431. xtype: "form",
  16432. layout: "hbox",
  16433. margin: '10px 20px',
  16434. border: 0,
  16435. items: [
  16436. {
  16437. flex: 1,
  16438. layout: 'vbox',
  16439. items: [
  16440. {
  16441. xtype: "textfield",
  16442. name: "widgetcode",
  16443. fieldLabel: "弹框编号",
  16444. flex: 1,
  16445. allowBlank: false,
  16446. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  16447. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  16448. labelWidth: 50,
  16449. width: "100%",
  16450. },
  16451. {
  16452. xtype: "textfield",
  16453. name: "widgetname",
  16454. fieldLabel: "弹框名称",
  16455. flex: 1,
  16456. allowBlank: false,
  16457. labelWidth: 50,
  16458. width: "100%",
  16459. },
  16460. ]
  16461. },
  16462. ]
  16463. }
  16464. ],
  16465. //窗口按钮
  16466. buttons: [
  16467. {
  16468. xtype: 'button', text: '保存', handler: function (btn) {
  16469. //窗口获取表单
  16470. var form = win_1.down('form');
  16471. var vaildSuccess = form.isValid();
  16472. if (!vaildSuccess) {
  16473. return;
  16474. }
  16475. var title = form.down('textfield[name="widgetname"]').getValue();
  16476. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  16477. me_1.viewModel.set("form.title", title);
  16478. me_1.viewModel.set("widgetPath", widgetPath);
  16479. var formdata = _this.viewModel.get("form");
  16480. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  16481. if (res.success) {
  16482. msg$1('添加成功');
  16483. }
  16484. me_1.loadForm(widgetPath);
  16485. win_1.close();
  16486. });
  16487. }
  16488. },
  16489. {
  16490. xtype: 'button', text: '取消', handler: function (btn) {
  16491. //窗口关闭
  16492. win_1.close();
  16493. }
  16494. }
  16495. ]
  16496. });
  16497. win_1.show();
  16498. }
  16499. };
  16500. WidgetDesign.prototype.widgetSave = function () {
  16501. var _this = this;
  16502. var _a, _b;
  16503. var widgetPath = this.viewModel.get("widgetPath");
  16504. if (!widgetPath) {
  16505. msg$1("请选择或添加弹框后再保存!");
  16506. return;
  16507. }
  16508. var title = this.viewModel.get("form.title");
  16509. if (!title) {
  16510. msg$1("请选择或添加弹框后再保存!");
  16511. return;
  16512. }
  16513. // 获取条件
  16514. var conditions = (_a = this.refs.grid2.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; }).map(function (r) {
  16515. delete r.id;
  16516. return r;
  16517. });
  16518. this.viewModel.set("form.conditions", conditions);
  16519. // 获取查询列
  16520. var columns = (_b = this.refs.grid3.getStore().getData().items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }).map(function (r) {
  16521. delete r.id;
  16522. if (r.dict) {
  16523. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  16524. }
  16525. return r;
  16526. });
  16527. this.viewModel.set("form.columns", columns);
  16528. // sql
  16529. var sql = this.refs.sqlEditor.getCode();
  16530. this.viewModel.set("form.sql", sql);
  16531. var form = this.viewModel.get("form");
  16532. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  16533. msg$1(res.msg);
  16534. if (res.success) {
  16535. msg$1('保存成功');
  16536. _this.loadForm(widgetPath);
  16537. }
  16538. }).catch(function (res) {
  16539. });
  16540. };
  16541. WidgetDesign.prototype.delCondition = function () {
  16542. var _a;
  16543. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16544. };
  16545. WidgetDesign.prototype.delColumn = function () {
  16546. var _a;
  16547. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16548. };
  16549. WidgetDesign.prototype.calcCondition = function () {
  16550. var _this = this;
  16551. var sql = this.refs.sqlEditor.getCode();
  16552. var re = sql.matchAll(/#{(.+?)}/gi);
  16553. var rows = this.refs.grid2.getDataRows();
  16554. this.refs.grid2.setLoading(true);
  16555. parseDynamicSqlApi(sql).then(function (res) {
  16556. var e_1, _a;
  16557. if (res.success) {
  16558. var tables_1 = [];
  16559. _.forEach(res.data, function (parseItem) {
  16560. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  16561. if (tableName && !_.includes(tables_1, tableName)) {
  16562. tables_1.push(tableName);
  16563. }
  16564. });
  16565. var _loop_1 = function (m) {
  16566. var e_2, _a;
  16567. var columnName = m[1];
  16568. // 没有这个列才添加
  16569. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  16570. var meta = undefined;
  16571. try {
  16572. for (var tables_2 = (e_2 = void 0, __values(tables_1)), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
  16573. var tableName = tables_2_1.value;
  16574. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16575. if (meta) {
  16576. break;
  16577. }
  16578. }
  16579. }
  16580. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  16581. finally {
  16582. try {
  16583. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  16584. }
  16585. finally { if (e_2) throw e_2.error; }
  16586. }
  16587. if (meta) {
  16588. // 没找到元数据,直接添加
  16589. _this.refs.grid2.appendEditRow({
  16590. conditionFieldBind: columnName,
  16591. conditionFieldLabel: meta.column_comment,
  16592. conditionFieldXtype: 'textfield',
  16593. conditionFieldFlex: 1,
  16594. conditionFieldDict: '',
  16595. conditionFieldWrap: false,
  16596. });
  16597. }
  16598. else {
  16599. _this.refs.grid2.appendEditRow({
  16600. conditionFieldBind: columnName,
  16601. conditionFieldLabel: '',
  16602. conditionFieldXtype: 'textfield',
  16603. conditionFieldFlex: 1,
  16604. conditionFieldDict: '',
  16605. conditionFieldWrap: false,
  16606. });
  16607. }
  16608. }
  16609. };
  16610. try {
  16611. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  16612. var m = re_1_1.value;
  16613. _loop_1(m);
  16614. }
  16615. }
  16616. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  16617. finally {
  16618. try {
  16619. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  16620. }
  16621. finally { if (e_1) throw e_1.error; }
  16622. }
  16623. }
  16624. }).finally(function () {
  16625. _this.refs.grid2.setLoading(false);
  16626. });
  16627. };
  16628. WidgetDesign.prototype.calcColumn = function () {
  16629. var _this = this;
  16630. var sql = this.refs.sqlEditor.getCode();
  16631. var rows = this.refs.grid3.getDataRows();
  16632. this.refs.grid3.setLoading(true);
  16633. parseDynamicSqlApi(sql).then(function (res) {
  16634. _.forEach(res.data, function (parseItem) {
  16635. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  16636. // 是否找到重复字段
  16637. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  16638. if (exists) {
  16639. return;
  16640. }
  16641. if (tableName) {
  16642. // 解出表格名和字段名
  16643. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16644. if (meta) {
  16645. // 找到了元数据
  16646. var r = {
  16647. dataIndex: meta.column_name,
  16648. header: meta.column_comment,
  16649. xtype: '',
  16650. dataType: 'string',
  16651. dict: '',
  16652. };
  16653. if (meta.column_ui === 'combo' && meta.column_dict) {
  16654. r.dict = meta.column_dict;
  16655. }
  16656. else if (meta.column_ui === "checkbox") {
  16657. r.xtype = 'checkbox';
  16658. }
  16659. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  16660. r.dataType = meta.data_type;
  16661. }
  16662. _this.refs.grid3.appendEditRow(r);
  16663. return;
  16664. }
  16665. }
  16666. if (columnName) {
  16667. // 解出字段名
  16668. var r = {
  16669. dataIndex: columnName,
  16670. header: columnName,
  16671. xtype: '',
  16672. dataType: 'string',
  16673. dict: '',
  16674. };
  16675. _this.refs.grid3.appendEditRow(r);
  16676. }
  16677. });
  16678. }).finally(function () {
  16679. _this.refs.grid3.setLoading(false);
  16680. });
  16681. };
  16682. return WidgetDesign;
  16683. }(Scope));
  16684. //# sourceMappingURL=WidgetDesign.js.map
  16685. var model$j = {
  16686. data: {
  16687. // spreadsheet: false,
  16688. // multSelect: false,
  16689. // showCheckColumn: false,
  16690. // checkColumncheckOnly: false,
  16691. // disableSelection: false,
  16692. vjson: {
  16693. reference: '',
  16694. pagination: false,
  16695. pageSize: false,
  16696. pageSizeOption: false,
  16697. hideFootbar: false,
  16698. hideRefresh: false,
  16699. hideExport: false,
  16700. hideAutoSize: false,
  16701. hideClearFilter: false,
  16702. hideSaveGridUIConfig: false,
  16703. hideClearGridUIConfig: false,
  16704. selectMode: '',
  16705. cellediting_clicksToEdit: 1,
  16706. columnLines: false,
  16707. rowLines: false,
  16708. border: false,
  16709. autoLoad: false,
  16710. remoteSort: false,
  16711. remoteFilter: false,
  16712. enableLocking: false,
  16713. enableColumnHide: false,
  16714. enableColumnMove: false,
  16715. gridfilters: false,
  16716. enableColumnResize: false,
  16717. sortOnClick: false,
  16718. hidden: false,
  16719. cls: '',
  16720. dataSource: {
  16721. url: '',
  16722. params: {
  16723. formData: '{form}',
  16724. },
  16725. },
  16726. listeners: {
  16727. beforeselect: '',
  16728. selectionchange: '',
  16729. itemclick: '',
  16730. itemdblclick: '',
  16731. cellClick: '',
  16732. celldblclick: '',
  16733. afterrender: '',
  16734. destory: '',
  16735. }
  16736. },
  16737. }
  16738. };
  16739. //# sourceMappingURL=YvgridDesign.model.js.map
  16740. var vjson$j = {
  16741. title: '表格-高级',
  16742. height: 450,
  16743. width: 970,
  16744. layout: 'fit',
  16745. modal: true,
  16746. items: [
  16747. {
  16748. xtype: 'tabpanel',
  16749. items: [
  16750. {
  16751. title: '属性',
  16752. xtype: 'form',
  16753. scrollable: true,
  16754. items: [
  16755. {
  16756. xtype: 'cols',
  16757. items: [
  16758. {
  16759. xtype: 'textfield',
  16760. fieldLabel: '引用名',
  16761. tooltip: 'reference',
  16762. bind: '{vjson.reference}',
  16763. },
  16764. ]
  16765. },
  16766. {
  16767. xtype: 'cols',
  16768. border: false,
  16769. items: [
  16770. // 允许分页、页大小、页大小选项
  16771. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  16772. // 多选、显示勾选、自动勾选、
  16773. // 单击编辑、列分割线、行分割线、边框
  16774. // 数据源自动加载、后端排序、后端过滤
  16775. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  16776. {
  16777. xtype: 'checkbox',
  16778. fieldLabel: '允许分页',
  16779. bind: {
  16780. value: "{vjson.pagination}"
  16781. }
  16782. },
  16783. {
  16784. xtype: 'numberfield',
  16785. fieldLabel: '页大小',
  16786. bind: '{vjson.pageSize}',
  16787. },
  16788. {
  16789. xtype: 'textfield',
  16790. fieldLabel: '页大小选项',
  16791. flex: 2,
  16792. bind: '{vjson.pageSizeOption}',
  16793. },
  16794. ]
  16795. },
  16796. {
  16797. layout: 'hbox',
  16798. border: false,
  16799. items: [
  16800. {
  16801. xtype: 'combo',
  16802. fieldLabel: '选择模式',
  16803. flex: 4,
  16804. data: [
  16805. { id: 'spreadsheet', text: 'Excel模式' },
  16806. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  16807. { id: 'checkColumn', text: '勾选框' },
  16808. { id: 'row_mulity', text: '行选择-允许多选' },
  16809. { id: 'row_single', text: '行选择-单选' },
  16810. { id: 'disableSelection', text: '禁用' },
  16811. ],
  16812. bind: {
  16813. value: '{vjson.selectMode}'
  16814. }
  16815. }
  16816. ]
  16817. },
  16818. {
  16819. layout: 'hbox',
  16820. border: false,
  16821. defaults: {
  16822. xtype: 'checkbox',
  16823. margin: '0 15 0 0',
  16824. },
  16825. items: [
  16826. {
  16827. xtype: 'container',
  16828. margin: '3',
  16829. border: false,
  16830. width: 80,
  16831. },
  16832. {
  16833. boxLabel: '隐藏底部',
  16834. bind: {
  16835. value: "{vjson.hideFootbar}"
  16836. }
  16837. },
  16838. {
  16839. boxLabel: '隐藏刷新',
  16840. bind: {
  16841. value: "{vjson.hideRefresh}"
  16842. }
  16843. },
  16844. {
  16845. boxLabel: '隐藏导出',
  16846. bind: {
  16847. value: "{vjson.hideExport}"
  16848. }
  16849. },
  16850. {
  16851. boxLabel: '隐藏自动调宽',
  16852. bind: {
  16853. value: "{vjson.hideAutoSize}"
  16854. }
  16855. },
  16856. {
  16857. boxLabel: '隐藏清空筛选',
  16858. bind: {
  16859. value: "{vjson.hideClearFilter}"
  16860. }
  16861. },
  16862. {
  16863. boxLabel: '隐藏保存布局',
  16864. bind: {
  16865. value: "{vjson.hideSaveGridUIConfig}"
  16866. }
  16867. },
  16868. {
  16869. boxLabel: '隐藏重置布局',
  16870. bind: {
  16871. value: "{vjson.hideClearGridUIConfig}"
  16872. }
  16873. },
  16874. ]
  16875. },
  16876. {
  16877. layout: 'hbox',
  16878. border: false,
  16879. defaults: {
  16880. xtype: 'checkbox',
  16881. margin: '0 15 0 0',
  16882. },
  16883. items: [
  16884. {
  16885. xtype: 'container',
  16886. margin: '3',
  16887. border: false,
  16888. width: 80
  16889. },
  16890. {
  16891. boxLabel: '单击编辑',
  16892. bind: {
  16893. value: "{vjson.cellediting_clicksToEdit}"
  16894. }
  16895. },
  16896. {
  16897. boxLabel: '列分隔线',
  16898. bind: {
  16899. value: "{vjson.columnLines}"
  16900. }
  16901. },
  16902. {
  16903. boxLabel: '行分隔线',
  16904. bind: {
  16905. value: "{vjson.rowLines}"
  16906. }
  16907. },
  16908. {
  16909. boxLabel: '边框',
  16910. bind: {
  16911. value: "{vjson.border}"
  16912. }
  16913. },
  16914. ]
  16915. },
  16916. {
  16917. layout: 'hbox',
  16918. border: false,
  16919. defaults: {
  16920. xtype: 'checkbox',
  16921. margin: '0 15 0 0',
  16922. },
  16923. items: [
  16924. {
  16925. xtype: 'container',
  16926. margin: '3',
  16927. border: false,
  16928. width: 80
  16929. },
  16930. {
  16931. boxLabel: '数据源自动加载',
  16932. bind: {
  16933. value: "{vjson.autoLoad}"
  16934. }
  16935. },
  16936. {
  16937. boxLabel: '后端排序',
  16938. bind: {
  16939. value: "{vjson.remoteSort}"
  16940. }
  16941. },
  16942. {
  16943. boxLabel: '后端过滤',
  16944. bind: {
  16945. value: "{vjson.remoteFilter}"
  16946. }
  16947. },
  16948. ]
  16949. },
  16950. {
  16951. layout: 'hbox',
  16952. border: false,
  16953. defaults: {
  16954. xtype: 'checkbox',
  16955. margin: '0 15 0 0',
  16956. },
  16957. items: [
  16958. {
  16959. xtype: 'container',
  16960. margin: '3',
  16961. border: false,
  16962. width: 80
  16963. },
  16964. {
  16965. boxLabel: '自定义锁定',
  16966. bind: {
  16967. value: "{vjson.enableLocking}"
  16968. }
  16969. },
  16970. {
  16971. boxLabel: '自定义隐藏',
  16972. bind: {
  16973. value: "{vjson.enableColumnHide}"
  16974. }
  16975. },
  16976. {
  16977. boxLabel: '用户拖拽字段',
  16978. bind: {
  16979. value: "{vjson.enableColumnMove}"
  16980. }
  16981. },
  16982. {
  16983. boxLabel: '自定义筛选',
  16984. bind: {
  16985. value: "{vjson.gridfilters}"
  16986. }
  16987. },
  16988. {
  16989. boxLabel: '用户拖拽字段宽度',
  16990. bind: {
  16991. value: "{vjson.enableColumnResize}"
  16992. }
  16993. },
  16994. {
  16995. boxLabel: '点击列头排序',
  16996. bind: {
  16997. value: "{vjson.sortOnClick}"
  16998. }
  16999. },
  17000. {
  17001. xtype: 'checkbox',
  17002. boxLabel: '隐藏',
  17003. bind: {
  17004. value: "{vjson.hidden}"
  17005. }
  17006. },
  17007. ]
  17008. },
  17009. {
  17010. xtype: 'cols',
  17011. items: [
  17012. {
  17013. xtype: 'textfield',
  17014. fieldLabel: '样式',
  17015. bind: '{vjson.cls}',
  17016. flex: 4
  17017. },
  17018. ]
  17019. },
  17020. ]
  17021. },
  17022. {
  17023. title: '字段',
  17024. xtype: 'yvgrid',
  17025. reference: 'grid1',
  17026. pagination: false,
  17027. hideFootbar: true,
  17028. plugins: {
  17029. clipboard: true,
  17030. selectionreplicator: true
  17031. },
  17032. selModel: {
  17033. type: 'spreadsheet',
  17034. columnSelect: true,
  17035. pruneRemoved: false,
  17036. extensible: 'y'
  17037. },
  17038. listeners: {
  17039. editfinish: 'scope.gridEditFinish',
  17040. },
  17041. tbar: {
  17042. xtype: 'toolbar',
  17043. items: [
  17044. {
  17045. xtype: 'button',
  17046. text: '添加',
  17047. iconCls: 'x-fa fa-plus-circle',
  17048. listeners: {
  17049. click: 'scope.addColumn'
  17050. }
  17051. },
  17052. {
  17053. xtype: 'button',
  17054. text: '删除',
  17055. iconCls: 'x-fa fa-minus-circle',
  17056. listeners: {
  17057. click: 'scope.removeColumn'
  17058. }
  17059. },
  17060. '-',
  17061. {
  17062. xtype: 'button',
  17063. text: '自动分析',
  17064. iconCls: 'x-fa fa-code-fork',
  17065. listeners: {
  17066. click: 'scope.calcColumn'
  17067. }
  17068. },
  17069. {
  17070. xtype: 'button',
  17071. text: '上移',
  17072. iconCls: 'x-fa fa-arrow-up',
  17073. listeners: {
  17074. click: 'scope.moveUp'
  17075. }
  17076. },
  17077. {
  17078. xtype: 'button',
  17079. text: '下移',
  17080. iconCls: 'x-fa fa-arrow-down',
  17081. listeners: {
  17082. click: 'scope.moveDown'
  17083. }
  17084. },
  17085. ]
  17086. },
  17087. columns: [
  17088. { xtype: 'rownumberer' },
  17089. {
  17090. text: '字段',
  17091. dataIndex: 'dataIndex',
  17092. width: 140,
  17093. sortable: false,
  17094. menuDisabled: true,
  17095. editor: {
  17096. selectOnFocus: true,
  17097. },
  17098. },
  17099. {
  17100. text: '标题',
  17101. dataIndex: 'header',
  17102. width: 120,
  17103. sortable: false,
  17104. menuDisabled: true,
  17105. editor: {
  17106. selectOnFocus: true,
  17107. },
  17108. },
  17109. {
  17110. text: '类型',
  17111. dataIndex: 'xtype',
  17112. width: 100,
  17113. sortable: false,
  17114. menuDisabled: true,
  17115. editor: {
  17116. xtype: 'combo',
  17117. typeAhead: true,
  17118. triggerAction: 'all',
  17119. selectOnFocus: false,
  17120. listConfig: {
  17121. minWidth: 200
  17122. },
  17123. store: [
  17124. ['', '默认'],
  17125. ['rownum', 'rownum'],
  17126. ['checkcolumn', 'checkcolumn'],
  17127. ]
  17128. },
  17129. },
  17130. {
  17131. text: '数据类型',
  17132. dataIndex: 'dataType',
  17133. width: 100,
  17134. sortable: false,
  17135. menuDisabled: true,
  17136. editor: {
  17137. xtype: 'combo',
  17138. selectOnFocus: true,
  17139. listConfig: {
  17140. minWidth: 200
  17141. },
  17142. store: [
  17143. ['', '默认'],
  17144. ['string', 'string'],
  17145. ['number', 'number'],
  17146. ['date', 'date'],
  17147. ]
  17148. },
  17149. },
  17150. {
  17151. text: '编辑模式',
  17152. dataIndex: 'editor',
  17153. width: 100,
  17154. sortable: false,
  17155. menuDisabled: true,
  17156. editor: {
  17157. xtype: 'combo',
  17158. selectOnFocus: true,
  17159. listConfig: {
  17160. minWidth: 200
  17161. },
  17162. store: [
  17163. ['', ''],
  17164. ['textfield', 'textfield'],
  17165. ['numberfield', 'numberfield'],
  17166. ['combo', 'combo'],
  17167. ['combogrid', 'combogrid'],
  17168. ['datefield', 'datefield'],
  17169. ]
  17170. },
  17171. },
  17172. {
  17173. text: '宽度',
  17174. dataIndex: 'width',
  17175. align: 'right',
  17176. width: 100,
  17177. sortable: false,
  17178. menuDisabled: true,
  17179. editor: {
  17180. xtype: 'numberfield',
  17181. selectOnFocus: true,
  17182. minValue: 0,
  17183. maxValue: 1000
  17184. },
  17185. },
  17186. {
  17187. text: '权重',
  17188. dataIndex: 'flex',
  17189. align: 'right',
  17190. width: 90,
  17191. sortable: false,
  17192. menuDisabled: true,
  17193. editor: {
  17194. xtype: 'numberfield',
  17195. selectOnFocus: true,
  17196. minValue: 0,
  17197. maxValue: 10
  17198. },
  17199. },
  17200. {
  17201. text: '字典',
  17202. dataIndex: 'dict',
  17203. sortable: false,
  17204. menuDisabled: true,
  17205. width: 210,
  17206. editor: {
  17207. selectOnFocus: true,
  17208. },
  17209. },
  17210. {
  17211. text: '对齐',
  17212. dataIndex: 'align',
  17213. width: 90,
  17214. sortable: false,
  17215. menuDisabled: true,
  17216. editor: {
  17217. xtype: 'combo',
  17218. selectOnFocus: true,
  17219. listConfig: {
  17220. minWidth: 120
  17221. },
  17222. store: [
  17223. ['start', 'start'],
  17224. ['center', 'center'],
  17225. ['end', 'end'],
  17226. ]
  17227. },
  17228. },
  17229. {
  17230. text: '必填',
  17231. dataIndex: 'notAllowBlank',
  17232. width: 50,
  17233. resizable: false,
  17234. sortable: false,
  17235. menuDisabled: true,
  17236. xtype: 'checkcolumn',
  17237. },
  17238. {
  17239. text: '禁用',
  17240. dataIndex: 'disabled',
  17241. width: 50,
  17242. resizable: false,
  17243. sortable: false,
  17244. menuDisabled: true,
  17245. xtype: 'checkcolumn',
  17246. },
  17247. {
  17248. text: '禁菜',
  17249. dataIndex: 'menuDisabled',
  17250. width: 50,
  17251. resizable: false,
  17252. sortable: false,
  17253. menuDisabled: true,
  17254. xtype: 'checkcolumn',
  17255. },
  17256. {
  17257. text: '过滤',
  17258. dataIndex: 'filterable',
  17259. xtype: 'checkcolumn',
  17260. width: 50,
  17261. resizable: false,
  17262. sortable: false,
  17263. menuDisabled: true,
  17264. },
  17265. {
  17266. text: '隐藏',
  17267. dataIndex: 'hidden',
  17268. xtype: 'checkcolumn',
  17269. width: 50,
  17270. resizable: false,
  17271. sortable: false,
  17272. menuDisabled: true,
  17273. },
  17274. {
  17275. text: '可隐',
  17276. dataIndex: 'hideable',
  17277. xtype: 'checkcolumn',
  17278. width: 50,
  17279. resizable: false,
  17280. sortable: false,
  17281. menuDisabled: true,
  17282. },
  17283. {
  17284. text: '调宽',
  17285. dataIndex: 'resizable',
  17286. xtype: 'checkcolumn',
  17287. width: 50,
  17288. resizable: false,
  17289. sortable: false,
  17290. menuDisabled: true,
  17291. },
  17292. {
  17293. text: '排序',
  17294. dataIndex: 'sortable',
  17295. xtype: 'checkcolumn',
  17296. width: 50,
  17297. resizable: false,
  17298. sortable: false,
  17299. menuDisabled: true,
  17300. },
  17301. {
  17302. text: '适宽',
  17303. dataIndex: 'autoSize',
  17304. xtype: 'checkcolumn',
  17305. width: 50,
  17306. resizable: false,
  17307. sortable: false,
  17308. menuDisabled: true,
  17309. },
  17310. ],
  17311. },
  17312. {
  17313. title: '数据源',
  17314. layout: 'border',
  17315. listeners: {
  17316. activate: 'scope.dataSourceActivate'
  17317. },
  17318. items: [
  17319. {
  17320. region: 'north',
  17321. xtype: 'toolbar',
  17322. border: false,
  17323. items: [
  17324. {
  17325. xtype: 'textfield',
  17326. fieldLabel: '数据源',
  17327. flex: 1,
  17328. bind: {
  17329. value: '{vjson.dataSource.url}'
  17330. }
  17331. },
  17332. {
  17333. xtype: 'button',
  17334. text: '保存',
  17335. iconCls: 'x-fa fa-save',
  17336. listeners: {
  17337. click: 'scope.dataSourceSave'
  17338. }
  17339. },
  17340. {
  17341. xtype: 'button',
  17342. text: '读取',
  17343. iconCls: 'x-fa fa-folder-open',
  17344. listeners: {
  17345. click: 'scope.reloadSqlContent'
  17346. }
  17347. },
  17348. ]
  17349. },
  17350. {
  17351. region: 'center',
  17352. xtype: 'sqleditor',
  17353. layout: 'fit',
  17354. reference: 'sqlEditor',
  17355. },
  17356. {
  17357. region: 'south',
  17358. xtype: 'jsoneditor',
  17359. height: 200,
  17360. split: true,
  17361. collapsible: true,
  17362. title: '参数',
  17363. reference: 'sqlParams',
  17364. }
  17365. ]
  17366. },
  17367. {
  17368. title: '事件',
  17369. xtype: 'form',
  17370. scrollable: true,
  17371. margin: '10',
  17372. defaults: {
  17373. width: '100%',
  17374. labelAlign: 'top',
  17375. },
  17376. items: [
  17377. {
  17378. xtype: 'textfield',
  17379. fieldLabel: '选中前触发 beforeSelect',
  17380. bind: {
  17381. value: '{vjson.listeners.beforeselect}'
  17382. },
  17383. },
  17384. {
  17385. xtype: 'textfield',
  17386. fieldLabel: '选择范围改变 selectionChange',
  17387. bind: {
  17388. value: '{vjson.listeners.selectionchange}'
  17389. },
  17390. },
  17391. {
  17392. xtype: 'textfield',
  17393. fieldLabel: '行点击 itemClick',
  17394. bind: {
  17395. value: '{vjson.listeners.itemclick}'
  17396. },
  17397. },
  17398. {
  17399. xtype: 'textfield',
  17400. fieldLabel: '行双击 itemDblClick',
  17401. bind: {
  17402. value: '{vjson.listeners.itemdblclick}'
  17403. },
  17404. },
  17405. {
  17406. xtype: 'textfield',
  17407. fieldLabel: '单元格点击 cellClick',
  17408. bind: {
  17409. value: '{vjson.listeners.cellClick}'
  17410. },
  17411. },
  17412. {
  17413. xtype: 'textfield',
  17414. fieldLabel: '单元格双击 cellDblClick',
  17415. bind: {
  17416. value: '{vjson.listeners.celldblclick}'
  17417. },
  17418. },
  17419. {
  17420. xtype: 'textfield',
  17421. fieldLabel: '渲染后触发 afterrender',
  17422. bind: {
  17423. value: '{vjson.listeners.afterrender}'
  17424. },
  17425. },
  17426. {
  17427. xtype: 'textfield',
  17428. fieldLabel: '销毁后触发 destory',
  17429. bind: {
  17430. value: '{vjson.listeners.destory}'
  17431. },
  17432. },
  17433. ]
  17434. },
  17435. ],
  17436. }
  17437. ],
  17438. fbar: [
  17439. {
  17440. text: '应用', iconCls: 'x-fa fa-save',
  17441. listeners: {
  17442. click: 'scope.save'
  17443. }
  17444. },
  17445. '-',
  17446. {
  17447. text: '确定', iconCls: 'x-fa fa-check-circle',
  17448. listeners: {
  17449. click: 'scope.saveClose'
  17450. }
  17451. },
  17452. {
  17453. text: '取消', iconCls: 'x-fa fa-times-circle',
  17454. listeners: {
  17455. click: 'system.closeMe()'
  17456. }
  17457. },
  17458. ]
  17459. };
  17460. //# sourceMappingURL=YvgridDesign.view.js.map
  17461. var VjsonExchange = /** @class */ (function () {
  17462. function VjsonExchange(vjson) {
  17463. this.pendingSet = true;
  17464. this.vjsonOrigin = _$2.cloneDeep(vjson);
  17465. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  17466. }
  17467. /**
  17468. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  17469. * @param propName
  17470. * @param value
  17471. */
  17472. VjsonExchange.prototype.setPropValue = function (propName, value) {
  17473. if (this.pendingSet) {
  17474. return;
  17475. }
  17476. // selectMode
  17477. // pageSizeOption
  17478. // cellediting_clicksToEdit
  17479. msg$1('' + propName + '=' + value);
  17480. _$2.set(this.vjson, propName, value);
  17481. };
  17482. /**
  17483. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  17484. */
  17485. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  17486. var _a, _b, _c;
  17487. if (this.pendingSet) {
  17488. return;
  17489. }
  17490. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  17491. // 如果不使用默认属性,就直接设定 undefined
  17492. var vs = {
  17493. dataIndex: undefined,
  17494. header: undefined,
  17495. xtype: '',
  17496. width: undefined,
  17497. flex: undefined,
  17498. align: 'start',
  17499. editor: undefined,
  17500. dataType: 'string',
  17501. dict: undefined,
  17502. disabled: false,
  17503. menuDisabled: false,
  17504. notAllowBlank: false,
  17505. filterable: true,
  17506. hidden: false,
  17507. hideable: true,
  17508. resizable: true,
  17509. sortable: true,
  17510. autoSize: true,
  17511. };
  17512. var raw = record.get('raw');
  17513. if (raw === undefined || raw == null) {
  17514. raw = {};
  17515. record.set('raw', raw);
  17516. }
  17517. var setRaw = function (propName, value) {
  17518. if (typeof value === 'undefined' || value == null) {
  17519. msg$1("delete columns[" + rowIdx + "]." + propName);
  17520. delete raw[propName];
  17521. return;
  17522. }
  17523. var defaultValue = vs[propName];
  17524. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  17525. // 要设的值,与默认值相同,就直接删除这个属性
  17526. msg$1("delete columns[" + rowIdx + "]." + propName);
  17527. delete raw[propName];
  17528. return;
  17529. }
  17530. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  17531. _$2.set(raw, propName, value);
  17532. };
  17533. if (!vs.hasOwnProperty(propName)) {
  17534. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  17535. return;
  17536. }
  17537. else if (propName === 'dict') {
  17538. if (value) {
  17539. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  17540. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  17541. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  17542. }
  17543. }
  17544. else {
  17545. setRaw('fix', undefined);
  17546. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  17547. msg$1("delete columns[" + rowIdx + "].editor.fix");
  17548. delete raw.editor.fix;
  17549. }
  17550. }
  17551. }
  17552. else if (propName === 'xtype') {
  17553. if (!value) {
  17554. setRaw('xtype', undefined);
  17555. }
  17556. else {
  17557. setRaw('xtype', value);
  17558. }
  17559. }
  17560. else if (propName === 'notAllowBlank') {
  17561. setRaw('editor.allowBlank', !value);
  17562. }
  17563. else if (propName === 'editor') {
  17564. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  17565. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  17566. value = undefined;
  17567. }
  17568. // editor.xtype
  17569. if (!value) {
  17570. // 不需要编辑器
  17571. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  17572. msg$1("delete columns[" + rowIdx + "].editor");
  17573. delete raw.editor;
  17574. record.set('notAllowBlank', false);
  17575. }
  17576. }
  17577. else {
  17578. setRaw('editor.xtype', value);
  17579. var dict = record.get('dict');
  17580. if (value === 'combo' && dict) {
  17581. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  17582. }
  17583. }
  17584. }
  17585. else if (propName === 'width') {
  17586. var width = value;
  17587. var flex = record.get('flex');
  17588. if (!width && !flex) {
  17589. setRaw('width', undefined);
  17590. setRaw('flex', undefined);
  17591. record.set('flex', undefined);
  17592. record.set('width', undefined);
  17593. return;
  17594. }
  17595. else if (!!width) {
  17596. setRaw('flex', undefined);
  17597. record.set('flex', undefined);
  17598. setRaw('width', width);
  17599. return;
  17600. }
  17601. }
  17602. else if (propName === 'flex') {
  17603. var width = record.get('width');
  17604. var flex = value;
  17605. if (!width && !flex) {
  17606. setRaw('width', undefined);
  17607. setRaw('flex', undefined);
  17608. record.set('flex', undefined);
  17609. record.set('width', undefined);
  17610. return;
  17611. }
  17612. else if (!!flex) {
  17613. setRaw('width', undefined);
  17614. record.set('width', undefined);
  17615. setRaw('flex', flex);
  17616. return;
  17617. }
  17618. }
  17619. else {
  17620. // 其他属性,作为同名属性,与 raw 同步
  17621. setRaw(propName, value);
  17622. }
  17623. };
  17624. /**
  17625. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  17626. */
  17627. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  17628. var _this = this;
  17629. var vs = [
  17630. 'reference', 'pagination', 'pageSize',
  17631. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  17632. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  17633. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  17634. 'listeners.beforeselect',
  17635. 'listeners.selectionchange',
  17636. 'listeners.itemclick',
  17637. 'listeners.itemdblclick',
  17638. 'listeners.cellClick',
  17639. 'listeners.celldblclick',
  17640. 'listeners.afterrender',
  17641. 'listeners.destory',
  17642. ];
  17643. _$2.forEach(vs, function (v) {
  17644. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  17645. });
  17646. };
  17647. VjsonExchange.prototype.bindChangeProp = function (propName) {
  17648. var me = this;
  17649. return function (value) {
  17650. me.setPropValue(propName, value);
  17651. };
  17652. };
  17653. VjsonExchange.prototype.parseModel = function () {
  17654. var _this = this;
  17655. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
  17656. //@ts-ignore
  17657. var df = YvanUI.Defaults.grid;
  17658. var vjson = _$2.assign({}, df, this.vjson);
  17659. var model = {
  17660. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  17661. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  17662. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  17663. pageSizeOption: '["20", "50", "100", "200", "300"]',
  17664. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  17665. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  17666. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  17667. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  17668. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  17669. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  17670. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  17671. selectMode: 'spreadsheet',
  17672. cellediting_clicksToEdit: true,
  17673. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  17674. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  17675. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  17676. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  17677. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  17678. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  17679. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  17680. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  17681. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  17682. gridfilters: true,
  17683. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  17684. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  17685. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  17686. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  17687. columns: [],
  17688. listeners: {
  17689. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  17690. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  17691. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  17692. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  17693. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  17694. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  17695. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  17696. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  17697. }
  17698. };
  17699. if (_$2.isArray(this.vjson.pageSizeOption)) {
  17700. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  17701. }
  17702. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  17703. if (_$2.get(vjson, 'disableSelection') == true) {
  17704. model.selectMode = 'disableSelection';
  17705. }
  17706. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  17707. model.selectMode = 'spreadsheet';
  17708. }
  17709. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  17710. model.selectMode = 'onlyCheckColumn';
  17711. }
  17712. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  17713. model.selectMode = 'checkColumn';
  17714. }
  17715. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  17716. model.selectMode = 'row_mulity';
  17717. }
  17718. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  17719. model.selectMode = 'row_single';
  17720. }
  17721. else {
  17722. model.selectMode = 'row_single';
  17723. }
  17724. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  17725. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  17726. model.dataSource = {
  17727. url: _$2.get(vjson, 'dataSource.url'),
  17728. //@ts-ignore
  17729. params: _$2.get(vjson, 'dataSource.params')
  17730. };
  17731. }
  17732. _$2.forEach(vjson.columns, function (column) {
  17733. model.columns.push(_this.parseColumn(column));
  17734. });
  17735. return model;
  17736. };
  17737. VjsonExchange.prototype.parseColumn = function (column) {
  17738. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  17739. var model = {
  17740. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  17741. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  17742. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  17743. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  17744. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  17745. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  17746. editor: '',
  17747. editParam: '',
  17748. dict: '',
  17749. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  17750. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  17751. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  17752. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  17753. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  17754. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  17755. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  17756. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  17757. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  17758. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  17759. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  17760. raw: _$2.cloneDeep(column),
  17761. };
  17762. // width / flex 只能留一个属性, 或者全不留
  17763. if (model.width <= 0 && model.flex <= 0) {
  17764. delete model.width;
  17765. delete model.flex;
  17766. }
  17767. else if (model.width > 0) {
  17768. delete model.flex;
  17769. }
  17770. else {
  17771. delete model.width;
  17772. }
  17773. // editor
  17774. if (_$2.isObject(_$2.get(column, 'editor'))) {
  17775. model.editor = _$2.get(column, 'editor.xtype');
  17776. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  17777. if (!model.editor) {
  17778. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  17779. model.editor = 'textfield';
  17780. }
  17781. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  17782. msg$1('不可识别的 editor.xtype=' + model.editor);
  17783. console.error('不可识别的 editor.xtype', column);
  17784. }
  17785. if (_$2.get(column, 'editor.allowBlank') === false) {
  17786. model.notAllowBlank = true;
  17787. }
  17788. }
  17789. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  17790. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  17791. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  17792. if (match && match[1]) {
  17793. model.dict = match[1];
  17794. }
  17795. }
  17796. return model;
  17797. };
  17798. return VjsonExchange;
  17799. }());
  17800. //
  17801. //# sourceMappingURL=YvgridExchange.js.map
  17802. var YvgridDesign = /** @class */ (function (_super) {
  17803. __extends(YvgridDesign, _super);
  17804. function YvgridDesign(moduleId) {
  17805. var _this = _super.call(this, { model: model$j, vjson: vjson$j }) || this;
  17806. _this.moduleId = '';
  17807. _this.name = 'YvgridDesign';
  17808. _this.dataSourceIsActived = false;
  17809. _this.setModuleId(moduleId);
  17810. return _this;
  17811. }
  17812. YvgridDesign.prototype.setModuleId = function (moduleId) {
  17813. var _this = this;
  17814. this.moduleId = moduleId;
  17815. if (this.componentSelectionChangeSubscribe) {
  17816. this.componentSelectionChangeSubscribe.cancel();
  17817. this.componentSelectionChangeSubscribe = null;
  17818. }
  17819. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  17820. var id = _a.id, from = _a.from;
  17821. _this.onComponentSelectionChange(id, from);
  17822. });
  17823. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  17824. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  17825. if (vj.xtype !== 'yvgrid') {
  17826. throw Error('非 yvgrid 组件');
  17827. }
  17828. this.vjsonExchange = new VjsonExchange(vj);
  17829. };
  17830. YvgridDesign.prototype.onLoad = function () {
  17831. var _this = this;
  17832. var model = this.vjsonExchange.parseModel();
  17833. this.vjsonExchange.pendingSet = true;
  17834. mergeViewModel(this.viewModel, "vjson", model, false);
  17835. this.refs.grid1.setData(model.columns);
  17836. this.vjsonExchange.attachViewModel(this.viewModel);
  17837. _$2.defer(function () {
  17838. _this.vjsonExchange.pendingSet = false;
  17839. });
  17840. };
  17841. YvgridDesign.prototype.moveUp = function (sender) {
  17842. var grid = sender.up('grid');
  17843. grid.rowMoveUp();
  17844. };
  17845. YvgridDesign.prototype.moveDown = function (sender) {
  17846. var grid = sender.up('grid');
  17847. grid.rowMoveDown();
  17848. };
  17849. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  17850. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  17851. };
  17852. YvgridDesign.prototype.reloadSqlContent = function () {
  17853. var _this = this;
  17854. var url = this.viewModel.get('vjson.dataSource.url');
  17855. if (url) {
  17856. loadSqlContentApi(url).then(function (res) {
  17857. _this.refs.sqlEditor.setCode('');
  17858. if (res.success) {
  17859. _this.refs.sqlEditor.setCode(res.data.content);
  17860. }
  17861. }).catch(function () {
  17862. _this.refs.sqlEditor.setCode('');
  17863. });
  17864. }
  17865. };
  17866. YvgridDesign.prototype.dataSourceSave = function () {
  17867. var url = this.viewModel.get('vjson.dataSource.url');
  17868. if (!url) {
  17869. msg$1('必须填写 groovy/SQL 模块路径');
  17870. return;
  17871. }
  17872. var content = this.refs.sqlEditor.getCode();
  17873. saveSqlContentApi(url, content).then(function (res) {
  17874. if (res.success) {
  17875. msg$1('保存成功');
  17876. }
  17877. else {
  17878. msg$1(res.msg);
  17879. }
  17880. });
  17881. };
  17882. YvgridDesign.prototype.dataSourceActivate = function () {
  17883. if (!this.dataSourceIsActived) {
  17884. // 激活
  17885. this.reloadSqlContent();
  17886. var params = this.viewModel.get('vjson.dataSource.params');
  17887. if (_$2.isObject(params)) {
  17888. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  17889. }
  17890. this.dataSourceIsActived = true;
  17891. }
  17892. };
  17893. // 外部控件选择发生改变
  17894. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  17895. if (!id || from === this.name) {
  17896. return;
  17897. }
  17898. this.setVjson(id);
  17899. };
  17900. YvgridDesign.prototype.setVjson = function (id) {
  17901. // 找到对应的组件 判断是不是表格
  17902. };
  17903. YvgridDesign.prototype.save = function () {
  17904. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  17905. if (this.dataSourceIsActived) {
  17906. var url = this.viewModel.get('vjson.dataSource.url');
  17907. // 解析 params
  17908. var paramsString = this.refs.sqlParams.getCode('');
  17909. var params = undefined;
  17910. if (paramsString) {
  17911. try {
  17912. params = window['YvanUI'].json5.parse(paramsString);
  17913. }
  17914. catch (e) {
  17915. msg$1('dataSource.params 格式非法,请检查');
  17916. return;
  17917. }
  17918. }
  17919. if (typeof params === 'undefined') {
  17920. params = this.viewModel.get('vjson.dataSource.params');
  17921. }
  17922. if (url) {
  17923. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  17924. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  17925. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  17926. }
  17927. else {
  17928. delete this.vjsonExchange.vjson['dataSource'];
  17929. }
  17930. }
  17931. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  17932. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  17933. from: this.name,
  17934. ignoreRenderUI: false
  17935. });
  17936. };
  17937. YvgridDesign.prototype.saveClose = function () {
  17938. this.save();
  17939. this.close();
  17940. };
  17941. YvgridDesign.prototype.addColumn = function () {
  17942. this.refs.grid1.appendEditRow({
  17943. dataIndex: '',
  17944. header: '',
  17945. xtype: '',
  17946. width: 80,
  17947. align: '',
  17948. editor: '',
  17949. editParam: '',
  17950. dict: '',
  17951. disabled: false,
  17952. notAllowBlank: false,
  17953. menuDisabled: false,
  17954. filterable: false,
  17955. hidden: false,
  17956. hideable: true,
  17957. resizable: true,
  17958. sortable: true,
  17959. locked: false,
  17960. lockable: false,
  17961. autoSize: true,
  17962. raw: undefined,
  17963. }, 'header');
  17964. };
  17965. YvgridDesign.prototype.removeColumn = function () {
  17966. var _this = this;
  17967. var rows = [];
  17968. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  17969. rows.push(r);
  17970. });
  17971. _$2.forEach(rows, function (r) {
  17972. _this.refs.grid1.getStore().remove(r);
  17973. });
  17974. };
  17975. YvgridDesign.prototype.calcColumn = function () {
  17976. msg$1('暂未实现');
  17977. };
  17978. YvgridDesign.prototype.onDestroy = function () {
  17979. if (this.componentSelectionChangeSubscribe) {
  17980. this.componentSelectionChangeSubscribe.cancel();
  17981. this.componentSelectionChangeSubscribe = null;
  17982. }
  17983. };
  17984. return YvgridDesign;
  17985. }(Scope));
  17986. //# sourceMappingURL=YvgridDesign.js.map
  17987. var YvanUI$1 = window['YvanUI'];
  17988. var _$1 = window["_"];
  17989. var Ext$1 = window['Ext'];
  17990. var $$1 = window["$"];
  17991. var historySize = 100;
  17992. var ViewDesign = /** @class */ (function () {
  17993. function ViewDesign(moduleId, reference) {
  17994. var _this = this;
  17995. this.name = "ViewDesign";
  17996. this.expandedVjsonObjArray = [];
  17997. // 编辑历史
  17998. this.undoVjsonList = [];
  17999. // 撤销历史
  18000. this.redoVjsonList = [];
  18001. // 订阅事件列表
  18002. this.subscribeList = [];
  18003. // private getOuterCopyValueTimer: any = null
  18004. /**
  18005. * 唯一编号
  18006. */
  18007. this.id = _$1.uniqueId("_dv");
  18008. this.moduleId = moduleId;
  18009. this.moduleObject = moduleStore.getModuleObject(moduleId);
  18010. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  18011. this.designReference = reference;
  18012. this.designElement = reference.ariaEl.dom;
  18013. this.$overlay.appendTo(this.designElement);
  18014. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  18015. // 添加到撤销
  18016. this.lastVjson = _$1.cloneDeep(this.vjson);
  18017. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  18018. event.stopPropagation();
  18019. event.preventDefault();
  18020. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  18021. });
  18022. this.$overlay.on('click', '.studio_mask', function (event) {
  18023. event.stopPropagation();
  18024. event.preventDefault();
  18025. _this.clearSelection();
  18026. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  18027. _$1.defer(function () {
  18028. _this.$overlay.focus();
  18029. });
  18030. });
  18031. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  18032. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  18033. this.$overlay.on('copy', this.onCopy.bind(this));
  18034. this.$overlay.on('paste', this.onPaste.bind(this));
  18035. this.$overlay.on('focus', this.onfocus.bind(this));
  18036. // this.$overlay.on('mouseenter', ()=>{
  18037. // clearTimeout(this.getOuterCopyValueTimer);
  18038. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  18039. // })
  18040. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  18041. _this.onMousemove(event);
  18042. }, 300, { maxWait: 500 }).bind(this));
  18043. window.addEventListener('message', this.onMessageEvent.bind(this));
  18044. this.subscribe();
  18045. setDesignInstance(this);
  18046. }
  18047. // todo ======== 方法 ==========
  18048. ViewDesign.prototype.subscribe = function () {
  18049. var _this = this;
  18050. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  18051. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  18052. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18053. _this.setVjson(vjson, from, ignoreRenderUI);
  18054. }));
  18055. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  18056. var id = _a.id, from = _a.from;
  18057. _this.onComponentSelectionChange(id, from);
  18058. }));
  18059. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  18060. var id = _a.id, from = _a.from;
  18061. _this.onComponentDelete(id, from);
  18062. }));
  18063. };
  18064. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  18065. if (vjson === void 0) { vjson = this.vjson; }
  18066. if (from === void 0) { from = this.name; }
  18067. this.vjson = vjson;
  18068. if (from !== "undo" && from !== "redo") {
  18069. if (this.undoVjsonList.length >= 100) {
  18070. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  18071. }
  18072. this.undoVjsonList.push(this.lastVjson);
  18073. }
  18074. this.lastVjson = _$1.cloneDeep(vjson);
  18075. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  18076. };
  18077. /**
  18078. * 覆盖层点击事件
  18079. */
  18080. ViewDesign.prototype.overlayClickFunction = function (event) {
  18081. if (!event.altKey && !event.shiftKey) {
  18082. var target = this.findElByXY(event.clientX, event.clientY);
  18083. if (target) {
  18084. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  18085. var extHandle = Ext$1.get(target).component;
  18086. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18087. rect.x = position.x;
  18088. rect.y = position.y;
  18089. this.clearSelection();
  18090. this.appendMaskbox(rect, extHandle.id);
  18091. }
  18092. }
  18093. };
  18094. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  18095. if (dragType === void 0) { dragType = ""; }
  18096. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  18097. var ele = document.elementsFromPoint(x, y);
  18098. if (ele.length <= 1) {
  18099. return;
  18100. }
  18101. var target = null;
  18102. for (var i = 0; i < ele.length; i++) {
  18103. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  18104. if (((_a = ele[i].getAttribute("class")) === null || _a === void 0 ? void 0 : _a.indexOf("yvan_design ")) >= 0 && ele[i].id && ele[i].id.indexOf('-') < 0) {
  18105. switch (dragType) {
  18106. case "cols-container":
  18107. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  18108. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  18109. target = ele[i];
  18110. }
  18111. break;
  18112. case "col-item":
  18113. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  18114. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  18115. target = ele[i];
  18116. }
  18117. break;
  18118. case "rows-container":
  18119. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  18120. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  18121. target = ele[i];
  18122. }
  18123. break;
  18124. case "row-item":
  18125. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  18126. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  18127. target = ele[i];
  18128. }
  18129. break;
  18130. default:
  18131. target = ele[i];
  18132. break;
  18133. }
  18134. if (target) {
  18135. break;
  18136. }
  18137. }
  18138. }
  18139. return target;
  18140. };
  18141. /**
  18142. * 清空选择项
  18143. */
  18144. ViewDesign.prototype.clearSelection = function () {
  18145. // $(this.designElement).removeClass('selected');
  18146. // // $(this.designElement).find('.selected').removeClass('selected')
  18147. // $(this.designElement).find('.ds_mask')
  18148. // .not('.mask_not_hide')
  18149. // .remove();
  18150. $$1('.studio_mask').remove();
  18151. // $(this.designElement).find('.selected').each(function () {
  18152. // $(this).removeClass('selected');
  18153. // // const extHandle = Ext.get(this).component
  18154. // // if (extHandle) {
  18155. // // extHandle.removeCls('selected')
  18156. // // }
  18157. // })
  18158. };
  18159. /**
  18160. * 添加遮罩层
  18161. */
  18162. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  18163. var that = this;
  18164. if (vjsonId) {
  18165. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  18166. }
  18167. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  18168. // return item === cj.xtype
  18169. // }) >= 0
  18170. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18171. this.$mask = $$1("\n<div class=\"studio_mask\" tabindex=\"0\">\n <span style=\"display: none\">dsMain.BILL_DATE</span>\n <i class=\"fa fa-trash-o ds_del\"></i>\n <i class=\"fa fa-angle-double-up ds_parent\"></i>\n</div>");
  18172. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  18173. this.$mask.css({
  18174. position: 'absolute',
  18175. top: top, left: left, width: width, height: height,
  18176. border: '2px dashed #1890ff',
  18177. zIndex: 100,
  18178. });
  18179. this.$mask.appendTo(this.$overlay);
  18180. this.$mask.on("click", ".ds_del", function (e) {
  18181. e.stopPropagation();
  18182. e.preventDefault();
  18183. that.deleteComponent(vjsonId);
  18184. });
  18185. // 点击选中父级
  18186. this.$mask.on('click', '.ds_parent', function (e) {
  18187. e.stopPropagation();
  18188. e.preventDefault();
  18189. that.selectParent(vjsonId);
  18190. });
  18191. var sel = document.getElementById(vjsonId);
  18192. var sVjosn = findInCode(this.vjson, vjsonId);
  18193. // 限制可以拖动的组件
  18194. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  18195. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  18196. this.dragSource = new Ext$1.drag.Source({
  18197. element: this.$mask[0],
  18198. constrain: this.$overlay[0],
  18199. listeners: {
  18200. dragmove: this.dragmove.bind(that, this.vjson),
  18201. dragend: this.dragend.bind(that, this.vjson)
  18202. },
  18203. startRect: rect,
  18204. sourceVjson: findInCode(this.vjson, vjsonId),
  18205. sourceVjsonId: vjsonId,
  18206. dragType: dragType
  18207. });
  18208. }
  18209. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  18210. };
  18211. /**
  18212. * 选中某个选项
  18213. */
  18214. ViewDesign.prototype.setSelection = function (id) {
  18215. var _a, _b;
  18216. if (!this.designElement) {
  18217. return;
  18218. }
  18219. // 清空选中内容
  18220. this.clearSelection();
  18221. if (!id) {
  18222. return;
  18223. }
  18224. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  18225. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18226. rect.x = position.x;
  18227. rect.y = position.y;
  18228. this.appendMaskbox(rect, id);
  18229. };
  18230. /**
  18231. * 删除组件
  18232. * @param id
  18233. */
  18234. ViewDesign.prototype.deleteComponent = function (id) {
  18235. deletVjsonById(this.vjson, id);
  18236. this.moduleObject.modulePage.currentComponentSelectId = null;
  18237. this.setVjson();
  18238. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  18239. this.clearSelection();
  18240. };
  18241. ViewDesign.prototype.selectParent = function (id) {
  18242. var pid = getSuperVjsonId(this.vjson, id);
  18243. this.moduleObject.modulePage.currentComponentSelectId = pid;
  18244. this.setSelection(pid);
  18245. };
  18246. // todo ====== 拖拽事件 ======
  18247. ViewDesign.prototype.dragmove = function (node, source, info) {
  18248. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18249. if (!target) {
  18250. return;
  18251. }
  18252. var rect = target.getBoundingClientRect();
  18253. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18254. var extHandle = Ext$1.get(target).component;
  18255. if (!extHandle) {
  18256. return;
  18257. }
  18258. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18259. rect.x = position.x;
  18260. rect.y = position.y;
  18261. this.appendDirection(rect, extHandle.id, direction);
  18262. };
  18263. ViewDesign.prototype.dragend = function (node, source, info) {
  18264. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18265. if (!target) {
  18266. return;
  18267. }
  18268. var rect = target.getBoundingClientRect();
  18269. var extHandle = Ext$1.get(target).component;
  18270. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18271. if (!extHandle) {
  18272. return;
  18273. }
  18274. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  18275. this.removeDirection();
  18276. };
  18277. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  18278. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18279. var cv = findInCode(this.vjson, vjsonId);
  18280. if (this.$direction) {
  18281. $$1('#direction' + this.id).remove();
  18282. }
  18283. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  18284. //
  18285. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  18286. if (direction) {
  18287. if (direction === "top") {
  18288. // direction = 'center'
  18289. height = height / 4;
  18290. }
  18291. else if (direction === "bottom") {
  18292. // direction = 'center'
  18293. top = top + height / 4 * 3;
  18294. height = height / 4;
  18295. }
  18296. else if (direction === "left") {
  18297. width = width / 4;
  18298. }
  18299. else if (direction === "right") {
  18300. left = left + width / 4 * 3;
  18301. width = width / 4;
  18302. }
  18303. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18304. this.$direction.css({
  18305. position: 'absolute',
  18306. top: top, left: left, width: width, height: height,
  18307. // border: '2px dashed #1890ff',
  18308. background: 'rgba(40,224,218,0.75)',
  18309. zIndex: 100,
  18310. });
  18311. this.$direction.appendTo(this.$overlay);
  18312. // }
  18313. }
  18314. };
  18315. ViewDesign.prototype.removeDirection = function () {
  18316. if (this.$direction) {
  18317. this.$direction.remove();
  18318. this.$direction = null;
  18319. }
  18320. };
  18321. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  18322. var arrS;
  18323. if (sourceVjId) {
  18324. arrS = findArrayContainer(this.vjson, sourceVjId);
  18325. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  18326. var indexS = _$1.findIndex(arrS, function (v) {
  18327. return v.id === sourceVjId;
  18328. });
  18329. if (indexS < 0) {
  18330. return;
  18331. }
  18332. }
  18333. delete sourceVjson.id;
  18334. var vjsonT = findInCode(this.vjson, targetVjId);
  18335. var arrT = findArrayContainer(this.vjson, targetVjId);
  18336. var indexT = _$1.findIndex(arrT, function (v) {
  18337. return v.id === targetVjId;
  18338. });
  18339. if (indexT < 0) {
  18340. return;
  18341. }
  18342. switch (direction) {
  18343. case 'top':
  18344. case 'left':
  18345. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18346. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18347. vjsonT.items.splice(0, 0, sourceVjson);
  18348. }
  18349. else {
  18350. arrT.splice(indexT, 0, sourceVjson);
  18351. }
  18352. break;
  18353. case 'bottom':
  18354. case 'right':
  18355. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18356. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18357. vjsonT.items.push(sourceVjson);
  18358. }
  18359. else {
  18360. arrT.splice(indexT + 1, 0, sourceVjson);
  18361. }
  18362. break;
  18363. case 'center':
  18364. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18365. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18366. vjsonT.items.push(sourceVjson);
  18367. }
  18368. else {
  18369. arrT.splice(indexT, 1, sourceVjson);
  18370. }
  18371. break;
  18372. }
  18373. if (sourceVjId) {
  18374. deletVjsonById(this.vjson, sourceVjId);
  18375. sourceVjson.id = sourceVjId;
  18376. }
  18377. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  18378. };
  18379. // todo ======== 事件 ==========
  18380. // 接收 postMessage 事件分发
  18381. ViewDesign.prototype.onMessageEvent = function (event) {
  18382. var _a, _b;
  18383. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  18384. if (fucName && typeof this[fucName] === 'function') {
  18385. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  18386. }
  18387. };
  18388. // 接收外部选中组件事件
  18389. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  18390. if (from !== this.name) {
  18391. this.setSelection(id);
  18392. }
  18393. };
  18394. // 接收外部组件删除事件
  18395. ViewDesign.prototype.onComponentDelete = function (id, from) {
  18396. if (from !== this.name) {
  18397. this.deleteComponent(id);
  18398. }
  18399. };
  18400. // 组件被选中
  18401. ViewDesign.prototype.onComponentSelect = function (args) {
  18402. if (args[2] != this.moduleId) {
  18403. return;
  18404. }
  18405. if (args[0]) {
  18406. var rect = args[0];
  18407. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18408. rect.x = position.x;
  18409. rect.y = position.y;
  18410. this.clearSelection();
  18411. this.appendMaskbox(rect, args[1]);
  18412. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  18413. }
  18414. };
  18415. ViewDesign.prototype.onComponentInfo = function (_a) {
  18416. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  18417. if (moduleId != this.moduleId) {
  18418. return;
  18419. }
  18420. if (rect) {
  18421. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18422. rect.x = position.x;
  18423. rect.y = position.y;
  18424. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18425. var cv_1 = findInCode(this.vjson, vjsonId);
  18426. if (this.$direction) {
  18427. $$1('#direction' + this.id).remove();
  18428. }
  18429. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  18430. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  18431. if (direction) {
  18432. if (direction === "top") {
  18433. direction = 'center';
  18434. //height = height/3
  18435. }
  18436. else if (direction === "bottom") {
  18437. direction = 'center';
  18438. // top=top+height/3*2
  18439. // height = height/3
  18440. }
  18441. else if (direction === "left") {
  18442. width = width / 3;
  18443. }
  18444. else if (direction === "right") {
  18445. left = left + width / 3 * 2;
  18446. width = width / 3;
  18447. }
  18448. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18449. this.$direction.css({
  18450. position: 'absolute',
  18451. top: top, left: left, width: width, height: height,
  18452. // border: '2px dashed #1890ff',
  18453. background: 'rgba(74,106,201,0.42)',
  18454. zIndex: 100,
  18455. });
  18456. this.$direction.appendTo(this.$overlay);
  18457. }
  18458. }
  18459. console.log("direction", direction);
  18460. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  18461. // rect.x = position.x
  18462. // rect.y = position.y
  18463. // this.clearSelection()
  18464. // this.appendMaskbox(rect, args[1])
  18465. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  18466. }
  18467. };
  18468. ViewDesign.prototype.onUndo = function () {
  18469. if (this.undoVjsonList.length > 0) {
  18470. if (this.redoVjsonList.length >= 100) {
  18471. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  18472. }
  18473. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18474. this.vjson = this.undoVjsonList.pop();
  18475. // this.setVjson(this.vjson, "", false, "undo")
  18476. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  18477. }
  18478. };
  18479. ViewDesign.prototype.onRedo = function () {
  18480. if (this.redoVjsonList.length > 0) {
  18481. if (this.undoVjsonList.length >= 100) {
  18482. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  18483. }
  18484. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18485. this.vjson = this.redoVjsonList.pop();
  18486. // this.setVjson(this.vjson, "", false, "redo")
  18487. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  18488. }
  18489. };
  18490. ViewDesign.prototype.onKeyPress = function (event) {
  18491. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  18492. // if (this.backStep()) {
  18493. // event.stopPropagation()
  18494. // event.preventDefault()
  18495. // return
  18496. // }
  18497. // }
  18498. //
  18499. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  18500. // if (this.recoverStep()) {
  18501. // event.stopPropagation()
  18502. // event.preventDefault()
  18503. // return
  18504. // }
  18505. // }
  18506. // if (event.key === 'ArrowUp') {
  18507. // if (this.selectParent()) {
  18508. // event.stopPropagation()
  18509. // event.preventDefault()
  18510. // return;
  18511. // }
  18512. // }
  18513. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  18514. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  18515. event.stopPropagation();
  18516. event.preventDefault();
  18517. return;
  18518. }
  18519. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  18520. // if (this.copyView()) {
  18521. // event.stopPropagation()
  18522. // event.preventDefault()
  18523. // return;
  18524. // }
  18525. // }
  18526. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  18527. // if (this.copyView(true)) {
  18528. // event.stopPropagation()
  18529. // event.preventDefault()
  18530. // return;
  18531. // }
  18532. // }
  18533. //
  18534. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  18535. // if (this.selectRoot()) {
  18536. // event.stopPropagation()
  18537. // event.preventDefault()
  18538. // return;
  18539. // }
  18540. //
  18541. };
  18542. ViewDesign.prototype.onCopy = function (event) {
  18543. if (this.moduleObject.modulePage.currentComponentSelectId) {
  18544. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  18545. if (copyVjson) {
  18546. removeDesignProp(copyVjson);
  18547. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  18548. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  18549. }
  18550. }
  18551. };
  18552. ViewDesign.prototype.onPaste = function (event) {
  18553. debugger;
  18554. };
  18555. ViewDesign.prototype.onfocus = function () {
  18556. console.log("getCopy");
  18557. console.log("document.activeElement", document.activeElement.id);
  18558. // clearTimeout(this.getOuterCopyValueTimer);
  18559. // native.clipboardRead()
  18560. };
  18561. ViewDesign.prototype.onMousemove = function (event) {
  18562. var _a;
  18563. if (document.activeElement.id === this.$overlay[0].id) {
  18564. // console.log(event.clientX, event.clientY)
  18565. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  18566. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  18567. // this.iframeWindow.postMessage({
  18568. // method: 'overlayGetInfo',
  18569. // args: [position, this.moduleId]
  18570. // }, '*')
  18571. }
  18572. }
  18573. };
  18574. ViewDesign.prototype.onDestroy = function () {
  18575. window.removeEventListener('message', this.onMessageEvent.bind(this));
  18576. for (var i = 0; i < this.subscribeList.length; i++) {
  18577. this.subscribeList[i].cancel();
  18578. }
  18579. };
  18580. // todo ======== 工具方法 ==========
  18581. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  18582. if (relative === void 0) { relative = null; }
  18583. if (from === "main" && to === "overlay") {
  18584. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18585. var x = overlayRect.x;
  18586. var y = overlayRect.y;
  18587. if (relative) {
  18588. var relativeRect = relative.getBoundingClientRect();
  18589. console.log("main->", relativeRect.x, relativeRect.y);
  18590. x = x - relativeRect.x;
  18591. y = y - relativeRect.y;
  18592. }
  18593. pos.x = pos.x - x;
  18594. pos.y = pos.y - y;
  18595. }
  18596. else if (from === "overlay" && to === "main") {
  18597. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18598. var x = overlayRect.x;
  18599. var y = overlayRect.y;
  18600. if (relative) {
  18601. var relativeRect = relative.getBoundingClientRect();
  18602. console.log("iframe->", relativeRect.x, relativeRect.y);
  18603. x = x - relativeRect.x;
  18604. y = y - relativeRect.y;
  18605. }
  18606. pos.x = pos.x + x;
  18607. pos.y = pos.y + y;
  18608. }
  18609. return pos;
  18610. };
  18611. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  18612. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  18613. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  18614. return "center";
  18615. }
  18616. // col-item 只能放左右
  18617. if (dragType === "col-item" || dragType === "") {
  18618. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  18619. if (x > rect.x && x < rect.x + rect.width / 3) {
  18620. return "left";
  18621. }
  18622. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  18623. return "right";
  18624. }
  18625. }
  18626. }
  18627. // cols-container 只能放上下
  18628. if (dragType === "cols-container" || dragType === "") {
  18629. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  18630. if (y > rect.y && y < rect.y + rect.height / 3) {
  18631. return "top";
  18632. }
  18633. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  18634. return "bottom";
  18635. }
  18636. }
  18637. }
  18638. return "";
  18639. };
  18640. return ViewDesign;
  18641. }());
  18642. //
  18643. //# sourceMappingURL=ViewDesign.js.map
  18644. var model$k = {
  18645. data: {
  18646. iframeSrc: ''
  18647. }
  18648. };
  18649. //# sourceMappingURL=ModulePage.model.js.map
  18650. var vjson$k = {
  18651. layout: 'fit',
  18652. border: false,
  18653. iconCls: 'x-fa fa-newspaper-o',
  18654. referenceHolder: true,
  18655. items: [
  18656. {
  18657. layout: 'border',
  18658. border: false,
  18659. items: [
  18660. {
  18661. region: 'center',
  18662. xtype: 'tabpanel',
  18663. border: false,
  18664. tabPosition: 'bottom',
  18665. reference: 'tabPanel',
  18666. listeners: {
  18667. tabchange: 'scope.tabchange'
  18668. },
  18669. defaults: {
  18670. border: false,
  18671. },
  18672. items: [
  18673. {
  18674. title: 'controller.js',
  18675. xtype: 'jseditor',
  18676. reference: 'controllerEditor',
  18677. },
  18678. {
  18679. title: 'view.design',
  18680. xtype: 'designer',
  18681. reference: 'designer',
  18682. listeners: {
  18683. afterrender: 'scope.previewRender'
  18684. },
  18685. },
  18686. {
  18687. title: 'view.js',
  18688. xtype: 'jseditor',
  18689. reference: 'viewEditor',
  18690. },
  18691. {
  18692. title: 'model.js',
  18693. xtype: 'jseditor',
  18694. reference: 'modelEditor',
  18695. },
  18696. {
  18697. title: 'groovy',
  18698. xtype: 'groovyeditor',
  18699. reference: 'groovyEditor',
  18700. },
  18701. {
  18702. title: 'SQL',
  18703. xtype: 'sqleditor',
  18704. reference: 'sqlEditor',
  18705. }
  18706. ]
  18707. }
  18708. ]
  18709. }
  18710. ]
  18711. };
  18712. //# sourceMappingURL=ModulePage.view.js.map
  18713. var ModulePage = /** @class */ (function (_super) {
  18714. __extends(ModulePage, _super);
  18715. function ModulePage(moduleId, module) {
  18716. var _this = _super.call(this, { model: model$k, vjson: vjson$k }) || this;
  18717. _this.name = "ModulePage";
  18718. _this.viewDesign = null;
  18719. _this.maxViewId = 0;
  18720. _this.moduleEventBus = new EventBus();
  18721. _this.codeChange = _$2.debounce(function (code, from, e) {
  18722. try {
  18723. switch (from) {
  18724. case _this.refs.controllerEditor.name:
  18725. moduleStore.updateJsController(_this.moduleId, code, from);
  18726. break;
  18727. case _this.refs.viewEditor.name:
  18728. moduleStore.updateJsView(_this.moduleId, code, from);
  18729. break;
  18730. case _this.refs.modelEditor.name:
  18731. moduleStore.updateJsModel(_this.moduleId, code, from);
  18732. break;
  18733. case _this.refs.groovyEditor.name:
  18734. moduleStore.updateGroovy(_this.moduleId, code, from);
  18735. break;
  18736. case _this.refs.sqlEditor.name:
  18737. moduleStore.updateMybatis(_this.moduleId, code, from);
  18738. break;
  18739. }
  18740. }
  18741. catch (e) {
  18742. }
  18743. }, 500, { maxWait: 10000 });
  18744. _this.moduleId = moduleId;
  18745. _this.module = module;
  18746. _this.cancelSubscribe = [];
  18747. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  18748. _this.initEditor(moduleItem);
  18749. }));
  18750. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  18751. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18752. _this.previewReRender();
  18753. }));
  18754. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  18755. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18756. _this.updateVjson(vjson, from, ignoreRenderUI);
  18757. }));
  18758. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  18759. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18760. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  18761. }));
  18762. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  18763. var id = _a.id, from = _a.from;
  18764. _this.onComponentSelectionChange(id, from);
  18765. }));
  18766. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  18767. _this.onUndo();
  18768. }));
  18769. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  18770. _this.onRedo();
  18771. }));
  18772. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  18773. _this.currentCopyVjson = stringToJsonObj(value);
  18774. }));
  18775. return _this;
  18776. }
  18777. ModulePage.prototype.onLoad = function () {
  18778. var _this = this;
  18779. // this.refs.preview.src = href
  18780. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  18781. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  18782. _this.saveCall();
  18783. }));
  18784. this.activeEditor = this.refs.controllerEditor;
  18785. this.refs.controllerEditor.modulePage = this;
  18786. this.refs.viewEditor.modulePage = this;
  18787. this.refs.modelEditor.modulePage = this;
  18788. this.refs.groovyEditor.modulePage = this;
  18789. this.refs.sqlEditor.modulePage = this;
  18790. this.refs.controllerEditor.name = "controllerEditor";
  18791. this.refs.viewEditor.name = "viewEditor";
  18792. this.refs.modelEditor.name = "modelEditor";
  18793. this.refs.groovyEditor.name = "groovyEditor";
  18794. this.refs.sqlEditor.name = "sqlEditor";
  18795. this.refs.controllerEditor.codeChange = this.codeChange;
  18796. this.refs.viewEditor.codeChange = this.codeChange;
  18797. this.refs.modelEditor.codeChange = this.codeChange;
  18798. this.refs.groovyEditor.codeChange = this.codeChange;
  18799. this.refs.sqlEditor.codeChange = this.codeChange;
  18800. };
  18801. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  18802. if (!cmpVjson || from === this.name) {
  18803. return;
  18804. }
  18805. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18806. replaceVjsonById(vj, cmpVjson);
  18807. this.updateVjson(vj, from, ignoreRenderUI);
  18808. };
  18809. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  18810. var _this = this;
  18811. var _a, _b;
  18812. if (!vjson || from === this.name) {
  18813. return;
  18814. }
  18815. this.addViewId(vjson);
  18816. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  18817. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  18818. (_a = this.refs.viewEditor) === null || _a === void 0 ? void 0 : _a.setCode((_b = moduleStore.getModuleObject(this.moduleId).fileContent) === null || _b === void 0 ? void 0 : _b.jsView);
  18819. this.previewReRender();
  18820. _$2.defer(function () {
  18821. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  18822. });
  18823. };
  18824. ModulePage.prototype.previewRender = function (sender) {
  18825. var _this = this;
  18826. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18827. if (!this.designScope) {
  18828. this.designScope = new Scope({
  18829. vjson: vjson,
  18830. model: {
  18831. data: {}
  18832. }
  18833. });
  18834. }
  18835. else {
  18836. this.designScope.vjson = vjson;
  18837. }
  18838. this.designScope.showDesigner(sender, {
  18839. moduleId: this.moduleId,
  18840. });
  18841. if (this.viewDesign) {
  18842. return;
  18843. }
  18844. _$2.defer(function () {
  18845. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  18846. handles$1.mainWindow.setLoading(false);
  18847. });
  18848. };
  18849. ModulePage.prototype.previewReRender = function () {
  18850. var designer = this.refs.designer;
  18851. this.previewRender(designer);
  18852. };
  18853. ModulePage.prototype.initEditor = function (moduleItem) {
  18854. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  18855. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  18856. return;
  18857. (_a = this.refs.controllerEditor) === null || _a === void 0 ? void 0 : _a.setCode((_b = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _b === void 0 ? void 0 : _b.jsController);
  18858. (_c = this.refs.viewEditor) === null || _c === void 0 ? void 0 : _c.setCode((_d = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _d === void 0 ? void 0 : _d.jsView);
  18859. (_e = this.refs.modelEditor) === null || _e === void 0 ? void 0 : _e.setCode((_f = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _f === void 0 ? void 0 : _f.jsModel);
  18860. (_g = this.refs.groovyEditor) === null || _g === void 0 ? void 0 : _g.setCode((_h = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _h === void 0 ? void 0 : _h.groovy);
  18861. (_j = this.refs.sqlEditor) === null || _j === void 0 ? void 0 : _j.setCode((_k = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _k === void 0 ? void 0 : _k.mybatis);
  18862. };
  18863. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  18864. this.currentComponentSelectId = id;
  18865. };
  18866. ModulePage.prototype.onUndo = function () {
  18867. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18868. this.viewDesign.onUndo();
  18869. }
  18870. };
  18871. ModulePage.prototype.onRedo = function () {
  18872. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18873. this.viewDesign.onRedo();
  18874. }
  18875. };
  18876. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  18877. this.activeEditor = newCard;
  18878. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  18879. };
  18880. ModulePage.prototype.saveCall = function () {
  18881. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  18882. moduleStore.saveFile(this.moduleId, "jsView");
  18883. }
  18884. else if (this.activeEditor === this.refs.controllerEditor) {
  18885. moduleStore.saveFile(this.moduleId, "jsController");
  18886. }
  18887. else if (this.activeEditor === this.refs.modelEditor) {
  18888. moduleStore.saveFile(this.moduleId, "jsModel");
  18889. }
  18890. else if (this.activeEditor === this.refs.groovyEditor) {
  18891. moduleStore.saveFile(this.moduleId, "groovy");
  18892. }
  18893. else if (this.activeEditor === this.refs.sqlEditor) {
  18894. moduleStore.saveFile(this.moduleId, "mybatis");
  18895. }
  18896. };
  18897. ModulePage.prototype.check = function () {
  18898. moduleStore.check(this.moduleId);
  18899. };
  18900. /**
  18901. * 为vjson添加id
  18902. * @param vjson
  18903. * @param isAll
  18904. */
  18905. ModulePage.prototype.addViewId = function (vjson, isAll) {
  18906. var _this = this;
  18907. if (isAll === void 0) { isAll = false; }
  18908. var maxIdTag = 0;
  18909. // 先提取当前的最大id
  18910. deepTravVJson(vjson, function (obj) {
  18911. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18912. return;
  18913. }
  18914. if (obj.id && obj.id.indexOf(idPrefix)) {
  18915. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  18916. if (sutr.length > 0) {
  18917. var tid = sutr.replace(idPrefix, "");
  18918. var idNum = parseInt(tid);
  18919. if (idNum && maxIdTag < idNum) {
  18920. maxIdTag = idNum;
  18921. }
  18922. }
  18923. }
  18924. });
  18925. // 标记最大的id号,避免重复
  18926. this.maxViewId = maxIdTag;
  18927. deepTravVJson(vjson, function (obj) {
  18928. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18929. return;
  18930. }
  18931. if (!obj.hasOwnProperty('id')) {
  18932. obj.id = _this.createViewId();
  18933. }
  18934. if (!obj.hasOwnProperty('designMode')) {
  18935. obj.designMode = true;
  18936. }
  18937. // if (obj.xtype == "tabview" && obj.activeTab) {
  18938. // // 设置默认的选项
  18939. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  18940. // if (typeof obj.activeTab === 'number') {
  18941. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  18942. // } else if (typeof obj.activeTab === 'string') {
  18943. // this._tabViewSelect[obj.id] = obj.activeTab
  18944. // }
  18945. //
  18946. // }
  18947. // }
  18948. if (isAll && obj.hasOwnProperty("view")) ;
  18949. });
  18950. return vjson;
  18951. };
  18952. /**
  18953. * 为组件创建 ID
  18954. */
  18955. ModulePage.prototype.createViewId = function () {
  18956. this.maxViewId++;
  18957. return this.id + idPrefix + this.maxViewId;
  18958. };
  18959. ModulePage.prototype.onDestroy = function () {
  18960. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  18961. this.cancelSubscribe[i].cancel();
  18962. }
  18963. _super.prototype.onDestroy.call(this);
  18964. };
  18965. return ModulePage;
  18966. }(Scope));
  18967. //# sourceMappingURL=ModulePage.js.map
  18968. var camundaModdleDescriptor = {
  18969. "name": "Camunda",
  18970. "uri": "http://camunda.org/schema/1.0/bpmn",
  18971. "prefix": "camunda",
  18972. "xml": {
  18973. "tagAlias": "lowerCase"
  18974. },
  18975. "associations": [],
  18976. "types": [
  18977. {
  18978. "name": "Definitions",
  18979. "isAbstract": true,
  18980. "extends": [
  18981. "bpmn:Definitions"
  18982. ],
  18983. "properties": [
  18984. {
  18985. "name": "diagramRelationId",
  18986. "isAttr": true,
  18987. "type": "String"
  18988. }
  18989. ]
  18990. },
  18991. {
  18992. "name": "InOutBinding",
  18993. "superClass": [
  18994. "Element"
  18995. ],
  18996. "isAbstract": true,
  18997. "properties": [
  18998. {
  18999. "name": "source",
  19000. "isAttr": true,
  19001. "type": "String"
  19002. },
  19003. {
  19004. "name": "sourceExpression",
  19005. "isAttr": true,
  19006. "type": "String"
  19007. },
  19008. {
  19009. "name": "target",
  19010. "isAttr": true,
  19011. "type": "String"
  19012. },
  19013. {
  19014. "name": "businessKey",
  19015. "isAttr": true,
  19016. "type": "String"
  19017. },
  19018. {
  19019. "name": "local",
  19020. "isAttr": true,
  19021. "type": "Boolean",
  19022. "default": false
  19023. },
  19024. {
  19025. "name": "variables",
  19026. "isAttr": true,
  19027. "type": "String"
  19028. }
  19029. ]
  19030. },
  19031. {
  19032. "name": "In",
  19033. "superClass": [
  19034. "InOutBinding"
  19035. ],
  19036. "meta": {
  19037. "allowedIn": [
  19038. "bpmn:CallActivity",
  19039. "bpmn:SignalEventDefinition"
  19040. ]
  19041. }
  19042. },
  19043. {
  19044. "name": "Out",
  19045. "superClass": [
  19046. "InOutBinding"
  19047. ],
  19048. "meta": {
  19049. "allowedIn": [
  19050. "bpmn:CallActivity"
  19051. ]
  19052. }
  19053. },
  19054. {
  19055. "name": "AsyncCapable",
  19056. "isAbstract": true,
  19057. "extends": [
  19058. "bpmn:Activity",
  19059. "bpmn:Gateway",
  19060. "bpmn:Event"
  19061. ],
  19062. "properties": [
  19063. {
  19064. "name": "async",
  19065. "isAttr": true,
  19066. "type": "Boolean",
  19067. "default": false
  19068. },
  19069. {
  19070. "name": "asyncBefore",
  19071. "isAttr": true,
  19072. "type": "Boolean",
  19073. "default": false
  19074. },
  19075. {
  19076. "name": "asyncAfter",
  19077. "isAttr": true,
  19078. "type": "Boolean",
  19079. "default": false
  19080. },
  19081. {
  19082. "name": "exclusive",
  19083. "isAttr": true,
  19084. "type": "Boolean",
  19085. "default": true
  19086. }
  19087. ]
  19088. },
  19089. {
  19090. "name": "JobPriorized",
  19091. "isAbstract": true,
  19092. "extends": [
  19093. "bpmn:Process",
  19094. "camunda:AsyncCapable"
  19095. ],
  19096. "properties": [
  19097. {
  19098. "name": "jobPriority",
  19099. "isAttr": true,
  19100. "type": "String"
  19101. }
  19102. ]
  19103. },
  19104. {
  19105. "name": "SignalEventDefinitionExtension",
  19106. "isAbstract": true,
  19107. "extends": [
  19108. "bpmn:SignalEventDefinition"
  19109. ],
  19110. "properties": [
  19111. {
  19112. "name": "async",
  19113. "isAttr": true,
  19114. "type": "Boolean",
  19115. "default": false
  19116. }
  19117. ]
  19118. },
  19119. {
  19120. "name": "ErrorEventDefinitionExtension",
  19121. "isAbstract": true,
  19122. "extends": [
  19123. "bpmn:ErrorEventDefinition"
  19124. ],
  19125. "properties": [
  19126. {
  19127. "name": "errorCodeVariable",
  19128. "isAttr": true,
  19129. "type": "String"
  19130. },
  19131. {
  19132. "name": "errorMessageVariable",
  19133. "isAttr": true,
  19134. "type": "String"
  19135. }
  19136. ]
  19137. },
  19138. {
  19139. "name": "ErrorEventDefinition",
  19140. "superClass": [
  19141. "bpmn:ErrorEventDefinition",
  19142. "Element"
  19143. ],
  19144. "properties": [
  19145. {
  19146. "name": "expression",
  19147. "isAttr": true,
  19148. "type": "String"
  19149. }
  19150. ],
  19151. "meta": {
  19152. "allowedIn": ["bpmn:ServiceTask"]
  19153. }
  19154. },
  19155. {
  19156. "name": "Error",
  19157. "isAbstract": true,
  19158. "extends": [
  19159. "bpmn:Error"
  19160. ],
  19161. "properties": [
  19162. {
  19163. "name": "camunda:errorMessage",
  19164. "isAttr": true,
  19165. "type": "String"
  19166. }
  19167. ]
  19168. },
  19169. {
  19170. "name": "PotentialStarter",
  19171. "superClass": [
  19172. "Element"
  19173. ],
  19174. "properties": [
  19175. {
  19176. "name": "resourceAssignmentExpression",
  19177. "type": "bpmn:ResourceAssignmentExpression"
  19178. }
  19179. ]
  19180. },
  19181. {
  19182. "name": "FormSupported",
  19183. "isAbstract": true,
  19184. "extends": [
  19185. "bpmn:StartEvent",
  19186. "bpmn:UserTask"
  19187. ],
  19188. "properties": [
  19189. {
  19190. "name": "formHandlerClass",
  19191. "isAttr": true,
  19192. "type": "String"
  19193. },
  19194. {
  19195. "name": "formKey",
  19196. "isAttr": true,
  19197. "type": "String"
  19198. },
  19199. {
  19200. "name": "formRef",
  19201. "isAttr": true,
  19202. "type": "String"
  19203. },
  19204. {
  19205. "name": "formRefBinding",
  19206. "isAttr": true,
  19207. "type": "String"
  19208. },
  19209. {
  19210. "name": "formRefVersion",
  19211. "isAttr": true,
  19212. "type": "String"
  19213. }
  19214. ]
  19215. },
  19216. {
  19217. "name": "TemplateSupported",
  19218. "isAbstract": true,
  19219. "extends": [
  19220. "bpmn:Collaboration",
  19221. "bpmn:Process",
  19222. "bpmn:FlowElement"
  19223. ],
  19224. "properties": [
  19225. {
  19226. "name": "modelerTemplate",
  19227. "isAttr": true,
  19228. "type": "String"
  19229. },
  19230. {
  19231. "name": "modelerTemplateVersion",
  19232. "isAttr": true,
  19233. "type": "Integer"
  19234. }
  19235. ]
  19236. },
  19237. {
  19238. "name": "Initiator",
  19239. "isAbstract": true,
  19240. "extends": ["bpmn:StartEvent"],
  19241. "properties": [
  19242. {
  19243. "name": "initiator",
  19244. "isAttr": true,
  19245. "type": "String"
  19246. }
  19247. ]
  19248. },
  19249. {
  19250. "name": "ScriptTask",
  19251. "isAbstract": true,
  19252. "extends": [
  19253. "bpmn:ScriptTask"
  19254. ],
  19255. "properties": [
  19256. {
  19257. "name": "resultVariable",
  19258. "isAttr": true,
  19259. "type": "String"
  19260. },
  19261. {
  19262. "name": "resource",
  19263. "isAttr": true,
  19264. "type": "String"
  19265. }
  19266. ]
  19267. },
  19268. {
  19269. "name": "Process",
  19270. "isAbstract": true,
  19271. "extends": [
  19272. "bpmn:Process"
  19273. ],
  19274. "properties": [
  19275. {
  19276. "name": "candidateStarterGroups",
  19277. "isAttr": true,
  19278. "type": "String"
  19279. },
  19280. {
  19281. "name": "candidateStarterUsers",
  19282. "isAttr": true,
  19283. "type": "String"
  19284. },
  19285. {
  19286. "name": "versionTag",
  19287. "isAttr": true,
  19288. "type": "String"
  19289. },
  19290. {
  19291. "name": "historyTimeToLive",
  19292. "isAttr": true,
  19293. "type": "String"
  19294. },
  19295. {
  19296. "name": "isStartableInTasklist",
  19297. "isAttr": true,
  19298. "type": "Boolean",
  19299. "default": true
  19300. }
  19301. ]
  19302. },
  19303. {
  19304. "name": "EscalationEventDefinitionExtension",
  19305. "isAbstract": true,
  19306. "extends": [
  19307. "bpmn:EscalationEventDefinition"
  19308. ],
  19309. "properties": [
  19310. {
  19311. "name": "escalationCodeVariable",
  19312. "isAttr": true,
  19313. "type": "String"
  19314. }
  19315. ]
  19316. },
  19317. {
  19318. "name": "FormalExpression",
  19319. "isAbstract": true,
  19320. "extends": [
  19321. "bpmn:FormalExpression"
  19322. ],
  19323. "properties": [
  19324. {
  19325. "name": "resource",
  19326. "isAttr": true,
  19327. "type": "String"
  19328. }
  19329. ]
  19330. },
  19331. {
  19332. "name": "Assignable",
  19333. "extends": ["bpmn:UserTask"],
  19334. "properties": [
  19335. {
  19336. "name": "assignee",
  19337. "isAttr": true,
  19338. "type": "String"
  19339. },
  19340. {
  19341. "name": "candidateUsers",
  19342. "isAttr": true,
  19343. "type": "String"
  19344. },
  19345. {
  19346. "name": "candidateGroups",
  19347. "isAttr": true,
  19348. "type": "String"
  19349. },
  19350. {
  19351. "name": "dueDate",
  19352. "isAttr": true,
  19353. "type": "String"
  19354. },
  19355. {
  19356. "name": "followUpDate",
  19357. "isAttr": true,
  19358. "type": "String"
  19359. },
  19360. {
  19361. "name": "priority",
  19362. "isAttr": true,
  19363. "type": "String"
  19364. }
  19365. ]
  19366. },
  19367. {
  19368. "name": "CallActivity",
  19369. "extends": ["bpmn:CallActivity"],
  19370. "properties": [
  19371. {
  19372. "name": "calledElementBinding",
  19373. "isAttr": true,
  19374. "type": "String",
  19375. "default": "latest"
  19376. },
  19377. {
  19378. "name": "calledElementVersion",
  19379. "isAttr": true,
  19380. "type": "String"
  19381. },
  19382. {
  19383. "name": "calledElementVersionTag",
  19384. "isAttr": true,
  19385. "type": "String"
  19386. },
  19387. {
  19388. "name": "calledElementTenantId",
  19389. "isAttr": true,
  19390. "type": "String"
  19391. },
  19392. {
  19393. "name": "caseRef",
  19394. "isAttr": true,
  19395. "type": "String"
  19396. },
  19397. {
  19398. "name": "caseBinding",
  19399. "isAttr": true,
  19400. "type": "String",
  19401. "default": "latest"
  19402. },
  19403. {
  19404. "name": "caseVersion",
  19405. "isAttr": true,
  19406. "type": "String"
  19407. },
  19408. {
  19409. "name": "caseTenantId",
  19410. "isAttr": true,
  19411. "type": "String"
  19412. },
  19413. {
  19414. "name": "variableMappingClass",
  19415. "isAttr": true,
  19416. "type": "String"
  19417. },
  19418. {
  19419. "name": "variableMappingDelegateExpression",
  19420. "isAttr": true,
  19421. "type": "String"
  19422. }
  19423. ]
  19424. },
  19425. {
  19426. "name": "ServiceTaskLike",
  19427. "extends": [
  19428. "bpmn:ServiceTask",
  19429. "bpmn:BusinessRuleTask",
  19430. "bpmn:SendTask",
  19431. "bpmn:MessageEventDefinition"
  19432. ],
  19433. "properties": [
  19434. {
  19435. "name": "expression",
  19436. "isAttr": true,
  19437. "type": "String"
  19438. },
  19439. {
  19440. "name": "class",
  19441. "isAttr": true,
  19442. "type": "String"
  19443. },
  19444. {
  19445. "name": "delegateExpression",
  19446. "isAttr": true,
  19447. "type": "String"
  19448. },
  19449. {
  19450. "name": "resultVariable",
  19451. "isAttr": true,
  19452. "type": "String"
  19453. }
  19454. ]
  19455. },
  19456. {
  19457. "name": "DmnCapable",
  19458. "extends": [
  19459. "bpmn:BusinessRuleTask"
  19460. ],
  19461. "properties": [
  19462. {
  19463. "name": "decisionRef",
  19464. "isAttr": true,
  19465. "type": "String"
  19466. },
  19467. {
  19468. "name": "decisionRefBinding",
  19469. "isAttr": true,
  19470. "type": "String",
  19471. "default": "latest"
  19472. },
  19473. {
  19474. "name": "decisionRefVersion",
  19475. "isAttr": true,
  19476. "type": "String"
  19477. },
  19478. {
  19479. "name": "mapDecisionResult",
  19480. "isAttr": true,
  19481. "type": "String",
  19482. "default": "resultList"
  19483. },
  19484. {
  19485. "name": "decisionRefTenantId",
  19486. "isAttr": true,
  19487. "type": "String"
  19488. }
  19489. ]
  19490. },
  19491. {
  19492. "name": "ExternalCapable",
  19493. "extends": [
  19494. "camunda:ServiceTaskLike"
  19495. ],
  19496. "properties": [
  19497. {
  19498. "name": "type",
  19499. "isAttr": true,
  19500. "type": "String"
  19501. },
  19502. {
  19503. "name": "topic",
  19504. "isAttr": true,
  19505. "type": "String"
  19506. }
  19507. ]
  19508. },
  19509. {
  19510. "name": "TaskPriorized",
  19511. "extends": [
  19512. "bpmn:Process",
  19513. "camunda:ExternalCapable"
  19514. ],
  19515. "properties": [
  19516. {
  19517. "name": "taskPriority",
  19518. "isAttr": true,
  19519. "type": "String"
  19520. }
  19521. ]
  19522. },
  19523. {
  19524. "name": "Properties",
  19525. "superClass": [
  19526. "Element"
  19527. ],
  19528. "meta": {
  19529. "allowedIn": ["*"]
  19530. },
  19531. "properties": [
  19532. {
  19533. "name": "values",
  19534. "type": "Property",
  19535. "isMany": true
  19536. }
  19537. ]
  19538. },
  19539. {
  19540. "name": "Property",
  19541. "superClass": [
  19542. "Element"
  19543. ],
  19544. "properties": [
  19545. {
  19546. "name": "id",
  19547. "type": "String",
  19548. "isAttr": true
  19549. },
  19550. {
  19551. "name": "name",
  19552. "type": "String",
  19553. "isAttr": true
  19554. },
  19555. {
  19556. "name": "value",
  19557. "type": "String",
  19558. "isAttr": true
  19559. }
  19560. ]
  19561. },
  19562. {
  19563. "name": "Connector",
  19564. "superClass": [
  19565. "Element"
  19566. ],
  19567. "meta": {
  19568. "allowedIn": [
  19569. "camunda:ServiceTaskLike"
  19570. ]
  19571. },
  19572. "properties": [
  19573. {
  19574. "name": "inputOutput",
  19575. "type": "InputOutput"
  19576. },
  19577. {
  19578. "name": "connectorId",
  19579. "type": "String"
  19580. }
  19581. ]
  19582. },
  19583. {
  19584. "name": "InputOutput",
  19585. "superClass": [
  19586. "Element"
  19587. ],
  19588. "meta": {
  19589. "allowedIn": [
  19590. "bpmn:FlowNode",
  19591. "camunda:Connector"
  19592. ]
  19593. },
  19594. "properties": [
  19595. {
  19596. "name": "inputOutput",
  19597. "type": "InputOutput"
  19598. },
  19599. {
  19600. "name": "connectorId",
  19601. "type": "String"
  19602. },
  19603. {
  19604. "name": "inputParameters",
  19605. "isMany": true,
  19606. "type": "InputParameter"
  19607. },
  19608. {
  19609. "name": "outputParameters",
  19610. "isMany": true,
  19611. "type": "OutputParameter"
  19612. }
  19613. ]
  19614. },
  19615. {
  19616. "name": "InputOutputParameter",
  19617. "properties": [
  19618. {
  19619. "name": "name",
  19620. "isAttr": true,
  19621. "type": "String"
  19622. },
  19623. {
  19624. "name": "value",
  19625. "isBody": true,
  19626. "type": "String"
  19627. },
  19628. {
  19629. "name": "definition",
  19630. "type": "InputOutputParameterDefinition"
  19631. }
  19632. ]
  19633. },
  19634. {
  19635. "name": "InputOutputParameterDefinition",
  19636. "isAbstract": true
  19637. },
  19638. {
  19639. "name": "List",
  19640. "superClass": ["InputOutputParameterDefinition"],
  19641. "properties": [
  19642. {
  19643. "name": "items",
  19644. "isMany": true,
  19645. "type": "InputOutputParameterDefinition"
  19646. }
  19647. ]
  19648. },
  19649. {
  19650. "name": "Map",
  19651. "superClass": ["InputOutputParameterDefinition"],
  19652. "properties": [
  19653. {
  19654. "name": "entries",
  19655. "isMany": true,
  19656. "type": "Entry"
  19657. }
  19658. ]
  19659. },
  19660. {
  19661. "name": "Entry",
  19662. "properties": [
  19663. {
  19664. "name": "key",
  19665. "isAttr": true,
  19666. "type": "String"
  19667. },
  19668. {
  19669. "name": "value",
  19670. "isBody": true,
  19671. "type": "String"
  19672. },
  19673. {
  19674. "name": "definition",
  19675. "type": "InputOutputParameterDefinition"
  19676. }
  19677. ]
  19678. },
  19679. {
  19680. "name": "Value",
  19681. "superClass": [
  19682. "InputOutputParameterDefinition"
  19683. ],
  19684. "properties": [
  19685. {
  19686. "name": "id",
  19687. "isAttr": true,
  19688. "type": "String"
  19689. },
  19690. {
  19691. "name": "name",
  19692. "isAttr": true,
  19693. "type": "String"
  19694. },
  19695. {
  19696. "name": "value",
  19697. "isBody": true,
  19698. "type": "String"
  19699. }
  19700. ]
  19701. },
  19702. {
  19703. "name": "Script",
  19704. "superClass": ["InputOutputParameterDefinition"],
  19705. "properties": [
  19706. {
  19707. "name": "scriptFormat",
  19708. "isAttr": true,
  19709. "type": "String"
  19710. },
  19711. {
  19712. "name": "resource",
  19713. "isAttr": true,
  19714. "type": "String"
  19715. },
  19716. {
  19717. "name": "value",
  19718. "isBody": true,
  19719. "type": "String"
  19720. }
  19721. ]
  19722. },
  19723. {
  19724. "name": "Field",
  19725. "superClass": ["Element"],
  19726. "meta": {
  19727. "allowedIn": [
  19728. "camunda:ServiceTaskLike",
  19729. "camunda:ExecutionListener",
  19730. "camunda:TaskListener"
  19731. ]
  19732. },
  19733. "properties": [
  19734. {
  19735. "name": "name",
  19736. "isAttr": true,
  19737. "type": "String"
  19738. },
  19739. {
  19740. "name": "expression",
  19741. "type": "String"
  19742. },
  19743. {
  19744. "name": "stringValue",
  19745. "isAttr": true,
  19746. "type": "String"
  19747. },
  19748. {
  19749. "name": "string",
  19750. "type": "String"
  19751. }
  19752. ]
  19753. },
  19754. {
  19755. "name": "InputParameter",
  19756. "superClass": ["InputOutputParameter"]
  19757. },
  19758. {
  19759. "name": "OutputParameter",
  19760. "superClass": ["InputOutputParameter"]
  19761. },
  19762. {
  19763. "name": "Collectable",
  19764. "isAbstract": true,
  19765. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  19766. "superClass": ["camunda:AsyncCapable"],
  19767. "properties": [
  19768. {
  19769. "name": "collection",
  19770. "isAttr": true,
  19771. "type": "String"
  19772. },
  19773. {
  19774. "name": "elementVariable",
  19775. "isAttr": true,
  19776. "type": "String"
  19777. }
  19778. ]
  19779. },
  19780. {
  19781. "name": "FailedJobRetryTimeCycle",
  19782. "superClass": ["Element"],
  19783. "meta": {
  19784. "allowedIn": [
  19785. "camunda:AsyncCapable",
  19786. "bpmn:MultiInstanceLoopCharacteristics"
  19787. ]
  19788. },
  19789. "properties": [
  19790. {
  19791. "name": "body",
  19792. "isBody": true,
  19793. "type": "String"
  19794. }
  19795. ]
  19796. },
  19797. {
  19798. "name": "ExecutionListener",
  19799. "superClass": ["Element"],
  19800. "meta": {
  19801. "allowedIn": [
  19802. "bpmn:Task",
  19803. "bpmn:ServiceTask",
  19804. "bpmn:UserTask",
  19805. "bpmn:BusinessRuleTask",
  19806. "bpmn:ScriptTask",
  19807. "bpmn:ReceiveTask",
  19808. "bpmn:ManualTask",
  19809. "bpmn:ExclusiveGateway",
  19810. "bpmn:SequenceFlow",
  19811. "bpmn:ParallelGateway",
  19812. "bpmn:InclusiveGateway",
  19813. "bpmn:EventBasedGateway",
  19814. "bpmn:StartEvent",
  19815. "bpmn:IntermediateCatchEvent",
  19816. "bpmn:IntermediateThrowEvent",
  19817. "bpmn:EndEvent",
  19818. "bpmn:BoundaryEvent",
  19819. "bpmn:CallActivity",
  19820. "bpmn:SubProcess",
  19821. "bpmn:Process"
  19822. ]
  19823. },
  19824. "properties": [
  19825. {
  19826. "name": "expression",
  19827. "isAttr": true,
  19828. "type": "String"
  19829. },
  19830. {
  19831. "name": "class",
  19832. "isAttr": true,
  19833. "type": "String"
  19834. },
  19835. {
  19836. "name": "delegateExpression",
  19837. "isAttr": true,
  19838. "type": "String"
  19839. },
  19840. {
  19841. "name": "event",
  19842. "isAttr": true,
  19843. "type": "String"
  19844. },
  19845. {
  19846. "name": "script",
  19847. "type": "Script"
  19848. },
  19849. {
  19850. "name": "fields",
  19851. "type": "Field",
  19852. "isMany": true
  19853. }
  19854. ]
  19855. },
  19856. {
  19857. "name": "TaskListener",
  19858. "superClass": ["Element"],
  19859. "meta": {
  19860. "allowedIn": [
  19861. "bpmn:UserTask"
  19862. ]
  19863. },
  19864. "properties": [
  19865. {
  19866. "name": "expression",
  19867. "isAttr": true,
  19868. "type": "String"
  19869. },
  19870. {
  19871. "name": "class",
  19872. "isAttr": true,
  19873. "type": "String"
  19874. },
  19875. {
  19876. "name": "delegateExpression",
  19877. "isAttr": true,
  19878. "type": "String"
  19879. },
  19880. {
  19881. "name": "event",
  19882. "isAttr": true,
  19883. "type": "String"
  19884. },
  19885. {
  19886. "name": "script",
  19887. "type": "Script"
  19888. },
  19889. {
  19890. "name": "fields",
  19891. "type": "Field",
  19892. "isMany": true
  19893. },
  19894. {
  19895. "name": "id",
  19896. "type": "String",
  19897. "isAttr": true
  19898. },
  19899. {
  19900. "name": "eventDefinitions",
  19901. "type": "bpmn:TimerEventDefinition",
  19902. "isMany": true
  19903. }
  19904. ]
  19905. },
  19906. {
  19907. "name": "FormProperty",
  19908. "superClass": ["Element"],
  19909. "meta": {
  19910. "allowedIn": [
  19911. "bpmn:StartEvent",
  19912. "bpmn:UserTask"
  19913. ]
  19914. },
  19915. "properties": [
  19916. {
  19917. "name": "id",
  19918. "type": "String",
  19919. "isAttr": true
  19920. },
  19921. {
  19922. "name": "name",
  19923. "type": "String",
  19924. "isAttr": true
  19925. },
  19926. {
  19927. "name": "type",
  19928. "type": "String",
  19929. "isAttr": true
  19930. },
  19931. {
  19932. "name": "required",
  19933. "type": "String",
  19934. "isAttr": true
  19935. },
  19936. {
  19937. "name": "readable",
  19938. "type": "String",
  19939. "isAttr": true
  19940. },
  19941. {
  19942. "name": "writable",
  19943. "type": "String",
  19944. "isAttr": true
  19945. },
  19946. {
  19947. "name": "variable",
  19948. "type": "String",
  19949. "isAttr": true
  19950. },
  19951. {
  19952. "name": "expression",
  19953. "type": "String",
  19954. "isAttr": true
  19955. },
  19956. {
  19957. "name": "datePattern",
  19958. "type": "String",
  19959. "isAttr": true
  19960. },
  19961. {
  19962. "name": "default",
  19963. "type": "String",
  19964. "isAttr": true
  19965. },
  19966. {
  19967. "name": "values",
  19968. "type": "Value",
  19969. "isMany": true
  19970. }
  19971. ]
  19972. },
  19973. {
  19974. "name": "FormData",
  19975. "superClass": ["Element"],
  19976. "meta": {
  19977. "allowedIn": [
  19978. "bpmn:StartEvent",
  19979. "bpmn:UserTask"
  19980. ]
  19981. },
  19982. "properties": [
  19983. {
  19984. "name": "fields",
  19985. "type": "FormField",
  19986. "isMany": true
  19987. },
  19988. {
  19989. "name": "businessKey",
  19990. "type": "String",
  19991. "isAttr": true
  19992. }
  19993. ]
  19994. },
  19995. {
  19996. "name": "FormField",
  19997. "superClass": ["Element"],
  19998. "properties": [
  19999. {
  20000. "name": "id",
  20001. "type": "String",
  20002. "isAttr": true
  20003. },
  20004. {
  20005. "name": "label",
  20006. "type": "String",
  20007. "isAttr": true
  20008. },
  20009. {
  20010. "name": "type",
  20011. "type": "String",
  20012. "isAttr": true
  20013. },
  20014. {
  20015. "name": "datePattern",
  20016. "type": "String",
  20017. "isAttr": true
  20018. },
  20019. {
  20020. "name": "defaultValue",
  20021. "type": "String",
  20022. "isAttr": true
  20023. },
  20024. {
  20025. "name": "properties",
  20026. "type": "Properties"
  20027. },
  20028. {
  20029. "name": "validation",
  20030. "type": "Validation"
  20031. },
  20032. {
  20033. "name": "values",
  20034. "type": "Value",
  20035. "isMany": true
  20036. }
  20037. ]
  20038. },
  20039. {
  20040. "name": "Validation",
  20041. "superClass": ["Element"],
  20042. "properties": [
  20043. {
  20044. "name": "constraints",
  20045. "type": "Constraint",
  20046. "isMany": true
  20047. }
  20048. ]
  20049. },
  20050. {
  20051. "name": "Constraint",
  20052. "superClass": ["Element"],
  20053. "properties": [
  20054. {
  20055. "name": "name",
  20056. "type": "String",
  20057. "isAttr": true
  20058. },
  20059. {
  20060. "name": "config",
  20061. "type": "String",
  20062. "isAttr": true
  20063. }
  20064. ]
  20065. },
  20066. {
  20067. "name": "ConditionalEventDefinitionExtension",
  20068. "isAbstract": true,
  20069. "extends": [
  20070. "bpmn:ConditionalEventDefinition"
  20071. ],
  20072. "properties": [
  20073. {
  20074. "name": "variableName",
  20075. "isAttr": true,
  20076. "type": "String"
  20077. },
  20078. {
  20079. "name": "variableEvents",
  20080. "isAttr": true,
  20081. "type": "String"
  20082. }
  20083. ]
  20084. }
  20085. ],
  20086. "emumerations": []
  20087. };
  20088. //# sourceMappingURL=camundaModdleDescriptor.js.map
  20089. /**
  20090. * This is a sample file that should be replaced with the actual translation.
  20091. *
  20092. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  20093. * translations and labels to translate.
  20094. */
  20095. var translations = {
  20096. // Labels
  20097. 'Activate the global connect tool': '激活全局连接工具',
  20098. 'Append {type}': '追加 {type}',
  20099. 'Append EndEvent': '追加 结束事件 ',
  20100. 'Append Task': '追加 任务',
  20101. 'Append Gateway': '追加 网关',
  20102. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  20103. 'Add Lane above': '在上面添加道',
  20104. 'Divide into two Lanes': '分割成两个道',
  20105. 'Divide into three Lanes': '分割成三个道',
  20106. 'Add Lane below': '在下面添加道',
  20107. 'Append compensation activity': '追加补偿活动',
  20108. 'Change type': '修改类型',
  20109. 'Connect using Association': '使用关联连接',
  20110. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  20111. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  20112. 'Remove': '移除',
  20113. 'Activate the hand tool': '激活抓手工具',
  20114. 'Activate the lasso tool': '激活套索工具',
  20115. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  20116. 'Create expanded SubProcess': '创建扩展子过程',
  20117. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  20118. 'Create Pool/Participant': '创建池/参与者',
  20119. 'Parallel Multi Instance': '并行多重事件',
  20120. 'Sequential Multi Instance': '时序多重事件',
  20121. 'DataObjectReference': '数据对象参考',
  20122. 'DataStoreReference': '数据存储参考',
  20123. 'Loop': '循环',
  20124. 'Ad-hoc': '即席',
  20125. 'Create {type}': '创建 {type}',
  20126. 'Create Task': '创建任务',
  20127. 'Create StartEvent': '创建开始事件',
  20128. 'Create EndEvent': '创建结束事件',
  20129. 'Create Group': '创建组',
  20130. 'Task': '任务',
  20131. 'Send Task': '发送任务',
  20132. 'Receive Task': '接收任务',
  20133. 'User Task': '用户任务',
  20134. 'Manual Task': '手工任务',
  20135. 'Business Rule Task': '业务规则任务',
  20136. 'Service Task': '服务任务',
  20137. 'Script Task': '脚本任务',
  20138. 'Call Activity': '调用活动',
  20139. 'Sub Process (collapsed)': '子流程(折叠的)',
  20140. 'Sub Process (expanded)': '子流程(展开的)',
  20141. 'Start Event': '开始事件',
  20142. 'StartEvent': '开始事件',
  20143. 'Intermediate Throw Event': '中间事件',
  20144. 'End Event': '结束事件',
  20145. 'EndEvent': '结束事件',
  20146. 'Create Gateway': '创建网关',
  20147. 'GateWay': '网关',
  20148. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  20149. 'Message Start Event': '消息开始事件',
  20150. 'Timer Start Event': '定时开始事件',
  20151. 'Conditional Start Event': '条件开始事件',
  20152. 'Signal Start Event': '信号开始事件',
  20153. 'Error Start Event': '错误开始事件',
  20154. 'Escalation Start Event': '升级开始事件',
  20155. 'Compensation Start Event': '补偿开始事件',
  20156. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  20157. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  20158. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  20159. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  20160. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  20161. 'Message Intermediate Catch Event': '消息中间捕获事件',
  20162. 'Message Intermediate Throw Event': '消息中间抛出事件',
  20163. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  20164. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  20165. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  20166. 'Link Intermediate Catch Event': '链接中间捕获事件',
  20167. 'Link Intermediate Throw Event': '链接中间抛出事件',
  20168. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  20169. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  20170. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  20171. 'Message End Event': '消息结束事件',
  20172. 'Escalation End Event': '定时结束事件',
  20173. 'Error End Event': '错误结束事件',
  20174. 'Cancel End Event': '取消结束事件',
  20175. 'Compensation End Event': '补偿结束事件',
  20176. 'Signal End Event': '信号结束事件',
  20177. 'Terminate End Event': '终止结束事件',
  20178. 'Message Boundary Event': '消息边界事件',
  20179. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  20180. 'Timer Boundary Event': '定时边界事件',
  20181. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  20182. 'Escalation Boundary Event': '升级边界事件',
  20183. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  20184. 'Conditional Boundary Event': '条件边界事件',
  20185. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  20186. 'Error Boundary Event': '错误边界事件',
  20187. 'Cancel Boundary Event': '取消边界事件',
  20188. 'Signal Boundary Event': '信号边界事件',
  20189. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  20190. 'Compensation Boundary Event': '补偿边界事件',
  20191. 'Exclusive Gateway': '互斥网关',
  20192. 'Parallel Gateway': '并行网关',
  20193. 'Inclusive Gateway': '相容网关',
  20194. 'Complex Gateway': '复杂网关',
  20195. 'Event based Gateway': '事件网关',
  20196. 'Transaction': '转运',
  20197. 'Sub Process': '子流程',
  20198. 'Event Sub Process': '事件子流程',
  20199. 'Collapsed Pool': '折叠池',
  20200. 'Expanded Pool': '展开池',
  20201. // Errors
  20202. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  20203. 'no shape type specified': '没有指定的形状类型',
  20204. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  20205. 'out of bounds release': 'out of bounds release',
  20206. 'more than {count} child lanes': '子道大于{count} ',
  20207. 'element required': '元素不能为空',
  20208. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  20209. 'no diagram to display': '没有可展示的流程图',
  20210. 'no process or collaboration to display': '没有可展示的流程/协作',
  20211. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  20212. 'already rendered {element}': '{element} 已被渲染',
  20213. 'failed to import {element}': '导入{element}失败',
  20214. // 属性面板的参数
  20215. 'Id': '编号',
  20216. 'Name': '名称',
  20217. 'General': '常规',
  20218. 'Details': '详情',
  20219. 'Message Name': '消息名称',
  20220. 'Message': '消息',
  20221. 'Initiator': '创建者',
  20222. 'Asynchronous Continuations': '持续异步',
  20223. 'Asynchronous Before': '异步前',
  20224. 'Asynchronous After': '异步后',
  20225. 'Job Configuration': '工作配置',
  20226. 'Exclusive': '排除',
  20227. 'Job Priority': '工作优先级',
  20228. 'Retry Time Cycle': '重试时间周期',
  20229. 'Documentation': '文档',
  20230. 'Element Documentation': '元素文档',
  20231. 'History Configuration': '历史配置',
  20232. 'History Time To Live': '历史的生存时间',
  20233. 'Forms': '表单',
  20234. 'Form Key': '表单key',
  20235. 'Form Fields': '表单字段',
  20236. 'Business Key': '业务key',
  20237. 'Form Field': '表单字段',
  20238. 'ID': '编号',
  20239. 'Type': '类型',
  20240. 'Label': '名称',
  20241. 'Default Value': '默认值',
  20242. 'Validation': '校验',
  20243. 'Add Constraint': '添加约束',
  20244. 'Config': '配置',
  20245. 'Properties': '属性',
  20246. 'Add Property': '添加属性',
  20247. 'Value': '值',
  20248. 'Add': '添加',
  20249. 'Values': '值',
  20250. 'Add Value': '添加值',
  20251. 'Listeners': '监听器',
  20252. 'Execution Listener': '执行监听',
  20253. 'Event Type': '事件类型',
  20254. 'Listener Type': '监听器类型',
  20255. 'Java Class': 'Java类',
  20256. 'Expression': '表达式',
  20257. 'Must provide a value': '必须提供一个值',
  20258. 'Delegate Expression': '代理表达式',
  20259. 'Script': '脚本',
  20260. 'Script Format': '脚本格式',
  20261. 'Script Type': '脚本类型',
  20262. 'Inline Script': '内联脚本',
  20263. 'External Script': '外部脚本',
  20264. 'Resource': '资源',
  20265. 'Field Injection': '字段注入',
  20266. 'Extensions': '扩展',
  20267. 'Input/Output': '输入/输出',
  20268. 'Input Parameters': '输入参数',
  20269. 'Output Parameters': '输出参数',
  20270. 'Parameters': '参数',
  20271. 'Output Parameter': '输出参数',
  20272. 'Timer Definition Type': '定时器定义类型',
  20273. 'Timer Definition': '定时器定义',
  20274. 'Date': '日期',
  20275. 'Duration': '持续',
  20276. 'Cycle': '循环',
  20277. 'Signal': '信号',
  20278. 'Signal Name': '信号名称',
  20279. 'Escalation': '升级',
  20280. 'Error': '错误',
  20281. 'Link Name': '链接名称',
  20282. 'Condition': '条件名称',
  20283. 'Variable Name': '变量名称',
  20284. 'Variable Event': '变量事件',
  20285. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  20286. 'Wait for Completion': '等待完成',
  20287. 'Activity Ref': '活动参考',
  20288. 'Version Tag': '版本标签',
  20289. 'Executable': '可执行文件',
  20290. 'External Task Configuration': '扩展任务配置',
  20291. 'Task Priority': '任务优先级',
  20292. 'External': '外部',
  20293. 'Connector': '连接器',
  20294. 'Must configure Connector': '必须配置连接器',
  20295. 'Connector Id': '连接器编号',
  20296. 'Implementation': '实现方式',
  20297. 'Field Injections': '字段注入',
  20298. 'Fields': '字段',
  20299. 'Result Variable': '结果变量',
  20300. 'Topic': '主题',
  20301. 'Configure Connector': '配置连接器',
  20302. 'Input Parameter': '输入参数',
  20303. 'Assignee': '代理人',
  20304. 'Candidate Users': '候选用户',
  20305. 'Candidate Groups': '候选组',
  20306. 'Due Date': '到期时间',
  20307. 'Follow Up Date': '跟踪日期',
  20308. 'Priority': '优先级',
  20309. // eslint-disable-next-line no-template-curly-in-string
  20310. 'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
  20311. // eslint-disable-next-line no-template-curly-in-string
  20312. 'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
  20313. 'Variables': '变量',
  20314. 'Candidate Starter Configuration': '候选开始配置',
  20315. 'Task Listener': '任务监听器',
  20316. 'Candidate Starter Groups': '候选开始组',
  20317. 'Candidate Starter Users': '候选开始用户',
  20318. 'Tasklist Configuration': '任务列表配置',
  20319. 'Startable': '启动',
  20320. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  20321. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  20322. 'This maps to the process definition key.': '这会映射为流程定义的键',
  20323. 'CallActivity Type': '调用活动类型',
  20324. 'Condition Type': '条件类型',
  20325. 'Create UserTask': '创建用户任务',
  20326. 'Create CallActivity': '创建调用活动',
  20327. 'Called Element': '调用元素',
  20328. 'Create DataObjectReference': '创建数据对象引用',
  20329. 'Create DataStoreReference': '创建数据存储引用',
  20330. 'Multi Instance': '多实例',
  20331. 'Loop Cardinality': '实例数量',
  20332. Collection: '任务参与人列表',
  20333. 'Element Variable': '元素变量',
  20334. 'Completion Condition': '完成条件'
  20335. };
  20336. //# sourceMappingURL=translations.js.map
  20337. function customTranslate(template, replacements) {
  20338. replacements = replacements || {};
  20339. // Translate
  20340. template = translations[template] || template;
  20341. // Replace
  20342. return template.replace(/{([^}]+)}/g, function (_, key) {
  20343. return replacements[key] || '{' + key + '}';
  20344. });
  20345. }
  20346. //# sourceMappingURL=customTranslate.js.map
  20347. var vjson$l = {
  20348. title: '导入流程',
  20349. layout: 'fit',
  20350. width: 400,
  20351. height: 400,
  20352. items: [
  20353. {
  20354. layout: 'border',
  20355. items: [
  20356. {
  20357. xtype: 'form',
  20358. items: [
  20359. // {
  20360. // xtype: 'cols',
  20361. // items: [
  20362. // {
  20363. // xtype: 'textfield',
  20364. // allowBlank: false,
  20365. // fieldLabel: '流程名称',
  20366. // bind: '{name}'
  20367. // },
  20368. // ],
  20369. // },
  20370. {
  20371. xtype: 'cols',
  20372. items: [
  20373. {
  20374. xtype: 'filefield',
  20375. name: 'deployFile',
  20376. fieldLabel: '文件名称',
  20377. // labelWidth: '100%',
  20378. msgTarget: 'side',
  20379. reference: 'MOBANB_FILE',
  20380. fileUpload: true,
  20381. allowBlank: false,
  20382. // flex: 1,
  20383. // width: '100%',
  20384. buttonText: '请选择文件位置',
  20385. listeners: {
  20386. change: 'scope.fileChange'
  20387. }
  20388. // bind: '{FILE}'
  20389. },
  20390. ]
  20391. }
  20392. ],
  20393. region: 'center',
  20394. split: true,
  20395. },
  20396. ],
  20397. },
  20398. ],
  20399. fbar: {
  20400. xtype: 'toolbar',
  20401. items: [
  20402. {
  20403. xtype: 'button',
  20404. text: '保存',
  20405. iconCls: 'x-fa fa-save',
  20406. listeners: {
  20407. click: 'scope.save',
  20408. },
  20409. }
  20410. ],
  20411. },
  20412. };
  20413. //# sourceMappingURL=ImportBpmn.view.js.map
  20414. var model$l = {
  20415. data: {
  20416. name: '',
  20417. file_content: ''
  20418. }
  20419. };
  20420. //# sourceMappingURL=ImportBpmn.model.js.map
  20421. var ImportBpmn = /** @class */ (function (_super) {
  20422. __extends(ImportBpmn, _super);
  20423. function ImportBpmn() {
  20424. return _super.call(this, { model: model$l, vjson: vjson$l }) || this;
  20425. }
  20426. ImportBpmn.prototype.onLoad = function () {
  20427. };
  20428. ImportBpmn.prototype.save = function (sender) {
  20429. if (this.data.file_content) {
  20430. this.dialogSuccess(this.data);
  20431. }
  20432. else {
  20433. Ext.Msg.alert('提示', "请先上传文件");
  20434. }
  20435. };
  20436. ImportBpmn.prototype.fileChange = function (e) {
  20437. var _this = this;
  20438. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  20439. var file = e.fileInputEl.dom.files[0]; //获取文件
  20440. var reader = new FileReader();
  20441. reader.readAsText(file, "UTF-8");
  20442. reader.onload = function () {
  20443. _this.data.file_content = reader.result;
  20444. };
  20445. };
  20446. return ImportBpmn;
  20447. }(Scope));
  20448. //# sourceMappingURL=ImportBpmn.js.map
  20449. var model$m = {
  20450. data: {
  20451. form_id: '',
  20452. form_name: '',
  20453. save_dir_path: '',
  20454. absolute_path: '',
  20455. form: {
  20456. id: '',
  20457. code: '',
  20458. name: '',
  20459. table: '',
  20460. controller: '',
  20461. groovy: '',
  20462. fields: [],
  20463. buttons: [],
  20464. },
  20465. }
  20466. };
  20467. //# sourceMappingURL=ConfigStrategy.model.js.map
  20468. var vjson$m = {
  20469. title: '配置适配策略',
  20470. layout: 'fit',
  20471. items: [
  20472. {
  20473. layout: 'border',
  20474. items: [
  20475. {
  20476. region: 'center',
  20477. xtype: 'yvgrid',
  20478. pagination: false,
  20479. hideFootbar: true,
  20480. plugins: {
  20481. clipboard: true,
  20482. selectionreplicator: true
  20483. },
  20484. tbar: {
  20485. xtype: 'toolbar',
  20486. items: [
  20487. {
  20488. xtype: 'button',
  20489. text: '添加策略',
  20490. iconCls: 'x-fa fa-plus-circle',
  20491. listeners: {
  20492. click: 'scope.addStrategy'
  20493. }
  20494. },
  20495. {
  20496. xtype: 'button',
  20497. text: '删除',
  20498. iconCls: 'x-fa fa-minus-circle',
  20499. listeners: {}
  20500. },
  20501. '-',
  20502. {
  20503. xtype: 'button',
  20504. text: '上移',
  20505. iconCls: 'x-fa fa-arrow-up',
  20506. listeners: {}
  20507. },
  20508. {
  20509. xtype: 'button',
  20510. text: '下移',
  20511. iconCls: 'x-fa fa-arrow-down',
  20512. listeners: {}
  20513. },
  20514. ]
  20515. },
  20516. columns: [
  20517. { xtype: 'rownumberer' },
  20518. {
  20519. header: '优先级',
  20520. dataIndex: 'priority',
  20521. width: 140,
  20522. sortable: false,
  20523. menuDisabled: true,
  20524. editor: {
  20525. selectOnFocus: true
  20526. },
  20527. },
  20528. {
  20529. header: '策略编号',
  20530. dataIndex: 'strategy_code',
  20531. width: 140,
  20532. sortable: false,
  20533. menuDisabled: true,
  20534. editor: {
  20535. selectOnFocus: true
  20536. },
  20537. },
  20538. {
  20539. header: '策略名称',
  20540. dataIndex: 'strategy_name',
  20541. width: 140,
  20542. sortable: false,
  20543. menuDisabled: true,
  20544. editor: {
  20545. selectOnFocus: true
  20546. },
  20547. },
  20548. {
  20549. header: "条件表达式",
  20550. dataIndex: "strategy_exp",
  20551. },
  20552. ],
  20553. },
  20554. {
  20555. title: '适配条件',
  20556. region: 'south',
  20557. height: '50%',
  20558. xtype: 'form',
  20559. items: [
  20560. {
  20561. xtype: 'cols',
  20562. items: [
  20563. {
  20564. xtype: 'rows',
  20565. items: [
  20566. {
  20567. xtype: 'textfield',
  20568. fieldLabel: "仓库",
  20569. },
  20570. {
  20571. xtype: 'textfield',
  20572. fieldLabel: "货主",
  20573. },
  20574. {
  20575. xtype: 'textfield',
  20576. fieldLabel: "项目",
  20577. },
  20578. {
  20579. xtype: 'textfield',
  20580. fieldLabel: "行政区划",
  20581. },
  20582. {
  20583. xtype: 'textfield',
  20584. fieldLabel: "客户",
  20585. },
  20586. {
  20587. xtype: 'textfield',
  20588. fieldLabel: "商品",
  20589. }
  20590. ]
  20591. },
  20592. {
  20593. xtype: 'rows',
  20594. margin: '8 0 0 10',
  20595. items: [
  20596. {
  20597. xtype: 'label',
  20598. html: '自定义表达式',
  20599. },
  20600. {
  20601. xtype: 'textarea',
  20602. }
  20603. ]
  20604. }
  20605. ]
  20606. }
  20607. ]
  20608. }
  20609. ]
  20610. }
  20611. ]
  20612. };
  20613. //
  20614. //# sourceMappingURL=ConfigStrategy.view.js.map
  20615. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  20616. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  20617. // import ReportRunner from "./ReportRunner";
  20618. var ConfigStrategy = /** @class */ (function (_super) {
  20619. __extends(ConfigStrategy, _super);
  20620. function ConfigStrategy() {
  20621. return _super.call(this, { model: model$m, vjson: vjson$m }) || this;
  20622. }
  20623. ConfigStrategy.prototype.onLoad = function () {
  20624. this.load();
  20625. };
  20626. ConfigStrategy.prototype.load = function () {
  20627. var _this = this;
  20628. var form_id = this.viewModel.get("form_id");
  20629. var absolute_path = this.viewModel.get("absolute_path");
  20630. var save_dir_path = this.viewModel.get("save_dir_path");
  20631. if (absolute_path && form_id) {
  20632. this.setLoading(true);
  20633. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  20634. if (res.success) {
  20635. // 基础属性
  20636. _this.viewModel.set('form', res.data.form);
  20637. // 字段定义
  20638. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  20639. // 按钮
  20640. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  20641. }
  20642. }).finally(function () {
  20643. _this.setLoading(false);
  20644. });
  20645. }
  20646. };
  20647. ConfigStrategy.prototype.saveAll = function () {
  20648. var _this = this;
  20649. var save_dir_path = this.viewModel.get("save_dir_path");
  20650. if (!save_dir_path) {
  20651. msg("save_dir_path error");
  20652. return;
  20653. }
  20654. var form_id = this.viewModel.get("form_id");
  20655. var absolute_path = this.viewModel.get("absolute_path");
  20656. // 表格校验
  20657. if (!this.refs.form1.isValid()) {
  20658. msg("请检查表单必填项!");
  20659. return;
  20660. }
  20661. // 字段数据
  20662. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  20663. delete item.id;
  20664. if (item.hide) {
  20665. delete item.hide_text;
  20666. }
  20667. else {
  20668. item.hide = item.hide_text;
  20669. delete item.hide_text;
  20670. }
  20671. if (item.readonly) {
  20672. delete item.readonly_text;
  20673. }
  20674. else {
  20675. item.readonly = item.readonly_text;
  20676. delete item.readonly_text;
  20677. }
  20678. if (item.disabled) {
  20679. delete item.disabled_text;
  20680. }
  20681. else {
  20682. item.disabled = item.disabled_text;
  20683. delete item.disabled_text;
  20684. }
  20685. if (item.required) {
  20686. delete item.required_text;
  20687. }
  20688. else {
  20689. item.required = item.required_text;
  20690. delete item.required_text;
  20691. }
  20692. return item;
  20693. });
  20694. this.viewModel.set("form.fields", gridColumnRows);
  20695. // 按钮数据
  20696. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  20697. delete item.id;
  20698. return item;
  20699. });
  20700. this.viewModel.set("form.buttons", gridBtnRows);
  20701. // 查询条件
  20702. // 策略
  20703. var form = this.viewModel.get("form");
  20704. this.setLoading(true);
  20705. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  20706. if (res.success) {
  20707. msg('保存成功');
  20708. handles$1.mainWindow.refs['exporerTree'].reload();
  20709. }
  20710. }).finally(function () {
  20711. _this.setLoading(false);
  20712. });
  20713. };
  20714. ConfigStrategy.prototype.addColumn = function () {
  20715. this.refs.gridColumn.getStore().add({});
  20716. };
  20717. ConfigStrategy.prototype.removeColumn = function () {
  20718. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  20719. };
  20720. ConfigStrategy.prototype.calcColumn = function (sender) {
  20721. var _this = this;
  20722. var table = this.viewModel.get("form.table");
  20723. if (!table) {
  20724. msg("表名不存在!");
  20725. return;
  20726. }
  20727. this.setLoading(true);
  20728. calcColumnForm({ table: table }).then(function (res) {
  20729. if (res.success) {
  20730. msg(res.msg);
  20731. if (res.data.columns.length > 0) {
  20732. _$2.forEach(res.data.columns, function (it) {
  20733. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  20734. });
  20735. }
  20736. }
  20737. }).finally(function () {
  20738. _this.setLoading(false);
  20739. });
  20740. };
  20741. ConfigStrategy.prototype.addButton = function () {
  20742. this.refs.gridButton.getStore().add({});
  20743. };
  20744. ConfigStrategy.prototype.moveUp = function (sender) {
  20745. var grid = sender.up('grid');
  20746. grid.rowMoveUp();
  20747. };
  20748. ConfigStrategy.prototype.moveDown = function (sender) {
  20749. var grid = sender.up('grid');
  20750. grid.rowMoveDown();
  20751. };
  20752. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  20753. var win = new Ext.Window({
  20754. autoDestroy: true,
  20755. title: "添加(编辑)策略",
  20756. width: 400,
  20757. height: 300,
  20758. resizable: true,
  20759. closable: true,
  20760. maximizable: true,
  20761. minimizable: true,
  20762. plain: true,
  20763. // constrainHeader: true,
  20764. constrain: true,
  20765. layout: 'fit',
  20766. animateTarget: sender,
  20767. buttonAlign: 'center',
  20768. items: [
  20769. {
  20770. xtype: "form",
  20771. layout: "hbox",
  20772. margin: '10px 20px',
  20773. border: 0,
  20774. items: [
  20775. {
  20776. flex: 1,
  20777. layout: 'vbox',
  20778. items: [
  20779. {
  20780. xtype: "numberfield",
  20781. fieldLabel: "优先级",
  20782. flex: 1,
  20783. allowBlank: false,
  20784. labelWidth: 50,
  20785. width: "100%",
  20786. },
  20787. {
  20788. xtype: "textfield",
  20789. fieldLabel: "策略名称",
  20790. flex: 1,
  20791. allowBlank: false,
  20792. labelWidth: 50,
  20793. width: "100%",
  20794. },
  20795. {
  20796. xtype: "textfield",
  20797. fieldLabel: "策略编号",
  20798. flex: 1,
  20799. allowBlank: false,
  20800. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20801. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20802. labelWidth: 50,
  20803. width: "100%",
  20804. },
  20805. {
  20806. xtype: "textfield",
  20807. fieldLabel: "仓库ID",
  20808. flex: 1,
  20809. allowBlank: false,
  20810. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20811. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20812. labelWidth: 50,
  20813. width: "100%",
  20814. },
  20815. ]
  20816. },
  20817. ]
  20818. }
  20819. ],
  20820. //窗口按钮
  20821. buttons: [
  20822. {
  20823. xtype: 'button', text: '保存', handler: function (btn) {
  20824. //窗口获取表单
  20825. var form = win.down('form');
  20826. var vaildSuccess = form.isValid();
  20827. if (!vaildSuccess) {
  20828. return;
  20829. }
  20830. var filename = form.down('textfield[name="filename"]').getValue();
  20831. }
  20832. },
  20833. {
  20834. xtype: 'button', text: '取消', handler: function (btn) {
  20835. //窗口关闭
  20836. win.close();
  20837. }
  20838. }
  20839. ]
  20840. });
  20841. win.show();
  20842. };
  20843. return ConfigStrategy;
  20844. }(Scope));
  20845. //# sourceMappingURL=ConfigStrategy.js.map
  20846. var buildVjson = function () {
  20847. return {
  20848. bind: {
  20849. title: '流程编辑-{text}',
  20850. },
  20851. layout: 'fit',
  20852. items: [{
  20853. layout: 'border',
  20854. tbar: {
  20855. xtype: 'toolbar',
  20856. items: [
  20857. {
  20858. xtype: 'button',
  20859. text: '撤销',
  20860. listeners: {
  20861. click: "scope.undo"
  20862. }
  20863. },
  20864. {
  20865. xtype: 'button',
  20866. text: '还原',
  20867. listeners: {
  20868. click: "scope.redo"
  20869. }
  20870. },
  20871. {
  20872. xtype: 'button',
  20873. text: '保存',
  20874. listeners: {
  20875. click: "scope.save"
  20876. }
  20877. },
  20878. {
  20879. xtype: 'button',
  20880. text: '导入BPM',
  20881. listeners: {
  20882. click: "scope.importBpm"
  20883. }
  20884. },
  20885. {
  20886. xtype: 'button',
  20887. text: '配置适配策略',
  20888. listeners: {
  20889. click: "scope.configStrategy"
  20890. }
  20891. },
  20892. {
  20893. fieldLabel: '选择配置分支',
  20894. xtype: 'combogrid',
  20895. },
  20896. ]
  20897. },
  20898. items: [
  20899. {
  20900. xtype: "panel",
  20901. region: 'center',
  20902. reference: "bpmn_view",
  20903. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  20904. },
  20905. {
  20906. split: true,
  20907. xtype: "panel",
  20908. region: 'east',
  20909. width: '30%',
  20910. reference: "bpmn_properties",
  20911. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  20912. }
  20913. ],
  20914. }],
  20915. listeners: {
  20916. afterrender: 'scope.onViewRender'
  20917. }
  20918. };
  20919. };
  20920. var BpmnDesign = /** @class */ (function (_super) {
  20921. __extends(BpmnDesign, _super);
  20922. function BpmnDesign() {
  20923. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  20924. _this.bpmnModeler = null;
  20925. _this.bpmnModelerName = "";
  20926. return _this;
  20927. }
  20928. BpmnDesign.prototype.onLoad = function () {
  20929. var _this = this;
  20930. _super.prototype.onLoad.call(this);
  20931. this.setLoading(true);
  20932. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  20933. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  20934. if (res && res.success && res.data && res.data.bpmn) {
  20935. var diagramXML = res.data.bpmn;
  20936. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  20937. var elements = _this.bpmnModeler._definitions.rootElements;
  20938. if (Array.isArray(elements) && elements.length > 0) {
  20939. elements[0].name = _this.bpmnModelerName;
  20940. }
  20941. }).catch(function (err) {
  20942. msgError(err);
  20943. });
  20944. }
  20945. else {
  20946. msgError(res.msg);
  20947. }
  20948. }).finally(function () {
  20949. _this.setLoading(false);
  20950. });
  20951. };
  20952. BpmnDesign.prototype.onViewRender = function (sender) {
  20953. var customTranslateModule = {
  20954. translate: ['value', customTranslate]
  20955. };
  20956. this.bpmnModeler = new BpmnModeler({
  20957. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  20958. propertiesPanel: {
  20959. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  20960. },
  20961. additionalModules: [
  20962. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  20963. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  20964. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  20965. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  20966. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  20967. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  20968. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  20969. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  20970. customTranslateModule,
  20971. ],
  20972. moddleExtensions: {
  20973. camunda: camundaModdleDescriptor
  20974. },
  20975. keyboard: { bindTo: document } // 使用键盘快捷键
  20976. });
  20977. };
  20978. //开启快捷键
  20979. //modeler.get('keyboard').bind(document);
  20980. //关闭快捷键
  20981. //modeler.get('keyboard').unbind();
  20982. BpmnDesign.prototype.undo = function (sender) {
  20983. this.bpmnModeler.get('commandStack').undo();
  20984. };
  20985. BpmnDesign.prototype.redo = function (sender) {
  20986. this.bpmnModeler.get('commandStack').redo();
  20987. };
  20988. BpmnDesign.prototype.save = function (sender) {
  20989. var _this = this;
  20990. this.setLoading(true);
  20991. this.bpmnModeler.saveXML().then(function (resBpm) {
  20992. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  20993. if (res.success) {
  20994. msg$1("保存成功");
  20995. }
  20996. else {
  20997. msgError(res.msg);
  20998. }
  20999. }).catch(function (e) {
  21000. var _a, _b;
  21001. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  21002. msgError(msg);
  21003. }).finally(function () {
  21004. _this.setLoading(false);
  21005. });
  21006. }).catch(function (e) {
  21007. msgError(e);
  21008. _this.setLoading(false);
  21009. });
  21010. };
  21011. BpmnDesign.prototype.importBpm = function (sender) {
  21012. var _this = this;
  21013. var dlg = new ImportBpmn();
  21014. //@ts-ignore
  21015. dlg.success = function (sen, data) {
  21016. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  21017. var elements = _this.bpmnModeler._definitions.rootElements;
  21018. if (Array.isArray(elements) && elements.length > 0) {
  21019. elements[0].name = _this.bpmnModelerName;
  21020. }
  21021. }).catch(function (err) {
  21022. msgError(err);
  21023. });
  21024. };
  21025. dlg.showDialog(sender, {}, {});
  21026. // this.bpmnModeler.importXML()
  21027. };
  21028. BpmnDesign.prototype.configStrategy = function (sender) {
  21029. var configStrategy = new ConfigStrategy();
  21030. configStrategy.showDialog(sender, {}, {});
  21031. };
  21032. return BpmnDesign;
  21033. }(Scope));
  21034. //# sourceMappingURL=BpmnDesign.js.map
  21035. var model$n = {
  21036. data: {
  21037. id: '',
  21038. path: '',
  21039. form: {
  21040. title: '',
  21041. sqlId: '',
  21042. }
  21043. }
  21044. };
  21045. //# sourceMappingURL=WhLayoutDesign.model.js.map
  21046. var vjson$n = {
  21047. bind: {
  21048. title: '{title}',
  21049. },
  21050. layout: 'fit',
  21051. items: [
  21052. {
  21053. layout: 'border',
  21054. items: [
  21055. {
  21056. region: 'center',
  21057. reference: 'editor',
  21058. border: true,
  21059. // html: '<div class="geEditor"></div>',
  21060. // listeners: {
  21061. // afterrender: 'scope.editorInit'
  21062. // }
  21063. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  21064. listeners: {
  21065. afterrender: 'scope.iframeRender'
  21066. }
  21067. },
  21068. ]
  21069. }
  21070. ]
  21071. }; //
  21072. //
  21073. //# sourceMappingURL=WhLayoutDesign.view.js.map
  21074. var WidgetDesign$1 = /** @class */ (function (_super) {
  21075. __extends(WidgetDesign, _super);
  21076. function WidgetDesign(layoutCode, layoutName) {
  21077. var _this = _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  21078. _this.layoutCode = layoutCode;
  21079. _this.layoutName = layoutName;
  21080. return _this;
  21081. }
  21082. WidgetDesign.prototype.onLoad = function () {
  21083. this.viewModel.set('layoutCode', this.layoutCode);
  21084. this.viewModel.set('layoutName', this.layoutName);
  21085. if (this.layoutCode) {
  21086. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  21087. }
  21088. else {
  21089. this.viewModel.set('title', '新建图纸');
  21090. }
  21091. };
  21092. WidgetDesign.prototype.reload = function () {
  21093. var _this = this;
  21094. this.setLoading(true);
  21095. loadWhLayout({
  21096. layoutCode: this.layoutCode,
  21097. layoutName: this.layoutName,
  21098. }).then(function (res) {
  21099. if (res.success) {
  21100. var xml = res.data.layoutContent;
  21101. var doc = _this.mxUtils.parseXml(xml);
  21102. var graph = _this.editorUi.editor.graph;
  21103. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  21104. }
  21105. }).finally(function () {
  21106. _this.setLoading(false);
  21107. });
  21108. };
  21109. WidgetDesign.prototype.editorInit = function (sender) {
  21110. var that = this;
  21111. var dom = $(sender.el.dom).find('.geEditor')[0];
  21112. //@ts-ignore
  21113. require(['mxgraph'], function () {
  21114. var editorUiInit = EditorUi.prototype.init;
  21115. EditorUi.prototype.init = function () {
  21116. editorUiInit.apply(this, arguments);
  21117. this.actions.get('save').funct = that.onFileSave.bind(that);
  21118. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21119. this.actions.get('open').visible = false;
  21120. this.actions.get('new').visible = false;
  21121. this.actions.get('preview').visible = false;
  21122. this.actions.get('print').visible = false;
  21123. this.actions.get('pageSetup').visible = false;
  21124. this.actions.get('help').visible = false;
  21125. this.actions.get('export').visible = false;
  21126. this.actions.get('about').visible = false;
  21127. this.menus.menus.help.setEnabled(false);
  21128. that.editorUi = this;
  21129. if (that.layoutCode) {
  21130. that.reload();
  21131. }
  21132. };
  21133. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  21134. var mxLanguage = 'zh';
  21135. mxResources.loadDefaultBundle = false;
  21136. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  21137. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  21138. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  21139. // Fixes possible asynchronous requests
  21140. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  21141. // Adds bundle text to resources
  21142. mxResources.parse(xhr[0].getText());
  21143. // Configures the default graph theme
  21144. var themes = new Object();
  21145. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  21146. // Main
  21147. new EditorUi(new Editor(false, themes), dom);
  21148. }, function () {
  21149. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  21150. });
  21151. });
  21152. };
  21153. WidgetDesign.prototype.iframeRender = function (sender) {
  21154. var that = this;
  21155. var iframe = $(sender.el.dom).find('iframe')[0];
  21156. iframe.contentWindow['designer'] = that;
  21157. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  21158. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  21159. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21160. editorUi.actions.get('open').visible = false;
  21161. editorUi.actions.get('new').visible = false;
  21162. editorUi.actions.get('preview').visible = false;
  21163. editorUi.actions.get('print').visible = false;
  21164. editorUi.actions.get('pageSetup').visible = false;
  21165. editorUi.actions.get('help').visible = false;
  21166. editorUi.actions.get('export').visible = false;
  21167. editorUi.actions.get('about').visible = false;
  21168. editorUi.menus.menus.help.setEnabled(false);
  21169. that.editorUi = editorUi;
  21170. that.mxUtils = iframe.contentWindow['mxUtils'];
  21171. if (that.layoutCode) {
  21172. that.reload();
  21173. }
  21174. };
  21175. };
  21176. WidgetDesign.prototype.onDestroy = function () {
  21177. var _a;
  21178. try {
  21179. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  21180. }
  21181. catch (e) {
  21182. }
  21183. };
  21184. WidgetDesign.prototype.onFileSaveAs = function () {
  21185. var _this = this;
  21186. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  21187. .then(function (_a) {
  21188. var code = _a.code, name = _a.name;
  21189. _this.layoutCode = code;
  21190. _this.layoutName = name;
  21191. _this.onSave();
  21192. });
  21193. };
  21194. WidgetDesign.prototype.onSave = function () {
  21195. var _this = this;
  21196. var layoutContent = this.editorUi.getEditBlankXml();
  21197. var layoutCode = this.layoutCode;
  21198. var layoutName = this.layoutName;
  21199. if (!layoutCode || !layoutName) {
  21200. msg$1('图形编号和图形名称必填');
  21201. return;
  21202. }
  21203. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  21204. this.setLoading(true);
  21205. saveWhLayout({
  21206. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  21207. }).then(function (res) {
  21208. msg$1(res.msg);
  21209. handles$1.whLayout.reload();
  21210. }).finally(function () {
  21211. _this.setLoading(false);
  21212. });
  21213. };
  21214. WidgetDesign.prototype.onFileSave = function () {
  21215. if (!this.layoutCode || !this.layoutName) {
  21216. this.onFileSaveAs();
  21217. }
  21218. else {
  21219. this.onSave();
  21220. }
  21221. };
  21222. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  21223. var code = _a.code, name = _a.name;
  21224. return new Promise(function (resolve, reject) {
  21225. var viewModel = new Ext.app.ViewModel({
  21226. data: {
  21227. code: code !== null && code !== void 0 ? code : '',
  21228. name: name !== null && name !== void 0 ? name : '',
  21229. }
  21230. });
  21231. var dlg = Ext.create('Ext.window.Window', {
  21232. title: '保存',
  21233. viewModel: viewModel,
  21234. layout: {
  21235. type: "vbox",
  21236. pack: "start",
  21237. align: "stretch"
  21238. },
  21239. items: [
  21240. {
  21241. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  21242. bind: '{code}'
  21243. },
  21244. {
  21245. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  21246. bind: '{name}'
  21247. }
  21248. ],
  21249. fbar: [
  21250. {
  21251. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  21252. click: function () {
  21253. var code = viewModel.get('code');
  21254. var name = viewModel.get('name');
  21255. resolve({ code: code, name: name });
  21256. dlg.close();
  21257. }
  21258. }
  21259. },
  21260. {
  21261. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  21262. click: function () {
  21263. dlg.close();
  21264. }
  21265. }
  21266. },
  21267. ]
  21268. });
  21269. dlg.show();
  21270. });
  21271. };
  21272. return WidgetDesign;
  21273. }(Scope));
  21274. //# sourceMappingURL=WhLayoutDesign.js.map
  21275. // init()
  21276. var Workbench = /** @class */ (function (_super) {
  21277. __extends(Workbench, _super);
  21278. // activeModulePage: ModulePage = null
  21279. function Workbench() {
  21280. var _this = _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  21281. _this.name = "MainWindow";
  21282. _this.modules = [];
  21283. _this.yvgridDesign = null;
  21284. return _this;
  21285. }
  21286. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  21287. if (newCard) {
  21288. this.viewModel.set('leftTabTitle', newCard.tooltip);
  21289. }
  21290. else {
  21291. this.viewModel.set('leftTabTitle', '未选中');
  21292. }
  21293. };
  21294. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  21295. get: function () {
  21296. var _a;
  21297. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  21298. },
  21299. enumerable: true,
  21300. configurable: true
  21301. });
  21302. Workbench.prototype.documentKeydown = function (event) {
  21303. if (event.ctrlKey || event.metaKey) {
  21304. if (event.key.toLowerCase() === 's') {
  21305. eventBus.publish(EventType.SaveCall, {});
  21306. event.stopPropagation();
  21307. event.preventDefault();
  21308. }
  21309. else if (event.key.toLowerCase() === 'z') {
  21310. if (event.shiftKey) {
  21311. eventBus.publish(EventType.Redo, {});
  21312. event.stopPropagation();
  21313. event.preventDefault();
  21314. }
  21315. else {
  21316. eventBus.publish(EventType.Undo, {});
  21317. event.stopPropagation();
  21318. event.preventDefault();
  21319. }
  21320. }
  21321. }
  21322. };
  21323. Workbench.prototype.onLoad = function () {
  21324. var _this = this;
  21325. window["tt"] = this.refs['tt'];
  21326. window["vm"] = this.viewModel;
  21327. $('#loading').remove();
  21328. setMainWindow(this);
  21329. setStatusbar(this.down('statusbar'));
  21330. document.addEventListener('keydown', this.documentKeydown.bind(this));
  21331. var currentProject = getCurrentProject();
  21332. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  21333. // handles.fileTree.reload()
  21334. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  21335. _this.showModule(rawData);
  21336. });
  21337. eventBus.subscribe(EventType.Undo, function () {
  21338. _this.onUndo();
  21339. });
  21340. eventBus.subscribe(EventType.Redo, function () {
  21341. _this.onRedo();
  21342. });
  21343. eventBus.subscribe(EventType.Cut, function (_a) {
  21344. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21345. _this.onCut(a, b, c, d);
  21346. });
  21347. eventBus.subscribe(EventType.Copy, function (_a) {
  21348. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21349. _this.onCopy(a, b, c, d);
  21350. });
  21351. eventBus.subscribe(EventType.Paste, function (_a) {
  21352. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21353. _this.onPaste(a, b, c, d);
  21354. });
  21355. eventBus.subscribe(EventType.SelectAll, function () {
  21356. _this.onSelectAll();
  21357. });
  21358. eventBus.subscribe(EventType.SelectAll, function () {
  21359. _this.onSelectAll();
  21360. });
  21361. eventBus.subscribe(EventType.RunCheckModule, function () {
  21362. _this.runCheckModule();
  21363. });
  21364. eventBus.subscribe(EventType.StopCheckModule, function () {
  21365. _this.stopCheckModule();
  21366. });
  21367. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  21368. _this.onCompoentContextMenu(args);
  21369. });
  21370. this.runCheckModule();
  21371. };
  21372. Workbench.prototype.onCompoentContextMenu = function (args) {
  21373. var _this = this;
  21374. if (!this.yvgridDesign) {
  21375. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  21376. this.yvgridDesign.showDialog(null, {}, {});
  21377. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  21378. this.yvgridDesign.onDestroy = function () {
  21379. fn_1();
  21380. _this.yvgridDesign = null;
  21381. };
  21382. }
  21383. };
  21384. Workbench.prototype.runCheckModule = function () {
  21385. var _this = this;
  21386. if (this.checkTimer) {
  21387. return;
  21388. }
  21389. this.checkTimer = setInterval(function () {
  21390. var _a;
  21391. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  21392. _this.activeModulePage.check();
  21393. }
  21394. }, 5000);
  21395. };
  21396. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  21397. var dlg = new WidgetDesign(widgetPath, widgetName);
  21398. dlg.showPage({
  21399. id: 'widget_' + widgetPath,
  21400. path: 'widget_' + widgetPath,
  21401. }, {
  21402. data: {
  21403. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  21404. }
  21405. });
  21406. dlg.dialogSuccess = successCallback;
  21407. };
  21408. Workbench.prototype.stopCheckModule = function () {
  21409. clearInterval(this.checkTimer);
  21410. this.checkTimer = null;
  21411. };
  21412. Workbench.prototype.showDataSync = function () {
  21413. var ins = new DbSync();
  21414. ins.showPage({
  21415. id: 'db_sync__',
  21416. path: 'db_sync__',
  21417. }, {
  21418. data: {}
  21419. });
  21420. };
  21421. /**
  21422. * 打开一个项目
  21423. */
  21424. Workbench.prototype.openProject = function (project) {
  21425. setCurrentProject(project);
  21426. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  21427. handles$1.fileTree.reload();
  21428. };
  21429. /**
  21430. * 打开模板开发面板
  21431. */
  21432. Workbench.prototype.showTemplateDev = function () {
  21433. var ins = new TemplateDev();
  21434. ins.showPage({
  21435. id: 'template_dev__',
  21436. path: 'template_dev__',
  21437. }, {
  21438. data: {}
  21439. });
  21440. };
  21441. Workbench.prototype.openScope = function () {
  21442. };
  21443. /**
  21444. * 显示字段域管理器
  21445. */
  21446. Workbench.prototype.showColumnDomain = function () {
  21447. var instance = new DbDomain();
  21448. instance.showPage({
  21449. id: 'domain__',
  21450. path: 'domain__',
  21451. }, {
  21452. data: {}
  21453. });
  21454. };
  21455. /**
  21456. * 显示性能统计
  21457. */
  21458. Workbench.prototype.showPerform = function () {
  21459. // const instance = new PerformStats()
  21460. // instance.showPage({
  21461. // id: 'perform__',
  21462. // path: 'perform__',
  21463. //
  21464. // }, {
  21465. // data: {}
  21466. // })
  21467. };
  21468. /**
  21469. * 显示数据库代码模板库
  21470. */
  21471. Workbench.prototype.showDbCodeTemplate = function () {
  21472. // const instance = new DbCodeTemplate()
  21473. // instance.showPage({
  21474. // id: 'dbcode__',
  21475. // path: 'dbcode__',
  21476. //
  21477. // }, {
  21478. // data: {}
  21479. // })
  21480. };
  21481. /**
  21482. * 显示数据库代码模板库
  21483. */
  21484. Workbench.prototype.showReport = function (report_id, report_name, success) {
  21485. var instance = new ReportDesign();
  21486. instance.showPage({
  21487. id: 'report_' + report_id,
  21488. path: 'report_' + report_id,
  21489. }, {
  21490. data: {
  21491. report_id: report_id,
  21492. report_name: report_name,
  21493. }
  21494. });
  21495. instance.dialogSuccess = success;
  21496. };
  21497. /**
  21498. * 显示报表
  21499. */
  21500. Workbench.prototype.showReportPreview = function (report_id, instance) {
  21501. instance.showPage({
  21502. id: 'REPORT__' + report_id,
  21503. path: 'REPORT__' + report_id,
  21504. }, {
  21505. data: {
  21506. report_id: report_id,
  21507. }
  21508. });
  21509. var reportName = instance.viewModel.get('report_name');
  21510. instance.viewModel.set('report_name', '[预览]-' + reportName);
  21511. };
  21512. /**
  21513. * 显示运维页面
  21514. */
  21515. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  21516. // const instance = new DevOpsTerminal()
  21517. // instance.showPage({
  21518. // id: 'ops_' + opsId,
  21519. // path: 'ops_' + opsId,
  21520. //
  21521. // }, {
  21522. // data: {
  21523. // opsId: opsId,
  21524. // name: name,
  21525. // }
  21526. // })
  21527. // instance.dialogSuccess = success
  21528. };
  21529. /**
  21530. * 显示表结构
  21531. * tableName 为空的情况就是新建表,否则就是要编辑的表
  21532. * columnName 可以为空
  21533. */
  21534. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  21535. var id = 'tableColumn_' + tableName;
  21536. var isCreateTable = false;
  21537. // /ROOT/schema$public/schema$public$bas_location_group_rel
  21538. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  21539. if (!tableName) {
  21540. id = _$2.uniqueId('new_table');
  21541. tableName = id;
  21542. isCreateTable = true;
  21543. }
  21544. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  21545. instance.showPage({
  21546. id: id,
  21547. path: id,
  21548. locatPath: locatPath
  21549. }, {
  21550. data: {
  21551. tableName: tableName,
  21552. columnName: columnName
  21553. }
  21554. });
  21555. };
  21556. /**
  21557. * 打开某个模块
  21558. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  21559. */
  21560. Workbench.prototype.showModule = function (rawData) {
  21561. var id = rawData.id, path = rawData.path;
  21562. var separator = '/';
  21563. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  21564. var module = this.modules[idx];
  21565. var pageId = path.replaceAll('/', '_');
  21566. console.log('open module', module);
  21567. var instance = new ModulePage(id, module);
  21568. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  21569. instance.showPage({
  21570. id: 'module_' + pageId,
  21571. path: path,
  21572. title: module.name
  21573. }, {
  21574. data: {}
  21575. });
  21576. };
  21577. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  21578. var bpmnDesign = new BpmnDesign();
  21579. bpmnDesign.showPage({}, {
  21580. data: {
  21581. absolutePath: absolutePath,
  21582. id: id,
  21583. text: text
  21584. }
  21585. });
  21586. };
  21587. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  21588. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  21589. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  21590. layoutDesign.showPage({
  21591. id: id,
  21592. path: id,
  21593. }, {
  21594. data: {}
  21595. });
  21596. };
  21597. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  21598. var _a;
  21599. // this.activeModulePage = newCard.yvanScope
  21600. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  21601. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  21602. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  21603. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  21604. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  21605. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  21606. eventBus.publish(EventType.MainTabChange, {
  21607. moduleId: newCard.yvanScope.moduleId,
  21608. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  21609. from: this.name
  21610. });
  21611. };
  21612. Workbench.prototype.onUndo = function () {
  21613. var _a;
  21614. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  21615. };
  21616. Workbench.prototype.onRedo = function () {
  21617. var _a;
  21618. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  21619. };
  21620. Workbench.prototype.onCut = function (a, b, c, d) {
  21621. var _a;
  21622. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  21623. };
  21624. Workbench.prototype.onCopy = function (a, b, c, d) {
  21625. var _a;
  21626. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  21627. };
  21628. Workbench.prototype.onPaste = function (a, b, c, d) {
  21629. var _a;
  21630. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  21631. };
  21632. Workbench.prototype.onSelectAll = function () {
  21633. var _a;
  21634. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  21635. };
  21636. return Workbench;
  21637. }(Scope));
  21638. //# sourceMappingURL=Workbench.js.map
  21639. (function (FuncDomain) {
  21640. FuncDomain["SCOPE"] = "scope";
  21641. FuncDomain["SYSTEM"] = "system";
  21642. })(exports.FuncDomain || (exports.FuncDomain = {}));
  21643. (function (BizMode) {
  21644. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  21645. BizMode[BizMode["query"] = 1] = "query";
  21646. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  21647. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  21648. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  21649. })(exports.BizMode || (exports.BizMode = {}));
  21650. (function (BizFormat) {
  21651. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  21652. BizFormat[BizFormat["button"] = 1] = "button";
  21653. BizFormat[BizFormat["progress"] = 2] = "progress";
  21654. BizFormat[BizFormat["date"] = 3] = "date";
  21655. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  21656. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  21657. })(exports.BizFormat || (exports.BizFormat = {}));
  21658. (function (BizUnique) {
  21659. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  21660. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  21661. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  21662. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  21663. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  21664. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  21665. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  21666. })(exports.BizUnique || (exports.BizUnique = {}));
  21667. var ScopeEngine = /** @class */ (function () {
  21668. function ScopeEngine() {
  21669. }
  21670. ScopeEngine.getBizFile = function (director) {
  21671. return new Promise(function (resolve, reject) {
  21672. debugger;
  21673. });
  21674. };
  21675. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  21676. return new Promise(function (resolve, reject) {
  21677. var requireArr = [];
  21678. var requireKeyArr = [];
  21679. _$2.forOwn(billFile.domains, function (v, k) {
  21680. requireArr.push(v.domain);
  21681. requireKeyArr.push(k);
  21682. if (v.layout) {
  21683. requireArr.push(v.layout);
  21684. requireKeyArr.push(k + "_layout");
  21685. }
  21686. });
  21687. requireArr.push(billFile.layout);
  21688. requireKeyArr.push("layout");
  21689. requireArr.push(billFile.converter);
  21690. requireKeyArr.push("converter");
  21691. // @ts-ignore
  21692. require(requireArr, function () {
  21693. var requireReArr = [];
  21694. for (var _i = 0; _i < arguments.length; _i++) {
  21695. requireReArr[_i] = arguments[_i];
  21696. }
  21697. if (requireReArr.length <= 0) {
  21698. reject(new Error("没有加载到相关的文件!"));
  21699. }
  21700. var domains = {};
  21701. for (var i = 0; i < requireReArr.length - 2; i++) {
  21702. if (requireKeyArr[i].endsWith("_layout")) {
  21703. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  21704. domains[key_d].layout = requireReArr[i].default;
  21705. }
  21706. else {
  21707. domains[requireKeyArr[i]] = requireReArr[i].default;
  21708. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  21709. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  21710. }
  21711. }
  21712. var bizFile = {
  21713. bill: billFile,
  21714. domains: domains,
  21715. layout: requireReArr[requireReArr.length - 2].default,
  21716. converter: requireReArr[requireReArr.length - 1].default,
  21717. };
  21718. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  21719. scope.billSetting = bizFile;
  21720. resolve(scope);
  21721. });
  21722. });
  21723. };
  21724. ScopeEngine.buildScopeFromPath = function (path) {
  21725. return new Promise(function (resolve, reject) {
  21726. // @ts-ignore
  21727. require([path], function (bill) {
  21728. bill = bill.default;
  21729. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  21730. resolve(scope);
  21731. }).catch(function (e) {
  21732. reject(e);
  21733. });
  21734. });
  21735. });
  21736. };
  21737. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  21738. var controller = {};
  21739. var vjson = {
  21740. layout: 'fit',
  21741. title: bizFile.bill.name,
  21742. items: []
  21743. };
  21744. var model = {};
  21745. if (bizFile.layout.layout === "fit") {
  21746. vjson.items = bizFile.layout.items;
  21747. }
  21748. else if (bizFile.layout.layout === "border") {
  21749. vjson.items = [bizFile.layout];
  21750. }
  21751. var domainsVjson = {};
  21752. _$2.forOwn(bizFile.domains, function (v, k) {
  21753. var domainVjson = null;
  21754. var buttons = bizFile.domains[k].buttons;
  21755. if (bizFile.bill.domains[k].mode === "form") {
  21756. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  21757. if (Array.isArray(buttons) && buttons.length > 0) {
  21758. if (bizFile.bill.domains[k].type === "header") {
  21759. vjson.tbar = {
  21760. xtype: 'toolbar',
  21761. items: ScopeEngine.buildButton(controller, buttons)
  21762. };
  21763. }
  21764. else {
  21765. domainVjson.items.push({
  21766. xtype: "cols",
  21767. items: ScopeEngine.buildButton(controller, buttons)
  21768. });
  21769. }
  21770. }
  21771. }
  21772. else if (bizFile.bill.domains[k].mode === "table") {
  21773. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  21774. if (Array.isArray(buttons) && buttons.length > 0) {
  21775. if (bizFile.bill.domains[k].type === "header") {
  21776. vjson.tbar = {
  21777. xtype: 'toolbar',
  21778. items: ScopeEngine.buildButton(controller, buttons)
  21779. };
  21780. }
  21781. else {
  21782. domainVjson.tbar = {
  21783. xtype: 'toolbar',
  21784. items: ScopeEngine.buildButton(controller, buttons)
  21785. };
  21786. }
  21787. }
  21788. }
  21789. if (domainVjson) {
  21790. domainsVjson[k] = domainVjson;
  21791. }
  21792. });
  21793. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  21794. var scope = new Scope({ model: model, vjson: vjson });
  21795. scope['bill_define'] = bizFile;
  21796. _$2.merge(scope, controller);
  21797. console.log('bill_define', vjson, scope, scope['bill_define']);
  21798. return scope;
  21799. };
  21800. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  21801. var fieldGroups = {};
  21802. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21803. var field = bizFile.domains[domainKey].fields[i];
  21804. var item = { sort: field.form_sort };
  21805. item.xtype = field.xtype;
  21806. item.fieldLabel = field.column_desc;
  21807. item.bind = {
  21808. value: "{" + domainKey + "." + field.column_name + "}",
  21809. };
  21810. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  21811. // if (field.disabled !== "true" && field.disabled !== "false") {
  21812. // item.bind.disabled = eval(field.disabled)
  21813. // } else {
  21814. // item.disabled = (field.disabled === "true")
  21815. // }
  21816. // if (field.readonly !== "true" && field.readonly !== "false") {
  21817. // item.bind.disabled = eval(field.readonly)
  21818. // } else {
  21819. // item.readonly = (field.readonly === "true")
  21820. // }
  21821. // if (field.required !== "true" && field.required !== "false") {
  21822. // item.bind.required = eval(field.required)
  21823. // } else {
  21824. // item.required = (field.required === "true")
  21825. // }
  21826. // if (field.hide !== "true" && field.hide !== "false") {
  21827. // item.bind.hidden = eval(field.hide)
  21828. // } else {
  21829. // item.hidden = (field.hide === "true")
  21830. // }
  21831. // item.flex = field.
  21832. if (field.dict) {
  21833. item.fix = eval(field.dict);
  21834. }
  21835. // _.set(formModel, "", "")
  21836. item.field = field;
  21837. if (field.form_group) {
  21838. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  21839. fieldGroups[field.form_group] = [item];
  21840. }
  21841. else {
  21842. fieldGroups[field.form_group].push(item);
  21843. }
  21844. }
  21845. }
  21846. var formVjson = {
  21847. xtype: "form",
  21848. title: bizFile.domains[domainKey].name,
  21849. items: []
  21850. };
  21851. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  21852. var items = ScopeEngine.buildFieldSet(fieldGroup);
  21853. if (items) {
  21854. var fieldsetVjson = {
  21855. xtype: "fieldset",
  21856. title: k,
  21857. items: items
  21858. };
  21859. formVjson.items.push(fieldsetVjson);
  21860. }
  21861. });
  21862. return formVjson;
  21863. };
  21864. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  21865. // const vjson = { xtype: "grid", items: []}
  21866. var gridVjson = {
  21867. xtype: "yvgrid",
  21868. columns: [],
  21869. split: true,
  21870. reference: domainKey,
  21871. listeners: {
  21872. itemdblclick: function () {
  21873. },
  21874. },
  21875. };
  21876. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21877. var field = bizFile.domains[domainKey].fields[i];
  21878. gridVjson.columns.push({
  21879. dataIndex: field.column_name,
  21880. header: field.column_desc,
  21881. });
  21882. }
  21883. return gridVjson;
  21884. };
  21885. ScopeEngine.buildFieldSet = function (fieldGroup) {
  21886. var colGroups = [{
  21887. xtype: "cols",
  21888. items: []
  21889. }];
  21890. var colGroup = colGroups[0];
  21891. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  21892. for (var i = 0; i < fieldGroup.length; i++) {
  21893. var field = fieldGroup[i];
  21894. if (field.field.form_newline === "true") {
  21895. if (colGroup.items.length > 0) {
  21896. colGroup = {
  21897. xtype: "cols",
  21898. items: [field]
  21899. };
  21900. colGroups.push(colGroup);
  21901. }
  21902. }
  21903. else {
  21904. colGroup.items.push(field);
  21905. }
  21906. delete field.field;
  21907. }
  21908. return colGroups;
  21909. };
  21910. ScopeEngine.buildButton = function (controller, buttons) {
  21911. var buttonsVjson = [];
  21912. var _loop_1 = function (i) {
  21913. var item = buttons[i];
  21914. var button = {
  21915. xtype: "button",
  21916. text: item.btn_name,
  21917. iconCls: item.icon
  21918. };
  21919. if (item.hidden === "true" || item.hidden === "false") {
  21920. button.hidden = (item.hidden === "true");
  21921. }
  21922. if (item.listeners) {
  21923. var listeners_1 = {};
  21924. _$2.forOwn(item.listeners, function (v, k) {
  21925. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  21926. listeners_1[k] = v;
  21927. }
  21928. else {
  21929. try {
  21930. listeners_1[k] = eval(v);
  21931. }
  21932. catch (e) {
  21933. throw e;
  21934. }
  21935. }
  21936. });
  21937. button.listeners = listeners_1;
  21938. }
  21939. buttonsVjson.push(button);
  21940. };
  21941. for (var i = 0; i < buttons.length; i++) {
  21942. _loop_1(i);
  21943. }
  21944. return buttonsVjson;
  21945. };
  21946. ScopeEngine.buildListeners = function (controller, item) {
  21947. if (!item.hasOwnProperty("listeners")) {
  21948. return;
  21949. }
  21950. _$2.forOwn(item.listeners, function (v, k) {
  21951. if (v && typeof v === "string") {
  21952. if (v.indexOf(".") > -1) {
  21953. var strArr = v.split(".");
  21954. if (strArr.length != 2) {
  21955. console.error(item.listeners, "语法解析错误,请检查!");
  21956. }
  21957. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  21958. switch (funcDomain) {
  21959. case exports.FuncDomain.SCOPE:
  21960. controller[k] = findCustFunc(item, k);
  21961. break;
  21962. case exports.FuncDomain.SYSTEM:
  21963. break;
  21964. default:
  21965. throw new Error("错误的函数域定义");
  21966. }
  21967. }
  21968. else {
  21969. var func = eval(v);
  21970. if (typeof func === 'function') {
  21971. controller[k] = func;
  21972. }
  21973. throw new Error("解析自定义函数出错");
  21974. }
  21975. }
  21976. });
  21977. var findCustFunc = function (item, funcName) {
  21978. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  21979. throw new Error("没有找到相关的函数定义");
  21980. }
  21981. var func = eval(item[funcName]);
  21982. if (typeof func === 'function') {
  21983. return func;
  21984. }
  21985. throw new Error("解析自定义函数出错");
  21986. };
  21987. };
  21988. /**
  21989. * 只检索 items 的模式,深度遍历 vjson
  21990. */
  21991. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  21992. if (Array.isArray(vjson)) {
  21993. for (var i = 0; i < vjson.length; i++) {
  21994. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  21995. }
  21996. }
  21997. else {
  21998. _$2.forOwn(vjson, function (v, k) {
  21999. if (k !== "domain") {
  22000. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  22001. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  22002. }
  22003. }
  22004. else {
  22005. delete vjson.domain;
  22006. _$2.merge(vjson, domainsVjson[v]);
  22007. }
  22008. });
  22009. }
  22010. };
  22011. return ScopeEngine;
  22012. }());
  22013. //# sourceMappingURL=ScopeEngine.js.map
  22014. function initComponent () {
  22015. var ct = Ext.Component.prototype.constructor;
  22016. Ext.Component.override({
  22017. constructor: function (config) {
  22018. var _a, _b;
  22019. if (!isDesignMode(this, config)) {
  22020. var me_1 = this;
  22021. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  22022. _$2.each(baseConfigProcessList, function (process) {
  22023. process.call(me_1, me_1, config);
  22024. });
  22025. }
  22026. if (config) {
  22027. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  22028. config.i18nPath = config.$initParent.i18nPath;
  22029. }
  22030. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  22031. var setTitle_1 = config.$initParent.setTitle;
  22032. var handel_1 = config.$initParent;
  22033. config.$initParent.setTitle = function (title) {
  22034. var t = { title: title };
  22035. var WMSTranslate = window["WMSTranslate"];
  22036. if (WMSTranslate) {
  22037. if (typeof window['viewTranslate'] === 'function') {
  22038. window['viewTranslate'](t, title, "title");
  22039. }
  22040. }
  22041. setTitle_1.call(handel_1, t.title);
  22042. }.bind(config.$initParent);
  22043. }
  22044. var WMSTranslate = window["WMSTranslate"];
  22045. if (WMSTranslate) {
  22046. if (typeof window['viewTranslate'] === 'function') {
  22047. window['viewTranslate'](config, config.text, "text");
  22048. window['viewTranslate'](config, config.title, "title");
  22049. window['viewTranslate'](config, config.header, "header");
  22050. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  22051. window['viewTranslate'](config, config.emptyText, "emptyText");
  22052. }
  22053. }
  22054. }
  22055. ct.call(this, config);
  22056. }
  22057. });
  22058. var _initComponent = Ext.picker.Date.prototype.initComponent;
  22059. Ext.picker.Date.override({
  22060. initComponent: function () {
  22061. var me = this;
  22062. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  22063. _initComponent.call(me);
  22064. },
  22065. selectToday: function () {
  22066. var me = this, btn = me.todayBtn, handler = me.handler;
  22067. if (btn && !btn.disabled) {
  22068. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  22069. me.fireEvent('select', me, me.value);
  22070. if (handler) {
  22071. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  22072. }
  22073. me.onSelect();
  22074. }
  22075. return me;
  22076. },
  22077. });
  22078. }
  22079. //# sourceMappingURL=component.js.map
  22080. function initMainTab () {
  22081. Ext.define('Yvan.MainTab', {
  22082. extend: 'Ext.tab.Panel',
  22083. xtype: 'maintab',
  22084. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  22085. closeTabText: '关闭',
  22086. closeOthersTabsText: '关闭其他',
  22087. closeAllTabsText: '关闭所有'
  22088. }),
  22089. constructor: function (config) {
  22090. var me = this;
  22091. var newConfig = _$2.defaultsDeep({
  22092. // 强制属性
  22093. }, config);
  22094. this.superclass.constructor.call(me, newConfig);
  22095. },
  22096. initComponent: function () {
  22097. var me = this;
  22098. this.on({
  22099. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  22100. _$2.defer(function () {
  22101. me.changeHash(newCard.id);
  22102. window['cp'] = newCard.yvanScope;
  22103. });
  22104. $$2(window).trigger('tabChange', {
  22105. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  22106. });
  22107. },
  22108. afterrender: function () {
  22109. _$2.defer(function () {
  22110. me.tryRestoryPage();
  22111. });
  22112. }
  22113. });
  22114. this.superclass.initComponent.call(me);
  22115. },
  22116. tryRestoryPage: function () {
  22117. var me = this;
  22118. var hash = '' + window.location.hash;
  22119. if (hash && hash.indexOf('page=') > 0) {
  22120. if (hash.startsWith('#')) {
  22121. hash = hash.substr(1);
  22122. }
  22123. if (hash) {
  22124. var page = Qs.parse(hash).page;
  22125. if (page) {
  22126. // this.openScope(page)
  22127. me.fireEvent('restorypage', page);
  22128. }
  22129. }
  22130. }
  22131. },
  22132. changeHash: function (id) {
  22133. window.location.hash = Qs.stringify({ page: id });
  22134. },
  22135. /**
  22136. * 添加一个业务模块实例到选项卡
  22137. * @param scopeInstance 业务对象实例
  22138. * @param config ExtJS配置对象
  22139. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  22140. */
  22141. addScope: function (scopeInstance, config, panelInitCallback) {
  22142. scopeInstance.topScope = scopeInstance;
  22143. var me = this;
  22144. if (config.path) {
  22145. for (var i = 0; i < this.items.items.length; i++) {
  22146. // 找到当前 tabs 里有没有已经打开过
  22147. var tab = this.items.items[i];
  22148. if (_$2.isEqual(tab.path, config.path)) {
  22149. // 激活
  22150. this.setActiveTab(tab);
  22151. return tab;
  22152. }
  22153. }
  22154. }
  22155. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  22156. if (typeof panelInitCallback === 'function') {
  22157. panelInitCallback(newPanel);
  22158. }
  22159. // 添加业务模块
  22160. var newTab = this.add(newPanel);
  22161. this.setActiveTab(newTab);
  22162. newTab.on({
  22163. destroy: function (sender) {
  22164. me.changeHash('');
  22165. delete window['cp'];
  22166. }
  22167. });
  22168. return newTab;
  22169. }
  22170. });
  22171. }
  22172. //# sourceMappingURL=MainTab.js.map
  22173. /**
  22174. * 构建所有组件的公共属性
  22175. * @param config 原始config
  22176. * @param dragType 组件模式
  22177. * 不填,代表不能在设计时被拖拽
  22178. * row-container 是一个rows容器
  22179. * col-container 是一个cols容器
  22180. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  22181. * row-item rows中的一行,比如 tree / grid / panel 等等
  22182. */
  22183. function baseConfig(config, dragType) {
  22184. // if (isDesignMode(config, undefined) && dragType) {
  22185. if (typeof config === 'object') {
  22186. var cc = '';
  22187. switch (dragType) {
  22188. case "cols-container":
  22189. cc = 'design_cols_container';
  22190. break;
  22191. case "col-item":
  22192. cc = 'design_col_item';
  22193. break;
  22194. case "rows-container":
  22195. cc = 'design_rows_container';
  22196. break;
  22197. case "row-item":
  22198. cc = 'design_row_item';
  22199. break;
  22200. }
  22201. if (typeof config.cls === 'string') {
  22202. _$2.extend(config, {
  22203. cls: [config.cls, 'yvan_design', cc]
  22204. });
  22205. }
  22206. else if (_$2.isArray(config.cls)) {
  22207. _$2.extend(config, {
  22208. cls: __spread(config.cls, ['yvan_design', cc])
  22209. });
  22210. }
  22211. else {
  22212. _$2.extend(config, {
  22213. cls: ['yvan_design', cc]
  22214. });
  22215. }
  22216. }
  22217. return config;
  22218. }
  22219. //# sourceMappingURL=base.js.map
  22220. function initPanel () {
  22221. /**
  22222. *
  22223. */
  22224. var ct = Ext.panel.Panel.prototype.constructor;
  22225. Ext.panel.Panel.override({
  22226. constructor: function (config) {
  22227. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  22228. ct.call(this, newConfig);
  22229. }
  22230. });
  22231. var ss = Ext.form.FieldContainer.prototype;
  22232. Ext.form.FieldContainer.override({
  22233. config: __assign({}, fieldContainer)
  22234. });
  22235. }
  22236. //# sourceMappingURL=panel.js.map
  22237. function initGridColumn () {
  22238. var ct = Ext.grid.column.Column.prototype.constructor;
  22239. Ext.grid.column.Column.override({
  22240. constructor: function (config) {
  22241. var scope = lookupScope(config.$initParent.$initParent);
  22242. var newConfig = _$2.defaults({}, config, column);
  22243. if (typeof newConfig.summaryRenderer === 'string') {
  22244. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  22245. if (typeof newConfig.summaryRenderer === 'function') {
  22246. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  22247. }
  22248. }
  22249. if (config.formatter === 'datetime') {
  22250. newConfig.fix = ['system.formatDate()'];
  22251. delete newConfig.formatter;
  22252. }
  22253. // 在 grid.constructor 已经转换过了
  22254. // if (typeof newConfig.renderer === 'string') {
  22255. // newConfig.renderer = lookupFn(scope, config.renderer)
  22256. // if (typeof newConfig.renderer === 'function') {
  22257. // newConfig.renderer = newConfig.renderer.bind(scope)
  22258. // }
  22259. // }
  22260. ct.call(this, newConfig);
  22261. }
  22262. });
  22263. var ctAction = Ext.grid.column.Action.prototype.constructor;
  22264. Ext.grid.column.Action.override({
  22265. constructor: function (config) {
  22266. var scope = lookupScope(config.$initParent.$initParent);
  22267. _$2.forEach(config.items, function (item) {
  22268. if (typeof item.handler === 'string') {
  22269. item.handler = lookupFn(scope, item.handler);
  22270. if (typeof item.handler === 'function') {
  22271. item.handler = item.handler.bind(scope);
  22272. }
  22273. }
  22274. });
  22275. ctAction.call(this, config);
  22276. }
  22277. });
  22278. var ck = Ext.grid.column.Check.prototype.constructor;
  22279. Ext.grid.column.Check.override({
  22280. constructor: function (config) {
  22281. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  22282. var grid = sender.view.grid.ownerGrid;
  22283. var column = grid.getColumns()[sender.fullColumnIndex];
  22284. var context = {
  22285. event: e,
  22286. column: column,
  22287. field: sender.dataIndex,
  22288. value: checked,
  22289. record: record,
  22290. rowIdx: rowIndex
  22291. };
  22292. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  22293. });
  22294. ck.call(this, config);
  22295. }
  22296. });
  22297. // 227573
  22298. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  22299. // Ext.define('Yvan.ColumnOverride', {
  22300. // override: 'Ext.grid.column.Column',
  22301. //
  22302. // config: {
  22303. // enableSortOnClick: false,
  22304. // },
  22305. //
  22306. // // /**@Overrides*/
  22307. // onTitleElClick: function (e, t, sortOnClick) {
  22308. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  22309. // if (!$(e.target).is('.x-column-header-trigger')) {
  22310. // // 不是点击菜单的情况下,让列自适应宽度
  22311. // this.autoSize()
  22312. // }
  22313. // return onTitleElClick.call(this, e, t, false)
  22314. // }
  22315. // });
  22316. }
  22317. //# sourceMappingURL=gridcolumn.js.map
  22318. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  22319. /**
  22320. * 判断目标字符串与关键字是否重叠
  22321. * @param target 目标字符串
  22322. * @param keyword 搜索关键字
  22323. */
  22324. function pinyinMatch(target, keyword) {
  22325. if (typeof target != 'string' || typeof keyword != 'string') {
  22326. return false;
  22327. }
  22328. if (!keyword || !target) {
  22329. return false;
  22330. }
  22331. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  22332. keyword = _$2.toLower(keyword);
  22333. var pos1 = _$2.toLower(target).indexOf(keyword);
  22334. if (pos1 >= 0) {
  22335. return true;
  22336. }
  22337. var len = _$2.intersection(keyword.split('')).length;
  22338. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  22339. return true;
  22340. }
  22341. return false;
  22342. }
  22343. /**
  22344. * 对某个表达式进行求值
  22345. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  22346. *
  22347. * @example
  22348. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  22349. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  22350. *
  22351. * @param data 数据环境对象
  22352. * @param express 表达式对象
  22353. */
  22354. function calcExpress(data, express) {
  22355. var result = express;
  22356. if (SIMPLE_RE.test(express)) {
  22357. // '{foo}' 简单表达式
  22358. var path = express.substring(1, express.length - 1);
  22359. var ret = _$2.get(data, path);
  22360. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  22361. }
  22362. while (true) {
  22363. var mlist = result.match(/{(.*?)}/);
  22364. if (!mlist) {
  22365. break;
  22366. }
  22367. var pathC = mlist[0]; // {query.a}
  22368. var path = mlist[1]; // query.a
  22369. var value = _$2.get(data, path);
  22370. result = result.replaceAll(pathC, value || '');
  22371. }
  22372. return result;
  22373. }
  22374. /**
  22375. * 对个对象进行表达式求值,不用回调
  22376. * @example
  22377. * calcObjectFlat({query:{a:'aValue',b1:'b1Value',b2:'b2Value',d1:1,d2:2}}, { a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}'] })
  22378. *
  22379. * {
  22380. * a: '{query.a}',
  22381. * b: {
  22382. * b1: '{query.b1}',
  22383. * b2: '{query.b2}',
  22384. * },
  22385. * c: 'aa',
  22386. * d: [
  22387. * '{query.d1}',
  22388. * '{query.d2}'
  22389. * ]
  22390. * }
  22391. *
  22392. * 计算结果为
  22393. * {
  22394. * a: 'aValue',
  22395. * b: {
  22396. * b1: 'b1Value',
  22397. * b2: 'b2Value'
  22398. * },
  22399. * c: 'aa'
  22400. * d: [
  22401. * '1',
  22402. * '2'
  22403. * ]
  22404. * }
  22405. *
  22406. * @param data
  22407. * @param paramObject
  22408. */
  22409. function calcObjectFlat(data, paramObject) {
  22410. var result = _$2.cloneDeep(paramObject);
  22411. if (typeof paramObject === 'string') {
  22412. return calcExpress(data, paramObject);
  22413. }
  22414. var trav = function (param) {
  22415. _$2.forOwn(param, function (value, key) {
  22416. if (_$2.isPlainObject(value)) {
  22417. // 深度递归,对子对象进行求解
  22418. trav(value);
  22419. }
  22420. else if (_$2.isString(value)) {
  22421. // 字符串直接用 calcExpress 表达式求解
  22422. param[key] = calcExpress(data, param[key]);
  22423. }
  22424. else if (_$2.isArray(value)) {
  22425. // 数组求解
  22426. _$2.each(value, function (v, idx) {
  22427. value[idx] = calcExpress(data, v);
  22428. });
  22429. }
  22430. });
  22431. };
  22432. trav(result);
  22433. return result;
  22434. }
  22435. /**
  22436. * 合併 data 到當前的 ViewModel 對象
  22437. */
  22438. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  22439. var newRow = {};
  22440. if (isFlat == false) {
  22441. newRow = data;
  22442. }
  22443. else {
  22444. flatObject(newRow, '', data);
  22445. }
  22446. if (!propertyName) {
  22447. _$2.forOwn(newRow, function (value, key) {
  22448. viewModel.set(key, value);
  22449. });
  22450. }
  22451. else {
  22452. _$2.forOwn(newRow, function (value, key) {
  22453. viewModel.set(propertyName + "." + key, value);
  22454. });
  22455. }
  22456. }
  22457. /**
  22458. * 转换内联结构的行,到平面结构
  22459. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  22460. *
  22461. * @param array
  22462. * @param flatOption
  22463. * @return {[]}
  22464. */
  22465. function flatRow(array) {
  22466. var ret = [];
  22467. _$2.forEach(array, function (row) {
  22468. var newRow = {};
  22469. flatObject(newRow, '', row);
  22470. ret.push(newRow);
  22471. });
  22472. return ret;
  22473. }
  22474. function flatObject(parentObj, parentProp, obj) {
  22475. _$2.forOwn(obj, function (value, key) {
  22476. var fullKey = parentProp ? parentProp + '_' + key : key;
  22477. if (_$2.isArray(value)) {
  22478. parentObj[fullKey] = _$2.map(value, function (row) {
  22479. var newRow = {};
  22480. flatObject(newRow, '', row);
  22481. return newRow;
  22482. });
  22483. }
  22484. else {
  22485. if (typeof value === 'object') {
  22486. flatObject(parentObj, fullKey, value);
  22487. }
  22488. else {
  22489. parentObj[fullKey] = value;
  22490. }
  22491. }
  22492. });
  22493. }
  22494. /**
  22495. * 替换内部结构中,所有 N/A
  22496. */
  22497. function replaceNA(obj) {
  22498. if (obj === 'N/A') {
  22499. return '';
  22500. }
  22501. if (_$2.isArray(obj)) {
  22502. _$2.forEach(obj, function (value, idx) {
  22503. if (value === 'N/A') {
  22504. obj[idx] = '';
  22505. }
  22506. else {
  22507. replaceNA(value);
  22508. }
  22509. });
  22510. }
  22511. else if (_$2.isPlainObject(obj)) {
  22512. _$2.forOwn(obj, function (value, key) {
  22513. if (value === 'N/A') {
  22514. obj[key] = '';
  22515. }
  22516. else {
  22517. replaceNA(value);
  22518. }
  22519. });
  22520. }
  22521. }
  22522. function deepTravJson(obj, resolver) {
  22523. if (_$2.isArray(obj)) {
  22524. _$2.forEach(obj, function (value, idx) {
  22525. if (typeof value === 'string') {
  22526. resolver(obj, value, idx);
  22527. }
  22528. else {
  22529. deepTravJson(value, resolver);
  22530. }
  22531. });
  22532. }
  22533. else if (_$2.isPlainObject(obj)) {
  22534. _$2.forOwn(obj, function (value, key) {
  22535. if (typeof value === 'string') {
  22536. resolver(obj, value, key);
  22537. }
  22538. else {
  22539. deepTravJson(value, resolver);
  22540. }
  22541. });
  22542. }
  22543. }
  22544. /**
  22545. * 根据表达式进入写值
  22546. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  22547. * express="test-{query.a}" 写值就会失败
  22548. *
  22549. * @example
  22550. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  22551. * 写值成功
  22552. *
  22553. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  22554. * 写值失败
  22555. *
  22556. * @param viewModel VM对象
  22557. * @param express 表达式对象
  22558. * @param value 目标值
  22559. */
  22560. function tryWriteByExpress(viewModel, express, value) {
  22561. if (SIMPLE_RE.test(express)) {
  22562. // '{foo}' 简单表达式
  22563. express = express.substring(1, express.length - 1);
  22564. viewModel.set(express, value);
  22565. }
  22566. }
  22567. /**
  22568. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  22569. * @example
  22570. * tryWriteObject({ a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}']}, {a:'aValue', b:{b1:'b1Value', b2:'b2Value'}, c:'aa', d:[1,2]})
  22571. *
  22572. * expressObject:
  22573. * {
  22574. * a: '{query.a}',
  22575. * b: {
  22576. * b1: '{query.b1}',
  22577. * b2: '{query.b2}',
  22578. * },
  22579. * c: 'aa',
  22580. * d: [
  22581. * '{query.a}',
  22582. * '{query.b2}'
  22583. * ]
  22584. * }
  22585. *
  22586. * valueObject:
  22587. * {
  22588. * a: 'aValue',
  22589. * b: {
  22590. * b1: 'b1Value',
  22591. * b2: 'b2Value'
  22592. * },
  22593. * c: 'aa'
  22594. * c: [
  22595. * 'aValue',
  22596. * 'b2Value'
  22597. * ]
  22598. * }
  22599. *
  22600. * 系统会尝试回写
  22601. * viewModel.set('query.a', 'aValue')
  22602. * viewModel.set('query.b1', 'b1Value')
  22603. * viewModel.set('query.b2', 'b2Value')
  22604. *
  22605. * @param expressObject 含表达式的对象
  22606. * @param valueObject 表达式计算完成之后的结果对象
  22607. * @param writeFn 写入的方法 (path, value)=>void
  22608. */
  22609. function tryWriteObject(expressObject, valueObject, writeFn) {
  22610. var trav = function (pathPrefix) {
  22611. var parent = expressObject;
  22612. if (_$2.size(pathPrefix) > 1) {
  22613. parent = _$2.get(parent, pathPrefix.substring(1));
  22614. }
  22615. _$2.forOwn(parent, function (value, key) {
  22616. if (_$2.isPlainObject(value)) {
  22617. // 深度递归,对子对象进行求解
  22618. trav(pathPrefix + "." + key);
  22619. }
  22620. else if (_$2.isString(value)) {
  22621. // 字符串直接用 calcExpress 表达式求解
  22622. if (SIMPLE_RE.test(value)) {
  22623. // If we have '{foo}' alone it is a literal 简单表达式
  22624. var targetPath = value.substring(1, value.length - 1);
  22625. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  22626. if (!writeFn) {
  22627. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22628. }
  22629. else {
  22630. writeFn(targetPath, targetValue);
  22631. }
  22632. }
  22633. }
  22634. else if (_$2.isArray(value)) {
  22635. _$2.each(value, function (v, idx) {
  22636. if (SIMPLE_RE.test(v)) {
  22637. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  22638. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  22639. if (!writeFn) {
  22640. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22641. }
  22642. else {
  22643. writeFn(targetPath, targetValue);
  22644. }
  22645. }
  22646. });
  22647. }
  22648. });
  22649. };
  22650. trav("");
  22651. }
  22652. /**
  22653. * 尝试去掉变量两边括号
  22654. * {a} => a
  22655. * a => a
  22656. */
  22657. function tryVarSimple(value) {
  22658. if (SIMPLE_RE.test(value)) {
  22659. // If we have '{foo}' alone it is a literal 简单表达式
  22660. return value.substring(1, value.length - 1);
  22661. }
  22662. return value;
  22663. }
  22664. /**
  22665. * 对多个表达式进行求值. 异步回调的方式返回
  22666. * {
  22667. * a: 1,
  22668. * b: '{someBind}',
  22669. * c: ['a', 'b', 'c'],
  22670. * d: ['a', 'b', '{someBind}'],
  22671. * e: {
  22672. * y: 1,
  22673. * z: 2
  22674. * },
  22675. * f: {
  22676. * y: 1,
  22677. * z: '{someBind}'
  22678. * }
  22679. * }
  22680. *
  22681. * // Will produce
  22682. * {
  22683. * b: value,
  22684. * d: ['a', 'b', value],
  22685. * f: {
  22686. * y: 1,
  22687. * z: value
  22688. * }
  22689. * }
  22690. * @param viewModel scope.viewModel对象
  22691. * @param paramObject 求值对象
  22692. */
  22693. function calcObject(viewModel, paramObject) {
  22694. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  22695. return new Promise(function (resolve) {
  22696. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  22697. schedule.destroy();
  22698. // 从 Ext.data.Model 对象转换为 js-object 对象
  22699. ret = toPlainObject(ret);
  22700. resolve(ret);
  22701. }, viewModel, { single: true });
  22702. });
  22703. }
  22704. /**
  22705. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  22706. * @param config 组件构造函数传入的 config 配置文件
  22707. */
  22708. function getParentGrid(config) {
  22709. var _a;
  22710. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  22711. }
  22712. /**
  22713. * 解析
  22714. * {
  22715. * condition: "{skuId}",
  22716. * errorMsg: "无法编辑",
  22717. * notice: 'msg'
  22718. * }
  22719. */
  22720. function tryEnable(data, enableSetting) {
  22721. if (!enableSetting) {
  22722. // 没有这一段配置,可以编辑
  22723. return true;
  22724. }
  22725. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  22726. if (!evalFunction(data, condition)) {
  22727. // 没有达成 condition 条件
  22728. // 计算 msg 消息内容
  22729. var msgContent = calcExpress(data, errorMsg);
  22730. if (msgContent) {
  22731. if (!notice || notice === 'msg') {
  22732. // 进行提示
  22733. msg$1(msgContent);
  22734. }
  22735. }
  22736. return false;
  22737. }
  22738. return true;
  22739. }
  22740. /**
  22741. * 动态的为 combo 或 columns.combo 设置下拉框的值
  22742. * @param sender 目标对象
  22743. * @param config 目标对象的配置(在构造函数之前也可以)
  22744. * @param getDictFn 获取字典的方法
  22745. * @param bizKey 传入字典的参数
  22746. * @param multiValueSeparator 多个字典值的分割符号
  22747. */
  22748. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  22749. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  22750. // sender 和 config为空的时候获取值、
  22751. if (_$2.isArray(getDictFn)) {
  22752. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  22753. var realArray_1 = getDictFn;
  22754. getDictFn = function () {
  22755. return realArray_1;
  22756. };
  22757. }
  22758. if (!sender) {
  22759. return new Promise(function (resolve, reject) {
  22760. getDictFn(bizKey, function (r) {
  22761. resolve({ config: config, r: r });
  22762. });
  22763. });
  22764. }
  22765. if (sender.xtype === 'combotree') {
  22766. getDictFn(bizKey, function (r) {
  22767. if (sender.store) {
  22768. // 异步回传
  22769. sender.setStore(new Ext.data.TreeStore({ root: r }));
  22770. }
  22771. else {
  22772. // 同步回传
  22773. config.store = new Ext.data.TreeStore({ root: r });
  22774. }
  22775. });
  22776. return;
  22777. }
  22778. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  22779. getDictFn(bizKey, function (r) {
  22780. var _a, _b;
  22781. if (sender.store) {
  22782. // 异步回传
  22783. sender.setStore(new Ext.data.Store(r));
  22784. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  22785. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  22786. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  22787. if (typeof realValue !== 'undefined') {
  22788. sender.setValue(realValue);
  22789. }
  22790. }
  22791. else {
  22792. // 同步回传
  22793. config.store = new Ext.data.Store(r);
  22794. }
  22795. });
  22796. return;
  22797. }
  22798. else if (sender.xtype === 'gridcolumn') {
  22799. var grid = getParentGrid(config);
  22800. var editor_1 = config.editor, renderer = config.renderer;
  22801. getDictFn(bizKey, function (r) {
  22802. if (sender.store) {
  22803. // 已经渲染出来了, 用方法进行修改
  22804. var editor_2 = sender.getEditor();
  22805. if (editor_2 && editor_2.xtype === 'combo') {
  22806. var valueField_1 = r.field[0];
  22807. var displayField_1 = r.field[1];
  22808. editor_2.valueField = valueField_1;
  22809. editor_2.setDisplayField(displayField_1);
  22810. editor_2.setStore(new Ext.data.Store(r));
  22811. }
  22812. if (!sender.disableListFilter) {
  22813. sender.setFilter({
  22814. type: 'list',
  22815. options: _$2.map(r.data, function (r) { return ({
  22816. id: '' + r.id,
  22817. text: r.text,
  22818. }); })
  22819. });
  22820. }
  22821. }
  22822. else {
  22823. // 没有渲染之前,修改 config 即可
  22824. if (editor_1 && editor_1.xtype === 'combo') {
  22825. // 带编辑模式
  22826. editor_1.store = new Ext.data.Store(r);
  22827. }
  22828. if (!sender.disableListFilter) {
  22829. config.filter = {
  22830. type: 'list',
  22831. options: _$2.map(r.data, function (r) { return ({
  22832. id: '' + r.id,
  22833. text: r.text,
  22834. }); })
  22835. };
  22836. }
  22837. }
  22838. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  22839. var renderer = function (value, metaData) {
  22840. if (metaData === void 0) { metaData = false; }
  22841. if (!value && value != 0) {
  22842. return '';
  22843. }
  22844. var valueField = r.field[metaData === true ? 1 : 0];
  22845. var displayField = r.field[metaData === true ? 0 : 1];
  22846. var separator = multiValueSeparator;
  22847. if (separator) {
  22848. var arr = value.split(separator);
  22849. var displayValue_1 = "";
  22850. var _loop_1 = function (i) {
  22851. var itv = arr[i];
  22852. if (i > 0) {
  22853. displayValue_1 += separator;
  22854. }
  22855. _$2.each(r.data, function (row) {
  22856. // 从 valueField 找到要显示的 displayField
  22857. if (row[valueField] == itv) {
  22858. displayValue_1 += row[displayField];
  22859. return false;
  22860. }
  22861. else {
  22862. if (i >= r.data.length - 1) {
  22863. displayValue_1 += itv;
  22864. }
  22865. }
  22866. });
  22867. };
  22868. for (var i = 0; i < arr.length; i++) {
  22869. _loop_1(i);
  22870. }
  22871. return displayValue_1;
  22872. }
  22873. _$2.each(r.data, function (row) {
  22874. // 从 valueField 找到要显示的 displayField
  22875. if (row[valueField] == value) {
  22876. value = row[displayField];
  22877. return false;
  22878. }
  22879. });
  22880. return value;
  22881. };
  22882. var dictForExcel = {};
  22883. var valueField = r.field[0];
  22884. var displayField = r.field[1];
  22885. _$2.each(r.data, function (row) {
  22886. // 从 valueField 找到要显示的 displayField
  22887. var key = row[valueField];
  22888. if (key != '' && typeof key != "undefined" && key != null) {
  22889. dictForExcel[key] = row[displayField];
  22890. }
  22891. });
  22892. if (sender.rendered) {
  22893. // 已经渲染出来了, 对列进行渲染
  22894. sender.renderer = renderer;
  22895. sender.dictForExcel = dictForExcel;
  22896. sender.getView().refresh();
  22897. }
  22898. else {
  22899. sender.renderer = renderer;
  22900. sender.dictForExcel = dictForExcel;
  22901. config.renderer = renderer;
  22902. config.dictForExcel = dictForExcel;
  22903. }
  22904. });
  22905. return;
  22906. }
  22907. throw new TypeError("无法识别的组件类型");
  22908. }
  22909. /**
  22910. * 调用服务器 Ajax
  22911. */
  22912. function invokeServer$1(url) {
  22913. var args = [];
  22914. for (var _i = 1; _i < arguments.length; _i++) {
  22915. args[_i - 1] = arguments[_i];
  22916. }
  22917. // @ts-ignore
  22918. return ajax.func({
  22919. url: url,
  22920. method: 'invoke',
  22921. args: args
  22922. });
  22923. }
  22924. function clearViewModelValues(viewModel, propertyName) {
  22925. if (!propertyName) {
  22926. var dd_1 = viewModel.getData();
  22927. _$2.forOwn(dd_1, function (value, key) {
  22928. viewModel.set(key, '');
  22929. });
  22930. return;
  22931. }
  22932. var dd = _$2.get(viewModel.getData(), propertyName);
  22933. _$2.forOwn(dd, function (value, key) {
  22934. viewModel.set(propertyName + '.' + key, '');
  22935. });
  22936. }
  22937. function reloadGrid(scope, gridRefName) {
  22938. var _a;
  22939. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  22940. }
  22941. /**
  22942. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  22943. */
  22944. function toPlainObject(obj) {
  22945. if (obj.isModel) {
  22946. obj = obj.data;
  22947. }
  22948. _$2.forOwn(obj, function (v, k) {
  22949. // Ext.data.Model.constructor
  22950. if (!v) {
  22951. return;
  22952. }
  22953. if (v.isModel) {
  22954. v = v.data;
  22955. }
  22956. if (typeof v === 'object') {
  22957. obj[k] = toPlainObject(v);
  22958. }
  22959. else {
  22960. obj[k] = v;
  22961. }
  22962. });
  22963. return obj;
  22964. }
  22965. function confirm(msg, sender) {
  22966. return new Promise(function (resolve) {
  22967. var _a, _b;
  22968. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  22969. var t = { msg: msg };
  22970. var WMSTranslate = window["WMSTranslate"];
  22971. if (WMSTranslate) {
  22972. if (typeof window['viewTranslate'] === 'function') {
  22973. window['viewTranslate'](t, msg, "msg");
  22974. }
  22975. }
  22976. var config = {
  22977. title: '请确认',
  22978. modal: true,
  22979. animateTarget: sender,
  22980. // resizable: false,
  22981. // constrainHeader: true,
  22982. // constrain: true,
  22983. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  22984. layout: {
  22985. type: 'hbox',
  22986. pack: 'start',
  22987. align: 'stretch'
  22988. },
  22989. items: [
  22990. {
  22991. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  22992. border: false,
  22993. },
  22994. {
  22995. flex: 1,
  22996. border: false,
  22997. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  22998. }
  22999. ],
  23000. buttons: [
  23001. {
  23002. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  23003. handler: function () {
  23004. resolve();
  23005. win.close();
  23006. }
  23007. },
  23008. {
  23009. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  23010. handler: function () {
  23011. win.close();
  23012. }
  23013. }
  23014. ],
  23015. keyMapEnabled: true,
  23016. keyMap: {
  23017. ENTER: function () {
  23018. resolve();
  23019. win.close();
  23020. }
  23021. }
  23022. };
  23023. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  23024. config.constrain = true;
  23025. }
  23026. var win = new Ext.Window(config);
  23027. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  23028. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  23029. }
  23030. win.show();
  23031. });
  23032. }
  23033. /**
  23034. * 任何符号字符串都替换成下换线
  23035. */
  23036. function normId(value) {
  23037. return _$2.replace(value, /[^\w]/g, '_');
  23038. }
  23039. /**
  23040. *
  23041. * @param sender
  23042. * @param propertyName
  23043. * @param gridRefName
  23044. */
  23045. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  23046. var _a, _b;
  23047. var scope = lookupScope(sender);
  23048. clearViewModelValues(scope.viewModel, propertyName);
  23049. if (!gridRefName) {
  23050. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  23051. }
  23052. else {
  23053. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  23054. }
  23055. }
  23056. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  23057. if ([10, 13, 20, 40].includes(event.keyCode)) {
  23058. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  23059. var value = _$2.trim(sender.rawValue);
  23060. raiseClick(eOpts.handle);
  23061. }
  23062. }, 150);
  23063. function saveGridRow(grid1) {
  23064. var _a;
  23065. var config = grid1.config;
  23066. var scope = lookupScope(grid1);
  23067. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  23068. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  23069. // "表格保存"的相关配置
  23070. var dbSaveConfig = {
  23071. columns: [],
  23072. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  23073. saveRowValues: saveRowValues,
  23074. path: scope.originalVjson.__custom_path,
  23075. };
  23076. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  23077. if (err) {
  23078. // 如果有异常就不保存
  23079. return;
  23080. }
  23081. // 构建"表格保存"的相关配置
  23082. for (var i = 0; i < config.columns.length; i++) {
  23083. var c = config.columns[i];
  23084. var v = {
  23085. dataIndex: c.dataIndex,
  23086. header: c.header,
  23087. dbColumn: c.dbColumn,
  23088. serverCreateValue: c.serverCreateValue,
  23089. dbIsDeleteKey: c.dbIsDeleteKey,
  23090. dbIsUpdateKey: c.dbIsUpdateKey,
  23091. dbUpdateEnable: c.dbUpdateEnable,
  23092. serverValueConvert: c.dbUpdateEnable,
  23093. };
  23094. if (c.editor) {
  23095. v.editor = {
  23096. xtype: c.editor.xtype,
  23097. required: c.editor.required,
  23098. };
  23099. }
  23100. dbSaveConfig.columns.push(v);
  23101. }
  23102. // 进行业务上的逻辑校验
  23103. var hasError = false;
  23104. _$2.forEach(rows, function (row, i) {
  23105. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  23106. var c = config.columns[i_1];
  23107. var value = row[c.dataIndex];
  23108. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  23109. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  23110. hasError = true;
  23111. return false;
  23112. }
  23113. if (c.xtype === 'checkcolumn') {
  23114. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  23115. row[c.dataIndex] = c.uncheckedValue;
  23116. }
  23117. if (value === true && typeof c.checkedValue !== 'undefined') {
  23118. row[c.dataIndex] = c.checkedValue;
  23119. }
  23120. }
  23121. }
  23122. });
  23123. if (hasError) {
  23124. return;
  23125. }
  23126. // 设置当前界面为 "保存中..." 状态
  23127. grid1.setLoading(true);
  23128. invokeServer$1('/Dev@batchSave', {
  23129. newRows: newRows,
  23130. modifyRows: modifyRows,
  23131. removeRecords: removeRecords,
  23132. config: dbSaveConfig,
  23133. }).then(function (res) {
  23134. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  23135. msg$1(res.msg);
  23136. grid1.reload();
  23137. }).catch(function (e) {
  23138. console.error(e);
  23139. showErrorDialog$1(_$2.toString(e));
  23140. }).finally(function () {
  23141. // 无论正常异常,关闭 "保存中..." 状态
  23142. grid1.setLoading(false);
  23143. });
  23144. }
  23145. function insertGridRow(grid1) {
  23146. var config = grid1.config;
  23147. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  23148. var insertRow = {};
  23149. _$2.forEach(config.columns, function (c) {
  23150. var fn = c.createValue;
  23151. if (_$2.startsWith(fn, 'scope.') ||
  23152. _$2.startsWith(fn, 'system.')) {
  23153. var scope = lookupScope(grid1);
  23154. var fn2 = lookupFn(scope, fn, c);
  23155. if (_$2.isFunction(fn2)) {
  23156. var newValue = fn2();
  23157. if (!_$2.isUndefined(newValue)) {
  23158. insertRow[c.dataIndex] = newValue;
  23159. }
  23160. }
  23161. }
  23162. else if (_$2.isString(fn) && fn) {
  23163. insertRow[c.dataIndex] = fn;
  23164. }
  23165. });
  23166. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  23167. }
  23168. function commitMe(sender) {
  23169. var window = sender.up('window');
  23170. var scope = lookupScope(sender);
  23171. if (typeof scope['commit'] === 'function') {
  23172. scope['commit']().then(function (res) {
  23173. window.close();
  23174. });
  23175. }
  23176. }
  23177. function removeGridRow(grid1) {
  23178. var _a;
  23179. var config = grid1.config;
  23180. var rows = [];
  23181. if (grid1.selModel.selType === "rowmodel") {
  23182. rows.push(grid1.selection);
  23183. }
  23184. else {
  23185. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  23186. rows.push(r);
  23187. });
  23188. }
  23189. if (rows.length > 1) {
  23190. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  23191. if (_$2.isUndefined(batchRemoveConfirm)) {
  23192. //不需要提示
  23193. _$2.forEach(rows, function (r) {
  23194. grid1.getStore().remove(r);
  23195. });
  23196. }
  23197. else {
  23198. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  23199. confirm(tip).then(function () {
  23200. _$2.forEach(rows, function (r) {
  23201. grid1.getStore().remove(r);
  23202. });
  23203. });
  23204. }
  23205. }
  23206. else if (rows.length === 1) {
  23207. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  23208. if (_$2.isUndefined(singleRemoveConfirm)) {
  23209. //不需要提示
  23210. grid1.getStore().remove(rows[0]);
  23211. }
  23212. else {
  23213. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  23214. _$2.forEach(config.columns, function (c) {
  23215. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  23216. });
  23217. confirm(tip_1).then(function () {
  23218. grid1.getStore().remove(rows[0]);
  23219. });
  23220. }
  23221. }
  23222. else {
  23223. msg$1('请选择要删除的数据!');
  23224. }
  23225. }
  23226. function moveUpGridRow(grid) {
  23227. grid.rowMoveUp();
  23228. }
  23229. function moveDownGridRow(grid) {
  23230. grid.rowMoveDown();
  23231. }
  23232. var SystemEventFu = /** @class */ (function () {
  23233. function SystemEventFu() {
  23234. }
  23235. SystemEventFu.prototype.moveUpGridRow = function () {
  23236. return function (sender) {
  23237. var grid1 = sender.up('yvgrid');
  23238. moveUpGridRow(grid1);
  23239. };
  23240. };
  23241. SystemEventFu.prototype.commitMe = function () {
  23242. return function (sender) {
  23243. commitMe(sender);
  23244. };
  23245. };
  23246. SystemEventFu.prototype.moveDownGridRow = function () {
  23247. return function (sender) {
  23248. var grid1 = sender.up('yvgrid');
  23249. moveDownGridRow(grid1);
  23250. };
  23251. };
  23252. SystemEventFu.prototype.saveGridRow = function () {
  23253. return function (sender) {
  23254. var grid1 = sender.up('yvgrid');
  23255. saveGridRow(grid1);
  23256. };
  23257. };
  23258. SystemEventFu.prototype.insertGridRow = function () {
  23259. return function (sender) {
  23260. var grid1 = sender.up('yvgrid');
  23261. insertGridRow(grid1);
  23262. };
  23263. };
  23264. SystemEventFu.prototype.removeGridRow = function () {
  23265. return function (sender) {
  23266. var grid1 = sender.up('yvgrid');
  23267. removeGridRow(grid1);
  23268. };
  23269. };
  23270. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  23271. return function (sender, config) {
  23272. if (!config.listeners) {
  23273. config.listeners = {};
  23274. }
  23275. config.listeners.afterrender = function (sender) {
  23276. var scope = lookupScope(sender);
  23277. // $(sender.el.dom).on('keydown', (e) => {
  23278. // const xtype = Ext.fly(e.target).component.xtype
  23279. // if (xtype === 'textfield' && e.keyCode === 13) {
  23280. // Ext.defer(() => {
  23281. // raiseClick(scope.refs[btnReferenceName])
  23282. // })
  23283. // e.preventDefault()
  23284. // e.stopPropagation()
  23285. // return false
  23286. // }
  23287. // })
  23288. $(sender.el.dom).on('keyup', function (e) {
  23289. var tt = Ext.fly(e.target).component;
  23290. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  23291. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  23292. ![10, 13, 20, 40].includes(e.keyCode)) {
  23293. return;
  23294. }
  23295. e.preventDefault();
  23296. e.stopPropagation();
  23297. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  23298. return;
  23299. });
  23300. };
  23301. };
  23302. };
  23303. SystemEventFu.prototype.confirm = function (text, fn) {
  23304. return function (sender) {
  23305. var scope = lookupScope(sender);
  23306. var msg = calcExpress(scope.viewModel.data, text);
  23307. confirm(msg, sender).then(function () {
  23308. fn.call(scope, sender);
  23309. });
  23310. };
  23311. };
  23312. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  23313. return function (sender) {
  23314. var scope = lookupScope(sender);
  23315. var grid = scope.refs[gridRefName];
  23316. if (grid) {
  23317. var records = grid.getSelectionModel().getLastSelected();
  23318. grid.store.remove(records);
  23319. }
  23320. };
  23321. };
  23322. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  23323. //可以是 scope.XX / system.XX / string / lookup表达式
  23324. writeTarget) {
  23325. return function (sender) {
  23326. if (!invokeUrl) {
  23327. return;
  23328. }
  23329. var scope = lookupScope(sender);
  23330. scope.setLoading(true);
  23331. var data = scope.viewModel.data;
  23332. if (invokeParam) {
  23333. data = calcObjectFlat(data, invokeParam);
  23334. }
  23335. invokeServer$1(invokeUrl, data).then(function (res) {
  23336. if (res.success) {
  23337. if (typeof writeTarget === "string") {
  23338. _$2.forOwn(res.data, function (v, k) {
  23339. scope.viewModel.set(writeTarget + "." + k, v);
  23340. });
  23341. }
  23342. else if (typeof writeTarget === 'function') {
  23343. writeTarget.call(scope, res.data);
  23344. }
  23345. else if (typeof writeTarget === 'object') {
  23346. var ret = calcObjectFlat(res.data, writeTarget);
  23347. _$2.forOwn(ret, function (v, k) {
  23348. scope.viewModel.set(k, v);
  23349. });
  23350. }
  23351. }
  23352. else {
  23353. showErrorDialog$1(res.msg || '未知错误', sender);
  23354. }
  23355. }).catch(function (e) {
  23356. var _a, _b;
  23357. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23358. showErrorDialog$1(msg || e.toString(), sender);
  23359. }).finally(function () {
  23360. scope.setLoading(false);
  23361. });
  23362. };
  23363. };
  23364. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  23365. return function (sender) {
  23366. var scope = lookupScope(sender);
  23367. scope.setLoading(true);
  23368. var data = scope.viewModel.data;
  23369. if (arg0) {
  23370. data = calcObjectFlat(data, arg0);
  23371. }
  23372. invokeServer$1(groovyUrl, data).then(function (res) {
  23373. if (res.success) {
  23374. if (res.msg) {
  23375. msg(res.msg);
  23376. }
  23377. if (typeof successCallback === 'function') {
  23378. successCallback.call(scope, sender, res.data);
  23379. }
  23380. }
  23381. else {
  23382. showErrorDialog$1(res.msg || '未知错误', sender);
  23383. }
  23384. }).catch(function (e) {
  23385. var _a, _b;
  23386. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23387. showErrorDialog$1(msg || e.toString(), sender);
  23388. }).finally(function () {
  23389. scope.setLoading(false);
  23390. });
  23391. };
  23392. };
  23393. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  23394. return function (sender) {
  23395. var scope = lookupScope(sender);
  23396. var form = scope.down('form');
  23397. if (form) {
  23398. // 如果下级有表单,就做表单校验
  23399. var valid = form.isValid();
  23400. if (!valid) {
  23401. return;
  23402. }
  23403. }
  23404. scope.setLoading(true);
  23405. var data = scope.viewModel.data;
  23406. if (arg0) {
  23407. data = calcObjectFlat(data, arg0);
  23408. }
  23409. invokeServer$1(groovyUrl, data).then(function (res) {
  23410. if (res.success) {
  23411. if (res.msg) {
  23412. msg(res.msg);
  23413. }
  23414. scope.dialogSuccess(res);
  23415. }
  23416. else {
  23417. showErrorDialog$1(res.msg || '未知错误', sender);
  23418. }
  23419. }).catch(function (e) {
  23420. var _a, _b;
  23421. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23422. showErrorDialog$1(msg || e.toString(), sender);
  23423. }).finally(function () {
  23424. scope.setLoading(false);
  23425. });
  23426. };
  23427. };
  23428. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  23429. return function (sender) {
  23430. var scope = lookupScope(sender);
  23431. if (lookupObject) {
  23432. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  23433. }
  23434. else {
  23435. scope.dialogSuccess();
  23436. }
  23437. };
  23438. };
  23439. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  23440. return function (sender) {
  23441. var scope = lookupScope(sender);
  23442. clearViewModelValues(scope.viewModel, propertyName);
  23443. };
  23444. };
  23445. SystemEventFu.prototype.getGrid = function (url) {
  23446. return function (sender, config) {
  23447. if (config.xtype == "combogridmulti") {
  23448. // @ts-ignore
  23449. require([url], function (grid) {
  23450. _$2.forOwn(grid.default, function (v, k) {
  23451. sender[k] = v;
  23452. sender.config[k] = v;
  23453. if (sender.rendered) {
  23454. // 已经渲染出来了,重新调用 reload 强制刷新
  23455. sender.reload();
  23456. }
  23457. });
  23458. });
  23459. }
  23460. else {
  23461. // @ts-ignore
  23462. require([url], function (grid) {
  23463. sender.grid = grid.default;
  23464. config.grid = grid.default;
  23465. });
  23466. }
  23467. };
  23468. };
  23469. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  23470. return function (sender) {
  23471. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  23472. };
  23473. };
  23474. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  23475. return function (sender) {
  23476. var _a, _b;
  23477. var scope = lookupScope(sender);
  23478. if (!gridRefName) {
  23479. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  23480. }
  23481. else {
  23482. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  23483. }
  23484. };
  23485. };
  23486. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  23487. return function (sender) {
  23488. var scope = lookupScope(sender);
  23489. var data = scope.viewModel.data;
  23490. var param = calcObjectFlat(data, lookupForData);
  23491. // @ts-ignore
  23492. require([url], function (module) {
  23493. var ScopeClass = module.default;
  23494. var scope = new ScopeClass();
  23495. scope.success = successCallback;
  23496. scope.showDialog(sender, {}, { data: param });
  23497. });
  23498. };
  23499. };
  23500. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  23501. return function (sender, queryValue) {
  23502. showWidget(widgetUrl, lookup, sender, queryValue);
  23503. };
  23504. };
  23505. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  23506. return function (sender) {
  23507. clearViewModelByLookup(sender, lookup);
  23508. };
  23509. };
  23510. SystemEventFu.prototype.closeMe = function (callBack) {
  23511. return function (sender) {
  23512. var scope = lookupScope(sender);
  23513. scope.close();
  23514. if (callBack) {
  23515. callBack.call(sender);
  23516. }
  23517. };
  23518. };
  23519. // 未完成
  23520. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  23521. return function (sender) {
  23522. var scope = lookupScope(sender);
  23523. var data = scope.viewModel.data;
  23524. var billSetting = scope.billSetting;
  23525. var param = calcObjectFlat(data, lookupForData);
  23526. return new Promise(function (resolve, reject) {
  23527. var sf = function (scope) {
  23528. scope.success = function (dlgScope, dlgSender, reData) {
  23529. };
  23530. scope.showDialog(sender, {}, { data: param });
  23531. };
  23532. // @ts-ignore
  23533. require([url], function (module) {
  23534. // 业务描述文件
  23535. if (url.endsWith(".bill")) {
  23536. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  23537. sf(scope);
  23538. });
  23539. }
  23540. else { //原生yvanui文件
  23541. var ScopeClass = module.default;
  23542. var scope_1 = new ScopeClass();
  23543. sf(scope_1);
  23544. }
  23545. });
  23546. });
  23547. };
  23548. };
  23549. __decorate([
  23550. Lib({
  23551. title: '为某个表格,上移行',
  23552. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23553. }),
  23554. __metadata("design:type", Function),
  23555. __metadata("design:paramtypes", []),
  23556. __metadata("design:returntype", void 0)
  23557. ], SystemEventFu.prototype, "moveUpGridRow", null);
  23558. __decorate([
  23559. Lib({
  23560. title: '为某个表格,上移行',
  23561. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23562. }),
  23563. __metadata("design:type", Function),
  23564. __metadata("design:paramtypes", []),
  23565. __metadata("design:returntype", void 0)
  23566. ], SystemEventFu.prototype, "commitMe", null);
  23567. __decorate([
  23568. Lib({
  23569. title: '为某个表格,下移行',
  23570. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23571. }),
  23572. __metadata("design:type", Function),
  23573. __metadata("design:paramtypes", []),
  23574. __metadata("design:returntype", void 0)
  23575. ], SystemEventFu.prototype, "moveDownGridRow", null);
  23576. __decorate([
  23577. Lib({
  23578. title: '为某个表格,批量保存至数据库',
  23579. author: '罗一帆',
  23580. createAt: '2022-07-19',
  23581. updateAt: '2022-07-19',
  23582. type: 'system',
  23583. category: '表格',
  23584. }),
  23585. __metadata("design:type", Function),
  23586. __metadata("design:paramtypes", []),
  23587. __metadata("design:returntype", void 0)
  23588. ], SystemEventFu.prototype, "saveGridRow", null);
  23589. __decorate([
  23590. Lib({
  23591. title: '为某个表格插入数据行',
  23592. author: '罗一帆',
  23593. createAt: '2022-07-19',
  23594. updateAt: '2022-07-19',
  23595. type: 'system',
  23596. category: '表格',
  23597. }),
  23598. __metadata("design:type", Function),
  23599. __metadata("design:paramtypes", []),
  23600. __metadata("design:returntype", void 0)
  23601. ], SystemEventFu.prototype, "insertGridRow", null);
  23602. __decorate([
  23603. Lib({
  23604. title: '为某个表格删除所选数据行',
  23605. author: '罗一帆',
  23606. createAt: '2022-07-19',
  23607. updateAt: '2022-07-19',
  23608. type: 'system',
  23609. category: '表格',
  23610. }),
  23611. __metadata("design:type", Function),
  23612. __metadata("design:paramtypes", []),
  23613. __metadata("design:returntype", void 0)
  23614. ], SystemEventFu.prototype, "removeGridRow", null);
  23615. __decorate([
  23616. Lib({
  23617. title: '按下回车键之后默认是否按下某个按钮',
  23618. author: '罗一帆',
  23619. createAt: '2021-07-02',
  23620. updateAt: '2021-07-02',
  23621. type: 'system',
  23622. category: '字典',
  23623. }),
  23624. __metadata("design:type", Function),
  23625. __metadata("design:paramtypes", [Object]),
  23626. __metadata("design:returntype", void 0)
  23627. ], SystemEventFu.prototype, "enterToClick", null);
  23628. __decorate([
  23629. Lib({
  23630. title: '弹出确认对话框,回答 YES 之后调用某方法',
  23631. author: '罗一帆',
  23632. createAt: '2021-07-06',
  23633. updateAt: '2021-07-06',
  23634. type: 'system',
  23635. category: '对话框',
  23636. }),
  23637. __param(0, LibParam('对话框的确认文字', 'string')),
  23638. __param(1, LibParam('确认之后的调用的方法', 'event')),
  23639. __metadata("design:type", Function),
  23640. __metadata("design:paramtypes", [Object, Object]),
  23641. __metadata("design:returntype", void 0)
  23642. ], SystemEventFu.prototype, "confirm", null);
  23643. __decorate([
  23644. Lib({
  23645. title: '删除表格当前的选中行(前端删除)',
  23646. author: '罗一帆',
  23647. createAt: '2021-07-08',
  23648. updateAt: '2021-07-08',
  23649. type: 'system',
  23650. category: '表格',
  23651. }),
  23652. __param(0, LibParam('表格引用名', 'refs')),
  23653. __metadata("design:type", Function),
  23654. __metadata("design:paramtypes", [Object]),
  23655. __metadata("design:returntype", void 0)
  23656. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  23657. __decorate([
  23658. Lib({
  23659. title: '查询表单,如果 url 为空值,就取消查询',
  23660. author: '罗一帆',
  23661. createAt: '2021-07-06',
  23662. updateAt: '2021-07-06',
  23663. type: 'system',
  23664. category: '表单',
  23665. }),
  23666. __param(0, LibParam('后端服务路径', 'string')),
  23667. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23668. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  23669. __metadata("design:type", Function),
  23670. __metadata("design:paramtypes", [String, Object, Object]),
  23671. __metadata("design:returntype", void 0)
  23672. ], SystemEventFu.prototype, "loadForm", null);
  23673. __decorate([
  23674. Lib({
  23675. title: '提交(不做校验、不关闭窗体)',
  23676. author: '罗一帆',
  23677. createAt: '2021-07-02',
  23678. updateAt: '2021-07-02',
  23679. type: 'system',
  23680. category: '表单',
  23681. }),
  23682. __param(0, LibParam('后端服务路径', 'string')),
  23683. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23684. __param(2, LibParam('提交成功后的回调', 'event', true)),
  23685. __metadata("design:type", Function),
  23686. __metadata("design:paramtypes", [String, Object, Object]),
  23687. __metadata("design:returntype", void 0)
  23688. ], SystemEventFu.prototype, "commit", null);
  23689. __decorate([
  23690. Lib({
  23691. title: '提交表单',
  23692. author: '罗一帆',
  23693. createAt: '2021-07-02',
  23694. updateAt: '2021-07-02',
  23695. type: 'system',
  23696. category: '表单',
  23697. }),
  23698. __param(0, LibParam('后端服务路径', 'string')),
  23699. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  23700. __metadata("design:type", Function),
  23701. __metadata("design:paramtypes", [String, Object]),
  23702. __metadata("design:returntype", void 0)
  23703. ], SystemEventFu.prototype, "formCommit", null);
  23704. __decorate([
  23705. Lib({
  23706. title: '对话框成功回调',
  23707. author: '罗一帆',
  23708. createAt: '2021-07-02',
  23709. updateAt: '2021-07-02',
  23710. type: 'system',
  23711. category: '对话框',
  23712. }),
  23713. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  23714. __metadata("design:type", Function),
  23715. __metadata("design:paramtypes", [Object]),
  23716. __metadata("design:returntype", void 0)
  23717. ], SystemEventFu.prototype, "dialogSuccess", null);
  23718. __decorate([
  23719. Lib({
  23720. title: '清空 viewModel 某个属性',
  23721. author: '罗一帆',
  23722. createAt: '2021-07-02',
  23723. updateAt: '2021-07-02',
  23724. type: 'system',
  23725. category: '表单',
  23726. }),
  23727. __param(0, LibParam('属性路径', 'viewModel', true)),
  23728. __metadata("design:type", Function),
  23729. __metadata("design:paramtypes", [String]),
  23730. __metadata("design:returntype", void 0)
  23731. ], SystemEventFu.prototype, "clearViewModelValues", null);
  23732. __decorate([
  23733. Lib({
  23734. title: '从其他资源获取表格设置',
  23735. author: '罗一帆',
  23736. createAt: '2021-07-02',
  23737. updateAt: '2021-07-02',
  23738. type: 'system',
  23739. category: '表单',
  23740. }),
  23741. __param(0, LibParam('定义文件', 'module')),
  23742. __metadata("design:type", Function),
  23743. __metadata("design:paramtypes", [Object]),
  23744. __metadata("design:returntype", void 0)
  23745. ], SystemEventFu.prototype, "getGrid", null);
  23746. __decorate([
  23747. Lib({
  23748. title: '清空 viewModel 某个属性,并刷新表格',
  23749. author: '罗一帆',
  23750. createAt: '2021-07-02',
  23751. updateAt: '2021-07-02',
  23752. type: 'system',
  23753. category: '表单',
  23754. }),
  23755. __param(0, LibParam('清空的属性', 'viewModel')),
  23756. __param(1, LibParam('要刷新的表格', 'refs', true)),
  23757. __metadata("design:type", Function),
  23758. __metadata("design:paramtypes", [String, String]),
  23759. __metadata("design:returntype", void 0)
  23760. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  23761. __decorate([
  23762. Lib({
  23763. title: '刷新表格',
  23764. author: '罗一帆',
  23765. createAt: '2021-07-02',
  23766. updateAt: '2021-07-02',
  23767. type: 'system',
  23768. category: '表单',
  23769. }),
  23770. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  23771. __metadata("design:type", Function),
  23772. __metadata("design:paramtypes", [String]),
  23773. __metadata("design:returntype", void 0)
  23774. ], SystemEventFu.prototype, "reloadGrid", null);
  23775. __decorate([
  23776. Lib({
  23777. title: '显示对话框',
  23778. author: '罗一帆',
  23779. createAt: '2021-07-02',
  23780. updateAt: '2021-07-02',
  23781. type: 'system',
  23782. category: '对话框',
  23783. }),
  23784. __param(0, LibParam('业务模块名', 'module')),
  23785. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23786. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  23787. __metadata("design:type", Function),
  23788. __metadata("design:paramtypes", [String, Object, Object]),
  23789. __metadata("design:returntype", void 0)
  23790. ], SystemEventFu.prototype, "showDialog", null);
  23791. __decorate([
  23792. Lib({
  23793. title: '弹出查找框(不借助 search)',
  23794. author: '罗一帆',
  23795. createAt: '2021-07-02',
  23796. updateAt: '2021-07-02',
  23797. type: 'system',
  23798. category: '对话框',
  23799. }),
  23800. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  23801. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  23802. __metadata("design:type", Function),
  23803. __metadata("design:paramtypes", [Object, Object]),
  23804. __metadata("design:returntype", void 0)
  23805. ], SystemEventFu.prototype, "showWidget", null);
  23806. __decorate([
  23807. Lib({
  23808. title: '根据 lookup 清空 viewModel',
  23809. author: '罗一帆',
  23810. createAt: '2021-07-05',
  23811. updateAt: '2021-07-05',
  23812. type: 'system',
  23813. category: '表单',
  23814. }),
  23815. __param(0, LibParam('设值表达式', 'lookup')),
  23816. __metadata("design:type", Function),
  23817. __metadata("design:paramtypes", [Object]),
  23818. __metadata("design:returntype", void 0)
  23819. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  23820. __decorate([
  23821. Lib({
  23822. title: '关闭对话框',
  23823. author: '罗一帆',
  23824. createAt: '2021-07-05',
  23825. updateAt: '2021-07-05',
  23826. type: 'system',
  23827. category: '对话框',
  23828. }),
  23829. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  23830. __metadata("design:type", Function),
  23831. __metadata("design:paramtypes", [Object]),
  23832. __metadata("design:returntype", void 0)
  23833. ], SystemEventFu.prototype, "closeMe", null);
  23834. __decorate([
  23835. Lib({
  23836. title: '打开对话框并返回数据',
  23837. author: '余亮',
  23838. createAt: '2022-07-07',
  23839. updateAt: '2022-07-07',
  23840. type: 'system',
  23841. category: '对话框',
  23842. }),
  23843. __param(0, LibParam('业务模块名', 'module')),
  23844. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23845. __param(2, LibParam('结果映射关系', 'string', true)),
  23846. __metadata("design:type", Function),
  23847. __metadata("design:paramtypes", [String, Object, Object]),
  23848. __metadata("design:returntype", void 0)
  23849. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  23850. return SystemEventFu;
  23851. }());
  23852. /**
  23853. * 清空 viewmodel 里下属的所有属性
  23854. * @param viewModel VM对象
  23855. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  23856. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  23857. */
  23858. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  23859. var data = viewModel.data;
  23860. if (propertyKey) {
  23861. data = _$2.get(data, propertyKey);
  23862. }
  23863. _$2.forOwn(data, function (value, key) {
  23864. var targetKey = propertyKey ? propertyKey + "." + key : key;
  23865. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  23866. return;
  23867. }
  23868. viewModel.set(targetKey, '');
  23869. });
  23870. }
  23871. function clearViewModelByLookup(sender, lookup) {
  23872. if (_$2.isPlainObject(lookup)) {
  23873. var parentScope_1 = lookupScope(sender);
  23874. _$2.forOwn(lookup, function (value, key) {
  23875. if (SIMPLE_RE.test(value)) {
  23876. // '{foo}' 简单表达式
  23877. var path = value.substring(1, value.length - 1);
  23878. if (path !== 'queryValue') {
  23879. parentScope_1.viewModel.set(path, '');
  23880. }
  23881. }
  23882. });
  23883. }
  23884. }
  23885. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  23886. if (vjson === void 0) { vjson = {}; }
  23887. var parentScope = lookupScope(sender);
  23888. var me = sender;
  23889. // @ts-ignore
  23890. require([widgetUrl], function (widgetScope) {
  23891. var WidgetScopeClass = widgetScope.default;
  23892. widgetScope = new WidgetScopeClass();
  23893. // 传递进 widget.model 的数据
  23894. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  23895. widgetScope.parentScope = parentScope;
  23896. widgetScope.searchWidgetSuccess = function (data) {
  23897. if (typeof lookup === 'string') {
  23898. // lookup 是字符串的情况下,就是取某个列作为 value 值
  23899. me.setValue(data[lookup]);
  23900. return;
  23901. }
  23902. /**
  23903. * lookup: {
  23904. * // 扩展到 viewModel 的值做更改
  23905. * WH_CODE: "{queryValue}",
  23906. * WH_NAME: "{query.WH_NAME}",
  23907. * }
  23908. */
  23909. if (_$2.isPlainObject(lookup)) {
  23910. var parentScope_2 = lookupScope(sender);
  23911. tryWriteObject(lookup, data, function (path, value) {
  23912. if (path === 'queryValue') {
  23913. me.setValue(value);
  23914. }
  23915. else {
  23916. parentScope_2.viewModel.set(path, value);
  23917. }
  23918. });
  23919. }
  23920. return true;
  23921. };
  23922. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  23923. });
  23924. }
  23925. /**
  23926. * 停止事件的默认行为
  23927. * @param e
  23928. */
  23929. function stopEvent(e) {
  23930. e.preventDefault();
  23931. e.stopPropagation();
  23932. // @ts-ignore
  23933. window.event.cancelBubble = true;
  23934. e.returnValue = false;
  23935. e.cancelBubble = true;
  23936. }
  23937. /**
  23938. * 屏幕中央显示一个黑框提示
  23939. */
  23940. function msg$1(content) {
  23941. msg(content);
  23942. }
  23943. /**
  23944. * 错误对话框的强提醒
  23945. */
  23946. function showErrorDialog$1(msg, sender) {
  23947. showErrorDialog(msg, sender);
  23948. }
  23949. /**
  23950. * 错误对话框的强提醒
  23951. */
  23952. function showInfoDialog(msg, sender) {
  23953. showInfoDialogSimple(msg, sender);
  23954. }
  23955. /**
  23956. * 错误对话框的强提醒
  23957. */
  23958. function prompt$2(message, defaultValue, multiLine) {
  23959. if (defaultValue === void 0) { defaultValue = ""; }
  23960. if (multiLine === void 0) { multiLine = false; }
  23961. return prompt$1(message, defaultValue, multiLine);
  23962. }
  23963. /**
  23964. * 用于计算 express 表达式
  23965. */
  23966. function evalFunction(data, express) {
  23967. var keys = [];
  23968. var values = [];
  23969. _$2.forOwn(data, function (value, key) {
  23970. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  23971. if (match) {
  23972. key = key.substring(0, match.index);
  23973. }
  23974. keys.push(key);
  23975. values.push(value);
  23976. });
  23977. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  23978. try {
  23979. return func.apply(void 0, __spread(values));
  23980. }
  23981. catch (e) {
  23982. return;
  23983. }
  23984. }
  23985. /**
  23986. * 获取表格编辑的行数据
  23987. */
  23988. function getGridEditRows(grid) {
  23989. return grid.getGridEditRows();
  23990. }
  23991. //# sourceMappingURL=systemLib.js.map
  23992. var SystemLib = /*#__PURE__*/Object.freeze({
  23993. __proto__: null,
  23994. SIMPLE_RE: SIMPLE_RE,
  23995. pinyinMatch: pinyinMatch,
  23996. calcExpress: calcExpress,
  23997. calcObjectFlat: calcObjectFlat,
  23998. mergeViewModel: mergeViewModel,
  23999. flatRow: flatRow,
  24000. replaceNA: replaceNA,
  24001. deepTravJson: deepTravJson,
  24002. tryWriteByExpress: tryWriteByExpress,
  24003. tryWriteObject: tryWriteObject,
  24004. tryVarSimple: tryVarSimple,
  24005. calcObject: calcObject,
  24006. getParentGrid: getParentGrid,
  24007. tryEnable: tryEnable,
  24008. setComboStore: setComboStore,
  24009. invokeServer: invokeServer$1,
  24010. clearViewModelValues: clearViewModelValues,
  24011. reloadGrid: reloadGrid,
  24012. toPlainObject: toPlainObject,
  24013. confirm: confirm,
  24014. normId: normId,
  24015. clearViewModelReloadGrid: clearViewModelReloadGrid,
  24016. saveGridRow: saveGridRow,
  24017. insertGridRow: insertGridRow,
  24018. commitMe: commitMe,
  24019. removeGridRow: removeGridRow,
  24020. moveUpGridRow: moveUpGridRow,
  24021. moveDownGridRow: moveDownGridRow,
  24022. SystemEventFu: SystemEventFu,
  24023. clearViewModel: clearViewModel,
  24024. clearViewModelByLookup: clearViewModelByLookup,
  24025. showWidget: showWidget,
  24026. stopEvent: stopEvent,
  24027. msg: msg$1,
  24028. showErrorDialog: showErrorDialog$1,
  24029. showInfoDialog: showInfoDialog,
  24030. prompt: prompt$2,
  24031. evalFunction: evalFunction,
  24032. getGridEditRows: getGridEditRows
  24033. });
  24034. function initTree () {
  24035. Ext.define('Yvan.Tree', {
  24036. extend: 'Ext.tree.Panel',
  24037. alias: 'widget.yvtree',
  24038. xtype: 'yvtree',
  24039. constructor: function (config) {
  24040. var newConfig = _$2.defaultsDeep({
  24041. // 强制性属性
  24042. }, baseConfig(config, 'row-item'), config, tree);
  24043. _$2.assign(newConfig, {
  24044. tbar: [
  24045. {
  24046. xtype: 'textfield',
  24047. // triggerCls: 'x-form-clear-trigger',
  24048. flex: 1,
  24049. emptyText: '搜索过滤',
  24050. enableKeyEvents: true,
  24051. listeners: {
  24052. change: function (sender) {
  24053. var tree = sender.up("treepanel");
  24054. tree.filterByText(this.getRawValue());
  24055. },
  24056. keyup: function (sender, e) {
  24057. var tree = sender.up("treepanel");
  24058. if (e.ESC === e.getKey()) {
  24059. sender.setValue('');
  24060. tree.filterByText('');
  24061. }
  24062. }
  24063. }
  24064. },
  24065. ],
  24066. });
  24067. if (!newConfig.hideRefresh) {
  24068. newConfig.tbar.push({
  24069. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  24070. listeners: {
  24071. click: function (sender) {
  24072. var scope = sender.up("yvtree");
  24073. scope.reload();
  24074. }
  24075. }
  24076. });
  24077. }
  24078. if (!newConfig.hideExpand) {
  24079. newConfig.tbar.push({
  24080. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  24081. listeners: {
  24082. click: function (sender) {
  24083. var scope = sender.up("yvtree");
  24084. scope.expandAll();
  24085. }
  24086. }
  24087. });
  24088. }
  24089. if (!newConfig.hideCollapse) {
  24090. newConfig.tbar.push({
  24091. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  24092. listeners: {
  24093. click: function (sender) {
  24094. var scope = sender.up("yvtree");
  24095. scope.collapseAll();
  24096. }
  24097. }
  24098. });
  24099. }
  24100. this.superclass.constructor.call(this, newConfig);
  24101. },
  24102. /**
  24103. * 在根节点上增加一个节点,会触发 addNode 事件
  24104. * @param props
  24105. */
  24106. addRoot: function (props) {
  24107. var me = this;
  24108. var tableNode = me.getRootNode();
  24109. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  24110. if (_$2.isFunction(props)) {
  24111. props = props.call(this, parent);
  24112. }
  24113. _$2.forOwn(props, function (value, key) {
  24114. fieldNode.set(key, value);
  24115. });
  24116. var node = tableNode.appendChild(fieldNode);
  24117. me.ensureVisible(node);
  24118. me.setSelection(node);
  24119. me.fireEvent('addNode', me, {
  24120. parent: tableNode,
  24121. node: node,
  24122. });
  24123. },
  24124. addLast: function (props) {
  24125. var me = this;
  24126. var sel = me.selModel.getSelection();
  24127. if (!sel || sel.length <= 0) {
  24128. msg('请选择一个要添加的同级节点路径');
  24129. return;
  24130. }
  24131. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  24132. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24133. if (_$2.isFunction(props)) {
  24134. props = props.call(this, parent);
  24135. }
  24136. _$2.forOwn(props, function (value, key) {
  24137. fieldNode.set(key, value);
  24138. });
  24139. var node = parent.appendChild(fieldNode);
  24140. me.ensureVisible(node);
  24141. me.setSelection(node);
  24142. me.fireEvent('addNode', me, {
  24143. parent: parent,
  24144. node: node,
  24145. });
  24146. },
  24147. addChildren: function (props) {
  24148. var me = this;
  24149. var sel = me.selModel.getSelection();
  24150. if (!sel || sel.length <= 0) {
  24151. msg('请选择一个要添加子节点的路径');
  24152. return;
  24153. }
  24154. var parent = sel[0];
  24155. if (_$2.isFunction(props)) {
  24156. props = props.call(this, parent);
  24157. }
  24158. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24159. _$2.forOwn(props, function (value, key) {
  24160. fieldNode.set(key, value);
  24161. });
  24162. var node = parent.appendChild(fieldNode);
  24163. parent.expand();
  24164. me.ensureVisible(node);
  24165. me.setSelection(node);
  24166. me.fireEvent('addNode', me, {
  24167. parent: parent,
  24168. node: node,
  24169. });
  24170. },
  24171. initComponent: function () {
  24172. var me = this;
  24173. var config = me.config;
  24174. var scope = lookupScope(this);
  24175. if (!isDesignMode(scope, config)) {
  24176. // 转换 dataSource 属性
  24177. convertDataSource(me, scope, config);
  24178. }
  24179. this.superclass.initComponent.call(this);
  24180. this.on({
  24181. afterrender: function (sender) {
  24182. var me = this;
  24183. var config = this.config;
  24184. var dataSource = config.dataSource;
  24185. if (config.autoLoad) {
  24186. if (config.dataSourceCallbackFn) {
  24187. me.reload();
  24188. }
  24189. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  24190. me.reload();
  24191. }
  24192. }
  24193. }
  24194. });
  24195. },
  24196. _setDataReal: function (value) {
  24197. var me = this;
  24198. // me.setStore(new Ext.data.TreeStore({
  24199. // root: {
  24200. // expanded: true,
  24201. // // children: value
  24202. // children: [
  24203. // {
  24204. // id: '1', text: 'A',
  24205. // children: [
  24206. // {id: '1', text: 'A',},
  24207. // {id: '2', text: 'B'},
  24208. // ]
  24209. // },
  24210. // {id: '2', text: 'B'},
  24211. // ]
  24212. // }
  24213. // }))
  24214. me.store.setRoot({
  24215. expanded: true,
  24216. children: value
  24217. });
  24218. // me.store = new Ext.data.TreeStore({
  24219. // root: {
  24220. // expanded: true,
  24221. // // children: value
  24222. // children: [
  24223. // {
  24224. // id: '1', text: 'A',
  24225. // children: [
  24226. // {id: '1', text: 'A',},
  24227. // {id: '2', text: 'B'},
  24228. // ]
  24229. // },
  24230. // {id: '2', text: 'B'},
  24231. // ]
  24232. // }
  24233. // })
  24234. },
  24235. /**
  24236. * 重新载入数据(重新计算参数)
  24237. */
  24238. reload: function (reloadParams) {
  24239. if (reloadParams === void 0) { reloadParams = {}; }
  24240. var me = this;
  24241. var config = me.config;
  24242. if (config.dataSourceCallbackFn) {
  24243. // 函数请求刷新
  24244. var scope_1 = lookupScope(this);
  24245. // me.setLoading(true)
  24246. config.dataSourceCallbackFn.call(scope_1, me, {
  24247. successCallback: function (value) {
  24248. me._setDataReal(value);
  24249. // me.setLoading(false)
  24250. me.fireEvent('dataLoadComplete', me, true, value);
  24251. },
  24252. failCallback: function (error) {
  24253. // me.setLoading(false)
  24254. me.fireEvent('dataLoadComplete', me, false, error);
  24255. }
  24256. });
  24257. return;
  24258. }
  24259. var scope = lookupScope(me);
  24260. var dataSource = config.dataSource;
  24261. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  24262. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  24263. me.setLoading(true);
  24264. invokeServer$1(dataSource.url, params)
  24265. .then(function (res) {
  24266. me._setDataReal(res.data);
  24267. me.fireEvent('dataLoadComplete', me, res);
  24268. })
  24269. .finally(function () {
  24270. me.setLoading(false);
  24271. });
  24272. }
  24273. },
  24274. filterByText: function (text) {
  24275. this._filterText = text;
  24276. this._filterBy(this, text, 'text');
  24277. },
  24278. _filterBy: _$2.debounce(function (me, text, by) {
  24279. var view = me.getView();
  24280. me.store.clearFilter();
  24281. if (!me._filterText) {
  24282. // 没有筛选内容,还原状态
  24283. var selections = me.getSelection();
  24284. var selectionPaths_1 = [];
  24285. _$2.forEach(me.getSelection(), function (item) {
  24286. selectionPaths_1.push(item.getPath());
  24287. });
  24288. me.collapseAll();
  24289. _$2.forEach(selectionPaths_1, function (path) {
  24290. me.expandPath(path);
  24291. });
  24292. me.setSelection(selections);
  24293. return;
  24294. }
  24295. // 递归查找所有需要可见的节点 id 数组
  24296. var nodesAndParents = [];
  24297. var expandPaths = [];
  24298. me.getRootNode().cascadeBy(function (tree, view) {
  24299. var currNode = this;
  24300. currNode.collapse();
  24301. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  24302. // 展开到匹配的路径
  24303. // me.expandPath(currNode.getPath());
  24304. expandPaths.push(currNode.getPath());
  24305. // 沿途父节点全部设定为可见
  24306. while (currNode.parentNode) {
  24307. nodesAndParents.push(currNode.id);
  24308. currNode = currNode.parentNode;
  24309. }
  24310. }
  24311. }, null, [me, view]);
  24312. me.store.filterBy(function (r) {
  24313. return Ext.Array.contains(nodesAndParents, r.get('id'));
  24314. });
  24315. _$2.forEach(expandPaths, function (path) {
  24316. me.expandPath(path);
  24317. });
  24318. }, 1000),
  24319. });
  24320. }
  24321. function convertDataSource(sender, scope, newConfig) {
  24322. if (typeof newConfig.store !== 'undefined') {
  24323. // 有 store 属性的情况下,不做任何事
  24324. return;
  24325. }
  24326. if (typeof newConfig.dataSource === 'undefined') {
  24327. // 没有定义 dataSource 的情况下,不做任何事
  24328. return;
  24329. }
  24330. var dataSource = newConfig.dataSource;
  24331. if (typeof dataSource === 'string') {
  24332. // dataSource 是字符串的情况下,找到成员函数
  24333. dataSource = lookupFn(scope, dataSource);
  24334. }
  24335. if (typeof dataSource === 'function') {
  24336. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  24337. newConfig.store = new Ext.data.TreeStore({
  24338. root: {
  24339. expanded: true,
  24340. children: []
  24341. }
  24342. });
  24343. newConfig.dataSourceCallbackFn = dataSource;
  24344. return;
  24345. }
  24346. // throw new TypeError('无法识别的调用方法')
  24347. }
  24348. //# sourceMappingURL=yvtree.js.map
  24349. /**
  24350. * 构建一个 grid 支持的 dataSource
  24351. */
  24352. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  24353. if (reloadParams === void 0) { reloadParams = {}; }
  24354. if (isExcelExport === void 0) { isExcelExport = false; }
  24355. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  24356. var _a;
  24357. var me = grid;
  24358. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  24359. var storeOption = {};
  24360. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  24361. if (dataSource.sqlId) {
  24362. dataSource.method = 'invoke';
  24363. dataSource.url = '/Dev@executeSQL';
  24364. if (_$2.startsWith(dataSource.sqlId, '@')) {
  24365. // sqlId 是 @ 开头,代表直接带中文名
  24366. var scope_1 = lookupScope(grid);
  24367. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  24368. params.sqlId = dataSource.sqlId.substring(1);
  24369. }
  24370. else {
  24371. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  24372. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  24373. params.path = path;
  24374. params.sqlId = sqlId;
  24375. }
  24376. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  24377. }
  24378. var fields_1 = [];
  24379. _$2.forEach(grid.columns, function (col) {
  24380. var c = {};
  24381. if (col.dataIndex) {
  24382. c.name = col.dataIndex;
  24383. fields_1.push(c);
  24384. }
  24385. if (col.dataType) {
  24386. c.type = col.dataType;
  24387. }
  24388. });
  24389. // 默认支持 gridInvoke
  24390. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  24391. //@ts-ignore
  24392. storeOption = {
  24393. fields: fields_1,
  24394. remoteSort: config.remoteSort,
  24395. remoteFilter: config.remoteFilter,
  24396. autoLoad: true,
  24397. pageSize: me.store.pageSize || config.pageSize,
  24398. proxy: {
  24399. type: 'jsonAjax',
  24400. $owner: me,
  24401. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  24402. extraParams: extraParams,
  24403. reader: {
  24404. type: 'json',
  24405. rootProperty: 'data',
  24406. totalProperty: 'pagination.total',
  24407. successProperty: 'success',
  24408. messageProperty: 'msg',
  24409. transform: function (data) {
  24410. if (typeof window['ajaxProcess'] === 'function') {
  24411. window['ajaxProcess'](data);
  24412. }
  24413. if (typeof window['apiTranslate'] === 'function') {
  24414. window['apiTranslate'](data, dataSource.url);
  24415. }
  24416. if (typeof grid._transform === 'function') {
  24417. // 系统转换函数
  24418. grid._transform(data.data);
  24419. }
  24420. if (grid.dataTransform) {
  24421. if (typeof grid.dataTransform === 'string') {
  24422. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  24423. }
  24424. return grid.dataTransform.call(scope, grid, data);
  24425. }
  24426. return data;
  24427. }
  24428. }
  24429. },
  24430. listeners: {
  24431. load: function (store, records, successful, operation) {
  24432. var _a, _b, _c;
  24433. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  24434. if (rep.pagination) {
  24435. grid.dbInfo = rep.pagination.dbInfo;
  24436. grid.exportDataSql = rep.pagination.exportDataSql;
  24437. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  24438. }
  24439. me.exportExcelTotal = ((_b = rep === null || rep === void 0 ? void 0 : rep.pagination) === null || _b === void 0 ? void 0 : _b.total) || ((_c = rep === null || rep === void 0 ? void 0 : rep.data) === null || _c === void 0 ? void 0 : _c.length) || 0;
  24440. if (isExcelExport) {
  24441. if (typeof excelExportCallBack === 'function') {
  24442. excelExportCallBack(rep);
  24443. }
  24444. else if (excelExportCallBack) {
  24445. console.error("导出回调方法错误!");
  24446. }
  24447. me.fireEvent('excelDataLoadComplete', me, successful, records);
  24448. }
  24449. else {
  24450. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  24451. // 自动选中第一行
  24452. var data = grid.getStore().data;
  24453. if (data.length > 0) {
  24454. grid.setSelection(data.items[0]);
  24455. }
  24456. }
  24457. me.fireEvent('dataLoadComplete', me, successful, records);
  24458. }
  24459. }
  24460. }
  24461. };
  24462. }
  24463. else if (exports.apiConvert) {
  24464. // 外部扩展的 apiConvert
  24465. //@ts-ignore
  24466. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  24467. }
  24468. else {
  24469. throw new TypeError("不支持的 API 请求方式");
  24470. }
  24471. if (isExcelExport) {
  24472. var excelStore = new Ext.data.Store(storeOption);
  24473. excelStore.load();
  24474. }
  24475. else {
  24476. if (me.groupField) {
  24477. console.log('groupField', storeOption.groupField);
  24478. storeOption.groupField = me.groupField;
  24479. }
  24480. me.setStore(new Ext.data.Store(storeOption));
  24481. }
  24482. }
  24483. function initStores () {
  24484. Ext.define('Yvan.JsonAjaxProxy', {
  24485. extend: 'Ext.data.proxy.Ajax',
  24486. alias: 'proxy.jsonAjax',
  24487. actionMethods: {
  24488. create: "POST",
  24489. read: "POST",
  24490. update: "POST",
  24491. destroy: "POST"
  24492. },
  24493. timeout: storeAjax.timeout,
  24494. buildRequest: function (operation) {
  24495. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  24496. var me = this;
  24497. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  24498. var scope = lookupScope($owner);
  24499. var gridParam = me.getParams(operation);
  24500. var customParam = {};
  24501. // 提取 srot 元素
  24502. if (gridParam.sort) {
  24503. var sort = JSON.parse(gridParam.sort);
  24504. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  24505. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  24506. customParam.sortModel = [];
  24507. _$2.forEach(sort, function (s) {
  24508. customParam.sortModel.push({
  24509. colId: s.property,
  24510. sort: _$2.toLower(s.direction)
  24511. });
  24512. });
  24513. delete gridParam.sort;
  24514. }
  24515. // 提取筛选元素
  24516. if (gridParam.filter) {
  24517. var filter = JSON.parse(gridParam.filter);
  24518. console.log('gridParam.filter', gridParam.filter);
  24519. // "[{"operator":"like","value":"1","property":"id"}]"
  24520. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  24521. customParam.filterModel = {};
  24522. _$2.forEach(filter, function (s) {
  24523. var newFilterItem = {};
  24524. if (s.operator === 'like') {
  24525. newFilterItem.filterType = 'text';
  24526. newFilterItem.type = 'contains';
  24527. newFilterItem.filter = s.value;
  24528. }
  24529. else {
  24530. // 无法识别的筛选类型
  24531. newFilterItem.filterType = 'dict';
  24532. newFilterItem.type = 'in';
  24533. newFilterItem.filter = s.value;
  24534. }
  24535. customParam.filterModel[s.property] = newFilterItem;
  24536. });
  24537. delete gridParam.filter;
  24538. }
  24539. // 被 grid.constructor 作为方法存在
  24540. var extraParams = _$2.cloneDeep(me.getExtraParams());
  24541. var params = _$2.defaultsDeep(gridParam, extraParams);
  24542. // var request = this.superclass.buildRequest.apply(this, arguments);
  24543. var request = new Ext.data.Request({
  24544. params: {},
  24545. action: operation.getAction(),
  24546. records: operation.getRecords(),
  24547. url: me.buildUrl(),
  24548. jsonData: __assign({ args: [
  24549. params
  24550. ] }, customParam),
  24551. proxy: me
  24552. });
  24553. operation.setRequest(request);
  24554. return request;
  24555. },
  24556. afterRequest: function (req, res) {
  24557. // Extend.afterExtRequest(req, res)
  24558. }
  24559. });
  24560. Ext.define('Ext.ux.data.MyReader', {
  24561. extend: 'Ext.data.reader.Json',
  24562. xtype: 'yvgridreader',
  24563. useSimpleAccessors: false,
  24564. });
  24565. }
  24566. //# sourceMappingURL=stores.js.map
  24567. function initBehaviorEdit(config) {
  24568. var _a, _b, _c;
  24569. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  24570. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  24571. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  24572. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  24573. if (dbTableName) {
  24574. // 生成增删查改
  24575. var tbar = [
  24576. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  24577. click: 'system.saveGridRow()'
  24578. }, bind: {
  24579. disabled: '{!' + config.reference + '.ischanged}'
  24580. } }, saveButtonConfig),
  24581. '-',
  24582. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  24583. click: 'system.insertGridRow()'
  24584. } }, addButtonConfig),
  24585. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  24586. click: 'system.removeGridRow()'
  24587. } }, deleteButtonConfig),
  24588. ];
  24589. if (_$2.isArray(config.tbar)) {
  24590. config.tbar = __spread(tbar, [
  24591. '-'
  24592. ], config.tbar);
  24593. }
  24594. else if (_$2.isPlainObject(config.tbar)) {
  24595. config.tbar = {
  24596. border: false,
  24597. layout: {
  24598. type: 'vbox',
  24599. align: 'stretch'
  24600. },
  24601. items: [
  24602. {
  24603. xtype: 'toolbar',
  24604. border: false,
  24605. items: tbar
  24606. },
  24607. config.tbar,
  24608. ]
  24609. };
  24610. }
  24611. else if (_$2.isUndefined(config.tbar)) {
  24612. config.tbar = tbar;
  24613. }
  24614. else {
  24615. console.error("can't build tbar property!", config.tbar);
  24616. }
  24617. }
  24618. }
  24619. //# sourceMappingURL=grid_behavior.js.map
  24620. function initGridDialog(config) {
  24621. var detailDialog = _$2.get(config, 'detailDialog');
  24622. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  24623. if (_$2.isPlainObject(detailDialog)) {
  24624. var tbar = [
  24625. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  24626. click: 'system.showGridRowDetail()',
  24627. }, bind: {
  24628. disabled: '{!' + config.reference + '.selection}'
  24629. } }, detailButtonConfig)
  24630. ];
  24631. if (_$2.isArray(config.tbar)) {
  24632. config.tbar = __spread(config.tbar, [
  24633. '-'
  24634. ], tbar);
  24635. }
  24636. else if (_$2.isPlainObject(config.tbar)) {
  24637. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  24638. config.tbar.items = __spread(config.tbar.items);
  24639. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  24640. if (!toolbar) {
  24641. config.tbar.items = __spread(config.tbar.items, [
  24642. {
  24643. xtype: 'toolbar',
  24644. border: false,
  24645. items: tbar
  24646. },
  24647. ]);
  24648. }
  24649. else {
  24650. toolbar.items = __spread(toolbar.items, [
  24651. '-'
  24652. ], tbar);
  24653. }
  24654. }
  24655. else {
  24656. config.tbar = {
  24657. border: false,
  24658. layout: {
  24659. type: 'vbox',
  24660. align: 'stretch'
  24661. },
  24662. items: [
  24663. {
  24664. xtype: 'toolbar',
  24665. border: false,
  24666. items: tbar
  24667. },
  24668. config.tbar,
  24669. ]
  24670. };
  24671. }
  24672. }
  24673. else if (_$2.isUndefined(config.tbar)) {
  24674. config.tbar = tbar;
  24675. }
  24676. else {
  24677. console.error("can't build tbar property!", config.tbar);
  24678. }
  24679. }
  24680. }
  24681. var SystemEventFu$1 = /** @class */ (function () {
  24682. function SystemEventFu() {
  24683. }
  24684. SystemEventFu.prototype.showGridRowDetail = function () {
  24685. return function (sender) {
  24686. var grid1 = sender.up('yvgrid');
  24687. showGridRowDetail(grid1);
  24688. };
  24689. };
  24690. __decorate([
  24691. Lib({
  24692. title: '为某个表格所选数据行, 显示其对话框',
  24693. author: '罗一帆',
  24694. createAt: '2022-07-27',
  24695. updateAt: '2022-07-27',
  24696. type: 'system',
  24697. category: '表格',
  24698. }),
  24699. __metadata("design:type", Function),
  24700. __metadata("design:paramtypes", []),
  24701. __metadata("design:returntype", void 0)
  24702. ], SystemEventFu.prototype, "showGridRowDetail", null);
  24703. return SystemEventFu;
  24704. }());
  24705. function showGridRowDetail(grid1, isEdit) {
  24706. if (isEdit === void 0) { isEdit = true; }
  24707. var _a, _b, _c;
  24708. if (!grid1.selection) {
  24709. msg$1('请选中要展示的数据行!');
  24710. return;
  24711. }
  24712. var record = grid1.selection;
  24713. if (_$2.isArray(record)) {
  24714. record = record[0];
  24715. }
  24716. if (!record) {
  24717. msg$1('请选中要展示的数据行!');
  24718. return;
  24719. }
  24720. var config = grid1._originVJson;
  24721. var detailDialog = config.detailDialog;
  24722. var vjson = {};
  24723. var parentScope = lookupScope(grid1);
  24724. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  24725. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  24726. _$2.defaultsDeep(vjson, {
  24727. // 强制属性
  24728. layout: 'fit',
  24729. __custom_path: __custom_path,
  24730. __custom_version: __custom_version,
  24731. fbar: __spread([
  24732. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  24733. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  24734. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  24735. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  24736. }, detailDialog, {
  24737. // 默认属性
  24738. width: 800,
  24739. height: 450,
  24740. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  24741. });
  24742. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  24743. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  24744. vjson.items.push(tabpanel);
  24745. if (tabpanel) {
  24746. // 有多个选项卡,按每个选项卡进行过滤
  24747. _$2.forEach(tabpanel.items, function (tab) {
  24748. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  24749. if (tabColumns.length > 0) {
  24750. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  24751. _$2.extend(tab, tabVjson);
  24752. }
  24753. });
  24754. }
  24755. }
  24756. else {
  24757. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  24758. }
  24759. var model = {
  24760. data: {
  24761. _edit: isEdit,
  24762. _editType: isEdit ? '编辑' : '添加',
  24763. }
  24764. };
  24765. _$2.forOwn(record.data, function (value, key) {
  24766. if (key === 'id') {
  24767. // 忽略 ID 属性
  24768. return;
  24769. }
  24770. if (_$2.startsWith(key, '_')) {
  24771. // 忽略 _ 开头的所有属性
  24772. return;
  24773. }
  24774. model.data[key] = value;
  24775. });
  24776. console.log(vjson);
  24777. var scope = new Scope({ vjson: vjson, model: model, });
  24778. //@ts-ignore
  24779. scope.commit = function () {
  24780. return new Promise(function (resolve) {
  24781. _$2.forOwn(scope.viewModel.data, function (value, key) {
  24782. if (_$2.startsWith(key, '_')) {
  24783. // _origin 等属性可以被忽略
  24784. return;
  24785. }
  24786. if (key === 'id') {
  24787. // id 属性被忽略
  24788. return;
  24789. }
  24790. record.set(key, value);
  24791. });
  24792. resolve();
  24793. });
  24794. };
  24795. scope.showDialog(grid1, {}, {});
  24796. }
  24797. function buildForm(columns, tabpanel, detailDialog) {
  24798. var vjson = __assign({ border: false, layout: {
  24799. type: 'vbox',
  24800. pack: 'start',
  24801. align: 'stretch'
  24802. }, defaults: {
  24803. border: false,
  24804. anchor: '100%',
  24805. margin: '5',
  24806. }, scrollable: true, items: [] }, detailDialog.form);
  24807. var emptyFieldset = [];
  24808. var fieldsetList = [];
  24809. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  24810. _$2.forEach(columns, function (c) {
  24811. var fieldset = _$2.get(c, 'form.fieldset');
  24812. if (fieldset) {
  24813. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  24814. if (idx < 0) {
  24815. fieldsetList.push({
  24816. fieldset: fieldset,
  24817. columns: [c]
  24818. });
  24819. }
  24820. else {
  24821. fieldsetList[idx].columns.push(c);
  24822. }
  24823. }
  24824. else {
  24825. emptyFieldset.push(c);
  24826. }
  24827. });
  24828. _$2.forEach(fieldsetList, function (fs) {
  24829. var fieldSetVjson = {
  24830. xtype: 'fieldset',
  24831. title: fs.fieldset,
  24832. items: []
  24833. };
  24834. buildFieldItems(fieldSetVjson.items, fs.columns);
  24835. vjson.items.push(fieldSetVjson);
  24836. });
  24837. buildFieldItems(vjson.items, emptyFieldset);
  24838. return vjson;
  24839. }
  24840. // 构建字段组
  24841. function buildFieldItems(items, columns) {
  24842. var _a, _b, _c, _d, _e;
  24843. var row = {
  24844. xtype: 'cols',
  24845. items: []
  24846. };
  24847. for (var i = 0; i < columns.length; i++) {
  24848. var column = columns[i];
  24849. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  24850. delete row.xtype;
  24851. row.layout = column.form.rowlayout;
  24852. }
  24853. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  24854. row.items.push({ border: false, flex: column.form.prefix });
  24855. }
  24856. var fieldVjson = buildField(column, row.items.length);
  24857. if (!fieldVjson) {
  24858. continue;
  24859. }
  24860. row.items.push(fieldVjson);
  24861. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  24862. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  24863. }
  24864. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  24865. items.push(row);
  24866. row = {
  24867. xtype: 'cols',
  24868. items: []
  24869. };
  24870. }
  24871. }
  24872. if (row.items.length > 0) {
  24873. items.push(row);
  24874. }
  24875. }
  24876. // 构建字段
  24877. function buildField(column, colIdx) {
  24878. var ret;
  24879. if (column.xtype === 'checkcolumn') {
  24880. ret = _$2.defaultsDeep({
  24881. xtype: 'checkbox',
  24882. uncheckedValue: column.uncheckedValue,
  24883. checkedValue: column.checkedValue,
  24884. boxLabel: column.header,
  24885. bind: {
  24886. value: '{' + column.dataIndex + '}'
  24887. }
  24888. }, column.form);
  24889. if (colIdx == 0) {
  24890. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  24891. ret.margin = '0 0 0 85';
  24892. }
  24893. }
  24894. else {
  24895. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  24896. fieldLabel: column.header,
  24897. bind: {
  24898. value: '{' + column.dataIndex + '}'
  24899. },
  24900. });
  24901. }
  24902. if (!ret.xtype) {
  24903. return;
  24904. }
  24905. if (!ret.dict && ret.xtype === 'combo') {
  24906. ret.dict = column.dict;
  24907. }
  24908. // 删除辅助属性
  24909. delete ret.order;
  24910. delete ret.wrap;
  24911. return ret;
  24912. }
  24913. //# sourceMappingURL=grid_dialog.js.map
  24914. var model$o = {
  24915. data: {}
  24916. };
  24917. //# sourceMappingURL=GridColumnCustom.model.js.map
  24918. var vjson$o = {
  24919. title: '自定义表格属性',
  24920. layout: 'fit',
  24921. width: 980,
  24922. height: 500,
  24923. fbar: [
  24924. {
  24925. xtype: "button",
  24926. text: "保存",
  24927. iconCls: 'x-fa fa-save',
  24928. listeners: {
  24929. click: 'scope.commit',
  24930. }
  24931. },
  24932. {
  24933. xtype: "button",
  24934. text: "关闭",
  24935. iconCls: 'x-fa fa-times',
  24936. listeners: {
  24937. click: 'system.closeMe()',
  24938. }
  24939. },
  24940. ],
  24941. items: [
  24942. {
  24943. region: 'center',
  24944. xtype: 'tabpanel',
  24945. items: [
  24946. {
  24947. title: '基本信息', reference: 'basic',
  24948. layout: {
  24949. type: 'vbox',
  24950. pack: 'start',
  24951. align: 'stretch'
  24952. },
  24953. defaults: {
  24954. border: false,
  24955. anchor: '100%',
  24956. margin: '5',
  24957. },
  24958. scrollable: true,
  24959. items: [
  24960. {
  24961. xtype: 'cols',
  24962. items: [
  24963. {
  24964. fieldLabel: '路径',
  24965. bind: { value: '{__custom_path}' },
  24966. xtype: 'textfield',
  24967. flex: 2,
  24968. },
  24969. {
  24970. fieldLabel: '版本',
  24971. bind: { value: '{__custom_version}' },
  24972. xtype: 'textfield',
  24973. },
  24974. ]
  24975. },
  24976. {
  24977. xtype: 'cols',
  24978. items: [
  24979. {
  24980. fieldLabel: '配置点',
  24981. bind: { value: '{__custom_point}' },
  24982. xtype: 'textfield',
  24983. },
  24984. {
  24985. fieldLabel: 'reference',
  24986. bind: { value: '{reference}' },
  24987. xtype: 'textfield',
  24988. },
  24989. {
  24990. fieldLabel: '编辑模式',
  24991. bind: { value: '{_mode}' },
  24992. xtype: 'combo',
  24993. dict: 'GRID_MODE',
  24994. },
  24995. ]
  24996. },
  24997. {
  24998. layout: 'hbox',
  24999. defaults: {
  25000. margin: '0 0 0 15',
  25001. },
  25002. items: [
  25003. {
  25004. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  25005. bind: {
  25006. value: "{hideFootbar}"
  25007. }
  25008. },
  25009. {
  25010. boxLabel: '隐藏刷新', xtype: 'checkbox',
  25011. bind: {
  25012. value: "{hideRefresh}"
  25013. }
  25014. },
  25015. {
  25016. boxLabel: '隐藏导出', xtype: 'checkbox',
  25017. bind: {
  25018. value: "{hideExport}"
  25019. }
  25020. },
  25021. {
  25022. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  25023. bind: {
  25024. value: "{hideAutoSize}"
  25025. }
  25026. },
  25027. {
  25028. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  25029. bind: {
  25030. value: "{hideClearFilter}"
  25031. }
  25032. },
  25033. {
  25034. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  25035. bind: {
  25036. value: "{hideSaveGridUIConfig}"
  25037. }
  25038. },
  25039. {
  25040. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  25041. bind: {
  25042. value: "{hideClearGridUIConfig}"
  25043. }
  25044. },
  25045. ]
  25046. },
  25047. {
  25048. layout: 'hbox',
  25049. defaults: {
  25050. margin: '0 0 0 15',
  25051. },
  25052. items: [
  25053. {
  25054. boxLabel: '自动载入数据源', xtype: 'checkbox',
  25055. bind: { value: '{autoLoad}' },
  25056. margin: '0 0 0 85',
  25057. },
  25058. {
  25059. boxLabel: '分页模式', xtype: 'checkbox',
  25060. bind: { value: '{pagination}' },
  25061. },
  25062. {
  25063. boxLabel: '显示行序号', xtype: 'checkbox',
  25064. bind: { value: '{show_rownum}' },
  25065. },
  25066. {
  25067. boxLabel: '后端排序', xtype: 'checkbox',
  25068. bind: {
  25069. value: "{remoteSort}"
  25070. }
  25071. },
  25072. {
  25073. boxLabel: '后端过滤', xtype: 'checkbox',
  25074. bind: {
  25075. value: "{remoteFilter}"
  25076. }
  25077. },
  25078. {
  25079. boxLabel: '隐藏', xtype: 'checkbox',
  25080. bind: {
  25081. value: "{hidden}"
  25082. }
  25083. },
  25084. ]
  25085. },
  25086. {
  25087. layout: 'hbox',
  25088. defaults: {
  25089. margin: '0 0 0 15',
  25090. },
  25091. items: [
  25092. {
  25093. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  25094. bind: {
  25095. value: "{enableColumnHide}"
  25096. }
  25097. },
  25098. {
  25099. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  25100. bind: {
  25101. value: "{enableColumnMove}"
  25102. }
  25103. },
  25104. {
  25105. boxLabel: '自定义筛选', xtype: 'checkbox',
  25106. bind: {
  25107. value: "{gridfilters}"
  25108. }
  25109. },
  25110. {
  25111. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  25112. bind: {
  25113. value: "{enableColumnResize}"
  25114. }
  25115. },
  25116. {
  25117. boxLabel: '点击列头排序', xtype: 'checkbox',
  25118. bind: {
  25119. value: "{sortOnClick}"
  25120. }
  25121. },
  25122. ]
  25123. },
  25124. {
  25125. xtype: 'cols',
  25126. items: [
  25127. {
  25128. fieldLabel: 'dbTableName',
  25129. labelWidth: 110,
  25130. bind: { value: '{behavior.dbTableName}' },
  25131. xtype: 'textfield',
  25132. },
  25133. {
  25134. fieldLabel: 'theid',
  25135. bind: { value: '{theid}' },
  25136. xtype: 'textfield',
  25137. },
  25138. {
  25139. fieldLabel: '添加行聚焦',
  25140. bind: { value: '{behavior.focusColumnAfterInsert}' },
  25141. xtype: 'textfield',
  25142. },
  25143. ]
  25144. },
  25145. {
  25146. xtype: 'cols',
  25147. items: [
  25148. {
  25149. fieldLabel: '批量删除提示',
  25150. labelWidth: 110,
  25151. bind: { value: '{behavior.batchRemoveConfirm}' },
  25152. xtype: 'textfield',
  25153. },
  25154. {
  25155. fieldLabel: '删除提示',
  25156. bind: { value: '{behavior.singleRemoveConfirm}' },
  25157. xtype: 'textfield',
  25158. },
  25159. {
  25160. fieldLabel: '触发刷新',
  25161. labelWidth: 110,
  25162. bind: { value: '{behavior.selectToReload}' },
  25163. xtype: 'textfield',
  25164. },
  25165. ]
  25166. },
  25167. ]
  25168. },
  25169. {
  25170. title: '字段', reference: 'grid1',
  25171. xtype: 'yvgrid',
  25172. pagination: false,
  25173. _mode: 'edit',
  25174. listeners: {
  25175. buttonclick: 'scope.grid1Buttonclick',
  25176. },
  25177. hideFootbar: true,
  25178. tbar: [
  25179. {
  25180. xtype: 'button',
  25181. text: '添加',
  25182. iconCls: 'x-fa fa-plus-circle',
  25183. listeners: {
  25184. click: 'scope.addField'
  25185. }
  25186. },
  25187. {
  25188. xtype: 'button',
  25189. text: '删除',
  25190. iconCls: 'x-fa fa-minus-circle',
  25191. listeners: {
  25192. click: 'scope.removeField'
  25193. }
  25194. },
  25195. '-',
  25196. {
  25197. xtype: 'button',
  25198. text: '自动分析',
  25199. iconCls: 'x-fa fa-code-fork',
  25200. listeners: {
  25201. click: 'scope.calcField'
  25202. }
  25203. },
  25204. {
  25205. xtype: 'button',
  25206. text: '上移',
  25207. iconCls: 'x-fa fa-arrow-up',
  25208. listeners: {
  25209. click: 'scope.moveUp'
  25210. }
  25211. },
  25212. {
  25213. xtype: 'button',
  25214. text: '下移',
  25215. iconCls: 'x-fa fa-arrow-down',
  25216. listeners: {
  25217. click: 'scope.moveDown'
  25218. }
  25219. },
  25220. ],
  25221. store: {},
  25222. columns: [
  25223. {
  25224. dataIndex: 'dataIndex', header: "字段名", width: 140,
  25225. editor: { xtype: 'textfield' }
  25226. },
  25227. {
  25228. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  25229. editor: { xtype: 'textfield' }
  25230. },
  25231. {
  25232. dataIndex: 'header', header: '中文', width: 140,
  25233. editor: { xtype: 'textfield' }
  25234. },
  25235. {
  25236. dataIndex: 'dict', header: '字典', width: 110,
  25237. editor: { xtype: 'combogrid' }
  25238. },
  25239. {
  25240. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  25241. editor: { xtype: 'combogrid' }, hidden: true,
  25242. },
  25243. {
  25244. dataIndex: 'width', header: '宽度', width: 80,
  25245. editor: { xtype: 'numberfield' }, hidden: true,
  25246. },
  25247. {
  25248. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  25249. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  25250. },
  25251. {
  25252. dataIndex: 'serverCreateValue', header: '服务端创建值',
  25253. editor: { xtype: 'textfield' },
  25254. },
  25255. {
  25256. dataIndex: 'createValue', text: '客户端新创建值',
  25257. editor: { xtype: 'textfield' },
  25258. },
  25259. {
  25260. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  25261. resizable: false, sortable: false, menuDisabled: true,
  25262. checkedValue: true, uncheckedValue: false,
  25263. },
  25264. {
  25265. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  25266. resizable: false, sortable: false, menuDisabled: true,
  25267. checkedValue: true, uncheckedValue: false,
  25268. },
  25269. {
  25270. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  25271. resizable: false, sortable: false, menuDisabled: true,
  25272. checkedValue: true, uncheckedValue: false,
  25273. },
  25274. {
  25275. dataIndex: 'formatter', header: '格式化', width: 110,
  25276. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  25277. },
  25278. {
  25279. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  25280. resizable: false, sortable: false, menuDisabled: true,
  25281. checkedValue: true, uncheckedValue: false, hidden: true,
  25282. },
  25283. {
  25284. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  25285. resizable: false, sortable: false, menuDisabled: true,
  25286. hidden: true,
  25287. },
  25288. {
  25289. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  25290. resizable: false, sortable: false, menuDisabled: true,
  25291. checkedValue: true, uncheckedValue: false, hidden: true,
  25292. },
  25293. {
  25294. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  25295. resizable: false, sortable: false, menuDisabled: true,
  25296. },
  25297. {
  25298. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  25299. resizable: false, sortable: false, menuDisabled: true,
  25300. checkedValue: true, uncheckedValue: false, hidden: true,
  25301. },
  25302. {
  25303. dataIndex: 'form_order', text: '对话框序号',
  25304. editor: { xtype: 'numberfield' },
  25305. },
  25306. {
  25307. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  25308. resizable: false, sortable: false, menuDisabled: true,
  25309. checkedValue: true, uncheckedValue: false,
  25310. },
  25311. {
  25312. dataIndex: 'form_xtype', text: '对话框编辑器',
  25313. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  25314. },
  25315. {
  25316. dataIndex: 'form_fieldset', text: '对话框字段组',
  25317. editor: { xtype: 'textfield' }, hidden: true,
  25318. },
  25319. {
  25320. dataIndex: 'form_tab', text: '对话框选项卡',
  25321. editor: { xtype: 'textfield' }, hidden: true,
  25322. },
  25323. {
  25324. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  25325. resizable: false, sortable: false, menuDisabled: true,
  25326. checkedValue: true, uncheckedValue: false, hidden: true,
  25327. },
  25328. ],
  25329. },
  25330. {
  25331. title: 'SQL和查询条件', reference: 'sql',
  25332. layout: 'border',
  25333. border: false,
  25334. items: [
  25335. {
  25336. region: 'north',
  25337. height: 200,
  25338. border: false,
  25339. split: true,
  25340. xtype: 'yvgrid',
  25341. reference: 'gridCondition',
  25342. pagination: false,
  25343. hideFootbar: true,
  25344. _mode: 'edit',
  25345. listeners: {
  25346. buttonclick: 'scope.conditionButtonclick',
  25347. },
  25348. store: {},
  25349. tbar: {
  25350. xtype: 'toolbar',
  25351. border: false,
  25352. items: [
  25353. {
  25354. xtype: 'button',
  25355. text: '添加条件',
  25356. iconCls: 'x-fa fa-plus-circle',
  25357. listeners: {
  25358. click: 'scope.addCondition'
  25359. }
  25360. },
  25361. {
  25362. xtype: 'button',
  25363. text: '删除条件',
  25364. iconCls: 'x-fa fa-minus-circle',
  25365. listeners: {
  25366. click: 'scope.removeCondition'
  25367. }
  25368. },
  25369. '-',
  25370. {
  25371. xtype: 'button',
  25372. text: '自动分析条件变量',
  25373. iconCls: 'x-fa fa-code-fork',
  25374. listeners: {
  25375. click: 'scope.calcCondition'
  25376. }
  25377. },
  25378. {
  25379. xtype: 'button',
  25380. text: '上移',
  25381. iconCls: 'x-fa fa-arrow-up',
  25382. listeners: {
  25383. click: 'scope.moveUpCondition'
  25384. }
  25385. },
  25386. {
  25387. xtype: 'button',
  25388. text: '下移',
  25389. iconCls: 'x-fa fa-arrow-down',
  25390. listeners: {
  25391. click: 'scope.moveDownCondition'
  25392. }
  25393. },
  25394. ]
  25395. },
  25396. columns: [
  25397. {
  25398. text: '条件变量',
  25399. dataIndex: 'param_name',
  25400. width: 140,
  25401. sortable: false,
  25402. menuDisabled: true,
  25403. editor: {
  25404. selectOnFocus: true
  25405. },
  25406. },
  25407. {
  25408. text: '中文标题',
  25409. dataIndex: 'fieldLabel',
  25410. width: 120,
  25411. sortable: false,
  25412. menuDisabled: true,
  25413. editor: {
  25414. selectOnFocus: true
  25415. },
  25416. },
  25417. {
  25418. text: '编辑类型',
  25419. dataIndex: 'xtype',
  25420. width: 80,
  25421. sortable: false,
  25422. menuDisabled: true,
  25423. editor: {
  25424. xtype: 'combo',
  25425. typeAhead: true,
  25426. triggerAction: 'all',
  25427. selectOnFocus: true,
  25428. store: [
  25429. ['textfield', 'textfield'],
  25430. ['combo', 'combo'],
  25431. ['datefield', 'datefield'],
  25432. ['datetimefield', 'datetimefield'],
  25433. ['numberfield', 'numberfield'],
  25434. ['multiplesearch', 'multiplesearch'],
  25435. ]
  25436. }
  25437. },
  25438. {
  25439. text: '权重',
  25440. dataIndex: 'conditionFieldFlex',
  25441. align: 'right',
  25442. width: 60,
  25443. sortable: false,
  25444. menuDisabled: true,
  25445. editor: {
  25446. xtype: 'numberfield',
  25447. selectOnFocus: false,
  25448. minValue: 0,
  25449. maxValue: 10
  25450. },
  25451. },
  25452. {
  25453. text: '字典',
  25454. dataIndex: 'conditionFieldDict',
  25455. width: 160,
  25456. sortable: false,
  25457. menuDisabled: true,
  25458. editor: {
  25459. selectOnFocus: false
  25460. },
  25461. },
  25462. {
  25463. xtype: 'checkcolumn',
  25464. dataIndex: "conditionFieldWrap", header: "换行",
  25465. width: 65,
  25466. sortable: false,
  25467. menuDisabled: true,
  25468. },
  25469. {
  25470. text: '扩展参数',
  25471. dataIndex: 'conditionFieldExtend',
  25472. sortable: false,
  25473. menuDisabled: true,
  25474. editor: {
  25475. selectOnFocus: false
  25476. },
  25477. },
  25478. ]
  25479. },
  25480. {
  25481. region: 'center',
  25482. xtype: 'sqleditor',
  25483. layout: 'fit',
  25484. reference: 'sqlEditor',
  25485. split: true,
  25486. },
  25487. ]
  25488. },
  25489. {
  25490. title: '详情对话框',
  25491. layout: {
  25492. type: 'vbox',
  25493. pack: 'start',
  25494. align: 'stretch'
  25495. },
  25496. defaults: {
  25497. border: false,
  25498. anchor: '100%',
  25499. margin: '5',
  25500. },
  25501. scrollable: true,
  25502. items: [
  25503. {
  25504. xtype: 'cols',
  25505. items: [
  25506. {
  25507. fieldLabel: '对话框标题',
  25508. bind: { value: '{detailDialog.title}' },
  25509. xtype: 'textfield',
  25510. flex: 2,
  25511. },
  25512. {
  25513. fieldLabel: '宽度',
  25514. bind: { value: '{detailDialog.width}' },
  25515. xtype: 'numberfield',
  25516. },
  25517. {
  25518. fieldLabel: '高度',
  25519. bind: { value: '{detailDialog.height}' },
  25520. xtype: 'numberfield',
  25521. },
  25522. ]
  25523. },
  25524. ]
  25525. },
  25526. {
  25527. title: '界面源码',
  25528. xtype: 'jseditor',
  25529. reference: 'jseditor'
  25530. }
  25531. ]
  25532. }
  25533. ]
  25534. };
  25535. //# sourceMappingURL=GridColumnCustom.view.js.map
  25536. var GridColumnCustom = /** @class */ (function (_super) {
  25537. __extends(GridColumnCustom, _super);
  25538. function GridColumnCustom() {
  25539. return _super.call(this, { model: model$o, vjson: vjson$o }) || this;
  25540. }
  25541. GridColumnCustom.prototype.commit = function () {
  25542. };
  25543. GridColumnCustom.prototype.grid1Buttonclick = function () {
  25544. };
  25545. GridColumnCustom.prototype.conditionButtonclick = function () {
  25546. };
  25547. GridColumnCustom.prototype.addField = function () {
  25548. };
  25549. GridColumnCustom.prototype.removeField = function () {
  25550. };
  25551. GridColumnCustom.prototype.calcField = function () {
  25552. };
  25553. GridColumnCustom.prototype.moveUp = function () {
  25554. };
  25555. GridColumnCustom.prototype.moveDown = function () {
  25556. };
  25557. GridColumnCustom.prototype.addCondition = function () {
  25558. };
  25559. GridColumnCustom.prototype.removeCondition = function () {
  25560. };
  25561. GridColumnCustom.prototype.calcCondition = function () {
  25562. };
  25563. GridColumnCustom.prototype.moveUpCondition = function () {
  25564. };
  25565. GridColumnCustom.prototype.moveDownCondition = function () {
  25566. };
  25567. return GridColumnCustom;
  25568. }(Scope));
  25569. //# sourceMappingURL=GridColumnCustom.js.map
  25570. function initGridCode(grid, newConfig, buttons) {
  25571. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  25572. buttons.push({
  25573. xtype: 'button',
  25574. tooltip: '定义表格属性',
  25575. iconCls: 'x-fa fa-codepen',
  25576. handler: function (btn) {
  25577. var customWindow = new GridColumnCustom();
  25578. customWindow.showDialog(btn, {}, {});
  25579. }
  25580. });
  25581. buttons.push({
  25582. xtype: 'button',
  25583. tooltip: '定义表格数据源',
  25584. iconCls: 'x-fa fa-database',
  25585. handler: function () {
  25586. // showCustomGridDataSource(grid)
  25587. }
  25588. });
  25589. }
  25590. }
  25591. //# sourceMappingURL=grid_code.js.map
  25592. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  25593. var hexToString = function (hex) {
  25594. var arr = hex.split("");
  25595. var out = "";
  25596. for (var i = 0; i < arr.length / 2; i++) {
  25597. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  25598. // @ts-ignore
  25599. var charValue = String.fromCharCode(tmp);
  25600. out += charValue;
  25601. }
  25602. return out;
  25603. };
  25604. var defaultGrid = grid;
  25605. function initGrid () {
  25606. Ext.define('Yvan.Grid', {
  25607. extend: 'Ext.grid.Panel',
  25608. xtype: 'yvgrid',
  25609. __suspendReload: false,
  25610. _originVJson: {},
  25611. constructor: function (config) {
  25612. var _this = this;
  25613. var _a, _b, _c, _d, _e, _f;
  25614. var me = this;
  25615. var dataSource = config.dataSource;
  25616. var scope = ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.yvanScope) || ((_c = (_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.lookupReferenceHolder()) === null || _c === void 0 ? void 0 : _c.yvanScope) || ((_d = config.$vmParent) === null || _d === void 0 ? void 0 : _d.yvanScope) || ((_f = (_e = config.$vmParent) === null || _e === void 0 ? void 0 : _e._parent) === null || _f === void 0 ? void 0 : _f.yvanScope);
  25617. me._originVJson = config;
  25618. if (!isDesignMode(scope, config)) {
  25619. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  25620. if (Array.isArray(config.columns) && config.columns.length > 0) {
  25621. var cacheData = this.getColumnConfigCache();
  25622. if (Array.isArray(cacheData) && cacheData.length > 0) {
  25623. var newColumns = [];
  25624. for (var j = 0; j < cacheData.length; j++) {
  25625. var itData = cacheData[j];
  25626. for (var i = 0; i < config.columns.length; i++) {
  25627. var column = config.columns[i];
  25628. if (itData.dataIndex === column.dataIndex) {
  25629. if (itData.width) {
  25630. column.width = itData.width;
  25631. }
  25632. column.hidden = itData.hidden;
  25633. column.locked = itData.locked;
  25634. newColumns.push(column);
  25635. break;
  25636. }
  25637. }
  25638. }
  25639. config.columns = newColumns;
  25640. }
  25641. }
  25642. }
  25643. var newConfig = _$2.defaultsDeep({
  25644. // 强制性属性 bug.
  25645. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  25646. // enableLocking: false,
  25647. // syncRowHeight: false,
  25648. }, baseConfig(config, 'row-item'), config, grid);
  25649. // 在面板上的组件
  25650. // const scope = newConfig.$initParent?.yvanScope ||
  25651. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  25652. // config.$vmParent?.yvanScope ||
  25653. // newConfig.$vmParent?._parent?.yvanScope;
  25654. var buttons = [];
  25655. var getRowClass = newConfig.getRowClass;
  25656. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  25657. _$2.startsWith(getRowClass, "system."))) {
  25658. var fn = lookupFn(scope, getRowClass);
  25659. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  25660. }
  25661. if (!newConfig.hideExport) {
  25662. buttons.push({
  25663. xtype: 'button',
  25664. tooltip: '导出Excel',
  25665. iconCls: 'x-fa fa-download',
  25666. listeners: {
  25667. click: this.exportExcel
  25668. },
  25669. });
  25670. }
  25671. if (!newConfig.hideAutoSize) {
  25672. buttons.push({
  25673. xtype: 'button',
  25674. iconCls: 'x-fa fa-text-width',
  25675. tooltip: '自适应宽度',
  25676. listeners: {
  25677. click: this.autoSizeColumns
  25678. }
  25679. });
  25680. }
  25681. if (!newConfig.hideClearFilter) {
  25682. buttons.push({
  25683. xtype: 'button',
  25684. tooltip: '清空筛选',
  25685. iconCls: 'x-fa fa-filter',
  25686. handler: this.clearFilter
  25687. });
  25688. }
  25689. if (!newConfig.hideSaveGridUIConfig) {
  25690. buttons.push({
  25691. xtype: 'button',
  25692. tooltip: '保存布局',
  25693. iconCls: 'x-fa fa-cogs',
  25694. handler: this.saveGridUIConfig
  25695. });
  25696. }
  25697. if (!newConfig.hideClearGridUIConfig) {
  25698. buttons.push({
  25699. xtype: 'button',
  25700. tooltip: '还原布局',
  25701. iconCls: 'x-fa fa-reply-all',
  25702. handler: this.clearGridUIConfig
  25703. });
  25704. }
  25705. initGridCode(me, newConfig, buttons);
  25706. if (!newConfig.hideFootbar) {
  25707. if (newConfig.pagination) {
  25708. newConfig.bbar = new Ext.PagingToolbar({
  25709. // pageSize: newConfig.pageSize, 这个值是无效的
  25710. displayInfo: true,
  25711. store: this.store,
  25712. emptyMsg: '没有记录',
  25713. cls: 'grid-bbar',
  25714. items: __spread([
  25715. {
  25716. xtype: 'combobox',
  25717. tooltip: '分页',
  25718. queryMode: 'local',
  25719. editable: false,
  25720. allowBlank: true,
  25721. labelAlign: 'right',
  25722. width: 90,
  25723. // labelWidth: 30,
  25724. listConfig: {
  25725. minWidth: null
  25726. },
  25727. value: 50,
  25728. valueField: undefined,
  25729. displayField: undefined,
  25730. hideClear: true,
  25731. store: newConfig.pageSizeOption,
  25732. listeners: {
  25733. change: function (sender, nv, ov) {
  25734. _this.store.pageSize = nv;
  25735. _this.store.loadPage(1);
  25736. }
  25737. }
  25738. }
  25739. ], buttons),
  25740. doRefresh: function () {
  25741. me.reload();
  25742. }
  25743. });
  25744. }
  25745. else {
  25746. newConfig.bbar = {
  25747. xtype: 'toolbar', overflowHandler: 'menu',
  25748. cls: 'grid-bbar',
  25749. items: __spread([
  25750. {
  25751. xtype: 'button',
  25752. tooltip: '刷新',
  25753. iconCls: 'x-fa fa-refresh',
  25754. handler: function () {
  25755. _this.reload();
  25756. }
  25757. },
  25758. '-'
  25759. ], buttons)
  25760. };
  25761. if (newConfig.hideRefresh) {
  25762. newConfig.bbar.items.splice(0, 1);
  25763. }
  25764. }
  25765. }
  25766. if (_$2.isArray(newConfig.condition)) {
  25767. // 带查询条件
  25768. var conditionRows_1 = [];
  25769. var newRow_1 = false;
  25770. var currentRow_1 = { xtype: 'cols', items: [], };
  25771. conditionRows_1.push(currentRow_1);
  25772. _$2.forEach(newConfig.condition, function (item) {
  25773. var _a;
  25774. if (newRow_1) {
  25775. currentRow_1 = { xtype: 'cols', items: [], };
  25776. conditionRows_1.push(currentRow_1);
  25777. }
  25778. var vj = _$2.cloneDeep(item);
  25779. if (vj.xtype) {
  25780. if (item.xtype === 'combo' && item.dict) {
  25781. vj.fix = ['system.getDict("' + item.dict + '")'];
  25782. }
  25783. if (item.xtype === 'datetimefield') {
  25784. _$2.defer(function () {
  25785. //@ts-ignore
  25786. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  25787. });
  25788. }
  25789. else if (item.xtype === 'datefield') {
  25790. _$2.defer(function () {
  25791. //@ts-ignore
  25792. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  25793. });
  25794. }
  25795. else {
  25796. scope.viewModel.set(item.param_name, '');
  25797. }
  25798. }
  25799. else {
  25800. // 没有组件类型,是个空占位符
  25801. vj.border = false;
  25802. }
  25803. if (item.param_name) {
  25804. vj.bind = {
  25805. value: '{' + item.param_name + '}'
  25806. };
  25807. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25808. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25809. }
  25810. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  25811. currentRow_1.items.push(vj);
  25812. });
  25813. newConfig.tbar = {
  25814. xtype: 'form',
  25815. border: false,
  25816. items: conditionRows_1,
  25817. defaults: {
  25818. margin: '8 0 8 0'
  25819. },
  25820. };
  25821. console.log('newConfig', newConfig);
  25822. }
  25823. _$2.each(newConfig.columns, function (c) {
  25824. var renderer = c.renderer, formatter = c.formatter;
  25825. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  25826. _$2.startsWith(renderer, "system."))) {
  25827. if (newConfig.$initParent) {
  25828. if (scope) {
  25829. var rendererFn = lookupFn(scope, renderer);
  25830. c.renderer = rendererFn.bind(scope);
  25831. }
  25832. }
  25833. }
  25834. if (c.dict) {
  25835. c.fix = ['system.getDict("' + c.dict + '")'];
  25836. if (c.editor && c.editor.xtype === 'combo') {
  25837. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  25838. c.editor.typeAhead = true;
  25839. c.editor.triggerAction = 'all';
  25840. c.editor.selectOnFocus = false;
  25841. c.editor.listConfig = {
  25842. minWidth: 200
  25843. };
  25844. }
  25845. }
  25846. if (formatter === 'button') {
  25847. c.tdCls = 'td-btn';
  25848. if (!c.listeners) {
  25849. c.listeners = {};
  25850. }
  25851. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  25852. if ($(event.target).is('input')) {
  25853. me.fireEvent('buttonclick', me, this, record);
  25854. }
  25855. };
  25856. }
  25857. else if (formatter === 'percentRenderer') {
  25858. c.tdCls = 'td-percent';
  25859. }
  25860. });
  25861. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  25862. // 强制为编辑模式
  25863. newConfig.selModel = {
  25864. type: 'spreadsheet',
  25865. columnSelect: true,
  25866. pruneRemoved: false,
  25867. extensible: 'y'
  25868. };
  25869. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  25870. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  25871. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25872. }
  25873. else {
  25874. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  25875. }
  25876. }
  25877. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  25878. // 强制为勾选模式
  25879. newConfig.selModel = {
  25880. type: 'checkboxmodel',
  25881. mode: 'MULTI',
  25882. };
  25883. }
  25884. else if (newConfig._mode === 'checkonly') {
  25885. newConfig.selModel = {
  25886. type: 'checkboxmodel',
  25887. mode: 'MULTI',
  25888. checkOnly: true,
  25889. };
  25890. }
  25891. else if (newConfig._mode === 'select') {
  25892. // 强制为选择模式
  25893. newConfig.selModel = {
  25894. selType: 'rowmodel',
  25895. mode: 'SINGLE',
  25896. };
  25897. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  25898. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25899. }
  25900. }
  25901. initBehaviorEdit(newConfig);
  25902. initGridDialog(newConfig);
  25903. this.superclass.constructor.call(this, newConfig);
  25904. this.store.pageSize = newConfig.pageSize;
  25905. },
  25906. setData: function (value) {
  25907. var me = this;
  25908. me._setDataReal(value);
  25909. },
  25910. /**
  25911. * 添加行,并进入编辑状态
  25912. * @param record 新行的属性集
  25913. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  25914. */
  25915. appendEditRow: function (record, editRowCol) {
  25916. var records = this.getStore().add(record);
  25917. var recNew = records[0];
  25918. this.setSelection(records);
  25919. if (typeof editRowCol === 'string' && editRowCol) {
  25920. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25921. }
  25922. if (typeof editRowCol === 'number') {
  25923. var ce = this.findPlugin('cellediting');
  25924. this.editingPlugin = ce;
  25925. ce.startEdit(recNew, editRowCol);
  25926. }
  25927. },
  25928. beginEdit: function (record, editRowCol) {
  25929. if (typeof record === 'number') {
  25930. record = this.store.data.getAt(record);
  25931. }
  25932. if (record.isEntity === true) {
  25933. this.setSelection([record]);
  25934. if (typeof editRowCol === 'string' && editRowCol) {
  25935. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25936. }
  25937. if (typeof editRowCol === 'number') {
  25938. var ce = this.findPlugin('cellediting');
  25939. this.editingPlugin = ce;
  25940. ce.startEdit(record, editRowCol);
  25941. }
  25942. }
  25943. },
  25944. /**
  25945. * 移除行
  25946. * @param record 如果记录传空,就是当前选中的行
  25947. */
  25948. removeEditRow: function (record) {
  25949. if (!record) {
  25950. record = this.selection;
  25951. }
  25952. if (!record) {
  25953. msg('请选中要删除的行');
  25954. return;
  25955. }
  25956. this.getStore().remove(record);
  25957. },
  25958. /**
  25959. * 获取全部原始数据
  25960. */
  25961. getDataRows: function () {
  25962. return this.getStore().data.items.map(function (r) { return r.data; });
  25963. },
  25964. /**
  25965. * 获取全部原始数据, 不带 id/ 不带 origin
  25966. */
  25967. getDataRowsOnlyData: function () {
  25968. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  25969. delete r.id;
  25970. delete r._origin;
  25971. return r;
  25972. });
  25973. },
  25974. rowMoveUp: function () {
  25975. var grid = this;
  25976. if (!grid.selection) {
  25977. msg('无法对多行进行移动');
  25978. return;
  25979. }
  25980. var record = grid.selection;
  25981. if (_$2.isArray(record)) {
  25982. record = record[0];
  25983. }
  25984. if (!record) {
  25985. msg('无法对多行进行移动');
  25986. return;
  25987. }
  25988. // const records = grid.selModel.getSelection()
  25989. // if (records.length !== 1) {
  25990. // msg('无法对多行进行移动')
  25991. // return
  25992. // }
  25993. //
  25994. // const [record] = records
  25995. var index = grid.store.indexOf(record);
  25996. if (index > 0) {
  25997. grid.store.removeAt(index);
  25998. grid.store.insert(index - 1, record);
  25999. grid.getView().refresh();
  26000. grid.selModel.select([record]);
  26001. }
  26002. },
  26003. rowMoveDown: function () {
  26004. var grid = this;
  26005. // const records = grid.selModel.getSelection()
  26006. // if (records.length !== 1) {
  26007. // msg('无法对多行进行移动')
  26008. // return
  26009. // }
  26010. if (!grid.selection) {
  26011. msg('无法对多行进行移动');
  26012. return;
  26013. }
  26014. var record = grid.selection;
  26015. if (_$2.isArray(record)) {
  26016. record = record[0];
  26017. }
  26018. if (!record) {
  26019. msg('无法对多行进行移动');
  26020. return;
  26021. }
  26022. var index = grid.store.indexOf(record);
  26023. if (index < grid.store.getCount() - 1) {
  26024. grid.store.removeAt(index);
  26025. grid.store.insert(index + 1, record);
  26026. grid.getView().refresh();
  26027. grid.selModel.select([record]);
  26028. }
  26029. },
  26030. getEditRecord: function () {
  26031. var _a, _b;
  26032. var me = this;
  26033. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  26034. var rowIdx = (_b = (_a = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.rowIdx;
  26035. var record;
  26036. if (typeof rowIdx === 'undefined') {
  26037. record = me.getSelectionModel().getLastSelected();
  26038. }
  26039. else {
  26040. record = me.store.getAt(rowIdx);
  26041. }
  26042. return record;
  26043. },
  26044. getEditRow: function () {
  26045. var _a;
  26046. var me = this;
  26047. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  26048. },
  26049. setEditRow: function (rowValues) {
  26050. var me = this;
  26051. var record = me.getEditRecord();
  26052. if (record) {
  26053. _$2.forOwn(rowValues, function (v, k) {
  26054. record.set(k, v);
  26055. });
  26056. }
  26057. },
  26058. _transform: function (data) {
  26059. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  26060. _$2.forEach(data, function (row) {
  26061. row._origin = _$2.clone(row);
  26062. });
  26063. },
  26064. _setDataReal: function (value) {
  26065. var me = this;
  26066. this._transform(value);
  26067. var storeOpt = {
  26068. fields: getFileds(this),
  26069. data: value,
  26070. };
  26071. if (this.groupField) {
  26072. storeOpt.groupField = this.groupField;
  26073. }
  26074. var store = new Ext.data.Store(storeOpt);
  26075. me.setStore(store);
  26076. },
  26077. setStore: function (store) {
  26078. var me = this;
  26079. if (_$2.isArray(store)) {
  26080. var value = store;
  26081. this._transform(value);
  26082. var storeOpt = {
  26083. fields: getFileds(this),
  26084. data: value,
  26085. };
  26086. if (this.groupField) {
  26087. storeOpt.groupField = this.groupField;
  26088. }
  26089. store = new Ext.data.Store(storeOpt);
  26090. }
  26091. me.superclass.setStore.call(this, store);
  26092. var reference = this.reference;
  26093. if (reference) {
  26094. var scope = lookupScope(this);
  26095. scope.viewModel.set(reference + '.ischanged', false);
  26096. scope.viewModel.set(reference + '.theid', null);
  26097. scope.viewModel.set(reference + '.theid2', null);
  26098. scope.viewModel.set(reference + '.theid3', null);
  26099. }
  26100. if (store) {
  26101. store.on({
  26102. add: function (store, records, index, eOpts) {
  26103. me._raiseChange(store, 'add');
  26104. },
  26105. remove: function (store, records, index, isMove, eOpts) {
  26106. me._raiseChange(store, 'remove');
  26107. },
  26108. datachanged: function (sender, opt) {
  26109. me._raiseChange(store, 'datachanged');
  26110. }
  26111. });
  26112. }
  26113. },
  26114. _raiseChange: function (store, type) {
  26115. var _a, _b;
  26116. var reference = this.reference;
  26117. if (reference && store) {
  26118. var ischanged = false;
  26119. if (store.getModifiedRecords().length > 0 ||
  26120. store.getNewRecords().length > 0 ||
  26121. store.getRemovedRecords().length > 0) {
  26122. ischanged = true;
  26123. }
  26124. else {
  26125. ischanged = false;
  26126. }
  26127. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  26128. }
  26129. },
  26130. /**
  26131. * 轻量级刷新
  26132. */
  26133. refreshData: function () {
  26134. var store = this.getStore();
  26135. if (store) {
  26136. store.reload();
  26137. }
  26138. },
  26139. /**
  26140. * 为表格强制设置焦点
  26141. * @param seq 顺序号
  26142. */
  26143. focusRow: function (seq) {
  26144. this.setSelection(this.store.getAt(seq));
  26145. this.getView().focusRow(seq);
  26146. },
  26147. /**
  26148. * 重新载入数据(重新计算参数)
  26149. */
  26150. reload: function (reloadParams) {
  26151. if (reloadParams === void 0) { reloadParams = {}; }
  26152. var me = this;
  26153. var config = me.config;
  26154. if (config.dataSourceCallbackFn) {
  26155. // 函数请求刷新
  26156. var scope_1 = lookupScope(this);
  26157. _$2.defer(function () {
  26158. me.setLoading(true);
  26159. });
  26160. config.dataSourceCallbackFn.call(scope_1, me, {
  26161. successCallback: function (value) {
  26162. me._setDataReal(value);
  26163. _$2.defer(function () {
  26164. me.setLoading(false);
  26165. });
  26166. // 自动选中第一行
  26167. var data = me.getStore().data;
  26168. if (data.length > 0) {
  26169. me.setSelection(data.items[0]);
  26170. }
  26171. me.fireEvent('dataLoadComplete', me, true, value);
  26172. },
  26173. failCallback: function (error) {
  26174. _$2.defer(function () {
  26175. me.setLoading(false);
  26176. });
  26177. me.fireEvent('dataLoadComplete', me, false, error);
  26178. }
  26179. });
  26180. return;
  26181. }
  26182. // if (this.store) {
  26183. // this.store.reload({aaaa: 1, bbbb: 2})
  26184. // }
  26185. var dataSource = config.dataSource;
  26186. var scope = lookupScope(me);
  26187. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  26188. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  26189. }
  26190. },
  26191. exportCurrentExcelClick: function () {
  26192. var _a;
  26193. var me = this;
  26194. var config = me.config;
  26195. var scope = lookupScope(me);
  26196. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26197. if (excelFileName.endsWith(".xlsx")) {
  26198. excelFileName = excelFileName.split(".xlsx")[0];
  26199. }
  26200. excelFileName += ".xlsx";
  26201. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  26202. var excelData = me.makeExcelData(rowsAll);
  26203. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  26204. },
  26205. /**
  26206. * excel 导出
  26207. * excelExportParams 导出参数
  26208. * isContinue 是否继续导出
  26209. */
  26210. exportExcelClick: function (excelExportParams, isContinue) {
  26211. if (isContinue === void 0) { isContinue = false; }
  26212. var me = this;
  26213. var config = me.config;
  26214. excelExportParams.isExcelExport = true;
  26215. var scope = lookupScope(me);
  26216. var dataSource = config.dataSource;
  26217. var ep = function () {
  26218. scope.setLoading(true);
  26219. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  26220. var _a, _b, _c, _d;
  26221. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
  26222. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  26223. var total = parseInt((_c = responseData.pagination) === null || _c === void 0 ? void 0 : _c.total) || ((_d = responseData.data) === null || _d === void 0 ? void 0 : _d.length) || 0;
  26224. me.exportExcelCurrentPage = page;
  26225. me.exportExcelPageSize = size;
  26226. me.exportExcelTotal = total;
  26227. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26228. if (excelFileName.endsWith(".xlsx")) {
  26229. excelFileName = excelFileName.split(".xlsx")[0];
  26230. }
  26231. var pageExcelData = me.makeExcelData(responseData.data);
  26232. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  26233. excelFileName += ".xlsx";
  26234. LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
  26235. scope.setLoading(false);
  26236. if (page < total / size) {
  26237. page++;
  26238. me.exportExcelCurrentPage = page;
  26239. if (isContinue === true) {
  26240. excelExportParams.exportExcelCurrentPage = page;
  26241. ep();
  26242. }
  26243. }
  26244. });
  26245. };
  26246. ep();
  26247. },
  26248. exportBigExcelClick: function () {
  26249. var _a;
  26250. var me = this;
  26251. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  26252. showErrorDialog('当前表格不支持大批量导出');
  26253. return;
  26254. }
  26255. var config = me.config;
  26256. var scope = lookupScope(me);
  26257. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26258. var head = [];
  26259. var dict = {};
  26260. _$2.forEach(me.columns, function (column) {
  26261. if (column.isHidden())
  26262. return;
  26263. if (!column.dataIndex)
  26264. return;
  26265. if (!column.text)
  26266. return;
  26267. head.push({ field: column.dataIndex, name: column.text });
  26268. if (column.dictForExcel) {
  26269. dict[column.dataIndex] = column.dictForExcel;
  26270. }
  26271. });
  26272. // 判断是否需要解密
  26273. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  26274. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  26275. me.dbInfo.password = hexToString(me.dbInfo.password);
  26276. me.dbInfo.username = hexToString(me.dbInfo.username);
  26277. }
  26278. scope.setLoading(true);
  26279. Ext.Ajax.request({
  26280. timeout: 15000,
  26281. url: window["EXPORT_DATA_HOST"],
  26282. method: "POST",
  26283. jsonData: {
  26284. file: excelFileName,
  26285. dbInfo: me.dbInfo,
  26286. exportDataSql: me.exportDataSql,
  26287. exportDataSqlParams: me.exportDataSqlParams,
  26288. head: head,
  26289. dict: dict,
  26290. },
  26291. }).then(function () {
  26292. scope.setLoading(false);
  26293. msg('请求成功');
  26294. }).catch(function () {
  26295. scope.setLoading(false);
  26296. showErrorDialog('请求失败,请确认是否已安装客户端');
  26297. });
  26298. },
  26299. makeExcelData: function (jsonData) {
  26300. var me = this;
  26301. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  26302. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  26303. return;
  26304. }
  26305. var data = [];
  26306. // 获取表格的列定义
  26307. var headerTextArr = [];
  26308. var headers = [];
  26309. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  26310. var header = me.headerCt.getGridColumns()[i];
  26311. if (!header.isHidden()) {
  26312. var textStr = _$2.trim(header.text);
  26313. var dataIndexStr = _$2.trim(header.dataIndex);
  26314. if (dataIndexStr) {
  26315. if (textStr === '') {
  26316. headerTextArr.push(dataIndexStr);
  26317. }
  26318. else {
  26319. headerTextArr.push(textStr);
  26320. }
  26321. headers.push(header);
  26322. }
  26323. }
  26324. }
  26325. if (headers.length === 0) {
  26326. return;
  26327. }
  26328. data.push(headerTextArr);
  26329. for (var i = 0; i < jsonData.length; i++) {
  26330. var dataRow = jsonData[i];
  26331. var row = [];
  26332. for (var j = 0; j < headers.length; j++) {
  26333. var key = headers[j].dataIndex;
  26334. var value = dataRow[key];
  26335. if (!value && value !== 0) {
  26336. value = '';
  26337. }
  26338. var oValue = value;
  26339. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  26340. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  26341. try {
  26342. value = headers[j].renderer(value);
  26343. if (!value && value !== 0) {
  26344. value = oValue;
  26345. }
  26346. }
  26347. catch (e) {
  26348. value = oValue;
  26349. }
  26350. }
  26351. row.push(value);
  26352. }
  26353. data.push(row);
  26354. }
  26355. return data;
  26356. },
  26357. initComponent: function () {
  26358. var _this = this;
  26359. var _a;
  26360. var me = this;
  26361. var config = me.config;
  26362. var scope = lookupScope(this);
  26363. if (isDesignMode(scope, config)) {
  26364. this.superclass.initComponent.call(this);
  26365. return;
  26366. }
  26367. // 转换 dataSource 属性
  26368. convertDataSource$1(me, scope, config);
  26369. this.on({
  26370. afterrender: function (sender) {
  26371. var me = this;
  26372. var config = this.config;
  26373. var dataSource = config.dataSource;
  26374. if (config.autoLoad) {
  26375. if (config.dataSourceCallbackFn) {
  26376. me.reload();
  26377. }
  26378. else if (_$2.isPlainObject(dataSource)) {
  26379. me.reload();
  26380. }
  26381. }
  26382. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  26383. var vm = this.lookupViewModel();
  26384. this.contextMenu = this.add(new Ext.menu.Menu({
  26385. viewModel: vm,
  26386. items: _$2.map(config.tbar, function (item) {
  26387. var menuItem = __assign({}, item);
  26388. if (menuItem.xtype === 'button') {
  26389. delete menuItem.xtype;
  26390. }
  26391. return menuItem;
  26392. })
  26393. }));
  26394. }
  26395. else if (_$2.isPlainObject(config.contextMenu)) {
  26396. this.contextMenu = this.add(config.contextMenu);
  26397. }
  26398. var $dom = $(sender.el.dom);
  26399. $dom.on('keydown', function (e) {
  26400. me.fireEvent('keydown', me, e);
  26401. }).on('keyup', function (e) {
  26402. me.fireEvent('keyup', me, e);
  26403. });
  26404. // 默认显示提示
  26405. if (this.cellTip) {
  26406. this.tip = Ext.create('Ext.tip.ToolTip', {
  26407. target: this.el,
  26408. delegate: '.x-grid-cell-inner',
  26409. trackMouse: true,
  26410. ancor: 'top',
  26411. style: 'background-color: #0D6EFD;',
  26412. listeners: {
  26413. beforeshow: function (tip) {
  26414. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  26415. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  26416. return false;
  26417. }
  26418. tip.update(tipText);
  26419. }
  26420. }
  26421. });
  26422. }
  26423. },
  26424. itemcontextmenu: function (view, rec, node, index, e) {
  26425. if (this.contextMenu) {
  26426. e.stopEvent();
  26427. this.contextMenu.show().setLocalXY(e.getXY());
  26428. return false;
  26429. }
  26430. },
  26431. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  26432. // this.setColumnConfigCache()
  26433. // },
  26434. // columnhide(sender, column, eOpts) {
  26435. // this.setColumnConfigCache()
  26436. // },
  26437. // columnshow(sender, column, eOpts) {
  26438. // this.setColumnConfigCache()
  26439. // },
  26440. // columnresize(sender, column, width, eOpts) {
  26441. // this.setColumnConfigCache()
  26442. // },
  26443. destory: function () {
  26444. },
  26445. selectionchange: function (sender, param) {
  26446. var record = undefined;
  26447. if (_$2.isArray(param)) {
  26448. record = param[0];
  26449. }
  26450. else if (_$2.isObject(param)) {
  26451. record = _$2.get(param, 'endCell.record');
  26452. }
  26453. itemselectFun(this, sender, record);
  26454. },
  26455. itemclick: function (sender, record) {
  26456. itemselectFun(this, sender, record);
  26457. },
  26458. show: function (sender) {
  26459. if (sender.__suspendReload) {
  26460. sender.__suspendReload = false;
  26461. sender.reload();
  26462. }
  26463. }
  26464. });
  26465. _$2.defer(function () {
  26466. var ce = _this.findPlugin('cellediting');
  26467. ce.on({
  26468. beforeedit: function (editor, context, eOpts) {
  26469. me.fireEvent('editbefore', me, editor, context, eOpts);
  26470. },
  26471. canceledit: function (editor, context, eOpts) {
  26472. me.fireEvent('editcancel', me, editor, context, eOpts);
  26473. },
  26474. edit: function (editor, context, eOpts) {
  26475. me.fireEvent('editfinish', me, editor, context, eOpts);
  26476. },
  26477. validateedit: function (editor, context, eOpts) {
  26478. me.fireEvent('editvalidate', me, editor, context, eOpts);
  26479. },
  26480. });
  26481. });
  26482. var itemselectFun = _$2.debounce(function (me, sender, record) {
  26483. var reference = me.reference;
  26484. var scope = lookupScope(me);
  26485. var theid = _$2.get(config, 'behavior.theid');
  26486. if (theid && reference) {
  26487. if (!record) {
  26488. scope.viewModel.set(reference + '.theid', null);
  26489. }
  26490. else {
  26491. scope.viewModel.set(reference + '.theid', record.get(theid));
  26492. }
  26493. }
  26494. var theid2 = _$2.get(config, 'behavior.theid2');
  26495. if (theid2 && reference) {
  26496. if (!record) {
  26497. scope.viewModel.set(reference + '.theid2', null);
  26498. }
  26499. else {
  26500. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  26501. }
  26502. }
  26503. var theid3 = _$2.get(config, 'behavior.theid3');
  26504. if (theid3 && reference) {
  26505. if (!record) {
  26506. scope.viewModel.set(reference + '.theid3', null);
  26507. }
  26508. else {
  26509. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  26510. }
  26511. }
  26512. me.fireEvent('itemselect', sender, record);
  26513. }, 50);
  26514. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  26515. // 为 stores.proxy.buildRequest 做准备
  26516. this.store.proxy.$owner = this;
  26517. }
  26518. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  26519. if (selectToReload) {
  26520. // 点击后触发某个目标表格刷新
  26521. this.on({
  26522. itemselect: function (sender) {
  26523. if (_$2.isArray(selectToReload)) {
  26524. _$2.forEach(selectToReload, function (ref) {
  26525. if (ref) {
  26526. var ctlTarget = scope.refs[ref];
  26527. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26528. if (ctlTarget.isVisible()) {
  26529. ctlTarget.reload();
  26530. }
  26531. else {
  26532. ctlTarget.__suspendReload = true;
  26533. }
  26534. }
  26535. }
  26536. });
  26537. }
  26538. else if (_$2.isString(selectToReload)) {
  26539. var ctlTarget = scope.refs[selectToReload];
  26540. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26541. ctlTarget.reload();
  26542. }
  26543. }
  26544. }
  26545. });
  26546. }
  26547. this.superclass.initComponent.call(this);
  26548. },
  26549. // 生成列自定义的缓存key
  26550. makeColumnConfigCacheKey: function (config) {
  26551. var _a, _b, _c, _d, _e, _f;
  26552. var scope = ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.yvanScope) || ((_c = (_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.lookupReferenceHolder()) === null || _c === void 0 ? void 0 : _c.yvanScope) || ((_d = config.$vmParent) === null || _d === void 0 ? void 0 : _d.yvanScope) || ((_f = (_e = config.$vmParent) === null || _e === void 0 ? void 0 : _e._parent) === null || _f === void 0 ? void 0 : _f.yvanScope);
  26553. var key = "gridColumnCache-" + scope.scopeKey + "-";
  26554. if (config.reference) {
  26555. key += config.reference;
  26556. }
  26557. else {
  26558. var subKey = "";
  26559. for (var i = 0; i < config.columns.length; i++) {
  26560. var column = config.columns[i];
  26561. if (column.dataIndex) {
  26562. subKey += column.dataIndex;
  26563. }
  26564. }
  26565. key += subKey;
  26566. }
  26567. return key;
  26568. },
  26569. getColumnConfigCache: function () {
  26570. var key = this.columnConfigCacheKey;
  26571. var dataStr = localStorage.getItem(key);
  26572. if (dataStr) {
  26573. return JSON.parse(dataStr);
  26574. }
  26575. return "";
  26576. },
  26577. setColumnConfigCache: function () {
  26578. var key = this.columnConfigCacheKey;
  26579. var cacheData = [];
  26580. var columns = this.headerCt.getGridColumns();
  26581. var index = 0;
  26582. for (var i = 0; i < columns.length; i++) {
  26583. var column = columns[i];
  26584. if (column.dataIndex) {
  26585. cacheData.push({
  26586. dataIndex: column.dataIndex,
  26587. width: column.width,
  26588. hidden: column.hidden,
  26589. locked: column.locked,
  26590. index: index
  26591. });
  26592. index++;
  26593. }
  26594. }
  26595. localStorage.setItem(key, JSON.stringify(cacheData));
  26596. },
  26597. autoSizeColumns: function (sender) {
  26598. var grid = sender ? sender.up('grid') : this;
  26599. // const columns = grid.columns;
  26600. // for (let i = 0; i < columns.length; i++) {
  26601. // const column = columns[i];
  26602. // grid.getView().autoSizeColumn(column);
  26603. // column.setWidth(column.getWidth() + 5);
  26604. // }
  26605. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26606. grid.headerCt.getGridColumns()[i].autoSize(i);
  26607. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26608. }
  26609. },
  26610. clearFilter: function (sender) {
  26611. var grid = sender.up('grid');
  26612. grid.filters.clearFilters();
  26613. grid.getStore().sorters.removeAll();
  26614. // grid.getStore().reload()
  26615. },
  26616. saveGridUIConfig: function (sender) {
  26617. var grid = sender.up('grid');
  26618. grid.setColumnConfigCache();
  26619. msg('保存设置成功!');
  26620. },
  26621. clearGridUIConfig: function (sender) {
  26622. var grid = sender.up('grid');
  26623. var key = grid.columnConfigCacheKey;
  26624. localStorage.setItem(key, "");
  26625. msg('清空设置成功,重新打开后生效!');
  26626. },
  26627. setLoading: function (value) {
  26628. if (value) {
  26629. this.mask('读取中');
  26630. }
  26631. else {
  26632. this.unmask();
  26633. }
  26634. },
  26635. exportExcel: function (sender) {
  26636. var _a, _b;
  26637. var rect = sender.btnEl.dom.getBoundingClientRect();
  26638. var scope = lookupScope(this);
  26639. var grid = sender.up('grid');
  26640. var menuItems = [];
  26641. var topOffset = 0;
  26642. if (((_a = grid === null || grid === void 0 ? void 0 : grid.dataSource) === null || _a === void 0 ? void 0 : _a.method) === 'invoke' || ((_b = grid === null || grid === void 0 ? void 0 : grid.dataSource) === null || _b === void 0 ? void 0 : _b.sqlId)) {
  26643. menuItems.push({
  26644. text: '大批量导出 (需要客户端支持!)',
  26645. iconCls: 'x-fa fa-download',
  26646. listeners: {
  26647. click: function (sender, value) {
  26648. // @ts-ignore
  26649. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  26650. .then(function (res) {
  26651. grid.exportBigExcelClick();
  26652. });
  26653. }
  26654. }
  26655. });
  26656. menuItems.push('-');
  26657. topOffset += 30;
  26658. }
  26659. menuItems.push({
  26660. text: '导出当前数据',
  26661. iconCls: 'x-fa fa-download',
  26662. listeners: {
  26663. click: function (sender, value) {
  26664. grid.exportCurrentExcelClick();
  26665. }
  26666. }
  26667. });
  26668. topOffset += 30;
  26669. if (grid === null || grid === void 0 ? void 0 : grid.dataSource) {
  26670. menuItems.push({
  26671. xtype: "textfield",
  26672. fieldLabel: '当前导出页',
  26673. maskRe: /[0-9]/,
  26674. value: grid.exportExcelCurrentPage,
  26675. listeners: {
  26676. render: function (sender) {
  26677. grid.exportExcelCurrentPageCmp = sender;
  26678. },
  26679. change: function (sender, value) {
  26680. var v = parseInt(value);
  26681. if (isNaN(v) || v === 0) {
  26682. window['system'].msg("页码不能为0");
  26683. v = 1;
  26684. sender.setValue(v);
  26685. }
  26686. var size = parseInt(grid.exportExcelPageSize);
  26687. var total = parseInt(grid.exportExcelTotal);
  26688. if (v > total / size) {
  26689. v = parseInt(total / size + "");
  26690. }
  26691. grid.exportExcelCurrentPage = v + "";
  26692. }
  26693. }
  26694. }, {
  26695. xtype: "textfield",
  26696. fieldLabel: '导出页大小',
  26697. maskRe: /[0-9]/,
  26698. value: grid.exportExcelPageSize,
  26699. listeners: {
  26700. render: function (sender) {
  26701. grid.exportExcelPageSizeCmp = sender;
  26702. },
  26703. change: function (sender, value) {
  26704. var v = parseInt(value);
  26705. if (isNaN(v) || v === 0) {
  26706. window['system'].msg("导出页大小不能为0");
  26707. v = defaultGrid.exportExcelPageSize;
  26708. sender.setValue(v);
  26709. }
  26710. if (v > 10000) {
  26711. window['system'].msg("导出页大小不能大于10000");
  26712. v = 10000;
  26713. sender.setValue(v);
  26714. }
  26715. var page = parseInt(grid.exportExcelCurrentPage);
  26716. var total = parseInt(grid.exportExcelTotal);
  26717. if (page > total / v) {
  26718. page = parseInt(total / v + "") + 1;
  26719. grid.exportExcelCurrentPageCmp.setValue(page);
  26720. }
  26721. grid.exportExcelPageSize = v + "";
  26722. }
  26723. }
  26724. }, {
  26725. xtype: "textfield",
  26726. fieldLabel: '总条数',
  26727. value: grid.exportExcelTotal,
  26728. readOnly: true
  26729. }, {
  26730. text: '导出',
  26731. iconCls: 'x-fa fa-download',
  26732. listeners: {
  26733. click: function (sender, value) {
  26734. grid.exportExcelClick({
  26735. exportExcelPageSize: grid.exportExcelPageSize,
  26736. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26737. });
  26738. }
  26739. }
  26740. }, {
  26741. text: '连续导出',
  26742. iconCls: 'x-fa fa-download',
  26743. listeners: {
  26744. click: function (sender, value) {
  26745. grid.exportExcelClick({
  26746. exportExcelPageSize: grid.exportExcelPageSize,
  26747. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26748. }, true);
  26749. }
  26750. }
  26751. });
  26752. topOffset += 150;
  26753. }
  26754. var treeMenu = new Ext.menu.Menu({
  26755. xtype: 'menu',
  26756. floated: false,
  26757. width: 300,
  26758. docked: 'left',
  26759. items: menuItems
  26760. });
  26761. treeMenu.showAt(rect.left, rect.top - topOffset);
  26762. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26763. // grid.headerCt.getGridColumns()[i].autoSize(i);
  26764. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26765. // }
  26766. },
  26767. /**
  26768. * 获取表格编辑的行数据
  26769. */
  26770. getGridEditRows: function () {
  26771. var grid = this;
  26772. var store = grid.getStore();
  26773. var rows = [];
  26774. var modifyRows = [];
  26775. var newRows = [];
  26776. var err = "";
  26777. var records = store.getModifiedRecords();
  26778. var newRecords = store.getNewRecords();
  26779. var removeRecords = [];
  26780. _$2.forEach(store.getRemovedRecords(), function (row) {
  26781. removeRecords.push(row.data);
  26782. });
  26783. _$2.forEach(records, function (record) {
  26784. var colums = grid.columns;
  26785. var errFunc = undefined;
  26786. _$2.forEach(colums, function (col) {
  26787. var name = col.dataIndex;
  26788. var value = record.data[name];
  26789. var colIndex = col.getIndex(); //获得列号
  26790. var rowIndex = store.indexOfId(record.id); //获得行号
  26791. var editor = col.getEditor(); //使用的编辑器
  26792. var tmpErrFunc = function () {
  26793. var text = col.text || col.name;
  26794. msg(text + ' 校验失败, 请确保输入的数据正确');
  26795. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  26796. };
  26797. if (editor && !editor.allowBlank && isEmpty(value)) {
  26798. errFunc = tmpErrFunc;
  26799. return false;
  26800. }
  26801. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  26802. errFunc = tmpErrFunc;
  26803. return false;
  26804. }
  26805. });
  26806. if (typeof errFunc === 'function') {
  26807. err = "1";
  26808. _$2.remove(rows, function (n) {
  26809. return true;
  26810. });
  26811. //@ts-ignore
  26812. errFunc();
  26813. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  26814. return false;
  26815. }
  26816. else {
  26817. if (_$2.findIndex(newRecords, function (item) {
  26818. return item === record;
  26819. }) >= 0) {
  26820. newRows.push(record.data);
  26821. }
  26822. else {
  26823. modifyRows.push(record.data);
  26824. }
  26825. rows.push(record.data);
  26826. }
  26827. });
  26828. return {
  26829. rows: rows,
  26830. newRows: newRows,
  26831. modifyRows: modifyRows,
  26832. removeRecords: removeRecords,
  26833. err: err
  26834. };
  26835. }
  26836. // reload() {
  26837. // dataSourceReload(this)
  26838. // },
  26839. });
  26840. }
  26841. /**
  26842. * 获取 columns 中所有的 dataIndex
  26843. */
  26844. function getFileds(newConfig) {
  26845. var fields = [];
  26846. _$2.forEach(newConfig.columns, function (c) {
  26847. if (c.dataIndex) {
  26848. fields.push(c.dataIndex);
  26849. }
  26850. });
  26851. return fields;
  26852. }
  26853. function convertDataSource$1(sender, scope, newConfig) {
  26854. if (typeof newConfig.store !== 'undefined') {
  26855. // 有 store 属性的情况下,不做任何事
  26856. return;
  26857. }
  26858. if (typeof newConfig.dataSource === 'undefined') {
  26859. // 没有定义 dataSource 的情况下,不做任何事
  26860. return;
  26861. }
  26862. if (_$2.isArray(newConfig.data)) {
  26863. // 有 data 属性赋值的情况下
  26864. newConfig.store = {
  26865. fields: getFileds(newConfig),
  26866. data: newConfig.data
  26867. };
  26868. delete newConfig.data;
  26869. return;
  26870. }
  26871. var dataSource = newConfig.dataSource;
  26872. if (typeof dataSource === 'string') {
  26873. // dataSource 是字符串的情况下,找到成员函数
  26874. dataSource = lookupFn(scope, dataSource);
  26875. }
  26876. if (typeof dataSource === 'function') {
  26877. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  26878. newConfig.store = new Ext.data.Store({
  26879. fields: getFileds(newConfig),
  26880. // data: [],
  26881. autoLoad: true,
  26882. proxy: {
  26883. type: 'memory',
  26884. data: [],
  26885. }
  26886. });
  26887. newConfig.dataSourceCallbackFn = dataSource;
  26888. return;
  26889. }
  26890. // throw new TypeError('无法识别的调用方法')
  26891. }
  26892. function initTextfield () {
  26893. var cc = Ext.form.field.Text.prototype.constructor;
  26894. var initComponent = Ext.form.field.Text.prototype.initComponent;
  26895. Ext.form.field.Text.override({
  26896. constructor: function (config) {
  26897. var newConfig = _$2.defaultsDeep({
  26898. // 强制属性
  26899. triggers: {
  26900. clear: {
  26901. weight: -1,
  26902. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  26903. hidden: true,
  26904. handler: 'onClearClick',
  26905. },
  26906. }
  26907. }, baseConfig(config, 'col-item'), config, text);
  26908. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26909. newConfig.enableKeyEvents = true;
  26910. }
  26911. cc.call(this, newConfig);
  26912. },
  26913. /**
  26914. * 清空所有值
  26915. */
  26916. onClearClick: function (sender, e) {
  26917. var me = this;
  26918. me.setValue('');
  26919. },
  26920. /**
  26921. * 尝试获取下一个要获取焦点的控件
  26922. */
  26923. _raiseNextFocus: function (sender) {
  26924. var config = sender.config;
  26925. var scope = lookupScope(sender);
  26926. if (typeof config.nextFocus === 'function') {
  26927. config.nextFocus(sender);
  26928. }
  26929. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  26930. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  26931. var fn = lookupFn(scope, config.nextFocus);
  26932. if (typeof fn === 'function') {
  26933. var nextCtlReference = fn(sender);
  26934. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  26935. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  26936. if (ctl) {
  26937. if (typeof ctl.focus2 === 'function') {
  26938. ctl.focus2();
  26939. }
  26940. else {
  26941. ctl.focus();
  26942. }
  26943. }
  26944. }
  26945. }
  26946. }
  26947. else {
  26948. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  26949. if (ctl) {
  26950. if (typeof ctl.focus2 === 'function') {
  26951. ctl.focus2();
  26952. }
  26953. else {
  26954. ctl.focus();
  26955. }
  26956. }
  26957. }
  26958. }
  26959. },
  26960. initComponent: function () {
  26961. /**
  26962. * 改变必填项之前加星号
  26963. */
  26964. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  26965. // this.beforeLabelTextTpl = [
  26966. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26967. // ];
  26968. this.afterLabelTextTpl = [
  26969. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26970. ];
  26971. }
  26972. var me = this;
  26973. this.on({
  26974. change: function (sender, newVal) {
  26975. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  26976. if (hideTrigger || disabled || readOnly || hideClear) {
  26977. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  26978. return;
  26979. }
  26980. var value = newVal;
  26981. if (value) {
  26982. me.getTrigger('clear').show();
  26983. me.updateLayout();
  26984. }
  26985. else {
  26986. me.getTrigger('clear').hide();
  26987. me.updateLayout();
  26988. }
  26989. },
  26990. afterrender: function (sender) {
  26991. var _this = this;
  26992. var _a;
  26993. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  26994. sender.inputEl.dom.setAttribute('spellcheck', "false");
  26995. $$2(sender.inputEl.dom).on('click', function (e) {
  26996. sender.fireEvent('click', _this, e);
  26997. });
  26998. $$2(sender.inputEl.dom).on('keydown', function (e) {
  26999. var _a, _b, _c, _d;
  27000. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  27001. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  27002. if (sender.isExpanded === true) {
  27003. // 弹开下拉框的基础上,不干预上下选择
  27004. return;
  27005. }
  27006. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27007. var grid = sender.ownerCt.up('grid');
  27008. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  27009. if (editingPlugin) {
  27010. var rowIdx = (_c = (_b = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.rowIdx;
  27011. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  27012. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  27013. // editingPlugin
  27014. var targetRecord = void 0;
  27015. if (e.code === 'ArrowDown') {
  27016. targetRecord = grid.store.data.getAt(rowIdx + 1);
  27017. }
  27018. else {
  27019. targetRecord = grid.store.data.getAt(rowIdx - 1);
  27020. }
  27021. if (targetRecord) {
  27022. grid.setSelection([targetRecord]);
  27023. editingPlugin.startEdit(targetRecord, column);
  27024. }
  27025. e.stopPropagation();
  27026. e.preventDefault();
  27027. }
  27028. }
  27029. }
  27030. }
  27031. });
  27032. }
  27033. var config = sender.config;
  27034. if (config.ff && config.ff > 0) {
  27035. setTimeout(function () {
  27036. if (typeof sender.focus2 === 'function') {
  27037. sender.focus2();
  27038. }
  27039. else {
  27040. sender.focus();
  27041. }
  27042. }, config.ff);
  27043. }
  27044. }
  27045. });
  27046. var config = this.config;
  27047. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  27048. this.on({
  27049. keyup: function (sender, e) {
  27050. if ([10, 13, 20, 40].includes(e.keyCode)) {
  27051. sender._raiseNextFocus(sender);
  27052. }
  27053. }
  27054. });
  27055. }
  27056. var that = this;
  27057. this.on({
  27058. keyup: function (sender, e, eOpts) {
  27059. if (![10, 13, 20, 40].includes(e.keyCode)) {
  27060. return;
  27061. }
  27062. that.keydown_fun_item(sender, e, eOpts);
  27063. }
  27064. });
  27065. initComponent.call(this);
  27066. },
  27067. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  27068. var that = sender;
  27069. if ([10, 13, 20, 40].includes(event.keyCode)) {
  27070. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  27071. var value = _$2.trim(sender.rawValue);
  27072. var r = that.fireEvent('scancode', that, value, event);
  27073. if (r === 'OK') {
  27074. // 停止事件的默认处理程序,停止事件的冒泡
  27075. // event.stopEvent();
  27076. event.preventDefault();
  27077. event.stopPropagation();
  27078. }
  27079. }
  27080. }, 100)
  27081. });
  27082. }
  27083. //# sourceMappingURL=textfield.js.map
  27084. function initTbFill () {
  27085. /**
  27086. *
  27087. */
  27088. var ct = Ext.toolbar.Fill.prototype.constructor;
  27089. Ext.toolbar.Fill.override({
  27090. constructor: function (config) {
  27091. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  27092. ct.call(this, newConfig);
  27093. }
  27094. });
  27095. }
  27096. //# sourceMappingURL=tbfill.js.map
  27097. function initTbSeparator () {
  27098. /**
  27099. *
  27100. */
  27101. var ct = Ext.toolbar.Separator.prototype.constructor;
  27102. Ext.toolbar.Separator.override({
  27103. constructor: function (config) {
  27104. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  27105. ct.call(this, newConfig);
  27106. }
  27107. });
  27108. }
  27109. //# sourceMappingURL=tbseparator.js.map
  27110. function initToolbar () {
  27111. /**
  27112. *
  27113. */
  27114. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  27115. Ext.toolbar.Toolbar.override({
  27116. constructor: function (config) {
  27117. var newConfig = _$2.defaultsDeep({
  27118. // 强制性属性
  27119. }, baseConfig(config, 'cols-container'), config, toolbar);
  27120. ct.call(this, newConfig);
  27121. }
  27122. });
  27123. initTbFill();
  27124. initTbSeparator();
  27125. }
  27126. //# sourceMappingURL=toolbar.js.map
  27127. function initSplitter () {
  27128. var ct = Ext.resizer.Splitter.prototype.constructor;
  27129. Ext.resizer.Splitter.override({
  27130. constructor: function (config) {
  27131. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  27132. ct.call(this, newConfig);
  27133. }
  27134. });
  27135. }
  27136. //# sourceMappingURL=splitter.js.map
  27137. /**
  27138. * 通用 dataSource 解析,
  27139. * Tree/Combo/Grid/PageList ... 都会从这里解析
  27140. */
  27141. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  27142. var config = ctl.config;
  27143. return new Promise(function (resolve, reject) {
  27144. if (!config.dataSource) {
  27145. // 没有设置数据源,直接置空
  27146. return Promise.resolve();
  27147. }
  27148. var option = {
  27149. extraParam: extraParam,
  27150. _successCb: _successCb,
  27151. successCallback: function (value) {
  27152. if (typeof successCallback === "function") {
  27153. successCallback(value);
  27154. }
  27155. else {
  27156. ctl.setData(value);
  27157. }
  27158. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  27159. ctl.setLoading(false);
  27160. resolve(value);
  27161. },
  27162. failCallback: function (error) {
  27163. if (typeof failCallback === "function") {
  27164. failCallback(error);
  27165. }
  27166. ctl.fireEvent('dataLoadComplete', ctl, false);
  27167. ctl.setLoading(false);
  27168. reject(error);
  27169. }
  27170. };
  27171. // 请求前要求确认一下
  27172. var isCanceled = false;
  27173. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  27174. isCanceled = true;
  27175. } }, option));
  27176. if (!isCanceled) {
  27177. // 请求没有被取消
  27178. // 调用异步接口返回 Promise
  27179. return _innerReload(ctl, option);
  27180. }
  27181. return reject();
  27182. });
  27183. }
  27184. function _innerReload(ctl, option) {
  27185. var config = ctl.config;
  27186. ctl.setLoading(true);
  27187. var scope = lookupScope(ctl);
  27188. var dataSource = config.dataSource;
  27189. if (typeof dataSource == 'string') {
  27190. dataSource = lookupFn(scope, config.dataSource);
  27191. }
  27192. if (typeof dataSource === 'function') {
  27193. // @ts-ignore
  27194. dataSource.call(scope, ctl, option);
  27195. return;
  27196. }
  27197. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27198. if (!ajax.func) {
  27199. console.error("没有配置 ajax");
  27200. return;
  27201. }
  27202. var params_1 = {};
  27203. var sortModel = null;
  27204. var filterModel = null;
  27205. if (option.extraParam && option.extraParam.filterModel) {
  27206. filterModel = option.extraParam.filterModel;
  27207. }
  27208. if (option.extraParam && option.extraParam.sortModel) {
  27209. sortModel = option.extraParam.sortModel;
  27210. }
  27211. _$2.forOwn(option.extraParam, function (v, key) {
  27212. if (key != "filterModel" && key != "sortModel") {
  27213. if (typeof v === 'function') {
  27214. params_1[key] = v();
  27215. }
  27216. else {
  27217. params_1[key] = v;
  27218. }
  27219. }
  27220. });
  27221. var ds = dataSource;
  27222. _$2.forOwn(ds.params, function (v, key) {
  27223. if (typeof v === 'function') {
  27224. params_1[key] = v();
  27225. }
  27226. else {
  27227. params_1[key] = v;
  27228. }
  27229. });
  27230. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  27231. // @ts-ignore
  27232. ajax.func({
  27233. method: dataSource.method,
  27234. url: ds.url,
  27235. data: params_1,
  27236. filterModel: filterModel,
  27237. sortModel: sortModel,
  27238. }).then(function (res) {
  27239. if (res.success) {
  27240. option.successCallback(res.data);
  27241. }
  27242. else {
  27243. option.failCallback(res.msg);
  27244. }
  27245. }).catch(function (e) {
  27246. option.failCallback(e);
  27247. });
  27248. }
  27249. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27250. var ds_1 = ctl.dataSource;
  27251. // @ts-ignore
  27252. Extend.ajax.func({
  27253. url: ds_1.sqlId,
  27254. data: params_1,
  27255. db: ds_1.db,
  27256. method: 'sql',
  27257. filterModel: filterModel,
  27258. sortModel: sortModel,
  27259. }).then(function (res) {
  27260. if (res.success) {
  27261. option.successCallback(res.data);
  27262. }
  27263. else {
  27264. option.failCallback(res.msg);
  27265. }
  27266. }).catch(function (e) {
  27267. option.failCallback(e);
  27268. }).finally(function () {
  27269. ctl.loading = false;
  27270. });
  27271. return;
  27272. }
  27273. else {
  27274. console.error("非法的 dataSource", ctl.dataSource);
  27275. debugger;
  27276. throw new Error("非法的 dataSource");
  27277. }
  27278. }
  27279. }
  27280. //# sourceMappingURL=DataSourceHelper.js.map
  27281. function initCombo () {
  27282. var cc = Ext.form.field.ComboBox.prototype.constructor;
  27283. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27284. Ext.form.field.ComboBox.override({
  27285. constructor: function (config) {
  27286. var newConfig = _$2.defaultsDeep({
  27287. // 强制性属性
  27288. }, baseConfig(config, 'col-item'), config, combo);
  27289. if (typeof config.dict === 'string') {
  27290. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27291. }
  27292. else if (typeof newConfig.store == 'undefined') {
  27293. if (_$2.isArray(newConfig.data)) {
  27294. // ExtJS 无法直接接受数组模式
  27295. newConfig.store = {
  27296. fields: [newConfig.valueField, newConfig.displayField],
  27297. data: newConfig.data
  27298. };
  27299. delete newConfig.data;
  27300. }
  27301. else if (typeof newConfig.data !== 'object') {
  27302. newConfig.store = {
  27303. fields: [newConfig.valueField, newConfig.displayField],
  27304. data: []
  27305. };
  27306. delete newConfig.data;
  27307. }
  27308. }
  27309. cc.call(this, newConfig);
  27310. },
  27311. setDict: function (bizKey) {
  27312. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27313. this.dict = bizKey;
  27314. },
  27315. getDict: function () {
  27316. return this.dict;
  27317. },
  27318. setData: function (value) {
  27319. if (!value) {
  27320. return;
  27321. }
  27322. var config = value.config;
  27323. if (!this.store) {
  27324. this.store = new Ext.data.Store({
  27325. fields: [config.valueField, config.displayField],
  27326. data: value
  27327. });
  27328. }
  27329. else {
  27330. this.store.getProxy().setData(value);
  27331. this.store.load();
  27332. }
  27333. },
  27334. setLoading: function (value) {
  27335. if (value) {
  27336. if (!this.loadMask) {
  27337. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27338. }
  27339. }
  27340. else {
  27341. if (this.loadMask) {
  27342. this.loadMask.destroy();
  27343. delete this.loadMask;
  27344. }
  27345. }
  27346. },
  27347. reload: function () {
  27348. dataSourceReload(this);
  27349. },
  27350. initComponent: function () {
  27351. var that = this;
  27352. var toggle = function (e) {
  27353. var readOnly = that.readOnly, disabled = that.disabled;
  27354. if (readOnly || disabled) {
  27355. return;
  27356. }
  27357. if ($(e.target).is('.x-form-trigger')) {
  27358. return;
  27359. }
  27360. // 点击后下拉
  27361. if (that.isExpanded) {
  27362. that.collapse();
  27363. }
  27364. else {
  27365. that.expand();
  27366. that.doQuery(that.allQuery, true);
  27367. }
  27368. };
  27369. this.on({
  27370. afterrender: function (sender) {
  27371. var config = this.config;
  27372. if (config.dataSource && config.autoLoad) {
  27373. dataSourceReload(this);
  27374. }
  27375. // 点击后下拉
  27376. $(this.el.dom).on('click', toggle.bind(this));
  27377. },
  27378. focusenter: function (sender, event, opt) {
  27379. var _a;
  27380. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27381. // 表格内编辑框,获取焦点后自动弹开
  27382. toggle.call(this, event);
  27383. }
  27384. },
  27385. destory: function () {
  27386. $(this.el.dom).off('click', toggle.bind(this));
  27387. },
  27388. beforequery: function (context) {
  27389. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  27390. // console.log('beforequery', query)
  27391. if (!forceAll && query) {
  27392. combo.store.clearFilter();
  27393. combo.store.filterBy(function (record, id) {
  27394. var text = record.get(combo.displayField);
  27395. // 用拼音筛选的方式
  27396. return keywordFilter(query, text, id);
  27397. });
  27398. combo.expand();
  27399. return false;
  27400. }
  27401. combo.store.clearFilter();
  27402. combo.expand();
  27403. return false;
  27404. },
  27405. });
  27406. initComponent.call(this);
  27407. },
  27408. focus2: function () {
  27409. this.focus();
  27410. var that = this;
  27411. _$2.defer(function () {
  27412. if (that.isExpanded) {
  27413. that.collapse();
  27414. }
  27415. else {
  27416. that.expand();
  27417. that.doQuery(that.allQuery, true);
  27418. }
  27419. });
  27420. }
  27421. });
  27422. }
  27423. //# sourceMappingURL=combo.js.map
  27424. /**
  27425. xtype: 'tagfield',
  27426. displayField: 'show',
  27427. valueField: 'id',
  27428. queryMode: 'local',
  27429. filterPickList: true,
  27430. store: {
  27431. fields: ['id', 'show'],
  27432. data: [
  27433. {id: 0, show: 'Battlestar Galactica'},
  27434. {id: 1, show: 'Doctor Who'},
  27435. {id: 2, show: 'Farscape'},
  27436. {id: 3, show: 'Firefly'},
  27437. {id: 4, show: 'Star Trek'},
  27438. {id: 5, show: 'Star Wars: Christmas Special'}
  27439. ]
  27440. }
  27441. */
  27442. function initTag () {
  27443. var cc = Ext.form.field.Tag.prototype.constructor;
  27444. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27445. Ext.form.field.Tag.override({
  27446. constructor: function (config) {
  27447. var newConfig = _$2.defaultsDeep({
  27448. // 强制性属性
  27449. }, baseConfig(config, 'col-item'), config, tagfield);
  27450. if (typeof config.dict === 'string') {
  27451. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27452. }
  27453. else if (typeof newConfig.store == 'undefined') {
  27454. if (_$2.isArray(newConfig.data)) {
  27455. // ExtJS 无法直接接受数组模式
  27456. newConfig.store = {
  27457. fields: [newConfig.valueField, newConfig.displayField],
  27458. data: newConfig.data
  27459. };
  27460. delete newConfig.data;
  27461. }
  27462. else if (typeof newConfig.data !== 'object') {
  27463. newConfig.store = {
  27464. fields: [newConfig.valueField, newConfig.displayField],
  27465. data: []
  27466. };
  27467. delete newConfig.data;
  27468. }
  27469. }
  27470. cc.call(this, newConfig);
  27471. },
  27472. setDict: function (bizKey) {
  27473. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27474. this.dict = bizKey;
  27475. },
  27476. getDict: function () {
  27477. return this.dict;
  27478. },
  27479. setData: function (value) {
  27480. if (!value) {
  27481. return;
  27482. }
  27483. var config = value.config;
  27484. if (!this.store) {
  27485. this.store = new Ext.data.Store({
  27486. fields: [config.valueField, config.displayField],
  27487. data: value
  27488. });
  27489. }
  27490. else {
  27491. this.store.getProxy().setData(value);
  27492. this.store.load();
  27493. }
  27494. },
  27495. setLoading: function (value) {
  27496. if (value) {
  27497. if (!this.loadMask) {
  27498. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27499. }
  27500. }
  27501. else {
  27502. if (this.loadMask) {
  27503. this.loadMask.destroy();
  27504. delete this.loadMask;
  27505. }
  27506. }
  27507. },
  27508. reload: function () {
  27509. dataSourceReload(this);
  27510. },
  27511. initComponent: function () {
  27512. var that = this;
  27513. var toggle = function (e) {
  27514. var readOnly = that.readOnly, disabled = that.disabled;
  27515. if (readOnly || disabled) {
  27516. return;
  27517. }
  27518. if ($(e.target).is('.x-form-trigger')) {
  27519. return;
  27520. }
  27521. // 点击后下拉
  27522. if (that.isExpanded) {
  27523. that.collapse();
  27524. }
  27525. else {
  27526. that.expand();
  27527. that.doQuery(that.allQuery, true);
  27528. }
  27529. };
  27530. this.on({
  27531. afterrender: function (sender) {
  27532. var config = this.config;
  27533. if (config.dataSource && config.autoLoad) {
  27534. dataSourceReload(this);
  27535. }
  27536. // 点击后下拉
  27537. $(this.el.dom).on('click', toggle.bind(this));
  27538. },
  27539. focusenter: function (sender, event, opt) {
  27540. var _a;
  27541. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27542. // 表格内编辑框,获取焦点后自动弹开
  27543. toggle.call(this, event);
  27544. }
  27545. },
  27546. destory: function () {
  27547. $(this.el.dom).off('click', toggle.bind(this));
  27548. },
  27549. });
  27550. initComponent.call(this);
  27551. },
  27552. focus2: function () {
  27553. this.focus();
  27554. var that = this;
  27555. _$2.defer(function () {
  27556. if (that.isExpanded) {
  27557. that.collapse();
  27558. }
  27559. else {
  27560. that.expand();
  27561. that.doQuery(that.allQuery, true);
  27562. }
  27563. });
  27564. }
  27565. });
  27566. }
  27567. //# sourceMappingURL=tagfield.js.map
  27568. function initComboGridMulti () {
  27569. Ext.define('Yvan.LocalComboGrid', {
  27570. extend: 'Ext.form.field.Picker',
  27571. // extend: 'Yvan.PickerAlignCenter',
  27572. xtype: 'combogridmulti',
  27573. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  27574. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  27575. editable: false,
  27576. initComponent: function () {
  27577. this.on({
  27578. afterrender: function () {
  27579. var config = this.config;
  27580. if (config.dataSource && config.autoLoad) {
  27581. dataSourceReload(this);
  27582. }
  27583. },
  27584. });
  27585. this.superclass.initComponent.apply(this, arguments);
  27586. },
  27587. setStore: function (store) {
  27588. this.store = store;
  27589. var me = this;
  27590. if (me.store) {
  27591. if (me.picker) {
  27592. me.picker.setStore(store);
  27593. if (me.isExpanded) {
  27594. me.collapse();
  27595. delete me.picker;
  27596. me.expand();
  27597. }
  27598. }
  27599. this.onLoad();
  27600. me.mon(me.store, {
  27601. scope: me,
  27602. load: me.onLoad,
  27603. update: me.onUpdate
  27604. });
  27605. }
  27606. },
  27607. reload: function () {
  27608. dataSourceReload(this);
  27609. },
  27610. setData: function (value) {
  27611. var me = this;
  27612. var config = me.config;
  27613. if (!value) {
  27614. return;
  27615. }
  27616. if (!this.store) {
  27617. this.store = new Ext.data.Store({
  27618. fields: [config.valueField, config.displayField],
  27619. data: value
  27620. });
  27621. }
  27622. else {
  27623. this.store.getProxy().setData(value);
  27624. this.store.load();
  27625. }
  27626. this.onLoad();
  27627. },
  27628. createPicker: function () {
  27629. var me = this;
  27630. var picker = new Ext.grid.Panel(__assign(__assign({}, comboGridMultiPicker), { border: false, baseCls: Ext.baseCSSPrefix + 'boundlist', shrinkWrapDock: 2, store: me.store, floating: true, displayField: me.displayField, columns: me.columns, minHeight: me.minPickerHeight, maxHeight: me.maxPickerHeight, minWidth: me.minPickerWidth, manageHeight: false, shadow: false, scrollable: true, listeners: {
  27631. scope: me,
  27632. selectionchange: me.onSelectionChange,
  27633. itemkeydown: me.onPickerKeyDown
  27634. } })), view = picker.getView();
  27635. if (Ext.isIE9 && Ext.isStrict) {
  27636. view.on({
  27637. scope: me,
  27638. highlightitem: me.repaintPickerView,
  27639. unhighlightitem: me.repaintPickerView,
  27640. afteritemexpand: me.repaintPickerView,
  27641. afteritemcollapse: me.repaintPickerView
  27642. });
  27643. }
  27644. return picker;
  27645. },
  27646. repaintPickerView: function () {
  27647. var style = this.picker.getView().getEl().dom.style;
  27648. style.display = style.display;
  27649. },
  27650. onSelectionChange: function (view, record, node, rowIndex, e) {
  27651. this.selectItem(view, record);
  27652. },
  27653. onPickerKeyDown: function (treeView, record, item, index, e) {
  27654. var key = e.getKey();
  27655. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  27656. this.selectItem(treeView, record);
  27657. }
  27658. },
  27659. selectItem: function (sender, record) {
  27660. var me = this;
  27661. var ids = [];
  27662. _$2.forEach(me.picker.getSelection(), function (record) {
  27663. ids.push(record.get(me.valueField));
  27664. });
  27665. me.fireEvent('select', me, record);
  27666. me.setValue(ids.join(me.splitChar));
  27667. // me.collapse();
  27668. },
  27669. onExpand: function () {
  27670. var me = this;
  27671. var picker = this.picker;
  27672. var value = this.value;
  27673. if (!me.store) {
  27674. msg('正在初始化数据,请稍后');
  27675. me.collapse();
  27676. return;
  27677. }
  27678. var vs = _$2.split(value, me.splitChar);
  27679. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  27680. picker.setSelection(records);
  27681. },
  27682. setValue: function (value) {
  27683. var me = this;
  27684. console.log('setValue', value);
  27685. me.value = value;
  27686. if (!me.store || me.store.loading) {
  27687. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  27688. return me.mixins.field.setValue.call(me, value);
  27689. // return me;
  27690. }
  27691. var vs = _$2.split(value, me.splitChar);
  27692. var displayValues = [];
  27693. _$2.forEach(vs, function (v) {
  27694. var _a;
  27695. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  27696. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  27697. if (dv) {
  27698. displayValues.push(dv);
  27699. }
  27700. else {
  27701. displayValues.push(v);
  27702. }
  27703. });
  27704. // set the raw value to the record's display field if a record was found
  27705. me.setRawValue(displayValues.join(me.splitChar));
  27706. return me.mixins.field.setValue.call(me, value);
  27707. },
  27708. getSubmitValue: function () {
  27709. return this.value;
  27710. },
  27711. getValue: function () {
  27712. return this.value;
  27713. },
  27714. onLoad: function () {
  27715. var value = this.value;
  27716. if (value) {
  27717. this.setValue(value);
  27718. }
  27719. },
  27720. onUpdate: function (store, rec, type, modifiedFieldNames) {
  27721. var display = this.displayField;
  27722. var me = this;
  27723. if (type === 'edit' && modifiedFieldNames &&
  27724. Ext.Array.contains(modifiedFieldNames, display) &&
  27725. this.value === rec.getId()) {
  27726. me.mixins.field.setValue.call(me, this.value);
  27727. this.setRawValue(rec.get(display));
  27728. }
  27729. }
  27730. });
  27731. }
  27732. //# sourceMappingURL=combogridmulti.js.map
  27733. function initSearch () {
  27734. Ext.define('Yvan.Search', {
  27735. extend: 'Ext.form.field.Text',
  27736. alias: 'widget.searchfield',
  27737. xtype: 'searchfield',
  27738. constructor: function (config) {
  27739. var self = this;
  27740. var newConfig = _$2.defaultsDeep({
  27741. // 强制性属性
  27742. triggers: {
  27743. clear: {
  27744. weight: 0,
  27745. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27746. hidden: true,
  27747. handler: 'onClearClick',
  27748. },
  27749. search: {
  27750. weight: 1,
  27751. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  27752. handler: 'onSearchClick'
  27753. },
  27754. },
  27755. listeners: {
  27756. blur: function (sender, e) {
  27757. this.revertOnblur();
  27758. },
  27759. specialkey: function (sender, e) {
  27760. var _a;
  27761. var me = this;
  27762. if (e.getKey() === e.ENTER) {
  27763. me.onSearchClick(sender, {}, e);
  27764. return;
  27765. }
  27766. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27767. },
  27768. afterrender: function (sender, e) {
  27769. var _a;
  27770. this.replaceRawInputEvent();
  27771. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27772. }
  27773. },
  27774. }, baseConfig(config, 'col-item'), config, search);
  27775. this.superclass.constructor.call(self, newConfig);
  27776. },
  27777. revertOnblur: function () {
  27778. this.setRawValue(this.lastValue);
  27779. },
  27780. onSearchClick: function (sender, vv, e) {
  27781. var me = this;
  27782. var config = me.config;
  27783. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  27784. if (e) {
  27785. e.preventDefault();
  27786. e.stopPropagation();
  27787. }
  27788. this.fireEvent('search', sender, e);
  27789. if (!widget) {
  27790. return;
  27791. }
  27792. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  27793. },
  27794. replaceRawInputEvent: function () {
  27795. var me = this;
  27796. var $dom = $(me.inputEl.dom);
  27797. $dom.on('input', function (e) {
  27798. stopEvent(e);
  27799. // console.log('has input', e)
  27800. });
  27801. $dom.on('keyup', function (e) {
  27802. if (e.key === "Enter") {
  27803. me.onSearchClick(me, {}, e);
  27804. return;
  27805. }
  27806. stopEvent(e);
  27807. });
  27808. $dom.on('change', function (e) {
  27809. stopEvent(e);
  27810. });
  27811. },
  27812. onChange: function (newVal, oldVal) {
  27813. var me = this;
  27814. var value = newVal;
  27815. if (value) {
  27816. me.getTrigger('clear').show();
  27817. me.updateLayout();
  27818. }
  27819. else {
  27820. me.getTrigger('clear').hide();
  27821. me.updateLayout();
  27822. }
  27823. },
  27824. /**
  27825. * 清空所有值
  27826. */
  27827. onClearClick: function (sender, e) {
  27828. var me = this;
  27829. var config = me.config;
  27830. var lookup = config.lookup;
  27831. me.setValue('');
  27832. clearViewModelByLookup(sender, lookup);
  27833. }
  27834. });
  27835. }
  27836. //# sourceMappingURL=search.js.map
  27837. function initMultipleSearch () {
  27838. Ext.define('Yvan.MultipleSearch', {
  27839. extend: 'Ext.form.field.Text',
  27840. xtype: 'multiplesearch',
  27841. bindTargert: '',
  27842. constructor: function (config) {
  27843. var _a, _b, _c, _d;
  27844. var self = this;
  27845. var newConfig = _$2.defaultsDeep({
  27846. // 强制性属性
  27847. triggers: {
  27848. clear: {
  27849. weight: 0,
  27850. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27851. hidden: true,
  27852. handler: 'onClearClick',
  27853. }
  27854. },
  27855. transformRawValue: function (o) {
  27856. return o;
  27857. },
  27858. listeners: {
  27859. specialkey: function (sender, e) {
  27860. var me = this;
  27861. if (e.getKey() === e.ENTER) {
  27862. me.fireEvent('search', me, e);
  27863. }
  27864. },
  27865. afterrender: function (sender, e) {
  27866. var _a;
  27867. this.replaceRawInputEvent();
  27868. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27869. }
  27870. },
  27871. }, baseConfig(config, 'col-item'), config, search);
  27872. this.superclass.constructor.call(self, newConfig);
  27873. var vv = (_d = (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.bind) === null || _b === void 0 ? void 0 : _b.value) || ((_c = this.config) === null || _c === void 0 ? void 0 : _c.bind))) !== null && _d !== void 0 ? _d : '';
  27874. vv = _$2.replace(vv, "{", "");
  27875. vv = _$2.replace(vv, "}", "");
  27876. this.bindTargert = vv;
  27877. this.bindTargert = _$2.trim(this.bindTargert);
  27878. },
  27879. setBindValue: function (arrValue) {
  27880. if (this.bindTargert) {
  27881. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  27882. }
  27883. },
  27884. replaceRawInputEvent: function () {
  27885. var me = this;
  27886. var $dom = $(me.inputEl.dom);
  27887. $dom.on('input', function (e) {
  27888. var _a, _b, _c, _d, _e, _f;
  27889. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  27890. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  27891. if (!a.endsWith(",") && a.length > 0) {
  27892. e.currentTarget.value = a + ",";
  27893. }
  27894. else {
  27895. e.currentTarget.value = a;
  27896. }
  27897. }
  27898. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  27899. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  27900. _$2.remove(arr, function (it) {
  27901. return !it;
  27902. });
  27903. me.setBindValue(arr);
  27904. stopEvent(e);
  27905. });
  27906. $dom.on('keyup', function (e) {
  27907. me.fireEvent('keyup', me, e);
  27908. // invokeMethod(me.config.listeners?.keyup, me, e)
  27909. stopEvent(e);
  27910. });
  27911. $dom.on('keydown', function (e) {
  27912. me.fireEvent('keydown', me, e);
  27913. // invokeMethod(me.config.listeners?.keydown, me, e)
  27914. //stopEvent(e)
  27915. });
  27916. $dom.on('change', function (e) {
  27917. stopEvent(e);
  27918. });
  27919. $dom.on('paste', function (e) {
  27920. var _a;
  27921. // @ts-ignore
  27922. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  27923. var text = clipdata.getData("text/plain");
  27924. var spliter = ',';
  27925. text = text.replaceAll("\r", "");
  27926. text = text.replaceAll("\n", spliter);
  27927. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  27928. var arr = text.split(spliter);
  27929. if (arr && Array.isArray(arr)) {
  27930. for (var i = 0; i < arr.length; i++) {
  27931. arr[i] = _$2.trim(arr[i]);
  27932. }
  27933. }
  27934. _$2.remove(arr, function (it) {
  27935. return !it;
  27936. });
  27937. me.setBindValue(arr);
  27938. stopEvent(e);
  27939. });
  27940. },
  27941. onChange: function (newVal, oldVal) {
  27942. var me = this;
  27943. var value = newVal;
  27944. if (value) {
  27945. me.getTrigger('clear').show();
  27946. me.updateLayout();
  27947. }
  27948. else {
  27949. me.getTrigger('clear').hide();
  27950. me.updateLayout();
  27951. }
  27952. },
  27953. /**
  27954. * 清空所有值
  27955. */
  27956. onClearClick: function (sender, e) {
  27957. var me = this;
  27958. var config = me.config;
  27959. var lookup = config.lookup;
  27960. me.setValue('');
  27961. clearViewModelByLookup(sender, lookup);
  27962. }
  27963. });
  27964. }
  27965. //# sourceMappingURL=multiplesearch.js.map
  27966. function initDate () {
  27967. var cc = Ext.form.field.Date.prototype.constructor;
  27968. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  27969. Ext.form.field.Date.override({
  27970. format: 'Y-m-d',
  27971. altFormats: 'Y-m-d',
  27972. constructor: function (config) {
  27973. var newConfig = _$2.defaultsDeep({
  27974. // 强制属性
  27975. }, baseConfig(config, 'col-item'), config, date);
  27976. cc.call(this, newConfig);
  27977. },
  27978. getValue: function () {
  27979. var ov = getValue.call(this);
  27980. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  27981. // console.log('cc:', nv, ov)
  27982. return nv;
  27983. },
  27984. // focus2() {
  27985. // const that = this
  27986. // if (that.isExpanded) {
  27987. // that.collapse()
  27988. //
  27989. // } else {
  27990. // that.expand();
  27991. // }
  27992. // _.defer(() => {
  27993. // that.focus()
  27994. // })
  27995. // },
  27996. initComponent: function () {
  27997. this.on({
  27998. afterrender: function () {
  27999. var config = this.config;
  28000. // 日期框,不要默认弹出
  28001. // $(this.el.dom).on('click', toggle.bind(this))
  28002. },
  28003. destory: function () {
  28004. // 日期框,不要默认弹出
  28005. // $(this.el.dom).off('click', toggle.bind(this))
  28006. },
  28007. change: {
  28008. fn: function (sender) {
  28009. if (sender.format === 'Y-m-d') {
  28010. // 年月日格式
  28011. var value = sender.getRawValue();
  28012. if (/^\d{8}$/.test(value)) {
  28013. // 8位数字,自动转换为 YYYY-MM-DD
  28014. var newValue = [
  28015. value.substr(0, 4),
  28016. value.substr(4, 2),
  28017. value.substr(6, 2)
  28018. ].join('-');
  28019. sender.setValue(newValue);
  28020. }
  28021. }
  28022. },
  28023. }
  28024. // focus: {
  28025. // // 获得焦点后自动下拉
  28026. // fn(sender) {
  28027. // sender.expand();
  28028. // this.doQuery(this.allQuery, true);
  28029. // },
  28030. // },
  28031. });
  28032. initComponent.call(this);
  28033. },
  28034. createInitialDate: function (value) {
  28035. var minValue = this.minValue, maxValue = this.maxValue;
  28036. value = value || syncDate(new Date());
  28037. if (minValue && minValue > value) {
  28038. value = minValue;
  28039. }
  28040. else if (maxValue && maxValue < value) {
  28041. value = maxValue;
  28042. }
  28043. return value;
  28044. },
  28045. });
  28046. }
  28047. //# sourceMappingURL=datefield.js.map
  28048. function initDateTimePicker () {
  28049. Ext.define('Yvan.DateTimePicker', {
  28050. extend: 'Ext.picker.Date',
  28051. alias: 'datetimepicker',
  28052. alternateClassName: 'Ext.DateTimePicker',
  28053. renderTpl: [
  28054. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  28055. '<div class="{baseCls}-header">',
  28056. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  28057. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  28058. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  28059. '</div>',
  28060. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  28061. '<thead>',
  28062. '<tr role="row">',
  28063. '<tpl for="dayNames">',
  28064. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  28065. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  28066. '</th>',
  28067. '</tpl>',
  28068. '</tr>',
  28069. '</thead>',
  28070. '<tbody>',
  28071. '<tr role="row">',
  28072. '<tpl for="days">',
  28073. '{#:this.isEndOfWeek}',
  28074. '<td role="gridcell">',
  28075. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  28076. '</td>',
  28077. '</tpl>',
  28078. '</tr>',
  28079. '</tbody>',
  28080. '</table>',
  28081. '<tpl if="showToday">',
  28082. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  28083. '</tpl>',
  28084. // These elements are used with Assistive Technologies such as screen readers
  28085. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  28086. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  28087. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  28088. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  28089. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  28090. '</div>',
  28091. {
  28092. firstInitial: function (value) {
  28093. return Ext.picker.Date.prototype.getDayInitial(value);
  28094. },
  28095. isEndOfWeek: function (value) {
  28096. // convert from 1 based index to 0 based
  28097. // by decrementing value once.
  28098. value--;
  28099. // eslint-disable-next-line vars-on-top
  28100. var end = value % 7 === 0 && value !== 0;
  28101. return end ? '</tr><tr role="row">' : '';
  28102. },
  28103. renderTodayBtn: function (values, out) {
  28104. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  28105. },
  28106. renderMonthBtn: function (values, out) {
  28107. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  28108. }
  28109. }
  28110. ],
  28111. beforeRender: function () {
  28112. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  28113. this.superclass.beforeRender.call(this);
  28114. function handleInput(extHandle, $input) {
  28115. var $dom = $(extHandle.el.dom);
  28116. // const $up = $dom.find('.x-form-spinner-up')
  28117. // const $down = $dom.find('.x-form-spinner-down')
  28118. // debugger
  28119. // $up.on('mousedown', () => {
  28120. // debugger
  28121. // });
  28122. // $up.on('click', () => {
  28123. // debugger
  28124. // });
  28125. extHandle.on('click', function (sender) {
  28126. var hideBak = me.hide;
  28127. me.hide = Ext.emptyFn;
  28128. extHandle.focus();
  28129. me.hide = hideBak;
  28130. });
  28131. var changeValue = function (delta) {
  28132. if (_$2.trim(extHandle.getValue()) === '') {
  28133. extHandle.setValue(extHandle.minValue);
  28134. }
  28135. else {
  28136. var v = parseInt('' + extHandle.getValue());
  28137. if (v + delta > extHandle.maxValue) {
  28138. extHandle.setValue(extHandle.minValue);
  28139. }
  28140. else if (v + delta < extHandle.minValue) {
  28141. extHandle.setValue(extHandle.maxValue);
  28142. }
  28143. else {
  28144. extHandle.setValue(v + delta);
  28145. }
  28146. }
  28147. };
  28148. $input.on('mousewheel', function (e) {
  28149. e.stopPropagation();
  28150. var event = e.originalEvent;
  28151. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  28152. // if (event.wheelDelta) {
  28153. // delta = event.wheelDelta / 120;
  28154. // } else if (event.detail) {
  28155. // delta = -event.detail / 3;
  28156. // }
  28157. var zoomSize = Math.ceil(eventDelta / 120);
  28158. changeValue(zoomSize);
  28159. // console.log('delta', delta)
  28160. // $input.focus()
  28161. });
  28162. }
  28163. me.input1 = Ext.create('Ext.form.field.Number', {
  28164. minValue: 0,
  28165. maxValue: 23,
  28166. flex: 1,
  28167. enableKeyEvents: true,
  28168. fieldLabel: '时',
  28169. labelWidth: 20,
  28170. hideLabel: true,
  28171. spinDownEnabled: false,
  28172. spinUpEnabled: false,
  28173. style: {
  28174. marginLeft: '5px',
  28175. },
  28176. listeners: {
  28177. afterrender: function (sender) {
  28178. var $input = $(sender.inputEl.dom);
  28179. handleInput(me.input1, $input);
  28180. },
  28181. change: function (sender, e) {
  28182. if (me.getValue()) {
  28183. me.value.setHours(sender.getValue());
  28184. }
  28185. },
  28186. }
  28187. });
  28188. me.input2 = Ext.create('Ext.form.field.Number', {
  28189. minValue: 0,
  28190. maxValue: 59,
  28191. flex: 1,
  28192. enableKeyEvents: true,
  28193. fieldLabel: ' ',
  28194. hideLabel: false,
  28195. labelWidth: 8,
  28196. spinDownEnabled: false,
  28197. spinUpEnabled: false,
  28198. listeners: {
  28199. afterrender: function (sender) {
  28200. var $input = $(sender.inputEl.dom);
  28201. handleInput(me.input2, $input);
  28202. },
  28203. change: function (sender, e) {
  28204. if (me.getValue()) {
  28205. me.value.setMinutes(sender.getValue());
  28206. }
  28207. },
  28208. }
  28209. });
  28210. me.input3 = Ext.create('Ext.form.field.Number', {
  28211. minValue: 0,
  28212. maxValue: 59,
  28213. flex: 1,
  28214. enableKeyEvents: true,
  28215. fieldLabel: ' ',
  28216. hideLabel: false,
  28217. labelWidth: 8,
  28218. spinDownEnabled: false,
  28219. spinUpEnabled: false,
  28220. style: {
  28221. marginRight: '5px',
  28222. },
  28223. listeners: {
  28224. afterrender: function (sender) {
  28225. var $input = $(sender.inputEl.dom);
  28226. handleInput(me.input3, $input);
  28227. },
  28228. change: function (sender, e) {
  28229. if (me.getValue()) {
  28230. me.value.setSeconds(sender.getValue());
  28231. }
  28232. },
  28233. }
  28234. });
  28235. me.confirmBtn = new Ext.button.Button({
  28236. text: '确认',
  28237. handler: me.confirmClick,
  28238. scope: me
  28239. });
  28240. me.tdBtn = new Ext.button.Button({
  28241. text: '现在',
  28242. handler: me.selectToday,
  28243. scope: me
  28244. });
  28245. me.todayBtn = Ext.create('Ext.container.Container', {
  28246. layout: 'anchor', border: false,
  28247. defaults: {
  28248. border: false, anchor: '100%',
  28249. margin: '0 0 5 0',
  28250. },
  28251. items: [
  28252. {
  28253. layout: 'hbox',
  28254. items: [
  28255. me.input1,
  28256. me.input2,
  28257. me.input3,
  28258. ]
  28259. },
  28260. {
  28261. layout: 'hbox',
  28262. items: [
  28263. me.confirmBtn,
  28264. me.tdBtn,
  28265. ]
  28266. }
  28267. ]
  28268. });
  28269. },
  28270. // finishRenderChildren() {
  28271. // var me = this;
  28272. //
  28273. // this.superclass.finishRenderChildren.call(this);
  28274. // //*
  28275. // me.input1.finishRender();
  28276. // me.input2.finishRender();
  28277. // me.input3.finishRender();
  28278. // //
  28279. // me.tdBtn.finishRender();
  28280. // me.confirmBtn.finishRender();
  28281. // },
  28282. setValue: function (value) {
  28283. //this.value = Ext.Date.clearTime(value, true);
  28284. this.value = value;
  28285. this.input1.setValue(this.value.getHours());
  28286. this.input2.setValue(this.value.getMinutes());
  28287. this.input3.setValue(this.value.getSeconds());
  28288. return this.update(this.value);
  28289. },
  28290. selectDate: function (value) {
  28291. if (this.showTime) {
  28292. value.setHours(this.input1.getValue());
  28293. value.setMinutes(this.input2.getValue());
  28294. value.setSeconds(this.input3.getValue());
  28295. }
  28296. this.value = value;
  28297. return this.update(this.value);
  28298. },
  28299. setDisabledStatus: function (disabled) {
  28300. var me = this;
  28301. debugger;
  28302. // me.callParent();
  28303. if (me.showTime) {
  28304. me.confirmBtn.setDisabled(disabled);
  28305. }
  28306. if (me.isShowFooter()) {
  28307. me.footerContainer.setDisabled(disabled);
  28308. }
  28309. },
  28310. handleDateClick: function (e, t) {
  28311. var me = this, handler = me.handler;
  28312. // e.stopEvent();
  28313. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  28314. me.doCancelFocus = me.focusOnSelect === false;
  28315. me.selectDate(new Date(t.dateValue));
  28316. delete me.doCancelFocus;
  28317. /* 有时间输入时单击事件不退出选择,只移动光标 */
  28318. if (me.showTime) {
  28319. return;
  28320. }
  28321. me.fireEvent('select', me, me.value);
  28322. if (handler) {
  28323. handler.call(me.scope || me, me, me.value);
  28324. }
  28325. me.onSelect();
  28326. }
  28327. },
  28328. selectToday: function () {
  28329. var me = this, btn = me.todayBtn, handler = me.handler;
  28330. if (btn && !btn.disabled) {
  28331. me.value = syncDate(new Date());
  28332. me.update(me.value);
  28333. me.fireEvent('select', me, me.value);
  28334. if (handler) {
  28335. handler.call(me.scope || me, me, me.value);
  28336. }
  28337. me.onSelect();
  28338. me.hide();
  28339. }
  28340. return me;
  28341. },
  28342. confirmClick: function () {
  28343. var me = this, btn = me.confirmBtn, handler = me.handler;
  28344. if (btn && !btn.disabled) {
  28345. me.fireEvent('select', me, me.value);
  28346. if (handler) {
  28347. handler.call(me.scope || me, me, me.value);
  28348. }
  28349. me.onSelect();
  28350. me.hide();
  28351. }
  28352. return me;
  28353. },
  28354. selectedUpdate: function (date) {
  28355. var me = this,
  28356. //t = date.getTime(),
  28357. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  28358. cells.removeCls(cls);
  28359. for (c = 0; c < cLen; c++) {
  28360. cell = Ext.fly(cellItems[c]);
  28361. if (cell.dom.firstChild.dateValue == t) {
  28362. me.fireEvent('highlightitem', me, cell);
  28363. cell.addCls(cls);
  28364. if (me.isVisible() && !me.doCancelFocus) {
  28365. Ext.fly(cell.dom.firstChild).focus(50);
  28366. }
  28367. break;
  28368. }
  28369. }
  28370. },
  28371. // private, inherit docs
  28372. beforeDestroy: function () {
  28373. var me = this;
  28374. if (me.rendered) {
  28375. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  28376. }
  28377. me.superclass.beforeDestroy.call(this);
  28378. }
  28379. });
  28380. }
  28381. //# sourceMappingURL=datetimepicker.js.map
  28382. function initDateTime () {
  28383. Ext.define('Yvan.DateTimeField', {
  28384. extend: 'Ext.form.field.Date',
  28385. xtype: 'datetimefield',
  28386. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  28387. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28388. showTime: true,
  28389. format: "Y-m-d H:i:s",
  28390. constructor: function (config) {
  28391. var newConfig = _$2.defaultsDeep({
  28392. // 强制属性
  28393. }, baseConfig(config, 'col-item'), config, date);
  28394. this.superclass.constructor.call(this, newConfig);
  28395. },
  28396. initComponent: function () {
  28397. this.superclass.initComponent.call(this);
  28398. var setInitValue = function () {
  28399. var value = this.getRawValue();
  28400. if (!value) {
  28401. // 没填内容的时候,自动设置当前时间
  28402. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  28403. }
  28404. };
  28405. this.on({
  28406. afterrender: function () {
  28407. var config = this.config;
  28408. // 日期框,不要默认弹出
  28409. $(this.el.dom).on('click', setInitValue.bind(this));
  28410. },
  28411. destory: function () {
  28412. // 日期框,不要默认弹出
  28413. $(this.el.dom).off('click', setInitValue.bind(this));
  28414. },
  28415. change: {
  28416. fn: function (sender) {
  28417. if (sender.format === "Y-m-d H:i:s") {
  28418. // 年月日格式
  28419. var value = sender.getRawValue();
  28420. if (/^\d{14}$/.test(value)) {
  28421. // 8位数字,自动转换为 YYYY-MM-DD
  28422. var newValue = [
  28423. value.substr(0, 4),
  28424. '-',
  28425. value.substr(4, 2),
  28426. '-',
  28427. value.substr(6, 2),
  28428. ' ',
  28429. value.substr(8, 2),
  28430. ':',
  28431. value.substr(10, 2),
  28432. ':',
  28433. value.substr(12, 2)
  28434. ].join('');
  28435. sender.setValue(newValue);
  28436. }
  28437. }
  28438. },
  28439. }
  28440. });
  28441. },
  28442. getValue: function () {
  28443. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  28444. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  28445. // console.log('cc:', nv, ov)
  28446. return nv;
  28447. },
  28448. onExpand: function () {
  28449. var strValue = this.getValue();
  28450. var value;
  28451. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  28452. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)), parseInt(strValue.substr(11, 2)), parseInt(strValue.substr(14, 2)), parseInt(strValue.substr(17, 2)));
  28453. }
  28454. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  28455. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  28456. }
  28457. else {
  28458. value = syncDate(new Date());
  28459. }
  28460. this.picker.setValue(value);
  28461. },
  28462. createPicker: function () {
  28463. var me = this, format = Ext.String.format;
  28464. //@ts-ignore
  28465. return new Yvan.DateTimePicker({
  28466. pickerField: me,
  28467. ownerCt: me.ownerCt,
  28468. renderTo: document.body,
  28469. floating: true,
  28470. hidden: true,
  28471. focusOnShow: true,
  28472. minDate: me.minValue,
  28473. maxDate: me.maxValue,
  28474. disabledDatesRE: me.disabledDatesRE,
  28475. disabledDatesText: me.disabledDatesText,
  28476. disabledDays: me.disabledDays,
  28477. disabledDaysText: me.disabledDaysText,
  28478. format: me.format,
  28479. showToday: me.showToday,
  28480. showTime: me.showTime,
  28481. startDay: me.startDay,
  28482. minText: format(me.minText, me.formatDate(me.minValue)),
  28483. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  28484. listeners: {
  28485. scope: me,
  28486. select: me.onSelect
  28487. },
  28488. keyNavConfig: {
  28489. esc: function () {
  28490. me.collapse();
  28491. }
  28492. }
  28493. });
  28494. },
  28495. });
  28496. }
  28497. //# sourceMappingURL=datetimefield.js.map
  28498. function initNumber () {
  28499. var cc = Ext.form.field.Number.prototype.constructor;
  28500. var initComponent = Ext.form.field.Number.prototype.initComponent;
  28501. Ext.form.field.Number.override({
  28502. constructor: function (config) {
  28503. var newConfig = _$2.defaultsDeep({
  28504. // 强制属性
  28505. }, baseConfig(config, 'col-item'), config, numberfield);
  28506. cc.call(this, newConfig);
  28507. },
  28508. initComponent: function () {
  28509. this.on({
  28510. afterrender: function (sender) {
  28511. var _this = this;
  28512. var _a;
  28513. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  28514. sender.inputEl.dom.setAttribute('spellcheck', "false");
  28515. $$2(sender.inputEl.dom).on('click', function (e) {
  28516. sender.fireEvent('click', _this, e);
  28517. });
  28518. }
  28519. }
  28520. });
  28521. initComponent.call(this);
  28522. },
  28523. });
  28524. }
  28525. //# sourceMappingURL=numberfield.js.map
  28526. function initCheckbox () {
  28527. var cc = Ext.form.field.Checkbox.prototype.constructor;
  28528. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  28529. Ext.form.field.Checkbox.override({
  28530. constructor: function (config) {
  28531. var newConfig = _$2.defaultsDeep({
  28532. // 强制属性
  28533. }, baseConfig(config, 'col-item'), config, checkbox);
  28534. cc.call(this, newConfig);
  28535. },
  28536. getValue: function () {
  28537. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28538. var ov = getValue.call(this);
  28539. // const ov = this.getRawValue()
  28540. return (ov ? checkedValue : uncheckedValue);
  28541. },
  28542. setValue: function (nv) {
  28543. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28544. var value;
  28545. if (nv === checkedValue) {
  28546. value = true;
  28547. }
  28548. else if (nv === uncheckedValue) {
  28549. value = false;
  28550. }
  28551. else {
  28552. value = !!nv;
  28553. }
  28554. // me.setRawValue(value)
  28555. // me.checked = value
  28556. // return me.mixins.field.setValue.call(me, value);
  28557. setValue.call(this, value);
  28558. },
  28559. updateCheckedCls: function (checked) {
  28560. var me = this;
  28561. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  28562. checked = checked != null ? checked : me.getValue();
  28563. if (checked === uncheckedValue) {
  28564. checked = false;
  28565. }
  28566. else if (checked === checkedValue) {
  28567. checked = true;
  28568. }
  28569. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  28570. },
  28571. initComponent: function () {
  28572. initComponent.call(this);
  28573. },
  28574. });
  28575. }
  28576. //# sourceMappingURL=checkbox.js.map
  28577. function initCheckboxGroup () {
  28578. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  28579. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  28580. Ext.form.CheckboxGroup.override({
  28581. constructor: function (config) {
  28582. var newConfig = _$2.defaultsDeep({
  28583. // 强制属性
  28584. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  28585. cc.call(this, newConfig);
  28586. },
  28587. initComponent: function () {
  28588. initComponent.call(this);
  28589. },
  28590. });
  28591. }
  28592. //# sourceMappingURL=checkboxgroup.js.map
  28593. function initRadio () {
  28594. var cc = Ext.form.field.Radio.prototype.constructor;
  28595. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  28596. Ext.form.field.Radio.override({
  28597. constructor: function (config) {
  28598. var newConfig = _$2.defaultsDeep({
  28599. // 强制属性
  28600. }, baseConfig(config, 'col-item'), config, radio);
  28601. cc.call(this, newConfig);
  28602. },
  28603. initComponent: function () {
  28604. initComponent.call(this);
  28605. },
  28606. });
  28607. }
  28608. //# sourceMappingURL=radio.js.map
  28609. function initRadioGroup () {
  28610. var cc = Ext.form.RadioGroup.prototype.constructor;
  28611. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  28612. Ext.form.RadioGroup.override({
  28613. constructor: function (config) {
  28614. var newConfig = _$2.defaultsDeep({
  28615. // 强制属性
  28616. }, baseConfig(config, 'col-item'), config, radiogroup);
  28617. cc.call(this, newConfig);
  28618. },
  28619. initComponent: function () {
  28620. initComponent.call(this);
  28621. },
  28622. });
  28623. }
  28624. //# sourceMappingURL=radiogroup.js.map
  28625. function initFieldset () {
  28626. /**
  28627. *
  28628. */
  28629. var ct = Ext.form.FieldSet.prototype.constructor;
  28630. Ext.form.FieldSet.override({
  28631. constructor: function (config) {
  28632. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  28633. ct.call(this, newConfig);
  28634. }
  28635. });
  28636. }
  28637. //# sourceMappingURL=fieldset.js.map
  28638. function initCombotree () {
  28639. Ext.define('Yvan.ComboTree', {
  28640. extend: 'Ext.form.field.Picker',
  28641. xtype: 'combotree',
  28642. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28643. config: {
  28644. store: null,
  28645. displayField: null,
  28646. columns: null,
  28647. selectOnTab: true,
  28648. maxPickerHeight: 300,
  28649. minPickerHeight: 100,
  28650. minPickerWidth: 350,
  28651. rootVisible: true,
  28652. },
  28653. editable: false,
  28654. setStore: function (store) {
  28655. this.store = store;
  28656. var me = this;
  28657. if (me.store) {
  28658. if (me.picker) {
  28659. me.picker.setStore(store);
  28660. if (me.isExpanded) {
  28661. me.collapse();
  28662. delete me.picker;
  28663. me.expand();
  28664. }
  28665. }
  28666. this.onLoad();
  28667. me.mon(me.store, {
  28668. scope: me,
  28669. load: me.onLoad,
  28670. update: me.onUpdate
  28671. });
  28672. }
  28673. },
  28674. createPicker: function () {
  28675. var me = this;
  28676. var picker = new Ext.tree.Panel({
  28677. border: false,
  28678. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28679. shrinkWrapDock: 2,
  28680. store: me.store,
  28681. floating: true,
  28682. rootVisible: me.rootVisible,
  28683. displayField: me.displayField,
  28684. columns: me.columns,
  28685. minHeight: me.minPickerHeight,
  28686. maxHeight: me.maxPickerHeight,
  28687. minWidth: me.minPickerWidth,
  28688. manageHeight: false,
  28689. shadow: false,
  28690. scrollable: true,
  28691. // modal: true,
  28692. // constrain: true,
  28693. // constrainTo: topScope._handle.el.dom,
  28694. // renderTo: topScope._handle.el.dom,
  28695. // alignTarget: topScope._handle,
  28696. listeners: {
  28697. scope: me,
  28698. itemclick: me.onItemClick,
  28699. itemkeydown: me.onPickerKeyDown
  28700. }
  28701. }), view = picker.getView();
  28702. if (Ext.isIE9 && Ext.isStrict) {
  28703. view.on({
  28704. scope: me,
  28705. highlightitem: me.repaintPickerView,
  28706. unhighlightitem: me.repaintPickerView,
  28707. afteritemexpand: me.repaintPickerView,
  28708. afteritemcollapse: me.repaintPickerView
  28709. });
  28710. }
  28711. return picker;
  28712. },
  28713. repaintPickerView: function () {
  28714. var style = this.picker.getView().getEl().dom.style;
  28715. style.display = style.display;
  28716. },
  28717. onItemClick: function (view, record, node, rowIndex, e) {
  28718. this.selectItem(view, record);
  28719. },
  28720. onPickerKeyDown: function (treeView, record, item, index, e) {
  28721. var key = e.getKey();
  28722. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  28723. this.selectItem(treeView, record);
  28724. }
  28725. },
  28726. selectItem: function (sender, record) {
  28727. var me = this;
  28728. me.setValue(record.getId());
  28729. me.fireEvent('select', me, record);
  28730. me.collapse();
  28731. },
  28732. onExpand: function () {
  28733. var picker = this.picker;
  28734. var store = picker.store;
  28735. var value = this.value;
  28736. var node;
  28737. if (value) {
  28738. node = store.getNodeById(value);
  28739. }
  28740. if (!node) {
  28741. node = store.getRoot();
  28742. }
  28743. picker.ensureVisible(node, {
  28744. select: true,
  28745. focus: true
  28746. });
  28747. },
  28748. setValue: function (value) {
  28749. var me = this;
  28750. console.log('setValue', value);
  28751. me.value = value;
  28752. if (!me.store || me.store.loading) {
  28753. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  28754. return me.mixins.field.setValue.call(me, value);
  28755. // return me;
  28756. }
  28757. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  28758. if (value === undefined) {
  28759. record = me.store.getRoot();
  28760. console.log('setValue', record.getId());
  28761. me.value = record.getId();
  28762. return me.mixins.field.setValue.call(me, value);
  28763. }
  28764. else {
  28765. record = me.store.getNodeById(value);
  28766. }
  28767. // set the raw value to the record's display field if a record was found
  28768. me.setRawValue(record ? record.get(me.displayField) : '');
  28769. return me.mixins.field.setValue.call(me, value);
  28770. },
  28771. getSubmitValue: function () {
  28772. return this.value;
  28773. },
  28774. getValue: function () {
  28775. return this.value;
  28776. },
  28777. onLoad: function () {
  28778. var value = this.value;
  28779. if (value) {
  28780. this.setValue(value);
  28781. }
  28782. },
  28783. onUpdate: function (store, rec, type, modifiedFieldNames) {
  28784. var display = this.displayField;
  28785. var me = this;
  28786. if (type === 'edit' && modifiedFieldNames &&
  28787. Ext.Array.contains(modifiedFieldNames, display) &&
  28788. this.value === rec.getId()) {
  28789. me.mixins.field.setValue.call(me, this.value);
  28790. this.setRawValue(rec.get(display));
  28791. }
  28792. }
  28793. });
  28794. }
  28795. //# sourceMappingURL=combotree.js.map
  28796. function initPickerPlus () {
  28797. Ext.define('Yvan.PickerAlignCenter', {
  28798. extend: 'Ext.form.field.Picker',
  28799. /**
  28800. * Performs the alignment on the picker using the class defaults
  28801. * @private
  28802. */
  28803. doAlign: function () {
  28804. // 不要挪动就好
  28805. },
  28806. });
  28807. }
  28808. //# sourceMappingURL=pickerplus.js.map
  28809. function initCombogrid () {
  28810. Ext.define('Yvan.ComboGrid', {
  28811. extend: 'Ext.form.field.Picker',
  28812. // extend: 'Yvan.PickerAlignCenter',
  28813. xtype: 'combogrid',
  28814. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  28815. triggers: {
  28816. clear: {
  28817. weight: 0,
  28818. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  28819. hidden: true,
  28820. handler: 'onClearClick',
  28821. },
  28822. },
  28823. config: __assign({}, comboGrid),
  28824. editable: true,
  28825. _superBlur: false,
  28826. allowCustomInput: false,
  28827. pressEnterPopup: true,
  28828. initComponent: function () {
  28829. var that = this;
  28830. var scope = lookupScope(that);
  28831. var config = that.config;
  28832. if (isDesignMode(scope, config)) {
  28833. this.superclass.initComponent.call(this, arguments);
  28834. return;
  28835. }
  28836. this.on({
  28837. blur: function (sender, e) {
  28838. if (this._superBlur) {
  28839. // 挂起时不恢复内容
  28840. return;
  28841. }
  28842. // 离开焦点时,恢复原来的值
  28843. sender.setRawValue(sender.value);
  28844. },
  28845. afterrender: function (sender) {
  28846. var $dom = $(sender.inputEl.dom);
  28847. that.scope = lookupScope(sender);
  28848. if (sender.column) {
  28849. // 列模式,拦截 keydown
  28850. $dom.on('keydown', function (e) {
  28851. if (isChartEvent(e) && !that.tryEnable()) {
  28852. // 没有达成 editEnable 条件,不用响应
  28853. stopEvent(e);
  28854. return;
  28855. }
  28856. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28857. stopEvent(e);
  28858. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28859. return;
  28860. }
  28861. });
  28862. }
  28863. else {
  28864. // 常规模式,拦截 keyup
  28865. $dom.on('keyup', function (e) {
  28866. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  28867. return;
  28868. }
  28869. if (isChartEvent(e) && !that.tryEnable()) {
  28870. // 没有达成 editEnable 条件,不用响应
  28871. stopEvent(e);
  28872. return;
  28873. }
  28874. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28875. stopEvent(e);
  28876. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28877. return;
  28878. }
  28879. if (!that.allowCustomInput) {
  28880. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  28881. stopEvent(e);
  28882. }
  28883. });
  28884. $dom.on('change', function (e) {
  28885. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  28886. // if (that.isExpanded) {
  28887. // that.filterChange(that, e.target.value)
  28888. // }
  28889. stopEvent(e);
  28890. });
  28891. }
  28892. $dom.on('input', function (e) {
  28893. stopEvent(e);
  28894. });
  28895. },
  28896. });
  28897. this.superclass.initComponent.apply(this, arguments);
  28898. },
  28899. createPicker: function () {
  28900. var me = this;
  28901. var cfg = {
  28902. layout: 'fit',
  28903. border: 0,
  28904. // border: 5,
  28905. style: {
  28906. // borderColor: 'black',
  28907. // borderWidth: '5px',
  28908. // borderStyle: 'solid',
  28909. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  28910. },
  28911. shadow: 'side',
  28912. shadowOffset: 100,
  28913. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28914. shrinkWrapDock: 2,
  28915. floating: true,
  28916. width: me.pickerWidth,
  28917. height: me.pickerHeight,
  28918. minWidth: me.pickerWidth,
  28919. minHeight: me.pickerHeight,
  28920. maxWidth: me.pickerWidth,
  28921. maxHeight: me.pickerHeight,
  28922. items: [
  28923. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  28924. xtype: 'toolbar',
  28925. items: [
  28926. { xtype: 'textfield', fieldLabel: '筛选' },
  28927. {
  28928. xtype: 'button',
  28929. text: '查询',
  28930. iconCls: 'x-fa fa-search',
  28931. cssType: 'primary',
  28932. listeners: {
  28933. click: function () {
  28934. me.reloadGrid();
  28935. }
  28936. }
  28937. },
  28938. ]
  28939. }, autoLoad: false, listeners: {
  28940. afterrender: function (grid) {
  28941. me.grid = grid;
  28942. grid.focus();
  28943. grid.on({
  28944. rowdblclick: function (sender, row) {
  28945. me.selectItem(row);
  28946. },
  28947. dataLoadComplete: function (sender) {
  28948. _$2.defer(function () {
  28949. me.setFocus();
  28950. });
  28951. },
  28952. keydown: function (sender, e) {
  28953. if (me.column) {
  28954. // 列模式,拦截 keydown
  28955. me.processKey(e);
  28956. }
  28957. },
  28958. keyup: function (sender, e) {
  28959. if (!me.column) {
  28960. // 常规模式,拦截 keyup
  28961. me.processKey(e);
  28962. }
  28963. }
  28964. });
  28965. },
  28966. } })
  28967. ]
  28968. };
  28969. // @ts-ignore
  28970. var picker = new Ext.container.Container(cfg);
  28971. return picker;
  28972. },
  28973. setFocus: function () {
  28974. if (this.grid.store.getCount() > 0) {
  28975. this.grid.focusRow(0);
  28976. }
  28977. },
  28978. processKey: function (e) {
  28979. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  28980. this.selectItem(this.grid.selection);
  28981. stopEvent(e);
  28982. }
  28983. else if (e.key === 'Escape') {
  28984. this.collapse();
  28985. }
  28986. },
  28987. repaintPickerView: function () {
  28988. var style = this.picker.getView().getEl().dom.style;
  28989. style.display = style.display;
  28990. },
  28991. onItemClick: function (view, record, node, rowIndex, e) {
  28992. this.selectItem(record);
  28993. },
  28994. onPickerKeyDown: function (treeView, record, item, index, e) {
  28995. var key = e.getKey();
  28996. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  28997. this.selectItem(record);
  28998. }
  28999. },
  29000. filterChange: _$2.debounce(function (sender, value) {
  29001. sender.onExpand();
  29002. }, 1000),
  29003. selectItem: function (record) {
  29004. var me = this;
  29005. var lookup = this.lookup;
  29006. var scope = lookupScope(this);
  29007. me.fireEvent('select', me, record);
  29008. if (record.isModel) {
  29009. record = record.data;
  29010. }
  29011. tryWriteObject(lookup, record, function (path, value) {
  29012. me._lookupSet(path, value);
  29013. });
  29014. // lookup
  29015. // fromColumn: 'toTarget'
  29016. // fromColumn: 'toTarget'
  29017. // fromColumn: 'toTarget'
  29018. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  29019. var value = _$2.get(record, fromColumn);
  29020. me._lookupSet(toTarget, value);
  29021. });
  29022. // 选定之后不能做清空
  29023. // const {lookupClearOnChange} = me
  29024. // if (_.isArray(lookupClearOnChange)) {
  29025. // _.each(lookupClearOnChange, item => {
  29026. // me._lookupSet(item, '')
  29027. // })
  29028. // }
  29029. me.collapse();
  29030. // 触发 _raiseNextFocus
  29031. me._raiseNextFocus(me);
  29032. },
  29033. onExpand: function () {
  29034. // 展开时,根据 lookup 带入查询参数
  29035. var expressData = this.getExpressData();
  29036. var txtField = this.grid.down('toolbar').down('textfield');
  29037. txtField.setValue(expressData.queryValue);
  29038. this.reloadGrid();
  29039. },
  29040. reloadGrid: function () {
  29041. // 展开时,根据 lookup 带入查询参数
  29042. var expressData = this.getExpressData();
  29043. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  29044. var txtField = this.grid.down('toolbar').down('textfield');
  29045. // 每个 combogrid 默认带上 __queryValue 属性
  29046. reloadParam["__queryValue"] = txtField.getValue();
  29047. this.grid.reload(reloadParam);
  29048. },
  29049. onTriggerClick: function (sender) {
  29050. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  29051. if (!grid) {
  29052. msg('正在初始化,请稍后');
  29053. return;
  29054. }
  29055. if (!this.tryEnable()) {
  29056. // 没有达成 editEnable 条件,不用弹出
  29057. return;
  29058. }
  29059. if (isExpanded || readOnly || disabled) {
  29060. // 已弹出、只读、禁用状态下,不允许弹出
  29061. return;
  29062. }
  29063. this._superBlur = true;
  29064. this.superclass.onTriggerClick.apply(this, arguments);
  29065. this._superBlur = false;
  29066. },
  29067. onCollapse: function () {
  29068. // 每次收回时,删除下拉组件
  29069. // delete this.picker
  29070. },
  29071. /**
  29072. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  29073. */
  29074. setValue: function (value) {
  29075. var me = this;
  29076. // 设值用户看到的表面内容
  29077. this.setRawValue(value);
  29078. // 设值 setValue 调用链,正常触发 change 事件等
  29079. return me.mixins.field.setValue.call(me, value);
  29080. },
  29081. _lookupSet: function (path, value) {
  29082. var me = this;
  29083. path = tryVarSimple(path);
  29084. if (me.column) {
  29085. // 判断写入目标,是否与自己绑定的属性相等
  29086. if (path === 'queryValue' || me.column.dataIndex === path) {
  29087. me.setValue(value);
  29088. }
  29089. // 列模式下,写当前编辑行
  29090. var parentRecord = me._lookupEditorRecord();
  29091. if (parentRecord) {
  29092. // Ext.data.Record / Ext.data.Model
  29093. parentRecord.set(path, value);
  29094. }
  29095. else {
  29096. debugger;
  29097. }
  29098. }
  29099. else {
  29100. // 常规模式下,写 viewModel
  29101. me.scope.viewModel.set(path, value);
  29102. }
  29103. },
  29104. _lookupGrid: function () {
  29105. return this.column.up('grid');
  29106. },
  29107. _lookupEditorRecord: function () {
  29108. var _a, _b, _c, _d;
  29109. // parentGrid.getSelectionModel().getLastSelected()
  29110. var grid = this._lookupGrid();
  29111. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  29112. if (!editingPlugin) {
  29113. return grid.getSelectionModel().getLastSelected();
  29114. }
  29115. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  29116. if (_$2.isNumber(rowIdx)) {
  29117. return grid.store.getAt(rowIdx);
  29118. }
  29119. else {
  29120. return grid.getSelectionModel().getLastSelected();
  29121. }
  29122. },
  29123. onChange: function (newVal, oldVal) {
  29124. var me = this;
  29125. var value = newVal;
  29126. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  29127. if (hideTrigger || disabled || readOnly || hideClear) {
  29128. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  29129. return;
  29130. }
  29131. if (value) {
  29132. me.getTrigger('clear').show();
  29133. me.updateLayout();
  29134. }
  29135. else {
  29136. me.getTrigger('clear').hide();
  29137. me.updateLayout();
  29138. }
  29139. },
  29140. /**
  29141. * 得到能用于 express 表达式计算的上下文数据
  29142. */
  29143. getExpressData: function () {
  29144. var queryValue = this.getRawValue();
  29145. if (!queryValue) {
  29146. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  29147. queryValue = this.getPicker().down('textfield').getRawValue();
  29148. }
  29149. if (this.column) {
  29150. // 列模式, 准备好判断 editEnable 表达式用的数据
  29151. var parentRecord = this._lookupEditorRecord();
  29152. if (!parentRecord) {
  29153. debugger;
  29154. }
  29155. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  29156. }
  29157. else {
  29158. // 编辑模式,准备好判断用的数据
  29159. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  29160. }
  29161. },
  29162. tryEnable: function () {
  29163. return tryEnable(this.getExpressData(), this.editEnable);
  29164. },
  29165. /**
  29166. * 清空所有值
  29167. */
  29168. onClearClick: function (sender, e) {
  29169. var me = this;
  29170. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  29171. me.fireEvent('clear', sender, e);
  29172. me.setValue('');
  29173. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  29174. me._lookupSet(toTarget, '');
  29175. });
  29176. _$2.each(lookupClearOnChange, function (item) {
  29177. me._lookupSet(item, '');
  29178. });
  29179. }
  29180. });
  29181. }
  29182. //# sourceMappingURL=combogrid.js.map
  29183. function initContainer () {
  29184. var cc = Ext.container.Container.prototype.constructor;
  29185. //const {initComponent} = Ext.container.Container.prototype
  29186. Ext.container.Container.override({
  29187. constructor: function (config) {
  29188. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  29189. cc.call(this, newConfig);
  29190. },
  29191. });
  29192. }
  29193. //# sourceMappingURL=container.js.map
  29194. function initRows () {
  29195. Ext.define('Yvan.Rows', {
  29196. extend: 'Ext.container.Container',
  29197. xtype: 'rows',
  29198. constructor: function (config) {
  29199. var self = this;
  29200. var newConfig = _$2.defaultsDeep({
  29201. // 强制性属性
  29202. layout: 'anchor', border: false,
  29203. defaults: {
  29204. border: false, anchor: '100%',
  29205. margin: '0 0 5 0',
  29206. },
  29207. }, baseConfig(config, 'rows-container'), config, rows);
  29208. this.superclass.constructor.call(self, newConfig);
  29209. },
  29210. });
  29211. }
  29212. //# sourceMappingURL=rows.js.map
  29213. function initForm () {
  29214. var ct = Ext.form.Panel.prototype.constructor;
  29215. Ext.form.Panel.override({
  29216. constructor: function (config) {
  29217. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  29218. ct.call(this, newConfig);
  29219. }
  29220. });
  29221. }
  29222. //# sourceMappingURL=form.js.map
  29223. function initCols () {
  29224. Ext.define('Yvan.Cols', {
  29225. extend: 'Ext.container.Container',
  29226. xtype: 'cols',
  29227. constructor: function (config) {
  29228. var self = this;
  29229. var newConfig = _$2.defaultsDeep({
  29230. // 强制性属性
  29231. layout: 'hbox',
  29232. minHeight: config.designMode ? 32 : 0
  29233. }, baseConfig(config, 'cols-container'), config, cols);
  29234. this.superclass.constructor.call(self, newConfig);
  29235. },
  29236. });
  29237. }
  29238. //# sourceMappingURL=cols.js.map
  29239. function initButton () {
  29240. /**
  29241. *
  29242. */
  29243. var ct = Ext.button.Button.prototype.constructor;
  29244. Ext.button.Button.override({
  29245. constructor: function (config) {
  29246. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  29247. ct.call(this, newConfig);
  29248. },
  29249. setLoading: function (value) {
  29250. if (value) {
  29251. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  29252. this._originIconCls = this.iconCls;
  29253. }
  29254. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  29255. this.setDisabled(true);
  29256. }
  29257. else {
  29258. this.setIconCls(this._originIconCls);
  29259. this.setDisabled(false);
  29260. }
  29261. }
  29262. });
  29263. }
  29264. //# sourceMappingURL=button.js.map
  29265. function initIframe () {
  29266. Ext.define('Ext.ux.IFrame', {
  29267. extend: 'Ext.Component',
  29268. alias: 'widget.uxiframe',
  29269. loadMask: 'Loading...',
  29270. src: 'about:blank',
  29271. renderTpl: [
  29272. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  29273. ],
  29274. childEls: ['iframeEl'],
  29275. initComponent: function () {
  29276. this.superclass.initComponent.call(this);
  29277. this.superclass.initEvents.call(this);
  29278. this.frameName = this.frameName || this.id + '-frame';
  29279. },
  29280. initEvents: function () {
  29281. var me = this;
  29282. this.superclass.initEvents.call(this);
  29283. me.iframeEl.on('load', me.onLoad, me);
  29284. },
  29285. initRenderData: function () {
  29286. return Ext.apply(this.superclass.initRenderData.call(this), {
  29287. src: this.src,
  29288. frameName: this.frameName
  29289. });
  29290. },
  29291. getBody: function () {
  29292. var doc = this.getDoc();
  29293. return doc.body || doc.documentElement;
  29294. },
  29295. getDoc: function () {
  29296. try {
  29297. return this.getWin().document;
  29298. }
  29299. catch (ex) {
  29300. return null;
  29301. }
  29302. },
  29303. getWin: function () {
  29304. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  29305. return win;
  29306. },
  29307. getFrame: function () {
  29308. var me = this;
  29309. return me.iframeEl.dom;
  29310. },
  29311. onLoad: function () {
  29312. var me = this, doc = me.getDoc();
  29313. if (doc) {
  29314. this.el.unmask();
  29315. this.fireEvent('load', this);
  29316. }
  29317. else if (me.src) {
  29318. this.el.unmask();
  29319. this.fireEvent('error', this);
  29320. }
  29321. },
  29322. load: function (src) {
  29323. var me = this, text = me.loadMask, frame = me.getFrame();
  29324. if (me.fireEvent('beforeload', me, src) !== false) {
  29325. if (text && me.el) {
  29326. me.el.mask(text);
  29327. }
  29328. frame.src = me.src = (src || me.src);
  29329. }
  29330. }
  29331. });
  29332. }
  29333. //# sourceMappingURL=iframe.js.map
  29334. /**
  29335. * 属性:
  29336. * - autoLoad: true
  29337. * - dataSource: ''
  29338. * 方法:
  29339. * - handleZoomBig
  29340. * - handleZoomSmall
  29341. * - handleZoomReset
  29342. * - openDiagram
  29343. * - getBpmn
  29344. * - getBpmnCanvas
  29345. * - getBpmnOverlays
  29346. * - getBpmnZoomScroll
  29347. * 事件:
  29348. * - initFinish
  29349. * - failed
  29350. * - success
  29351. * - itemHover
  29352. * - itemOut
  29353. * - itemClick
  29354. * - itemDblclick
  29355. * - itemMousedown
  29356. * - itemMouseup
  29357. */
  29358. function initBpmn () {
  29359. Ext.define('Yvan.Bpmn', {
  29360. // extend: 'Ext.container.Container',
  29361. extend: 'Ext.panel.Panel',
  29362. alias: 'widget.bpmn',
  29363. xtype: 'bpmn',
  29364. constructor: function (config) {
  29365. var self = this;
  29366. var newConfig = _$2.defaultsDeep({
  29367. // 强制性属性
  29368. }, baseConfig(config, 'row-item'), config, bpmn);
  29369. if (!newConfig.hideToolbar) {
  29370. newConfig.tbar = [];
  29371. newConfig.tbar.push({
  29372. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  29373. listeners: {
  29374. click: function (sender) {
  29375. self.reload();
  29376. }
  29377. }
  29378. });
  29379. newConfig.tbar.push({
  29380. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  29381. listeners: {
  29382. click: function (sender) {
  29383. self.handleZoomBig();
  29384. }
  29385. },
  29386. });
  29387. newConfig.tbar.push({
  29388. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  29389. listeners: {
  29390. click: function (sender) {
  29391. self.handleZoomSmall();
  29392. }
  29393. },
  29394. });
  29395. newConfig.tbar.push({
  29396. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  29397. listeners: {
  29398. click: function (sender) {
  29399. self.handleZoomReset();
  29400. }
  29401. },
  29402. });
  29403. }
  29404. this.superclass.constructor.call(self, newConfig);
  29405. },
  29406. initComponent: function () {
  29407. var _this = this;
  29408. var me = this;
  29409. var config = me.config;
  29410. var scope = lookupScope(this);
  29411. if (!isDesignMode(scope, config)) {
  29412. //@ts-ignore
  29413. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  29414. console.log('BpNavigated', me, BpNavigated);
  29415. var dom = me.el.dom;
  29416. var $dom = $(dom);
  29417. var $container = $dom.find('.x-autocontainer-innerCt');
  29418. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  29419. _this._bpmn = bpmn;
  29420. if (_this.autoLoad) {
  29421. _this.reload();
  29422. }
  29423. _this.fireEvent('initFinish', _this);
  29424. var eventBus = bpmn.get('eventBus');
  29425. eventBus.on('element.hover', function (e) {
  29426. // this.fireEvent('itemHover', this, e);
  29427. });
  29428. eventBus.on('element.out', function (e) {
  29429. _this.fireEvent('itemOut', _this, e);
  29430. });
  29431. eventBus.on('element.click', function (e) {
  29432. _this.fireEvent('itemClick', _this, e);
  29433. });
  29434. eventBus.on('element.dblclick', function (e) {
  29435. _this.fireEvent('itemDblclick', _this, e);
  29436. });
  29437. eventBus.on('element.mousedown', function (e) {
  29438. _this.fireEvent('itemMousedown', _this, e);
  29439. });
  29440. eventBus.on('element.mouseup', function (e) {
  29441. _this.fireEvent('itemMouseup', _this, e);
  29442. });
  29443. });
  29444. }
  29445. this.superclass.initComponent.call(this);
  29446. this.on({
  29447. afterrender: function (sender) {
  29448. }
  29449. });
  29450. },
  29451. /**
  29452. * 重新载入
  29453. */
  29454. reload: function () {
  29455. var _this = this;
  29456. var _a;
  29457. if (typeof this.dataSource === 'string' && this.dataSource) {
  29458. var scope = lookupScope(this);
  29459. var fn = lookupFn(scope, this.dataSource);
  29460. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  29461. _this.openDiagram(res.data);
  29462. });
  29463. }
  29464. },
  29465. /**
  29466. * 获取bpmn
  29467. */
  29468. getBpmn: function () {
  29469. return this._bpmn;
  29470. },
  29471. getBpmnCanvas: function () {
  29472. var _a;
  29473. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  29474. },
  29475. getBpmnOverlays: function () {
  29476. var _a;
  29477. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  29478. },
  29479. getBpmnZoomScroll: function () {
  29480. var _a;
  29481. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  29482. },
  29483. handleZoomBig: function () {
  29484. var _a;
  29485. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  29486. },
  29487. handleZoomSmall: function () {
  29488. var _a;
  29489. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  29490. },
  29491. handleZoomReset: function () {
  29492. var _a;
  29493. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  29494. },
  29495. openDiagram: function (diagram) {
  29496. var _this = this;
  29497. if (!this.getBpmn()) {
  29498. return;
  29499. }
  29500. this.getBpmn().importXML(diagram, function (err) {
  29501. if (err) {
  29502. // YvEventDispatch(this.onFailed, this, undefined);
  29503. _this.fireEvent('failed', _this, err);
  29504. return console.error('could not import BPMN 2.0 diagram', err);
  29505. }
  29506. // zoom to fit full viewport
  29507. _this.getBpmnCanvas().zoom('fit-viewport');
  29508. _this.fireEvent('success', _this);
  29509. });
  29510. },
  29511. });
  29512. }
  29513. //# sourceMappingURL=bpmn.js.map
  29514. function initSqlComplex () {
  29515. Ext.define('Yvan.SqlComplex', {
  29516. extend: 'Ext.panel.Panel',
  29517. xtype: 'sqlcomplex',
  29518. alias: 'widget.sqlcomplex',
  29519. getSqlExpress: function () {
  29520. },
  29521. constructor: function (config) {
  29522. var reference = config.reference;
  29523. var me = this;
  29524. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29525. {
  29526. region: 'west',
  29527. width: 280,
  29528. border: false,
  29529. split: true,
  29530. reference: reference + '_tree',
  29531. xtype: 'yvtree',
  29532. hideRefresh: true,
  29533. hideExpand: true,
  29534. hideCollapse: true,
  29535. listeners: {
  29536. itemdblclick: function (sender, record, item, index, e) {
  29537. var field = record.get('field');
  29538. var defaultValue = record.get('defaultValue');
  29539. if (!field) {
  29540. return;
  29541. }
  29542. var tabExpress = me.down('tabpanel');
  29543. var sqleditor = me.down('sqleditor');
  29544. var expressGrid = me.down('yvgrid');
  29545. if (tabExpress.getActiveTab().key !== 'grid') {
  29546. // SQL 模式
  29547. sqleditor.insertText(field + '=');
  29548. }
  29549. else {
  29550. // 表格模式
  29551. expressGrid.appendEditRow({
  29552. field: field,
  29553. operator: '=',
  29554. value: defaultValue,
  29555. remark: '',
  29556. });
  29557. _$2.defer(function () {
  29558. gridChanged(me, expressGrid);
  29559. });
  29560. }
  29561. }
  29562. },
  29563. },
  29564. {
  29565. region: 'center',
  29566. xtype: 'tabpanel',
  29567. reference: reference + '_tab',
  29568. tabPosition: 'bottom',
  29569. listeners: {
  29570. afterrender: function (sender) {
  29571. var scope = lookupScope(me);
  29572. var value = scope.viewModel.get(me.config.bindValue);
  29573. // sql 转换为 grid
  29574. try {
  29575. var list_1 = parseSqlToGrid(value);
  29576. _$2.defer(function () {
  29577. var grid = me.down('yvgrid');
  29578. grid.setData(list_1);
  29579. });
  29580. }
  29581. catch (e) {
  29582. console.error(e);
  29583. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29584. var tabSql = sender.down('sqleditor');
  29585. sender.setActiveTab(tabSql);
  29586. }
  29587. },
  29588. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29589. var scope = lookupScope(me);
  29590. var value = scope.viewModel.get(me.config.bindValue);
  29591. if (newCard.key === 'grid') {
  29592. // sql 转换为 grid
  29593. try {
  29594. var list_2 = parseSqlToGrid(value);
  29595. _$2.defer(function () {
  29596. var grid = me.down('yvgrid');
  29597. grid.setData(list_2);
  29598. });
  29599. return true;
  29600. }
  29601. catch (e) {
  29602. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29603. console.error(e);
  29604. return false;
  29605. }
  29606. }
  29607. else if (newCard.key === 'sql') {
  29608. // grid 转换为 sql
  29609. _$2.defer(function () {
  29610. var editor = me.down('sqleditor');
  29611. editor.setValue(value);
  29612. });
  29613. return true;
  29614. }
  29615. }
  29616. },
  29617. items: [
  29618. {
  29619. title: '表格模式',
  29620. key: 'grid',
  29621. xtype: 'yvgrid',
  29622. _mode: 'select',
  29623. reference: reference + '_grid',
  29624. hideFootbar: true,
  29625. pagination: false,
  29626. tbar: [
  29627. {
  29628. xtype: 'button',
  29629. text: '删除',
  29630. iconCls: 'x-fa fa-minus-circle',
  29631. cls: 'ext-btn-danger',
  29632. bind: {
  29633. disabled: '{!' + reference + '_grid.selection}',
  29634. },
  29635. listeners: {
  29636. click: function (sender) {
  29637. var grid = sender.up('yvgrid');
  29638. removeGridRow(grid);
  29639. gridChanged(me, grid);
  29640. }
  29641. },
  29642. },
  29643. ],
  29644. store: {},
  29645. listeners: {
  29646. editfinish: function (sender) {
  29647. gridChanged(me, sender);
  29648. },
  29649. },
  29650. columns: [
  29651. {
  29652. dataIndex: 'field',
  29653. header: '字段', sortable: false, menuDisabled: true,
  29654. width: 190,
  29655. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  29656. var column = context.column;
  29657. var propertyConfig = me.config.propertyConfig;
  29658. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29659. var field = record.get('field');
  29660. if (field) {
  29661. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29662. if (idx >= 0) {
  29663. var meta = propertyConfig[idx];
  29664. return meta.text;
  29665. }
  29666. }
  29667. return value;
  29668. }
  29669. },
  29670. {
  29671. dataIndex: 'operator',
  29672. header: '运算符', sortable: false, menuDisabled: true,
  29673. dict: 'operator',
  29674. width: 65,
  29675. editor: { xtype: 'combo' },
  29676. },
  29677. {
  29678. dataIndex: 'value',
  29679. header: '值', sortable: false, menuDisabled: true,
  29680. flex: 1,
  29681. getEditor: function (record) {
  29682. var column = this;
  29683. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  29684. var propertyConfig = me.config.propertyConfig;
  29685. var field = record.get('field');
  29686. if (!field) {
  29687. // 没有填 propertyName
  29688. return;
  29689. }
  29690. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29691. if (idx < 0) {
  29692. console.error('没有找到 field=' + field + ". propertyConfig");
  29693. return;
  29694. }
  29695. var meta = propertyConfig[idx];
  29696. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  29697. return new Ext.grid.CellEditor({
  29698. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  29699. });
  29700. }
  29701. return new Ext.grid.CellEditor({
  29702. field: __assign({ dict: meta.dict }, meta.editor)
  29703. });
  29704. },
  29705. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  29706. var column = context.column;
  29707. var grid = _$2.get(view, 'ownerGrid');
  29708. var propertyConfig = me.config.propertyConfig;
  29709. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29710. var field = record.get('field');
  29711. if (field) {
  29712. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  29713. if (idx >= 0) {
  29714. var meta = propertyConfig[idx];
  29715. var dictName = _$2.get(meta, 'dict');
  29716. if (dictName && window['DICT_CACHE'][dictName]) {
  29717. var dict_1 = window['DICT_CACHE'][dictName];
  29718. var valueText_1 = [];
  29719. _$2.forEach(_$2.split(valueList, ','), function (value) {
  29720. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  29721. if (idxKv >= 0) {
  29722. valueText_1.push(dict_1[idxKv].text);
  29723. }
  29724. else {
  29725. valueText_1.push(value);
  29726. }
  29727. });
  29728. return valueText_1.join(',');
  29729. }
  29730. }
  29731. }
  29732. return valueList;
  29733. },
  29734. },
  29735. ]
  29736. },
  29737. {
  29738. title: 'SQL模式',
  29739. key: 'sql',
  29740. xtype: 'sqleditor',
  29741. reference: reference + '_sql',
  29742. listeners: {
  29743. change: function (sender) {
  29744. var scope = lookupScope(me);
  29745. // 保存 editor 写入的值
  29746. scope.viewModel.set(me.config.bindValue, sender.getValue());
  29747. }
  29748. }
  29749. },
  29750. ]
  29751. }
  29752. ] });
  29753. this.superclass.constructor.call(this, newConfig);
  29754. },
  29755. initComponent: function () {
  29756. // 货位条件树
  29757. var me = this;
  29758. me.superclass.initComponent.apply(this, arguments);
  29759. var tree = this.down('yvtree');
  29760. var config = me.config;
  29761. tree.setRootNode(buildConfigTree(config.propertyConfig));
  29762. },
  29763. });
  29764. function gridChanged(me, grid) {
  29765. var data = grid.getDataRows();
  29766. var propertyConfig = me.config.propertyConfig;
  29767. var bindValue = me.config.bindValue;
  29768. var scope = lookupScope(me);
  29769. var sql = parseGridToSql(data);
  29770. scope.viewModel.set(bindValue, sql);
  29771. }
  29772. /**
  29773. * 用于从 propertyConfig 解析出树形结构
  29774. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  29775. * ->
  29776. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  29777. */
  29778. function buildConfigTree(propertyConfig) {
  29779. var root = {
  29780. expanded: true,
  29781. leaf: false,
  29782. children: []
  29783. };
  29784. var categoryObj = {};
  29785. var cfgList = propertyConfig;
  29786. _$2.forEach(cfgList, function (cfg) {
  29787. var cateNode = categoryObj[cfg.category];
  29788. if (!cateNode) {
  29789. cateNode = {
  29790. text: cfg.category, expanded: true, leaf: false,
  29791. children: []
  29792. };
  29793. categoryObj[cfg.category] = cateNode;
  29794. root.children.push(cateNode);
  29795. }
  29796. cateNode.children.push({
  29797. text: cfg.text,
  29798. field: cfg.field,
  29799. operator: cfg.operator,
  29800. defaultValue: cfg.defaultValue,
  29801. leaf: true,
  29802. });
  29803. });
  29804. return root;
  29805. }
  29806. /**
  29807. * 将表格变成 SQL where语句 [
  29808. * {field: 'f1', value: 1, operator: '='}
  29809. * {field: 'f2', value: 2, operator: '='}
  29810. * {field: 'f3', value: '3', operator: '>='}
  29811. * {field: 'f4', value: 4, operator: '='}
  29812. * ]
  29813. * ->
  29814. * f1=v1 and f2=v2
  29815. */
  29816. function parseGridToSql(list) {
  29817. var sqls = [];
  29818. _$2.forEach(list, function (i) {
  29819. var _a;
  29820. if (i.operator === 'in') {
  29821. sqls.push(i.field + ' in (' + (i.value) + ')');
  29822. }
  29823. else if (i.operator === 'notIn') {
  29824. sqls.push(i.field + ' not in (' + (i.value) + ')');
  29825. }
  29826. else {
  29827. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  29828. }
  29829. });
  29830. return sqls.join(' AND ');
  29831. }
  29832. /**
  29833. * 将 SQL 语句的 where 片段变成表格
  29834. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  29835. * @return [
  29836. {field: 'f1', value: 1, operator: '='}
  29837. {field: 'f2', value: 2, operator: '='}
  29838. {field: 'f3', value: '3', operator: '>='}
  29839. {field: 'f4', value: 4, operator: '='}
  29840. ]
  29841. */
  29842. function parseSqlToGrid(sql) {
  29843. if (!sql || !_$2.trim(sql)) {
  29844. return [];
  29845. }
  29846. var parser = new window['NodeSQLParser'].Parser();
  29847. var ast = parser.astify('select * from dual where ' + sql);
  29848. var ret = [];
  29849. exp(ast.where, ret);
  29850. return ret;
  29851. }
  29852. function exp(ast, ret) {
  29853. if (ast.type === 'binary_expr') {
  29854. if (_$2.toUpper(ast.operator) === 'AND') {
  29855. if (ast.left.type === 'binary_expr') {
  29856. exp(ast.left, ret);
  29857. }
  29858. if (ast.right.type === 'binary_expr') {
  29859. exp(ast.right, ret);
  29860. }
  29861. }
  29862. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  29863. if (ast.left.type === 'column_ref') {
  29864. if (ast.right.type === 'number' ||
  29865. ast.right.type === 'single_quote_string' ||
  29866. ast.right.type === 'double_quote_string') {
  29867. // 具体值相等
  29868. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  29869. }
  29870. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  29871. && ast.right.type === 'expr_list') {
  29872. // in / not in
  29873. var valueList_1 = [];
  29874. _$2.forEach(ast.right.value, function (item) {
  29875. valueList_1.push(item.value);
  29876. });
  29877. var operator = void 0;
  29878. if (_$2.toUpper(ast.operator) === 'IN') {
  29879. operator = 'in';
  29880. }
  29881. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  29882. operator = 'notIn';
  29883. }
  29884. ret.push({
  29885. field: ast.left.column, value: valueList_1.join(','),
  29886. operator: operator
  29887. });
  29888. }
  29889. else {
  29890. throw new Error('ast.right must is value.');
  29891. }
  29892. }
  29893. else {
  29894. throw new Error('ast.left must is column_ref.');
  29895. }
  29896. }
  29897. else {
  29898. // 必须用 AND 条件符匹配
  29899. throw new Error('ast.operator must is "AND / =".');
  29900. }
  29901. }
  29902. else {
  29903. throw new Error('ast.type must is "binary_expr".');
  29904. }
  29905. }
  29906. /**
  29907. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  29908. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  29909. {
  29910. type: 'binary_expr',
  29911. operator: 'AND',
  29912. left: {
  29913. type: 'binary_expr',
  29914. operator: 'AND',
  29915. left: {
  29916. type: 'binary_expr',
  29917. operator: 'AND',
  29918. left: {
  29919. type: 'binary_expr',
  29920. operator: 'AND',
  29921. left: {
  29922. type: 'binary_expr',
  29923. operator: '=',
  29924. left: {
  29925. type: 'column_ref',
  29926. table: null,
  29927. column: 'f1'
  29928. },
  29929. right: {
  29930. type: 'number',
  29931. value: 1
  29932. }
  29933. },
  29934. right: {
  29935. type: 'binary_expr',
  29936. operator: '=',
  29937. left: {
  29938. type: 'column_ref',
  29939. table: null,
  29940. column: 'f2'
  29941. },
  29942. right: {
  29943. type: 'number',
  29944. value: 2
  29945. }
  29946. }
  29947. },
  29948. right: {
  29949. type: 'binary_expr',
  29950. operator: '=',
  29951. left: {
  29952. type: 'column_ref',
  29953. table: null,
  29954. column: 'f3'
  29955. },
  29956. right: {
  29957. type: 'single_quote_string',
  29958. value: '3'
  29959. }
  29960. }
  29961. },
  29962. right: {
  29963. type: 'binary_expr',
  29964. operator: '>=',
  29965. left: {
  29966. type: 'column_ref',
  29967. table: null,
  29968. column: 'f4'
  29969. },
  29970. right: {
  29971. type: 'number',
  29972. value: 4
  29973. }
  29974. }
  29975. },
  29976. right: {
  29977. type: 'binary_expr',
  29978. operator: '<',
  29979. left: {
  29980. type: 'column_ref',
  29981. table: null,
  29982. column: 'f4'
  29983. },
  29984. right: {
  29985. type: 'number',
  29986. value: 3
  29987. }
  29988. }
  29989. }
  29990. * */
  29991. }
  29992. //# sourceMappingURL=SqlComplex.js.map
  29993. function initParamComplex () {
  29994. Ext.define('Yvan.ParamComplex', {
  29995. extend: 'Ext.panel.Panel',
  29996. xtype: 'paramcomplex',
  29997. alias: 'widget.paramcomplex',
  29998. getSqlExpress: function () {
  29999. },
  30000. constructor: function (config) {
  30001. var reference = config.reference;
  30002. var me = this;
  30003. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  30004. {
  30005. region: 'west',
  30006. width: 280,
  30007. border: false,
  30008. split: true,
  30009. reference: reference + '_tree',
  30010. xtype: 'yvtree',
  30011. hideRefresh: true,
  30012. hideExpand: true,
  30013. hideCollapse: true,
  30014. listeners: {
  30015. itemdblclick: function (sender, record, item, index, e) {
  30016. var field = record.get('field');
  30017. var defaultValue = record.get('defaultValue');
  30018. if (!field) {
  30019. return;
  30020. }
  30021. var tabExpress = me.down('tabpanel');
  30022. var sqleditor = me.down('sqleditor');
  30023. var expressGrid = me.down('yvgrid');
  30024. if (tabExpress.getActiveTab().key !== 'grid') {
  30025. // SQL 模式
  30026. sqleditor.insertText(field + '=');
  30027. }
  30028. else {
  30029. // 表格模式
  30030. expressGrid.appendEditRow({
  30031. field: field,
  30032. operator: '=',
  30033. value: defaultValue,
  30034. remark: '',
  30035. });
  30036. _$2.defer(function () {
  30037. gridChanged(me, expressGrid);
  30038. });
  30039. }
  30040. }
  30041. },
  30042. },
  30043. {
  30044. region: 'center',
  30045. xtype: 'tabpanel',
  30046. reference: reference + '_tab',
  30047. tabPosition: 'bottom',
  30048. listeners: {
  30049. afterrender: function (sender) {
  30050. var scope = lookupScope(me);
  30051. var value = scope.viewModel.get(me.config.bindValue);
  30052. // sql 转换为 grid
  30053. try {
  30054. var list_1 = parseParamToGrid(value);
  30055. _$2.defer(function () {
  30056. var grid = me.down('yvgrid');
  30057. grid.setData(list_1);
  30058. });
  30059. }
  30060. catch (e) {
  30061. console.error(e);
  30062. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  30063. var tabSql = sender.down('sqleditor');
  30064. sender.setActiveTab(tabSql);
  30065. }
  30066. },
  30067. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  30068. var scope = lookupScope(me);
  30069. var value = scope.viewModel.get(me.config.bindValue);
  30070. if (newCard.key === 'grid') {
  30071. // sql 转换为 grid
  30072. try {
  30073. var list_2 = parseParamToGrid(value);
  30074. _$2.defer(function () {
  30075. var grid = me.down('yvgrid');
  30076. grid.setData(list_2);
  30077. });
  30078. return true;
  30079. }
  30080. catch (e) {
  30081. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  30082. console.error(e);
  30083. return false;
  30084. }
  30085. }
  30086. else if (newCard.key === 'sql') {
  30087. // grid 转换为 sql
  30088. _$2.defer(function () {
  30089. var editor = me.down('sqleditor');
  30090. editor.setValue(value);
  30091. });
  30092. return true;
  30093. }
  30094. }
  30095. },
  30096. items: [
  30097. {
  30098. title: '表格模式',
  30099. key: 'grid',
  30100. xtype: 'yvgrid',
  30101. _mode: 'select',
  30102. reference: reference + '_grid',
  30103. hideFootbar: true,
  30104. pagination: false,
  30105. tbar: [
  30106. {
  30107. xtype: 'button',
  30108. text: '删除',
  30109. iconCls: 'x-fa fa-minus-circle',
  30110. cls: 'ext-btn-danger',
  30111. bind: {
  30112. disabled: '{!' + reference + '_grid.selection}',
  30113. },
  30114. listeners: {
  30115. click: function (sender) {
  30116. var grid = sender.up('yvgrid');
  30117. removeGridRow(grid);
  30118. gridChanged(me, grid);
  30119. }
  30120. },
  30121. },
  30122. ],
  30123. store: {},
  30124. listeners: {
  30125. editfinish: function (sender) {
  30126. gridChanged(me, sender);
  30127. },
  30128. },
  30129. columns: [
  30130. {
  30131. dataIndex: 'field',
  30132. header: '字段', sortable: false, menuDisabled: true,
  30133. width: 190,
  30134. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  30135. var column = context.column;
  30136. var propertyConfig = me.config.propertyConfig;
  30137. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30138. var field = record.get('field');
  30139. if (field) {
  30140. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30141. if (idx >= 0) {
  30142. var meta = propertyConfig[idx];
  30143. return meta.text;
  30144. }
  30145. }
  30146. return value;
  30147. }
  30148. },
  30149. {
  30150. dataIndex: 'value',
  30151. header: '值', sortable: false, menuDisabled: true,
  30152. flex: 1,
  30153. getEditor: function (record) {
  30154. var column = this;
  30155. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  30156. var propertyConfig = me.config.propertyConfig;
  30157. var field = record.get('field');
  30158. if (!field) {
  30159. // 没有填 propertyName
  30160. return;
  30161. }
  30162. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30163. if (idx < 0) {
  30164. console.error('没有找到 field=' + field + ". propertyConfig");
  30165. return;
  30166. }
  30167. var meta = propertyConfig[idx];
  30168. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  30169. return new Ext.grid.CellEditor({
  30170. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  30171. });
  30172. }
  30173. return new Ext.grid.CellEditor({
  30174. field: __assign({ dict: meta.dict }, meta.editor)
  30175. });
  30176. },
  30177. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  30178. var column = context.column;
  30179. var grid = _$2.get(view, 'ownerGrid');
  30180. var propertyConfig = me.config.propertyConfig;
  30181. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30182. var field = record.get('field');
  30183. if (field) {
  30184. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  30185. if (idx >= 0) {
  30186. var meta = propertyConfig[idx];
  30187. var dictName = _$2.get(meta, 'dict');
  30188. if (dictName && window['DICT_CACHE'][dictName]) {
  30189. var dict_1 = window['DICT_CACHE'][dictName];
  30190. var valueText_1 = [];
  30191. _$2.forEach(_$2.split(valueList, ','), function (value) {
  30192. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  30193. if (idxKv >= 0) {
  30194. valueText_1.push(dict_1[idxKv].text);
  30195. }
  30196. else {
  30197. valueText_1.push(value);
  30198. }
  30199. });
  30200. return valueText_1.join(',');
  30201. }
  30202. }
  30203. }
  30204. return valueList;
  30205. },
  30206. },
  30207. ]
  30208. },
  30209. {
  30210. title: '文本模式',
  30211. key: 'sql',
  30212. xtype: 'sqleditor',
  30213. reference: reference + '_sql',
  30214. listeners: {
  30215. change: function (sender) {
  30216. var scope = lookupScope(me);
  30217. // 保存 editor 写入的值
  30218. scope.viewModel.set(me.config.bindValue, sender.getValue());
  30219. }
  30220. }
  30221. },
  30222. ]
  30223. }
  30224. ] });
  30225. this.superclass.constructor.call(this, newConfig);
  30226. },
  30227. initComponent: function () {
  30228. // 货位条件树
  30229. var me = this;
  30230. me.superclass.initComponent.apply(this, arguments);
  30231. var tree = this.down('yvtree');
  30232. var config = me.config;
  30233. tree.setRootNode(buildConfigTree(config.propertyConfig));
  30234. },
  30235. });
  30236. function gridChanged(me, grid) {
  30237. var data = grid.getDataRows();
  30238. var propertyConfig = me.config.propertyConfig;
  30239. var bindValue = me.config.bindValue;
  30240. var scope = lookupScope(me);
  30241. var sql = parseGridToParam(data);
  30242. scope.viewModel.set(bindValue, sql);
  30243. }
  30244. /**
  30245. * 用于从 propertyConfig 解析出树形结构
  30246. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  30247. * ->
  30248. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  30249. */
  30250. function buildConfigTree(propertyConfig) {
  30251. var root = {
  30252. expanded: true,
  30253. leaf: false,
  30254. children: []
  30255. };
  30256. var categoryObj = {};
  30257. var cfgList = propertyConfig;
  30258. _$2.forEach(cfgList, function (cfg) {
  30259. var cateNode = categoryObj[cfg.category];
  30260. if (!cateNode) {
  30261. cateNode = {
  30262. text: cfg.category, expanded: true, leaf: false,
  30263. children: []
  30264. };
  30265. categoryObj[cfg.category] = cateNode;
  30266. root.children.push(cateNode);
  30267. }
  30268. cateNode.children.push({
  30269. text: cfg.text,
  30270. field: cfg.field,
  30271. operator: cfg.operator,
  30272. defaultValue: cfg.defaultValue,
  30273. leaf: true,
  30274. });
  30275. });
  30276. return root;
  30277. }
  30278. /**
  30279. * 将表格变成参数语句 [
  30280. * {field: 'f1', value: 1}
  30281. * {field: 'f2', value: 2}
  30282. * {field: 'f3', value: '3'}
  30283. * {field: 'f4', value: 4}
  30284. * ]
  30285. * ->
  30286. * f1=v1, f2=v2
  30287. */
  30288. function parseGridToParam(list) {
  30289. var sqls = [];
  30290. _$2.forEach(list, function (i) {
  30291. sqls.push(i.field + '=' + (i.value));
  30292. });
  30293. return sqls.join('; ');
  30294. }
  30295. /**
  30296. * 将 分号分割的的参数设置 变成表格
  30297. * @param param a=1; b=2; c='3'
  30298. * @return [
  30299. {field: 'a', value: 1}
  30300. {field: 'b', value: 2}
  30301. {field: 'c', value: '3'}
  30302. ]
  30303. */
  30304. function parseParamToGrid(param) {
  30305. if (!param || !_$2.trim(param)) {
  30306. return [];
  30307. }
  30308. var ret = [];
  30309. var sp = _$2.split(param, ';');
  30310. _$2.forEach(sp, function (v) {
  30311. var vi = _$2.indexOf(v, '=');
  30312. var field = _$2.trim(v.substr(0, vi));
  30313. var value = eval(v.substr(vi + 1));
  30314. ret.push({ field: field, value: value });
  30315. });
  30316. return ret;
  30317. }
  30318. }
  30319. //# sourceMappingURL=ParamComplex.js.map
  30320. function initSqlEditor$1 () {
  30321. Ext.define('com.yvan.studio.SqlEditor', {
  30322. extend: 'Ext.panel.Panel',
  30323. alias: 'widget.sqleditor',
  30324. xtype: 'sqleditor',
  30325. layout: 'fit',
  30326. border: false,
  30327. html: "<div class=\"editor\"/>",
  30328. config: {
  30329. value: ''
  30330. },
  30331. codeChange: undefined,
  30332. isChangeFromOuter: false,
  30333. setCode: function (value) {
  30334. var _this = this;
  30335. this.code = value;
  30336. this.value = value;
  30337. _$2.defer(function () {
  30338. _this.isChangeFromOuter = true;
  30339. if (_this.editor) {
  30340. _this.editor.setValue(value);
  30341. }
  30342. });
  30343. },
  30344. getCode: function () {
  30345. return this.getValue();
  30346. },
  30347. updateOptions: function (options) {
  30348. if (this.editor && options) {
  30349. this.editor.updateOptions(options);
  30350. }
  30351. },
  30352. getValue: function () {
  30353. if (!this.editor) {
  30354. return this.code;
  30355. }
  30356. return this.editor.getValue();
  30357. },
  30358. applyPosition: function () {
  30359. var _this = this;
  30360. if (this.autoFocusMethod) {
  30361. if (this.editor) {
  30362. _$2.defer(function () {
  30363. if (_this.autoFocusStartLine) {
  30364. _this.editor.setPosition({
  30365. lineNumber: _this.autoFocusStartLine,
  30366. column: _this.autoFocusStartColumn
  30367. });
  30368. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30369. }
  30370. _this.editor.focus();
  30371. });
  30372. delete this.autoFocusMethod;
  30373. }
  30374. }
  30375. this.editor.layout();
  30376. },
  30377. insertText: function (text) {
  30378. var editor = this.editor;
  30379. var position = editor.getPosition();
  30380. editor.executeEdits('', [
  30381. {
  30382. range: {
  30383. startLineNumber: position.lineNumber,
  30384. startColumn: position.column,
  30385. endLineNumber: position.lineNumber,
  30386. endColumn: position.column
  30387. },
  30388. text: text
  30389. }
  30390. ]);
  30391. },
  30392. setValue: function (value, fromEditor) {
  30393. this.setCode(value);
  30394. var me = this;
  30395. if (me.value === value) {
  30396. // 值相等,不需要变化
  30397. return;
  30398. }
  30399. if (fromEditor !== true && me.editor) {
  30400. // 不是来源于编辑器的变化,才设置编辑器的值
  30401. me.editor.setValue(value);
  30402. }
  30403. // 通知mixins setValue
  30404. me.value = value;
  30405. me.fireEvent('change', value);
  30406. },
  30407. initComponent: function () {
  30408. var that = this;
  30409. this.superclass.initComponent.call(this);
  30410. that.on({
  30411. resize: function () {
  30412. if (that.editor) {
  30413. that.editor.layout();
  30414. }
  30415. },
  30416. destory: function () {
  30417. if (that.editor) {
  30418. that.editor.dispose();
  30419. delete that.editor;
  30420. }
  30421. },
  30422. afterrender: function (sender) {
  30423. var $dom = $(that.el.dom).find('.editor');
  30424. attach_2($dom[0], {
  30425. value: that.code
  30426. }).then(function (editor) {
  30427. that.editor = editor;
  30428. that.applyPosition();
  30429. that.editor.onDidChangeModelContent(function (e) {
  30430. that.fireEvent('change', that.editor, e);
  30431. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30432. that.codeChange(that.editor.getValue(), that.name, e);
  30433. }
  30434. that.isChangeFromOuter = false;
  30435. });
  30436. });
  30437. }
  30438. });
  30439. }
  30440. });
  30441. function attach_2(element, opts) {
  30442. if (!window['monaco']) {
  30443. return;
  30444. }
  30445. var monaco = window['monaco'];
  30446. return new Promise(function (resolve) {
  30447. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  30448. enabled: false
  30449. } }));
  30450. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  30451. // const sql = editor.getValue()
  30452. // if (_.trim(sql).length > 0) {
  30453. // editor.setValue(format(sql, {
  30454. // indent: ' ',
  30455. // uppercase: true,
  30456. // }))
  30457. // }
  30458. // })
  30459. editor.onKeyUp(function (e) {
  30460. // console.log(e)
  30461. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30462. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30463. }
  30464. });
  30465. resolve(editor);
  30466. });
  30467. }
  30468. }
  30469. //# sourceMappingURL=SqlEditor.js.map
  30470. function initJsonEditor$1 () {
  30471. Ext.define('com.yvan.studio.JsonEditor', {
  30472. extend: 'Ext.panel.Panel',
  30473. alias: 'widget.jsoneditor',
  30474. xtype: 'jsoneditor',
  30475. layout: 'fit',
  30476. border: false,
  30477. html: "<div class=\"editor\"/>",
  30478. autoFocusMethod: true,
  30479. autoFocusStartLine: 0,
  30480. autoFocusStartColumn: 0,
  30481. codeChange: undefined,
  30482. funcArr: [],
  30483. modulePage: null,
  30484. isChangeFromOuter: false,
  30485. name: "",
  30486. /**
  30487. * 设置代码
  30488. */
  30489. setCode: function (value) {
  30490. var _this = this;
  30491. this.code = value;
  30492. _$2.defer(function () {
  30493. _this.isChangeFromOuter = true;
  30494. if (_this.editor) {
  30495. _this.editor.setValue(value);
  30496. }
  30497. });
  30498. },
  30499. updateOptions: function (options) {
  30500. if (this.editor && options) {
  30501. this.editor.updateOptions(options);
  30502. }
  30503. },
  30504. setLanguage: function (lang) {
  30505. if (!window['monaco']) {
  30506. return;
  30507. }
  30508. var monaco = window['monaco'];
  30509. if (this.editor && lang) {
  30510. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  30511. }
  30512. },
  30513. getCode: function () {
  30514. var _a;
  30515. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30516. },
  30517. applyPosition: function () {
  30518. var _this = this;
  30519. if (this.autoFocusMethod) {
  30520. if (this.editor) {
  30521. _$2.defer(function () {
  30522. if (_this.autoFocusStartLine) {
  30523. _this.editor.setPosition({
  30524. lineNumber: _this.autoFocusStartLine,
  30525. column: _this.autoFocusStartColumn
  30526. });
  30527. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30528. }
  30529. _this.editor.focus();
  30530. });
  30531. delete this.autoFocusMethod;
  30532. }
  30533. }
  30534. this.editor.layout();
  30535. },
  30536. initComponent: function () {
  30537. var that = this;
  30538. this.superclass.initComponent.apply(this, arguments);
  30539. this.on({
  30540. resize: function (sender, width, height) {
  30541. if (that.editor) {
  30542. that.editor.layout();
  30543. }
  30544. },
  30545. destory: function () {
  30546. if (that.editor) {
  30547. that.editor.dispose();
  30548. delete that.editor;
  30549. }
  30550. },
  30551. afterrender: function (sender) {
  30552. var $dom = $(that.el.dom).find('.editor');
  30553. attach_116($dom[0], {
  30554. value: that.code
  30555. }).then(function (editor) {
  30556. that.editor = editor;
  30557. that.applyPosition();
  30558. that.editor.onDidChangeModelContent(function (e) {
  30559. that.fireEvent('change', that.editor, e);
  30560. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30561. that.codeChange(that.editor.getValue(), that.name, e);
  30562. }
  30563. that.isChangeFromOuter = false;
  30564. });
  30565. });
  30566. }
  30567. });
  30568. },
  30569. });
  30570. function attach_116(element, opts) {
  30571. if (!window['monaco']) {
  30572. return;
  30573. }
  30574. var monaco = window['monaco'];
  30575. return new Promise(function (resolve) {
  30576. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  30577. enabled: false
  30578. } }));
  30579. editor.onKeyUp(function (e) {
  30580. // console.log(e)
  30581. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30582. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30583. }
  30584. });
  30585. resolve(editor);
  30586. });
  30587. }
  30588. }
  30589. //# sourceMappingURL=JsonEditor.js.map
  30590. function initJsEditor$1 () {
  30591. Ext.define('com.yvan.studio.JsEditor', {
  30592. extend: 'Ext.panel.Panel',
  30593. alias: 'widget.jseditor',
  30594. xtype: 'jseditor',
  30595. layout: 'fit',
  30596. border: false,
  30597. html: "<div class=\"editor\"/>",
  30598. autoFocusMethod: true,
  30599. autoFocusStartLine: 0,
  30600. autoFocusStartColumn: 0,
  30601. codeChange: undefined,
  30602. funcArr: [],
  30603. modulePage: null,
  30604. isChangeFromOuter: false,
  30605. name: "",
  30606. /**
  30607. * 设置代码
  30608. */
  30609. setCode: function (value) {
  30610. var _this = this;
  30611. this.code = value;
  30612. _$2.defer(function () {
  30613. _this.isChangeFromOuter = true;
  30614. if (_this.editor) {
  30615. _this.editor.setValue(value);
  30616. if (_this.name === "controllerEditor") {
  30617. _this.funcArr = _this.getAllFunction();
  30618. }
  30619. }
  30620. });
  30621. },
  30622. getCode: function () {
  30623. var _a;
  30624. if (!this.editor) {
  30625. return this.code;
  30626. }
  30627. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30628. },
  30629. applyPosition: function () {
  30630. var _this = this;
  30631. if (this.autoFocusMethod) {
  30632. if (this.editor) {
  30633. _$2.defer(function () {
  30634. if (_this.autoFocusStartLine) {
  30635. _this.editor.setPosition({
  30636. lineNumber: _this.autoFocusStartLine,
  30637. column: _this.autoFocusStartColumn
  30638. });
  30639. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30640. }
  30641. _this.editor.focus();
  30642. });
  30643. delete this.autoFocusMethod;
  30644. }
  30645. }
  30646. this.editor.layout();
  30647. },
  30648. initComponent: function () {
  30649. var that = this;
  30650. this.superclass.initComponent.apply(this, arguments);
  30651. this.on({
  30652. resize: function (sender, width, height) {
  30653. if (that.editor) {
  30654. that.editor.layout();
  30655. }
  30656. },
  30657. destory: function () {
  30658. if (that.editor) {
  30659. that.editor.dispose();
  30660. delete that.editor;
  30661. }
  30662. },
  30663. afterrender: function () {
  30664. var $dom = $(that.el.dom).find('.editor');
  30665. attach_1($dom[0], {
  30666. value: that.code
  30667. }).then(function (editor) {
  30668. that.editor = editor;
  30669. that.applyPosition();
  30670. that.editor.onDidChangeModelContent(function (e) {
  30671. that.fireEvent('change', that.editor, e);
  30672. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30673. that.codeChange(that.editor.getValue(), that.name, e);
  30674. }
  30675. that.isChangeFromOuter = false;
  30676. });
  30677. });
  30678. }
  30679. });
  30680. },
  30681. getAllFunction: function () {
  30682. var funcArr = [];
  30683. var ast = window['YvanUI'].recast.parse(this.code);
  30684. if (ast && ast.program && ast.program.body) {
  30685. if (Array.isArray(ast.program.body)) {
  30686. for (var i = 0; i < ast.program.body.length; i++) {
  30687. var m = ast.program.body[i];
  30688. if (m.type === "ExportDefaultDeclaration") {
  30689. if (m.declaration.type === "ClassDeclaration") {
  30690. if (m.declaration.body.type === "ClassBody") {
  30691. if (Array.isArray(m.declaration.body.body)) {
  30692. for (var j = 0; j < m.declaration.body.body.length; j++) {
  30693. var ob = m.declaration.body.body[j];
  30694. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  30695. var funcItem = { name: ob.key.name, args: [] };
  30696. if (Array.isArray(ob.value.params)) {
  30697. for (var k = 0; k < ob.value.params.length; k++) {
  30698. var p = ob.value.params[k];
  30699. funcItem.args.push(p.name);
  30700. }
  30701. }
  30702. funcArr.push(funcItem);
  30703. }
  30704. }
  30705. }
  30706. }
  30707. }
  30708. }
  30709. }
  30710. }
  30711. }
  30712. return funcArr;
  30713. }
  30714. });
  30715. var isInited = false;
  30716. function attach_1(element, opts) {
  30717. if (!window['monaco']) {
  30718. return;
  30719. }
  30720. var monaco = window['monaco'];
  30721. return new Promise(function (resolve) {
  30722. if (!isInited) {
  30723. isInited = true;
  30724. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  30725. noSemanticValidation: true,
  30726. noSyntaxValidation: false
  30727. });
  30728. // compiler options
  30729. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  30730. target: monaco.languages.typescript.ScriptTarget.ES2016,
  30731. allowNonTsExtensions: true,
  30732. });
  30733. // extra libraries
  30734. var libSource = [
  30735. 'declare class Facts {',
  30736. ' /**',
  30737. ' * Returns the next fact',
  30738. ' */',
  30739. ' static next():string',
  30740. ' static next222():string',
  30741. '}',
  30742. "\n declare namespace WotuUI {\n export class Text {\n label: string\n }\n\n export function wrapText(n1: string): Text\n export function render(element:HTMLElement, vjson:any): void\n }\n ",
  30743. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  30744. ].join('\n');
  30745. var libUri = 'file:///index.d.ts';
  30746. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  30747. // When resolving definitions and references, the editor will try to use created models.
  30748. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  30749. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  30750. }
  30751. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  30752. resolve(editor);
  30753. });
  30754. }
  30755. }
  30756. //# sourceMappingURL=JsEditor.js.map
  30757. function initClipboard () {
  30758. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  30759. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  30760. Ext.grid.plugin.Clipboard.override({
  30761. getCellData: function (format, erase) {
  30762. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  30763. if (selection) {
  30764. selection.eachCell(function (cellContext) {
  30765. column = cellContext.column;
  30766. view = cellContext.column.getView();
  30767. record = cellContext.record;
  30768. // Do not copy the check column or row numberer column
  30769. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  30770. return;
  30771. }
  30772. if (lastRecord !== record) {
  30773. lastRecord = record;
  30774. ret.push(row = []);
  30775. }
  30776. dataIndex = column.dataIndex;
  30777. // 记录原始数据
  30778. var rData = record.data[dataIndex];
  30779. if (isRaw) {
  30780. data = record.data[dataIndex];
  30781. }
  30782. else {
  30783. // Try to access the view node.
  30784. viewNode = view.all.item(cellContext.rowIdx);
  30785. // If we could not, it's because it's outside of the rendered block -
  30786. // recreate it.
  30787. if (!viewNode) {
  30788. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  30789. }
  30790. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  30791. data = cell.innerHTML;
  30792. if (isText) {
  30793. data = Ext.util.Format.stripTags(data);
  30794. }
  30795. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  30796. data = data || rData;
  30797. }
  30798. row.push(data);
  30799. if (erase && dataIndex) {
  30800. record.set(dataIndex, null);
  30801. }
  30802. });
  30803. }
  30804. // See decode() comment below
  30805. return Ext.util.TSV.encode(ret, undefined, null);
  30806. },
  30807. getCells: function (format, erase) {
  30808. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  30809. if (selection) {
  30810. selection.eachCell(function (cellContext) {
  30811. record = cellContext.record;
  30812. if (lastRecord !== record) {
  30813. lastRecord = record;
  30814. ret.push(row = {
  30815. model: record.self,
  30816. fields: []
  30817. });
  30818. }
  30819. dataIndex = cellContext.column.dataIndex;
  30820. row.fields.push({
  30821. name: dataIndex,
  30822. value: record.data[dataIndex]
  30823. });
  30824. if (erase && dataIndex) {
  30825. record.set(dataIndex, null);
  30826. }
  30827. });
  30828. }
  30829. return ret;
  30830. },
  30831. getTextData: function (format, erase) {
  30832. return this.getCellData(format, erase);
  30833. },
  30834. putCellData: function (data, format) {
  30835. var _a;
  30836. var values = Ext.util.TSV.decode(data, undefined, null), row, recCount = values.length, colCount = recCount ? values[0].length : 0, sourceRowIdx, sourceColIdx, view = this.getCmp().getView(), maxRowIdx = view.dataSource.getCount() - 1, maxColIdx = view.getVisibleColumnManager().getColumns().length - 1, selModel = view.getSelectionModel(), selected = selModel.getSelected(), navModel = view.getNavigationModel(), destination = selected.startCell || navModel.getPosition(), dataIndex, destinationStartColumn, dataObject = {};
  30837. // If the view is not focused, use the first cell of the selection as the destination.
  30838. if (!destination && selected) {
  30839. selected.eachCell(function (c) {
  30840. destination = c;
  30841. return false;
  30842. });
  30843. }
  30844. if (destination) {
  30845. // Create a new Context based upon the outermost View.
  30846. // NavigationModel works on local views.
  30847. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  30848. // At that point, we can use navModel.getPosition()
  30849. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  30850. }
  30851. else {
  30852. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  30853. }
  30854. destinationStartColumn = destination.colIdx;
  30855. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  30856. row = values[sourceRowIdx];
  30857. // Collect new values in dataObject
  30858. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  30859. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  30860. continue;
  30861. }
  30862. dataIndex = destination.column.dataIndex;
  30863. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  30864. if (dataIndex) {
  30865. switch (format) {
  30866. // Raw field values
  30867. case 'raw':
  30868. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30869. break;
  30870. // Textual data with HTML tags stripped
  30871. case 'text':
  30872. {
  30873. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  30874. // 获取字典原始的value
  30875. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  30876. }
  30877. else {
  30878. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30879. }
  30880. break;
  30881. }
  30882. }
  30883. }
  30884. // If we are at the end of the destination row, break the column loop.
  30885. if (destination.colIdx === maxColIdx) {
  30886. break;
  30887. }
  30888. destination.setColumn(destination.colIdx + 1);
  30889. }
  30890. // Update the record in one go.
  30891. destination.record.set(dataObject);
  30892. // If we are at the end of the destination store, break the row loop.
  30893. if (destination.rowIdx === maxRowIdx) {
  30894. break;
  30895. }
  30896. // Jump to next row in destination
  30897. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  30898. }
  30899. },
  30900. putTextData: function (data, format) {
  30901. var _a, _b, _c;
  30902. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  30903. // 根据复制的行数自动添加新的行
  30904. var dataLength = ((_c = (_b = (_a = this.cmp.getStore()) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.length) || 0;
  30905. if (selected.startCell.rowIdx + values.length >= dataLength) {
  30906. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  30907. this.cmp.getStore().add({});
  30908. }
  30909. }
  30910. this.putCellData(data, format);
  30911. },
  30912. });
  30913. }
  30914. //# sourceMappingURL=clipboard.js.map
  30915. function initDict$1 () {
  30916. var DICT_CACHE = window['DICT_CACHE'];
  30917. if (!DICT_CACHE) {
  30918. DICT_CACHE = {};
  30919. window['DICT_CACHE'] = DICT_CACHE;
  30920. }
  30921. DICT_CACHE.XTYPE = [
  30922. { id: 'datefield', text: '日期' },
  30923. { id: 'datetimefield', text: '日期时间' },
  30924. { id: 'textfield', text: '文本' },
  30925. { id: 'numberfield', text: '数字' },
  30926. { id: 'combo', text: '下拉框' },
  30927. ];
  30928. DICT_CACHE.operator = [
  30929. { id: '=', text: '=' },
  30930. { id: '>', text: '>' },
  30931. { id: '<', text: '<' },
  30932. { id: '>=', text: '>=' },
  30933. { id: '<=', text: '<=' },
  30934. { id: 'in', text: 'in' },
  30935. { id: 'notIn', text: 'notIn' },
  30936. ];
  30937. DICT_CACHE.GRID_MODE = [
  30938. { id: 'edit1', text: '单机编辑模式' },
  30939. { id: 'edit2', text: '双击编辑模式' },
  30940. { id: 'checkbox', text: '勾选' },
  30941. { id: 'checkonly', text: '只勾选' },
  30942. { id: 'select', text: '行选择模式' },
  30943. ];
  30944. DICT_CACHE.BOTH_SELECT = [
  30945. { id: 'N/A', text: '<无>' },
  30946. { id: 'textfield', text: '文本' },
  30947. { id: 'numberfield', text: '数字框' },
  30948. { id: 'datefield', text: '日期' },
  30949. { id: 'datetimefield', text: '日期时间' },
  30950. { id: 'combo', text: '下拉框' },
  30951. { id: 'combogrid', text: '下拉表' },
  30952. { id: 'checkbox', text: '勾选' },
  30953. ];
  30954. DICT_CACHE.ROW_LAYOUT = [
  30955. { id: 'flex', text: '按权重摆放' },
  30956. { id: 'hbox', text: '按宽度摆放' },
  30957. ];
  30958. DICT_CACHE.GRID_XTYPE = [
  30959. { id: 'N/A', text: '<无>' },
  30960. { id: 'textfield', text: '文本-textfield' },
  30961. { id: 'numberfield', text: '数字框-numberfield' },
  30962. { id: 'datefield', text: '日期-datefield' },
  30963. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30964. { id: 'combo', text: '下拉框-combo' },
  30965. { id: 'combogrid', text: '下拉表-combogrid' },
  30966. { id: 'checkbox', text: '勾选-checkbox' },
  30967. ];
  30968. DICT_CACHE.FORM_XTYPE = [
  30969. { id: 'N/A', text: '<无>' },
  30970. { id: 'textfield', text: '文本-textfield' },
  30971. { id: 'numberfield', text: '数字框-numberfield' },
  30972. { id: 'datefield', text: '日期-datefield' },
  30973. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30974. { id: 'combo', text: '下拉框-combo' },
  30975. { id: 'combogrid', text: '下拉表-combogrid' },
  30976. { id: 'checkbox', text: '勾选-checkbox' },
  30977. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  30978. ];
  30979. DICT_CACHE.GRID_FORMATTER = [
  30980. { id: 'N/A', text: '默认' },
  30981. { id: 'rownum', text: '序号-rownum' },
  30982. { id: 'button', text: '按钮-button' },
  30983. { id: 'checkbox', text: '勾选-checkbox' },
  30984. { id: 'progres', text: '进度条-progres' },
  30985. ];
  30986. }
  30987. //# sourceMappingURL=dict.js.map
  30988. function initDesigner () {
  30989. Ext.define('com.yvan.studio.designer', {
  30990. extend: 'Ext.panel.Panel',
  30991. alias: 'widget.designer',
  30992. xtype: 'designer',
  30993. layout: 'fit',
  30994. items: [],
  30995. constructor: function (config) {
  30996. var self = this;
  30997. var newConfig = _$2.defaultsDeep({
  30998. // 强制性属性
  30999. }, config);
  31000. this.superclass.constructor.call(self, newConfig);
  31001. },
  31002. initComponent: function () {
  31003. var me = this;
  31004. me.on({
  31005. afterrender: function () {
  31006. }
  31007. });
  31008. this.superclass.initComponent.call(me);
  31009. }
  31010. });
  31011. }
  31012. //# sourceMappingURL=designer.js.map
  31013. var FixClass = /** @class */ (function () {
  31014. function FixClass() {
  31015. }
  31016. FixClass.prototype.fix = function (me, config) {
  31017. var _this = this;
  31018. if (isDesignMode(me, config)) {
  31019. return;
  31020. }
  31021. if (!config) {
  31022. return;
  31023. }
  31024. var fix = config.fix;
  31025. if (!fix) {
  31026. return;
  31027. }
  31028. delete config.fix;
  31029. // 这里有个 bug
  31030. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  31031. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  31032. var scope;
  31033. if (config.$initParent) {
  31034. // 在面板上的组件
  31035. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  31036. }
  31037. else if (config.column) {
  31038. // 在列上的组件
  31039. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  31040. }
  31041. if (_$2.isArray(fix)) {
  31042. _$2.each(fix, function (f) {
  31043. var fn = lookupFn(scope, f);
  31044. fn.call(_this, me, config);
  31045. });
  31046. }
  31047. else if (_$2.isString(fix)) {
  31048. var fn = lookupFn(scope, fix);
  31049. fn.call(this, me, config);
  31050. }
  31051. };
  31052. __decorate([
  31053. baseConfigProcess(),
  31054. __metadata("design:type", Function),
  31055. __metadata("design:paramtypes", [Object, Object]),
  31056. __metadata("design:returntype", void 0)
  31057. ], FixClass.prototype, "fix", null);
  31058. return FixClass;
  31059. }());
  31060. //# sourceMappingURL=fix.js.map
  31061. function init$2() {
  31062. // 引入 filters 过滤插件
  31063. Ext.require([
  31064. 'Ext.grid.filters.Filters'
  31065. ]);
  31066. // 启用 tooltip 快捷提示
  31067. Ext.QuickTips.init();
  31068. // 定义日期格式化方法
  31069. if (Ext.util && Ext.util.Format) {
  31070. Ext.apply(Ext.util.Format, {
  31071. dateFormat: 'Y-m-d'
  31072. });
  31073. }
  31074. Ext.form.field.Display.override({
  31075. cls: 'yvan-display-field',
  31076. labelAlign: 'right'
  31077. });
  31078. Ext.define("Ext.locale.zh_CN.picker.Date", {
  31079. override: "Ext.picker.Date",
  31080. format: "Y-m-d",
  31081. });
  31082. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  31083. override: "Ext.form.field.Date",
  31084. format: "Y-m-d",
  31085. });
  31086. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  31087. override: "Ext.grid.PropertyColumnModel",
  31088. format: "Y-m-d",
  31089. });
  31090. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  31091. override: "Ext.view.AbstractView",
  31092. loadingText: "读取中..."
  31093. });
  31094. Ext.LoadMask.prototype.msg = '请稍后...';
  31095. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  31096. override: "Ext.grid.header.Container",
  31097. sortClearText: '不排序',
  31098. sortAscText: "正序",
  31099. sortDescText: "倒序",
  31100. lockText: "锁定列",
  31101. unlockText: "解除锁定",
  31102. columnsText: "字段隐藏"
  31103. });
  31104. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  31105. override: "Ext.grid.filters.filter.Date",
  31106. fields: {
  31107. lt: { text: '之前' },
  31108. gt: { text: '之后' },
  31109. eq: { text: '相等' },
  31110. },
  31111. // Defaults to Ext.Date.defaultFormat
  31112. dateFormat: null
  31113. });
  31114. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  31115. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  31116. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  31117. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  31118. override: "Ext.grid.locking.Lockable",
  31119. lockText: "锁定",
  31120. unlockText: '解锁',
  31121. });
  31122. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  31123. override: "Ext.grid.filters.Filters",
  31124. menuFilterText: "过滤"
  31125. });
  31126. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  31127. override: "Ext.grid.filters.filter.Boolean",
  31128. yesText: "已钩选",
  31129. noText: "未勾选"
  31130. });
  31131. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  31132. override: "Ext.grid.filters.filter.String",
  31133. emptyText: "输入过滤文本..."
  31134. });
  31135. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  31136. override: "Ext.grid.filters.filter.Number",
  31137. emptyText: "输入数字..."
  31138. });
  31139. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  31140. override: "Ext.PagingToolbar",
  31141. beforePageText: "第",
  31142. // update
  31143. afterPageText: "/ {0} 页",
  31144. // update
  31145. firstText: "第一页",
  31146. prevText: "上一页",
  31147. // update
  31148. nextText: "下一页",
  31149. lastText: "最后页",
  31150. refreshText: "刷新",
  31151. displayMsg: "总共 {2} 条",
  31152. // update
  31153. emptyMsg: '没有数据'
  31154. });
  31155. /**
  31156. * 改变事件的获取方式.
  31157. * 具体见: ext-all-debug.js:23216 addListener
  31158. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  31159. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  31160. */
  31161. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  31162. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  31163. if (typeof fn === 'string' &&
  31164. (_$2.startsWith(fn, 'scope.') ||
  31165. _$2.startsWith(fn, 'system.') ||
  31166. _$2.startsWith(fn, 'format.'))) {
  31167. scope = lookupScope(this);
  31168. if (isDesignMode(scope, undefined)) {
  31169. fn = Ext.emptyFn;
  31170. }
  31171. else {
  31172. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  31173. // const vm = this.lookupViewModel()
  31174. // if (vm && vm.yvanScope) {
  31175. // scope = vm.yvanScope
  31176. // fn = scope[fn.substr('scope.'.length)]
  31177. // }
  31178. fn = lookupFn(scope, fn, this);
  31179. }
  31180. }
  31181. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  31182. };
  31183. // 将 SystemLib 扩展到 window.system 下
  31184. if (!window['system']) {
  31185. window['system'] = {};
  31186. }
  31187. _$2.extend(window['system'], SystemLib);
  31188. _$2.extend(window['system'], {
  31189. showGridRowDetail: showGridRowDetail
  31190. });
  31191. Ext.apply(Ext.util.Format, {
  31192. // 百分比
  31193. percentRenderer: function (v, rd, model) {
  31194. if (!v) {
  31195. v = 0;
  31196. }
  31197. if (typeof v === 'string') {
  31198. v = parseInt(v);
  31199. }
  31200. var valueString = v.toFixed(2);
  31201. var valueFixed = v > 100 ? 100 : v;
  31202. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  31203. var cls = '';
  31204. if (v < 90) {
  31205. cls = 'danger';
  31206. }
  31207. else if (v < 100) {
  31208. cls = 'warning';
  31209. }
  31210. else {
  31211. cls = 'success';
  31212. }
  31213. return Ext.String
  31214. .format(
  31215. // '<div>'
  31216. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  31217. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  31218. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  31219. // + '</div></div>', valueString, valueFixed, cls);
  31220. '<div class="x-progress x-progress-default x-widthed" style="width: 100%;"><div class="x-progress-text x-progress-text-back" style="width:100%;">{0}%</div><div class="x-progress-bar progress-{1}" style="width: {2}%;"><div class="x-progress-text" style="width: {3}%">{4}%</div></div></div>', valueString, cls, valueFixed, ((100 / valueFixed) * 100), valueString); // .format(
  31221. // '<div>'
  31222. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  31223. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  31224. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  31225. // + '</div></div>', v, valueFixed, valueString);
  31226. },
  31227. //button
  31228. button: function (v, rd, model) {
  31229. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  31230. }
  31231. });
  31232. initComponent();
  31233. initPanel();
  31234. initGridColumn();
  31235. initTree();
  31236. initGrid();
  31237. initMainTab();
  31238. initTextfield();
  31239. initCombo();
  31240. initTag();
  31241. initContainer();
  31242. initRows();
  31243. initCols();
  31244. initForm();
  31245. initToolbar();
  31246. initSplitter();
  31247. initButton();
  31248. initStores();
  31249. initSearch();
  31250. initMultipleSearch();
  31251. initDate();
  31252. initDateTimePicker();
  31253. initDateTime();
  31254. initNumber();
  31255. initCheckbox();
  31256. initCheckboxGroup();
  31257. initRadio();
  31258. initRadioGroup();
  31259. initFieldset();
  31260. initCombotree();
  31261. initPickerPlus();
  31262. initCombogrid();
  31263. initComboGridMulti();
  31264. initIframe();
  31265. initBpmn();
  31266. initSqlEditor$1();
  31267. initJsonEditor$1();
  31268. initJsEditor$1();
  31269. initClipboard();
  31270. initSqlComplex();
  31271. initParamComplex();
  31272. initDict$1();
  31273. initDesigner();
  31274. }
  31275. //# sourceMappingURL=init.js.map
  31276. /**
  31277. * 创建一个 Ajax 客户端
  31278. */
  31279. function createAjax(createOption) {
  31280. if (createOption.baseUrl) {
  31281. axios__default.defaults.baseURL = createOption.baseUrl;
  31282. axios__default.defaults.timeout = createOption.timeout;
  31283. storeAjax.timeout = createOption.timeout;
  31284. axios__default.defaults.timeoutErrorMessage = '网络超时';
  31285. }
  31286. return function (option) {
  31287. //@ts-ignore
  31288. option.method = (option.method || 'get').toLocaleLowerCase();
  31289. //@ts-ignore
  31290. var ax = __assign({}, option);
  31291. switch (option.method) {
  31292. case 'get':
  31293. ax.method = 'GET';
  31294. ax.params = option.param;
  31295. ax.headers = __assign({}, option.headers);
  31296. break;
  31297. case 'post':
  31298. ax.method = 'POST';
  31299. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  31300. ax.params = option.param;
  31301. ax.data = Qs.stringify(option.data);
  31302. break;
  31303. case 'put':
  31304. case 'patch':
  31305. case 'delete':
  31306. ax.method = option.method;
  31307. ax.headers = option.headers;
  31308. ax.params = option.param;
  31309. ax.data = Qs.stringify(option.data);
  31310. break;
  31311. case 'download':
  31312. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  31313. return new Promise(function (resolver, reject) {
  31314. });
  31315. case "invoke":
  31316. ax.url = serverInvokeUrlTransform(option.url, option);
  31317. ax.method = 'POST';
  31318. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31319. if (typeof option.args === 'object') {
  31320. ax.data = JSON.stringify({
  31321. args: option.args,
  31322. });
  31323. }
  31324. else {
  31325. ax.data = JSON.stringify({
  31326. args: [
  31327. __assign(__assign({}, option.data), option.param)
  31328. ],
  31329. filterModel: option.filterModel,
  31330. sortModel: option.sortModel
  31331. });
  31332. }
  31333. break;
  31334. case 'post-json':
  31335. ax.method = 'POST';
  31336. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31337. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  31338. break;
  31339. case 'post-file':
  31340. //TODO 刘壮. 上传文件
  31341. var forms = new FormData();
  31342. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  31343. _$2.forOwn(option.data, function (value, key) {
  31344. if (key === 'files') {
  31345. var i_1 = 0;
  31346. _$2.each(value, function (f) {
  31347. // @ts-ignore
  31348. forms.append('file' + (++i_1), f);
  31349. });
  31350. }
  31351. else {
  31352. forms.append(key, value);
  31353. }
  31354. });
  31355. ax.data = forms;
  31356. ax.method = 'POST';
  31357. break;
  31358. case "sql":
  31359. ax.url = sqlUrlTransform(option.url);
  31360. ax.method = 'POST';
  31361. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31362. ax.data = JSON.stringify({
  31363. args: [option.data],
  31364. db: option.db,
  31365. filterModel: option.filterModel,
  31366. sortModel: option.sortModel
  31367. });
  31368. break;
  31369. default:
  31370. throw new Error('not implements');
  31371. }
  31372. return new Promise(function (resolver, reject) {
  31373. axios__default(ax).then(function (resolverRaw) {
  31374. var apiResult = {
  31375. rawData: resolverRaw.data,
  31376. status: resolverRaw.status,
  31377. success: (resolverRaw.data && resolverRaw.data.success),
  31378. data: resolverRaw.data.data,
  31379. pagination: resolverRaw.data.pagination,
  31380. msg: (resolverRaw.data.msg),
  31381. errors: resolverRaw.data.errors,
  31382. headers: resolverRaw.headers
  31383. };
  31384. if (typeof window['apiTranslate'] === 'function') {
  31385. window['apiTranslate'](apiResult.rawData, option.url);
  31386. }
  31387. resolver(apiResult);
  31388. }).catch(function (reason) {
  31389. reject(reason);
  31390. });
  31391. });
  31392. };
  31393. }
  31394. function downLoad(downLoadUrl, filename, data, header, isJson) {
  31395. if (isJson === void 0) { isJson = false; }
  31396. var YvanUI = _$2.get(window, 'YvanUI');
  31397. YvanUI.loading();
  31398. var createObjectURL = function (object) {
  31399. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  31400. };
  31401. // const formData = new FormData();
  31402. // _.forOwn(data, (v, k) => {
  31403. // formData.append(k, v);
  31404. // });
  31405. var formData = '';
  31406. var xhr = new XMLHttpRequest();
  31407. xhr.open('POST', downLoadUrl);
  31408. xhr.responseType = 'blob';
  31409. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  31410. if (isJson) {
  31411. formData = data ? JSON.stringify(data) : '';
  31412. xhr.setRequestHeader('Content-Type', 'application/json');
  31413. }
  31414. else {
  31415. formData = data ? Qs.stringify(data) : '';
  31416. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  31417. }
  31418. //
  31419. if (header) {
  31420. _$2.forOwn(header, function (v, k) {
  31421. xhr.setRequestHeader(k, v);
  31422. });
  31423. }
  31424. xhr.onload = function (e) {
  31425. if (this.status === 200) {
  31426. var blob = this.response;
  31427. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  31428. navigator.msSaveBlob(blob, filename);
  31429. YvanUI.clearLoading();
  31430. }
  31431. else {
  31432. var a = document.createElement('a');
  31433. var url = createObjectURL(blob);
  31434. a.href = url;
  31435. a.download = filename;
  31436. document.append(a);
  31437. a.click();
  31438. a.remove();
  31439. window.URL.revokeObjectURL(url);
  31440. YvanUI.clearLoading();
  31441. }
  31442. }
  31443. };
  31444. xhr.send(formData);
  31445. }
  31446. //# sourceMappingURL=ajax.js.map
  31447. function readExcel(file) {
  31448. return new Promise(function (resolve, reject) {
  31449. if (!file) {
  31450. reject("文件读取失败!!!");
  31451. return;
  31452. }
  31453. var reader = new FileReader();
  31454. reader.onload = function (e) {
  31455. if (e.target) {
  31456. var data = e.target.result;
  31457. var workbook = XLSX.read(data, { type: 'binary' });
  31458. resolve(workbook);
  31459. }
  31460. else {
  31461. reject("文件读取失败!!!");
  31462. }
  31463. };
  31464. try {
  31465. reader.readAsBinaryString(file);
  31466. }
  31467. catch (e) {
  31468. reject(e);
  31469. }
  31470. });
  31471. }
  31472. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  31473. if (dataStartRow === void 0) { dataStartRow = 2; }
  31474. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  31475. if (rowValidate === void 0) { rowValidate = undefined; }
  31476. if (otherValidate === void 0) { otherValidate = undefined; }
  31477. if (fieldValidate === void 0) { fieldValidate = undefined; }
  31478. return new Promise(function (resolve, reject) {
  31479. var promiseArr = [];
  31480. for (var i = 0; i < columnsSet.length; i++) {
  31481. var fix = columnsSet[i].fix;
  31482. if (_$2.isArray(fix) && fix.length > 0) {
  31483. var ss = fix[0].toLowerCase();
  31484. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31485. columnsSet[i].importFormatter = function (vdata) {
  31486. // @ts-ignore
  31487. return window.moment(vdata.ov) - 0;
  31488. };
  31489. }
  31490. else {
  31491. var fn = lookupFn(topScope, fix[0]);
  31492. promiseArr.push(fn(null, columnsSet[i]));
  31493. delete columnsSet[i].fix;
  31494. }
  31495. }
  31496. else if (_$2.isString(fix)) {
  31497. var ss = fix.toLowerCase();
  31498. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31499. columnsSet[i].importFormatter = function (vdata) {
  31500. // @ts-ignore
  31501. return window.moment(vdata.ov) - 0;
  31502. };
  31503. }
  31504. else {
  31505. var fn = lookupFn(topScope, fix);
  31506. promiseArr.push(fn(null, columnsSet[i]));
  31507. delete columnsSet[i].fix;
  31508. }
  31509. }
  31510. }
  31511. var read = function () {
  31512. readExcel(file).then(function (workbook) {
  31513. var sheetNames = workbook.SheetNames; // 工作表名称集合
  31514. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  31515. var titleRowValue = [];
  31516. var titleRowKey = [];
  31517. var needLoop = false; // 是否需要迭代
  31518. var columns = [];
  31519. if (worksheet && worksheet["!ref"]) {
  31520. var t = worksheet["!ref"];
  31521. var tempArr = t.split(':');
  31522. if (tempArr.length >= 2) {
  31523. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  31524. // 选取title的行,删除之前的行
  31525. if (titleRowNumber > firstRowNumber) {
  31526. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  31527. for (var key in worksheet) {
  31528. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  31529. delete worksheet[key];
  31530. }
  31531. }
  31532. }
  31533. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  31534. firstRowNumber = titleRowNumber + '';
  31535. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  31536. }
  31537. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  31538. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  31539. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  31540. for (var key in worksheet) {
  31541. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  31542. titleRowKey.push(key);
  31543. titleRowValue.push(worksheet[key].v);
  31544. }
  31545. }
  31546. if (columnsSet && columnsSet.length > 0) {
  31547. var length = columnsSet.length;
  31548. length = length <= titleRowKey.length ? length : titleRowKey.length;
  31549. for (var i = 0; i < length; i++) {
  31550. var vk = titleRowKey[i];
  31551. var item = columnsSet[i];
  31552. var column = {};
  31553. if (typeof item === 'string') {
  31554. column.dataIndex = item;
  31555. column.header = worksheet[vk].v;
  31556. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  31557. }
  31558. else if (typeof item.dataIndex === "string") {
  31559. column.dataIndex = item.dataIndex;
  31560. column.header = worksheet[vk].v;
  31561. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  31562. if (typeof item.validate === "function") {
  31563. column.validate = item.validate;
  31564. needLoop = true;
  31565. }
  31566. if (typeof item.importFormatter === "function") {
  31567. column.importFormatter = item.importFormatter;
  31568. needLoop = true;
  31569. }
  31570. if ((item.data instanceof Array && item.data.length > 0)
  31571. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  31572. column.data = item.data;
  31573. needLoop = true;
  31574. }
  31575. }
  31576. columns.push(column);
  31577. }
  31578. }
  31579. }
  31580. }
  31581. if (fieldValidate && typeof fieldValidate === "function") {
  31582. if (fieldValidate(columns, titleRowValue) !== true) {
  31583. reject("fields validate error");
  31584. return;
  31585. }
  31586. }
  31587. var allData = XLSX.utils.sheet_to_json(worksheet);
  31588. var okData = [], errorData = [], errorMsgData = [];
  31589. var needItemLoop = needLoop;
  31590. if (rowValidate && typeof rowValidate === "function") {
  31591. needLoop = true;
  31592. }
  31593. if (needLoop === true) {
  31594. for (var index = 0; index < allData.length; index++) {
  31595. var row = allData[index];
  31596. var rowNumber = dataStartRow + index;
  31597. row.__importID__ = rowNumber;
  31598. var isRowOk = true;
  31599. if (needItemLoop) {
  31600. var _loop_1 = function (num) {
  31601. var column = columns[num];
  31602. var ov = row[column.dataIndex];
  31603. var nv = ov;
  31604. var hasError = false;
  31605. var rowNumber_1 = dataStartRow + index;
  31606. var ei = {
  31607. errorId: rowNumber_1 + '_' + column.dataIndex,
  31608. importID: rowNumber_1,
  31609. dataIndex: column.dataIndex,
  31610. header: column.header,
  31611. value: ov,
  31612. errormessage: ""
  31613. };
  31614. // 格式化
  31615. if (column.data instanceof Array) {
  31616. nv = undefined;
  31617. ei.errormessage = "字典匹配失败";
  31618. _$2.forEach(column.data, function (v, index) {
  31619. if (v.text === ov) {
  31620. nv = v.id;
  31621. return;
  31622. }
  31623. });
  31624. }
  31625. else if (_$2.isPlainObject(column.data)) {
  31626. nv = undefined;
  31627. ei.errormessage = "字典匹配失败";
  31628. _$2.forEach(column.data, function (value, key) {
  31629. if (value === ov) {
  31630. nv = key;
  31631. return;
  31632. }
  31633. });
  31634. }
  31635. if (typeof column.importFormatter === 'function') {
  31636. var vdata = {
  31637. column: column,
  31638. ov: ov,
  31639. nv: nv,
  31640. rowIndex: index,
  31641. data: row,
  31642. rowDatas: allData
  31643. };
  31644. nv = undefined;
  31645. ei.errormessage = "格式化失败";
  31646. nv = column.importFormatter(vdata);
  31647. }
  31648. if (!nv && nv != 0) {
  31649. hasError = true;
  31650. }
  31651. else {
  31652. row[column.dataIndex] = nv;
  31653. ei.errormessage = "";
  31654. }
  31655. // 校验
  31656. if (typeof column.validate === 'function') {
  31657. var vdata = {
  31658. column: column,
  31659. ov: ov,
  31660. nv: nv,
  31661. rowIndex: index,
  31662. data: row,
  31663. rowDatas: allData
  31664. };
  31665. var errormessage = column.validate(vdata);
  31666. if (errormessage === true) ;
  31667. else {
  31668. hasError = true;
  31669. ei.errormessage = ei.errormessage + "/" + errormessage;
  31670. }
  31671. }
  31672. if (hasError === true) {
  31673. isRowOk = false;
  31674. errorMsgData.push(ei);
  31675. }
  31676. };
  31677. for (var num = 0; num < columns.length; num++) {
  31678. _loop_1(num);
  31679. }
  31680. }
  31681. if (rowValidate && typeof rowValidate === "function") {
  31682. var errormessage = rowValidate({
  31683. columns: columns,
  31684. data: row,
  31685. rowIndex: index,
  31686. rowDatas: allData
  31687. });
  31688. if (errormessage === true) ;
  31689. else {
  31690. isRowOk = false;
  31691. var ei = {
  31692. errorId: rowNumber + '',
  31693. dataIndex: "row",
  31694. header: "数据行",
  31695. value: "当前行的数据",
  31696. importID: rowNumber,
  31697. errormessage: errormessage
  31698. };
  31699. errorMsgData.push(ei);
  31700. }
  31701. }
  31702. row.__hasError__ = !isRowOk;
  31703. if (isRowOk === true) {
  31704. okData.push(row);
  31705. }
  31706. else {
  31707. errorData.push(row);
  31708. }
  31709. }
  31710. }
  31711. else {
  31712. // 添加数据的唯一标识
  31713. for (var index = 0; index < allData.length; index++) {
  31714. var row = allData[index];
  31715. var rowNumber = dataStartRow + index;
  31716. row.__importID__ = rowNumber;
  31717. row.__hasError__ = false;
  31718. }
  31719. okData = allData;
  31720. }
  31721. if (otherValidate && typeof otherValidate === "function") {
  31722. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  31723. }
  31724. else {
  31725. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  31726. }
  31727. // clearLoading()
  31728. }).catch(function (e) {
  31729. reject(e);
  31730. });
  31731. };
  31732. if (promiseArr.length > 0) {
  31733. Promise.all(promiseArr).then(function (resArr) {
  31734. for (var i = 0; i < resArr.length; i++) {
  31735. var tmp = resArr[i];
  31736. tmp.config.data = [];
  31737. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  31738. if (tmp.r.field.length > 1) {
  31739. var keyKey = tmp.r.field[0];
  31740. var valueKey = tmp.r.field[1];
  31741. for (var j = 0; j < tmp.r.data.length; j++) {
  31742. var it = tmp.r.data[j];
  31743. var newIt = {};
  31744. newIt.id = it[keyKey];
  31745. newIt.text = it[valueKey];
  31746. tmp.config.data.push(newIt);
  31747. }
  31748. }
  31749. }
  31750. }
  31751. read();
  31752. });
  31753. }
  31754. else {
  31755. setTimeout(read, 50);
  31756. }
  31757. });
  31758. }
  31759. //# sourceMappingURL=xlsx.js.map
  31760. var ExcelImportDialog = /** @class */ (function (_super) {
  31761. __extends(ExcelImportDialog, _super);
  31762. function ExcelImportDialog(option) {
  31763. var _this = this;
  31764. var vjson = vjsonFunc(option);
  31765. _this = _super.call(this, { model: model$p, vjson: vjson }) || this;
  31766. _this.importExcelOption = option;
  31767. return _this;
  31768. }
  31769. ExcelImportDialog.prototype.onLoad = function () {
  31770. _super.prototype.onLoad.call(this);
  31771. };
  31772. ExcelImportDialog.prototype.fileChange = function (sender) {
  31773. var _this = this;
  31774. var file = sender.fileInputEl.dom.files[0];
  31775. // const senderScope = lookupScope(sender)
  31776. var topScope = this.topScope;
  31777. var rowValidate = this.importExcelOption.rowValidate;
  31778. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  31779. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  31780. }
  31781. var afterClientValidate = this.importExcelOption.afterClientValidate;
  31782. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  31783. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  31784. }
  31785. var fieldValidate = this.importExcelOption.fieldValidate;
  31786. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  31787. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  31788. }
  31789. this.setLoading(true);
  31790. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  31791. _this.importData = res;
  31792. _this.refs.dataGrid.setData(res.allData);
  31793. _this.viewModel.set("dataCount", res.allData.length);
  31794. _this.refs.errGrid.setData(res.errorMsgData);
  31795. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  31796. }).catch(function (e) {
  31797. _this.importData = null;
  31798. _this.refs.dataGrid.setData();
  31799. _this.refs.errGrid.setData();
  31800. msg(e.toString());
  31801. }).finally(function () {
  31802. _this.setLoading(false);
  31803. });
  31804. };
  31805. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  31806. if (record.get('__hasError__')) {
  31807. return "x-grid-record-bg-red";
  31808. }
  31809. };
  31810. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  31811. return "x-grid-record-bg-red";
  31812. };
  31813. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  31814. var _a;
  31815. var id = record.data.__importID__;
  31816. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  31817. var selectRecord = null;
  31818. var dataIndex = -1;
  31819. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31820. for (var i = 0; i < rows.length; i++) {
  31821. if (rows[i].importID === id) {
  31822. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31823. dataIndex = i;
  31824. }
  31825. if (rows[i].errorId === id + "_" + subId) {
  31826. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31827. dataIndex = i;
  31828. break;
  31829. }
  31830. }
  31831. if (selectRecord) {
  31832. this.refs.errGrid.ensureVisible(selectRecord);
  31833. this.refs.errGrid.selModel.select(dataIndex);
  31834. // this.refs.errGrid.reload()
  31835. }
  31836. };
  31837. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  31838. var _a;
  31839. var id = record.data.importID;
  31840. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31841. var selectRecord = null;
  31842. var dataIndex = -1;
  31843. for (var i = 0; i < rows.length; i++) {
  31844. if (rows[i].__importID__ === id) {
  31845. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  31846. dataIndex = i;
  31847. break;
  31848. }
  31849. }
  31850. if (selectRecord) {
  31851. this.refs.dataGrid.ensureVisible(selectRecord);
  31852. this.refs.dataGrid.selModel.select(dataIndex);
  31853. // this.refs.dataGrid.reload()
  31854. }
  31855. };
  31856. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  31857. this.viewModel.set("dataType", newValue);
  31858. if (this.importData) {
  31859. this.refs.dataGrid.setData(this.importData[newValue]);
  31860. this.viewModel.set("dataCount", this.importData[newValue].length);
  31861. }
  31862. };
  31863. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  31864. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  31865. window.location.href = this.importExcelOption.dowLoadUrl;
  31866. return;
  31867. }
  31868. var xt = [];
  31869. _$2.forEach(this.importExcelOption.columns, function (v) {
  31870. xt.push(v.header);
  31871. });
  31872. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  31873. if (filename.endsWith(".xlsx")) {
  31874. filename = filename.split(".xlsx")[0];
  31875. }
  31876. filename = filename + ".xlsx";
  31877. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  31878. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  31879. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  31880. XLSX.writeFile(wb, filename); //导出Excel
  31881. };
  31882. ExcelImportDialog.prototype.getData = function (sender) {
  31883. _$2.each(this.importData.okData, function (item) {
  31884. delete item.id;
  31885. delete item.__hasError__;
  31886. delete item.__importID__;
  31887. delete item._origin;
  31888. });
  31889. _$2.each(this.importData.allData, function (item) {
  31890. delete item.id;
  31891. delete item.__hasError__;
  31892. delete item.__importID__;
  31893. delete item._origin;
  31894. });
  31895. _$2.each(this.importData.errorData, function (item) {
  31896. delete item.id;
  31897. delete item.__hasError__;
  31898. delete item.__importID__;
  31899. delete item._origin;
  31900. });
  31901. this.dialogSuccess(this.importData);
  31902. };
  31903. return ExcelImportDialog;
  31904. }(Scope));
  31905. var model$p = {
  31906. data: {
  31907. dataType: "all",
  31908. errMsgCount: 0,
  31909. dataCount: 0
  31910. }
  31911. };
  31912. var vjsonFunc = function (option) {
  31913. return {
  31914. title: option.title || 'excel导入',
  31915. layout: 'fit',
  31916. items: [
  31917. {
  31918. layout: 'border',
  31919. tbar: {
  31920. xtype: "form",
  31921. items: [
  31922. {
  31923. xtype: "cols",
  31924. items: [
  31925. {
  31926. xtype: "filefield",
  31927. fieldLabel: 'excel文件',
  31928. buttonText: '请选择excel文件',
  31929. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  31930. flex: 3,
  31931. listeners: {
  31932. change: "scope.fileChange"
  31933. }
  31934. }, {
  31935. xtype: "button",
  31936. iconCls: "x-fa fa-download",
  31937. text: "下载模版",
  31938. listeners: {
  31939. click: "scope.downloadTemplate"
  31940. }
  31941. }, {
  31942. xtype: 'container',
  31943. border: false,
  31944. layout: 'hbox',
  31945. }, {
  31946. xtype: "button",
  31947. iconCls: "x-fa fa-upload",
  31948. text: option.tQButtonText || "提取数据",
  31949. listeners: {
  31950. click: "scope.getData"
  31951. }
  31952. }
  31953. ]
  31954. },
  31955. ]
  31956. },
  31957. items: [
  31958. {
  31959. tbar: {
  31960. xtype: "toolbar",
  31961. title: "导入的数据",
  31962. items: [{
  31963. xtype: 'label',
  31964. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  31965. }, {
  31966. xtype: 'radiogroup',
  31967. items: [
  31968. {
  31969. boxLabel: '所有数据',
  31970. checked: true,
  31971. inputValue: 'allData',
  31972. }, {
  31973. boxLabel: '正确数据',
  31974. inputValue: 'okData',
  31975. }, {
  31976. boxLabel: '错误数据',
  31977. inputValue: 'errorData',
  31978. }
  31979. ],
  31980. listeners: {
  31981. change: 'scope.filterData',
  31982. },
  31983. }, {
  31984. xtype: "textfield",
  31985. readOnly: true,
  31986. fieldLabel: "条目数",
  31987. bind: "{dataCount}"
  31988. }]
  31989. },
  31990. xtype: 'yvgrid',
  31991. reference: 'dataGrid',
  31992. layout: 'fit',
  31993. pagination: false,
  31994. // pageSize: 50,
  31995. getRowClass: 'scope.getDataGridRowRecord',
  31996. columns: option.columns,
  31997. region: 'center',
  31998. split: true,
  31999. listeners: {
  32000. cellclick: "scope.dataGridClick",
  32001. },
  32002. selModel: {
  32003. // type: 'rowmodel',
  32004. mode: 'SINGLE',
  32005. },
  32006. }, {
  32007. tbar: {
  32008. xtype: "toolbar", items: [
  32009. {
  32010. xtype: 'label',
  32011. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  32012. }, {
  32013. xtype: "textfield",
  32014. readOnly: true,
  32015. fieldLabel: "条目数",
  32016. bind: "{errMsgCount}"
  32017. }
  32018. ]
  32019. },
  32020. xtype: 'yvgrid',
  32021. reference: 'errGrid',
  32022. layout: 'fit',
  32023. pagination: false,
  32024. getRowClass: 'scope.getErrGridRowRecord',
  32025. height: "40%",
  32026. columns: [
  32027. { dataIndex: "errorId", header: "ID", hidden: true },
  32028. { dataIndex: "importID", header: "行号", width: 80 },
  32029. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  32030. { dataIndex: "value", header: "值", width: 120 },
  32031. { dataIndex: "header", header: "字段名", width: 120 },
  32032. { dataIndex: "dataIndex", header: "字段", width: 120 }
  32033. ],
  32034. region: 'south',
  32035. split: true,
  32036. listeners: {
  32037. itemclick: "scope.errGridClick"
  32038. },
  32039. selModel: {
  32040. // type: 'rowmodel',
  32041. mode: 'SINGLE',
  32042. },
  32043. },
  32044. ],
  32045. },
  32046. ],
  32047. referenceHolder: true,
  32048. };
  32049. };
  32050. //# sourceMappingURL=ExcelImportDialog.js.map
  32051. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  32052. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  32053. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  32054. ret.report_id = reportId;
  32055. ret.report = report;
  32056. return ret;
  32057. }
  32058. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  32059. var e_1, _a, e_2, _b;
  32060. var model = {
  32061. data: {
  32062. report_name: config.report_name,
  32063. query: {},
  32064. sum: {},
  32065. }
  32066. };
  32067. var json5 = window['YvanUI'].json5;
  32068. var report = config.report ? json5.parse(config.report) : {};
  32069. var conditionRows = [];
  32070. var sumRows = [];
  32071. model.data.has_sum = _$2.size(report.summary) > 0;
  32072. // query 查询条件
  32073. var newRow = false;
  32074. var currentRow = { xtype: 'cols', items: [], };
  32075. conditionRows.push(currentRow);
  32076. _$2.forEach(report.query, function (item) {
  32077. if (newRow) {
  32078. currentRow = { xtype: 'cols', items: [], };
  32079. conditionRows.push(currentRow);
  32080. }
  32081. var vj = json5.parse(item.conditionFieldExtend);
  32082. if (item.conditionFieldXtype) {
  32083. vj.xtype = item.conditionFieldXtype;
  32084. if (item.conditionFieldXtype === 'combo') {
  32085. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  32086. }
  32087. if (item.conditionFieldXtype === 'datetimefield') {
  32088. //@ts-ignore
  32089. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  32090. }
  32091. else if (item.conditionFieldXtype === 'datefield') {
  32092. //@ts-ignore
  32093. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  32094. }
  32095. else {
  32096. model.data.query[item.conditionFieldBind] = '';
  32097. }
  32098. }
  32099. else {
  32100. // 没有组件类型,是个空占位符
  32101. vj.border = false;
  32102. }
  32103. if (item.conditionFieldBind) {
  32104. vj.bind = {
  32105. value: '{query.' + item.conditionFieldBind + '}'
  32106. };
  32107. }
  32108. if (item.conditionFieldFlex) {
  32109. vj.flex = item.conditionFieldFlex;
  32110. }
  32111. if (item.conditionFieldXtype) {
  32112. vj.fieldLabel = item.conditionFieldLabel;
  32113. }
  32114. if (item.fieldLabel) {
  32115. vj.fieldLabel = item.fieldLabel;
  32116. }
  32117. newRow = item.conditionFieldWrap || false;
  32118. currentRow.items.push(vj);
  32119. });
  32120. if (currentRow) {
  32121. currentRow.margin = '10 0 10 0';
  32122. }
  32123. // sum 汇总条件
  32124. newRow = true;
  32125. try {
  32126. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  32127. var item = _d.value;
  32128. if (newRow) {
  32129. currentRow = {
  32130. xtype: 'cols',
  32131. defaultType: 'displayfield',
  32132. defaults: {
  32133. labelWidth: 70,
  32134. },
  32135. items: []
  32136. };
  32137. sumRows.push(currentRow);
  32138. }
  32139. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  32140. if (item.sumFieldBind) {
  32141. vj.bind = '{sum.' + item.sumFieldBind + '}';
  32142. model.data.sum[item.sumFieldBind] = '';
  32143. }
  32144. else {
  32145. // 没有组件类型,是个空占位符
  32146. vj.border = false;
  32147. }
  32148. if (item.sumFieldFlex) {
  32149. vj.flex = item.sumFieldFlex;
  32150. }
  32151. if (item.sumFieldLabel) {
  32152. vj.fieldLabel = item.sumFieldLabel;
  32153. }
  32154. // sumFieldBind: "zs"
  32155. // sumFieldExtend: "{}"
  32156. // sumFieldFlex: 1
  32157. // sumFieldLabel: "总数"
  32158. // sumFieldWrap: false
  32159. newRow = item.sumFieldWrap || false;
  32160. currentRow.items.push(vj);
  32161. }
  32162. }
  32163. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  32164. finally {
  32165. try {
  32166. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  32167. }
  32168. finally { if (e_1) throw e_1.error; }
  32169. }
  32170. if (currentRow) {
  32171. currentRow.margin = '10 0 10 0';
  32172. }
  32173. // column 结果字段
  32174. var columns = [];
  32175. try {
  32176. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  32177. var item = _f.value;
  32178. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  32179. if (item.xtype) {
  32180. if (item.xtype == 'checkbox') {
  32181. vj.xtype = 'checkcolumn';
  32182. vj.disabled = true;
  32183. }
  32184. else {
  32185. vj.xtype = item.xtype;
  32186. }
  32187. }
  32188. if (item.dataType) {
  32189. vj.dataType = item.dataType;
  32190. }
  32191. if (item.align) {
  32192. vj.align = item.align;
  32193. }
  32194. if (item.width) {
  32195. vj.width = item.width;
  32196. }
  32197. if (item.dict) {
  32198. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  32199. }
  32200. columns.push(vj);
  32201. }
  32202. }
  32203. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  32204. finally {
  32205. try {
  32206. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  32207. }
  32208. finally { if (e_2) throw e_2.error; }
  32209. }
  32210. var vjson = {
  32211. bind: {
  32212. title: '{report_name}',
  32213. },
  32214. layout: 'fit',
  32215. referenceHolder: true,
  32216. items: [
  32217. {
  32218. layout: 'border',
  32219. border: false,
  32220. items: [
  32221. {
  32222. region: 'north',
  32223. border: false,
  32224. tbar: {
  32225. xtype: 'toolbar',
  32226. border: false,
  32227. items: [
  32228. {
  32229. xtype: 'button',
  32230. text: '查询',
  32231. reference: 'btnSearch',
  32232. iconCls: 'x-fa fa-search',
  32233. listeners: {
  32234. click: 'scope.reload',
  32235. },
  32236. },
  32237. {
  32238. xtype: 'button',
  32239. text: '关闭',
  32240. iconCls: 'x-fa fa-times',
  32241. listeners: {
  32242. click: 'system.closeMe()',
  32243. },
  32244. },
  32245. ],
  32246. },
  32247. defaults: {
  32248. margin: '8 0 0 0'
  32249. },
  32250. items: __spread(conditionRows, sumRows),
  32251. fix: ['system.enterToClick("btnSearch")'],
  32252. },
  32253. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  32254. method: 'invoke',
  32255. url: '/report/Report@execute',
  32256. params: {
  32257. dataSource: report.dataSource,
  32258. pagination: report.grid.pagination || true,
  32259. report_id: config.report_id,
  32260. query: '{query}',
  32261. },
  32262. }, columns: columns }, report.grid),
  32263. ],
  32264. },
  32265. ],
  32266. };
  32267. return { model: model, vjson: vjson, report: report };
  32268. }
  32269. var ReportScope = /** @class */ (function (_super) {
  32270. __extends(ReportScope, _super);
  32271. function ReportScope(_a, invokeServerFn) {
  32272. var model = _a.model, vjson = _a.vjson;
  32273. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  32274. _this.invokeServerFn = invokeServerFn;
  32275. return _this;
  32276. }
  32277. ReportScope.prototype.onLoad = function () {
  32278. // this.reload()
  32279. };
  32280. ReportScope.prototype.reload = function () {
  32281. var _this = this;
  32282. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  32283. if (this.viewModel.get('has_sum')) {
  32284. this.invokeServerFn('/report/Report@executeSum', {
  32285. dataSource: this.report.dataSource,
  32286. report_id: this.report_id,
  32287. query: this.viewModel.get('query'),
  32288. }).then(function (res) {
  32289. if (!res.success) {
  32290. showErrorDialog$1(res.msg);
  32291. }
  32292. else {
  32293. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  32294. }
  32295. });
  32296. }
  32297. this.refs.grid1.reload();
  32298. };
  32299. return ReportScope;
  32300. }(Scope));
  32301. //# sourceMappingURL=Report.js.map
  32302. var studio = {
  32303. init: init$1,
  32304. handles: handles$1,
  32305. Workbench: Workbench
  32306. };
  32307. //# sourceMappingURL=index.js.map
  32308. exports.axios = axios;
  32309. exports.qs = Qs;
  32310. exports.lodash = _$2;
  32311. exports.jquery = $$2;
  32312. exports.moment = moment$1;
  32313. exports.recast = recast;
  32314. exports.XLSX = XLSX;
  32315. exports.Defaults = Defaults;
  32316. exports.ExcelImportDialog = ExcelImportDialog;
  32317. exports.Lib = Lib;
  32318. exports.LibParam = LibParam;
  32319. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32320. exports.ReportScope = ReportScope;
  32321. exports.SIMPLE_RE = SIMPLE_RE;
  32322. exports.Scope = Scope;
  32323. exports.ScopeEngine = ScopeEngine;
  32324. exports.SystemEventFu = SystemEventFu;
  32325. exports.ajax = ajax;
  32326. exports.baseConfigProcess = baseConfigProcess;
  32327. exports.baseConfigProcessList = baseConfigProcessList;
  32328. exports.buildPlus = buildPlus;
  32329. exports.buildReportScope = buildReportScope;
  32330. exports.calcExpress = calcExpress;
  32331. exports.calcObject = calcObject;
  32332. exports.calcObjectFlat = calcObjectFlat;
  32333. exports.clearViewModel = clearViewModel;
  32334. exports.clearViewModelByLookup = clearViewModelByLookup;
  32335. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32336. exports.clearViewModelValues = clearViewModelValues;
  32337. exports.commitMe = commitMe;
  32338. exports.confirm = confirm;
  32339. exports.createAjax = createAjax;
  32340. exports.createUUID = createUUID;
  32341. exports.deepTravJson = deepTravJson;
  32342. exports.downLoad = downLoad;
  32343. exports.evalFunction = evalFunction;
  32344. exports.extend = extend;
  32345. exports.flatRow = flatRow;
  32346. exports.getApiConvert = getApiConvert;
  32347. exports.getGridEditRows = getGridEditRows;
  32348. exports.getParentGrid = getParentGrid;
  32349. exports.getPinyin = getPinyin;
  32350. exports.getRegList = getRegList;
  32351. exports.getRegParamList = getRegParamList;
  32352. exports.getScopeOnCreate = getScopeOnCreate;
  32353. exports.init = init$2;
  32354. exports.insertGridRow = insertGridRow;
  32355. exports.invokeServer = invokeServer$1;
  32356. exports.isDesignMode = isDesignMode;
  32357. exports.isEmpty = isEmpty;
  32358. exports.json5 = dist;
  32359. exports.keywordFilter = keywordFilter;
  32360. exports.lookupFn = lookupFn;
  32361. exports.lookupScope = lookupScope;
  32362. exports.mergeViewModel = mergeViewModel;
  32363. exports.moveDownGridRow = moveDownGridRow;
  32364. exports.moveUpGridRow = moveUpGridRow;
  32365. exports.msg = msg$1;
  32366. exports.msgError = msgError;
  32367. exports.normId = normId;
  32368. exports.pinyinMatch = pinyinMatch;
  32369. exports.prompt = prompt$2;
  32370. exports.raiseClick = raiseClick;
  32371. exports.reloadGrid = reloadGrid;
  32372. exports.removeGridRow = removeGridRow;
  32373. exports.replaceNA = replaceNA;
  32374. exports.saveGridRow = saveGridRow;
  32375. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32376. exports.setComboStore = setComboStore;
  32377. exports.showErrorDialog = showErrorDialog$1;
  32378. exports.showInfoDialog = showInfoDialog;
  32379. exports.showWidget = showWidget;
  32380. exports.sqlUrlTransform = sqlUrlTransform;
  32381. exports.stopEvent = stopEvent;
  32382. exports.studio = studio;
  32383. exports.toPlainObject = toPlainObject;
  32384. exports.toString = toString;
  32385. exports.tryEnable = tryEnable;
  32386. exports.tryVarSimple = tryVarSimple;
  32387. exports.tryWriteByExpress = tryWriteByExpress;
  32388. exports.tryWriteObject = tryWriteObject;
  32389. exports.watch = watch;
  32390. Object.defineProperty(exports, '__esModule', { value: true });
  32391. });
  32392. //# sourceMappingURL=yvan-ext.js.map