yvan-ext.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809
  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. };
  50. var comboGrid = {
  51. selectOnTab: true,
  52. pickerHeight: 500,
  53. pickerWidth: 850,
  54. editEnable: null,
  55. };
  56. var comboGridPicker = {
  57. xtype: 'yvgrid',
  58. layout: 'fit',
  59. selModel: {
  60. selType: 'rowmodel',
  61. mode: 'SINGLE'
  62. },
  63. };
  64. var comboGridMulti = {
  65. selectOnTab: true,
  66. pickerHeight: 500,
  67. pickerWidth: 850,
  68. editEnable: null,
  69. splitChar: ',',
  70. displayField: 'text',
  71. valueField: 'id',
  72. autoLoad: true,
  73. };
  74. var comboGridMultiPicker = {
  75. selType: 'checkboxmodel',
  76. selModel: {
  77. type: 'checkboxmodel',
  78. checkOnly: false
  79. },
  80. };
  81. var numberfield = {
  82. labelAlign: 'right',
  83. decimalPrecision: 6,
  84. labelWidth: labelWidth,
  85. };
  86. var checkbox = {
  87. labelAlign: 'right',
  88. labelWidth: labelWidth,
  89. checkedValue: true,
  90. uncheckedValue: false,
  91. };
  92. var checkboxgroup = {
  93. labelAlign: 'right',
  94. labelWidth: labelWidth,
  95. };
  96. var radio = {
  97. labelAlign: 'right',
  98. labelWidth: labelWidth,
  99. };
  100. var radiogroup = {
  101. labelAlign: 'right',
  102. labelWidth: labelWidth,
  103. simpleValue: true,
  104. layout: 'hbox',
  105. defaults: {
  106. xtype: 'radio',
  107. name: 'type',
  108. margin: '0 15 0 0'
  109. },
  110. };
  111. var form = {
  112. margin: '5 5 0 0',
  113. border: false,
  114. defaults: {
  115. margin: '0 0 5 0',
  116. border: false,
  117. },
  118. };
  119. var column = {
  120. filter: { type: 'string' },
  121. };
  122. var grid = {
  123. border: true,
  124. columnLines: true,
  125. rowLines: true,
  126. plugins: {
  127. cellediting: {
  128. clicksToEdit: 1,
  129. },
  130. gridfilters: true
  131. },
  132. multiColumnSort: true,
  133. viewConfig: {
  134. enableTextSelection: true,
  135. sortOnClick: false,
  136. emptyText: '没有数据'
  137. },
  138. selModel: {
  139. type: 'checkboxmodel',
  140. checkOnly: false
  141. },
  142. pagination: true,
  143. pageSize: 50,
  144. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  145. hideFootbar: false,
  146. hideRefresh: false,
  147. hideExport: false,
  148. hideAutoSize: false,
  149. hideClearFilter: false,
  150. hideSaveGridUIConfig: false,
  151. hideClearGridUIConfig: false,
  152. autoLoad: true,
  153. remoteSort: false,
  154. remoteFilter: false,
  155. enableLocking: true,
  156. syncRowHeight: false,
  157. enableColumnMove: true,
  158. enableColumnHide: true,
  159. enableColumnResize: true,
  160. hidden: false,
  161. disabled: false,
  162. exportExcelPageSize: 100,
  163. exportExcelCurrentPage: 1,
  164. exportExcelTotal: 0,
  165. cellTip: false,
  166. };
  167. var fieldContainer = {
  168. labelAlign: 'right',
  169. labelWidth: labelWidth,
  170. layout: 'hbox',
  171. defaults: {
  172. flex: 1,
  173. }
  174. };
  175. var tree = {
  176. autoLoad: true,
  177. hideFilter: false,
  178. hideToolbar: false,
  179. hideRefresh: false,
  180. hideExpand: false,
  181. hideCollapse: false,
  182. root: [],
  183. rootVisible: false,
  184. };
  185. var search = {
  186. labelAlign: 'right',
  187. labelWidth: labelWidth,
  188. };
  189. var text = {
  190. labelAlign: 'right',
  191. labelWidth: labelWidth,
  192. msgTarget: 'qtip',
  193. };
  194. var toolbar = {
  195. overflowHandler: 'menu',
  196. };
  197. var tbfill = {};
  198. var tbseparator = {};
  199. var button = {};
  200. var fieldSet = {
  201. margin: '5 5 0 0',
  202. border: false,
  203. defaults: {
  204. margin: '0 0 5 0',
  205. border: false,
  206. },
  207. };
  208. var storeAjax = {
  209. timeout: 60000
  210. };
  211. var panel = {};
  212. var splitter = {};
  213. var maintab = {};
  214. var rows = {};
  215. var cols = {
  216. defaults: {
  217. flex: 1
  218. },
  219. };
  220. var bpmn = {
  221. hideRefresh: false,
  222. autoLoad: true,
  223. dataSource: '',
  224. bpmnConfig: {}
  225. };
  226. //# sourceMappingURL=Defaults.js.map
  227. var Defaults = /*#__PURE__*/Object.freeze({
  228. __proto__: null,
  229. windows: windows,
  230. date: date,
  231. tagfield: tagfield,
  232. combo: combo,
  233. comboGrid: comboGrid,
  234. comboGridPicker: comboGridPicker,
  235. comboGridMulti: comboGridMulti,
  236. comboGridMultiPicker: comboGridMultiPicker,
  237. numberfield: numberfield,
  238. checkbox: checkbox,
  239. checkboxgroup: checkboxgroup,
  240. radio: radio,
  241. radiogroup: radiogroup,
  242. form: form,
  243. column: column,
  244. grid: grid,
  245. fieldContainer: fieldContainer,
  246. tree: tree,
  247. search: search,
  248. text: text,
  249. toolbar: toolbar,
  250. tbfill: tbfill,
  251. tbseparator: tbseparator,
  252. button: button,
  253. fieldSet: fieldSet,
  254. storeAjax: storeAjax,
  255. panel: panel,
  256. splitter: splitter,
  257. maintab: maintab,
  258. rows: rows,
  259. cols: cols,
  260. bpmn: bpmn
  261. });
  262. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  263. function createCommonjsModule(fn, module) {
  264. return module = { exports: {} }, fn(module, module.exports), module.exports;
  265. }
  266. var dist = createCommonjsModule(function (module, exports) {
  267. (function (global, factory) {
  268. module.exports = factory() ;
  269. }(commonjsGlobal, (function () {
  270. function createCommonjsModule(fn, module) {
  271. return module = { exports: {} }, fn(module, module.exports), module.exports;
  272. }
  273. var _global = createCommonjsModule(function (module) {
  274. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  275. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  276. ? window : typeof self != 'undefined' && self.Math == Math ? self
  277. // eslint-disable-next-line no-new-func
  278. : Function('return this')();
  279. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  280. });
  281. var _core = createCommonjsModule(function (module) {
  282. var core = module.exports = { version: '2.6.5' };
  283. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  284. });
  285. var _core_1 = _core.version;
  286. var _isObject = function (it) {
  287. return typeof it === 'object' ? it !== null : typeof it === 'function';
  288. };
  289. var _anObject = function (it) {
  290. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  291. return it;
  292. };
  293. var _fails = function (exec) {
  294. try {
  295. return !!exec();
  296. } catch (e) {
  297. return true;
  298. }
  299. };
  300. // Thank's IE8 for his funny defineProperty
  301. var _descriptors = !_fails(function () {
  302. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  303. });
  304. var document = _global.document;
  305. // typeof document.createElement is 'object' in old IE
  306. var is = _isObject(document) && _isObject(document.createElement);
  307. var _domCreate = function (it) {
  308. return is ? document.createElement(it) : {};
  309. };
  310. var _ie8DomDefine = !_descriptors && !_fails(function () {
  311. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  312. });
  313. // 7.1.1 ToPrimitive(input [, PreferredType])
  314. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  315. // and the second argument - flag - preferred type is a string
  316. var _toPrimitive = function (it, S) {
  317. if (!_isObject(it)) { return it; }
  318. var fn, val;
  319. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  320. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  321. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. throw TypeError("Can't convert object to primitive value");
  323. };
  324. var dP = Object.defineProperty;
  325. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  326. _anObject(O);
  327. P = _toPrimitive(P, true);
  328. _anObject(Attributes);
  329. if (_ie8DomDefine) { try {
  330. return dP(O, P, Attributes);
  331. } catch (e) { /* empty */ } }
  332. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  333. if ('value' in Attributes) { O[P] = Attributes.value; }
  334. return O;
  335. };
  336. var _objectDp = {
  337. f: f
  338. };
  339. var _propertyDesc = function (bitmap, value) {
  340. return {
  341. enumerable: !(bitmap & 1),
  342. configurable: !(bitmap & 2),
  343. writable: !(bitmap & 4),
  344. value: value
  345. };
  346. };
  347. var _hide = _descriptors ? function (object, key, value) {
  348. return _objectDp.f(object, key, _propertyDesc(1, value));
  349. } : function (object, key, value) {
  350. object[key] = value;
  351. return object;
  352. };
  353. var hasOwnProperty = {}.hasOwnProperty;
  354. var _has = function (it, key) {
  355. return hasOwnProperty.call(it, key);
  356. };
  357. var id = 0;
  358. var px = Math.random();
  359. var _uid = function (key) {
  360. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  361. };
  362. var _shared = createCommonjsModule(function (module) {
  363. var SHARED = '__core-js_shared__';
  364. var store = _global[SHARED] || (_global[SHARED] = {});
  365. (module.exports = function (key, value) {
  366. return store[key] || (store[key] = value !== undefined ? value : {});
  367. })('versions', []).push({
  368. version: _core.version,
  369. mode: 'global',
  370. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  371. });
  372. });
  373. var _functionToString = _shared('native-function-to-string', Function.toString);
  374. var _redefine = createCommonjsModule(function (module) {
  375. var SRC = _uid('src');
  376. var TO_STRING = 'toString';
  377. var TPL = ('' + _functionToString).split(TO_STRING);
  378. _core.inspectSource = function (it) {
  379. return _functionToString.call(it);
  380. };
  381. (module.exports = function (O, key, val, safe) {
  382. var isFunction = typeof val == 'function';
  383. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  384. if (O[key] === val) { return; }
  385. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  386. if (O === _global) {
  387. O[key] = val;
  388. } else if (!safe) {
  389. delete O[key];
  390. _hide(O, key, val);
  391. } else if (O[key]) {
  392. O[key] = val;
  393. } else {
  394. _hide(O, key, val);
  395. }
  396. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  397. })(Function.prototype, TO_STRING, function toString() {
  398. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  399. });
  400. });
  401. var _aFunction = function (it) {
  402. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  403. return it;
  404. };
  405. // optional / simple context binding
  406. var _ctx = function (fn, that, length) {
  407. _aFunction(fn);
  408. if (that === undefined) { return fn; }
  409. switch (length) {
  410. case 1: return function (a) {
  411. return fn.call(that, a);
  412. };
  413. case 2: return function (a, b) {
  414. return fn.call(that, a, b);
  415. };
  416. case 3: return function (a, b, c) {
  417. return fn.call(that, a, b, c);
  418. };
  419. }
  420. return function (/* ...args */) {
  421. return fn.apply(that, arguments);
  422. };
  423. };
  424. var PROTOTYPE = 'prototype';
  425. var $export = function (type, name, source) {
  426. var IS_FORCED = type & $export.F;
  427. var IS_GLOBAL = type & $export.G;
  428. var IS_STATIC = type & $export.S;
  429. var IS_PROTO = type & $export.P;
  430. var IS_BIND = type & $export.B;
  431. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  432. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  433. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  434. var key, own, out, exp;
  435. if (IS_GLOBAL) { source = name; }
  436. for (key in source) {
  437. // contains in native
  438. own = !IS_FORCED && target && target[key] !== undefined;
  439. // export native or passed
  440. out = (own ? target : source)[key];
  441. // bind timers to global for call from export context
  442. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  443. // extend global
  444. if (target) { _redefine(target, key, out, type & $export.U); }
  445. // export
  446. if (exports[key] != out) { _hide(exports, key, exp); }
  447. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  448. }
  449. };
  450. _global.core = _core;
  451. // type bitmap
  452. $export.F = 1; // forced
  453. $export.G = 2; // global
  454. $export.S = 4; // static
  455. $export.P = 8; // proto
  456. $export.B = 16; // bind
  457. $export.W = 32; // wrap
  458. $export.U = 64; // safe
  459. $export.R = 128; // real proto method for `library`
  460. var _export = $export;
  461. // 7.1.4 ToInteger
  462. var ceil = Math.ceil;
  463. var floor = Math.floor;
  464. var _toInteger = function (it) {
  465. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  466. };
  467. // 7.2.1 RequireObjectCoercible(argument)
  468. var _defined = function (it) {
  469. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  470. return it;
  471. };
  472. // true -> String#at
  473. // false -> String#codePointAt
  474. var _stringAt = function (TO_STRING) {
  475. return function (that, pos) {
  476. var s = String(_defined(that));
  477. var i = _toInteger(pos);
  478. var l = s.length;
  479. var a, b;
  480. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  481. a = s.charCodeAt(i);
  482. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  483. ? TO_STRING ? s.charAt(i) : a
  484. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  485. };
  486. };
  487. var $at = _stringAt(false);
  488. _export(_export.P, 'String', {
  489. // 21.1.3.3 String.prototype.codePointAt(pos)
  490. codePointAt: function codePointAt(pos) {
  491. return $at(this, pos);
  492. }
  493. });
  494. var codePointAt = _core.String.codePointAt;
  495. var max = Math.max;
  496. var min = Math.min;
  497. var _toAbsoluteIndex = function (index, length) {
  498. index = _toInteger(index);
  499. return index < 0 ? max(index + length, 0) : min(index, length);
  500. };
  501. var fromCharCode = String.fromCharCode;
  502. var $fromCodePoint = String.fromCodePoint;
  503. // length should be 1, old FF problem
  504. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  505. // 21.1.2.2 String.fromCodePoint(...codePoints)
  506. fromCodePoint: function fromCodePoint(x) {
  507. var arguments$1 = arguments;
  508. // eslint-disable-line no-unused-vars
  509. var res = [];
  510. var aLen = arguments.length;
  511. var i = 0;
  512. var code;
  513. while (aLen > i) {
  514. code = +arguments$1[i++];
  515. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  516. res.push(code < 0x10000
  517. ? fromCharCode(code)
  518. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  519. );
  520. } return res.join('');
  521. }
  522. });
  523. var fromCodePoint = _core.String.fromCodePoint;
  524. // This is a generated file. Do not edit.
  525. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  526. 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]/;
  527. 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]/;
  528. var unicode = {
  529. Space_Separator: Space_Separator,
  530. ID_Start: ID_Start,
  531. ID_Continue: ID_Continue
  532. };
  533. var util = {
  534. isSpaceSeparator: function isSpaceSeparator (c) {
  535. return typeof c === 'string' && unicode.Space_Separator.test(c)
  536. },
  537. isIdStartChar: function isIdStartChar (c) {
  538. return typeof c === 'string' && (
  539. (c >= 'a' && c <= 'z') ||
  540. (c >= 'A' && c <= 'Z') ||
  541. (c === '$') || (c === '_') ||
  542. unicode.ID_Start.test(c)
  543. )
  544. },
  545. isIdContinueChar: function isIdContinueChar (c) {
  546. return typeof c === 'string' && (
  547. (c >= 'a' && c <= 'z') ||
  548. (c >= 'A' && c <= 'Z') ||
  549. (c >= '0' && c <= '9') ||
  550. (c === '$') || (c === '_') ||
  551. (c === '\u200C') || (c === '\u200D') ||
  552. unicode.ID_Continue.test(c)
  553. )
  554. },
  555. isDigit: function isDigit (c) {
  556. return typeof c === 'string' && /[0-9]/.test(c)
  557. },
  558. isHexDigit: function isHexDigit (c) {
  559. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  560. },
  561. };
  562. var source;
  563. var parseState;
  564. var stack;
  565. var pos;
  566. var line;
  567. var column;
  568. var token;
  569. var key;
  570. var root;
  571. var parse = function parse (text, reviver) {
  572. source = String(text);
  573. parseState = 'start';
  574. stack = [];
  575. pos = 0;
  576. line = 1;
  577. column = 0;
  578. token = undefined;
  579. key = undefined;
  580. root = undefined;
  581. do {
  582. token = lex();
  583. // This code is unreachable.
  584. // if (!parseStates[parseState]) {
  585. // throw invalidParseState()
  586. // }
  587. parseStates[parseState]();
  588. } while (token.type !== 'eof')
  589. if (typeof reviver === 'function') {
  590. return internalize({'': root}, '', reviver)
  591. }
  592. return root
  593. };
  594. function internalize (holder, name, reviver) {
  595. var value = holder[name];
  596. if (value != null && typeof value === 'object') {
  597. for (var key in value) {
  598. var replacement = internalize(value, key, reviver);
  599. if (replacement === undefined) {
  600. delete value[key];
  601. } else {
  602. value[key] = replacement;
  603. }
  604. }
  605. }
  606. return reviver.call(holder, name, value)
  607. }
  608. var lexState;
  609. var buffer;
  610. var doubleQuote;
  611. var sign;
  612. var c;
  613. function lex () {
  614. lexState = 'default';
  615. buffer = '';
  616. doubleQuote = false;
  617. sign = 1;
  618. for (;;) {
  619. c = peek();
  620. // This code is unreachable.
  621. // if (!lexStates[lexState]) {
  622. // throw invalidLexState(lexState)
  623. // }
  624. var token = lexStates[lexState]();
  625. if (token) {
  626. return token
  627. }
  628. }
  629. }
  630. function peek () {
  631. if (source[pos]) {
  632. return String.fromCodePoint(source.codePointAt(pos))
  633. }
  634. }
  635. function read () {
  636. var c = peek();
  637. if (c === '\n') {
  638. line++;
  639. column = 0;
  640. } else if (c) {
  641. column += c.length;
  642. } else {
  643. column++;
  644. }
  645. if (c) {
  646. pos += c.length;
  647. }
  648. return c
  649. }
  650. var lexStates = {
  651. default: function default$1 () {
  652. switch (c) {
  653. case '\t':
  654. case '\v':
  655. case '\f':
  656. case ' ':
  657. case '\u00A0':
  658. case '\uFEFF':
  659. case '\n':
  660. case '\r':
  661. case '\u2028':
  662. case '\u2029':
  663. read();
  664. return
  665. case '/':
  666. read();
  667. lexState = 'comment';
  668. return
  669. case undefined:
  670. read();
  671. return newToken('eof')
  672. }
  673. if (util.isSpaceSeparator(c)) {
  674. read();
  675. return
  676. }
  677. // This code is unreachable.
  678. // if (!lexStates[parseState]) {
  679. // throw invalidLexState(parseState)
  680. // }
  681. return lexStates[parseState]()
  682. },
  683. comment: function comment () {
  684. switch (c) {
  685. case '*':
  686. read();
  687. lexState = 'multiLineComment';
  688. return
  689. case '/':
  690. read();
  691. lexState = 'singleLineComment';
  692. return
  693. }
  694. throw invalidChar(read())
  695. },
  696. multiLineComment: function multiLineComment () {
  697. switch (c) {
  698. case '*':
  699. read();
  700. lexState = 'multiLineCommentAsterisk';
  701. return
  702. case undefined:
  703. throw invalidChar(read())
  704. }
  705. read();
  706. },
  707. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  708. switch (c) {
  709. case '*':
  710. read();
  711. return
  712. case '/':
  713. read();
  714. lexState = 'default';
  715. return
  716. case undefined:
  717. throw invalidChar(read())
  718. }
  719. read();
  720. lexState = 'multiLineComment';
  721. },
  722. singleLineComment: function singleLineComment () {
  723. switch (c) {
  724. case '\n':
  725. case '\r':
  726. case '\u2028':
  727. case '\u2029':
  728. read();
  729. lexState = 'default';
  730. return
  731. case undefined:
  732. read();
  733. return newToken('eof')
  734. }
  735. read();
  736. },
  737. value: function value () {
  738. switch (c) {
  739. case '{':
  740. case '[':
  741. return newToken('punctuator', read())
  742. case 'n':
  743. read();
  744. literal('ull');
  745. return newToken('null', null)
  746. case 't':
  747. read();
  748. literal('rue');
  749. return newToken('boolean', true)
  750. case 'f':
  751. read();
  752. literal('alse');
  753. return newToken('boolean', false)
  754. case '-':
  755. case '+':
  756. if (read() === '-') {
  757. sign = -1;
  758. }
  759. lexState = 'sign';
  760. return
  761. case '.':
  762. buffer = read();
  763. lexState = 'decimalPointLeading';
  764. return
  765. case '0':
  766. buffer = read();
  767. lexState = 'zero';
  768. return
  769. case '1':
  770. case '2':
  771. case '3':
  772. case '4':
  773. case '5':
  774. case '6':
  775. case '7':
  776. case '8':
  777. case '9':
  778. buffer = read();
  779. lexState = 'decimalInteger';
  780. return
  781. case 'I':
  782. read();
  783. literal('nfinity');
  784. return newToken('numeric', Infinity)
  785. case 'N':
  786. read();
  787. literal('aN');
  788. return newToken('numeric', NaN)
  789. case '"':
  790. case "'":
  791. doubleQuote = (read() === '"');
  792. buffer = '';
  793. lexState = 'string';
  794. return
  795. }
  796. throw invalidChar(read())
  797. },
  798. identifierNameStartEscape: function identifierNameStartEscape () {
  799. if (c !== 'u') {
  800. throw invalidChar(read())
  801. }
  802. read();
  803. var u = unicodeEscape();
  804. switch (u) {
  805. case '$':
  806. case '_':
  807. break
  808. default:
  809. if (!util.isIdStartChar(u)) {
  810. throw invalidIdentifier()
  811. }
  812. break
  813. }
  814. buffer += u;
  815. lexState = 'identifierName';
  816. },
  817. identifierName: function identifierName () {
  818. switch (c) {
  819. case '$':
  820. case '_':
  821. case '\u200C':
  822. case '\u200D':
  823. buffer += read();
  824. return
  825. case '\\':
  826. read();
  827. lexState = 'identifierNameEscape';
  828. return
  829. }
  830. if (util.isIdContinueChar(c)) {
  831. buffer += read();
  832. return
  833. }
  834. return newToken('identifier', buffer)
  835. },
  836. identifierNameEscape: function identifierNameEscape () {
  837. if (c !== 'u') {
  838. throw invalidChar(read())
  839. }
  840. read();
  841. var u = unicodeEscape();
  842. switch (u) {
  843. case '$':
  844. case '_':
  845. case '\u200C':
  846. case '\u200D':
  847. break
  848. default:
  849. if (!util.isIdContinueChar(u)) {
  850. throw invalidIdentifier()
  851. }
  852. break
  853. }
  854. buffer += u;
  855. lexState = 'identifierName';
  856. },
  857. sign: function sign$1 () {
  858. switch (c) {
  859. case '.':
  860. buffer = read();
  861. lexState = 'decimalPointLeading';
  862. return
  863. case '0':
  864. buffer = read();
  865. lexState = 'zero';
  866. return
  867. case '1':
  868. case '2':
  869. case '3':
  870. case '4':
  871. case '5':
  872. case '6':
  873. case '7':
  874. case '8':
  875. case '9':
  876. buffer = read();
  877. lexState = 'decimalInteger';
  878. return
  879. case 'I':
  880. read();
  881. literal('nfinity');
  882. return newToken('numeric', sign * Infinity)
  883. case 'N':
  884. read();
  885. literal('aN');
  886. return newToken('numeric', NaN)
  887. }
  888. throw invalidChar(read())
  889. },
  890. zero: function zero () {
  891. switch (c) {
  892. case '.':
  893. buffer += read();
  894. lexState = 'decimalPoint';
  895. return
  896. case 'e':
  897. case 'E':
  898. buffer += read();
  899. lexState = 'decimalExponent';
  900. return
  901. case 'x':
  902. case 'X':
  903. buffer += read();
  904. lexState = 'hexadecimal';
  905. return
  906. }
  907. return newToken('numeric', sign * 0)
  908. },
  909. decimalInteger: function decimalInteger () {
  910. switch (c) {
  911. case '.':
  912. buffer += read();
  913. lexState = 'decimalPoint';
  914. return
  915. case 'e':
  916. case 'E':
  917. buffer += read();
  918. lexState = 'decimalExponent';
  919. return
  920. }
  921. if (util.isDigit(c)) {
  922. buffer += read();
  923. return
  924. }
  925. return newToken('numeric', sign * Number(buffer))
  926. },
  927. decimalPointLeading: function decimalPointLeading () {
  928. if (util.isDigit(c)) {
  929. buffer += read();
  930. lexState = 'decimalFraction';
  931. return
  932. }
  933. throw invalidChar(read())
  934. },
  935. decimalPoint: function decimalPoint () {
  936. switch (c) {
  937. case 'e':
  938. case 'E':
  939. buffer += read();
  940. lexState = 'decimalExponent';
  941. return
  942. }
  943. if (util.isDigit(c)) {
  944. buffer += read();
  945. lexState = 'decimalFraction';
  946. return
  947. }
  948. return newToken('numeric', sign * Number(buffer))
  949. },
  950. decimalFraction: function decimalFraction () {
  951. switch (c) {
  952. case 'e':
  953. case 'E':
  954. buffer += read();
  955. lexState = 'decimalExponent';
  956. return
  957. }
  958. if (util.isDigit(c)) {
  959. buffer += read();
  960. return
  961. }
  962. return newToken('numeric', sign * Number(buffer))
  963. },
  964. decimalExponent: function decimalExponent () {
  965. switch (c) {
  966. case '+':
  967. case '-':
  968. buffer += read();
  969. lexState = 'decimalExponentSign';
  970. return
  971. }
  972. if (util.isDigit(c)) {
  973. buffer += read();
  974. lexState = 'decimalExponentInteger';
  975. return
  976. }
  977. throw invalidChar(read())
  978. },
  979. decimalExponentSign: function decimalExponentSign () {
  980. if (util.isDigit(c)) {
  981. buffer += read();
  982. lexState = 'decimalExponentInteger';
  983. return
  984. }
  985. throw invalidChar(read())
  986. },
  987. decimalExponentInteger: function decimalExponentInteger () {
  988. if (util.isDigit(c)) {
  989. buffer += read();
  990. return
  991. }
  992. return newToken('numeric', sign * Number(buffer))
  993. },
  994. hexadecimal: function hexadecimal () {
  995. if (util.isHexDigit(c)) {
  996. buffer += read();
  997. lexState = 'hexadecimalInteger';
  998. return
  999. }
  1000. throw invalidChar(read())
  1001. },
  1002. hexadecimalInteger: function hexadecimalInteger () {
  1003. if (util.isHexDigit(c)) {
  1004. buffer += read();
  1005. return
  1006. }
  1007. return newToken('numeric', sign * Number(buffer))
  1008. },
  1009. string: function string () {
  1010. switch (c) {
  1011. case '\\':
  1012. read();
  1013. buffer += escape();
  1014. return
  1015. case '"':
  1016. if (doubleQuote) {
  1017. read();
  1018. return newToken('string', buffer)
  1019. }
  1020. buffer += read();
  1021. return
  1022. case "'":
  1023. if (!doubleQuote) {
  1024. read();
  1025. return newToken('string', buffer)
  1026. }
  1027. buffer += read();
  1028. return
  1029. case '\n':
  1030. case '\r':
  1031. throw invalidChar(read())
  1032. case '\u2028':
  1033. case '\u2029':
  1034. separatorChar(c);
  1035. break
  1036. case undefined:
  1037. throw invalidChar(read())
  1038. }
  1039. buffer += read();
  1040. },
  1041. start: function start () {
  1042. switch (c) {
  1043. case '{':
  1044. case '[':
  1045. return newToken('punctuator', read())
  1046. // This code is unreachable since the default lexState handles eof.
  1047. // case undefined:
  1048. // return newToken('eof')
  1049. }
  1050. lexState = 'value';
  1051. },
  1052. beforePropertyName: function beforePropertyName () {
  1053. switch (c) {
  1054. case '$':
  1055. case '_':
  1056. buffer = read();
  1057. lexState = 'identifierName';
  1058. return
  1059. case '\\':
  1060. read();
  1061. lexState = 'identifierNameStartEscape';
  1062. return
  1063. case '}':
  1064. return newToken('punctuator', read())
  1065. case '"':
  1066. case "'":
  1067. doubleQuote = (read() === '"');
  1068. lexState = 'string';
  1069. return
  1070. }
  1071. if (util.isIdStartChar(c)) {
  1072. buffer += read();
  1073. lexState = 'identifierName';
  1074. return
  1075. }
  1076. throw invalidChar(read())
  1077. },
  1078. afterPropertyName: function afterPropertyName () {
  1079. if (c === ':') {
  1080. return newToken('punctuator', read())
  1081. }
  1082. throw invalidChar(read())
  1083. },
  1084. beforePropertyValue: function beforePropertyValue () {
  1085. lexState = 'value';
  1086. },
  1087. afterPropertyValue: function afterPropertyValue () {
  1088. switch (c) {
  1089. case ',':
  1090. case '}':
  1091. return newToken('punctuator', read())
  1092. }
  1093. throw invalidChar(read())
  1094. },
  1095. beforeArrayValue: function beforeArrayValue () {
  1096. if (c === ']') {
  1097. return newToken('punctuator', read())
  1098. }
  1099. lexState = 'value';
  1100. },
  1101. afterArrayValue: function afterArrayValue () {
  1102. switch (c) {
  1103. case ',':
  1104. case ']':
  1105. return newToken('punctuator', read())
  1106. }
  1107. throw invalidChar(read())
  1108. },
  1109. end: function end () {
  1110. // This code is unreachable since it's handled by the default lexState.
  1111. // if (c === undefined) {
  1112. // read()
  1113. // return newToken('eof')
  1114. // }
  1115. throw invalidChar(read())
  1116. },
  1117. };
  1118. function newToken (type, value) {
  1119. return {
  1120. type: type,
  1121. value: value,
  1122. line: line,
  1123. column: column,
  1124. }
  1125. }
  1126. function literal (s) {
  1127. for (var i = 0, list = s; i < list.length; i += 1) {
  1128. var c = list[i];
  1129. var p = peek();
  1130. if (p !== c) {
  1131. throw invalidChar(read())
  1132. }
  1133. read();
  1134. }
  1135. }
  1136. function escape () {
  1137. var c = peek();
  1138. switch (c) {
  1139. case 'b':
  1140. read();
  1141. return '\b'
  1142. case 'f':
  1143. read();
  1144. return '\f'
  1145. case 'n':
  1146. read();
  1147. return '\n'
  1148. case 'r':
  1149. read();
  1150. return '\r'
  1151. case 't':
  1152. read();
  1153. return '\t'
  1154. case 'v':
  1155. read();
  1156. return '\v'
  1157. case '0':
  1158. read();
  1159. if (util.isDigit(peek())) {
  1160. throw invalidChar(read())
  1161. }
  1162. return '\0'
  1163. case 'x':
  1164. read();
  1165. return hexEscape()
  1166. case 'u':
  1167. read();
  1168. return unicodeEscape()
  1169. case '\n':
  1170. case '\u2028':
  1171. case '\u2029':
  1172. read();
  1173. return ''
  1174. case '\r':
  1175. read();
  1176. if (peek() === '\n') {
  1177. read();
  1178. }
  1179. return ''
  1180. case '1':
  1181. case '2':
  1182. case '3':
  1183. case '4':
  1184. case '5':
  1185. case '6':
  1186. case '7':
  1187. case '8':
  1188. case '9':
  1189. throw invalidChar(read())
  1190. case undefined:
  1191. throw invalidChar(read())
  1192. }
  1193. return read()
  1194. }
  1195. function hexEscape () {
  1196. var buffer = '';
  1197. var c = peek();
  1198. if (!util.isHexDigit(c)) {
  1199. throw invalidChar(read())
  1200. }
  1201. buffer += read();
  1202. c = peek();
  1203. if (!util.isHexDigit(c)) {
  1204. throw invalidChar(read())
  1205. }
  1206. buffer += read();
  1207. return String.fromCodePoint(parseInt(buffer, 16))
  1208. }
  1209. function unicodeEscape () {
  1210. var buffer = '';
  1211. var count = 4;
  1212. while (count-- > 0) {
  1213. var c = peek();
  1214. if (!util.isHexDigit(c)) {
  1215. throw invalidChar(read())
  1216. }
  1217. buffer += read();
  1218. }
  1219. return String.fromCodePoint(parseInt(buffer, 16))
  1220. }
  1221. var parseStates = {
  1222. start: function start () {
  1223. if (token.type === 'eof') {
  1224. throw invalidEOF()
  1225. }
  1226. push();
  1227. },
  1228. beforePropertyName: function beforePropertyName () {
  1229. switch (token.type) {
  1230. case 'identifier':
  1231. case 'string':
  1232. key = token.value;
  1233. parseState = 'afterPropertyName';
  1234. return
  1235. case 'punctuator':
  1236. // This code is unreachable since it's handled by the lexState.
  1237. // if (token.value !== '}') {
  1238. // throw invalidToken()
  1239. // }
  1240. pop();
  1241. return
  1242. case 'eof':
  1243. throw invalidEOF()
  1244. }
  1245. // This code is unreachable since it's handled by the lexState.
  1246. // throw invalidToken()
  1247. },
  1248. afterPropertyName: function afterPropertyName () {
  1249. // This code is unreachable since it's handled by the lexState.
  1250. // if (token.type !== 'punctuator' || token.value !== ':') {
  1251. // throw invalidToken()
  1252. // }
  1253. if (token.type === 'eof') {
  1254. throw invalidEOF()
  1255. }
  1256. parseState = 'beforePropertyValue';
  1257. },
  1258. beforePropertyValue: function beforePropertyValue () {
  1259. if (token.type === 'eof') {
  1260. throw invalidEOF()
  1261. }
  1262. push();
  1263. },
  1264. beforeArrayValue: function beforeArrayValue () {
  1265. if (token.type === 'eof') {
  1266. throw invalidEOF()
  1267. }
  1268. if (token.type === 'punctuator' && token.value === ']') {
  1269. pop();
  1270. return
  1271. }
  1272. push();
  1273. },
  1274. afterPropertyValue: function afterPropertyValue () {
  1275. // This code is unreachable since it's handled by the lexState.
  1276. // if (token.type !== 'punctuator') {
  1277. // throw invalidToken()
  1278. // }
  1279. if (token.type === 'eof') {
  1280. throw invalidEOF()
  1281. }
  1282. switch (token.value) {
  1283. case ',':
  1284. parseState = 'beforePropertyName';
  1285. return
  1286. case '}':
  1287. pop();
  1288. }
  1289. // This code is unreachable since it's handled by the lexState.
  1290. // throw invalidToken()
  1291. },
  1292. afterArrayValue: function afterArrayValue () {
  1293. // This code is unreachable since it's handled by the lexState.
  1294. // if (token.type !== 'punctuator') {
  1295. // throw invalidToken()
  1296. // }
  1297. if (token.type === 'eof') {
  1298. throw invalidEOF()
  1299. }
  1300. switch (token.value) {
  1301. case ',':
  1302. parseState = 'beforeArrayValue';
  1303. return
  1304. case ']':
  1305. pop();
  1306. }
  1307. // This code is unreachable since it's handled by the lexState.
  1308. // throw invalidToken()
  1309. },
  1310. end: function end () {
  1311. // This code is unreachable since it's handled by the lexState.
  1312. // if (token.type !== 'eof') {
  1313. // throw invalidToken()
  1314. // }
  1315. },
  1316. };
  1317. function push () {
  1318. var value;
  1319. switch (token.type) {
  1320. case 'punctuator':
  1321. switch (token.value) {
  1322. case '{':
  1323. value = {};
  1324. break
  1325. case '[':
  1326. value = [];
  1327. break
  1328. }
  1329. break
  1330. case 'null':
  1331. case 'boolean':
  1332. case 'numeric':
  1333. case 'string':
  1334. value = token.value;
  1335. break
  1336. // This code is unreachable.
  1337. // default:
  1338. // throw invalidToken()
  1339. }
  1340. if (root === undefined) {
  1341. root = value;
  1342. } else {
  1343. var parent = stack[stack.length - 1];
  1344. if (Array.isArray(parent)) {
  1345. parent.push(value);
  1346. } else {
  1347. parent[key] = value;
  1348. }
  1349. }
  1350. if (value !== null && typeof value === 'object') {
  1351. stack.push(value);
  1352. if (Array.isArray(value)) {
  1353. parseState = 'beforeArrayValue';
  1354. } else {
  1355. parseState = 'beforePropertyName';
  1356. }
  1357. } else {
  1358. var current = stack[stack.length - 1];
  1359. if (current == null) {
  1360. parseState = 'end';
  1361. } else if (Array.isArray(current)) {
  1362. parseState = 'afterArrayValue';
  1363. } else {
  1364. parseState = 'afterPropertyValue';
  1365. }
  1366. }
  1367. }
  1368. function pop () {
  1369. stack.pop();
  1370. var current = stack[stack.length - 1];
  1371. if (current == null) {
  1372. parseState = 'end';
  1373. } else if (Array.isArray(current)) {
  1374. parseState = 'afterArrayValue';
  1375. } else {
  1376. parseState = 'afterPropertyValue';
  1377. }
  1378. }
  1379. // This code is unreachable.
  1380. // function invalidParseState () {
  1381. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1382. // }
  1383. // This code is unreachable.
  1384. // function invalidLexState (state) {
  1385. // return new Error(`JSON5: invalid lex state '${state}'`)
  1386. // }
  1387. function invalidChar (c) {
  1388. if (c === undefined) {
  1389. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1390. }
  1391. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1392. }
  1393. function invalidEOF () {
  1394. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1395. }
  1396. // This code is unreachable.
  1397. // function invalidToken () {
  1398. // if (token.type === 'eof') {
  1399. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1400. // }
  1401. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1402. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1403. // }
  1404. function invalidIdentifier () {
  1405. column -= 5;
  1406. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1407. }
  1408. function separatorChar (c) {
  1409. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1410. }
  1411. function formatChar (c) {
  1412. var replacements = {
  1413. "'": "\\'",
  1414. '"': '\\"',
  1415. '\\': '\\\\',
  1416. '\b': '\\b',
  1417. '\f': '\\f',
  1418. '\n': '\\n',
  1419. '\r': '\\r',
  1420. '\t': '\\t',
  1421. '\v': '\\v',
  1422. '\0': '\\0',
  1423. '\u2028': '\\u2028',
  1424. '\u2029': '\\u2029',
  1425. };
  1426. if (replacements[c]) {
  1427. return replacements[c]
  1428. }
  1429. if (c < ' ') {
  1430. var hexString = c.charCodeAt(0).toString(16);
  1431. return '\\x' + ('00' + hexString).substring(hexString.length)
  1432. }
  1433. return c
  1434. }
  1435. function syntaxError (message) {
  1436. var err = new SyntaxError(message);
  1437. err.lineNumber = line;
  1438. err.columnNumber = column;
  1439. return err
  1440. }
  1441. var stringify = function stringify (value, replacer, space) {
  1442. var stack = [];
  1443. var indent = '';
  1444. var propertyList;
  1445. var replacerFunc;
  1446. var gap = '';
  1447. var quote;
  1448. if (
  1449. replacer != null &&
  1450. typeof replacer === 'object' &&
  1451. !Array.isArray(replacer)
  1452. ) {
  1453. space = replacer.space;
  1454. quote = replacer.quote;
  1455. replacer = replacer.replacer;
  1456. }
  1457. if (typeof replacer === 'function') {
  1458. replacerFunc = replacer;
  1459. } else if (Array.isArray(replacer)) {
  1460. propertyList = [];
  1461. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1462. var v = list[i];
  1463. var item = (void 0);
  1464. if (typeof v === 'string') {
  1465. item = v;
  1466. } else if (
  1467. typeof v === 'number' ||
  1468. v instanceof String ||
  1469. v instanceof Number
  1470. ) {
  1471. item = String(v);
  1472. }
  1473. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1474. propertyList.push(item);
  1475. }
  1476. }
  1477. }
  1478. if (space instanceof Number) {
  1479. space = Number(space);
  1480. } else if (space instanceof String) {
  1481. space = String(space);
  1482. }
  1483. if (typeof space === 'number') {
  1484. if (space > 0) {
  1485. space = Math.min(10, Math.floor(space));
  1486. gap = ' '.substr(0, space);
  1487. }
  1488. } else if (typeof space === 'string') {
  1489. gap = space.substr(0, 10);
  1490. }
  1491. return serializeProperty('', {'': value})
  1492. function serializeProperty (key, holder) {
  1493. var value = holder[key];
  1494. if (value != null) {
  1495. if (typeof value.toJSON5 === 'function') {
  1496. value = value.toJSON5(key);
  1497. } else if (typeof value.toJSON === 'function') {
  1498. value = value.toJSON(key);
  1499. }
  1500. }
  1501. if (replacerFunc) {
  1502. value = replacerFunc.call(holder, key, value);
  1503. }
  1504. if (value instanceof Number) {
  1505. value = Number(value);
  1506. } else if (value instanceof String) {
  1507. value = String(value);
  1508. } else if (value instanceof Boolean) {
  1509. value = value.valueOf();
  1510. }
  1511. switch (value) {
  1512. case null: return 'null'
  1513. case true: return 'true'
  1514. case false: return 'false'
  1515. }
  1516. if (typeof value === 'string') {
  1517. return quoteString(value)
  1518. }
  1519. if (typeof value === 'number') {
  1520. return String(value)
  1521. }
  1522. if (typeof value === 'object') {
  1523. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1524. }
  1525. return undefined
  1526. }
  1527. function quoteString (value) {
  1528. var quotes = {
  1529. "'": 0.1,
  1530. '"': 0.2,
  1531. };
  1532. var replacements = {
  1533. "'": "\\'",
  1534. '"': '\\"',
  1535. '\\': '\\\\',
  1536. '\b': '\\b',
  1537. '\f': '\\f',
  1538. '\n': '\\n',
  1539. '\r': '\\r',
  1540. '\t': '\\t',
  1541. '\v': '\\v',
  1542. '\0': '\\0',
  1543. '\u2028': '\\u2028',
  1544. '\u2029': '\\u2029',
  1545. };
  1546. var product = '';
  1547. for (var i = 0; i < value.length; i++) {
  1548. var c = value[i];
  1549. switch (c) {
  1550. case "'":
  1551. case '"':
  1552. quotes[c]++;
  1553. product += c;
  1554. continue
  1555. case '\0':
  1556. if (util.isDigit(value[i + 1])) {
  1557. product += '\\x00';
  1558. continue
  1559. }
  1560. }
  1561. if (replacements[c]) {
  1562. product += replacements[c];
  1563. continue
  1564. }
  1565. if (c < ' ') {
  1566. var hexString = c.charCodeAt(0).toString(16);
  1567. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1568. continue
  1569. }
  1570. product += c;
  1571. }
  1572. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1573. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1574. return quoteChar + product + quoteChar
  1575. }
  1576. function serializeObject (value) {
  1577. if (stack.indexOf(value) >= 0) {
  1578. throw TypeError('Converting circular structure to JSON5')
  1579. }
  1580. stack.push(value);
  1581. var stepback = indent;
  1582. indent = indent + gap;
  1583. var keys = propertyList || Object.keys(value);
  1584. var partial = [];
  1585. for (var i = 0, list = keys; i < list.length; i += 1) {
  1586. var key = list[i];
  1587. var propertyString = serializeProperty(key, value);
  1588. if (propertyString !== undefined) {
  1589. var member = serializeKey(key) + ':';
  1590. if (gap !== '') {
  1591. member += ' ';
  1592. }
  1593. member += propertyString;
  1594. partial.push(member);
  1595. }
  1596. }
  1597. var final;
  1598. if (partial.length === 0) {
  1599. final = '{}';
  1600. } else {
  1601. var properties;
  1602. if (gap === '') {
  1603. properties = partial.join(',');
  1604. final = '{' + properties + '}';
  1605. } else {
  1606. var separator = ',\n' + indent;
  1607. properties = partial.join(separator);
  1608. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1609. }
  1610. }
  1611. stack.pop();
  1612. indent = stepback;
  1613. return final
  1614. }
  1615. function serializeKey (key) {
  1616. if (key.length === 0) {
  1617. return quoteString(key)
  1618. }
  1619. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1620. if (!util.isIdStartChar(firstChar)) {
  1621. return quoteString(key)
  1622. }
  1623. for (var i = firstChar.length; i < key.length; i++) {
  1624. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1625. return quoteString(key)
  1626. }
  1627. }
  1628. return key
  1629. }
  1630. function serializeArray (value) {
  1631. if (stack.indexOf(value) >= 0) {
  1632. throw TypeError('Converting circular structure to JSON5')
  1633. }
  1634. stack.push(value);
  1635. var stepback = indent;
  1636. indent = indent + gap;
  1637. var partial = [];
  1638. for (var i = 0; i < value.length; i++) {
  1639. var propertyString = serializeProperty(String(i), value);
  1640. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1641. }
  1642. var final;
  1643. if (partial.length === 0) {
  1644. final = '[]';
  1645. } else {
  1646. if (gap === '') {
  1647. var properties = partial.join(',');
  1648. final = '[' + properties + ']';
  1649. } else {
  1650. var separator = ',\n' + indent;
  1651. var properties$1 = partial.join(separator);
  1652. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1653. }
  1654. }
  1655. stack.pop();
  1656. indent = stepback;
  1657. return final
  1658. }
  1659. };
  1660. var JSON5 = {
  1661. parse: parse,
  1662. stringify: stringify,
  1663. };
  1664. var lib = JSON5;
  1665. var es5 = lib;
  1666. return es5;
  1667. })));
  1668. });
  1669. /*! *****************************************************************************
  1670. Copyright (c) Microsoft Corporation.
  1671. Permission to use, copy, modify, and/or distribute this software for any
  1672. purpose with or without fee is hereby granted.
  1673. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1674. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1675. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1676. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1677. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1678. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1679. PERFORMANCE OF THIS SOFTWARE.
  1680. ***************************************************************************** */
  1681. /* global Reflect, Promise */
  1682. var extendStatics = function(d, b) {
  1683. extendStatics = Object.setPrototypeOf ||
  1684. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1685. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1686. return extendStatics(d, b);
  1687. };
  1688. function __extends(d, b) {
  1689. extendStatics(d, b);
  1690. function __() { this.constructor = d; }
  1691. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1692. }
  1693. var __assign = function() {
  1694. __assign = Object.assign || function __assign(t) {
  1695. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1696. s = arguments[i];
  1697. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1698. }
  1699. return t;
  1700. };
  1701. return __assign.apply(this, arguments);
  1702. };
  1703. function __decorate(decorators, target, key, desc) {
  1704. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1705. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1706. 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;
  1707. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1708. }
  1709. function __param(paramIndex, decorator) {
  1710. return function (target, key) { decorator(target, key, paramIndex); }
  1711. }
  1712. function __metadata(metadataKey, metadataValue) {
  1713. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1714. }
  1715. function __values(o) {
  1716. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1717. if (m) return m.call(o);
  1718. if (o && typeof o.length === "number") return {
  1719. next: function () {
  1720. if (o && i >= o.length) o = void 0;
  1721. return { value: o && o[i++], done: !o };
  1722. }
  1723. };
  1724. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1725. }
  1726. function __read(o, n) {
  1727. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1728. if (!m) return o;
  1729. var i = m.call(o), r, ar = [], e;
  1730. try {
  1731. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1732. }
  1733. catch (error) { e = { error: error }; }
  1734. finally {
  1735. try {
  1736. if (r && !r.done && (m = i["return"])) m.call(i);
  1737. }
  1738. finally { if (e) throw e.error; }
  1739. }
  1740. return ar;
  1741. }
  1742. function __spread() {
  1743. for (var ar = [], i = 0; i < arguments.length; i++)
  1744. ar = ar.concat(__read(arguments[i]));
  1745. return ar;
  1746. }
  1747. var PropertyDescription = /** @class */ (function () {
  1748. function PropertyDescription() {
  1749. var _this = this;
  1750. var args = [];
  1751. for (var _i = 0; _i < arguments.length; _i++) {
  1752. args[_i] = arguments[_i];
  1753. }
  1754. this.propertyes = {
  1755. props: [],
  1756. events: []
  1757. };
  1758. _$2.each(args, function (arg) {
  1759. _this.merge(arg);
  1760. });
  1761. }
  1762. PropertyDescription.prototype.merge = function (pd) {
  1763. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1764. if (pd.events) {
  1765. if (this.propertyes.events) {
  1766. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1767. }
  1768. else {
  1769. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1770. }
  1771. }
  1772. };
  1773. /**
  1774. * 根据分组名 获取属性定义
  1775. */
  1776. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1777. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1778. };
  1779. /**
  1780. * 获取全部事件
  1781. */
  1782. PropertyDescription.prototype.getEvents = function () {
  1783. return this.propertyes.events;
  1784. };
  1785. return PropertyDescription;
  1786. }());
  1787. //# sourceMappingURL=PropertyDescription.js.map
  1788. var PropertyDescriptionTable = new Map();
  1789. var width = {
  1790. name: 'width',
  1791. default: '',
  1792. group: 'common',
  1793. desc: '宽',
  1794. type: 'string'
  1795. };
  1796. var height = {
  1797. name: 'height',
  1798. default: '',
  1799. group: 'common',
  1800. desc: '高',
  1801. type: 'string'
  1802. };
  1803. var fieldLabel = {
  1804. name: 'fieldLabel',
  1805. default: '',
  1806. group: 'common',
  1807. desc: '文本描述',
  1808. type: 'string',
  1809. expr: true,
  1810. };
  1811. var text$1 = {
  1812. name: 'text',
  1813. default: '',
  1814. group: 'common',
  1815. desc: '文本描述',
  1816. type: 'string',
  1817. expr: true,
  1818. };
  1819. var iconCls = {
  1820. name: 'iconCls',
  1821. default: '',
  1822. group: 'common',
  1823. desc: '图标',
  1824. type: 'string',
  1825. expr: true,
  1826. };
  1827. var disabled = {
  1828. name: 'disabled',
  1829. default: false,
  1830. group: 'common',
  1831. desc: '禁用',
  1832. type: 'boolean',
  1833. expr: true,
  1834. };
  1835. var value = {
  1836. name: 'value',
  1837. default: '',
  1838. group: 'common',
  1839. desc: '字段值',
  1840. type: 'string',
  1841. expr: true,
  1842. };
  1843. var template = {
  1844. name: 'template',
  1845. default: '',
  1846. group: 'common',
  1847. desc: 'HTML内容',
  1848. type: 'string',
  1849. expr: true,
  1850. };
  1851. var reference = {
  1852. name: 'reference',
  1853. default: '',
  1854. group: 'common',
  1855. desc: '组件句柄',
  1856. type: 'string',
  1857. expr: true,
  1858. };
  1859. var tooltip = {
  1860. name: 'tooltip',
  1861. default: '',
  1862. group: 'common',
  1863. desc: '悬停提示',
  1864. type: 'string'
  1865. };
  1866. // =============事件 ==============
  1867. var click = {
  1868. name: 'click',
  1869. default: '',
  1870. group: 'listeners',
  1871. desc: '点击事件',
  1872. eventParamter: [
  1873. 'sender',
  1874. 'e: any'
  1875. ],
  1876. type: 'listeners'
  1877. };
  1878. var change = {
  1879. name: 'change',
  1880. default: '',
  1881. group: 'listeners',
  1882. desc: 'value change事件',
  1883. eventParamter: [
  1884. 'sender',
  1885. 'e: any'
  1886. ],
  1887. type: 'listeners'
  1888. };
  1889. var keyup = {
  1890. name: 'keyup',
  1891. default: '',
  1892. group: 'listeners',
  1893. desc: '键盘按键抬起事件',
  1894. eventParamter: [
  1895. 'sender',
  1896. 'e'
  1897. ],
  1898. type: 'listeners'
  1899. };
  1900. var afterrender = {
  1901. name: 'afterrender',
  1902. default: '',
  1903. group: 'listeners',
  1904. desc: '控件渲染后触发',
  1905. eventParamter: [
  1906. 'sender',
  1907. 'e'
  1908. ],
  1909. type: 'listeners'
  1910. };
  1911. // =============特性 ==============
  1912. var fix = {
  1913. name: 'fix',
  1914. default: '',
  1915. group: 'fix',
  1916. desc: '特性',
  1917. type: 'fix',
  1918. expr: true,
  1919. };
  1920. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1921. props: [
  1922. height
  1923. ]
  1924. }));
  1925. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1926. props: [
  1927. {
  1928. name: 'borderless',
  1929. default: true,
  1930. group: 'css',
  1931. desc: '有无边框',
  1932. type: 'boolean'
  1933. },
  1934. {
  1935. name: 'type',
  1936. default: '',
  1937. group: 'css',
  1938. desc: '布局类型',
  1939. type: ['line', 'clean', 'wide', 'space', 'form']
  1940. },
  1941. {
  1942. name: '_designMode',
  1943. default: 'module',
  1944. group: 'common',
  1945. desc: '设计类型',
  1946. type: ['none', 'module', 'scroll-module']
  1947. }
  1948. ]
  1949. }));
  1950. var YvBase = {
  1951. props: [
  1952. width, height, reference, afterrender, fix
  1953. ],
  1954. events: [
  1955. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1956. ]
  1957. };
  1958. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1959. props: [
  1960. template
  1961. ]
  1962. }));
  1963. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1964. props: [
  1965. {
  1966. name: 'label',
  1967. default: '',
  1968. group: 'common',
  1969. desc: '字段组标题',
  1970. type: 'string'
  1971. }
  1972. ]
  1973. }));
  1974. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1975. props: [
  1976. {
  1977. name: 'src',
  1978. default: '',
  1979. group: 'common',
  1980. desc: '地址路径',
  1981. type: 'string'
  1982. }
  1983. ]
  1984. }));
  1985. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1986. props: [
  1987. width, height,
  1988. {
  1989. name: 'value',
  1990. default: '上传',
  1991. group: 'common',
  1992. desc: '文本描述',
  1993. type: 'string'
  1994. },
  1995. {
  1996. name: 'upload',
  1997. default: '/upload',
  1998. group: 'common',
  1999. desc: '上传地址',
  2000. type: 'string'
  2001. },
  2002. ],
  2003. events: [
  2004. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2005. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2006. ]
  2007. }));
  2008. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2009. props: [
  2010. value,
  2011. {
  2012. name: 'imgWidth',
  2013. default: '',
  2014. group: 'common',
  2015. desc: '图片宽',
  2016. type: 'string'
  2017. },
  2018. {
  2019. name: 'imgHeight',
  2020. default: '',
  2021. group: 'common',
  2022. desc: '图片高',
  2023. type: 'string'
  2024. }
  2025. ]
  2026. }));
  2027. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2028. props: [
  2029. value,
  2030. {
  2031. name: 'imgWidth',
  2032. default: '',
  2033. group: 'common',
  2034. desc: '图片宽',
  2035. type: 'string'
  2036. },
  2037. {
  2038. name: 'imgHeight',
  2039. default: '',
  2040. group: 'common',
  2041. desc: '图片高',
  2042. type: 'string'
  2043. }
  2044. ]
  2045. }));
  2046. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2047. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2048. }));
  2049. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2050. props: [
  2051. fieldLabel, value, disabled,
  2052. tooltip, width, height
  2053. ],
  2054. }));
  2055. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2056. props: [
  2057. fieldLabel, value, disabled,
  2058. tooltip, width, height, keyup, afterrender, change
  2059. ],
  2060. }));
  2061. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2062. props: [
  2063. fieldLabel, value, disabled,
  2064. tooltip, width, height, keyup, afterrender, change
  2065. ],
  2066. }));
  2067. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2068. props: [
  2069. fieldLabel, value, disabled,
  2070. tooltip, width, height, keyup, afterrender, change
  2071. ],
  2072. }));
  2073. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2074. props: [
  2075. fieldLabel, value, disabled,
  2076. tooltip, width, height, keyup, afterrender, change
  2077. ],
  2078. }));
  2079. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2080. props: [
  2081. fieldLabel, value, disabled,
  2082. tooltip, width, height, keyup, afterrender, change
  2083. ],
  2084. }));
  2085. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2086. props: [
  2087. fieldLabel, value, disabled,
  2088. tooltip, width, height, keyup, afterrender, change
  2089. ],
  2090. }));
  2091. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2092. props: [
  2093. fieldLabel, value, disabled,
  2094. tooltip, width, height, keyup, afterrender, change
  2095. ],
  2096. }));
  2097. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2098. props: [
  2099. fieldLabel, value, disabled,
  2100. tooltip, width, height, keyup, afterrender, change
  2101. ],
  2102. }));
  2103. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2104. props: [
  2105. fieldLabel, value, disabled,
  2106. tooltip, width, height
  2107. ],
  2108. }));
  2109. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2110. props: [
  2111. fieldLabel, value, disabled,
  2112. tooltip, width, height, keyup, afterrender, change
  2113. ],
  2114. }));
  2115. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2116. props: [
  2117. fieldLabel, value, disabled,
  2118. tooltip, width, height, keyup, afterrender, change
  2119. ],
  2120. }));
  2121. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2122. props: [
  2123. fieldLabel, value, disabled,
  2124. tooltip, width, height, keyup, afterrender, change
  2125. ],
  2126. }));
  2127. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2128. props: [
  2129. fieldLabel, value, disabled,
  2130. tooltip, width, height, afterrender, change
  2131. ],
  2132. }));
  2133. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2134. /**
  2135. * 弹出输入框,输入文字
  2136. * @param message 提示文字
  2137. * @param defaultValue 默认值
  2138. * @param multiLine 是否多行输入
  2139. */
  2140. function prompt$1(message, defaultValue, multiLine) {
  2141. if (defaultValue === void 0) { defaultValue = ""; }
  2142. if (multiLine === void 0) { multiLine = false; }
  2143. return new Promise(function (resolve) {
  2144. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2145. if (button === 'ok') {
  2146. resolve(value);
  2147. }
  2148. }, null, multiLine, defaultValue);
  2149. });
  2150. }
  2151. /**
  2152. * 显示错误异常信息
  2153. * @param msg 错误内容
  2154. * @param sender 发送者按钮(可以为空)
  2155. */
  2156. function showErrorDialog(msg, sender) {
  2157. console.error(msg);
  2158. Ext.MessageBox.show({
  2159. title: '错误',
  2160. msg: msg,
  2161. buttons: Ext.MessageBox.OK,
  2162. animateTarget: sender,
  2163. icon: 'error',
  2164. cls: 'show-icon-messagebox',
  2165. });
  2166. }
  2167. /**
  2168. * 显示错误异常信息
  2169. * @param msg 错误内容
  2170. * @param sender 发送者按钮(可以为空)
  2171. */
  2172. function showInfoDialogSimple(msg, sender) {
  2173. console.info(msg);
  2174. Ext.MessageBox.show({
  2175. title: '提示',
  2176. msg: msg,
  2177. buttons: Ext.MessageBox.OK,
  2178. animateTarget: sender,
  2179. icon: 'info',
  2180. cls: 'show-icon-messagebox',
  2181. });
  2182. }
  2183. function msgError(msg, sender) {
  2184. showErrorDialog(msg, sender);
  2185. }
  2186. /**
  2187. * 中间灰底白字提示
  2188. */
  2189. function msg(message) {
  2190. console.log(message);
  2191. var $body = $$2('body');
  2192. $body.find('[xtype=tooltip]').remove();
  2193. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2194. ' <div class="yvan-msg-content">' +
  2195. _$2.escape(message) +
  2196. '</div></div>');
  2197. $body.append($w);
  2198. var iframeWidth = $w.parent().width();
  2199. var iframeHeight = $w.parent().height();
  2200. var windowWidth = $w.width();
  2201. var windowHeight = $w.height();
  2202. var setWidth = (iframeWidth - windowWidth) / 2;
  2203. var setHeight = (iframeHeight - windowHeight) / 2;
  2204. if (iframeHeight < windowHeight || setHeight < 0) {
  2205. setHeight = 0;
  2206. }
  2207. if (iframeWidth < windowWidth || setWidth < 0) {
  2208. setWidth = 0;
  2209. }
  2210. $w.css({ left: setWidth, top: setHeight });
  2211. setTimeout(function () {
  2212. $w.remove();
  2213. }, 3000);
  2214. }
  2215. //# sourceMappingURL=message.js.map
  2216. localforage.config({
  2217. name: "studio",
  2218. storeName: "item",
  2219. });
  2220. function getItem(key, callback) {
  2221. localforage.getItem(key).then(function (value) {
  2222. if (callback) {
  2223. callback(value);
  2224. }
  2225. });
  2226. }
  2227. function setItem(key, value, callback) {
  2228. localforage.setItem(key, value).then(function (val) {
  2229. if (callback) {
  2230. callback();
  2231. }
  2232. });
  2233. }
  2234. var native = {
  2235. /**
  2236. * 读取文件
  2237. */
  2238. loadFile: function (fileName, callback) {
  2239. console.log('loadFile', fileName);
  2240. getItem('NATIVE_' + fileName, callback);
  2241. },
  2242. /**
  2243. * 保存文件
  2244. */
  2245. saveFile: function (fileName, content) {
  2246. console.log('saveFile', fileName, content);
  2247. setItem('NATIVE_' + fileName, content);
  2248. },
  2249. openInIdea: function (path) {
  2250. msg(path);
  2251. },
  2252. /**
  2253. * 初始化 native 工具类
  2254. */
  2255. init: function () {
  2256. var ClipboardJS = window['ClipboardJS'];
  2257. if (!ClipboardJS) {
  2258. msg('没有引入 ClipboardJS');
  2259. return;
  2260. }
  2261. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2262. var clipboard = new ClipboardJS('.__btnClipboard');
  2263. },
  2264. /**
  2265. * 设置剪切板
  2266. */
  2267. clipboardSet: function (c) {
  2268. var $btn = $('.__btnClipboard');
  2269. $btn.attr('data-clipboard-text', c);
  2270. $btn.trigger("click");
  2271. },
  2272. };
  2273. /**
  2274. * 判断变量是否有值 value === null || value === undefined
  2275. * @param value 目标变量
  2276. */
  2277. var noValue = function (value) {
  2278. return value === null || value === undefined;
  2279. };
  2280. //# sourceMappingURL=Utils.js.map
  2281. function initStateTree () {
  2282. Ext.define('com.yvan.studio.StateTree', {
  2283. extend: 'Ext.tree.Panel',
  2284. _saveStateFlag: true,
  2285. _filterText: '',
  2286. fbar: [
  2287. {
  2288. xtype: 'textfield',
  2289. flex: 1,
  2290. emptyText: '搜索过滤',
  2291. enableKeyEvents: true,
  2292. listeners: {
  2293. change: function (sender) {
  2294. var tree = sender.up("treepanel");
  2295. tree.filterByText(this.getRawValue());
  2296. },
  2297. keyup: function (sender, e) {
  2298. var tree = sender.up("treepanel");
  2299. if (e.ESC === e.getKey()) {
  2300. sender.setValue('');
  2301. tree.filterByText('');
  2302. }
  2303. }
  2304. }
  2305. },
  2306. ],
  2307. getStateFilename: function () {
  2308. throw Error('没有实现这个函数');
  2309. },
  2310. initComponent: function () {
  2311. var me = this;
  2312. this.on({
  2313. afterrender: function () {
  2314. var _this = this;
  2315. // 回车后打开节点
  2316. $(me.el.dom).keydown(function (event) {
  2317. if (event.keyCode === 13) {
  2318. event.preventDefault();
  2319. _this.fireEvent('itemverify');
  2320. return;
  2321. }
  2322. });
  2323. },
  2324. afteritemexpand: {
  2325. fn: function (node, index, item, eOpts) {
  2326. this.saveState();
  2327. },
  2328. buffer: 100,
  2329. },
  2330. afteritemcollapse: {
  2331. fn: function (node, index, item, eOpts) {
  2332. this.saveState();
  2333. },
  2334. buffer: 100,
  2335. },
  2336. itemdblclick: function (sender, record) {
  2337. this.fireEvent('itemverify');
  2338. },
  2339. itemclick: {
  2340. fn: function (node, index, item, eOpts) {
  2341. this.saveState();
  2342. },
  2343. buffer: 100,
  2344. }
  2345. });
  2346. this.superclass.superclass.initComponent.apply(this, arguments);
  2347. },
  2348. restoreState: function () {
  2349. var _this = this;
  2350. native.loadFile(this.getStateFilename(), function (content) {
  2351. if (!content)
  2352. return;
  2353. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2354. _this._saveStateFlag = false;
  2355. if (_.isArray(expands)) {
  2356. _.forEach(expands, function (p) {
  2357. _this.expandPath(p);
  2358. });
  2359. }
  2360. if (_.isArray(selections) && selections[0]) {
  2361. try {
  2362. _this.selectPath(selections[0]);
  2363. }
  2364. catch (e) {
  2365. }
  2366. }
  2367. if (scrollPosition && scrollSize) {
  2368. var size = _this.scrollable.getSize();
  2369. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2370. try {
  2371. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2372. }
  2373. catch (e) {
  2374. }
  2375. }
  2376. }
  2377. setTimeout(function () {
  2378. _this._saveStateFlag = true;
  2379. }, 200);
  2380. });
  2381. },
  2382. saveState: function () {
  2383. if (!this._saveStateFlag) {
  2384. return;
  2385. }
  2386. if (this._filterText) {
  2387. // 有筛选,不保存展开状态
  2388. return;
  2389. }
  2390. var expands = [];
  2391. var selections = [];
  2392. var selection = this.getSelection();
  2393. _.forEach(selection, function (item) {
  2394. selections.push(item.getPath());
  2395. });
  2396. var data = this.getStore().data;
  2397. _.forEach(data.items, function (item) {
  2398. if (item.data.expanded === true) {
  2399. expands.push(item.getPath());
  2400. }
  2401. });
  2402. var scrollPosition = this.scrollable.position;
  2403. var scrollSize = this.scrollable.getSize();
  2404. native.saveFile(this.getStateFilename(), {
  2405. selections: selections,
  2406. expands: expands,
  2407. scrollPosition: scrollPosition,
  2408. scrollSize: scrollSize
  2409. });
  2410. },
  2411. filterByText: function (text) {
  2412. this._filterText = text;
  2413. this._filterBy(this, text, 'text');
  2414. },
  2415. _filterBy: _.debounce(function (me, text, by) {
  2416. var view = me.getView();
  2417. me.store.clearFilter();
  2418. if (!me._filterText) {
  2419. // 没有筛选内容,还原状态
  2420. var selections = me.getSelection();
  2421. var selectionPaths_1 = [];
  2422. _.forEach(me.getSelection(), function (item) {
  2423. selectionPaths_1.push(item.getPath());
  2424. });
  2425. me.collapseAll();
  2426. me.restoreState();
  2427. _.forEach(selectionPaths_1, function (path) {
  2428. me.expandPath(path);
  2429. });
  2430. me.setSelection(selections);
  2431. return;
  2432. }
  2433. // 递归查找所有需要可见的节点 id 数组
  2434. var nodesAndParents = [];
  2435. var expandPaths = [];
  2436. me.getRootNode().cascadeBy(function (tree, view) {
  2437. var currNode = this;
  2438. currNode.collapse();
  2439. if (currNode && currNode.data[by] &&
  2440. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2441. // 展开到匹配的路径
  2442. // me.expandPath(currNode.getPath());
  2443. expandPaths.push(currNode.getPath());
  2444. // 沿途父节点全部设定为可见
  2445. while (currNode.parentNode) {
  2446. nodesAndParents.push(currNode.id);
  2447. currNode = currNode.parentNode;
  2448. }
  2449. }
  2450. }, null, [me, view]);
  2451. me.store.filterBy(function (r) {
  2452. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2453. });
  2454. _.forEach(expandPaths, function (path) {
  2455. me.expandPath(path);
  2456. });
  2457. }, 1000),
  2458. });
  2459. }
  2460. //# sourceMappingURL=StateTree.js.map
  2461. function initDashboard () {
  2462. Ext.define('com.yvan.studio.Dashboard', {
  2463. extend: 'Ext.panel.Panel',
  2464. alias: 'widget.dashboard',
  2465. xtype: 'dashboard',
  2466. html: ''
  2467. });
  2468. }
  2469. //# sourceMappingURL=dashboard.js.map
  2470. var handles$1 = {
  2471. mainWindow: undefined,
  2472. fileTree: undefined,
  2473. dbTree: undefined,
  2474. viewoutlinetree: undefined,
  2475. statusbar: undefined,
  2476. dictTree: undefined,
  2477. property: undefined,
  2478. dbcode: undefined,
  2479. report: undefined,
  2480. widget: undefined,
  2481. whLayout: undefined,
  2482. };
  2483. window['handles'] = handles$1;
  2484. function setDictTree(value) {
  2485. handles$1.dictTree = value;
  2486. }
  2487. function setMainWindow(value) {
  2488. handles$1.mainWindow = value;
  2489. }
  2490. function setReport(value) {
  2491. handles$1.report = value;
  2492. }
  2493. function setStatusbar(statusbar) {
  2494. handles$1.statusbar = statusbar;
  2495. }
  2496. function setFileTree(value) {
  2497. handles$1.fileTree = value;
  2498. }
  2499. function setDbTree(value) {
  2500. handles$1.dbTree = value;
  2501. }
  2502. function setWidget(value) {
  2503. handles$1.widget = value;
  2504. }
  2505. function setWhLayout(value) {
  2506. handles$1.whLayout = value;
  2507. }
  2508. function setViewoutlinetree(value) {
  2509. handles$1.viewoutlinetree = value;
  2510. }
  2511. function setPropertyPanel(value) {
  2512. handles$1.property = value;
  2513. }
  2514. function setDbCode(value) {
  2515. handles$1.dbcode = value;
  2516. }
  2517. //# sourceMappingURL=Handles.js.map
  2518. /**
  2519. * 获取当前打开的项目资料
  2520. */
  2521. function getCurrentProject() {
  2522. // const value = sessionStorage.getItem('CurrentProject');
  2523. // if (value) {
  2524. // project = JSON.parse(value)
  2525. // if (!project.url) {
  2526. // project = undefined
  2527. // }
  2528. // }
  2529. // return project
  2530. return {
  2531. uuid: '00000000',
  2532. name: '本服项目',
  2533. url: '',
  2534. };
  2535. }
  2536. /**
  2537. * 设置当前打开的项目资料(全局)
  2538. */
  2539. function setCurrentProject(value) {
  2540. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  2541. }
  2542. //# sourceMappingURL=Project.js.map
  2543. var CacheStore = /** @class */ (function () {
  2544. function CacheStore() {
  2545. // 订阅
  2546. this.subscribeList = [];
  2547. this.apiResponse = undefined;
  2548. }
  2549. /**
  2550. * 订阅结果集
  2551. */
  2552. CacheStore.prototype.registe = function (fn) {
  2553. this.subscribeList.push(fn);
  2554. };
  2555. /**
  2556. * 取消订阅
  2557. */
  2558. CacheStore.prototype.unregiste = function (fn) {
  2559. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  2560. };
  2561. /**
  2562. * 尝试取数据(先读缓存)
  2563. */
  2564. CacheStore.prototype.reloadIfNeed = function (param) {
  2565. var _this = this;
  2566. if (typeof this.apiResponse === 'undefined') {
  2567. // 从未有获取过值
  2568. var cacheKey = this.getCacheKey(param);
  2569. if (cacheKey) {
  2570. // 可以从缓存读
  2571. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2572. native.loadFile(fileName, function (res) {
  2573. if (res) {
  2574. // 缓存有值
  2575. _this.apiResponse = res;
  2576. _this.notifyRefresh();
  2577. }
  2578. else {
  2579. // 缓存没值
  2580. _this.reloadForce(param).then(function (res) {
  2581. });
  2582. }
  2583. });
  2584. }
  2585. else {
  2586. // 不能从缓存读
  2587. this.reloadForce(param).then(function (res) {
  2588. });
  2589. }
  2590. return true;
  2591. }
  2592. return false;
  2593. };
  2594. /**
  2595. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  2596. */
  2597. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  2598. var _this = this;
  2599. return new Promise(function (resolve, reject) {
  2600. if (typeof _this.apiResponse === 'undefined') {
  2601. // 从未有获取过值
  2602. var cacheKey = _this.getCacheKey(param);
  2603. if (cacheKey) {
  2604. // 可以从缓存读
  2605. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2606. native.loadFile(fileName, function (res) {
  2607. if (res) {
  2608. // 缓存有值
  2609. _this.apiResponse = res;
  2610. _this.notifyRefresh();
  2611. resolve(_this.apiResponse);
  2612. }
  2613. else {
  2614. // 缓存没值
  2615. _this.reloadForce(param).then(function (res) {
  2616. resolve(_this.apiResponse);
  2617. });
  2618. }
  2619. });
  2620. }
  2621. else {
  2622. // 不能从缓存读
  2623. _this.reloadForce(param).then(function (res) {
  2624. resolve(_this.apiResponse);
  2625. });
  2626. }
  2627. }
  2628. else {
  2629. // 有值,获取过
  2630. resolve(_this.apiResponse);
  2631. }
  2632. });
  2633. };
  2634. /**
  2635. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  2636. */
  2637. CacheStore.prototype.reloadForce = function (param) {
  2638. var _this = this;
  2639. _$2.forEach(this.subscribeList, function (fn) {
  2640. fn(true);
  2641. });
  2642. return this.invokeApi(param)
  2643. .then(function (res) {
  2644. _this.apiResponse = res;
  2645. var cacheKey = _this.getCacheKey(param);
  2646. if (cacheKey) {
  2647. // 可以保存到缓存
  2648. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  2649. native.saveFile(fileName, res);
  2650. }
  2651. // 通知订阅者刷新
  2652. _this.notifyRefresh();
  2653. })
  2654. .finally(function () {
  2655. _$2.forEach(_this.subscribeList, function (fn) {
  2656. fn(false);
  2657. });
  2658. });
  2659. };
  2660. /**
  2661. * 通知组件,isLoading状态被更改
  2662. */
  2663. CacheStore.prototype.notifyLoading = function (isLoading) {
  2664. var _this = this;
  2665. _$2.forEach(this.subscribeList, function (fn) {
  2666. fn(_this.apiResponse);
  2667. });
  2668. };
  2669. /**
  2670. * 通知数据更改,需要刷新
  2671. */
  2672. CacheStore.prototype.notifyRefresh = function () {
  2673. var _this = this;
  2674. _$2.forEach(this.subscribeList, function (fn) {
  2675. fn(_this.apiResponse);
  2676. });
  2677. };
  2678. return CacheStore;
  2679. }());
  2680. //# sourceMappingURL=CacheStore.js.map
  2681. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  2682. function createEmptyModule(path, filename) {
  2683. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  2684. }
  2685. function createFolder(parentPath, filename) {
  2686. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  2687. }
  2688. function getModuleFileContent(module) {
  2689. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  2690. }
  2691. function saveFile(fileFullPath, fileContent) {
  2692. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  2693. // @ts-ignore
  2694. system.msg("保存成功");
  2695. return res;
  2696. });
  2697. }
  2698. function getQueryDslInfo(tableName) {
  2699. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  2700. args: [
  2701. { tableName: tableName }
  2702. ]
  2703. }).catch(function (e) {
  2704. var _a, _b;
  2705. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  2706. showErrorDialog(msg);
  2707. console.error(msg, e);
  2708. });
  2709. }
  2710. function invokeServer(url, param) {
  2711. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  2712. return request.post(url, {
  2713. args: [
  2714. param
  2715. ]
  2716. }).catch(function (e) {
  2717. var _a, _b;
  2718. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  2719. showErrorDialog(msg);
  2720. console.error(msg, e);
  2721. });
  2722. }
  2723. function parseSqlApi(sql) {
  2724. return request.post(getBaseUrl() + "@parseSqlApi", {
  2725. args: [sql]
  2726. }).catch(function (e) {
  2727. var _a, _b;
  2728. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  2729. showErrorDialog(msg);
  2730. console.error(msg, e);
  2731. });
  2732. }
  2733. function saveModuleFiles(param) {
  2734. return request.post(getBaseUrl() + "@saveModuleFiles", {
  2735. args: [
  2736. param
  2737. ]
  2738. }).catch(function (e) {
  2739. var _a, _b;
  2740. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  2741. showErrorDialog(msg);
  2742. console.error(msg, e);
  2743. });
  2744. }
  2745. function createQueryDSLFile(_a) {
  2746. var schema_name = _a.schema_name, table_name = _a.table_name;
  2747. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  2748. args: [{ schema_name: schema_name, table_name: table_name }]
  2749. }).catch(function (e) {
  2750. var _a, _b;
  2751. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  2752. showErrorDialog(msg);
  2753. console.error(msg, e);
  2754. });
  2755. }
  2756. function dbToMeta(param) {
  2757. if (typeof param === 'undefined') {
  2758. param = { datasource: 'master' };
  2759. }
  2760. else if (typeof param.datasource === 'undefined') {
  2761. param.datasource = 'master';
  2762. }
  2763. return request.post(getBaseUrl() + "@dbToMeta", {
  2764. args: [
  2765. param
  2766. ]
  2767. }).catch(function (e) {
  2768. var _a, _b;
  2769. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  2770. showErrorDialog(msg);
  2771. console.error(msg, e);
  2772. });
  2773. }
  2774. function getColumnDomainApi(param) {
  2775. if (typeof param === 'undefined') {
  2776. param = { datasource: 'master' };
  2777. }
  2778. else if (typeof param.datasource === 'undefined') {
  2779. param.datasource = 'master';
  2780. }
  2781. return request.post(getBaseUrl() + "@getColumnDomain", {
  2782. args: [
  2783. param
  2784. ]
  2785. }).catch(function (e) {
  2786. var _a, _b;
  2787. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  2788. showErrorDialog(msg);
  2789. console.error(msg, e);
  2790. });
  2791. }
  2792. function getMateData(param) {
  2793. if (typeof param === 'undefined') {
  2794. param = { datasource: 'master' };
  2795. }
  2796. else if (typeof param.datasource === 'undefined') {
  2797. param.datasource = 'master';
  2798. }
  2799. return request.post(getBaseUrl() + "@getMateData", {
  2800. args: [
  2801. param
  2802. ]
  2803. }).catch(function (e) {
  2804. var _a, _b;
  2805. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  2806. showErrorDialog(msg);
  2807. console.error(msg, e);
  2808. });
  2809. }
  2810. function getMateDataByTableName(param) {
  2811. if (typeof param === 'undefined') {
  2812. param = { datasource: 'master' };
  2813. }
  2814. else if (typeof param.datasource === 'undefined') {
  2815. param.datasource = 'master';
  2816. }
  2817. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  2818. args: [
  2819. param
  2820. ]
  2821. }).catch(function (e) {
  2822. var _a, _b;
  2823. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  2824. showErrorDialog(msg);
  2825. console.error(msg, e);
  2826. });
  2827. }
  2828. function saveMetaTableChanges(param) {
  2829. if (typeof param === 'undefined') {
  2830. param = { datasource: 'master' };
  2831. }
  2832. else if (typeof param.datasource === 'undefined') {
  2833. param.datasource = 'master';
  2834. }
  2835. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  2836. args: [
  2837. param
  2838. ]
  2839. }).catch(function (e) {
  2840. var _a, _b;
  2841. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  2842. showErrorDialog(msg);
  2843. console.error(msg, e);
  2844. });
  2845. }
  2846. function getModifyTableDDL(param) {
  2847. if (typeof param === 'undefined') {
  2848. param = { datasource: 'master' };
  2849. }
  2850. else if (typeof param.datasource === 'undefined') {
  2851. param.datasource = 'master';
  2852. }
  2853. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  2854. args: [
  2855. param
  2856. ]
  2857. }).catch(function (e) {
  2858. var _a, _b;
  2859. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  2860. showErrorDialog(msg);
  2861. console.error(msg, e);
  2862. });
  2863. }
  2864. function pushToDbCommitApi(param) {
  2865. if (typeof param === 'undefined') {
  2866. param = { datasource: 'master' };
  2867. }
  2868. else if (typeof param.datasource === 'undefined') {
  2869. param.datasource = 'master';
  2870. }
  2871. return request.post(getBaseUrl() + "@pushToDbCommit", {
  2872. args: [
  2873. param
  2874. ]
  2875. }).catch(function (e) {
  2876. var _a, _b;
  2877. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  2878. showErrorDialog(msg);
  2879. console.error(msg, e);
  2880. });
  2881. }
  2882. /**
  2883. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  2884. */
  2885. function saveMetaExBuildDDL(param) {
  2886. if (typeof param === 'undefined') {
  2887. param = { datasource: 'master' };
  2888. }
  2889. else if (typeof param.datasource === 'undefined') {
  2890. param.datasource = 'master';
  2891. }
  2892. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  2893. args: [
  2894. param
  2895. ]
  2896. }).catch(function (e) {
  2897. var _a, _b;
  2898. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  2899. showErrorDialog(msg);
  2900. console.error(msg, e);
  2901. });
  2902. }
  2903. function registerResource(params) {
  2904. return request.post(getBaseUrl() + "@registerResource", {
  2905. args: [params]
  2906. }).catch(function (e) {
  2907. var _a, _b;
  2908. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  2909. showErrorDialog(msg);
  2910. console.error(msg, e);
  2911. });
  2912. }
  2913. function getMenuTree(params) {
  2914. return request.post(getBaseUrl() + "@getMenuTree", {
  2915. args: [params]
  2916. }).catch(function (e) {
  2917. var _a, _b;
  2918. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  2919. showErrorDialog(msg);
  2920. console.error(msg, e);
  2921. });
  2922. }
  2923. function moduleTree() {
  2924. return request.post(getBaseUrl() + "@moduleTree")
  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 dropTableDDL(schemaName, tableName) {
  2933. return request.post(getBaseUrl() + "@dropTableDDL", {
  2934. args: [
  2935. { schemaName: schemaName, tableName: tableName },
  2936. ]
  2937. }).catch(function (e) {
  2938. var _a, _b;
  2939. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  2940. showErrorDialog(msg);
  2941. console.error(msg, e);
  2942. });
  2943. }
  2944. function renameTableDDL(schemaName, tableName, reTableName) {
  2945. return request.post(getBaseUrl() + "@renameTableDDL", {
  2946. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  2947. }).catch(function (e) {
  2948. var _a, _b;
  2949. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  2950. showErrorDialog(msg);
  2951. console.error(msg, e);
  2952. });
  2953. }
  2954. function executeModifyProcedureSQL(param) {
  2955. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  2956. args: [
  2957. param,
  2958. ]
  2959. }).catch(function (e) {
  2960. var _a, _b;
  2961. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  2962. showErrorDialog(msg);
  2963. console.error(msg, e);
  2964. });
  2965. }
  2966. function parseDynamicSqlApi(sql, dataSource) {
  2967. return request.post(getBaseUrl() + "@parseDynamicSql", {
  2968. args: [
  2969. { sql: sql, dataSource: dataSource },
  2970. ]
  2971. }).catch(function (e) {
  2972. var _a, _b;
  2973. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  2974. showErrorDialog(msg);
  2975. console.error(msg, e);
  2976. });
  2977. }
  2978. function exporerList() {
  2979. return request.post(getBaseUrl() + "@exporerList", {
  2980. args: [{}]
  2981. }).catch(function (e) {
  2982. var _a, _b;
  2983. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  2984. showErrorDialog(msg);
  2985. console.error(msg, e);
  2986. });
  2987. }
  2988. function reportListApi() {
  2989. return request.post(getBaseUrl() + "@reportList", {
  2990. args: []
  2991. }).catch(function (e) {
  2992. var _a, _b;
  2993. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  2994. showErrorDialog(msg);
  2995. console.error(msg, e);
  2996. });
  2997. }
  2998. function reportByIdApi(reportId) {
  2999. return request.post(getBaseUrl() + "@reportById", {
  3000. args: [
  3001. { reportId: reportId },
  3002. ]
  3003. }).catch(function (e) {
  3004. var _a, _b;
  3005. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  3006. showErrorDialog(msg);
  3007. console.error(msg, e);
  3008. });
  3009. }
  3010. function createReportApi(reportName) {
  3011. return request.post(getBaseUrl() + "@createReport", {
  3012. args: [
  3013. { reportName: reportName },
  3014. ]
  3015. }).catch(function (e) {
  3016. var _a, _b;
  3017. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  3018. showErrorDialog(msg);
  3019. console.error(msg, e);
  3020. });
  3021. }
  3022. function saveReportApi(param) {
  3023. return request.post(getBaseUrl() + "@saveReport", {
  3024. args: [
  3025. param,
  3026. ]
  3027. }).catch(function (e) {
  3028. var _a, _b;
  3029. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  3030. showErrorDialog(msg);
  3031. console.error(msg, e);
  3032. });
  3033. }
  3034. function delReportApi(report_id) {
  3035. return request.post(getBaseUrl() + "@delReport", {
  3036. args: [{ report_id: report_id },]
  3037. }).catch(function (e) {
  3038. var _a, _b;
  3039. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  3040. showErrorDialog(msg);
  3041. console.error(msg, e);
  3042. });
  3043. }
  3044. function getDict(param) {
  3045. if (typeof param === 'undefined') {
  3046. param = { datasource: 'master' };
  3047. }
  3048. else if (typeof param.datasource === 'undefined') {
  3049. param.datasource = 'master';
  3050. }
  3051. return request.post(getBaseUrl() + "@getDict", {
  3052. args: [
  3053. param
  3054. ]
  3055. });
  3056. }
  3057. function saveDictApi(param) {
  3058. if (typeof param === 'undefined') {
  3059. param = { datasource: 'master' };
  3060. }
  3061. else if (typeof param.datasource === 'undefined') {
  3062. param.datasource = 'master';
  3063. }
  3064. return request.post(getBaseUrl() + "@saveDict", {
  3065. args: [
  3066. param
  3067. ]
  3068. }).catch(function (e) {
  3069. var _a, _b;
  3070. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  3071. showErrorDialog(msg);
  3072. console.error(msg, e);
  3073. });
  3074. }
  3075. function saveDictItemsApi(param) {
  3076. if (typeof param === 'undefined') {
  3077. param = { datasource: 'master' };
  3078. }
  3079. else if (typeof param.datasource === 'undefined') {
  3080. param.datasource = 'master';
  3081. }
  3082. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  3083. args: [
  3084. param
  3085. ]
  3086. }).catch(function (e) {
  3087. var _a, _b;
  3088. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  3089. showErrorDialog(msg);
  3090. console.error(msg, e);
  3091. });
  3092. }
  3093. function createDictEnum(param) {
  3094. return request.post(getBaseUrl() + "@createDictEnum", {
  3095. args: [
  3096. param
  3097. ]
  3098. }).catch(function (e) {
  3099. var _a, _b;
  3100. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  3101. showErrorDialog(msg);
  3102. console.error(msg, e);
  3103. });
  3104. }
  3105. function loadSqlContentApi(url) {
  3106. return request.post(getBaseUrl() + "@loadSqlContent", {
  3107. args: [
  3108. {
  3109. url: GLOBAL_NAMESPACE_PREFIX + url,
  3110. }
  3111. ]
  3112. }).catch(function (e) {
  3113. var _a, _b;
  3114. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  3115. showErrorDialog(msg);
  3116. console.error(msg, e);
  3117. });
  3118. }
  3119. function saveSqlContentApi(url, content) {
  3120. return request.post(getBaseUrl() + "@saveSqlContent", {
  3121. args: [
  3122. {
  3123. url: GLOBAL_NAMESPACE_PREFIX + url,
  3124. content: content,
  3125. }
  3126. ]
  3127. }).catch(function (e) {
  3128. var _a, _b;
  3129. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  3130. showErrorDialog(msg);
  3131. console.error(msg, e);
  3132. });
  3133. }
  3134. function readBpmn(param) {
  3135. return request.post(getBaseUrl() + "@readBpmn", {
  3136. args: [param]
  3137. }).catch(function (e) {
  3138. var _a, _b;
  3139. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3140. showErrorDialog(msg);
  3141. console.error(msg, e);
  3142. });
  3143. }
  3144. function createBpmn(path, filename) {
  3145. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3146. var _a, _b;
  3147. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  3148. showErrorDialog(msg);
  3149. console.error(msg, e);
  3150. });
  3151. }
  3152. function saveBpmn(fileFullPath, fileContent) {
  3153. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  3154. // @ts-ignore
  3155. system.msg("保存成功");
  3156. return res;
  3157. });
  3158. }
  3159. function deleteBpmn(path, filename) {
  3160. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3161. var _a, _b;
  3162. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  3163. showErrorDialog(msg);
  3164. console.error(msg, e);
  3165. });
  3166. }
  3167. function createDevForm(param) {
  3168. return request.post(getBaseUrl() + "@createDevForm", {
  3169. args: [param]
  3170. }).catch(function (e) {
  3171. var _a, _b;
  3172. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3173. showErrorDialog(msg);
  3174. console.error(msg, e);
  3175. });
  3176. }
  3177. function readDevForm(param) {
  3178. return request.post(getBaseUrl() + "@readDevForm", {
  3179. args: [param]
  3180. }).catch(function (e) {
  3181. var _a, _b;
  3182. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3183. showErrorDialog(msg);
  3184. console.error(msg, e);
  3185. });
  3186. }
  3187. function calcColumnForm(param) {
  3188. return request.post(getBaseUrl() + "@calcColumnForm", {
  3189. args: [param]
  3190. }).catch(function (e) {
  3191. var _a, _b;
  3192. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  3193. showErrorDialog(msg);
  3194. console.error(msg, e);
  3195. });
  3196. }
  3197. function widgetListApi(param) {
  3198. return request.post(getBaseUrl() + "@widgetListApi", {
  3199. args: [param]
  3200. }).catch(function (e) {
  3201. var _a, _b;
  3202. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  3203. showErrorDialog(msg);
  3204. console.error(msg, e);
  3205. });
  3206. }
  3207. function readWidget(param) {
  3208. return request.post(getBaseUrl() + "@readWidget", {
  3209. args: [param]
  3210. }).catch(function (e) {
  3211. var _a, _b;
  3212. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3213. showErrorDialog(msg);
  3214. console.error(msg, e);
  3215. });
  3216. }
  3217. function saveWidget(param) {
  3218. return request.post(getBaseUrl() + "@saveWidget", {
  3219. args: [param]
  3220. }).catch(function (e) {
  3221. var _a, _b;
  3222. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  3223. showErrorDialog(msg);
  3224. console.error(msg, e);
  3225. });
  3226. }
  3227. function deleteWidget(param) {
  3228. return request.post(getBaseUrl() + "@deleteWidget", {
  3229. args: [param]
  3230. }).catch(function (e) {
  3231. var _a, _b;
  3232. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  3233. showErrorDialog(msg);
  3234. console.error(msg, e);
  3235. });
  3236. }
  3237. function getDataBaseNameApi() {
  3238. return request.post(getBaseUrl() + "@getDataBaseName", {
  3239. args: []
  3240. }).catch(function (e) {
  3241. var _a, _b;
  3242. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3243. showErrorDialog(msg);
  3244. console.error(msg, e);
  3245. });
  3246. }
  3247. function getDiffDDLApi(param) {
  3248. return request.post(getBaseUrl() + "@getDiffDDL", {
  3249. args: [
  3250. param
  3251. ]
  3252. }).catch(function (e) {
  3253. var _a, _b;
  3254. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  3255. showErrorDialog(msg);
  3256. console.error(msg, e);
  3257. });
  3258. }
  3259. function dataSyncApi(param) {
  3260. return request.post(getBaseUrl() + "@dataSync", {
  3261. args: [
  3262. param
  3263. ]
  3264. }).catch(function (e) {
  3265. var _a, _b;
  3266. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  3267. showErrorDialog(msg);
  3268. console.error(msg, e);
  3269. });
  3270. }
  3271. function dataSyncInfoApi(param) {
  3272. return request.post(getBaseUrl() + "@dataSyncInfo", {
  3273. args: [
  3274. param
  3275. ]
  3276. }).catch(function (e) {
  3277. var _a, _b;
  3278. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  3279. showErrorDialog(msg);
  3280. console.error(msg, e);
  3281. });
  3282. }
  3283. function saveColumnDomain(param) {
  3284. if (typeof param === 'undefined') {
  3285. param = { datasource: 'master' };
  3286. }
  3287. else if (typeof param.datasource === 'undefined') {
  3288. param.datasource = 'master';
  3289. }
  3290. return request.post(getBaseUrl() + "@saveColumnDomain", {
  3291. args: [
  3292. param
  3293. ]
  3294. }).catch(function (e) {
  3295. var _a, _b;
  3296. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  3297. showErrorDialog('发生错误:' + msg);
  3298. console.error(msg, e);
  3299. });
  3300. }
  3301. function devOpsList() {
  3302. return request.post(getBaseUrl() + "@devOpsList", {
  3303. args: [{}]
  3304. }).catch(function (e) {
  3305. var _a, _b;
  3306. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  3307. showErrorDialog('发生错误:' + msg);
  3308. console.error(msg, e);
  3309. });
  3310. }
  3311. function devOpsById(opsId) {
  3312. return request.post(getBaseUrl() + "@devOpsById", {
  3313. args: [{ opsId: opsId }]
  3314. }).catch(function (e) {
  3315. var _a, _b;
  3316. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  3317. showErrorDialog('发生错误:' + msg);
  3318. console.error(msg, e);
  3319. });
  3320. }
  3321. function metricsRequestApi() {
  3322. return request.get("/api/metrics/request")
  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) || 'metricsRequestApi ERROR!';
  3326. showErrorDialog('发生错误:' + msg);
  3327. console.error(msg, e);
  3328. });
  3329. }
  3330. function metricsJdbcApi() {
  3331. return request.get("/api/metrics/jdbc")
  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) || 'metricsJdbcApi ERROR!';
  3335. showErrorDialog('发生错误:' + msg);
  3336. console.error(msg, e);
  3337. });
  3338. }
  3339. function executeDDL(param) {
  3340. return request.post(getBaseUrl() + "@executeDDL", {
  3341. args: [
  3342. param,
  3343. ]
  3344. }).catch(function (e) {
  3345. var _a, _b;
  3346. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  3347. showErrorDialog('发生错误:' + msg);
  3348. console.error(msg, e);
  3349. });
  3350. }
  3351. function getModifyIdxDDL(param) {
  3352. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  3353. args: [
  3354. param,
  3355. ]
  3356. }).catch(function (e) {
  3357. var _a, _b;
  3358. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  3359. showErrorDialog('发生错误:' + msg);
  3360. console.error(msg, e);
  3361. });
  3362. }
  3363. function getModifyProcedureSQL(param) {
  3364. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  3365. args: [
  3366. param,
  3367. ]
  3368. }).catch(function (e) {
  3369. var _a, _b;
  3370. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  3371. showErrorDialog('发生错误:' + msg);
  3372. console.error(msg, e);
  3373. });
  3374. }
  3375. function saveWhLayout(param) {
  3376. return request.post(getLayoutUrl() + "@saveWhLayout", {
  3377. args: [
  3378. param,
  3379. ]
  3380. }).catch(function (e) {
  3381. var _a, _b;
  3382. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  3383. showErrorDialog('发生错误:' + msg);
  3384. console.error(msg, e);
  3385. });
  3386. }
  3387. function deleteWhLayout(param) {
  3388. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  3389. args: [
  3390. param,
  3391. ]
  3392. }).catch(function (e) {
  3393. var _a, _b;
  3394. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  3395. showErrorDialog('发生错误:' + msg);
  3396. console.error(msg, e);
  3397. });
  3398. }
  3399. function loadWhLayoutAll() {
  3400. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  3401. args: []
  3402. }).catch(function (e) {
  3403. var _a, _b;
  3404. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  3405. showErrorDialog('发生错误:' + msg);
  3406. console.error(msg, e);
  3407. });
  3408. }
  3409. function loadWhLayout(param) {
  3410. return request.post(getLayoutUrl() + "@loadWhLayout", {
  3411. args: [
  3412. param,
  3413. ]
  3414. }).catch(function (e) {
  3415. var _a, _b;
  3416. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  3417. showErrorDialog('发生错误:' + msg);
  3418. console.error(msg, e);
  3419. });
  3420. }
  3421. var baseUrl = "/api/com/yvan/studio/FileManager";
  3422. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  3423. function getBaseUrl() {
  3424. // return getCurrentProject().url + baseUrl
  3425. return baseUrl;
  3426. }
  3427. function getLayoutUrl() {
  3428. // return getCurrentProject().url + baseUrl
  3429. return layoutUrl;
  3430. }
  3431. var Request = /** @class */ (function () {
  3432. function Request(axiosInstance) {
  3433. this.axiosInstance = axiosInstance;
  3434. }
  3435. // 全局响应数据转换处理
  3436. Request.transformResponse = function (response) {
  3437. var _a;
  3438. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  3439. };
  3440. Request.prototype.get = function (url, config) {
  3441. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  3442. };
  3443. Request.prototype.delete = function (url, config) {
  3444. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  3445. };
  3446. Request.prototype.head = function (url, config) {
  3447. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  3448. };
  3449. Request.prototype.options = function (url, config) {
  3450. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  3451. };
  3452. Request.prototype.post = function (url, data, config) {
  3453. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3454. };
  3455. Request.prototype.put = function (url, data, config) {
  3456. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3457. };
  3458. Request.prototype.patch = function (url, data, config) {
  3459. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3460. };
  3461. Request.prototype.request = function (config) {
  3462. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  3463. };
  3464. return Request;
  3465. }());
  3466. /** 创建一个axios实例对象 */
  3467. function axiosCreate(config) {
  3468. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  3469. }
  3470. var axiosInstance;
  3471. function init() {
  3472. axiosInstance = axiosCreate({
  3473. validateStatus: function (status) { return (status >= 200 && status < 400); },
  3474. });
  3475. request = new Request(axiosInstance);
  3476. }
  3477. var request;
  3478. //# sourceMappingURL=Api.js.map
  3479. // ------------------------------------------------------------------------------------------ types
  3480. /** 订阅消息key类型 */
  3481. var EventType;
  3482. (function (EventType) {
  3483. /** FileTree打开Module */
  3484. EventType["ModuleOpen"] = "ModuleOpen";
  3485. /** ModulePage 创建 */
  3486. EventType["ModulePageCreate"] = "ModulePageCreate";
  3487. /** ModuleItem内容变化 */
  3488. EventType["ModuleItemChange"] = "ModuleItemChange";
  3489. /** ModuleItem的 jsView 内容变化 */
  3490. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3491. /** 设置 vjson */
  3492. EventType["SetVjson"] = "SetVjson";
  3493. /** 更新 vjson */
  3494. EventType["UpdateVjson"] = "UpdateVjson";
  3495. /** 更新 组件vjson */
  3496. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3497. /** Component 选中内容变化 */
  3498. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3499. /** Component 选中内容变化 */
  3500. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3501. /** Component 删除事件 */
  3502. EventType["ComponentDelete"] = "ComponentDelete";
  3503. /** MainTab 选中改变事件 */
  3504. EventType["MainTabChange"] = "MainTabChange";
  3505. /** ModuleTab 选中改变事件 */
  3506. EventType["ModuleTabChange"] = "ModuleTabChange";
  3507. /** 保存事件 */
  3508. EventType["SaveCall"] = "SaveCall";
  3509. /** 撤销 */
  3510. EventType["Undo"] = "Undo";
  3511. /** 还原 */
  3512. EventType["Redo"] = "Redo";
  3513. /** 剪切 */
  3514. EventType["Cut"] = "Cut";
  3515. /** 复制 */
  3516. EventType["Copy"] = "Copy";
  3517. /** 粘贴 */
  3518. EventType["Paste"] = "Paste";
  3519. /** 全选 */
  3520. EventType["SelectAll"] = "SelectAll";
  3521. /** 读取剪切板 */
  3522. EventType["ClipboardRead"] = "ClipboardRead";
  3523. /** 检查模块更新 */
  3524. EventType["RunCheckModule"] = "RunCheckModule";
  3525. /** 停止检查模块更新 */
  3526. EventType["StopCheckModule"] = "StopCheckModule";
  3527. })(EventType || (EventType = {}));
  3528. // ------------------------------------------------------------------------------------------ impls
  3529. var EventBus = /** @class */ (function () {
  3530. function EventBus() {
  3531. /** 事件数据 */
  3532. this.store = {};
  3533. /** 事件订阅者注册表 */
  3534. this.observeStoreTable = {};
  3535. this.init();
  3536. }
  3537. EventBus.prototype.init = function () {
  3538. var _this = this;
  3539. // 更改store值就会自动publish消息 - 实现
  3540. this.store = new Proxy({}, {
  3541. get: function (target, key) {
  3542. return target[key];
  3543. },
  3544. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3545. set: function (target, key, data) {
  3546. if (noValue(key))
  3547. return false;
  3548. target[key] = data;
  3549. // 消息通知订阅者
  3550. var observerArr = _this.observeStoreTable[key];
  3551. if (noValue(observerArr) || observerArr.length <= 0)
  3552. return true;
  3553. observerArr.forEach(function (handler) {
  3554. //try {
  3555. handler(data, key);
  3556. // } catch (err) {
  3557. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3558. // }
  3559. });
  3560. return true;
  3561. },
  3562. });
  3563. };
  3564. /** 取消注册订阅者 */
  3565. EventBus.prototype.unregisterObserver = function (key, handler) {
  3566. var _this = this;
  3567. var observerArr = this.observeStoreTable[key];
  3568. if (noValue(observerArr) || observerArr.length <= 0)
  3569. return;
  3570. if (noValue(handler)) {
  3571. this.observeStoreTable[key] = [];
  3572. }
  3573. else {
  3574. observerArr.forEach(function (obsHandler, index) {
  3575. if (obsHandler !== handler)
  3576. return;
  3577. _this.observeStoreTable[key].splice(index, 1);
  3578. });
  3579. }
  3580. };
  3581. /** 注册订阅者 */
  3582. EventBus.prototype.registerObserver = function (key, handler) {
  3583. var observerArr = this.observeStoreTable[key];
  3584. if (noValue(observerArr) || observerArr.length <= 0) {
  3585. observerArr = [];
  3586. this.observeStoreTable[key] = observerArr;
  3587. }
  3588. observerArr.push(handler);
  3589. // if (noValue(key)) return;
  3590. // const sourceValue = this.store[key];
  3591. // if (noValue(sourceValue)) return;
  3592. // handler(sourceValue, key);
  3593. };
  3594. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3595. EventBus.prototype.getStore = function () {
  3596. return this.store;
  3597. };
  3598. /**
  3599. * 取消订阅
  3600. * @param key 订阅的消息key
  3601. * @param handler 指定取消的监听函数
  3602. */
  3603. EventBus.prototype.unsubscribe = function (key, handler) {
  3604. var _this = this;
  3605. if (key instanceof Array) {
  3606. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3607. }
  3608. else {
  3609. this.unregisterObserver(key, handler);
  3610. }
  3611. };
  3612. /**
  3613. * 消息订阅
  3614. * @param key 订阅的消息key
  3615. * @param handler 监听函数
  3616. */
  3617. EventBus.prototype.subscribe = function (key, handler) {
  3618. var _this = this;
  3619. var cancelSubscribe = {
  3620. key: key,
  3621. cancel: function () {
  3622. },
  3623. };
  3624. if (key instanceof Array) {
  3625. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3626. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3627. }
  3628. else {
  3629. this.registerObserver(key, handler);
  3630. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3631. }
  3632. return cancelSubscribe;
  3633. };
  3634. /**
  3635. * 消息订阅(只订阅一次)
  3636. * @param key 订阅的消息key
  3637. * @param handler 监听函数
  3638. */
  3639. EventBus.prototype.subscribeOnce = function (key, handler) {
  3640. var cancelSubscribe = this.subscribe(key, function (data) {
  3641. // try {
  3642. handler(data, key);
  3643. // } catch (err) {
  3644. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3645. // }
  3646. cancelSubscribe.cancel();
  3647. });
  3648. };
  3649. /**
  3650. * 发送消息(触发订阅监听函数)
  3651. * @param key 消息key
  3652. * @param eventData 消息值
  3653. */
  3654. EventBus.prototype.publish = function (key, eventData) {
  3655. var _this = this;
  3656. if (key instanceof Array) {
  3657. key.forEach(function (k) { return _this.store[k] = eventData; });
  3658. }
  3659. else {
  3660. this.store[key] = eventData;
  3661. }
  3662. };
  3663. return EventBus;
  3664. }());
  3665. // ------------------------------------------------------------------------------------------ use
  3666. var eventBus = new EventBus();
  3667. //# sourceMappingURL=EventBus.js.map
  3668. var idPrefix = "_ds_";
  3669. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  3670. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  3671. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  3672. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  3673. var layoutOrXtypeNameMap = {
  3674. fit: 'fit布局',
  3675. border: 'border布局',
  3676. center: '中部',
  3677. north: '上部',
  3678. south: '下部',
  3679. west: '左部',
  3680. east: '右部',
  3681. yvgrid: '表格',
  3682. tree: '树',
  3683. tabpanel: '标签页',
  3684. form: '表单',
  3685. fieldset: '字段组',
  3686. tbar: '顶部工具栏',
  3687. fbar: '底部工具栏',
  3688. toolbar: '工具栏',
  3689. cols: '列容器',
  3690. rows: '行容器',
  3691. textfield: '文本框',
  3692. textareafield: '长文本框',
  3693. numberfield: '数字框',
  3694. label: "文本",
  3695. combo: "下拉框",
  3696. combobox: "下拉框",
  3697. combotree: "下拉树",
  3698. combogrid: "下拉表",
  3699. datefield: "日期框",
  3700. searchfield: "搜索框",
  3701. button: "按钮",
  3702. checkbox: "勾选",
  3703. checkboxgroup: "勾选组",
  3704. radio: "点选",
  3705. radiogroup: "点选组",
  3706. container: "占位"
  3707. };
  3708. /**
  3709. * 从 VJSON 中找到 rows/cols 的数组
  3710. */
  3711. function findArrayContainer(vjson, id) {
  3712. var parentVJson = getSuperVjson(vjson, id);
  3713. if (_$2.isArray(parentVJson)) {
  3714. return parentVJson;
  3715. }
  3716. if (parentVJson.hasOwnProperty('items')) {
  3717. return parentVJson.items;
  3718. }
  3719. }
  3720. /**
  3721. * 根据id查找上级vjson
  3722. * @param vjson 原始 vjson 视图
  3723. * @param targetId 子元素的id
  3724. */
  3725. function getSuperVjson(vjson, targetId) {
  3726. return deepTravFindSuper(vjson, vjson, targetId);
  3727. }
  3728. /**
  3729. * 根据id查找上级vjson id
  3730. * @param vjson 原始 vjson 视图
  3731. * @param targetId 子元素的id
  3732. */
  3733. function getSuperVjsonId(vjson, targetId) {
  3734. var vj = getSuperVjson(vjson, targetId);
  3735. return vj.id;
  3736. }
  3737. function deepTravFindSuper(superVjson, vjson, targetId) {
  3738. var rObj = null;
  3739. _$2.forOwn(vjson, function (value, key) {
  3740. if (rObj) {
  3741. return;
  3742. }
  3743. if (typeof value !== "object") {
  3744. return;
  3745. }
  3746. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  3747. if (key !== 'items') {
  3748. return;
  3749. }
  3750. }
  3751. else {
  3752. // 模型、数据、数据源不扫描
  3753. if (key === 'data' ||
  3754. key === 'dataSource' ||
  3755. key === 'suggest' ||
  3756. key === 'options' ||
  3757. key === 'config' ||
  3758. key === 'columns' ||
  3759. key === 'viewModel' ||
  3760. key === 'store') {
  3761. return;
  3762. }
  3763. }
  3764. //事件不扫描
  3765. if (key === "on" && _$2.isObject(value)) {
  3766. return;
  3767. }
  3768. if (key.startsWith("on") && _$2.size(key) > 2) {
  3769. return;
  3770. }
  3771. if (value.id === targetId) {
  3772. if (_$2.isArray(vjson)) {
  3773. rObj = superVjson;
  3774. }
  3775. else {
  3776. rObj = vjson;
  3777. }
  3778. return;
  3779. }
  3780. rObj = deepTravFindSuper(vjson, value, targetId);
  3781. });
  3782. return rObj;
  3783. }
  3784. /**
  3785. * 深度遍历 vjson
  3786. * @param vjson 视图JSON
  3787. * @param resolver 分析函数
  3788. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  3789. */
  3790. function deepTravVJson(vjson, resolver, propDeep) {
  3791. if (propDeep === void 0) { propDeep = false; }
  3792. var markerList = [];
  3793. deepTrav1(vjson, resolver, markerList, propDeep);
  3794. return markerList;
  3795. }
  3796. function deepTrav1(obj, resolver, marker, propDeep) {
  3797. if (propDeep === void 0) { propDeep = false; }
  3798. var isMarker = resolver(obj);
  3799. if (marker && isMarker === true) {
  3800. marker.unshift({ id: 0, keyName: '', object: obj });
  3801. }
  3802. _$2.forOwn(obj, function (value, key) {
  3803. if (typeof value !== 'object') {
  3804. return;
  3805. }
  3806. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3807. if (key !== 'items' && key !== 'children') {
  3808. return;
  3809. }
  3810. }
  3811. else {
  3812. // 模型、数据、数据源不扫描
  3813. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3814. return;
  3815. }
  3816. if (!propDeep &&
  3817. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3818. key === 'listeners' || key === 'bind')) {
  3819. return;
  3820. }
  3821. }
  3822. //事件不扫描
  3823. if (key === 'on' && _$2.isObject(value)) {
  3824. return;
  3825. }
  3826. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3827. return;
  3828. }
  3829. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3830. if (marker && isMarkerChild === true) {
  3831. isMarker = true;
  3832. marker.unshift({ id: obj.id, keyName: key, object: value });
  3833. }
  3834. });
  3835. // @ts-ignore 删除作废对象
  3836. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3837. return isMarker;
  3838. }
  3839. /**
  3840. * 在代码中找到 reference 对应的对象
  3841. */
  3842. function findInCode(code, id) {
  3843. try {
  3844. deepTravVJson(code, function (child) {
  3845. if (child.id === id) {
  3846. throw child;
  3847. }
  3848. });
  3849. return undefined;
  3850. }
  3851. catch (err) {
  3852. return err;
  3853. }
  3854. }
  3855. function replaceVjsonById(vjson, itemVjson, itemId) {
  3856. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3857. msgError('无法定位组件!');
  3858. debugger;
  3859. return;
  3860. }
  3861. var id = itemId || itemVjson.id;
  3862. deepTravVJson(vjson, function (obj) {
  3863. if (obj.id == id) {
  3864. _$2.assign(obj, itemVjson, { id: id });
  3865. }
  3866. });
  3867. }
  3868. function deepTravDeleteVjson(obj, targetId) {
  3869. var isDelete = false;
  3870. _$2.forOwn(obj, function (value, key) {
  3871. if (isDelete) {
  3872. return;
  3873. }
  3874. if (typeof value !== 'object') {
  3875. return;
  3876. }
  3877. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3878. if (key !== 'items') {
  3879. return;
  3880. }
  3881. }
  3882. else {
  3883. // 模型、数据、数据源不扫描
  3884. if (key === 'data' ||
  3885. key === 'dataSource' ||
  3886. key === 'suggest' ||
  3887. key === 'options' ||
  3888. key === 'config' ||
  3889. key === 'columns' ||
  3890. key === 'viewModel' ||
  3891. key === 'store') {
  3892. return;
  3893. }
  3894. }
  3895. //事件不扫描
  3896. if (key === 'on' && _$2.isObject(value)) {
  3897. return;
  3898. }
  3899. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3900. return;
  3901. }
  3902. if (value.id === targetId) {
  3903. isDelete = true;
  3904. /** 如果是数组的元素*/
  3905. if (_$2.isArray(obj)) {
  3906. obj.splice(key, 1);
  3907. }
  3908. else {
  3909. delete obj[key];
  3910. }
  3911. return;
  3912. }
  3913. isDelete = deepTravDeleteVjson(value, targetId);
  3914. });
  3915. return isDelete;
  3916. }
  3917. /**
  3918. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3919. * @param obj 原始 vjson 视图
  3920. * @param targetId 子元素的id
  3921. */
  3922. function deletVjsonById(vjson, targetId) {
  3923. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3924. // if (_.isArray(obj)) {
  3925. // if (obj.length <= 0) {
  3926. // let T: any = {
  3927. // view: "template",
  3928. // template: "拖动任何组件到此处",
  3929. // role: "placeholder",
  3930. // id: webix.uid()
  3931. // }
  3932. // obj.push(T);
  3933. // }
  3934. // }
  3935. return isDeleted;
  3936. }
  3937. function removeDesignProp(vjson) {
  3938. deepTravVJson(vjson, function (obj) {
  3939. if (obj.hasOwnProperty('id')) {
  3940. delete obj.id;
  3941. }
  3942. if (obj.hasOwnProperty("designMode")) {
  3943. delete obj.designMode;
  3944. }
  3945. });
  3946. if (vjson.hasOwnProperty("cls")) {
  3947. delete vjson.cls;
  3948. }
  3949. if (vjson.hasOwnProperty("viewModel")) {
  3950. delete vjson.viewModel;
  3951. }
  3952. if (vjson.hasOwnProperty("store")) {
  3953. delete vjson.store;
  3954. }
  3955. }
  3956. function getLayoutOutline(vjson) {
  3957. deepTravVJson(vjson, function (obj) {
  3958. if (!Array.isArray(obj)) {
  3959. _$2.forOwn(obj, function (value, key) {
  3960. if (key === 'id' || key === 'region' || key === 'layoutName'
  3961. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3962. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3963. if (key === 'region'
  3964. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3965. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3966. if (!_$2.has(obj, 'layoutName')) {
  3967. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3968. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3969. // console.log(obj.layoutName, obj.layoutNameDesc)
  3970. }
  3971. }
  3972. }
  3973. else {
  3974. if (key === 'items') {
  3975. obj.children = obj[key];
  3976. }
  3977. if (key === 'tbar') {
  3978. var t = obj[key];
  3979. t.layoutName = key;
  3980. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3981. // console.log(t.layoutName, t.layoutNameDesc)
  3982. if (_$2.has(obj, "items")) {
  3983. obj.items.splice(0, 0, t);
  3984. }
  3985. else if (_$2.has(obj, "children")) {
  3986. obj.children.splice(0, 0, t);
  3987. }
  3988. else {
  3989. obj.children = [t];
  3990. }
  3991. }
  3992. if (key === 'fbar') {
  3993. var t = obj[key];
  3994. t.layoutName = key;
  3995. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3996. // console.log(t.layoutName, t.layoutNameDesc)
  3997. if (_$2.has(obj, "items")) {
  3998. obj.items.push(t);
  3999. }
  4000. else if (_$2.has(obj, "children")) {
  4001. obj.children.push(t);
  4002. }
  4003. else {
  4004. obj.children = [t];
  4005. }
  4006. }
  4007. delete obj[key];
  4008. }
  4009. });
  4010. if (!obj.hasOwnProperty("children")) {
  4011. obj.leaf = true;
  4012. }
  4013. if (!obj.hasOwnProperty("expanded")) {
  4014. obj.expanded = true;
  4015. }
  4016. }
  4017. });
  4018. return vjson;
  4019. }
  4020. //# sourceMappingURL=ViewHelper.js.map
  4021. var checkFlags = {};
  4022. // ------------------------------------------------------------------------------------------ impls
  4023. function jsViewToVJson(modulePage, jsView) {
  4024. if (!jsView)
  4025. return {};
  4026. jsView = jsView.replace(/^\s*export\s+default/, "");
  4027. jsView = _$2.trim(jsView) || "{}";
  4028. try {
  4029. var json = dist.parse(jsView);
  4030. return modulePage.addViewId(json);
  4031. }
  4032. catch (e) {
  4033. //@ts-ignore
  4034. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  4035. }
  4036. }
  4037. function stringToJsonObj(jsonStr) {
  4038. if (!jsonStr)
  4039. return {};
  4040. try {
  4041. return dist.parse(jsonStr);
  4042. }
  4043. catch (e) {
  4044. return {};
  4045. }
  4046. }
  4047. /**
  4048. * 获取view.js 文件 string
  4049. */
  4050. function vjsonTojsView(vjson) {
  4051. var reVjson = _$2.cloneDeep(vjson);
  4052. removeDesignProp(reVjson);
  4053. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  4054. }
  4055. var ModuleStore = /** @class */ (function (_super) {
  4056. __extends(ModuleStore, _super);
  4057. function ModuleStore() {
  4058. var _this = _super.call(this) || this;
  4059. _this.store = {};
  4060. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  4061. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  4062. _this.addModule(id, module, modulePage);
  4063. });
  4064. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  4065. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  4066. _this.onMainTabChange(moduleId, oldModuleId, from);
  4067. });
  4068. return _this;
  4069. }
  4070. ModuleStore.prototype.getCacheKey = function (param) {
  4071. return "filetree_data.json";
  4072. };
  4073. ModuleStore.prototype.invokeApi = function (param) {
  4074. return moduleTree();
  4075. };
  4076. ModuleStore.prototype.reloadModule = function (id) {
  4077. var moduleObject = this.store[id];
  4078. if (!moduleObject)
  4079. return;
  4080. var module = moduleObject.module;
  4081. getModuleFileContent(module).then(function (_a) {
  4082. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4083. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  4084. moduleObject.lastModifyTime = lastModifyTime;
  4085. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  4086. // 触发事件 ModuleItemChange
  4087. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4088. moduleObject.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: "reloadModule" });
  4089. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  4090. });
  4091. };
  4092. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  4093. var _this = this;
  4094. getModuleFileContent(module).then(function (_a) {
  4095. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4096. var moduleObject = {
  4097. id: id, module: module,
  4098. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  4099. lastModifyTime: lastModifyTime,
  4100. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  4101. modulePage: modulePage,
  4102. moduleEventBus: modulePage.moduleEventBus
  4103. };
  4104. _this.store[id] = moduleObject;
  4105. // 触发事件 ModuleItemChange
  4106. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4107. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  4108. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  4109. });
  4110. };
  4111. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  4112. if (this.store[moduleId]) {
  4113. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  4114. }
  4115. };
  4116. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  4117. var moduleObject = this.store[id];
  4118. moduleObject.fileContent.jsController = codeValue;
  4119. };
  4120. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  4121. var moduleObject = this.store[id];
  4122. moduleObject.fileContent.jsView = codeValue;
  4123. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  4124. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: from });
  4125. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  4126. };
  4127. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  4128. var moduleObject = this.store[id];
  4129. moduleObject.fileContent.jsModel = codeValue;
  4130. };
  4131. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  4132. var moduleObject = this.store[id];
  4133. moduleObject.fileContent.groovy = codeValue;
  4134. };
  4135. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  4136. var moduleObject = this.store[id];
  4137. moduleObject.fileContent.mybatis = codeValue;
  4138. };
  4139. ModuleStore.prototype.getModuleObject = function (id) {
  4140. return this.store[id];
  4141. };
  4142. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  4143. if (checkFlags[moduleId] === 1) {
  4144. // @ts-ignore
  4145. system.msg("正在检测文件是否有外部修改,请稍后操作");
  4146. }
  4147. eventBus.publish(EventType.StopCheckModule, {});
  4148. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  4149. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  4150. saveFile(fileFullPath, fileContent).then(function (res) {
  4151. if (res.data && res.data.lastModified) {
  4152. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  4153. }
  4154. }).finally(function () {
  4155. eventBus.publish(EventType.RunCheckModule, {});
  4156. });
  4157. };
  4158. ModuleStore.prototype.check = function (moduleId) {
  4159. {
  4160. return;
  4161. }
  4162. };
  4163. return ModuleStore;
  4164. }(CacheStore));
  4165. // ------------------------------------------------------------------------------------------ use
  4166. var moduleStore = new ModuleStore();
  4167. //# sourceMappingURL=ModuleStore.js.map
  4168. /**
  4169. * 调用方法
  4170. */
  4171. function invokeMethod(fn, sender, args) {
  4172. if (typeof fn === 'function') {
  4173. fn.apply.apply(fn, __spread([sender], args));
  4174. }
  4175. }
  4176. /**
  4177. * 判断事件是否为有效的输入字符
  4178. * @param e
  4179. */
  4180. function isChartEvent(e) {
  4181. if (e.key === 'Shift' ||
  4182. e.key === 'Control' ||
  4183. e.key === 'Alt' ||
  4184. e.key === 'Escape' ||
  4185. e.key === 'ArrowRight' ||
  4186. e.key === 'Tab' ||
  4187. e.key === 'ArrowLeft') {
  4188. return false;
  4189. }
  4190. if (e.keyCode >= 48 && e.keyCode <= 57) {
  4191. // 0-9
  4192. return true;
  4193. }
  4194. if (e.keyCode >= 65 && e.keyCode <= 90) {
  4195. // a-z
  4196. return true;
  4197. }
  4198. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  4199. // 小键盘 0-9
  4200. return true;
  4201. }
  4202. return false;
  4203. }
  4204. if (!window["time_offset"]) {
  4205. window["time_offset"] = 0;
  4206. }
  4207. function syncDate(date) {
  4208. if (date && date.setTime && date.getTime) {
  4209. date.setTime(date.getTime() + window["time_offset"]);
  4210. }
  4211. return date;
  4212. }
  4213. //# sourceMappingURL=utils.js.map
  4214. function isDesignMode(control, config) {
  4215. var _a, _b;
  4216. if (window["IS_DESIGN_MODE"]) {
  4217. return true;
  4218. }
  4219. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  4220. return true;
  4221. }
  4222. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  4223. return true;
  4224. }
  4225. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  4226. return true;
  4227. }
  4228. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  4229. return true;
  4230. }
  4231. return false;
  4232. }
  4233. function toString(value) {
  4234. if (typeof value === 'undefined' || value === null) {
  4235. return "";
  4236. }
  4237. if (typeof value === 'number' && isNaN(value)) {
  4238. return "";
  4239. }
  4240. if (value == 'N/A') {
  4241. return "";
  4242. }
  4243. return ("" + value);
  4244. }
  4245. function isEmpty(value) {
  4246. if (typeof value === 'undefined' || value === null) {
  4247. return true;
  4248. }
  4249. if (typeof value === 'number' && isNaN(value)) {
  4250. return true;
  4251. }
  4252. if (value == 'N/A') {
  4253. return true;
  4254. }
  4255. return ("" + value).trim().length <= 0;
  4256. }
  4257. function createUUID() {
  4258. //@ts-ignore
  4259. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  4260. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  4261. });
  4262. }
  4263. function getRegList() {
  4264. var regList = _$2.get(window, 'yvanLib.regList');
  4265. if (!regList) {
  4266. regList = [];
  4267. _$2.set(window, 'yvanLib.regList', regList);
  4268. }
  4269. return regList;
  4270. }
  4271. function getRegParamList(methodName) {
  4272. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  4273. if (!regParamList) {
  4274. regParamList = {};
  4275. _$2.set(window, 'yvanLib.regParamList', regParamList);
  4276. }
  4277. if (!_$2.has(regParamList, methodName)) {
  4278. regParamList[methodName] = [];
  4279. }
  4280. return regParamList[methodName];
  4281. }
  4282. /**
  4283. * 模拟点击按钮
  4284. */
  4285. function raiseClick(buttonHandle) {
  4286. if (!buttonHandle) {
  4287. return false;
  4288. }
  4289. if (buttonHandle.disabled) {
  4290. // 按钮是禁止状态
  4291. return false;
  4292. }
  4293. if (buttonHandle.hidden) {
  4294. // 按钮是隐藏状态
  4295. return false;
  4296. }
  4297. // 按钮点击
  4298. buttonHandle.click();
  4299. return true;
  4300. }
  4301. /**
  4302. * 标注系统全局函数的参数
  4303. * @param title 函数名称
  4304. * @param type 函数类型
  4305. * @param allowEmpty 可否为空
  4306. */
  4307. function LibParam(title, type, allowEmpty) {
  4308. if (allowEmpty === void 0) { allowEmpty = false; }
  4309. return function (target, methodName, paramsIndex) {
  4310. var systemFnArgs = getRegParamList(methodName);
  4311. systemFnArgs[paramsIndex] = {
  4312. type: type,
  4313. title: title,
  4314. name: methodName,
  4315. allowEmpty: allowEmpty,
  4316. };
  4317. };
  4318. }
  4319. /**
  4320. * 标注函数变成"系统全局函数"
  4321. */
  4322. function Lib(registe) {
  4323. return function (target, propertyKey, descriptor) {
  4324. var libList = getRegList();
  4325. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  4326. if (registe.type === 'system') {
  4327. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  4328. }
  4329. else if (registe.type === 'format') {
  4330. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  4331. }
  4332. return target;
  4333. };
  4334. }
  4335. /**
  4336. * 解析事件
  4337. * 'scope.私有方法名'
  4338. * 'system.系统函数名'
  4339. * 'format.格式化名'
  4340. */
  4341. function lookupFn(scope, event, errorWho) {
  4342. if (isDesignMode(scope, undefined)) {
  4343. return Ext.emptyFn;
  4344. }
  4345. if (!_$2.startsWith(event, 'scope.') &&
  4346. !_$2.startsWith(event, 'system.') &&
  4347. !_$2.startsWith(event, 'format.')) {
  4348. console.error('无法识别的事件响应类型', event);
  4349. throw new TypeError('无法识别的事件响应类型');
  4350. }
  4351. // 为 eval 准备环境
  4352. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  4353. var data = scope.viewModel.data;
  4354. var keys = [];
  4355. var values = [];
  4356. _$2.forOwn(data, function (value, key) {
  4357. var idxKey = key.indexOf('//');
  4358. if (idxKey >= 0) {
  4359. keys.push(key.substr(0, idxKey));
  4360. }
  4361. else {
  4362. keys.push(key);
  4363. }
  4364. values.push(value);
  4365. });
  4366. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  4367. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  4368. if (typeof funcResult !== 'function') {
  4369. console.error('无法识别的事件响应类型', event, func, errorWho);
  4370. throw new TypeError('无法识别的事件响应类型');
  4371. }
  4372. return funcResult;
  4373. }
  4374. /**
  4375. * 从 ext.element 获取 scope 对象
  4376. */
  4377. function lookupScope(extHandle) {
  4378. if (!extHandle) {
  4379. // @ts-ignore
  4380. return;
  4381. }
  4382. if (extHandle.isScope) {
  4383. return extHandle;
  4384. }
  4385. if (extHandle.column) {
  4386. // 列上的组件
  4387. return extHandle.column.lookupReferenceHolder().yvanScope;
  4388. }
  4389. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  4390. if (typeof extHandle.lookupViewModel === 'function') {
  4391. var vm = extHandle.lookupViewModel();
  4392. return vm.yvanScope;
  4393. }
  4394. return;
  4395. }
  4396. //# sourceMappingURL=lib.js.map
  4397. /**
  4398. * 全局 ajax 方法
  4399. */
  4400. var ajax = {};
  4401. /**
  4402. * 计算拼音的函数
  4403. */
  4404. var pinyinFunc = function (str) { return (str); };
  4405. exports.scopeOnLoad = null;
  4406. exports.apiConvert = undefined;
  4407. var baseConfigProcessList = [];
  4408. /**
  4409. * 在基类添加 Config 的处理方法
  4410. */
  4411. function baseConfigProcess(option) {
  4412. return function (target, propertyKey) {
  4413. baseConfigProcessList.push(target[propertyKey]);
  4414. };
  4415. }
  4416. // let designMode: boolean = false
  4417. //
  4418. // export function isDesignMode(): boolean {
  4419. // return designMode
  4420. // }
  4421. //
  4422. // export function setDesignMode(v: boolean) {
  4423. // designMode = v
  4424. // }
  4425. /**
  4426. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  4427. */
  4428. function serverInvokeUrlTransform(url, option) {
  4429. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  4430. }
  4431. /**
  4432. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  4433. */
  4434. function sqlUrlTransform(url) {
  4435. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  4436. }
  4437. /**
  4438. * YvanUI 全局扩展配置
  4439. */
  4440. function extend(option) {
  4441. if (option.ajax) {
  4442. ajax.func = option.ajax;
  4443. }
  4444. if (option.serverInvokeUrlTransform) {
  4445. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  4446. }
  4447. if (option.sqlUrlTransform) {
  4448. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  4449. }
  4450. if (option.pinyinFunction) {
  4451. pinyinFunc = option.pinyinFunction;
  4452. }
  4453. if (option.scopeOnLoad) {
  4454. exports.scopeOnLoad = option.scopeOnLoad;
  4455. }
  4456. if (option.scopeOnCreate) {
  4457. exports.scopeOnCreate = option.scopeOnCreate;
  4458. }
  4459. if (option.apiConvert) {
  4460. exports.apiConvert = option.apiConvert;
  4461. }
  4462. // if (typeof option.designMode !== 'undefined') {
  4463. // setDesignMode(option.designMode)
  4464. // }
  4465. }
  4466. function getApiConvert() {
  4467. return exports.apiConvert;
  4468. }
  4469. function getScopeOnCreate() {
  4470. return exports.scopeOnCreate;
  4471. }
  4472. function getPinyin(v) {
  4473. return pinyinFunc(v);
  4474. }
  4475. /**
  4476. * 适用于 Select / Tree 等,作筛选的通用方法.
  4477. * 1.首字母模糊匹配(不区分大小写)
  4478. * 2.标识的模糊匹配(不区分大小写)
  4479. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  4480. */
  4481. function keywordFilter(keyword, label, value) {
  4482. if (!keyword) {
  4483. return true;
  4484. }
  4485. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  4486. // const labelPy = _.toLower(getPinyin(label))
  4487. //@ts-ignore
  4488. var labelPy = _$2.toLower(getFirstPinyin2(label));
  4489. value = _$2.toLower(_$2.trim(value));
  4490. var found = 0;
  4491. _$2.some(ws, function (word) {
  4492. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  4493. found++;
  4494. return;
  4495. }
  4496. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  4497. found++;
  4498. return;
  4499. }
  4500. });
  4501. return found >= ws.length;
  4502. }
  4503. //# sourceMappingURL=config.js.map
  4504. var Scope = /** @class */ (function () {
  4505. function Scope(_a) {
  4506. var model = _a.model, vjson = _a.vjson, i18n = _a.i18n;
  4507. /**
  4508. * 业务模块的唯一编号
  4509. */
  4510. this.id = _$2.uniqueId('scope_');
  4511. this.IS_DESIGN_MODE = false;
  4512. /**
  4513. * onload 运行完成之后才会设置本标记为 true
  4514. */
  4515. this.isLoadFinish = false;
  4516. this._isLoading = false;
  4517. this.model = model;
  4518. if (typeof vjson.layout === 'undefined') {
  4519. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  4520. var ret = buildPlus({ model: model, vjson: vjson });
  4521. model = ret.model;
  4522. vjson = ret.vjson;
  4523. }
  4524. this.originalVjson = _$2.cloneDeep(vjson);
  4525. this.vjson = this.originalVjson; // this.buildVjson()
  4526. var WMSTranslate = window["WMSTranslate"];
  4527. if (WMSTranslate) {
  4528. var i18nPath_1 = this.constructor.name;
  4529. if (i18n) {
  4530. WMSTranslate[i18nPath_1] = i18n;
  4531. }
  4532. this.vjson.i18nPath = i18nPath_1;
  4533. deepTravVJson(this.vjson, function (obj) {
  4534. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  4535. return;
  4536. }
  4537. obj.i18nPath = i18nPath_1;
  4538. });
  4539. }
  4540. var extScope = getScopeOnCreate();
  4541. if (typeof extScope === 'function') {
  4542. extScope({ vjson: vjson, model: model }, this);
  4543. }
  4544. }
  4545. Scope.prototype._addWatch = function (tplExpress, fn) {
  4546. if (!this._watchList) {
  4547. this._watchList = [];
  4548. }
  4549. this._watchList.push({ watch: tplExpress, fn: fn });
  4550. };
  4551. Scope.prototype._applyWatchList = function () {
  4552. var _this = this;
  4553. _$2.forEach(this._watchList, function (item) {
  4554. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  4555. });
  4556. };
  4557. Object.defineProperty(Scope.prototype, "isScope", {
  4558. get: function () {
  4559. return true;
  4560. },
  4561. enumerable: true,
  4562. configurable: true
  4563. });
  4564. /**
  4565. * 产生一个当前模块有效的唯一id
  4566. * @param key 唯一编号
  4567. */
  4568. Scope.prototype.uid = function (key) {
  4569. return this.id + key;
  4570. };
  4571. /**
  4572. * 对话框"保存"成功.
  4573. * 关闭对话框,并响应 success 方法
  4574. * @param data 要傳回的數據(可以為空)
  4575. */
  4576. Scope.prototype.dialogSuccess = function (data) {
  4577. this._handle.fireEvent('success', this, data);
  4578. var sender = this._handle.config.animateTarget;
  4579. var scope = lookupScope(sender);
  4580. if (typeof this['success'] === 'function') {
  4581. this['success'].call(scope, sender, data);
  4582. }
  4583. this.close();
  4584. };
  4585. /**
  4586. * 设置等待状态
  4587. * @param value
  4588. * @param msg
  4589. */
  4590. Scope.prototype.setLoading = function (value) {
  4591. var _a;
  4592. var scope = this;
  4593. this._isLoading = value;
  4594. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  4595. };
  4596. Scope.prototype.getLoading = function () {
  4597. return this._isLoading;
  4598. };
  4599. /**
  4600. * 以对话框模式打开当前模块
  4601. * @param sender 发送者(按钮或Scope对象)
  4602. * @param vjsonOption 界面覆盖选项(可以为空)
  4603. * @param dataOption 数据覆盖选项(可以为空)
  4604. */
  4605. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  4606. var _a;
  4607. var that = this;
  4608. var vmodel = _$2.defaultsDeep({
  4609. //
  4610. }, dataOption, that.model);
  4611. this.viewModel = new Ext.app.ViewModel(vmodel);
  4612. this.viewModel.yvanScope = this;
  4613. this._applyWatchList();
  4614. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4615. var config = _$2.defaultsDeep({
  4616. animateTarget: sender,
  4617. viewModel: this.viewModel,
  4618. yvanScope: this,
  4619. referenceHolder: true,
  4620. }, vjsonOption, that.vjson, windows);
  4621. if (config.height === 'unset') {
  4622. delete config.height;
  4623. }
  4624. if (config.width === 'unset') {
  4625. delete config.width;
  4626. }
  4627. // const holder = sender?.lookupReferenceHolder()
  4628. // delete config.constrain
  4629. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  4630. if (topScope) {
  4631. config.constrain = true;
  4632. this.topScope = topScope;
  4633. }
  4634. var win = new Ext.Window(config);
  4635. // if (holder) {
  4636. // holder.add(win)
  4637. // }
  4638. if (topScope) {
  4639. topScope._handle.add(win);
  4640. }
  4641. win.addListener('beforerender', function (sender) {
  4642. // 记录句柄
  4643. if (sender && !that._handle) {
  4644. that._handle = sender;
  4645. }
  4646. });
  4647. win.addListener('afterrender', function (sender) {
  4648. // 调用onLoad回调
  4649. try {
  4650. that._onLoad();
  4651. }
  4652. catch (e) {
  4653. console.error('errorAt onLoad', e);
  4654. }
  4655. window['cw'] = that;
  4656. });
  4657. win.addListener('destroy', this._destroy.bind(this));
  4658. win.show();
  4659. };
  4660. /**
  4661. * 以标签模式打开当前模块
  4662. * @param vjsonOption 界面覆盖选项(可以为空)
  4663. * @param dataOption 数据覆盖选项(可以为空)
  4664. */
  4665. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  4666. var _this = this;
  4667. var that = this;
  4668. this._vjsonOption = vjsonOption;
  4669. this._dataOption = dataOption;
  4670. var vmodel = _$2.defaultsDeep({
  4671. data: {}
  4672. }, dataOption, that.model);
  4673. this.viewModel = new Ext.app.ViewModel(vmodel);
  4674. this.viewModel.yvanScope = this;
  4675. this._applyWatchList();
  4676. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4677. // 根级不能设置id
  4678. delete that.vjson.id;
  4679. var config = _$2.defaultsDeep({
  4680. viewModel: this.viewModel,
  4681. yvanScope: this,
  4682. referenceHolder: true,
  4683. }, vjsonOption, that.vjson);
  4684. var tt = Ext.getCmp('TT');
  4685. var handle = tt.addScope(this, config, function (handle) {
  4686. handle.addListener('added', function (sender) {
  4687. // 记录句柄
  4688. if (sender && !that._handle) {
  4689. that._handle = sender;
  4690. }
  4691. });
  4692. handle.addListener('afterrender', function (sender) {
  4693. // 调用onLoad回调
  4694. try {
  4695. that._onLoad();
  4696. }
  4697. catch (e) {
  4698. console.error('errorAt onLoad', e);
  4699. }
  4700. });
  4701. handle.addListener('destroy', _this._destroy.bind(_this));
  4702. });
  4703. return handle;
  4704. };
  4705. /**
  4706. * 直接渲染到元素
  4707. * @param element 渲染目标
  4708. * @param vjsonOption 界面覆盖选项(可以为空)
  4709. * @param dataOption 数据覆盖选项(可以为空)
  4710. */
  4711. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  4712. var that = this;
  4713. this._vjsonOption = vjsonOption;
  4714. this._dataOption = dataOption;
  4715. var vmodel = _$2.defaultsDeep({
  4716. data: {}
  4717. }, that.model, dataOption);
  4718. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4719. this.viewModel = new Ext.app.ViewModel(vmodel);
  4720. this.viewModel.yvanScope = this;
  4721. this._applyWatchList();
  4722. var config = _$2.defaultsDeep({
  4723. viewModel: this.viewModel,
  4724. yvanScope: this,
  4725. referenceHolder: true,
  4726. renderTo: element,
  4727. listeners: {
  4728. afterrender: function (sender) {
  4729. var _a;
  4730. // 记录句柄
  4731. if (sender && !that._handle) {
  4732. that._handle = sender;
  4733. }
  4734. // 调用onLoad回调
  4735. that._onLoad();
  4736. // 如果vjson中配置了 afterrender ,需要恢复状态
  4737. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4738. },
  4739. },
  4740. }, vjsonOption, that.vjson);
  4741. new Ext.container.Viewport(config);
  4742. };
  4743. Scope.prototype.showDesigner = function (designer, option) {
  4744. var that = this;
  4745. var vmodel = _$2.defaultsDeep({
  4746. data: {
  4747. IS_DESIGN_MODE: true,
  4748. }
  4749. }, that.model);
  4750. this.IS_DESIGN_MODE = true;
  4751. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  4752. this.viewModel = new Ext.app.ViewModel(vmodel);
  4753. this.viewModel.yvanScope = this;
  4754. this._applyWatchList();
  4755. var config = _$2.defaultsDeep({
  4756. viewModel: this.viewModel,
  4757. yvanScope: this,
  4758. referenceHolder: true,
  4759. listeners: {
  4760. afterrender: function (sender) {
  4761. var _a;
  4762. // 记录句柄
  4763. if (sender && !that._handle) {
  4764. that._handle = sender;
  4765. }
  4766. // 调用onLoad回调
  4767. that._onLoad();
  4768. // 如果vjson中配置了 afterrender ,需要恢复状态
  4769. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4770. },
  4771. },
  4772. }, that.vjson);
  4773. designer.removeAll(true);
  4774. designer.add(config);
  4775. };
  4776. /**
  4777. * 关闭对话框(或标签页)
  4778. */
  4779. Scope.prototype.close = function () {
  4780. this._handle.close();
  4781. };
  4782. Object.defineProperty(Scope.prototype, "data", {
  4783. /**
  4784. * 获取 viewModel 里包含的数据(只读)
  4785. */
  4786. get: function () {
  4787. return this.viewModel.getData();
  4788. },
  4789. enumerable: true,
  4790. configurable: true
  4791. });
  4792. /**
  4793. * 设置 viewModel 中的数据
  4794. * 可以是 key, value 模式
  4795. * 也可以是 {key:value} 模式
  4796. */
  4797. Scope.prototype.set = function (path, value) {
  4798. return this.viewModel.set(path, value);
  4799. };
  4800. /**
  4801. * 寻找模块内所有的 xtype 对应的对象
  4802. * @param xtypeKey
  4803. */
  4804. Scope.prototype.down = function (xtypeKey) {
  4805. return this._handle.down(xtypeKey);
  4806. };
  4807. Object.defineProperty(Scope.prototype, "refs", {
  4808. /**
  4809. * 获取所有设置过 Reference 名称的组件
  4810. */
  4811. get: function () {
  4812. var _a, _b;
  4813. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  4814. },
  4815. enumerable: true,
  4816. configurable: true
  4817. });
  4818. Scope.prototype._destroy = function () {
  4819. var that = this;
  4820. that.onDestroy();
  4821. delete that._watchList;
  4822. delete that._handle;
  4823. this.isLoadFinish = false;
  4824. };
  4825. /**
  4826. * 私有渲染完成后的回调
  4827. */
  4828. Scope.prototype._onLoad = function () {
  4829. var _this = this;
  4830. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  4831. exports.scopeOnLoad(this);
  4832. }
  4833. this.onLoad();
  4834. _$2.defer(function () {
  4835. _this.isLoadFinish = true;
  4836. });
  4837. };
  4838. /**
  4839. * 默认 渲染完成之后调用的函数
  4840. */
  4841. Scope.prototype.onLoad = function () {
  4842. };
  4843. /**
  4844. * 组件卸载之后的回调
  4845. */
  4846. Scope.prototype.onDestroy = function () {
  4847. };
  4848. return Scope;
  4849. }());
  4850. /**
  4851. * 观察装饰器,viewModel 属性更改时触发成员方法
  4852. * @param tplExpress tpl表达式,例如 "{form.f1}"
  4853. */
  4854. function watch(tplExpress, deep) {
  4855. if (deep === void 0) { deep = false; }
  4856. return function (target, propertyKey, pd) {
  4857. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  4858. return target[propertyKey];
  4859. };
  4860. }
  4861. // 获取vjson的hash值
  4862. function getVjsonHash(str) {
  4863. var hash = 3465217896, i, ch;
  4864. for (i = str.length - 1; i >= 0; i--) {
  4865. ch = str.charCodeAt(i);
  4866. hash ^= ((hash << 5) + ch + (hash >> 2));
  4867. }
  4868. return (hash & 0x7FFFFFFF) + "";
  4869. }
  4870. function buildPlus(_a) {
  4871. var model = _a.model, vjson = _a.vjson;
  4872. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  4873. {
  4874. layout: 'border',
  4875. // tbar: vjson.action,
  4876. items: vjson.items,
  4877. },
  4878. ] });
  4879. if (_$2.isArray(vjson.action)) {
  4880. vjsonNew.items[0].tbar = vjson.action;
  4881. }
  4882. return { model: model, vjson: vjsonNew };
  4883. }
  4884. //# sourceMappingURL=Scope.js.map
  4885. var model = {
  4886. data: {
  4887. form: {
  4888. resource_parent: '',
  4889. resource_name: '',
  4890. resource_icon: '',
  4891. scope_url: '',
  4892. scope_params: '',
  4893. resource_order: '',
  4894. permission_code: '',
  4895. },
  4896. }
  4897. };
  4898. //# sourceMappingURL=RegisterModule.model.js.map
  4899. var vjson = {
  4900. title: '注册模块',
  4901. layout: 'fit',
  4902. width: "40%",
  4903. height: "50%",
  4904. fbar: {
  4905. xtype: 'toolbar',
  4906. items: [
  4907. {
  4908. xtype: "button",
  4909. text: "确定",
  4910. iconCls: 'x-fa fa-check',
  4911. listeners: {
  4912. click: 'scope.saveNode',
  4913. }
  4914. },
  4915. {
  4916. xtype: "button",
  4917. text: "关闭",
  4918. iconCls: 'x-fa fa-times',
  4919. listeners: {
  4920. click: 'system.closeMe()',
  4921. }
  4922. },
  4923. ]
  4924. },
  4925. items: [
  4926. {
  4927. layout: 'border',
  4928. items: [
  4929. {
  4930. region: 'west',
  4931. layout: 'fit',
  4932. xtype: 'tabpanel',
  4933. reference: 'tabs',
  4934. width: "50%",
  4935. split: true,
  4936. listeners: {
  4937. tabchange: 'scope.tabchange',
  4938. },
  4939. items: [
  4940. {
  4941. region: 'center',
  4942. layout: 'fit',
  4943. title: 'PC菜单',
  4944. key: "1",
  4945. items: [
  4946. {
  4947. xtype: 'treepanel',
  4948. layout: 'fit',
  4949. region: 'west',
  4950. rootVisible: false,
  4951. useArrows: true,
  4952. reference: 'tree1',
  4953. listeners: {
  4954. itemclick: "scope.tree1NodeClick",
  4955. }
  4956. },
  4957. ]
  4958. },
  4959. {
  4960. region: 'center',
  4961. layout: 'fit',
  4962. title: 'PDA菜单',
  4963. key: "2",
  4964. items: [
  4965. {
  4966. xtype: 'treepanel',
  4967. layout: 'fit',
  4968. region: 'west',
  4969. reference: 'tree2',
  4970. rootVisible: false,
  4971. useArrows: true,
  4972. listeners: {
  4973. itemclick: "scope.tree1NodeClick",
  4974. }
  4975. },
  4976. ]
  4977. },
  4978. ]
  4979. },
  4980. {
  4981. region: 'center',
  4982. xtype: 'form',
  4983. margin: '0 0 0 0',
  4984. split: true,
  4985. width: '50%',
  4986. items: [
  4987. {
  4988. xtype: 'cols',
  4989. items: [
  4990. {
  4991. xtype: 'textfield',
  4992. fieldLabel: '上级资源ID',
  4993. bind: {
  4994. readOnly: true,
  4995. disabled: true,
  4996. value: '{form.resource_parent}'
  4997. },
  4998. },
  4999. ],
  5000. },
  5001. {
  5002. xtype: 'cols',
  5003. items: [
  5004. {
  5005. xtype: 'textfield',
  5006. fieldLabel: '资源名称',
  5007. bind: {
  5008. value: '{form.resource_name}'
  5009. },
  5010. allowBlank: false,
  5011. },
  5012. ],
  5013. },
  5014. {
  5015. xtype: 'cols',
  5016. items: [
  5017. {
  5018. xtype: 'numberfield',
  5019. fieldLabel: '资源排序',
  5020. bind: {
  5021. value: '{form.resource_order}'
  5022. },
  5023. allowBlank: false,
  5024. },
  5025. ],
  5026. },
  5027. {
  5028. xtype: 'cols',
  5029. items: [
  5030. {
  5031. xtype: 'textfield',
  5032. fieldLabel: '功能URL',
  5033. bind: {
  5034. disabled: true,
  5035. value: '{form.scope_url}'
  5036. },
  5037. },
  5038. ]
  5039. },
  5040. {
  5041. xtype: 'cols',
  5042. items: [
  5043. {
  5044. xtype: 'textfield',
  5045. fieldLabel: '权限编码',
  5046. bind: {
  5047. value: '{form.permission_code}'
  5048. }
  5049. },
  5050. ],
  5051. },
  5052. {
  5053. xtype: 'cols',
  5054. items: [
  5055. {
  5056. xtype: 'textfield',
  5057. fieldLabel: '功能参数',
  5058. bind: {
  5059. value: '{form.scope_params}'
  5060. }
  5061. },
  5062. ],
  5063. },
  5064. ],
  5065. },
  5066. ],
  5067. },
  5068. ],
  5069. referenceHolder: true,
  5070. };
  5071. //# sourceMappingURL=RegisterModule.view.js.map
  5072. var RegisterModule = /** @class */ (function (_super) {
  5073. __extends(RegisterModule, _super);
  5074. function RegisterModule() {
  5075. return _super.call(this, { model: model, vjson: vjson }) || this;
  5076. }
  5077. RegisterModule.prototype.onLoad = function () {
  5078. this.reloadTree("PC");
  5079. };
  5080. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  5081. var currTabKey = b.key;
  5082. if (currTabKey === '1') {
  5083. this.viewModel.set('form', '');
  5084. this.reloadTree("PC");
  5085. }
  5086. else {
  5087. this.viewModel.set('form', '');
  5088. this.reloadTree("PDA");
  5089. }
  5090. };
  5091. RegisterModule.prototype.reloadTree = function (type) {
  5092. var _this = this;
  5093. if ("PC" === type) {
  5094. this.setLoading(true);
  5095. getMenuTree({ type: "PC" }).then(function (res) {
  5096. if (res.success) {
  5097. _this.refs.tree1.store.setRootNode({
  5098. expanded: true,
  5099. children: res.data
  5100. });
  5101. }
  5102. }).finally(function () {
  5103. _this.setLoading(false);
  5104. });
  5105. }
  5106. else {
  5107. this.setLoading(true);
  5108. getMenuTree({ type: "PDA" }).then(function (res) {
  5109. if (res.success) {
  5110. _this.refs.tree2.store.setRoot({
  5111. expanded: true,
  5112. children: res.data
  5113. });
  5114. }
  5115. }).finally(function () {
  5116. _this.setLoading(false);
  5117. });
  5118. }
  5119. };
  5120. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  5121. var id = _$2.split(node.data.id, '_')[1];
  5122. if (!id) {
  5123. return;
  5124. }
  5125. this.viewModel.set('form.resource_parent', id);
  5126. };
  5127. RegisterModule.prototype.saveNode = function () {
  5128. var _this = this;
  5129. var tabKey = this.refs.tabs.activeTab.key;
  5130. // 检验菜单数据
  5131. var param = this.viewModel.get('form');
  5132. if (!param.resource_parent) {
  5133. msg('请选择一个父节点');
  5134. return;
  5135. }
  5136. if (!param.resource_name) {
  5137. msg('资源名称不能为空');
  5138. return;
  5139. }
  5140. if (!param.scope_url) {
  5141. msg('功能URL不能为空');
  5142. return;
  5143. }
  5144. var type;
  5145. if (tabKey === '1') {
  5146. type = 'PC';
  5147. }
  5148. else {
  5149. type = 'PDA';
  5150. }
  5151. this.setLoading(true);
  5152. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  5153. if (res.success) {
  5154. msg("注册成功");
  5155. _this.close();
  5156. }
  5157. }).finally(function () {
  5158. _this.setLoading(false);
  5159. });
  5160. };
  5161. return RegisterModule;
  5162. }(Scope));
  5163. //# sourceMappingURL=RegisterModule.js.map
  5164. var model$1 = {
  5165. data: {
  5166. title: "模板选择",
  5167. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  5168. moduleType: 1,
  5169. // 当前模块包路径 "com/galaxis/wms/bas/area"
  5170. packagePath: "",
  5171. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  5172. fileSavePath: "",
  5173. // 模块名称 "Dict"
  5174. moduleName: "NewModule",
  5175. // 页面标题 "字典维护"
  5176. pageTitle: "新模块",
  5177. // 单表查询
  5178. singleTable: {
  5179. sql: "select * from bas_dict",
  5180. // 新增或者删除所用的表
  5181. tableName: "",
  5182. // 是否分页查询
  5183. pagination: true,
  5184. // 是否需要删除
  5185. delete: true,
  5186. // 删除条件字段
  5187. deleteWhereColumn: "",
  5188. // 删除提示语
  5189. deleteTips: "确定要删除?",
  5190. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  5191. editType: 2,
  5192. },
  5193. singleTableView: {
  5194. tableNameList: [
  5195. // { value: "aaa"},
  5196. ],
  5197. columnList: [
  5198. // { value: "aaa"},
  5199. ],
  5200. }
  5201. }
  5202. };
  5203. //# sourceMappingURL=CreateModule.model.js.map
  5204. var vjson$1 = {
  5205. bind: {
  5206. title: '新建模块-{title}',
  5207. },
  5208. width: "55%",
  5209. height: "60%",
  5210. minWidth: 500,
  5211. minHeight: 400,
  5212. modal: true,
  5213. frame: true,
  5214. layout: 'card',
  5215. bbar: [
  5216. '->',
  5217. {
  5218. itemId: 'card-prev',
  5219. text: '&laquo; 上一步',
  5220. disabled: true,
  5221. listeners: {
  5222. click: 'scope.showPrevious',
  5223. },
  5224. },
  5225. {
  5226. itemId: 'card-next',
  5227. text: '下一步 &raquo;',
  5228. listeners: {
  5229. click: 'scope.showNext',
  5230. },
  5231. },
  5232. {
  5233. itemId: 'card-finish',
  5234. text: '立刻执行',
  5235. iconCls: 'x-fa fa-flash',
  5236. hidden: true,
  5237. listeners: {
  5238. click: 'scope.finish',
  5239. },
  5240. },
  5241. ],
  5242. items: [
  5243. {
  5244. vtitle: '模板选择',
  5245. reference: 'templateSelection',
  5246. layout: {
  5247. type: 'hbox',
  5248. pack: 'start',
  5249. align: 'stretch'
  5250. },
  5251. listeners: {
  5252. cardEnter: 'scope.templateEnter',
  5253. cardLevel: 'scope.templateLevel'
  5254. },
  5255. items: [
  5256. {
  5257. width: 150,
  5258. xtype: 'form',
  5259. border: false,
  5260. layout: {
  5261. type: 'vbox',
  5262. align: 'stretch'
  5263. },
  5264. defaults: {
  5265. border: false,
  5266. anchor: '100%',
  5267. margin: '5',
  5268. },
  5269. items: [
  5270. {
  5271. xtype: 'radiogroup',
  5272. bind: {
  5273. value: '{moduleType}'
  5274. },
  5275. layout: 'vbox',
  5276. defaults: {
  5277. border: false,
  5278. anchor: '100%',
  5279. margin: '5',
  5280. },
  5281. items: [
  5282. { boxLabel: '单表查询', inputValue: 1 },
  5283. { boxLabel: '主/明细查询', inputValue: 2 },
  5284. { boxLabel: '树/明细查询', inputValue: 3 },
  5285. { boxLabel: '卡片表单', inputValue: 4 },
  5286. { boxLabel: '主/详情查询', inputValue: 5 },
  5287. ]
  5288. },
  5289. ]
  5290. },
  5291. {
  5292. flex: 1,
  5293. region: 'center',
  5294. xtype: "panel",
  5295. border: false,
  5296. frame: true,
  5297. padding: "4px 8px",
  5298. html: "描述...",
  5299. }
  5300. ]
  5301. },
  5302. {
  5303. vtitle: '模块名称',
  5304. reference: 'moduleName',
  5305. layout: 'fit',
  5306. listeners: {
  5307. cardEnter: 'scope.moduleEnter',
  5308. cardLevel: 'scope.moduleLevel'
  5309. },
  5310. items: [
  5311. {
  5312. xtype: 'form',
  5313. border: false,
  5314. layout: {
  5315. type: 'vbox',
  5316. align: 'stretch'
  5317. },
  5318. defaults: {
  5319. border: false,
  5320. anchor: '100%',
  5321. margin: '5',
  5322. },
  5323. items: [
  5324. {
  5325. xtype: 'textfield',
  5326. fieldLabel: '包路径',
  5327. allowBlank: false,
  5328. bind: { value: '{packagePath}' },
  5329. },
  5330. {
  5331. xtype: 'textfield',
  5332. fieldLabel: '文件路径',
  5333. allowBlank: false,
  5334. bind: { value: '{fileSavePath}' },
  5335. },
  5336. {
  5337. xtype: 'textfield',
  5338. fieldLabel: '模块名',
  5339. allowBlank: false,
  5340. bind: { value: '{moduleName}' },
  5341. },
  5342. {
  5343. xtype: 'textfield',
  5344. fieldLabel: '菜单名',
  5345. allowBlank: false,
  5346. bind: { value: '{pageTitle}' },
  5347. },
  5348. ]
  5349. },
  5350. ]
  5351. },
  5352. {
  5353. vtitle: '确认结果',
  5354. reference: 'confirmResult',
  5355. layout: 'fit',
  5356. listeners: {
  5357. cardEnter: 'scope.optionEnter',
  5358. cardLevel: 'scope.optionLevel',
  5359. },
  5360. items: [
  5361. {
  5362. xtype: 'jsoneditor',
  5363. reference: 'jsoneditor'
  5364. }
  5365. ]
  5366. },
  5367. // ---------------------------------------------------------------------------------- 单表查询
  5368. {
  5369. vtitle: '查询SQL',
  5370. reference: 'singleTable_1',
  5371. layout: 'fit',
  5372. listeners: {
  5373. cardEnter: 'scope.editorEnter',
  5374. cardLevel: 'scope.editorLevel'
  5375. },
  5376. items: [
  5377. {
  5378. xtype: 'sqleditor',
  5379. }
  5380. ],
  5381. },
  5382. {
  5383. vtitle: '字段选项',
  5384. reference: 'singleTable_2',
  5385. layout: 'fit',
  5386. listeners: {
  5387. cardEnter: 'scope.columnEnter',
  5388. cardLevel: 'scope.columnLevel',
  5389. },
  5390. items: [
  5391. {
  5392. xtype: 'yvgrid',
  5393. border: false,
  5394. selModel: {
  5395. type: 'spreadsheet',
  5396. columnSelect: true,
  5397. pruneRemoved: false,
  5398. extensible: 'y'
  5399. },
  5400. plugins: {
  5401. clipboard: true,
  5402. selectionreplicator: true
  5403. },
  5404. reference: 'grid1',
  5405. idField: 'column_name',
  5406. hideFootbar: true,
  5407. tbar: {
  5408. xtype: 'toolbar',
  5409. items: [
  5410. {
  5411. xtype: 'button',
  5412. text: '添加',
  5413. iconCls: 'x-fa fa-plus-circle',
  5414. listeners: {
  5415. click: 'scope.addField'
  5416. }
  5417. },
  5418. {
  5419. xtype: 'button',
  5420. text: '删除',
  5421. iconCls: 'x-fa fa-minus-circle',
  5422. listeners: {
  5423. click: 'scope.removeField'
  5424. }
  5425. },
  5426. {
  5427. xtype: 'button',
  5428. text: '分析SQL',
  5429. iconCls: 'x-fa fa-refresh',
  5430. listeners: {
  5431. click: 'scope.parseSQL'
  5432. }
  5433. },
  5434. ]
  5435. },
  5436. columns: [
  5437. {
  5438. text: '字段名', dataIndex: 'column_name',
  5439. sortable: false,
  5440. menuDisabled: true,
  5441. width: 150,
  5442. editor: {
  5443. allowBlank: true,
  5444. selectOnFocus: false,
  5445. }
  5446. },
  5447. {
  5448. text: '字段中文', dataIndex: 'column_comment',
  5449. width: 150,
  5450. sortable: false,
  5451. menuDisabled: true,
  5452. editor: {
  5453. allowBlank: true,
  5454. selectOnFocus: false,
  5455. }
  5456. },
  5457. {
  5458. dataIndex: "column_useto",
  5459. // fix: ['system.getDict("column_useto")'],
  5460. header: "用途",
  5461. editor: {
  5462. xtype: 'combo',
  5463. allowBlank: false,
  5464. },
  5465. },
  5466. {
  5467. text: '主键', dataIndex: 'is_primary_key',
  5468. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5469. width: 48, resizable: false,
  5470. },
  5471. {
  5472. text: '必填', dataIndex: 'not_null',
  5473. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5474. width: 48, resizable: false,
  5475. },
  5476. {
  5477. text: '长度', dataIndex: 'column_size',
  5478. sortable: false, menuDisabled: true,
  5479. xtype: 'numbercolumn', format: '0',
  5480. editor: { allowBlank: true, selectOnFocus: true }
  5481. },
  5482. {
  5483. text: '字典', dataIndex: 'column_dict',
  5484. sortable: false, menuDisabled: true,
  5485. width: 200,
  5486. editor: {
  5487. allowBlank: true,
  5488. }
  5489. },
  5490. {
  5491. text: 'UI组件', dataIndex: 'column_ui',
  5492. sortable: false, menuDisabled: true,
  5493. // fix: ['system.getDict("column_ui")'],
  5494. width: 150,
  5495. editor: {
  5496. xtype: 'combo',
  5497. allowBlank: true,
  5498. }
  5499. },
  5500. {
  5501. dataIndex: 'data_type',
  5502. hidden: true,
  5503. },
  5504. ]
  5505. }
  5506. ],
  5507. },
  5508. {
  5509. vtitle: '其他选项',
  5510. reference: 'singleTable_3',
  5511. isEnd: true,
  5512. listeners: {
  5513. cardEnter: 'scope.extendEnter',
  5514. cardLevel: 'scope.extendLevel',
  5515. },
  5516. layout: 'fit',
  5517. items: [
  5518. {
  5519. xtype: 'form',
  5520. border: false,
  5521. layout: {
  5522. type: 'vbox',
  5523. align: 'stretch'
  5524. },
  5525. defaults: {
  5526. border: false,
  5527. anchor: '100%',
  5528. margin: '5',
  5529. },
  5530. items: [
  5531. {
  5532. xtype: 'checkbox',
  5533. fieldLabel: '需要分页',
  5534. labelWidth: 100,
  5535. bind: {
  5536. value: '{singleTable.pagination}',
  5537. },
  5538. },
  5539. {
  5540. xtype: 'combobox',
  5541. fieldLabel: '操作数据库表',
  5542. labelWidth: 100,
  5543. publishes: 'singleTable.tableName',
  5544. displayField: 'value',
  5545. valueField: 'value',
  5546. bind: {
  5547. data: '{singleTableView.tableNameList}',
  5548. value: '{singleTable.tableName}',
  5549. },
  5550. },
  5551. {
  5552. xtype: 'checkboxfield',
  5553. fieldLabel: '需要删除',
  5554. labelWidth: 100,
  5555. bind: {
  5556. value: '{singleTable.delete}',
  5557. },
  5558. },
  5559. {
  5560. xtype: 'combobox',
  5561. fieldLabel: '删除条件字段',
  5562. labelWidth: 100,
  5563. publishes: 'singleTable.deleteWhereColumn',
  5564. displayField: 'value',
  5565. valueField: 'value',
  5566. bind: {
  5567. data: '{singleTableView.columnList}',
  5568. hidden: '{!singleTable.delete}',
  5569. value: '{singleTable.deleteWhereColumn}',
  5570. },
  5571. },
  5572. {
  5573. xtype: 'textfield',
  5574. fieldLabel: '删除提示语句',
  5575. labelWidth: 100,
  5576. bind: {
  5577. hidden: '{!singleTable.delete}',
  5578. value: '{singleTable.deleteTips}',
  5579. },
  5580. },
  5581. {
  5582. fieldLabel: '新增与编辑',
  5583. labelWidth: 100,
  5584. xtype: 'radiogroup',
  5585. bind: {
  5586. value: '{singleTable.editType}'
  5587. },
  5588. layout: 'vbox',
  5589. defaults: {
  5590. border: false,
  5591. anchor: '100%',
  5592. margin: '5',
  5593. },
  5594. items: [
  5595. { boxLabel: '不要新增和编辑', inputValue: 1 },
  5596. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  5597. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  5598. ]
  5599. },
  5600. ]
  5601. }
  5602. ]
  5603. },
  5604. // ---------------------------------------------------------------------------------- 主/明细查询
  5605. {
  5606. vtitle: '主表查询SQL',
  5607. reference: 'mainDetailTable_1',
  5608. layout: 'fit',
  5609. listeners: {},
  5610. items: [],
  5611. },
  5612. {
  5613. vtitle: '主表字段选项',
  5614. reference: 'mainDetailTable_2',
  5615. layout: 'fit',
  5616. listeners: {},
  5617. items: [],
  5618. },
  5619. {
  5620. vtitle: '主表其他选项',
  5621. reference: 'mainDetailTable_3',
  5622. layout: 'fit',
  5623. listeners: {},
  5624. items: [],
  5625. },
  5626. {
  5627. vtitle: '子表查询SQL',
  5628. reference: 'mainDetailTable_4',
  5629. layout: 'fit',
  5630. listeners: {},
  5631. items: [],
  5632. },
  5633. {
  5634. vtitle: '子表字段选项',
  5635. reference: 'mainDetailTable_5',
  5636. layout: 'fit',
  5637. listeners: {},
  5638. items: [],
  5639. },
  5640. {
  5641. vtitle: '子表其他选项',
  5642. reference: 'mainDetailTable_6',
  5643. isEnd: true,
  5644. layout: 'fit',
  5645. listeners: {},
  5646. items: [],
  5647. },
  5648. // ---------------------------------------------------------------------------------- 树/明细查询
  5649. // ---------------------------------------------------------------------------------- 卡片表单
  5650. {
  5651. vtitle: '表单字段',
  5652. reference: 'cardForm_1',
  5653. layout: 'fit',
  5654. listeners: {},
  5655. items: [],
  5656. },
  5657. {
  5658. vtitle: '表单初始化',
  5659. reference: 'cardForm_2',
  5660. isEnd: true,
  5661. layout: 'fit',
  5662. listeners: {},
  5663. items: [],
  5664. },
  5665. ]
  5666. };
  5667. //# sourceMappingURL=CreateModule.view.js.map
  5668. var DbStore = /** @class */ (function (_super) {
  5669. __extends(DbStore, _super);
  5670. function DbStore() {
  5671. return _super !== null && _super.apply(this, arguments) || this;
  5672. }
  5673. DbStore.prototype.getCacheKey = function (param) {
  5674. return "db_data.json";
  5675. };
  5676. DbStore.prototype.invokeApi = function (param) {
  5677. return getMateData(param);
  5678. };
  5679. /**
  5680. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  5681. */
  5682. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  5683. return new Promise(function (resolve, reject) {
  5684. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  5685. resolve(res1);
  5686. // TODO 好像不需要,先跳过
  5687. // reloadByTableName(schema_name, table_name).then(res2 => {
  5688. // resolve(res1)
  5689. // }).catch(e => {
  5690. // reject(e)
  5691. // })
  5692. }).catch(function (e) {
  5693. reject(e);
  5694. });
  5695. });
  5696. };
  5697. /**
  5698. * 保存元数据至表格
  5699. */
  5700. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  5701. var _this = this;
  5702. return new Promise(function (resolve, reject) {
  5703. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  5704. // 保存后重新刷新
  5705. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  5706. resolve({
  5707. data: res2,
  5708. msg: res1.msg
  5709. });
  5710. }).catch(function (e) {
  5711. reject(e);
  5712. });
  5713. }).catch(function (e) {
  5714. reject(e);
  5715. });
  5716. });
  5717. };
  5718. /**
  5719. * 预览生成的 DDL 语句
  5720. */
  5721. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  5722. return new Promise(function (resolve, reject) {
  5723. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  5724. .then(function (res) {
  5725. resolve(res);
  5726. });
  5727. });
  5728. };
  5729. /**
  5730. * 执行 DDL
  5731. */
  5732. DbStore.prototype.pushToDbCommit = function (arg) {
  5733. return new Promise(function (resolve, reject) {
  5734. pushToDbCommitApi(arg).then(function (res) {
  5735. resolve(res);
  5736. }).catch(function (e) {
  5737. reject(e);
  5738. });
  5739. });
  5740. };
  5741. /**
  5742. * 重读某一个表格的 meta 元数据
  5743. */
  5744. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  5745. var _this = this;
  5746. return new Promise(function (resolve, reject) {
  5747. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  5748. if (!res[0] || !res[0].table_list[0]) {
  5749. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  5750. return;
  5751. }
  5752. var tableRow = _this.getTableByName(schema_name, table_name);
  5753. if (!tableRow) {
  5754. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  5755. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  5756. if (!schemaRow) {
  5757. showErrorDialog$1('没有找到 schema:' + schema_name);
  5758. return;
  5759. }
  5760. schemaRow.table_list.push(res[0].table_list[0]);
  5761. }
  5762. else {
  5763. // 找到了目标表格,就吧 table 所有属性都赋值过去
  5764. Object.assign(tableRow, res[0].table_list[0]);
  5765. }
  5766. // 所有界面通知一遍刷新
  5767. _this.notifyRefresh();
  5768. resolve(res);
  5769. }).catch(function (e) {
  5770. reject(e);
  5771. });
  5772. });
  5773. };
  5774. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  5775. var result = undefined;
  5776. _$2.forEach(this.apiResponse, function (schemaRow) {
  5777. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  5778. if (tableRow) {
  5779. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  5780. if (columnRow) {
  5781. result = columnRow;
  5782. return false;
  5783. }
  5784. }
  5785. });
  5786. return result;
  5787. };
  5788. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  5789. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  5790. if (!schemaRow) {
  5791. showErrorDialog$1('没有找到 schema:' + schemaName);
  5792. return;
  5793. }
  5794. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  5795. if (!schemaRow) {
  5796. showErrorDialog$1('没有找到 table:' + tableName);
  5797. return;
  5798. }
  5799. return tableRow;
  5800. };
  5801. /**
  5802. * 添加一个新表格
  5803. */
  5804. DbStore.prototype.appendNewTable = function (tableInfo) {
  5805. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  5806. if (!schemaRow) {
  5807. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  5808. return;
  5809. }
  5810. schemaRow.table_list.push(tableInfo);
  5811. };
  5812. /**
  5813. * 从数据库结构重新生成元数据
  5814. */
  5815. DbStore.prototype.dbToMetaAndReload = function () {
  5816. var _this = this;
  5817. this.notifyLoading(true);
  5818. dbToMeta().then(function () {
  5819. _this.reloadForce(undefined);
  5820. }).catch(function (e) {
  5821. _this.notifyLoading(false);
  5822. });
  5823. };
  5824. DbStore.prototype.getSchemaDbType = function (schemaName) {
  5825. var dbType = undefined;
  5826. _$2.forEach(this.apiResponse, function (schemaRow) {
  5827. if (schemaRow.schema_name === schemaName) {
  5828. dbType = schemaRow.db_type;
  5829. return false;
  5830. }
  5831. });
  5832. return dbType;
  5833. };
  5834. return DbStore;
  5835. }(CacheStore));
  5836. function syncQueryDSL(_a) {
  5837. var schema_name = _a.schema_name, table_name = _a.table_name;
  5838. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  5839. }
  5840. var instance = new DbStore();
  5841. // // 字段域数据
  5842. // let columnDomain = undefined
  5843. // // 元数据
  5844. // let apiResponse = []
  5845. //
  5846. // // 订阅
  5847. // const subscribeList = []
  5848. // /**
  5849. // * 获取全部元数据
  5850. // */
  5851. // export function getApiResponse() {
  5852. // return apiResponse
  5853. // }
  5854. //
  5855. // export function getColumnDomain() {
  5856. // return columnDomain
  5857. // }
  5858. // window['getApiResponse'] = getApiResponse
  5859. // window['getColumnDomain'] = getColumnDomain
  5860. // window['getDbTreeStore'] = function () {
  5861. // return apiResponse
  5862. // }
  5863. //
  5864. // /**
  5865. // * 订阅结果集
  5866. // */
  5867. // export function subscribe(fn) {
  5868. // subscribeList.push(fn)
  5869. // }
  5870. //
  5871. // /**
  5872. // * 取消订阅
  5873. // */
  5874. // export function describe(fn) {
  5875. // _.remove(subscribeList, item => item === fn)
  5876. // }
  5877. //
  5878. // /**
  5879. // * 刷新,如果前端从来没有取到过结果的话
  5880. // * 如果强制刷新成功,就返回 true
  5881. // * 如果没有被强制刷新,返回 false
  5882. // */
  5883. // export function reloadIfNeed() {
  5884. // if (_.size(apiResponse) <= 0) {
  5885. // reloadForce()
  5886. // return true
  5887. // }
  5888. // return false
  5889. // }
  5890. //
  5891. // export function reloadIfNeedPromise() {
  5892. // return new Promise((resolve, reject) => {
  5893. // if (_.size(apiResponse) <= 0) {
  5894. // // 从未有获取过值
  5895. // reloadForce().then(res => {
  5896. // resolve(apiResponse)
  5897. // })
  5898. // return
  5899. // }
  5900. // resolve(apiResponse)
  5901. // return
  5902. // })
  5903. // }
  5904. //
  5905. // /**
  5906. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  5907. // */
  5908. // export function reloadForce() {
  5909. // _.forEach(subscribeList, fn => {
  5910. // fn(true)
  5911. // })
  5912. //
  5913. // return getMateData().then((content) => {
  5914. // apiResponse = content
  5915. // _.forEach(subscribeList, fn => {
  5916. // fn(apiResponse)
  5917. // })
  5918. // }).finally(() => {
  5919. // _.forEach(subscribeList, fn => {
  5920. // fn(false)
  5921. // })
  5922. // })
  5923. // }
  5924. //
  5925. // /**
  5926. // * 通知刷新元数据
  5927. // */
  5928. // export function notifyRefresh() {
  5929. // _.forEach(subscribeList, fn => {
  5930. // fn(apiResponse)
  5931. // })
  5932. // }
  5933. // export function getAllDomain() {
  5934. // return new Promise((resolve, reject) => {
  5935. // getColumnDomainApi()
  5936. // .then(res => {
  5937. // if (res.success) {
  5938. // columnDomain = res.data
  5939. // resolve(res.data)
  5940. // } else {
  5941. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  5942. // console.error('getColumnDomain', res.msg)
  5943. // }
  5944. //
  5945. // })
  5946. // .catch(e => {
  5947. // showErrorDialog('getColumnDomain error!')
  5948. // console.error('getColumnDomain', e)
  5949. // reject(e)
  5950. // })
  5951. // })
  5952. // }
  5953. //# sourceMappingURL=DbStore.js.map
  5954. // noinspection TypeScriptCheckImport
  5955. function getSingleTableData(origin) {
  5956. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  5957. var _a, _b, _c;
  5958. var data = {
  5959. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  5960. package: _$2.replace(origin.packagePath, /\//g, "."),
  5961. groovyClass: origin.moduleName,
  5962. qClass: queryDslInfo.qClass,
  5963. qClassTable: queryDslInfo.qClassTable,
  5964. queryColumns: [],
  5965. insertColumns: [],
  5966. updateColumns: [],
  5967. updateWheres: [],
  5968. deleteWheres: [],
  5969. gridColumns: [],
  5970. sql: origin.sql,
  5971. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  5972. addButton: origin.editType !== 1,
  5973. saveButton: origin.editType === 2,
  5974. deleteButton: true,
  5975. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  5976. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  5977. fileSavePath: origin.fileSavePath,
  5978. };
  5979. origin.columnList.forEach(function (column) {
  5980. 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;
  5981. var query = origin.queryColumns.indexOf(column_name) >= 0;
  5982. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  5983. var update = origin.updateColumns.indexOf(column_name) >= 0;
  5984. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  5985. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  5986. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  5987. if (query) {
  5988. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  5989. }
  5990. if (insert) {
  5991. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  5992. }
  5993. if (update) {
  5994. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  5995. }
  5996. if (grid) {
  5997. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  5998. if (column_dict) {
  5999. gridColumn.fix = { dictName: column_dict };
  6000. }
  6001. if (origin.editType == 2 && (insert || update)) {
  6002. gridColumn.editor = { xtype: column_ui, fix: undefined };
  6003. if (column_dict) {
  6004. gridColumn.editor.fix = { dictName: column_dict };
  6005. }
  6006. }
  6007. data.gridColumns.push(gridColumn);
  6008. }
  6009. if (is_primary_key) {
  6010. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6011. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6012. }
  6013. });
  6014. return data;
  6015. });
  6016. }
  6017. // noinspection HttpUrlsUsage
  6018. var urlPrefix = "/static/studio-template/single_table";
  6019. function generateCode(data) {
  6020. return Promise.all([
  6021. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  6022. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  6023. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  6024. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  6025. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  6026. ]).then(function (values) {
  6027. var groovy = handlebars.compile(values[0]);
  6028. var mybatis = handlebars.compile(values[1]);
  6029. var controller = handlebars.compile(values[2]);
  6030. var view = handlebars.compile(values[3]);
  6031. var model = handlebars.compile(values[4]);
  6032. var code = {
  6033. groovy: groovy(data),
  6034. mybatis: mybatis(data),
  6035. controller: controller(data),
  6036. view: view(data),
  6037. model: model(data),
  6038. };
  6039. return code;
  6040. });
  6041. }
  6042. //# sourceMappingURL=SingleTableCodegen.js.map
  6043. var CreateModule = /** @class */ (function (_super) {
  6044. __extends(CreateModule, _super);
  6045. function CreateModule() {
  6046. var _this = _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  6047. _this.columns = [];
  6048. return _this;
  6049. }
  6050. CreateModule.prototype.onLoad = function () {
  6051. this.refs.grid1.setData([]);
  6052. };
  6053. CreateModule.prototype.addField = function () {
  6054. this.refs.grid1.appendEditRow({
  6055. column_name: '',
  6056. column_comment: '',
  6057. is_primary_key: false,
  6058. not_null: true,
  6059. column_domain: '',
  6060. data_type: '',
  6061. column_size: 0,
  6062. decimal_digits: 0,
  6063. default_value: '',
  6064. column_dict: '',
  6065. column_ui: '',
  6066. column_note: '',
  6067. }, 0);
  6068. };
  6069. CreateModule.prototype.removeField = function () {
  6070. var _this = this;
  6071. var rows = [];
  6072. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6073. rows.push(r);
  6074. });
  6075. _$2.forEach(rows, function (r) {
  6076. _this.refs.grid1.getStore().remove(r);
  6077. });
  6078. };
  6079. CreateModule.prototype.parseSQL = function (sender) {
  6080. var _this = this;
  6081. var sql = this.viewModel.get('singleTable.sql');
  6082. sender.up('window').setLoading(true);
  6083. instance.reloadIfNeedPromise(undefined).then(function (res) {
  6084. parseSqlApi(sql).then(function (parseResult) {
  6085. if (!parseResult.success) {
  6086. msg(parseResult.msg);
  6087. return;
  6088. }
  6089. var tableNameList = [];
  6090. var columnList = [];
  6091. var singleTableTableName;
  6092. var singleTableDeleteWhereColumn;
  6093. _this.refs.grid1.setData([]);
  6094. var rows = _this.refs.grid1.getDataRows();
  6095. _$2.forEach(parseResult.data, function (parseRetColumn) {
  6096. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  6097. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  6098. return;
  6099. }
  6100. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  6101. tableNameList.push({ value: tableName });
  6102. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  6103. columnList.push({ value: columnName });
  6104. if (!singleTableTableName)
  6105. singleTableTableName = tableName;
  6106. if (!singleTableDeleteWhereColumn)
  6107. singleTableDeleteWhereColumn = columnName;
  6108. // 已经加过这个列了
  6109. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  6110. if (rowExists) {
  6111. return;
  6112. }
  6113. var columnRow = instance.getColumnByTableNameColumnName(tableName, columnName);
  6114. if (columnRow) {
  6115. _this.refs.grid1.appendEditRow({
  6116. table_name: tableName,
  6117. column_name: columnRow.column_name,
  6118. column_comment: columnRow.column_comment,
  6119. column_useto: 2,
  6120. is_primary_key: columnRow.is_primary_key,
  6121. not_null: columnRow.not_null,
  6122. column_size: columnRow.column_size,
  6123. column_dict: columnRow.column_dict,
  6124. column_ui: columnRow.column_ui,
  6125. data_type: columnRow.data_type,
  6126. });
  6127. if (columnRow.is_primary_key)
  6128. singleTableDeleteWhereColumn = columnName;
  6129. }
  6130. else {
  6131. _this.refs.grid1.appendEditRow({
  6132. table_name: tableName,
  6133. column_name: columnName,
  6134. column_useto: 2,
  6135. });
  6136. }
  6137. });
  6138. _this.viewModel.set("singleTableView.columnList", columnList);
  6139. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  6140. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  6141. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  6142. }).finally(function () {
  6143. sender.up('window').setLoading(false);
  6144. });
  6145. }).catch(function () {
  6146. sender.up('window').setLoading(false);
  6147. });
  6148. };
  6149. CreateModule.prototype.templateEnter = function (sender) {
  6150. };
  6151. CreateModule.prototype.templateLevel = function (sender, opt) {
  6152. if (!this.viewModel.get('moduleType')) {
  6153. msg('请选择模板类型');
  6154. opt.cancel = true;
  6155. return;
  6156. }
  6157. };
  6158. CreateModule.prototype.moduleEnter = function (sender) {
  6159. };
  6160. CreateModule.prototype.moduleLevel = function (sender, opt) {
  6161. if (!sender.down('form').isValid()) {
  6162. opt.cancel = true;
  6163. return;
  6164. }
  6165. };
  6166. CreateModule.prototype.editorEnter = function (sender) {
  6167. var editor = sender.down('sqleditor');
  6168. editor.setValue(this.viewModel.get('singleTable.sql'));
  6169. };
  6170. CreateModule.prototype.editorLevel = function (sender, opt) {
  6171. var editor = sender.down('sqleditor');
  6172. var sql = editor.getValue();
  6173. if (!sql) {
  6174. msg('查询SQL语句必填');
  6175. opt.cancel = true;
  6176. return;
  6177. }
  6178. this.viewModel.set('singleTable.sql', sql);
  6179. };
  6180. CreateModule.prototype.columnEnter = function (sender) {
  6181. };
  6182. CreateModule.prototype.columnLevel = function (sender, opt) {
  6183. };
  6184. CreateModule.prototype.extendEnter = function (sender) {
  6185. };
  6186. CreateModule.prototype.extendLevel = function (sender, opt) {
  6187. };
  6188. // 确认结果 - Enter
  6189. CreateModule.prototype.optionEnter = function (sender) {
  6190. var _this = this;
  6191. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6192. var moduleType = this.viewModel.get("moduleType");
  6193. var data = this.viewModel.getData();
  6194. var code = "";
  6195. var origin = {};
  6196. if (moduleType === 1) {
  6197. var singleTable = data.singleTable;
  6198. var editColumns = this.refs.grid1.getDataRows();
  6199. origin.moduleType = data.moduleType;
  6200. origin.packagePath = data.packagePath;
  6201. origin.fileSavePath = data.fileSavePath;
  6202. origin.moduleName = data.moduleName;
  6203. origin.pageTitle = data.pageTitle;
  6204. if (singleTable) {
  6205. origin.sql = singleTable.sql;
  6206. origin.tableName = singleTable.tableName;
  6207. origin.pagination = singleTable.pagination;
  6208. origin.delete = singleTable.delete;
  6209. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  6210. origin.deleteTips = singleTable.deleteTips;
  6211. origin.editType = singleTable.editType;
  6212. }
  6213. origin.columnList = [];
  6214. origin.queryColumns = [];
  6215. origin.insertColumns = [];
  6216. origin.updateColumns = [];
  6217. origin.gridColumns = [];
  6218. editColumns.forEach(function (column) {
  6219. var row = {
  6220. table_name: column.table_name,
  6221. column_name: column.column_name,
  6222. column_comment: column.column_comment,
  6223. is_primary_key: column.is_primary_key,
  6224. not_null: column.not_null,
  6225. column_size: column.column_size,
  6226. column_dict: column.column_dict,
  6227. column_ui: column.column_ui,
  6228. data_type: column.data_type,
  6229. column_type: column.column_type,
  6230. };
  6231. origin.columnList.push(row);
  6232. // 1:查询条件; 2:查询结果; 3:条件+结果;
  6233. var column_name = column.column_name, column_useto = column.column_useto;
  6234. switch (column_useto) {
  6235. case 1:
  6236. origin.queryColumns.push(column_name);
  6237. break;
  6238. case 2:
  6239. origin.gridColumns.push(column_name);
  6240. break;
  6241. case 3:
  6242. origin.queryColumns.push(column_name);
  6243. origin.gridColumns.push(column_name);
  6244. break;
  6245. }
  6246. origin.insertColumns.push(column_name);
  6247. origin.updateColumns.push(column_name);
  6248. });
  6249. }
  6250. this.setLoading(true);
  6251. getSingleTableData(origin).then(function (data) {
  6252. code = JSON.stringify(data, null, 4);
  6253. window['lastTemplateData'] = code;
  6254. var editor = _this.refs.jsoneditor;
  6255. editor.setCode(code);
  6256. }).finally(function () { return _this.setLoading(false); });
  6257. };
  6258. // 确认结果 - Level
  6259. CreateModule.prototype.optionLevel = function (sender, opt) {
  6260. };
  6261. // 上一步
  6262. CreateModule.prototype.showPrevious = function () {
  6263. this.doCardNavigation(false);
  6264. };
  6265. // 下一步
  6266. CreateModule.prototype.showNext = function () {
  6267. this.doCardNavigation(true, true);
  6268. };
  6269. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  6270. if (isNext === void 0) { isNext = true; }
  6271. if (isCancelable === void 0) { isCancelable = false; }
  6272. var layout = this._handle.getLayout();
  6273. var activeItem = layout.activeItem;
  6274. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  6275. if (isNext)
  6276. this.prevCard = reference;
  6277. var activeCard;
  6278. if (reference === "templateSelection") {
  6279. if (isNext) {
  6280. activeCard = this.refs['moduleName'];
  6281. }
  6282. }
  6283. else if (reference === "moduleName") {
  6284. if (isNext) {
  6285. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6286. var moduleType = this.viewModel.get("moduleType");
  6287. switch (moduleType) {
  6288. case 1:
  6289. activeCard = this.refs['singleTable_1'];
  6290. break;
  6291. case 2:
  6292. activeCard = this.refs['mainDetailTable_1'];
  6293. break;
  6294. case 3:
  6295. // activeCard =
  6296. break;
  6297. case 4:
  6298. activeCard = this.refs['cardForm_1'];
  6299. break;
  6300. }
  6301. }
  6302. else {
  6303. activeCard = this.refs['templateSelection'];
  6304. }
  6305. }
  6306. else if (reference === "confirmResult") {
  6307. if (!isNext) {
  6308. activeCard = this.refs[this.prevCard];
  6309. }
  6310. }
  6311. else {
  6312. var name = reference.split('_')[0];
  6313. var idx = parseInt(reference.split('_')[1], 10);
  6314. if (isNext) {
  6315. if (isEnd) {
  6316. activeCard = this.refs['confirmResult'];
  6317. }
  6318. else {
  6319. idx += 1;
  6320. }
  6321. }
  6322. else {
  6323. idx -= 1;
  6324. }
  6325. if (idx <= 0) {
  6326. activeCard = this.refs['moduleName'];
  6327. }
  6328. else if (!activeCard) {
  6329. activeCard = this.refs[name + "_" + idx];
  6330. }
  6331. }
  6332. // 按钮状态
  6333. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  6334. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  6335. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  6336. // 设置下一页显示
  6337. if (activeCard) {
  6338. var optCancel = { cancel: false };
  6339. // 发出 cardLevel 事件
  6340. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  6341. if (isCancelable && optCancel.cancel) {
  6342. // 取消了
  6343. return;
  6344. }
  6345. layout.setActiveItem(activeCard);
  6346. this.viewModel.set('title', layout.activeItem.vtitle);
  6347. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  6348. }
  6349. };
  6350. // 立刻执行
  6351. CreateModule.prototype.finish = function (sender) {
  6352. var _this = this;
  6353. var parent = sender.up('window');
  6354. var editor = this.refs.jsoneditor;
  6355. var data = JSON.parse(editor.getCode());
  6356. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6357. var moduleType = this.viewModel.get("moduleType");
  6358. if (moduleType === 1) {
  6359. this.setLoading(true);
  6360. generateCode(data).then(function (code) {
  6361. console.log("===> ", code);
  6362. _this.setLoading(true);
  6363. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  6364. .then(function () {
  6365. msg("创建成功!");
  6366. parent.close();
  6367. handles$1.fileTree.reload();
  6368. }).finally(function () { return _this.setLoading(false); });
  6369. }).finally(function () { return _this.setLoading(false); });
  6370. }
  6371. };
  6372. return CreateModule;
  6373. }(Scope));
  6374. //# sourceMappingURL=CreateModule.js.map
  6375. function getModuleId(path) {
  6376. var separator = "/";
  6377. var sps = path.split(separator);
  6378. var joinSps = sps.join('$');
  6379. if (!joinSps) {
  6380. return "ROOT";
  6381. }
  6382. return joinSps;
  6383. }
  6384. /**
  6385. * Module数据转换成Tree数据
  6386. */
  6387. function modulesToTreeData(modules) {
  6388. var separator = "/";
  6389. var treeNodeMap = new Map();
  6390. var root = {
  6391. type: "Dir",
  6392. path: "",
  6393. expanded: true,
  6394. leaf: false,
  6395. children: [],
  6396. };
  6397. root.id = getModuleId(root.path);
  6398. treeNodeMap.set(root.path, root);
  6399. modules.forEach(function (module) {
  6400. var _a;
  6401. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  6402. if (paths.length <= 0)
  6403. return;
  6404. var path = [];
  6405. var parent = root;
  6406. paths.forEach(function (dirName, idx) {
  6407. var parentPath = path.join(separator);
  6408. parent = treeNodeMap.get(parentPath);
  6409. path.push(dirName);
  6410. var currentPath = path.join(separator);
  6411. var child = treeNodeMap.get(currentPath);
  6412. if (child == null) {
  6413. // 获取当前path 绝对路径
  6414. var indexLength = module.absolutePath.indexOf(currentPath);
  6415. var currentAbsolutePath = "";
  6416. if (indexLength > 0) {
  6417. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  6418. }
  6419. child = {
  6420. type: "Dir",
  6421. path: currentPath,
  6422. absolutePath: currentAbsolutePath,
  6423. leaf: false,
  6424. children: [],
  6425. text: dirName
  6426. };
  6427. child.id = getModuleId(child.path);
  6428. parent.children.push(child);
  6429. treeNodeMap.set(child.path, child);
  6430. }
  6431. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  6432. var leaf = {
  6433. type: "Module",
  6434. path: module.path + separator + module.name,
  6435. absolutePath: module.absolutePath,
  6436. leaf: true,
  6437. text: module.name,
  6438. module: module,
  6439. };
  6440. leaf.id = getModuleId(leaf.path);
  6441. child.children.push(leaf);
  6442. treeNodeMap.set(leaf.path, leaf);
  6443. }
  6444. });
  6445. });
  6446. // 排序处理
  6447. treeNodeMap.forEach(function (module) {
  6448. if (module.children) {
  6449. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  6450. module.children.length = 0;
  6451. children.forEach(function (item) { return module.children.push(item); });
  6452. }
  6453. });
  6454. return root;
  6455. }
  6456. function showDialog(sender, option) {
  6457. var _a, _b;
  6458. var win = new Ext.Window({
  6459. autoDestroy: true,
  6460. title: option.title,
  6461. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  6462. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  6463. resizable: false,
  6464. closable: true,
  6465. modal: true,
  6466. maximizable: false,
  6467. minimizable: false,
  6468. // constrainHeader: true,
  6469. constrain: true,
  6470. layout: 'fit',
  6471. animateTarget: sender,
  6472. buttonAlign: 'center',
  6473. items: [
  6474. {
  6475. xtype: "form",
  6476. layout: "hbox",
  6477. margin: '10px 20px',
  6478. border: 0,
  6479. items: option.items
  6480. }
  6481. ],
  6482. //窗口按钮
  6483. fbar: [
  6484. {
  6485. xtype: 'button', text: '保存', handler: function (btn) {
  6486. //窗口获取表单
  6487. var form = win.down('form');
  6488. var vaildSuccess = form.isValid();
  6489. if (!vaildSuccess) {
  6490. return;
  6491. }
  6492. option.submitFunc(form);
  6493. }
  6494. },
  6495. {
  6496. xtype: 'button', text: '取消', handler: function (btn) {
  6497. //窗口关闭
  6498. btn.up('window').close();
  6499. }
  6500. }
  6501. ],
  6502. });
  6503. win.show();
  6504. }
  6505. function showCreateFolderWin(sender, parentPath) {
  6506. showDialog(sender, {
  6507. title: '新建文件夹',
  6508. height: 150,
  6509. items: [
  6510. {
  6511. xtype: "textfield",
  6512. name: "filename",
  6513. fieldLabel: "文件夹名称",
  6514. allowBlank: false,
  6515. selectOnFocus: true,
  6516. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  6517. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  6518. labelWidth: 80,
  6519. width: "100%",
  6520. listeners: {
  6521. afterrender: function (sender) {
  6522. _$2.defer(function () {
  6523. sender.focus();
  6524. });
  6525. }
  6526. }
  6527. },
  6528. ],
  6529. submitFunc: function (form) {
  6530. var filename = form.down('textfield[name="filename"]').getValue();
  6531. createFolder(parentPath, filename).then(function (res) {
  6532. if (res.success) {
  6533. msg$1('创建成功');
  6534. handles$1.fileTree.reload();
  6535. form.up('window').close();
  6536. }
  6537. else {
  6538. showErrorDialog$1(res.msg);
  6539. }
  6540. }).catch(function (e) {
  6541. showErrorDialog$1(e.responseJSON.msg);
  6542. });
  6543. }
  6544. });
  6545. }
  6546. function showCreateModuleCrudWin(sender, path, absolutePath) {
  6547. var dlg = new CreateModule();
  6548. dlg.showDialog(sender, {}, {
  6549. data: {
  6550. packagePath: path,
  6551. fileSavePath: absolutePath,
  6552. }
  6553. });
  6554. }
  6555. function registerModule$1(sender, path, name, icon) {
  6556. // 前缀 com/galaxis/wms 写死了
  6557. var dlg = new RegisterModule();
  6558. dlg.showDialog(sender, {}, {
  6559. data: {
  6560. form: {
  6561. scope_url: path.replace("com/galaxis/wms", "."),
  6562. resource_name: name,
  6563. resource_icon: icon,
  6564. }
  6565. }
  6566. });
  6567. }
  6568. function showCreateEmptyModule(sender, path) {
  6569. var win = new Ext.Window({
  6570. autoDestroy: true,
  6571. title: "新建空模块",
  6572. width: 400,
  6573. height: 150,
  6574. resizable: true,
  6575. closable: true,
  6576. maximizable: true,
  6577. minimizable: true,
  6578. plain: true,
  6579. // constrainHeader: true,
  6580. constrain: true,
  6581. layout: 'fit',
  6582. animateTarget: sender,
  6583. buttonAlign: 'center',
  6584. items: [
  6585. {
  6586. xtype: "form",
  6587. layout: "hbox",
  6588. margin: '10px 20px',
  6589. border: 0,
  6590. items: [
  6591. {
  6592. flex: 1,
  6593. layout: 'vbox',
  6594. items: [
  6595. {
  6596. xtype: "textfield",
  6597. name: "filename",
  6598. fieldLabel: "模块名",
  6599. flex: 1,
  6600. allowBlank: false,
  6601. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  6602. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  6603. labelWidth: 50,
  6604. width: "100%",
  6605. },
  6606. ]
  6607. },
  6608. ]
  6609. }
  6610. ],
  6611. //窗口按钮
  6612. buttons: [
  6613. {
  6614. xtype: 'button', text: '保存', handler: function (btn) {
  6615. //窗口获取表单
  6616. var form = win.down('form');
  6617. var vaildSuccess = form.isValid();
  6618. if (!vaildSuccess) {
  6619. return;
  6620. }
  6621. var filename = form.down('textfield[name="filename"]').getValue();
  6622. createEmptyModule(path, filename).then(function (res) {
  6623. if (res.success) {
  6624. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  6625. handles$1.fileTree.reload();
  6626. win.close();
  6627. }
  6628. else {
  6629. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  6630. }
  6631. }).catch(function (e) {
  6632. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  6633. });
  6634. }
  6635. },
  6636. {
  6637. xtype: 'button', text: '取消', handler: function (btn) {
  6638. //窗口关闭
  6639. win.close();
  6640. }
  6641. }
  6642. ]
  6643. });
  6644. win.show();
  6645. }
  6646. //# sourceMappingURL=FileHelp.js.map
  6647. function initFileTree () {
  6648. Ext.define('com.yvan.studio.FileTree', {
  6649. extend: 'com.yvan.studio.StateTree',
  6650. xtype: 'filetree',
  6651. tooltip: '文件',
  6652. iconCls: 'x-fa fa-file',
  6653. rootVisible: false,
  6654. useArrows: true,
  6655. colspan: 2,
  6656. lines: true,
  6657. reference: 'filetree',
  6658. multiSelect: true,
  6659. getStateFilename: function () {
  6660. return getCurrentProject().uuid + "/filetree.json";
  6661. },
  6662. openNode: function () {
  6663. var selection = this.getSelection();
  6664. var _a = __read(selection, 1), record = _a[0];
  6665. if (!record) {
  6666. return;
  6667. }
  6668. var raw = record.raw;
  6669. if (raw.type === 'Dir') {
  6670. return;
  6671. }
  6672. if (raw.type === "Module" && raw.module) {
  6673. eventBus.publish(EventType.ModuleOpen, raw);
  6674. }
  6675. },
  6676. openInIdea: function () {
  6677. var _a = __read(this.getSelection(), 1), record = _a[0];
  6678. if (record) {
  6679. var data = record.data;
  6680. if (data.type === "Module") {
  6681. if (data.module.groovyFile && data.module.groovyFile.exists) {
  6682. native.openInIdea(data.module.groovyFile.absolutePath);
  6683. }
  6684. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  6685. native.openInIdea(data.module.jsControllerFile.absolutePath);
  6686. }
  6687. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  6688. native.openInIdea(data.module.jsViewFile.absolutePath);
  6689. }
  6690. return;
  6691. }
  6692. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  6693. }
  6694. },
  6695. deleteSelection: function () {
  6696. var selection = this.getSelection();
  6697. var pathList = [];
  6698. _.forEach(selection, function (item) {
  6699. if (item.data.type === "Dir") {
  6700. pathList.push({ path: item.data.path, isFolder: true });
  6701. }
  6702. else {
  6703. pathList.push({ path: item.data.path, isFolder: false });
  6704. }
  6705. });
  6706. {
  6707. return;
  6708. }
  6709. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  6710. //
  6711. // Ext.Msg.confirm('提示', title, (btn) => {
  6712. // if (btn === 'yes') {
  6713. // deleteFileOrFolder(raw.path, title, true)
  6714. // }
  6715. // })
  6716. // const title = '您确定要删除(' + raw.path + ')吗?'
  6717. // deleteFileOrFolder(raw.path, title, false)
  6718. },
  6719. listeners: {
  6720. itemverify: function () {
  6721. this.openNode();
  6722. },
  6723. afterrender: function (me) {
  6724. console.log('filetree_afterrender', 'reloadIfNeed');
  6725. moduleStore.registe(me.subscribeModule.bind(this));
  6726. moduleStore.reloadIfNeed("PC");
  6727. },
  6728. destroy: function (me) {
  6729. console.log('filetree_destroy');
  6730. moduleStore.unregiste(me.subscribeModule.bind(this));
  6731. },
  6732. itemcontextmenu: function (sender, node, element, idx, e) {
  6733. e.preventDefault();
  6734. var raw = node.raw;
  6735. var option = {};
  6736. if (raw.type === 'Dir') {
  6737. // 文件夹右键
  6738. option = {
  6739. shadow: 'frame', allowOtherMenus: true,
  6740. items: [
  6741. {
  6742. text: '新建空模块',
  6743. iconCls: 'x-fa fa-plus-circle',
  6744. handler: function (sender) {
  6745. showCreateEmptyModule(sender, raw.path);
  6746. }
  6747. },
  6748. {
  6749. text: '新建模块',
  6750. iconCls: 'x-fa fa-plus-circle',
  6751. handler: function (sender) {
  6752. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  6753. }
  6754. },
  6755. '-',
  6756. {
  6757. text: '新建文件夹',
  6758. iconCls: 'x-fa fa-folder-o',
  6759. handler: function (sender) {
  6760. var parentPath = raw.path;
  6761. showCreateFolderWin(sender, parentPath);
  6762. }
  6763. },
  6764. {
  6765. text: '复制路径',
  6766. iconCls: 'x-fa fa-external-link',
  6767. handler: function (sender) {
  6768. native.clipboardSet(raw.path);
  6769. }
  6770. },
  6771. ]
  6772. };
  6773. }
  6774. else {
  6775. // 文件右键
  6776. option = {
  6777. shadow: 'frame', allowOtherMenus: true,
  6778. items: [
  6779. // {
  6780. // text: '重命名',
  6781. // iconCls: 'x-fa fa-terminal',
  6782. // handler(sender) {
  6783. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  6784. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  6785. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  6786. // }
  6787. // },
  6788. // {
  6789. // text: '另存为',
  6790. // iconCls: 'x-fa fa-exchange',
  6791. // handler(sender) {
  6792. // console.error('没做')
  6793. // }
  6794. // },
  6795. {
  6796. text: '复制路径',
  6797. iconCls: 'x-fa fa-external-link',
  6798. handler: function (sender) {
  6799. native.clipboardSet(raw.path);
  6800. }
  6801. },
  6802. '-',
  6803. {
  6804. text: '注册模块',
  6805. iconCls: 'x-fa fa-sign-in',
  6806. handler: function (sender) {
  6807. registerModule$1(sender, raw.path);
  6808. }
  6809. },
  6810. ]
  6811. };
  6812. }
  6813. var treeMenu = new Ext.menu.Menu(option);
  6814. treeMenu.showAt(e.getXY());
  6815. },
  6816. },
  6817. tbar: [
  6818. {
  6819. xtype: 'button',
  6820. iconCls: 'x-fa fa-crosshairs',
  6821. tooltip: '选中当前打开的文件',
  6822. handler: function (sender) {
  6823. msg$1('没做');
  6824. }
  6825. },
  6826. {
  6827. xtype: 'button',
  6828. iconCls: 'x-fa fa-link',
  6829. tooltip: '在IDEA中打开',
  6830. handler: function (sender) {
  6831. var scope = sender.up("filetree");
  6832. scope.openInIdea();
  6833. }
  6834. },
  6835. {
  6836. xtype: 'button',
  6837. iconCls: 'x-fa fa-refresh',
  6838. tooltip: '刷新',
  6839. handler: function (sender) {
  6840. var scope = sender.up("filetree");
  6841. scope.reload();
  6842. }
  6843. },
  6844. {
  6845. xtype: 'button',
  6846. iconCls: 'x-fa fa-percent',
  6847. tooltip: '监控',
  6848. handler: function (sender) {
  6849. // handles.mainWindow.showPerform()
  6850. }
  6851. },
  6852. ],
  6853. initComponent: function () {
  6854. setFileTree(this);
  6855. this.superclass.initComponent.apply(this, arguments);
  6856. // super.initComponent.apply(this, arguments)
  6857. },
  6858. subscribeModule: function (res) {
  6859. if (typeof res === 'object') {
  6860. var rootNode = modulesToTreeData(res.data);
  6861. this.setRootNode(rootNode);
  6862. this.restoreState();
  6863. handles$1.mainWindow.modules = res.data;
  6864. }
  6865. else if (typeof res === 'boolean') {
  6866. this.setLoading(res);
  6867. }
  6868. },
  6869. reload: function () {
  6870. console.log('filetree_reloadForce');
  6871. moduleStore.reloadForce("PC").then(function (res) {
  6872. });
  6873. }
  6874. });
  6875. }
  6876. //# sourceMappingURL=FileTree.js.map
  6877. function initDbTree () {
  6878. var define = {
  6879. extend: 'com.yvan.studio.StateTree',
  6880. xtype: 'dbtree',
  6881. tooltip: '数据库',
  6882. iconCls: 'x-fa fa-database',
  6883. rootVisible: false,
  6884. useArrows: true,
  6885. reference: 'dbtree',
  6886. multiSelect: true,
  6887. getStateFilename: function () {
  6888. return getCurrentProject().uuid + "/dbtree.json";
  6889. },
  6890. tbar: [
  6891. {
  6892. xtype: 'button',
  6893. iconCls: 'x-fa fa-crosshairs',
  6894. tooltip: '选中当前打开的表',
  6895. handler: function (sender) {
  6896. var _a;
  6897. // 获取当前选中的活动标签 tableColumn_bas_car
  6898. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  6899. if (!locatPath) {
  6900. return;
  6901. }
  6902. handles$1.dbTree.selectPath(locatPath);
  6903. }
  6904. },
  6905. {
  6906. xtype: 'button',
  6907. iconCls: 'x-fa fa-refresh',
  6908. tooltip: '刷新',
  6909. handler: function (sender) {
  6910. handles$1.dbTree.reload();
  6911. }
  6912. },
  6913. {
  6914. xtype: 'button',
  6915. iconCls: 'x-fa fa-cloud-download',
  6916. tooltip: '重新拉取生成元数据(耗时很长!)',
  6917. handler: function (sender) {
  6918. handles$1.dbTree.dbToMetaAndReload(sender);
  6919. }
  6920. },
  6921. // {
  6922. // xtype: 'button',
  6923. // iconCls: 'x-fa fa-files-o',
  6924. // tooltip: '数据同步',
  6925. // handler(sender) {
  6926. //
  6927. // }
  6928. // },
  6929. {
  6930. xtype: 'button',
  6931. iconCls: 'x-fa fa-exchange',
  6932. tooltip: '数据结构同步',
  6933. handler: function (sender) {
  6934. // handles.mainWindow.showDataSync(sender)
  6935. }
  6936. },
  6937. {
  6938. xtype: 'button',
  6939. iconCls: 'x-fa fa-window-maximize',
  6940. tooltip: 'SQL查询分析器',
  6941. handler: function (sender) {
  6942. // handles.mainWindow.showDbCodeTemplate(sender)
  6943. }
  6944. },
  6945. {
  6946. xtype: 'button',
  6947. iconCls: 'x-fa fa-cubes',
  6948. tooltip: '数据域管理',
  6949. handler: function (sender) {
  6950. // handles.mainWindow.showColumnDomain()
  6951. }
  6952. },
  6953. {
  6954. xtype: 'button',
  6955. iconCls: 'x-fa fa-edit',
  6956. tooltip: '修改结构',
  6957. handler: function (sender) {
  6958. var tree = sender.up("treepanel");
  6959. var selection = tree.getSelection();
  6960. var _a = __read(selection, 1), node = _a[0];
  6961. if (!node) {
  6962. msg$1('请选择一个表');
  6963. return;
  6964. }
  6965. var raw = node.data.raw;
  6966. if (node.get('type') === 'table') ;
  6967. else if (node.get('type') === 'column') ;
  6968. }
  6969. },
  6970. ],
  6971. listeners: {
  6972. afterrender: function (me) {
  6973. setDbTree(this);
  6974. // 找管理器订阅刷新的事件
  6975. instance.registe(this.refreshData.bind(this));
  6976. instance.reloadIfNeed(undefined);
  6977. },
  6978. destory: function (me) {
  6979. setDbTree(undefined);
  6980. instance.unregiste(this.refreshData.bind(this));
  6981. },
  6982. itemcontextmenu: function (sender, node, element, idx, e) {
  6983. var _this = this;
  6984. e.preventDefault();
  6985. var option = {};
  6986. var raw = node.raw.raw;
  6987. if (node.get('type') === 'column') {
  6988. option = {
  6989. shadow: 'frame', allowOtherMenus: true,
  6990. items: [
  6991. {
  6992. text: '设计结构',
  6993. iconCls: 'x-fa fa-edit',
  6994. handler: function (sender) {
  6995. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  6996. }
  6997. },
  6998. ]
  6999. };
  7000. }
  7001. else if (node.get('type') === 'table') {
  7002. option = {
  7003. shadow: 'frame', allowOtherMenus: true,
  7004. items: [
  7005. {
  7006. text: '新建',
  7007. iconCls: 'x-fa fa-plus',
  7008. handler: function (sender) {
  7009. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  7010. }
  7011. },
  7012. {
  7013. text: '设计结构',
  7014. iconCls: 'x-fa fa-edit',
  7015. handler: function (sender) {
  7016. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  7017. }
  7018. },
  7019. {
  7020. text: '重命名',
  7021. iconCls: 'x-fa fa-pencil',
  7022. handler: function (sender) {
  7023. _this.renameTable(sender, node.data.raw);
  7024. }
  7025. },
  7026. '-',
  7027. {
  7028. text: '删除',
  7029. iconCls: 'x-fa fa-minus',
  7030. handler: function (sender) {
  7031. _this.removeTable(sender, node.data.raw);
  7032. }
  7033. },
  7034. ]
  7035. };
  7036. }
  7037. var treeMenu = new Ext.menu.Menu(option);
  7038. treeMenu.showAt(e.getXY());
  7039. }
  7040. },
  7041. // DbTreeStore 刷新时,会回调到这个方法
  7042. refreshData: function (isLoadingState) {
  7043. var me = this;
  7044. if (typeof isLoadingState === 'boolean') {
  7045. me.setLoading(isLoadingState);
  7046. return;
  7047. }
  7048. var rootNode = getDbTree(instance.apiResponse);
  7049. me.setRootNode(rootNode);
  7050. this.restoreState();
  7051. },
  7052. renameTable: function (sender, tableRow) {
  7053. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  7054. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  7055. if (!res.data)
  7056. return;
  7057. var window = Ext.create('Ext.window.Window', {
  7058. title: 'SQL 预览',
  7059. height: 400,
  7060. width: 600,
  7061. modal: true,
  7062. animateTarget: sender,
  7063. maximizable: true,
  7064. layout: 'fit',
  7065. items: {
  7066. xtype: 'sqleditor',
  7067. value: res.data,
  7068. },
  7069. buttons: [
  7070. {
  7071. xtype: 'button',
  7072. text: '执行',
  7073. iconCls: 'x-fa fa-save',
  7074. handler: function (sender) {
  7075. var editor = sender.up('window').down('sqleditor');
  7076. var ddl = editor.getValue();
  7077. window.setLoading(true);
  7078. instance.pushToDbCommit({
  7079. schema_name: tableRow.schema_name,
  7080. table_name: name,
  7081. old_table_name: tableRow.table_name,
  7082. ddl: ddl,
  7083. }).then(function () {
  7084. handles$1.dbTree.reload();
  7085. window.close();
  7086. }).finally(function () { return window.setLoading(false); });
  7087. },
  7088. },
  7089. {
  7090. xtype: 'button',
  7091. text: '取消',
  7092. iconCls: 'x-fa fa-times',
  7093. handler: function () {
  7094. window.close();
  7095. }
  7096. },
  7097. ]
  7098. }).show();
  7099. });
  7100. });
  7101. },
  7102. removeTable: function (sender, tableRow) {
  7103. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  7104. if (!res.data)
  7105. return;
  7106. var window = Ext.create('Ext.window.Window', {
  7107. title: 'SQL 预览',
  7108. height: 400,
  7109. width: 600,
  7110. modal: true,
  7111. animateTarget: sender,
  7112. maximizable: true,
  7113. layout: 'fit',
  7114. items: {
  7115. xtype: 'sqleditor',
  7116. value: res.data,
  7117. },
  7118. buttons: [
  7119. {
  7120. xtype: 'button',
  7121. text: '执行',
  7122. iconCls: 'x-fa fa-save',
  7123. handler: function (sender) {
  7124. var editor = sender.up('window').down('sqleditor');
  7125. var ddl = editor.getValue();
  7126. window.setLoading(true);
  7127. instance.pushToDbCommit({
  7128. schema_name: tableRow.schema_name,
  7129. table_name: tableRow.table_name,
  7130. ddl: ddl
  7131. })
  7132. .then(function () {
  7133. handles$1.dbTree.reload();
  7134. window.close();
  7135. }).finally(function () { return window.setLoading(false); });
  7136. }
  7137. },
  7138. {
  7139. xtype: 'button',
  7140. text: '取消',
  7141. iconCls: 'x-fa fa-times',
  7142. handler: function () {
  7143. window.close();
  7144. }
  7145. }
  7146. ]
  7147. }).show();
  7148. });
  7149. },
  7150. // hideHeaders: true,
  7151. // columns: [
  7152. // {
  7153. // xtype: 'treecolumn',
  7154. // text: '名称',
  7155. // dataIndex: 'text',
  7156. // flex: 2,
  7157. // }, {
  7158. // text: '描述',
  7159. // dataIndex: 'comment',
  7160. // flex: 1,
  7161. // }
  7162. // ],
  7163. reload: function () {
  7164. // 强制刷新 DbManager
  7165. instance.reloadForce(undefined);
  7166. },
  7167. dbToMetaAndReload: function () {
  7168. // 从数据库结构重新生成元数据
  7169. instance.dbToMetaAndReload();
  7170. }
  7171. };
  7172. Ext.define('com.yvan.studio.DbTree', define);
  7173. }
  7174. /**
  7175. * 将数据构建成 dbTree 需要的格式
  7176. */
  7177. function getDbTree(apiResponse) {
  7178. var rootNode = {
  7179. children: [],
  7180. expanded: true,
  7181. id: "ROOT",
  7182. leaf: false,
  7183. };
  7184. _$2.forEach(apiResponse, function (schemaRow) {
  7185. var schemaNode = {
  7186. id: 'schema$' + schemaRow.schema_name,
  7187. type: "schema",
  7188. expanded: true,
  7189. leaf: false,
  7190. iconCls: 'x-fa fa-th-large ',
  7191. text: schemaRow.schema_name,
  7192. raw: __assign({}, schemaRow),
  7193. children: [],
  7194. };
  7195. delete schemaNode.raw.table_list;
  7196. rootNode.children.push(schemaNode);
  7197. _$2.forEach(schemaRow.table_list, function (tableRow) {
  7198. var _a;
  7199. var tableNode = {
  7200. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  7201. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  7202. comment: tableRow.description,
  7203. type: "table",
  7204. iconCls: 'x-fa fa-table',
  7205. expanded: false,
  7206. leaf: false,
  7207. children: [],
  7208. raw: __assign({}, tableRow)
  7209. };
  7210. delete tableNode.raw.column_list;
  7211. schemaNode.children.push(tableNode);
  7212. _$2.forEach(tableRow.column_list, function (columnRow) {
  7213. var _a;
  7214. var iconCls = 'x-fa fa-square-o';
  7215. if (columnRow.is_primary_key) {
  7216. iconCls = 'x-fa fa-key';
  7217. }
  7218. else if (columnRow.not_null) {
  7219. iconCls = 'x-fa fa-check-square';
  7220. }
  7221. var columnNode = {
  7222. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  7223. type: "column",
  7224. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  7225. comment: columnRow.column_comment,
  7226. leaf: true,
  7227. iconCls: iconCls,
  7228. raw: __assign({}, columnRow)
  7229. };
  7230. tableNode.children.push(columnNode);
  7231. }); // column
  7232. }); // table
  7233. }); // schema
  7234. return rootNode;
  7235. }
  7236. //# sourceMappingURL=DbTree.js.map
  7237. var ReportGridController = /** @class */ (function () {
  7238. function ReportGridController() {
  7239. }
  7240. ReportGridController.prototype.onLoad = function (sender) {
  7241. this.reload();
  7242. setReport(this);
  7243. };
  7244. ReportGridController.prototype.showSingle = function (sender) {
  7245. var _this = this;
  7246. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7247. if (record) {
  7248. handles.mainWindow.showFormSingle(record.data, function () {
  7249. _this.reload();
  7250. });
  7251. }
  7252. };
  7253. ReportGridController.prototype.filterChanged = function (sender, value) {
  7254. console.log('filterChange', sender, value);
  7255. this.view.store.clearFilter();
  7256. if (value) {
  7257. this.view.store.filterBy(function (record) {
  7258. var code = _.lowerCase(record.get('report_name'));
  7259. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  7260. return (code.includes(value) ||
  7261. dict_desc_py.includes(value));
  7262. });
  7263. }
  7264. };
  7265. ReportGridController.prototype.onClearClick = function () {
  7266. var _a, _b;
  7267. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  7268. };
  7269. ReportGridController.prototype.reload = function () {
  7270. var me = this;
  7271. me.getView().setLoading(true);
  7272. reportListApi().then(function (res) {
  7273. _.forEach(res.data, function (r) {
  7274. r.report_enable = r.report_enable === 1;
  7275. });
  7276. me.getView().setStore(new Ext.data.Store({
  7277. fields: ['report_id', 'report_name', 'report_enable'],
  7278. data: res.data,
  7279. }));
  7280. }).finally(function () {
  7281. me.getView().setLoading(false);
  7282. });
  7283. };
  7284. ReportGridController.prototype.reportAdd = function () {
  7285. var _this = this;
  7286. prompt$2('请输入报表名称').then(function (name) {
  7287. createReportApi(name).then(function (res) {
  7288. if (res.success) {
  7289. msg$1('添加成功');
  7290. handles.mainWindow.showReport(res.data, name, function () {
  7291. _this.reload();
  7292. });
  7293. }
  7294. _this.reload();
  7295. });
  7296. });
  7297. };
  7298. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  7299. e.preventDefault();
  7300. var me = sender.up('grid').ownerGrid.getController();
  7301. var option = {
  7302. shadow: 'frame', allowOtherMenus: true,
  7303. items: [
  7304. {
  7305. text: '添加',
  7306. iconCls: 'x-fa fa-plus-circle',
  7307. handler: function (sender) {
  7308. me.reportAdd();
  7309. }
  7310. },
  7311. {
  7312. text: '编辑',
  7313. iconCls: 'x-fa fa-edit',
  7314. handler: function (sender) {
  7315. me.reportEdit();
  7316. }
  7317. },
  7318. {
  7319. text: '删除',
  7320. iconCls: 'x-fa fa-minus-circle',
  7321. handler: function (sender) {
  7322. me.reportRemove();
  7323. }
  7324. },
  7325. '-',
  7326. {
  7327. text: '注册(至菜单)',
  7328. iconCls: 'x-fa fa-sign-in',
  7329. handler: function (sender) {
  7330. me.reportRegiste(sender);
  7331. }
  7332. },
  7333. {
  7334. text: '卸载',
  7335. iconCls: 'x-fa fa-sign-out',
  7336. handler: function (sender) {
  7337. console.error('没做');
  7338. }
  7339. },
  7340. ]
  7341. };
  7342. var treeMenu = new Ext.menu.Menu(option);
  7343. treeMenu.showAt(e.getXY());
  7344. };
  7345. ReportGridController.prototype.reportRegiste = function (sender) {
  7346. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7347. if (record) {
  7348. var reportName = record.get('report_name');
  7349. var reportId = record.get('report_id');
  7350. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  7351. }
  7352. };
  7353. ReportGridController.prototype.reportRemove = function () {
  7354. var _this = this;
  7355. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7356. if (record) {
  7357. var reportName = record.get('report_name');
  7358. var reportId_1 = record.get('report_id');
  7359. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  7360. delReportApi(reportId_1).then(function (res) {
  7361. if (res.success) {
  7362. msg$1('删除成功');
  7363. _this.reload();
  7364. }
  7365. });
  7366. });
  7367. }
  7368. };
  7369. ReportGridController.prototype.reportEdit = function () {
  7370. var _this = this;
  7371. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7372. if (record) {
  7373. var reportName = record.get('report_name');
  7374. var reportId = record.get('report_id');
  7375. handles.mainWindow.showReport(reportId, reportName, function () {
  7376. _this.reload();
  7377. });
  7378. }
  7379. };
  7380. ReportGridController.prototype.onDblClick = function (sender) {
  7381. this.reportEdit();
  7382. };
  7383. return ReportGridController;
  7384. }());
  7385. //# sourceMappingURL=ReportGridController.js.map
  7386. function initReportGrid () {
  7387. var controller = new ReportGridController();
  7388. Ext.define('com.yvan.studio.ReportGrid', {
  7389. extend: 'Ext.grid.Panel',
  7390. xtype: 'reportGrid',
  7391. controller: controller,
  7392. scope: controller,
  7393. referenceHolder: true,
  7394. tooltip: '查询报表',
  7395. iconCls: 'x-fa fa-bar-chart',
  7396. useArrows: true,
  7397. reference: 'reportgrid',
  7398. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  7399. listeners: {
  7400. itemdblclick: 'onDblClick',
  7401. afterrender: 'onLoad',
  7402. },
  7403. viewConfig: {
  7404. listeners: {
  7405. itemcontextmenu: 'onGridContextMenu',
  7406. },
  7407. },
  7408. tbar: {
  7409. xtype: 'toolbar',
  7410. items: [
  7411. {
  7412. xtype: 'button',
  7413. tooltip: '测试',
  7414. iconCls: 'x-fa fa-bars',
  7415. listeners: {
  7416. click: 'showSingle'
  7417. }
  7418. },
  7419. {
  7420. xtype: 'button',
  7421. tooltip: '刷新',
  7422. iconCls: 'x-fa fa-refresh',
  7423. listeners: {
  7424. click: 'reload'
  7425. }
  7426. },
  7427. {
  7428. xtype: 'button',
  7429. tooltip: '添加',
  7430. iconCls: 'x-fa fa-plus-circle',
  7431. listeners: {
  7432. click: 'reportAdd'
  7433. }
  7434. },
  7435. {
  7436. xtype: 'button',
  7437. tooltip: '删除',
  7438. iconCls: 'x-fa fa-minus-circle',
  7439. listeners: {
  7440. click: 'reportRemove'
  7441. }
  7442. },
  7443. {
  7444. xtype: 'textfield',
  7445. flex: 1,
  7446. reference: "txtFilter",
  7447. emptyText: '搜索过滤',
  7448. enableKeyEvents: true,
  7449. listeners: {
  7450. change: {
  7451. fn: 'filterChanged',
  7452. buffer: 50
  7453. }
  7454. }
  7455. },
  7456. ]
  7457. },
  7458. columns: [
  7459. {
  7460. text: 'ID', dataIndex: 'report_id',
  7461. hidden: true,
  7462. },
  7463. {
  7464. text: '报表名称', dataIndex: 'report_name',
  7465. menuDisabled: true, flex: 1,
  7466. },
  7467. ]
  7468. });
  7469. }
  7470. //# sourceMappingURL=ReportGrid.js.map
  7471. /** 所有变量类型 */
  7472. var TypeEnum;
  7473. (function (TypeEnum) {
  7474. TypeEnum["string"] = "string";
  7475. TypeEnum["number"] = "number";
  7476. TypeEnum["object"] = "object";
  7477. TypeEnum["array"] = "array";
  7478. TypeEnum["function"] = "function";
  7479. TypeEnum["null"] = "null";
  7480. TypeEnum["boolean"] = "boolean";
  7481. TypeEnum["symbol"] = "symbol";
  7482. TypeEnum["json"] = "json";
  7483. TypeEnum["math"] = "math";
  7484. TypeEnum["regexp"] = "regexp";
  7485. TypeEnum["date"] = "date";
  7486. TypeEnum["undefined"] = "undefined";
  7487. TypeEnum["nan"] = "nan";
  7488. TypeEnum["reactNode"] = "react_node";
  7489. })(TypeEnum || (TypeEnum = {}));
  7490. /**
  7491. * 判断对象类型
  7492. * @param object 对象
  7493. */
  7494. var variableTypeOf = function (object) {
  7495. var typeStr = Object.prototype.toString.call(object);
  7496. var typeName;
  7497. switch (("" + typeStr).toLowerCase()) {
  7498. case '[object string]':
  7499. typeName = TypeEnum.string;
  7500. break;
  7501. case '[object number]':
  7502. if (Number.isNaN(object)) {
  7503. return TypeEnum.nan;
  7504. }
  7505. typeName = TypeEnum.number;
  7506. break;
  7507. case '[object object]':
  7508. if (object.$$typeof && object.props) {
  7509. var type = variableTypeOf(object.$$typeof);
  7510. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  7511. return TypeEnum.reactNode;
  7512. }
  7513. }
  7514. typeName = TypeEnum.object;
  7515. break;
  7516. case '[object array]':
  7517. typeName = TypeEnum.array;
  7518. break;
  7519. case '[object function]':
  7520. typeName = TypeEnum.function;
  7521. break;
  7522. case '[object null]':
  7523. typeName = TypeEnum.null;
  7524. break;
  7525. case '[object boolean]':
  7526. typeName = TypeEnum.boolean;
  7527. break;
  7528. case '[object date]':
  7529. typeName = TypeEnum.date;
  7530. break;
  7531. // 不常用
  7532. case '[object symbol]':
  7533. typeName = TypeEnum.symbol;
  7534. break;
  7535. case '[object json]':
  7536. typeName = TypeEnum.json;
  7537. break;
  7538. case '[object math]':
  7539. typeName = TypeEnum.math;
  7540. break;
  7541. case '[object regexp]':
  7542. typeName = TypeEnum.regexp;
  7543. break;
  7544. // 貌似不会走的分支
  7545. case '[object undefined]':
  7546. typeName = TypeEnum.undefined;
  7547. break;
  7548. // 无法识别
  7549. default:
  7550. if (object === undefined) {
  7551. return TypeEnum.undefined;
  7552. }
  7553. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  7554. typeName = TypeEnum.object;
  7555. }
  7556. return typeName;
  7557. };
  7558. //# sourceMappingURL=typeof.js.map
  7559. function initGroovyEditor () {
  7560. Ext.define('com.yvan.studio.GroovyEditor', {
  7561. extend: 'Ext.panel.Panel',
  7562. alias: 'widget.groovyeditor',
  7563. xtype: 'groovyeditor',
  7564. layout: 'fit',
  7565. border: false,
  7566. html: "<div class=\"editor\"/>",
  7567. config: {
  7568. value: ''
  7569. },
  7570. codeChange: undefined,
  7571. isChangeFromOuter: false,
  7572. getCode: function () {
  7573. if (this.editor) {
  7574. return this.editor.getValue();
  7575. }
  7576. else {
  7577. return this.code;
  7578. }
  7579. },
  7580. setCode: function (value) {
  7581. var _this = this;
  7582. this.code = value;
  7583. this.value = value;
  7584. _$2.defer(function () {
  7585. _this.isChangeFromOuter = true;
  7586. if (_this.editor) {
  7587. _this.editor.setValue(value);
  7588. }
  7589. });
  7590. },
  7591. applyPosition: function () {
  7592. var _this = this;
  7593. if (this.autoFocusMethod) {
  7594. if (this.editor) {
  7595. _$2.defer(function () {
  7596. if (_this.autoFocusStartLine) {
  7597. _this.editor.setPosition({
  7598. lineNumber: _this.autoFocusStartLine,
  7599. column: _this.autoFocusStartColumn
  7600. });
  7601. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7602. }
  7603. _this.editor.focus();
  7604. });
  7605. delete this.autoFocusMethod;
  7606. }
  7607. }
  7608. this.editor.layout();
  7609. },
  7610. getValue: function () {
  7611. return this.value;
  7612. },
  7613. setValue: function (value, fromEditor) {
  7614. var me = this;
  7615. if (me.value === value) {
  7616. // 值相等,不需要变化
  7617. return;
  7618. }
  7619. if (fromEditor !== true && me.editor) {
  7620. // 不是来源于编辑器的变化,才设置编辑器的值
  7621. me.editor.setValue(value);
  7622. }
  7623. // 通知mixins setValue
  7624. me.value = value;
  7625. me.fireEvent('change', value);
  7626. },
  7627. initComponent: function () {
  7628. var that = this;
  7629. this.superclass.initComponent.call(this, arguments);
  7630. that.on({
  7631. resize: function () {
  7632. if (that.editor) {
  7633. that.editor.layout();
  7634. }
  7635. },
  7636. destory: function () {
  7637. if (that.editor) {
  7638. that.editor.dispose();
  7639. delete that.editor;
  7640. }
  7641. },
  7642. afterrender: function (sender) {
  7643. var $dom = $(that.el.dom).find('.editor');
  7644. attach_3($dom[0], {
  7645. value: that.code
  7646. }).then(function (editor) {
  7647. that.editor = editor;
  7648. that.applyPosition();
  7649. that.editor.onDidChangeModelContent(function (e) {
  7650. that.fireEvent('change', that.editor, e);
  7651. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  7652. that.codeChange(that.editor.getValue(), that.name, e);
  7653. }
  7654. that.isChangeFromOuter = false;
  7655. });
  7656. });
  7657. }
  7658. });
  7659. }
  7660. });
  7661. }
  7662. function attach_3(element, opts) {
  7663. return new Promise(function (resolve) {
  7664. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  7665. enabled: false
  7666. } }));
  7667. editor.onKeyUp(function (e) {
  7668. // console.log(e)
  7669. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7670. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7671. }
  7672. });
  7673. resolve(editor);
  7674. });
  7675. }
  7676. //# sourceMappingURL=GroovyEditor.js.map
  7677. function initJsEditor () {
  7678. Ext.define('com.yvan.studio.JsEditor', {
  7679. extend: 'Ext.panel.Panel',
  7680. alias: 'widget.jseditor',
  7681. xtype: 'jseditor',
  7682. layout: 'fit',
  7683. border: false,
  7684. html: "<div class=\"editor\"/>",
  7685. autoFocusMethod: true,
  7686. autoFocusStartLine: 0,
  7687. autoFocusStartColumn: 0,
  7688. codeChange: undefined,
  7689. funcArr: [],
  7690. modulePage: null,
  7691. isChangeFromOuter: false,
  7692. name: "",
  7693. /**
  7694. * 设置代码
  7695. */
  7696. setCode: function (value) {
  7697. var _this = this;
  7698. this.code = value;
  7699. _$2.defer(function () {
  7700. _this.isChangeFromOuter = true;
  7701. if (_this.editor) {
  7702. _this.editor.setValue(value);
  7703. if (_this.name === "controllerEditor") {
  7704. _this.funcArr = _this.getAllFunction();
  7705. }
  7706. }
  7707. });
  7708. },
  7709. getCode: function () {
  7710. var _a;
  7711. if (!this.editor) {
  7712. return this.code;
  7713. }
  7714. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7715. },
  7716. applyPosition: function () {
  7717. var _this = this;
  7718. if (this.autoFocusMethod) {
  7719. if (this.editor) {
  7720. _$2.defer(function () {
  7721. if (_this.autoFocusStartLine) {
  7722. _this.editor.setPosition({
  7723. lineNumber: _this.autoFocusStartLine,
  7724. column: _this.autoFocusStartColumn
  7725. });
  7726. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7727. }
  7728. _this.editor.focus();
  7729. });
  7730. delete this.autoFocusMethod;
  7731. }
  7732. }
  7733. this.editor.layout();
  7734. },
  7735. initComponent: function () {
  7736. var that = this;
  7737. this.superclass.initComponent.apply(this, arguments);
  7738. this.on({
  7739. resize: function (sender, width, height) {
  7740. if (that.editor) {
  7741. that.editor.layout();
  7742. }
  7743. },
  7744. destory: function () {
  7745. if (that.editor) {
  7746. that.editor.dispose();
  7747. delete that.editor;
  7748. }
  7749. },
  7750. afterrender: function () {
  7751. var $dom = $(that.el.dom).find('.editor');
  7752. attach_1($dom[0], {
  7753. value: that.code
  7754. }).then(function (editor) {
  7755. that.editor = editor;
  7756. that.applyPosition();
  7757. that.editor.onDidChangeModelContent(function (e) {
  7758. that.fireEvent('change', that.editor, e);
  7759. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7760. that.codeChange(that.editor.getValue(), that.name, e);
  7761. }
  7762. that.isChangeFromOuter = false;
  7763. });
  7764. });
  7765. }
  7766. });
  7767. },
  7768. getAllFunction: function () {
  7769. var funcArr = [];
  7770. var ast = window['YvanUI'].recast.parse(this.code);
  7771. if (ast && ast.program && ast.program.body) {
  7772. if (Array.isArray(ast.program.body)) {
  7773. for (var i = 0; i < ast.program.body.length; i++) {
  7774. var m = ast.program.body[i];
  7775. if (m.type === "ExportDefaultDeclaration") {
  7776. if (m.declaration.type === "ClassDeclaration") {
  7777. if (m.declaration.body.type === "ClassBody") {
  7778. if (Array.isArray(m.declaration.body.body)) {
  7779. for (var j = 0; j < m.declaration.body.body.length; j++) {
  7780. var ob = m.declaration.body.body[j];
  7781. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  7782. var funcItem = { name: ob.key.name, args: [] };
  7783. if (Array.isArray(ob.value.params)) {
  7784. for (var k = 0; k < ob.value.params.length; k++) {
  7785. var p = ob.value.params[k];
  7786. funcItem.args.push(p.name);
  7787. }
  7788. }
  7789. funcArr.push(funcItem);
  7790. }
  7791. }
  7792. }
  7793. }
  7794. }
  7795. }
  7796. }
  7797. }
  7798. }
  7799. return funcArr;
  7800. }
  7801. });
  7802. }
  7803. var isInited = false;
  7804. function attach_1(element, opts) {
  7805. return new Promise(function (resolve) {
  7806. var monaco = window['monaco'];
  7807. if (!isInited) {
  7808. isInited = true;
  7809. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  7810. noSemanticValidation: true,
  7811. noSyntaxValidation: false
  7812. });
  7813. // compiler options
  7814. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  7815. target: monaco.languages.typescript.ScriptTarget.ES2016,
  7816. allowNonTsExtensions: true,
  7817. });
  7818. // extra libraries
  7819. var libSource = [
  7820. 'declare class Facts {',
  7821. ' /**',
  7822. ' * Returns the next fact',
  7823. ' */',
  7824. ' static next():string',
  7825. ' static next222():string',
  7826. '}',
  7827. "\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 ",
  7828. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  7829. ].join('\n');
  7830. var libUri = 'file:///index.d.ts';
  7831. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  7832. // When resolving definitions and references, the editor will try to use created models.
  7833. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  7834. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  7835. }
  7836. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  7837. resolve(editor);
  7838. });
  7839. }
  7840. //# sourceMappingURL=JsEditor.js.map
  7841. function initJsonEditor () {
  7842. Ext.define('com.yvan.studio.JsonEditor', {
  7843. extend: 'Ext.panel.Panel',
  7844. alias: 'widget.jsoneditor',
  7845. xtype: 'jsoneditor',
  7846. layout: 'fit',
  7847. border: false,
  7848. html: "<div class=\"editor\"/>",
  7849. autoFocusMethod: true,
  7850. autoFocusStartLine: 0,
  7851. autoFocusStartColumn: 0,
  7852. codeChange: undefined,
  7853. funcArr: [],
  7854. modulePage: null,
  7855. isChangeFromOuter: false,
  7856. name: "",
  7857. /**
  7858. * 设置代码
  7859. */
  7860. setCode: function (value) {
  7861. var _this = this;
  7862. this.code = value;
  7863. _$2.defer(function () {
  7864. _this.isChangeFromOuter = true;
  7865. if (_this.editor) {
  7866. _this.editor.setValue(value);
  7867. }
  7868. });
  7869. },
  7870. updateOptions: function (options) {
  7871. if (this.editor && options) {
  7872. this.editor.updateOptions(options);
  7873. }
  7874. },
  7875. setLanguage: function (lang) {
  7876. if (this.editor && lang) {
  7877. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  7878. }
  7879. },
  7880. getCode: function () {
  7881. var _a;
  7882. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7883. },
  7884. applyPosition: function () {
  7885. var _this = this;
  7886. if (this.autoFocusMethod) {
  7887. if (this.editor) {
  7888. _$2.defer(function () {
  7889. if (_this.autoFocusStartLine) {
  7890. _this.editor.setPosition({
  7891. lineNumber: _this.autoFocusStartLine,
  7892. column: _this.autoFocusStartColumn
  7893. });
  7894. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7895. }
  7896. _this.editor.focus();
  7897. });
  7898. delete this.autoFocusMethod;
  7899. }
  7900. }
  7901. this.editor.layout();
  7902. },
  7903. initComponent: function () {
  7904. var that = this;
  7905. this.superclass.initComponent.apply(this, arguments);
  7906. this.on({
  7907. resize: function (sender, width, height) {
  7908. if (that.editor) {
  7909. that.editor.layout();
  7910. }
  7911. },
  7912. destory: function () {
  7913. if (that.editor) {
  7914. that.editor.dispose();
  7915. delete that.editor;
  7916. }
  7917. },
  7918. afterrender: function (sender) {
  7919. var $dom = $(that.el.dom).find('.editor');
  7920. attach_116($dom[0], {
  7921. value: that.code
  7922. }).then(function (editor) {
  7923. that.editor = editor;
  7924. that.applyPosition();
  7925. that.editor.onDidChangeModelContent(function (e) {
  7926. that.fireEvent('change', that.editor, e);
  7927. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7928. that.codeChange(that.editor.getValue(), that.name, e);
  7929. }
  7930. that.isChangeFromOuter = false;
  7931. });
  7932. });
  7933. }
  7934. });
  7935. },
  7936. });
  7937. }
  7938. function attach_116(element, opts) {
  7939. return new Promise(function (resolve) {
  7940. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  7941. enabled: false
  7942. } }));
  7943. editor.onKeyUp(function (e) {
  7944. // console.log(e)
  7945. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7946. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7947. }
  7948. });
  7949. resolve(editor);
  7950. });
  7951. }
  7952. //# sourceMappingURL=JsonEditor.js.map
  7953. function initSqlEditor () {
  7954. Ext.define('com.yvan.studio.SqlEditor', {
  7955. extend: 'Ext.panel.Panel',
  7956. alias: 'widget.sqleditor',
  7957. xtype: 'sqleditor',
  7958. layout: 'fit',
  7959. border: false,
  7960. html: "<div class=\"editor\"/>",
  7961. config: {
  7962. value: ''
  7963. },
  7964. codeChange: undefined,
  7965. isChangeFromOuter: false,
  7966. setCode: function (value) {
  7967. var _this = this;
  7968. this.code = value;
  7969. this.value = value;
  7970. _$2.defer(function () {
  7971. _this.isChangeFromOuter = true;
  7972. if (_this.editor) {
  7973. _this.editor.setValue(value);
  7974. }
  7975. });
  7976. },
  7977. getCode: function () {
  7978. return this.getValue();
  7979. },
  7980. updateOptions: function (options) {
  7981. if (this.editor && options) {
  7982. this.editor.updateOptions(options);
  7983. }
  7984. },
  7985. getValue: function () {
  7986. if (!this.editor) {
  7987. return this.code;
  7988. }
  7989. return this.editor.getValue();
  7990. },
  7991. applyPosition: function () {
  7992. var _this = this;
  7993. if (this.autoFocusMethod) {
  7994. if (this.editor) {
  7995. _$2.defer(function () {
  7996. if (_this.autoFocusStartLine) {
  7997. _this.editor.setPosition({
  7998. lineNumber: _this.autoFocusStartLine,
  7999. column: _this.autoFocusStartColumn
  8000. });
  8001. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  8002. }
  8003. _this.editor.focus();
  8004. });
  8005. delete this.autoFocusMethod;
  8006. }
  8007. }
  8008. this.editor.layout();
  8009. },
  8010. setValue: function (value, fromEditor) {
  8011. this.setCode(value);
  8012. var me = this;
  8013. if (me.value === value) {
  8014. // 值相等,不需要变化
  8015. return;
  8016. }
  8017. if (fromEditor !== true && me.editor) {
  8018. // 不是来源于编辑器的变化,才设置编辑器的值
  8019. me.editor.setValue(value);
  8020. }
  8021. // 通知mixins setValue
  8022. me.value = value;
  8023. me.fireEvent('change', value);
  8024. },
  8025. initComponent: function () {
  8026. var that = this;
  8027. this.superclass.initComponent.call(this);
  8028. that.on({
  8029. resize: function () {
  8030. if (that.editor) {
  8031. that.editor.layout();
  8032. }
  8033. },
  8034. destory: function () {
  8035. if (that.editor) {
  8036. that.editor.dispose();
  8037. delete that.editor;
  8038. }
  8039. },
  8040. afterrender: function (sender) {
  8041. var $dom = $(that.el.dom).find('.editor');
  8042. attach_2($dom[0], {
  8043. value: that.code
  8044. }).then(function (editor) {
  8045. that.editor = editor;
  8046. that.applyPosition();
  8047. that.editor.onDidChangeModelContent(function (e) {
  8048. that.fireEvent('change', that.editor, e);
  8049. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  8050. that.codeChange(that.editor.getValue(), that.name, e);
  8051. }
  8052. that.isChangeFromOuter = false;
  8053. });
  8054. });
  8055. }
  8056. });
  8057. }
  8058. });
  8059. }
  8060. function attach_2(element, opts) {
  8061. return new Promise(function (resolve) {
  8062. var monaco = window['monaco'];
  8063. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  8064. enabled: false
  8065. } }));
  8066. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  8067. // const sql = editor.getValue()
  8068. // if (_.trim(sql).length > 0) {
  8069. // editor.setValue(format(sql, {
  8070. // indent: ' ',
  8071. // uppercase: true,
  8072. // }))
  8073. // }
  8074. msg$1('没做');
  8075. });
  8076. editor.onKeyUp(function (e) {
  8077. // console.log(e)
  8078. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8079. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8080. }
  8081. });
  8082. resolve(editor);
  8083. });
  8084. }
  8085. //# sourceMappingURL=SqlEditor.js.map
  8086. function initTemplateEditor () {
  8087. Ext.define('com.yvan.studio.TemplateEditor', {
  8088. extend: 'Ext.panel.Panel',
  8089. alias: 'widget.templateeditor',
  8090. xtype: 'templateeditor',
  8091. layout: 'fit',
  8092. border: false,
  8093. html: "<div class=\"editor\"/>",
  8094. autoFocusMethod: true,
  8095. autoFocusStartLine: 0,
  8096. autoFocusStartColumn: 0,
  8097. codeChange: undefined,
  8098. funcArr: [],
  8099. modulePage: null,
  8100. isChangeFromOuter: false,
  8101. name: "",
  8102. /**
  8103. * 设置代码
  8104. */
  8105. setCode: function (value) {
  8106. var _this = this;
  8107. this.code = value;
  8108. _$2.defer(function () {
  8109. _this.isChangeFromOuter = true;
  8110. if (_this.editor) {
  8111. _this.editor.setValue(value);
  8112. }
  8113. });
  8114. },
  8115. getCode: function () {
  8116. var _a;
  8117. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  8118. },
  8119. applyPosition: function () {
  8120. var _this = this;
  8121. if (this.autoFocusMethod) {
  8122. if (this.editor) {
  8123. _$2.defer(function () {
  8124. if (_this.autoFocusStartLine) {
  8125. _this.editor.setPosition({
  8126. lineNumber: _this.autoFocusStartLine,
  8127. column: _this.autoFocusStartColumn
  8128. });
  8129. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  8130. }
  8131. _this.editor.focus();
  8132. });
  8133. delete this.autoFocusMethod;
  8134. }
  8135. }
  8136. this.editor.layout();
  8137. },
  8138. initComponent: function () {
  8139. var that = this;
  8140. this.superclass.initComponent.apply(this, arguments);
  8141. this.on({
  8142. resize: function (sender, width, height) {
  8143. if (that.editor) {
  8144. that.editor.layout();
  8145. }
  8146. },
  8147. destory: function () {
  8148. if (that.editor) {
  8149. that.editor.dispose();
  8150. delete that.editor;
  8151. }
  8152. },
  8153. afterrender: function (sender) {
  8154. var $dom = $(that.el.dom).find('.editor');
  8155. attach_117($dom[0], {
  8156. value: that.code
  8157. }).then(function (editor) {
  8158. that.editor = editor;
  8159. that.applyPosition();
  8160. that.editor.onDidChangeModelContent(function (e) {
  8161. that.fireEvent('change', that.editor, e);
  8162. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  8163. that.codeChange(that.editor.getValue(), that.name, e);
  8164. }
  8165. that.isChangeFromOuter = false;
  8166. });
  8167. });
  8168. }
  8169. });
  8170. },
  8171. });
  8172. }
  8173. function attach_117(element, opts) {
  8174. return new Promise(function (resolve) {
  8175. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  8176. enabled: false
  8177. } }));
  8178. editor.onKeyUp(function (e) {
  8179. // console.log(e)
  8180. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8181. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8182. }
  8183. });
  8184. resolve(editor);
  8185. });
  8186. }
  8187. //# sourceMappingURL=TemplateEditor.js.map
  8188. var DictStore = /** @class */ (function (_super) {
  8189. __extends(DictStore, _super);
  8190. function DictStore() {
  8191. return _super !== null && _super.apply(this, arguments) || this;
  8192. }
  8193. DictStore.prototype.getCacheKey = function (param) {
  8194. return "dict_data.json";
  8195. };
  8196. DictStore.prototype.invokeApi = function (param) {
  8197. return getDict(param);
  8198. };
  8199. DictStore.prototype.getDicts = function () {
  8200. return this.apiResponse.data.dict;
  8201. };
  8202. DictStore.prototype.getDictCodes = function () {
  8203. return new Promise(function (resolve) {
  8204. // reloadIfNeedPromise().then(() => {
  8205. // const result = []
  8206. // _.forEach(this.getDicts(), dictRow => {
  8207. // result.push({
  8208. // id: dictRow.dict_code,
  8209. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  8210. // })
  8211. // })
  8212. // resolve(result)
  8213. // })
  8214. });
  8215. };
  8216. DictStore.prototype.saveDict = function (param) {
  8217. return saveDictApi(param);
  8218. };
  8219. DictStore.prototype.saveDictItems = function (param) {
  8220. return saveDictItemsApi(param);
  8221. };
  8222. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  8223. var results = [];
  8224. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  8225. if (dictItemRow.dict_code === dict_code) {
  8226. results.push(_$2.clone(dictItemRow));
  8227. }
  8228. });
  8229. return results;
  8230. };
  8231. return DictStore;
  8232. }(CacheStore));
  8233. var instance$1 = new DictStore();
  8234. //# sourceMappingURL=DictStore.js.map
  8235. var DictTreeController = /** @class */ (function () {
  8236. function DictTreeController() {
  8237. this._saveStateFlag = true;
  8238. }
  8239. DictTreeController.prototype.dictSave = function () {
  8240. var _this = this;
  8241. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8242. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  8243. if (err) {
  8244. // 如果有异常就不保存
  8245. return;
  8246. }
  8247. // 进行业务上的逻辑校验,比如说必填校验等等
  8248. var hasError = false;
  8249. _$2.forEach(rows, function (row, i) {
  8250. if (isEmpty(row.dict_code)) {
  8251. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  8252. hasError = true;
  8253. return false;
  8254. }
  8255. });
  8256. if (hasError) {
  8257. return;
  8258. }
  8259. // 设置当前界面为 "保存中..." 状态
  8260. this.view.setLoading(true);
  8261. instance$1.saveDict({
  8262. newRows: newRows,
  8263. modifyRows: modifyRows,
  8264. removeRecords: removeRecords,
  8265. }).then(function (res) {
  8266. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8267. msg$1(res.msg);
  8268. _this.reload();
  8269. }).finally(function () {
  8270. // 无论正常异常,关闭 "保存中..." 状态
  8271. _this.view.setLoading(false);
  8272. });
  8273. };
  8274. DictTreeController.prototype.dictItemSave = function () {
  8275. var _this = this;
  8276. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8277. var currentDictCode = undefined;
  8278. if (record) {
  8279. currentDictCode = record.get('dict_code');
  8280. }
  8281. if (!currentDictCode) {
  8282. msg$1('请选择一个字典');
  8283. return;
  8284. }
  8285. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8286. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  8287. if (err) {
  8288. // 如果有异常就不保存
  8289. return;
  8290. }
  8291. // 进行业务上的逻辑校验,比如说必填校验等等
  8292. var hasError = false;
  8293. _$2.forEach(rows, function (row, i) {
  8294. if (!row.dict_value && row.dict_value !== 0) {
  8295. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  8296. hasError = true;
  8297. return false;
  8298. }
  8299. });
  8300. if (hasError) {
  8301. return;
  8302. }
  8303. // 设置当前界面为 "保存中..." 状态
  8304. this.view.setLoading(true);
  8305. instance$1.saveDictItems({
  8306. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  8307. newRows: newRows,
  8308. modifyRows: modifyRows,
  8309. removeRecords: removeRecords,
  8310. dict_code: currentDictCode
  8311. }).then(function (res) {
  8312. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8313. msg$1(res.msg);
  8314. _this.reload();
  8315. }).finally(function () {
  8316. // 无论正常异常,关闭 "保存中..." 状态
  8317. _this.view.setLoading(false);
  8318. });
  8319. };
  8320. DictTreeController.prototype.createDictEnum = function () {
  8321. var _this = this;
  8322. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8323. var currentDictCode = undefined;
  8324. if (record) {
  8325. currentDictCode = record.get('dict_code');
  8326. }
  8327. if (!currentDictCode) {
  8328. msg$1('请选择一个字典');
  8329. return;
  8330. }
  8331. // 设置当前界面为 "保存中..." 状态
  8332. this.view.setLoading(true);
  8333. createDictEnum({ dictCode: currentDictCode })
  8334. .then(function () { return _this.reload(); })
  8335. .finally(function () { return _this.view.setLoading(false); });
  8336. };
  8337. DictTreeController.prototype.onLoad = function () {
  8338. setDictTree(this);
  8339. this.grid1 = this.view.lookupReference('grid1');
  8340. this.grid2 = this.view.lookupReference('grid2');
  8341. this.grid1.setData([]);
  8342. this.grid2.setData([]);
  8343. // this.grid1.columns[0].hide()
  8344. this.grid2.columns[0].hide();
  8345. // 找管理器订阅刷新的事件
  8346. instance$1.registe(this.refreshData.bind(this));
  8347. // 非强制性刷新 DbManager
  8348. instance$1.reloadIfNeed(undefined);
  8349. };
  8350. DictTreeController.prototype.onDestory = function () {
  8351. instance$1.unregiste(this.refreshData.bind(this));
  8352. };
  8353. // dictStore 刷新时,会回调到这个方法
  8354. DictTreeController.prototype.refreshData = function (isLoadingState) {
  8355. var me = this;
  8356. if (typeof isLoadingState === 'boolean') {
  8357. me.view.setLoading(isLoadingState);
  8358. return;
  8359. }
  8360. this.grid1.setData(instance$1.getDicts());
  8361. this.restoreState();
  8362. };
  8363. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  8364. var _this = this;
  8365. _$2.defer(function () {
  8366. _this.saveState();
  8367. });
  8368. if (!record) {
  8369. this.grid2.setData([]);
  8370. return;
  8371. }
  8372. var dict_code = record.get('dict_code');
  8373. var data = instance$1.getDictItemByDictcode(dict_code);
  8374. this.grid2.setData(data);
  8375. };
  8376. DictTreeController.prototype.reload = function () {
  8377. var _this = this;
  8378. // 强制刷新 DbManager
  8379. instance$1.reloadForce(undefined).then(function (res) {
  8380. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  8381. });
  8382. };
  8383. DictTreeController.prototype.dictAdd = function () {
  8384. this.grid1.appendEditRow({
  8385. _createFlag: true,
  8386. dict_code: '',
  8387. dict_desc: '',
  8388. }, 0);
  8389. };
  8390. DictTreeController.prototype.dictRemove = function () {
  8391. this.grid1.removeEditRow();
  8392. };
  8393. DictTreeController.prototype.dictItemAdd = function () {
  8394. var _a, _b;
  8395. 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;
  8396. if (!dict_code) {
  8397. msg$1('请先保存字典');
  8398. return;
  8399. }
  8400. this.grid2.appendEditRow({
  8401. dict_code: dict_code,
  8402. dict_text: '',
  8403. dict_value: '',
  8404. }, 0);
  8405. };
  8406. DictTreeController.prototype.dictItemRemove = function () {
  8407. var _this = this;
  8408. var rows = [];
  8409. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  8410. rows.push(r);
  8411. });
  8412. _$2.forEach(rows, function (r) {
  8413. _this.grid2.getStore().remove(r);
  8414. });
  8415. };
  8416. DictTreeController.prototype.clearSearch1 = function () {
  8417. this.grid1.store.clearFilter();
  8418. };
  8419. DictTreeController.prototype.search1 = function (sender) {
  8420. this.grid1.store.clearFilter();
  8421. this.getViewModel().set('grid1.selection', null);
  8422. this.grid1.fireEvent('itemselect');
  8423. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8424. if (!value) {
  8425. return;
  8426. }
  8427. this.grid1.store.filterBy(function (record) {
  8428. if (record.get('_createFlag')) {
  8429. return true;
  8430. }
  8431. var dict_code = _$2.lowerCase(record.get('dict_code'));
  8432. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  8433. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  8434. return (dict_code.includes(value) ||
  8435. dict_desc.includes(value) ||
  8436. dict_desc_py.includes(value));
  8437. });
  8438. };
  8439. DictTreeController.prototype.clearSearch2 = function () {
  8440. this.grid2.store.clearFilter();
  8441. };
  8442. DictTreeController.prototype.search2 = function (sender) {
  8443. this.grid2.store.clearFilter();
  8444. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8445. if (!value) {
  8446. return;
  8447. }
  8448. this.grid2.store.filterBy(function (record) {
  8449. var dict_text = _$2.lowerCase(record.get('dict_text'));
  8450. var dict_value = _$2.lowerCase(record.get('dict_value'));
  8451. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  8452. return (dict_text.includes(value) ||
  8453. dict_value === value ||
  8454. dict_text_py.includes(value));
  8455. });
  8456. };
  8457. DictTreeController.prototype.getStateFilename = function () {
  8458. return getCurrentProject().uuid + "/dicttree.json";
  8459. };
  8460. DictTreeController.prototype.restoreState = function () {
  8461. var _this = this;
  8462. var grid = this.grid1;
  8463. native.loadFile(this.getStateFilename(), function (content) {
  8464. if (!content)
  8465. return;
  8466. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  8467. _this._saveStateFlag = false;
  8468. if (selection) {
  8469. var idx = grid.store.findExact('dict_code', selection);
  8470. if (idx >= 0) {
  8471. var record = grid.store.getAt(idx);
  8472. if (record) {
  8473. grid.setSelection([record]);
  8474. }
  8475. }
  8476. }
  8477. if (scrollPosition && scrollSize) {
  8478. var size = grid.scrollable.getSize();
  8479. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  8480. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  8481. }
  8482. }
  8483. setTimeout(function () {
  8484. _this._saveStateFlag = true;
  8485. }, 200);
  8486. });
  8487. };
  8488. DictTreeController.prototype.saveState = function () {
  8489. if (!this._saveStateFlag) {
  8490. return;
  8491. }
  8492. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8493. var selection = undefined;
  8494. if (record) {
  8495. selection = record.get('dict_code');
  8496. }
  8497. var scrollPosition = this.grid1.scrollable.position;
  8498. var scrollSize = this.grid1.scrollable.getSize();
  8499. native.saveFile(this.getStateFilename(), {
  8500. selection: selection,
  8501. scrollPosition: scrollPosition,
  8502. scrollSize: scrollSize
  8503. });
  8504. };
  8505. return DictTreeController;
  8506. }());
  8507. //# sourceMappingURL=DictTreeController.js.map
  8508. function initDict () {
  8509. var controller = new DictTreeController();
  8510. Ext.define('com.yvan.studio.DictTree', {
  8511. extend: 'Ext.panel.Panel',
  8512. xtype: 'dicttree',
  8513. controller: controller,
  8514. scope: controller,
  8515. referenceHolder: true,
  8516. tooltip: '字典',
  8517. iconCls: 'x-fa fa-book',
  8518. rootVisible: false,
  8519. useArrows: true,
  8520. reference: 'dicttree',
  8521. layout: 'border',
  8522. listeners: {
  8523. afterrender: 'onLoad',
  8524. destory: 'onDestory',
  8525. },
  8526. items: [
  8527. {
  8528. region: 'center',
  8529. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  8530. _mode: 'select',
  8531. tbar: [
  8532. {
  8533. xtype: 'button',
  8534. tooltip: '刷新',
  8535. iconCls: 'x-fa fa-refresh',
  8536. listeners: {
  8537. click: 'reload'
  8538. }
  8539. },
  8540. {
  8541. xtype: 'button',
  8542. tooltip: '添加',
  8543. iconCls: 'x-fa fa-plus-circle',
  8544. listeners: {
  8545. click: 'dictAdd'
  8546. }
  8547. },
  8548. {
  8549. xtype: 'button',
  8550. tooltip: '删除',
  8551. iconCls: 'x-fa fa-minus-circle',
  8552. bind: {
  8553. disabled: '{!grid1.selection}'
  8554. },
  8555. listeners: {
  8556. click: 'dictRemove'
  8557. }
  8558. },
  8559. {
  8560. xtype: 'button',
  8561. tooltip: '保存',
  8562. iconCls: 'x-fa fa-save',
  8563. bind: {
  8564. disabled: '{!grid1.ischanged}'
  8565. },
  8566. listeners: {
  8567. click: 'dictSave'
  8568. }
  8569. },
  8570. {
  8571. xtype: 'textfield',
  8572. hideClear: true,
  8573. triggers: {
  8574. clear: {
  8575. cls: 'x-form-clear-trigger',
  8576. handler: 'clearSearch1'
  8577. },
  8578. },
  8579. flex: 1,
  8580. emptyText: '搜索过滤',
  8581. enableKeyEvents: true,
  8582. listeners: {
  8583. keyup: {
  8584. fn: 'search1',
  8585. buffer: 50
  8586. }
  8587. }
  8588. },
  8589. ],
  8590. listeners: {
  8591. itemselect: 'grid1Selected',
  8592. },
  8593. idField: 'dict_code',
  8594. columns: [
  8595. {
  8596. text: '字典编号', dataIndex: 'dict_code',
  8597. menuDisabled: true, flex: 1,
  8598. editor: {
  8599. allowBlank: true,
  8600. selectOnFocus: false
  8601. }
  8602. },
  8603. {
  8604. text: '中文描述', dataIndex: 'dict_desc',
  8605. menuDisabled: true, flex: 1,
  8606. editor: {
  8607. allowBlank: true,
  8608. selectOnFocus: false
  8609. }
  8610. },
  8611. ]
  8612. },
  8613. {
  8614. region: 'south', height: '50%',
  8615. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  8616. split: true,
  8617. _mode: 'edit1',
  8618. listeners: {},
  8619. tbar: [
  8620. {
  8621. xtype: 'button',
  8622. tooltip: '添加',
  8623. iconCls: 'x-fa fa-plus-circle',
  8624. bind: {
  8625. disabled: '{!grid1.selection}'
  8626. },
  8627. listeners: {
  8628. click: 'dictItemAdd'
  8629. }
  8630. },
  8631. {
  8632. xtype: 'button',
  8633. tooltip: '删除',
  8634. iconCls: 'x-fa fa-minus-circle',
  8635. bind: {
  8636. disabled: '{!grid1.selection}'
  8637. },
  8638. listeners: {
  8639. click: 'dictItemRemove'
  8640. }
  8641. },
  8642. {
  8643. xtype: 'button',
  8644. tooltip: '保存',
  8645. iconCls: 'x-fa fa-save',
  8646. bind: {
  8647. disabled: '{!grid2.ischanged}'
  8648. },
  8649. listeners: {
  8650. click: 'dictItemSave'
  8651. }
  8652. },
  8653. {
  8654. xtype: 'button',
  8655. tooltip: '刷新代码',
  8656. iconCls: 'x-fa fa-code',
  8657. bind: {
  8658. disabled: '{!grid1.selection}'
  8659. },
  8660. listeners: {
  8661. click: 'createDictEnum'
  8662. }
  8663. },
  8664. ],
  8665. columns: [
  8666. {
  8667. text: '字典项', dataIndex: 'dict_text',
  8668. menuDisabled: true, flex: 1,
  8669. editor: {
  8670. allowBlank: true,
  8671. selectOnFocus: false
  8672. }
  8673. },
  8674. {
  8675. text: '字典值', dataIndex: 'dict_value',
  8676. menuDisabled: true, flex: 1,
  8677. dataType: 'int',
  8678. editor: {
  8679. xtype: 'numberfield',
  8680. allowBlank: true,
  8681. selectOnFocus: false
  8682. }
  8683. },
  8684. {
  8685. text: '激活', dataIndex: 'is_enable',
  8686. xtype: 'checkcolumn', menuDisabled: true,
  8687. },
  8688. {
  8689. text: '变量名', dataIndex: 'var_name',
  8690. menuDisabled: true, flex: 1,
  8691. editor: {
  8692. allowBlank: true,
  8693. selectOnFocus: false
  8694. }
  8695. },
  8696. ]
  8697. }
  8698. ]
  8699. });
  8700. }
  8701. //# sourceMappingURL=DictTree.js.map
  8702. var model$2 = {
  8703. data: {
  8704. form: {
  8705. path: "",
  8706. requestBody: "",
  8707. responseBody: "",
  8708. }
  8709. }
  8710. };
  8711. var vjson$2 = {
  8712. title: '接口信息',
  8713. layout: 'fit',
  8714. width: 800,
  8715. height: 500,
  8716. items: [
  8717. {
  8718. xtype: 'form',
  8719. layout: {
  8720. type: 'vbox',
  8721. pack: 'start',
  8722. align: 'stretch'
  8723. },
  8724. defaults: {
  8725. border: false,
  8726. anchor: '100%',
  8727. margin: '5',
  8728. },
  8729. items: [
  8730. {
  8731. xtype: 'textfield',
  8732. fieldLabel: '接口路径',
  8733. bind: {
  8734. value: "{form.path}",
  8735. },
  8736. },
  8737. {
  8738. xtype: 'textareafield',
  8739. // height: 150,
  8740. flex: 2,
  8741. fieldLabel: '请求数据',
  8742. bind: {
  8743. value: "{form.requestBody}",
  8744. },
  8745. },
  8746. {
  8747. xtype: 'textareafield',
  8748. // height: 150,
  8749. flex: 5,
  8750. fieldLabel: '响应数据',
  8751. bind: {
  8752. value: "{form.responseBody}",
  8753. },
  8754. },
  8755. ]
  8756. }
  8757. ]
  8758. };
  8759. var ApiInfoDialog = /** @class */ (function (_super) {
  8760. __extends(ApiInfoDialog, _super);
  8761. function ApiInfoDialog() {
  8762. return _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  8763. }
  8764. return ApiInfoDialog;
  8765. }(Scope));
  8766. //# sourceMappingURL=apiInfoDialog.js.map
  8767. var model$3 = {
  8768. data: {
  8769. query: {
  8770. role_id: '',
  8771. resource_id: '',
  8772. },
  8773. form: {},
  8774. form2: {
  8775. key: "",
  8776. start_at: "",
  8777. end_at: "",
  8778. }
  8779. }
  8780. };
  8781. var vjson$3 = {
  8782. title: '接口信息',
  8783. layout: 'fit',
  8784. items: [
  8785. {
  8786. layout: 'border',
  8787. border: false,
  8788. items: [
  8789. {
  8790. region: 'center',
  8791. layout: 'border',
  8792. items: [
  8793. {
  8794. region: 'north',
  8795. bind: {
  8796. title: '{form.title}',
  8797. },
  8798. xtype: 'form',
  8799. scrollable: true,
  8800. layout: {
  8801. type: 'vbox',
  8802. pack: 'start',
  8803. align: 'stretch'
  8804. },
  8805. defaults: {
  8806. border: false,
  8807. anchor: '100%',
  8808. margin: '5',
  8809. },
  8810. tbar: {
  8811. xtype: 'toolbar',
  8812. items: [
  8813. {
  8814. xtype: 'button',
  8815. text: '查询',
  8816. iconCls: 'x-fa fa-search',
  8817. listeners: {
  8818. click: 'scope.requestLogs'
  8819. },
  8820. },
  8821. {
  8822. xtype: 'button',
  8823. text: '保存',
  8824. iconCls: 'x-fa fa-save',
  8825. listeners: {},
  8826. },
  8827. {
  8828. xtype: 'button',
  8829. text: '禁用',
  8830. iconCls: 'x-fa fa-stop-circle',
  8831. bind: {},
  8832. listeners: {},
  8833. },
  8834. {
  8835. xtype: 'button',
  8836. text: '启用',
  8837. iconCls: 'x-fa fa-play-circle',
  8838. bind: {},
  8839. listeners: {},
  8840. },
  8841. ],
  8842. },
  8843. items: [
  8844. {
  8845. xtype: 'cols',
  8846. defaults: { labelWidth: 120 },
  8847. items: [
  8848. {
  8849. xtype: 'textfield',
  8850. fieldLabel: 'URL',
  8851. bind: {
  8852. value: '{form.api_url}',
  8853. },
  8854. readOnly: true,
  8855. },
  8856. {
  8857. xtype: 'textfield',
  8858. fieldLabel: '名称',
  8859. bind: {
  8860. value: '{form.api_name}',
  8861. },
  8862. readOnly: true,
  8863. },
  8864. ],
  8865. },
  8866. {
  8867. xtype: 'cols',
  8868. defaults: { labelWidth: 120 },
  8869. items: [
  8870. {
  8871. xtype: 'textfield',
  8872. fieldLabel: '实现类',
  8873. bind: {
  8874. value: '{form.api_class}',
  8875. },
  8876. readOnly: true,
  8877. },
  8878. {
  8879. border: false,
  8880. flex: 1
  8881. },
  8882. ]
  8883. },
  8884. {
  8885. xtype: 'cols',
  8886. defaults: { labelWidth: 120 },
  8887. items: [
  8888. {
  8889. xtype: 'textfield',
  8890. fieldLabel: '超时时间',
  8891. bind: {
  8892. value: '{form.timeout}',
  8893. },
  8894. readOnly: true,
  8895. },
  8896. {
  8897. border: false,
  8898. flex: 1
  8899. },
  8900. ]
  8901. },
  8902. {
  8903. xtype: 'cols',
  8904. defaults: { labelWidth: 120 },
  8905. items: [
  8906. {
  8907. xtype: 'textfield',
  8908. fieldLabel: 'Remote IP',
  8909. bind: {
  8910. value: '{form.remote_ip}',
  8911. },
  8912. readOnly: true,
  8913. },
  8914. {
  8915. border: false,
  8916. flex: 1
  8917. },
  8918. ]
  8919. },
  8920. {
  8921. xtype: 'cols',
  8922. defaults: { labelWidth: 120 },
  8923. items: [
  8924. {
  8925. xtype: 'textfield',
  8926. fieldLabel: '解析表单',
  8927. bind: {
  8928. value: '{form.chandi}',
  8929. },
  8930. readOnly: true,
  8931. },
  8932. {
  8933. border: false,
  8934. flex: 1
  8935. },
  8936. ]
  8937. },
  8938. ],
  8939. },
  8940. {
  8941. region: 'center',
  8942. // title: 'Request',
  8943. layout: 'border',
  8944. items: [
  8945. {
  8946. region: 'north',
  8947. xtype: 'form',
  8948. reference: 'form2',
  8949. split: true,
  8950. items: [
  8951. {
  8952. xtype: 'cols',
  8953. width: 700,
  8954. items: [
  8955. {
  8956. xtype: 'textfield',
  8957. fieldLabel: '关键字',
  8958. bind: {
  8959. value: "{form2.key}"
  8960. },
  8961. },
  8962. {
  8963. xtype: 'datefield',
  8964. fieldLabel: '开始时间',
  8965. bind: {
  8966. value: "{form2.start_at}"
  8967. },
  8968. },
  8969. {
  8970. xtype: 'datefield',
  8971. fieldLabel: '结束时间',
  8972. bind: {
  8973. value: "{form2.end_at}"
  8974. },
  8975. },
  8976. ]
  8977. }
  8978. ]
  8979. },
  8980. {
  8981. region: 'center',
  8982. xtype: 'yvgrid',
  8983. layout: 'fit',
  8984. reference: 'grid1',
  8985. pagination: true,
  8986. autoLoad: false,
  8987. selModel: {
  8988. selType: 'rowmodel',
  8989. mode: 'SINGLE',
  8990. },
  8991. dataSource: {
  8992. method: 'invoke',
  8993. url: '/sys/api/Api@requestLogs',
  8994. params: {
  8995. formData: '{form2}',
  8996. path: '{form.api_url}',
  8997. },
  8998. },
  8999. listeners: {
  9000. rowdblclick: 'scope.showDialog',
  9001. },
  9002. columns: [
  9003. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9004. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  9005. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  9006. { dataIndex: "size", header: "大小", width: 80 },
  9007. { dataIndex: "path", header: "path", flex: 1 },
  9008. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  9009. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  9010. ]
  9011. }
  9012. ]
  9013. },
  9014. ],
  9015. },
  9016. ],
  9017. },
  9018. ],
  9019. referenceHolder: true,
  9020. };
  9021. var Api = /** @class */ (function (_super) {
  9022. __extends(Api, _super);
  9023. function Api() {
  9024. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  9025. }
  9026. Api.prototype.onLoad = function () {
  9027. _super.prototype.onLoad.call(this);
  9028. this.requestLogs();
  9029. };
  9030. Api.prototype.selectList = function (sender, selected, eOpts) {
  9031. this.viewModel.set("form", selected.data);
  9032. if (selected.data.api_type === '1') {
  9033. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  9034. }
  9035. else {
  9036. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  9037. }
  9038. };
  9039. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  9040. var sel = [];
  9041. _$2.forEach(records, function (item) {
  9042. if (item.data.flg === 'Y') {
  9043. sel.push(item);
  9044. }
  9045. });
  9046. this.refs.methodGrid.selModel.select(sel);
  9047. };
  9048. Api.prototype.saveAll = function () {
  9049. var _this = this;
  9050. var _a, _b, _c;
  9051. var role_id = this.viewModel.get("query.role_id");
  9052. if (!role_id) {
  9053. msg$1("请先选择一个角色");
  9054. return;
  9055. }
  9056. var wh_id = this.viewModel.get("form.wh_id");
  9057. if (!wh_id) {
  9058. msg$1("请先选择一个仓库");
  9059. return;
  9060. }
  9061. var menus = this.refs.theTree.getChecked();
  9062. var rowsMenus = [];
  9063. _$2.forEach(menus, function (m) {
  9064. if (m.data.resource_id) {
  9065. rowsMenus.push(m.data.resource_id);
  9066. }
  9067. });
  9068. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  9069. 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; });
  9070. _$2.remove(mm, function (x) {
  9071. return methodsArry.includes(x.resource_id);
  9072. });
  9073. var rowsBtn = [];
  9074. _$2.forEach(mm, function (m) {
  9075. rowsBtn.push({ resource_id: m.resource_id });
  9076. });
  9077. this.setLoading(true);
  9078. invokeServer$1('/sys/role/Role@saveAll', {
  9079. wh_id: wh_id,
  9080. role_id: role_id,
  9081. rowsMenus: rowsMenus,
  9082. rowsBtn: rowsBtn,
  9083. }).then(function (res) {
  9084. msg$1(res.msg);
  9085. if (res.success) {
  9086. _this.reloadTree();
  9087. // this.viewModel.set('query.role_id', '')
  9088. _this.viewModel.set('query.resource_id', '');
  9089. _this.refs.methodGrid.reload();
  9090. }
  9091. }).finally(function () {
  9092. _this.setLoading(false);
  9093. });
  9094. };
  9095. Api.prototype.editRoleSuccess = function (sender, data) {
  9096. if (data.success) {
  9097. this.refs.roleGrid.reload();
  9098. this.viewModel.set("query.JIAOS_ID", "");
  9099. this.reloadTree();
  9100. this.viewModel.set("query.CAID_ID", "");
  9101. this.refs.methodGrid.reload();
  9102. }
  9103. };
  9104. Api.prototype.deleteRole = function (sender) {
  9105. var _this = this;
  9106. var role_id = this.viewModel.get("query.role_id");
  9107. if (!role_id) {
  9108. msg$1("请先选择一个角色");
  9109. return;
  9110. }
  9111. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  9112. if (btn === 'yes') {
  9113. invokeServer$1('/sys/role/Role@deleteRole', {
  9114. role_id: role_id,
  9115. wh_id: window['whId']
  9116. }).then(function (res) {
  9117. msg$1(res.msg);
  9118. if (res.success) {
  9119. _this.refs.roleGrid.reload();
  9120. _this.viewModel.set("query.role_id", "");
  9121. _this.reloadTree();
  9122. _this.refs.methodGrid.reload();
  9123. }
  9124. });
  9125. }
  9126. });
  9127. };
  9128. Api.prototype.reloadTree = function () {
  9129. showErrorDialog$1('reloadTree 不存在');
  9130. };
  9131. Api.prototype.whChange = function (sender, value) {
  9132. this.viewModel.set("form.wh_id", value);
  9133. this.reloadTree();
  9134. this.refs.methodGrid.reload();
  9135. };
  9136. Api.prototype.requestLogs = function () {
  9137. var path = this.viewModel.get("form.api_url");
  9138. if (!path)
  9139. return;
  9140. this.refs.grid1.reload();
  9141. };
  9142. Api.prototype.showDialog = function (sender) {
  9143. var _a, _b;
  9144. 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; });
  9145. if (!rows || rows.length <= 0)
  9146. return;
  9147. var dialog = new ApiInfoDialog();
  9148. dialog.showDialog(null, {}, {
  9149. data: {
  9150. form: __assign({}, rows[0])
  9151. }
  9152. });
  9153. };
  9154. return Api;
  9155. }(Scope));
  9156. //# sourceMappingURL=ApiPage.js.map
  9157. var Controller = /** @class */ (function () {
  9158. function Controller() {
  9159. }
  9160. Controller.prototype.selectList = function (sender, selected, eOpts) {
  9161. var _a, _b, _c, _d, _e, _f, _g, _h;
  9162. // @ts-ignore
  9163. 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; });
  9164. if (!rows || rows.length <= 0)
  9165. return;
  9166. var apiPage = new Api();
  9167. apiPage.showPage({
  9168. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  9169. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  9170. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  9171. }, {
  9172. data: {
  9173. form: __assign({}, rows[0])
  9174. }
  9175. });
  9176. };
  9177. return Controller;
  9178. }());
  9179. var controller = new Controller();
  9180. function initApiTree () {
  9181. Ext.define('com.yvan.studio.ApiGrid', {
  9182. extend: 'Ext.Panel',
  9183. xtype: 'apigrid',
  9184. controller: controller,
  9185. scope: controller,
  9186. referenceHolder: true,
  9187. layout: 'fit',
  9188. items: [
  9189. {
  9190. width: 400,
  9191. split: true,
  9192. xtype: 'yvgrid',
  9193. reference: 'roleGrid',
  9194. border: false,
  9195. pagination: false,
  9196. autoLoad: true,
  9197. remoteFilter: false,
  9198. selModel: {
  9199. selType: 'rowmodel',
  9200. mode: 'SINGLE',
  9201. },
  9202. tbar: {
  9203. xtype: 'toolbar',
  9204. items: [
  9205. {
  9206. xtype: 'button',
  9207. text: '新增',
  9208. iconCls: 'x-fa fa-plus-circle',
  9209. listeners: {},
  9210. },
  9211. {
  9212. xtype: 'button',
  9213. text: '删除',
  9214. iconCls: 'x-fa fa-trash',
  9215. bind: {
  9216. disabled: '{roleGrid.selection==null}',
  9217. },
  9218. listeners: {},
  9219. },
  9220. ],
  9221. },
  9222. dataSource: {
  9223. url: '/sys/api/Api@getApiList',
  9224. method: 'invoke',
  9225. params: {},
  9226. },
  9227. listeners: {
  9228. itemdblclick: "selectList",
  9229. },
  9230. columns: [
  9231. {
  9232. dataIndex: 'api_name',
  9233. header: '接口名称',
  9234. filter: { type: 'string' },
  9235. flex: 1,
  9236. },
  9237. ],
  9238. },
  9239. ]
  9240. });
  9241. }
  9242. //# sourceMappingURL=ApiTree.js.map
  9243. var model$4 = {
  9244. data: {
  9245. iframeSrc: ''
  9246. }
  9247. };
  9248. var vjson$4 = {
  9249. layout: 'fit',
  9250. border: false,
  9251. iconCls: 'x-fa fa-newspaper-o',
  9252. referenceHolder: true,
  9253. items: [
  9254. {
  9255. // title: 'view.design',
  9256. xtype: 'uxiframe',
  9257. layout: 'fit',
  9258. // cls: 'module_page_iframe',
  9259. reference: 'iframe',
  9260. listeners: {
  9261. afterrender: 'scope.iframeRender'
  9262. }
  9263. },
  9264. ]
  9265. };
  9266. var Iframe = /** @class */ (function (_super) {
  9267. __extends(Iframe, _super);
  9268. function Iframe(path) {
  9269. var _this = _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  9270. _this.path = "";
  9271. _this.path = path;
  9272. return _this;
  9273. }
  9274. Iframe.prototype.iframeRender = function (sender) {
  9275. var $dom = $(sender.el.dom).find('iframe');
  9276. var iframe = $dom[0];
  9277. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  9278. iframe.onload = function () {
  9279. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  9280. };
  9281. };
  9282. return Iframe;
  9283. }(Scope));
  9284. //# sourceMappingURL=Iframe.js.map
  9285. var Controller$1 = /** @class */ (function () {
  9286. function Controller() {
  9287. }
  9288. Controller.prototype.onDblClick = function (sender, record) {
  9289. var data = record.raw;
  9290. if (data.text === "运行报表") {
  9291. this.openIframe("/xxl-job/index", "运行报表");
  9292. }
  9293. else if (data.text === "任务管理") {
  9294. this.openIframe("/xxl-job/jobinfo", "任务管理");
  9295. }
  9296. else if (data.text === "调度日志") {
  9297. this.openIframe("/xxl-job/joblog", "调度日志");
  9298. }
  9299. else if (data.text === "执行器管理") {
  9300. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  9301. }
  9302. };
  9303. Controller.prototype.openIframe = function (path, title) {
  9304. var page = new Iframe(path);
  9305. page.showPage({
  9306. title: title,
  9307. id: 'xxljob__' + path.replaceAll("/", "_"),
  9308. path: 'xxljob__' + path.replaceAll("/", "_"),
  9309. }, {});
  9310. };
  9311. Controller.prototype.onLoad = function () {
  9312. var me = this;
  9313. me.getView().setRootNode({
  9314. expanded: true,
  9315. leaf: false,
  9316. children: [
  9317. { leaf: true, text: '运行报表' },
  9318. { leaf: true, text: '任务管理' },
  9319. { leaf: true, text: '调度日志' },
  9320. { leaf: true, text: '执行器管理' },
  9321. ]
  9322. });
  9323. };
  9324. return Controller;
  9325. }());
  9326. var controller$1 = new Controller$1();
  9327. function initTaskTree () {
  9328. Ext.define('com.yvan.studio.TaskTree', {
  9329. extend: 'Ext.tree.Panel',
  9330. xtype: 'tasktree',
  9331. controller: controller$1,
  9332. scope: controller$1,
  9333. reference: 'roleGrid',
  9334. tooltip: '表单定义',
  9335. iconCls: 'x-fa fa-bar-chart',
  9336. useArrows: true,
  9337. rootVisible: false,
  9338. colspan: 2,
  9339. lines: true,
  9340. multiSelect: false,
  9341. referenceHolder: true,
  9342. // openNode() {
  9343. // const selection = this.getSelection()
  9344. // const [record] = selection
  9345. // if (!record) {
  9346. // return
  9347. // }
  9348. //
  9349. // const {raw} = record;
  9350. // if (raw.type === 'Dir') {
  9351. // return
  9352. // }
  9353. // if (raw.type === "Module" && raw.module) {
  9354. // // eventBus.publish(EventType.ModuleOpen, raw)
  9355. // }
  9356. // },
  9357. listeners: {
  9358. itemdblclick: 'onDblClick',
  9359. afterrender: "onLoad",
  9360. },
  9361. });
  9362. }
  9363. //# sourceMappingURL=TaskTree.js.map
  9364. var model$5 = {
  9365. data: {
  9366. form: {
  9367. address: "",
  9368. level: "",
  9369. logger: "",
  9370. message: "",
  9371. nodeName: "",
  9372. serverName: "",
  9373. thread: "",
  9374. whId: "",
  9375. userId: "",
  9376. }
  9377. }
  9378. };
  9379. var vjson$5 = {
  9380. title: '接口信息',
  9381. layout: 'fit',
  9382. width: 800,
  9383. height: 600,
  9384. items: [
  9385. {
  9386. xtype: 'form',
  9387. layout: {
  9388. type: 'vbox',
  9389. pack: 'start',
  9390. align: 'stretch'
  9391. },
  9392. defaults: {
  9393. border: false,
  9394. anchor: '100%',
  9395. margin: '5',
  9396. },
  9397. items: [
  9398. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  9399. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  9400. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  9401. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  9402. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  9403. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  9404. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  9405. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  9406. {
  9407. xtype: 'textareafield',
  9408. flex: 5,
  9409. fieldLabel: '响应数据',
  9410. bind: {
  9411. value: "{form.message}",
  9412. },
  9413. },
  9414. ]
  9415. }
  9416. ]
  9417. };
  9418. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  9419. __extends(ApiInfoDialog, _super);
  9420. function ApiInfoDialog() {
  9421. return _super.call(this, { model: model$5, vjson: vjson$5 }) || this;
  9422. }
  9423. return ApiInfoDialog;
  9424. }(Scope));
  9425. //# sourceMappingURL=LogPageDialog.js.map
  9426. var model$6 = {
  9427. data: {
  9428. form2: {}
  9429. }
  9430. };
  9431. var vjson$6 = {
  9432. title: '日志查询',
  9433. layout: 'fit',
  9434. width: "70%",
  9435. height: "80%",
  9436. items: [
  9437. {
  9438. region: 'center',
  9439. xtype: 'yvgrid',
  9440. layout: 'fit',
  9441. reference: 'grid1',
  9442. pagination: false,
  9443. autoLoad: false,
  9444. selModel: {
  9445. selType: 'rowmodel',
  9446. mode: 'SINGLE',
  9447. },
  9448. dataSource: {
  9449. method: 'invoke',
  9450. url: '/sys/api/Api@aroundLogs',
  9451. params: {
  9452. formData: '{form2}',
  9453. },
  9454. },
  9455. listeners: {
  9456. rowdblclick: 'scope.showDialog2',
  9457. },
  9458. columns: [
  9459. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9460. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9461. { dataIndex: "thread", header: "thread", width: 150 },
  9462. { dataIndex: "message", header: "message", flex: 1 },
  9463. ]
  9464. }
  9465. ]
  9466. };
  9467. var AroundLog = /** @class */ (function (_super) {
  9468. __extends(AroundLog, _super);
  9469. function AroundLog() {
  9470. return _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  9471. }
  9472. AroundLog.prototype.onLoad = function () {
  9473. _super.prototype.onLoad.call(this);
  9474. this.queryLog();
  9475. };
  9476. AroundLog.prototype.queryLog = function () {
  9477. this.refs.grid1.reload();
  9478. };
  9479. AroundLog.prototype.showDialog2 = function () {
  9480. var _a, _b;
  9481. 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; });
  9482. if (!rows || rows.length <= 0)
  9483. return;
  9484. var dialog = new ApiInfoDialog$1();
  9485. dialog.showDialog(null, {}, {
  9486. data: {
  9487. form: __assign({}, rows[0])
  9488. }
  9489. });
  9490. };
  9491. return AroundLog;
  9492. }(Scope));
  9493. //# sourceMappingURL=AroundLog.js.map
  9494. var model$7 = {
  9495. data: {
  9496. form2: {
  9497. key: "",
  9498. start_at: "",
  9499. end_at: "",
  9500. }
  9501. }
  9502. };
  9503. var vjson$7 = {
  9504. title: '日志查询',
  9505. layout: 'fit',
  9506. tbar: {
  9507. xtype: 'toolbar',
  9508. items: [
  9509. {
  9510. xtype: 'button',
  9511. text: '刷新',
  9512. listeners: {
  9513. click: 'scope.queryLog'
  9514. },
  9515. },
  9516. {
  9517. xtype: 'button',
  9518. text: '周围日志',
  9519. bind: {},
  9520. listeners: {
  9521. click: 'scope.aroundLogs'
  9522. },
  9523. },
  9524. ],
  9525. },
  9526. items: [
  9527. {
  9528. region: 'center',
  9529. xtype: 'yvgrid',
  9530. layout: 'fit',
  9531. reference: 'grid1',
  9532. pagination: true,
  9533. autoLoad: false,
  9534. selModel: {
  9535. selType: 'rowmodel',
  9536. mode: 'SINGLE',
  9537. },
  9538. dataSource: {
  9539. method: 'invoke',
  9540. url: '/sys/api/Api@queryLog',
  9541. params: {
  9542. formData: '{form2}',
  9543. path: '{form.api_url}',
  9544. },
  9545. },
  9546. listeners: {
  9547. rowdblclick: 'scope.showDialog',
  9548. },
  9549. columns: [
  9550. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9551. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9552. { dataIndex: "thread", header: "thread", width: 150 },
  9553. { dataIndex: "message", header: "message", flex: 1 },
  9554. ]
  9555. }
  9556. ]
  9557. };
  9558. var LogPage = /** @class */ (function (_super) {
  9559. __extends(LogPage, _super);
  9560. function LogPage() {
  9561. return _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  9562. }
  9563. LogPage.prototype.onLoad = function () {
  9564. _super.prototype.onLoad.call(this);
  9565. this.queryLog();
  9566. };
  9567. LogPage.prototype.queryLog = function () {
  9568. this.refs.grid1.reload();
  9569. };
  9570. LogPage.prototype.showDialog = function () {
  9571. var _a, _b;
  9572. 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; });
  9573. if (!rows || rows.length <= 0)
  9574. return;
  9575. var dialog = new ApiInfoDialog$1();
  9576. dialog.showDialog(null, {}, {
  9577. data: {
  9578. form: __assign({}, rows[0])
  9579. }
  9580. });
  9581. };
  9582. LogPage.prototype.aroundLogs = function () {
  9583. var _a, _b;
  9584. 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; });
  9585. if (!rows || rows.length <= 0)
  9586. return;
  9587. var dialog = new AroundLog();
  9588. dialog.showDialog(null, {}, {
  9589. data: {
  9590. form2: __assign({}, rows[0])
  9591. }
  9592. });
  9593. };
  9594. return LogPage;
  9595. }(Scope));
  9596. //# sourceMappingURL=LogPage.js.map
  9597. var Controller$2 = /** @class */ (function () {
  9598. function Controller() {
  9599. }
  9600. Controller.prototype.queryLog = function () {
  9601. var form2 = this.getViewModel().get("form2");
  9602. var logPage = new LogPage();
  9603. logPage.showPage({}, {
  9604. data: {
  9605. form2: __assign({}, form2)
  9606. }
  9607. });
  9608. };
  9609. return Controller;
  9610. }());
  9611. var controller$2 = new Controller$2();
  9612. function initLogsTree () {
  9613. Ext.define('com.yvan.studio.LogsTree', {
  9614. extend: 'Ext.panel.Panel',
  9615. xtype: 'logstree',
  9616. controller: controller$2,
  9617. scope: controller$2,
  9618. viewModel: {
  9619. data: {
  9620. form2: {
  9621. key: "",
  9622. start_at: "",
  9623. end_at: "",
  9624. }
  9625. }
  9626. },
  9627. reference: 'logstree',
  9628. tooltip: '表单定义',
  9629. iconCls: 'x-fa fa-bar-chart',
  9630. useArrows: true,
  9631. rootVisible: false,
  9632. colspan: 2,
  9633. lines: true,
  9634. multiSelect: false,
  9635. referenceHolder: true,
  9636. items: [
  9637. {
  9638. region: 'north',
  9639. xtype: 'form',
  9640. reference: 'form2',
  9641. split: true,
  9642. items: [
  9643. {
  9644. xtype: 'textfield',
  9645. fieldLabel: '关键字',
  9646. bind: {
  9647. value: "{form2.key}"
  9648. },
  9649. },
  9650. {
  9651. xtype: 'datefield',
  9652. fieldLabel: '开始时间',
  9653. bind: {
  9654. value: "{form2.start_at}"
  9655. },
  9656. },
  9657. {
  9658. xtype: 'datefield',
  9659. fieldLabel: '结束时间',
  9660. bind: {
  9661. value: "{form2.end_at}"
  9662. },
  9663. },
  9664. ]
  9665. },
  9666. {
  9667. xtype: "cols",
  9668. items: [
  9669. {
  9670. xtype: "box",
  9671. },
  9672. {
  9673. xtype: "button",
  9674. text: '查询',
  9675. listeners: {
  9676. click: 'queryLog'
  9677. },
  9678. },
  9679. {
  9680. xtype: "box",
  9681. },
  9682. ]
  9683. },
  9684. ],
  9685. });
  9686. }
  9687. //# sourceMappingURL=LogsTree.js.map
  9688. var model$8 = {
  9689. data: {
  9690. // opsId: "",
  9691. // name: "",
  9692. running: false,
  9693. }
  9694. };
  9695. //# sourceMappingURL=DevOpsTerminal.model.js.map
  9696. var vjson$8 = {
  9697. bind: {
  9698. title: '运维-{name}',
  9699. },
  9700. layout: 'fit',
  9701. items: [
  9702. {
  9703. layout: 'border',
  9704. items: [
  9705. {
  9706. region: 'north',
  9707. items: [
  9708. {
  9709. xtype: 'toolbar',
  9710. border: false,
  9711. items: [
  9712. {
  9713. xtype: 'button',
  9714. text: '执行',
  9715. iconCls: 'x-fa fa-play',
  9716. bind: {
  9717. hidden: "{running}",
  9718. },
  9719. listeners: {
  9720. click: 'scope.start'
  9721. }
  9722. },
  9723. {
  9724. xtype: 'button',
  9725. text: '停止',
  9726. iconCls: 'x-fa fa-stop',
  9727. bind: {
  9728. hidden: "{!running}",
  9729. },
  9730. listeners: {
  9731. click: 'scope.stop'
  9732. }
  9733. },
  9734. ],
  9735. },
  9736. ]
  9737. },
  9738. {
  9739. region: 'center',
  9740. reference: 'terminal',
  9741. xtype: 'terminal',
  9742. },
  9743. ],
  9744. },
  9745. ],
  9746. };
  9747. //# sourceMappingURL=DevOpsTerminal.view.js.map
  9748. var DevOpsTerminal = /** @class */ (function (_super) {
  9749. __extends(DevOpsTerminal, _super);
  9750. function DevOpsTerminal() {
  9751. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  9752. _this.websocket = undefined;
  9753. return _this;
  9754. }
  9755. DevOpsTerminal.prototype.onLoad = function () {
  9756. this.load();
  9757. };
  9758. DevOpsTerminal.prototype.onDestroy = function () {
  9759. if (this.websocket) {
  9760. this.websocket.close();
  9761. this.websocket = undefined;
  9762. }
  9763. };
  9764. DevOpsTerminal.prototype.load = function () {
  9765. var _this = this;
  9766. var opsId = this.viewModel.get('opsId');
  9767. this.setLoading(true);
  9768. devOpsById(opsId).then(function (res) {
  9769. _this.viewModel.set('devOps', res.data);
  9770. }).finally(function () {
  9771. _this.setLoading(false);
  9772. });
  9773. };
  9774. DevOpsTerminal.prototype.start = function () {
  9775. var me = this;
  9776. var running = this.viewModel.get('running');
  9777. var devOps = this.viewModel.get('devOps');
  9778. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  9779. return;
  9780. var devopsServer = "ws://122.9.140.63:9999";
  9781. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  9782. this.websocket.addEventListener('open', function () {
  9783. me.viewModel.set('running', true);
  9784. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  9785. });
  9786. this.websocket.addEventListener('message', function (event) {
  9787. me.refs.terminal.write(event.data);
  9788. });
  9789. this.websocket.addEventListener('close', function () {
  9790. me.stop();
  9791. });
  9792. this.websocket.addEventListener('error', function () {
  9793. me.stop();
  9794. });
  9795. };
  9796. DevOpsTerminal.prototype.stop = function () {
  9797. if (this.websocket) {
  9798. this.websocket.close();
  9799. this.websocket = undefined;
  9800. }
  9801. this.viewModel.set('running', false);
  9802. };
  9803. return DevOpsTerminal;
  9804. }(Scope));
  9805. //# sourceMappingURL=DevOpsTerminal.js.map
  9806. var Controller$3 = /** @class */ (function () {
  9807. function Controller() {
  9808. }
  9809. Controller.prototype.onLoad = function (sender) {
  9810. this.reload();
  9811. };
  9812. Controller.prototype.reload = function () {
  9813. var me = this;
  9814. // @ts-ignore
  9815. var view = me.getView();
  9816. view.setLoading(true);
  9817. devOpsList().then(function (res) {
  9818. view.setStore(new Ext.data.Store({
  9819. fields: ['ops_id', 'host', 'name'],
  9820. data: res.data,
  9821. }));
  9822. }).finally(function () {
  9823. view.setLoading(false);
  9824. });
  9825. };
  9826. Controller.prototype.onDblClick = function (sender) {
  9827. this.devOpsTerminal();
  9828. };
  9829. Controller.prototype.devOpsTerminal = function () {
  9830. // @ts-ignore
  9831. var view = this.getView();
  9832. var _a = __read(view.getSelection(), 1), record = _a[0];
  9833. if (record) {
  9834. var name = record.get('name');
  9835. var opsId = record.get('ops_id');
  9836. var instance = new DevOpsTerminal();
  9837. instance.showPage({
  9838. id: 'ops_' + opsId,
  9839. path: 'ops_' + opsId,
  9840. }, {
  9841. data: {
  9842. opsId: opsId,
  9843. name: name,
  9844. }
  9845. });
  9846. instance.dialogSuccess = function () {
  9847. };
  9848. }
  9849. };
  9850. return Controller;
  9851. }());
  9852. var controller$3 = new Controller$3();
  9853. function initDevOpsTree () {
  9854. Ext.define('com.yvan.studio.DevOpsGrid', {
  9855. extend: 'Ext.grid.Panel',
  9856. xtype: 'devopsgrid',
  9857. controller: controller$3,
  9858. scope: controller$3,
  9859. referenceHolder: true,
  9860. tooltip: '运维',
  9861. iconCls: 'x-fa fa-terminal',
  9862. useArrows: true,
  9863. reference: 'devopsgrid',
  9864. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  9865. listeners: {
  9866. afterrender: 'onLoad',
  9867. itemdblclick: 'onDblClick',
  9868. },
  9869. viewConfig: {
  9870. // listeners: {
  9871. // itemcontextmenu: 'onGridContextMenu',
  9872. // },
  9873. },
  9874. tbar: {
  9875. xtype: 'toolbar',
  9876. items: [
  9877. {
  9878. xtype: 'button',
  9879. tooltip: '刷新',
  9880. iconCls: 'x-fa fa-refresh',
  9881. listeners: {
  9882. click: 'reload'
  9883. }
  9884. },
  9885. {
  9886. xtype: 'textfield',
  9887. flex: 1,
  9888. emptyText: '搜索过滤',
  9889. enableKeyEvents: true,
  9890. listeners: {
  9891. change: {
  9892. fn: 'filterChanged',
  9893. buffer: 50
  9894. }
  9895. }
  9896. },
  9897. ]
  9898. },
  9899. columns: [
  9900. {
  9901. text: 'ID', dataIndex: 'report_id',
  9902. hidden: true,
  9903. },
  9904. {
  9905. text: '服务器',
  9906. dataIndex: 'host',
  9907. width: 100,
  9908. menuDisabled: true,
  9909. },
  9910. {
  9911. text: '操作名称',
  9912. dataIndex: 'name',
  9913. flex: 1,
  9914. menuDisabled: true,
  9915. },
  9916. ]
  9917. });
  9918. }
  9919. //# sourceMappingURL=DevOpsTree.js.map
  9920. function initTerminal () {
  9921. Ext.define('com.yvan.studio.Terminal', {
  9922. extend: 'Ext.panel.Panel',
  9923. alias: 'widget.terminal',
  9924. xtype: 'terminal',
  9925. layout: 'fit',
  9926. border: false,
  9927. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  9928. config: {},
  9929. write: function (str) {
  9930. if (this.term) {
  9931. this.term.write(str);
  9932. }
  9933. },
  9934. initComponent: function () {
  9935. var that = this;
  9936. this.superclass.initComponent.call(this, arguments);
  9937. that.on({
  9938. resize: function () {
  9939. var _a;
  9940. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  9941. that.fitAddon.fit();
  9942. }
  9943. },
  9944. destory: function () {
  9945. if (that.term) {
  9946. that.term.dispose();
  9947. delete that.term;
  9948. }
  9949. if (that.fitAddon) {
  9950. that.fitAddon.dispose();
  9951. delete that.fitAddon;
  9952. }
  9953. },
  9954. afterrender: function (sender) {
  9955. _.defer(function () {
  9956. var $dom = $(that.el.dom).find('.terminal');
  9957. that.term = new xterm.Terminal({
  9958. // cursorBlink: false,
  9959. // cursorStyle: 'bar', // block underline bar
  9960. // enableBold: false,
  9961. // bellStyle: "sound",
  9962. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  9963. // scrollback: 10000,
  9964. // tabStopWidth: 4,
  9965. disableStdin: true,
  9966. theme: {
  9967. // foreground: "#111",
  9968. // background: "#fdfdfd",
  9969. // background: "#fafafa",
  9970. },
  9971. });
  9972. that.fitAddon = new xtermAddonFit.FitAddon();
  9973. that.term.loadAddon(that.fitAddon);
  9974. that.term.open($dom[0]);
  9975. that.fitAddon.fit();
  9976. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  9977. });
  9978. }
  9979. });
  9980. }
  9981. });
  9982. }
  9983. //# sourceMappingURL=Terminal.js.map
  9984. var vjson$9 = {
  9985. title: '接口统计',
  9986. layout: 'fit',
  9987. items: [
  9988. {
  9989. title: '接口统计',
  9990. xtype: 'yvgrid',
  9991. enableLocking: false,
  9992. reference: 'grid1',
  9993. pagination: false,
  9994. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  9995. tbar: {
  9996. xtype: 'form',
  9997. items: [
  9998. {
  9999. xtype: 'cols',
  10000. items: [
  10001. {
  10002. xtype: 'textfield',
  10003. fieldLabel: '搜索',
  10004. listeners: {
  10005. change: 'scope.requestFilterChange'
  10006. }
  10007. },
  10008. ]
  10009. },
  10010. ]
  10011. },
  10012. columns: [
  10013. { text: '地址', dataIndex: 'url', flex: 1 },
  10014. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  10015. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10016. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10017. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10018. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10019. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10020. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10021. ],
  10022. leadingBufferZone: 8,
  10023. trailingBufferZone: 8,
  10024. viewConfig: {
  10025. listeners: {
  10026. expandbody: 'scope.onChildExpand'
  10027. }
  10028. },
  10029. listeners: {
  10030. itemdblclick: 'scope.itemClick1'
  10031. },
  10032. plugins: {
  10033. rowwidget: {
  10034. widget: {
  10035. xtype: 'yvgrid',
  10036. hideFootbar: true,
  10037. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10038. listeners: {
  10039. itemdblclick: 'scope.itemClick1'
  10040. },
  10041. columns: [
  10042. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10043. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10044. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10045. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10046. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10047. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10048. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10049. ]
  10050. }
  10051. }
  10052. }
  10053. },
  10054. ]
  10055. };
  10056. //# sourceMappingURL=InterfaceStatistics.view.js.map
  10057. var model$9 = {
  10058. data: {
  10059. count: 0,
  10060. dataSourceName: '',
  10061. sql: "",
  10062. histogram: '',
  10063. maxCost: 0,
  10064. minCost: 0,
  10065. avgCost: '',
  10066. sumCost: 0,
  10067. histogramInfos: [
  10068. // count: 1
  10069. // gteCost: 20
  10070. // ltCost: 50
  10071. // 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"
  10072. // topN: [
  10073. // cost: 24
  10074. // occurrenceTime: "1648004895171"
  10075. // 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"
  10076. // ]
  10077. ]
  10078. }
  10079. };
  10080. //# sourceMappingURL=PerformDialog.model.js.map
  10081. var vjson$a = {
  10082. title: '性能统计详情',
  10083. height: 400,
  10084. width: 800,
  10085. modal: true,
  10086. layout: 'fit',
  10087. items: [
  10088. {
  10089. xtype: 'tabpanel',
  10090. items: [
  10091. {
  10092. title: '摘要',
  10093. key: "1",
  10094. layout: 'border',
  10095. items: [
  10096. {
  10097. region: 'north',
  10098. border: false,
  10099. defaults: {
  10100. margin: '8 0 0 0'
  10101. },
  10102. items: [
  10103. {
  10104. xtype: 'cols',
  10105. defaultType: 'displayfield',
  10106. defaults: {
  10107. labelWidth: 70,
  10108. },
  10109. items: [
  10110. {
  10111. fieldLabel: 'count',
  10112. bind: {
  10113. value: '{count}'
  10114. }
  10115. },
  10116. {
  10117. fieldLabel: 'maxCost',
  10118. bind: {
  10119. value: '{maxCost}'
  10120. }
  10121. },
  10122. {
  10123. fieldLabel: 'minCost',
  10124. bind: {
  10125. value: '{minCost}'
  10126. }
  10127. },
  10128. {
  10129. fieldLabel: 'avgCost',
  10130. bind: {
  10131. value: '{avgCost}'
  10132. }
  10133. },
  10134. {
  10135. fieldLabel: 'sumCost',
  10136. bind: {
  10137. value: '{sumCost}'
  10138. }
  10139. },
  10140. ]
  10141. },
  10142. {
  10143. xtype: 'cols',
  10144. items: [
  10145. {
  10146. flex: 5,
  10147. border: false,
  10148. items: [
  10149. {
  10150. xtype: 'segmentedbutton',
  10151. reference: 'histogram',
  10152. allowToggle: false,
  10153. border: false,
  10154. items: []
  10155. }
  10156. ]
  10157. },
  10158. ]
  10159. },
  10160. ],
  10161. },
  10162. {
  10163. region: 'center',
  10164. xtype: 'sqleditor',
  10165. reference: 'sqlEditor',
  10166. },
  10167. ]
  10168. },
  10169. {
  10170. title: '直方图',
  10171. key: "2",
  10172. }
  10173. ]
  10174. }
  10175. ]
  10176. };
  10177. //# sourceMappingURL=PerformDialog.view.js.map
  10178. var PerformDialog = /** @class */ (function (_super) {
  10179. __extends(PerformDialog, _super);
  10180. function PerformDialog() {
  10181. return _super.call(this, { model: model$9, vjson: vjson$a }) || this;
  10182. }
  10183. PerformDialog.prototype.onLoad = function () {
  10184. var _this = this;
  10185. var sql = this.viewModel.get('sql');
  10186. var sql2 = sqlFormat.format(sql, {
  10187. indent: ' ',
  10188. uppercase: true,
  10189. });
  10190. var histogramInfos = this.viewModel.get('histogramInfos');
  10191. var vs = _$2.map(histogramInfos, function (v) {
  10192. if (v.ltCost > 2100000000) {
  10193. return {
  10194. text: "[" + v.gteCost + ", \u221E):" + v.count
  10195. };
  10196. }
  10197. return {
  10198. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  10199. };
  10200. });
  10201. this.refs.sqlEditor.setCode(sql2);
  10202. _$2.forEach(vs, function (v) {
  10203. _this.refs.histogram.add(v);
  10204. });
  10205. };
  10206. return PerformDialog;
  10207. }(Scope));
  10208. //# sourceMappingURL=PerformDialog.js.map
  10209. var model$a = {
  10210. data: {}
  10211. };
  10212. var PerformStats = /** @class */ (function (_super) {
  10213. __extends(PerformStats, _super);
  10214. function PerformStats() {
  10215. var _this = _super.call(this, { model: model$a, vjson: vjson$9 }) || this;
  10216. _this.requestFilterChange = _.debounce(function (sender, value) {
  10217. var store = _this.refs.grid1.store;
  10218. store.clearFilter();
  10219. if (value) {
  10220. store.filterBy(function (record, id) {
  10221. var text = toString(record.get('url'));
  10222. // 用拼音筛选的方式
  10223. return text.includes(value);
  10224. });
  10225. }
  10226. }, 100);
  10227. return _this;
  10228. }
  10229. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10230. widget.setData(record.data.children);
  10231. };
  10232. PerformStats.prototype.itemClick1 = function (sender, record) {
  10233. console.log('itemClick1', record.data);
  10234. new PerformDialog().showDialog(sender, {}, {
  10235. data: record.data
  10236. });
  10237. };
  10238. PerformStats.prototype.onLoad = function () {
  10239. var _this = this;
  10240. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10241. .then(function (_a) {
  10242. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10243. var resData = reqRes.data;
  10244. var jdbcData = jdbcRes.data;
  10245. _.forEach(jdbcData, function (item) {
  10246. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10247. });
  10248. _.forEach(resData, function (item) {
  10249. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10250. if (_.isArray(item.sqls)) {
  10251. item.children = _.map(item.sqls, function (sql) {
  10252. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10253. }).filter(function (v) { return !!v; });
  10254. }
  10255. item.jdbcCount = _.size(item.children);
  10256. });
  10257. _this.refs.grid1.setData(resData);
  10258. // this.refs.grid2.setData(jdbcData)
  10259. });
  10260. };
  10261. return PerformStats;
  10262. }(Scope));
  10263. //# sourceMappingURL=InterfaceStatistics.js.map
  10264. var vjson$b = {
  10265. title: '性能统计',
  10266. layout: 'fit',
  10267. items: [
  10268. {
  10269. title: '数据库统计',
  10270. xtype: 'yvgrid',
  10271. enableLocking: false,
  10272. reference: 'grid2',
  10273. pagination: false,
  10274. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10275. tbar: {
  10276. xtype: 'form',
  10277. items: [
  10278. {
  10279. xtype: 'cols',
  10280. items: [
  10281. {
  10282. fieldLabel: '搜索',
  10283. listeners: {
  10284. change: 'scope.jdbcFilterChange'
  10285. }
  10286. },
  10287. ]
  10288. },
  10289. ]
  10290. },
  10291. listeners: {
  10292. itemdblclick: 'scope.itemClick1'
  10293. },
  10294. columns: [
  10295. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10296. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10297. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10298. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10299. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10300. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10301. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10302. ]
  10303. },
  10304. ]
  10305. };
  10306. //# sourceMappingURL=DatabaseStatistics.view.js.map
  10307. var model$b = {
  10308. data: {}
  10309. };
  10310. var PerformStats$1 = /** @class */ (function (_super) {
  10311. __extends(PerformStats, _super);
  10312. function PerformStats() {
  10313. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  10314. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  10315. var store = _this.refs.grid2.store;
  10316. store.clearFilter();
  10317. if (value) {
  10318. store.filterBy(function (record, id) {
  10319. var text = toString(record.get('sql'));
  10320. // 用拼音筛选的方式
  10321. return text.includes(value);
  10322. });
  10323. }
  10324. }, 100);
  10325. return _this;
  10326. }
  10327. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10328. widget.setData(record.data.children);
  10329. };
  10330. PerformStats.prototype.itemClick1 = function (sender, record) {
  10331. console.log('itemClick1', record.data);
  10332. new PerformDialog().showDialog(sender, {}, {
  10333. data: record.data
  10334. });
  10335. };
  10336. PerformStats.prototype.onLoad = function () {
  10337. var _this = this;
  10338. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10339. .then(function (_a) {
  10340. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10341. var resData = reqRes.data;
  10342. var jdbcData = jdbcRes.data;
  10343. _.forEach(jdbcData, function (item) {
  10344. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10345. });
  10346. _.forEach(resData, function (item) {
  10347. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10348. if (_.isArray(item.sqls)) {
  10349. item.children = _.map(item.sqls, function (sql) {
  10350. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10351. }).filter(function (v) { return !!v; });
  10352. }
  10353. item.jdbcCount = _.size(item.children);
  10354. });
  10355. _this.refs.grid2.setData(jdbcData);
  10356. });
  10357. };
  10358. return PerformStats;
  10359. }(Scope));
  10360. //# sourceMappingURL=DatabaseStatistics.js.map
  10361. var Controller$4 = /** @class */ (function () {
  10362. function Controller() {
  10363. }
  10364. Controller.prototype.onDblClick = function (sender, record) {
  10365. var data = record.raw;
  10366. if (data.text === "接口统计") {
  10367. var page = new PerformStats();
  10368. page.showPage({
  10369. title: "接口统计",
  10370. id: '_InterfaceStatistics',
  10371. path: '_InterfaceStatistics',
  10372. }, {});
  10373. }
  10374. else if (data.text === "数据库统计") {
  10375. var page = new PerformStats$1();
  10376. page.showPage({
  10377. title: "数据库统计",
  10378. id: '_DatabaseStatistics',
  10379. path: '_DatabaseStatistics',
  10380. }, {});
  10381. }
  10382. };
  10383. Controller.prototype.onLoad = function () {
  10384. var me = this;
  10385. //@ts-ignore
  10386. var view = me.getView();
  10387. view.setRootNode({
  10388. expanded: true,
  10389. leaf: false,
  10390. children: [
  10391. { leaf: true, text: '接口统计' },
  10392. { leaf: true, text: '数据库统计' },
  10393. ]
  10394. });
  10395. };
  10396. return Controller;
  10397. }());
  10398. var controller$4 = new Controller$4();
  10399. function initMonitorTree () {
  10400. Ext.define('com.yvan.studio.MonitorTree', {
  10401. extend: 'Ext.tree.Panel',
  10402. xtype: 'monitortree',
  10403. controller: controller$4,
  10404. scope: controller$4,
  10405. reference: 'roleGrid',
  10406. tooltip: '表单定义',
  10407. iconCls: 'x-fa fa-bar-chart',
  10408. useArrows: true,
  10409. rootVisible: false,
  10410. colspan: 2,
  10411. lines: true,
  10412. multiSelect: false,
  10413. referenceHolder: true,
  10414. // openNode() {
  10415. // const selection = this.getSelection()
  10416. // const [record] = selection
  10417. // if (!record) {
  10418. // return
  10419. // }
  10420. //
  10421. // const {raw} = record;
  10422. // if (raw.type === 'Dir') {
  10423. // return
  10424. // }
  10425. // if (raw.type === "Module" && raw.module) {
  10426. // // eventBus.publish(EventType.ModuleOpen, raw)
  10427. // }
  10428. // },
  10429. listeners: {
  10430. itemdblclick: 'onDblClick',
  10431. afterrender: "onLoad",
  10432. },
  10433. });
  10434. }
  10435. //# sourceMappingURL=MonitorTree.js.map
  10436. var Controller$5 = /** @class */ (function () {
  10437. function Controller() {
  10438. }
  10439. return Controller;
  10440. }());
  10441. var controller$5 = new Controller$5();
  10442. function initHomeTree () {
  10443. Ext.define('com.yvan.studio.HomeTree', {
  10444. extend: 'Ext.Panel',
  10445. xtype: 'hometree',
  10446. controller: controller$5,
  10447. scope: controller$5,
  10448. referenceHolder: true,
  10449. bodyCls: 'home',
  10450. // layout: 'fit',
  10451. tbar: {
  10452. xtype: 'toolbar',
  10453. items: [
  10454. {
  10455. xtype: 'button',
  10456. iconCls: 'x-fa fa-exchange',
  10457. text: '数据结构同步',
  10458. handler: function (sender) {
  10459. handles$1.mainWindow.showDataSync(sender);
  10460. }
  10461. },
  10462. {
  10463. xtype: 'button',
  10464. iconCls: 'x-fa fa-cubes',
  10465. text: '数据域管理',
  10466. handler: function (sender) {
  10467. handles$1.mainWindow.showColumnDomain();
  10468. }
  10469. },
  10470. ],
  10471. },
  10472. // items: [
  10473. //
  10474. // ],
  10475. layout: {
  10476. type: 'vbox',
  10477. pack: 'start',
  10478. align: 'stretch',
  10479. },
  10480. items: [
  10481. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  10482. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  10483. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  10484. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  10485. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  10486. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  10487. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  10488. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  10489. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  10490. ],
  10491. });
  10492. }
  10493. //# sourceMappingURL=HomeTree.js.map
  10494. var WidgetStore = /** @class */ (function (_super) {
  10495. __extends(WidgetStore, _super);
  10496. function WidgetStore() {
  10497. return _super !== null && _super.apply(this, arguments) || this;
  10498. }
  10499. WidgetStore.prototype.getCacheKey = function (param) {
  10500. return "widget_data.json";
  10501. };
  10502. /*invokeApi(param: any): Promise<any> {
  10503. return new Promise<any>(resolve => {
  10504. //@ts-ignore
  10505. require(["../../widget/all"], function (res) {
  10506. const widgetList = res.default
  10507. resolve(widgetList)
  10508. })
  10509. })
  10510. }*/
  10511. WidgetStore.prototype.invokeApi = function (param) {
  10512. return widgetListApi(param);
  10513. };
  10514. return WidgetStore;
  10515. }(CacheStore));
  10516. var instance$2 = new WidgetStore();
  10517. //# sourceMappingURL=WidgetStore.js.map
  10518. var WidgetGridController = /** @class */ (function () {
  10519. function WidgetGridController() {
  10520. }
  10521. WidgetGridController.prototype.onLoad = function (sender) {
  10522. var me = this;
  10523. setWidget(me);
  10524. instance$2.registe(me.reloadData.bind(this));
  10525. instance$2.reloadIfNeed(undefined);
  10526. };
  10527. WidgetGridController.prototype.widgetAdd = function (sender) {
  10528. var me = this;
  10529. var win = new Ext.Window({
  10530. autoDestroy: true,
  10531. title: "新建弹框",
  10532. width: 400,
  10533. height: 220,
  10534. resizable: true,
  10535. closable: true,
  10536. maximizable: true,
  10537. minimizable: true,
  10538. plain: true,
  10539. // constrainHeader: true,
  10540. constrain: true,
  10541. layout: 'fit',
  10542. animateTarget: sender,
  10543. buttonAlign: 'center',
  10544. items: [
  10545. {
  10546. xtype: "form",
  10547. layout: "hbox",
  10548. margin: '10px 20px',
  10549. border: 0,
  10550. items: [
  10551. {
  10552. flex: 1,
  10553. layout: 'vbox',
  10554. items: [
  10555. {
  10556. xtype: "textfield",
  10557. name: "widgetcode",
  10558. fieldLabel: "弹窗文件",
  10559. flex: 1,
  10560. allowBlank: false,
  10561. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  10562. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  10563. labelWidth: 80,
  10564. width: "100%",
  10565. },
  10566. {
  10567. xtype: "textfield",
  10568. name: "widgetname",
  10569. fieldLabel: "弹窗名称",
  10570. flex: 1,
  10571. allowBlank: false,
  10572. labelWidth: 80,
  10573. width: "100%",
  10574. },
  10575. ]
  10576. },
  10577. ]
  10578. }
  10579. ],
  10580. //窗口按钮
  10581. buttons: [
  10582. {
  10583. xtype: 'button', text: '保存', handler: function (btn) {
  10584. //窗口获取表单
  10585. var form = win.down('form');
  10586. var vaildSuccess = form.isValid();
  10587. if (!vaildSuccess) {
  10588. return;
  10589. }
  10590. var title = form.down('textfield[name="widgetname"]').getValue();
  10591. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  10592. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  10593. if (res.success) {
  10594. msg$1('添加成功');
  10595. // 添加
  10596. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  10597. me.reload();
  10598. });
  10599. win.close();
  10600. }
  10601. });
  10602. }
  10603. },
  10604. {
  10605. xtype: 'button', text: '取消', handler: function (btn) {
  10606. //窗口关闭
  10607. win.close();
  10608. }
  10609. }
  10610. ]
  10611. });
  10612. win.show();
  10613. };
  10614. WidgetGridController.prototype.widgetRemove = function (sender) {
  10615. var _this = this;
  10616. //@ts-ignore
  10617. var record = this.getView().selection.data;
  10618. if (!record) {
  10619. msg$1('请选择一行');
  10620. return;
  10621. }
  10622. var widgetPath = record.widget_path;
  10623. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  10624. if (btn === 'yes') {
  10625. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  10626. if (res.success) {
  10627. msg$1(res.msg);
  10628. _this.reload();
  10629. }
  10630. });
  10631. }
  10632. });
  10633. };
  10634. WidgetGridController.prototype.widgetEdit = function (record) {
  10635. var _this = this;
  10636. if (record) {
  10637. var widgetPath = record.widget_path;
  10638. var widgetName = record.widget_name;
  10639. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  10640. _this.reload();
  10641. });
  10642. }
  10643. };
  10644. WidgetGridController.prototype.onDestory = function (sender) {
  10645. var me = this;
  10646. setWidget(undefined);
  10647. instance$2.unregiste(me.reloadData.bind(this));
  10648. };
  10649. WidgetGridController.prototype.reloadData = function (res) {
  10650. var me = this;
  10651. //@ts-ignore
  10652. var view = me.getView();
  10653. if (typeof res === 'object') {
  10654. // const data = []
  10655. // _.forOwn(res, (v, k) => {
  10656. // data.push({
  10657. // widget_path: k,
  10658. // widget_name: v.title,
  10659. // vjson : v
  10660. // })
  10661. // })
  10662. view.setStore(new Ext.data.Store({
  10663. fields: ['widget_path', 'widget_name'],
  10664. data: res.data,
  10665. }));
  10666. }
  10667. else if (typeof res === 'boolean') {
  10668. view.setLoading(res);
  10669. }
  10670. };
  10671. WidgetGridController.prototype.reload = function () {
  10672. instance$2.reloadForce(undefined);
  10673. };
  10674. WidgetGridController.prototype.filterChanged = function (sender, value) {
  10675. //@ts-ignore
  10676. this.view.store.clearFilter();
  10677. if (value) {
  10678. //@ts-ignore
  10679. this.view.store.filterBy(function (record) {
  10680. var widget_path = record.get('widget_path');
  10681. var widget_name = record.get('widget_name');
  10682. return (window['system'].pinyinMatch(widget_name, value) ||
  10683. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10684. });
  10685. }
  10686. };
  10687. WidgetGridController.prototype.onClearClick = function () {
  10688. var _a, _b;
  10689. //@ts-ignore
  10690. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10691. };
  10692. WidgetGridController.prototype.onDblClick = function (sender, record) {
  10693. this.widgetEdit(record.data);
  10694. };
  10695. return WidgetGridController;
  10696. }());
  10697. //# sourceMappingURL=WidgetGridController.js.map
  10698. function initWidget () {
  10699. var controller = new WidgetGridController();
  10700. Ext.define('com.yvan.studio.WidgetGrid', {
  10701. extend: 'Ext.grid.Panel',
  10702. xtype: 'widgetgrid',
  10703. controller: controller,
  10704. scope: controller,
  10705. referenceHolder: true,
  10706. tooltip: '检索窗口',
  10707. iconCls: 'x-fa fa-search',
  10708. useArrows: true,
  10709. reference: 'widgetgrid',
  10710. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10711. listeners: {
  10712. itemdblclick: 'onDblClick',
  10713. afterrender: 'onLoad',
  10714. destory: 'onDestory',
  10715. },
  10716. viewConfig: {
  10717. listeners: {
  10718. itemcontextmenu: 'onGridContextMenu',
  10719. },
  10720. },
  10721. tbar: [
  10722. {
  10723. xtype: 'button',
  10724. tooltip: '刷新',
  10725. iconCls: 'x-fa fa-refresh',
  10726. listeners: {
  10727. click: 'reload'
  10728. }
  10729. },
  10730. {
  10731. xtype: 'button',
  10732. tooltip: '添加',
  10733. iconCls: 'x-fa fa-plus-circle',
  10734. listeners: {
  10735. click: 'widgetAdd'
  10736. }
  10737. },
  10738. {
  10739. xtype: 'button',
  10740. tooltip: '删除',
  10741. iconCls: 'x-fa fa-minus-circle',
  10742. listeners: {
  10743. click: 'widgetRemove'
  10744. }
  10745. },
  10746. ],
  10747. fbar: [
  10748. {
  10749. xtype: 'textfield',
  10750. flex: 1,
  10751. reference: "txtFilter",
  10752. emptyText: '搜索过滤',
  10753. enableKeyEvents: true,
  10754. listeners: {
  10755. change: {
  10756. fn: 'filterChanged',
  10757. buffer: 50
  10758. }
  10759. }
  10760. },
  10761. ],
  10762. columns: [
  10763. {
  10764. text: '弹窗文件', dataIndex: 'widget_path',
  10765. menuDisabled: true, flex: 1,
  10766. },
  10767. {
  10768. text: '弹窗名称', dataIndex: 'widget_name',
  10769. menuDisabled: true, flex: 1,
  10770. },
  10771. ]
  10772. });
  10773. }
  10774. //# sourceMappingURL=WidgetGrid.js.map
  10775. var WhLayoutController = /** @class */ (function () {
  10776. function WhLayoutController() {
  10777. }
  10778. WhLayoutController.prototype.onLoad = function (sender) {
  10779. var _this = this;
  10780. var me = this;
  10781. setWhLayout(me);
  10782. _$2.defer(function () {
  10783. _this.reload();
  10784. });
  10785. };
  10786. WhLayoutController.prototype.reload = function () {
  10787. //@ts-ignore
  10788. var view = this.getView();
  10789. view.setLoading(true);
  10790. loadWhLayoutAll().then(function (res) {
  10791. view.setStore(new Ext.data.Store({
  10792. fields: ['layout_code', 'layout_name'],
  10793. data: res.data,
  10794. }));
  10795. }).finally(function () {
  10796. view.setLoading(false);
  10797. });
  10798. };
  10799. WhLayoutController.prototype.add = function () {
  10800. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  10801. };
  10802. WhLayoutController.prototype.edit = function (data) {
  10803. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  10804. };
  10805. WhLayoutController.prototype.remove = function () {
  10806. var _this = this;
  10807. var _a;
  10808. //@ts-ignore
  10809. var view = this.getView();
  10810. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  10811. if (!record) {
  10812. msg$1('请选择一行数据');
  10813. return;
  10814. }
  10815. var layoutCode = record.layout_code;
  10816. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  10817. if (btn === 'yes') {
  10818. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  10819. if (res.success) {
  10820. msg$1(res.msg);
  10821. _this.reload();
  10822. }
  10823. });
  10824. }
  10825. });
  10826. };
  10827. WhLayoutController.prototype.onDblClick = function () {
  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. this.edit(record);
  10837. };
  10838. WhLayoutController.prototype.filterChanged = function (sender, value) {
  10839. //@ts-ignore
  10840. this.view.store.clearFilter();
  10841. if (value) {
  10842. //@ts-ignore
  10843. this.view.store.filterBy(function (record) {
  10844. var widget_path = record.get('widget_path');
  10845. var widget_name = record.get('widget_name');
  10846. return (window['system'].pinyinMatch(widget_name, value) ||
  10847. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10848. });
  10849. }
  10850. };
  10851. WhLayoutController.prototype.onClearClick = function () {
  10852. var _a, _b;
  10853. //@ts-ignore
  10854. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10855. };
  10856. return WhLayoutController;
  10857. }());
  10858. //# sourceMappingURL=WhLayoutController.js.map
  10859. function initWhLayout () {
  10860. var controller = new WhLayoutController();
  10861. Ext.define('com.yvan.studio.WhLayout', {
  10862. extend: 'Ext.grid.Panel',
  10863. xtype: 'whlayout',
  10864. alias: 'widget.whlayout',
  10865. controller: controller,
  10866. scope: controller,
  10867. referenceHolder: true,
  10868. tooltip: '检索窗口',
  10869. iconCls: 'x-fa fa-search',
  10870. useArrows: true,
  10871. reference: 'whlayout',
  10872. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10873. listeners: {
  10874. itemdblclick: 'onDblClick',
  10875. afterrender: 'onLoad',
  10876. destory: 'onDestory',
  10877. },
  10878. viewConfig: {
  10879. listeners: {
  10880. itemcontextmenu: 'onGridContextMenu',
  10881. },
  10882. },
  10883. tbar: [
  10884. {
  10885. xtype: 'button',
  10886. tooltip: '刷新',
  10887. iconCls: 'x-fa fa-refresh',
  10888. listeners: {
  10889. click: 'reload'
  10890. }
  10891. },
  10892. {
  10893. xtype: 'button',
  10894. tooltip: '添加',
  10895. iconCls: 'x-fa fa-plus-circle',
  10896. listeners: {
  10897. click: 'add'
  10898. }
  10899. },
  10900. {
  10901. xtype: 'button',
  10902. tooltip: '删除',
  10903. iconCls: 'x-fa fa-minus-circle',
  10904. listeners: {
  10905. click: 'remove'
  10906. }
  10907. },
  10908. ],
  10909. fbar: [
  10910. {
  10911. xtype: 'textfield',
  10912. flex: 1,
  10913. reference: "txtFilter",
  10914. emptyText: '搜索过滤',
  10915. enableKeyEvents: true,
  10916. listeners: {
  10917. change: {
  10918. fn: 'filterChanged',
  10919. buffer: 50
  10920. }
  10921. }
  10922. },
  10923. ],
  10924. columns: [
  10925. {
  10926. text: '图编号', dataIndex: 'layout_code',
  10927. menuDisabled: true, flex: 1,
  10928. },
  10929. {
  10930. text: '图名称', dataIndex: 'layout_name',
  10931. menuDisabled: true, flex: 1,
  10932. },
  10933. ]
  10934. });
  10935. }
  10936. //# sourceMappingURL=WhLayout.js.map
  10937. var BpmnTreeController = /** @class */ (function () {
  10938. function BpmnTreeController() {
  10939. }
  10940. BpmnTreeController.prototype.onLoad = function (sender) {
  10941. this.reload();
  10942. };
  10943. BpmnTreeController.prototype.reload = function () {
  10944. var me = this;
  10945. me.getView().setLoading(true);
  10946. exporerList().then(function (res) {
  10947. // handles.mainWindow.modules = res.data
  10948. // const rootNode = modulesToTreeData(res.data)
  10949. var rootNode = res.data.tree;
  10950. me.getView().setRootNode({
  10951. expanded: true,
  10952. leaf: false,
  10953. children: rootNode
  10954. });
  10955. // const lastId = window.location.hash.substring(1);
  10956. // file.selectPath(lastId)
  10957. // if (lastId) {
  10958. // const node = getModuleById(rootNode, lastId)
  10959. // if (node) {
  10960. // showDesign(node.id, node.path, node.text, node.module)
  10961. // }
  10962. // }
  10963. // this.restoreState()
  10964. }).finally(function () {
  10965. me.getView().setLoading(false);
  10966. });
  10967. };
  10968. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  10969. var _this = this;
  10970. e.preventDefault();
  10971. var raw = node.raw;
  10972. //const me = sender.up("treepanel").scope
  10973. var option;
  10974. if (raw.exporerType === 1) ;
  10975. else if (raw.exporerType === 21) {
  10976. if (raw.type === 'Dir') {
  10977. option = {
  10978. shadow: 'frame', allowOtherMenus: true,
  10979. items: [
  10980. {
  10981. text: '添加',
  10982. iconCls: 'x-fa fa-plus-circle',
  10983. handler: function (sender) {
  10984. var dirPath = raw.dirPath;
  10985. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  10986. }
  10987. },
  10988. '-',
  10989. {
  10990. text: '新建文件夹',
  10991. iconCls: 'x-fa fa-folder-o',
  10992. handler: function (sender) {
  10993. }
  10994. }
  10995. ]
  10996. };
  10997. }
  10998. else if (raw.type === 'Model') {
  10999. option = {
  11000. shadow: 'frame', allowOtherMenus: true,
  11001. items: [
  11002. {
  11003. text: '编辑',
  11004. iconCls: 'x-fa fa-edit',
  11005. handler: function (sender) {
  11006. }
  11007. },
  11008. {
  11009. text: '删除',
  11010. iconCls: 'x-fa fa-minus-circle',
  11011. handler: function (sender) {
  11012. }
  11013. },
  11014. '-',
  11015. {
  11016. text: '注册(至菜单)',
  11017. iconCls: 'x-fa fa-sign-in',
  11018. handler: function (sender) {
  11019. }
  11020. },
  11021. {
  11022. text: '新建文件夹',
  11023. iconCls: 'x-fa fa-folder-o',
  11024. handler: function (sender) {
  11025. }
  11026. }
  11027. ]
  11028. };
  11029. }
  11030. }
  11031. else if (raw.exporerType === 22) {
  11032. if (raw.type === 'Dir') {
  11033. option = {
  11034. shadow: 'frame', allowOtherMenus: true,
  11035. items: [
  11036. {
  11037. text: '添加',
  11038. iconCls: 'x-fa fa-plus-circle',
  11039. handler: function (sender) {
  11040. var dirPath = raw.dirPath;
  11041. handles$1.mainWindow.showFormBill();
  11042. }
  11043. },
  11044. '-',
  11045. {
  11046. text: '新建文件夹',
  11047. iconCls: 'x-fa fa-folder-o',
  11048. handler: function (sender) {
  11049. }
  11050. }
  11051. ]
  11052. };
  11053. }
  11054. else if (raw.type === 'Model') {
  11055. option = {
  11056. shadow: 'frame', allowOtherMenus: true,
  11057. items: [
  11058. {
  11059. text: '编辑',
  11060. iconCls: 'x-fa fa-edit',
  11061. handler: function (sender) {
  11062. }
  11063. },
  11064. {
  11065. text: '删除',
  11066. iconCls: 'x-fa fa-minus-circle',
  11067. handler: function (sender) {
  11068. }
  11069. },
  11070. '-',
  11071. {
  11072. text: '注册(至菜单)',
  11073. iconCls: 'x-fa fa-sign-in',
  11074. handler: function (sender) {
  11075. }
  11076. },
  11077. {
  11078. text: '新建文件夹',
  11079. iconCls: 'x-fa fa-folder-o',
  11080. handler: function (sender) {
  11081. }
  11082. }
  11083. ]
  11084. };
  11085. }
  11086. }
  11087. else if (raw.exporerType === 3) ;
  11088. else if (raw.exporerType === 50) {
  11089. option = {
  11090. shadow: 'frame', allowOtherMenus: true,
  11091. items: [
  11092. {
  11093. text: '新建流程',
  11094. iconCls: 'x-fa fa-new',
  11095. handler: function (sender) {
  11096. _this.bpmnAdd(sender);
  11097. }
  11098. },
  11099. ]
  11100. };
  11101. }
  11102. else if (raw.exporerType === 51) {
  11103. option = {
  11104. shadow: 'frame', allowOtherMenus: true,
  11105. items: [
  11106. {
  11107. text: '新建流程',
  11108. iconCls: 'x-fa fa-new',
  11109. handler: function (sender) {
  11110. _this.bpmnAdd(sender);
  11111. }
  11112. },
  11113. {
  11114. text: '删除',
  11115. iconCls: 'x-fa fa-minus-circle',
  11116. handler: function (sender) {
  11117. _this.bpmnDelete(sender, raw);
  11118. }
  11119. },
  11120. ]
  11121. };
  11122. }
  11123. else {
  11124. throw Error('暂时不支持!');
  11125. }
  11126. if (option) {
  11127. var treeMenu = new Ext.menu.Menu(option);
  11128. treeMenu.showAt(e.getXY());
  11129. }
  11130. };
  11131. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  11132. var _this = this;
  11133. prompt$2('输入工作流名称').then(function (name) {
  11134. createBpmn("", name).then(function (res) {
  11135. if (res.success) {
  11136. msg$1('添加成功');
  11137. }
  11138. _this.reload();
  11139. });
  11140. });
  11141. };
  11142. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  11143. var _this = this;
  11144. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  11145. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  11146. if (res.success) {
  11147. msg$1('添加成功');
  11148. }
  11149. _this.reload();
  11150. });
  11151. });
  11152. };
  11153. BpmnTreeController.prototype.reportAdd = function (sender) {
  11154. var _this = this;
  11155. prompt$2('请输入报表名称').then(function (name) {
  11156. createReportApi(name).then(function (res) {
  11157. if (res.success) {
  11158. msg$1('添加成功');
  11159. handles$1.mainWindow.showReport(res.data, name, function () {
  11160. _this.reload();
  11161. });
  11162. }
  11163. _this.reload();
  11164. });
  11165. });
  11166. };
  11167. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  11168. if (record) {
  11169. var reportName = record.get('report_name');
  11170. var reportId = record.get('report_id');
  11171. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  11172. }
  11173. };
  11174. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  11175. var _this = this;
  11176. if (record) {
  11177. var reportName = record.get('report_name');
  11178. var reportId_1 = record.get('report_id');
  11179. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  11180. delReportApi(reportId_1).then(function (res) {
  11181. if (res.success) {
  11182. msg$1('删除成功');
  11183. _this.reload();
  11184. }
  11185. });
  11186. });
  11187. }
  11188. };
  11189. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  11190. var _this = this;
  11191. if (!record || record.type !== 'Module') {
  11192. return;
  11193. }
  11194. var reportName = record.text;
  11195. var reportId = record.target;
  11196. handles$1.mainWindow.showReport(reportId, reportName, function () {
  11197. _this.reload();
  11198. });
  11199. };
  11200. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  11201. var data = record.raw;
  11202. if (data.type !== 'Module' && data.type !== 'Dir') {
  11203. return;
  11204. }
  11205. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  11206. if (data.exporerType === 10) { // 表单
  11207. // this.reportEdit(sender, data)
  11208. handles$1.mainWindow.showReport();
  11209. }
  11210. else if (data.exporerType === 21) {
  11211. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  11212. }
  11213. else if (data.exporerType === 22) {
  11214. handles$1.mainWindow.showFormBill();
  11215. }
  11216. else if (data.exporerType === 30) {
  11217. handles$1.mainWindow.showWidgetDesign();
  11218. }
  11219. else if (data.exporerType === 51) {
  11220. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  11221. }
  11222. else {
  11223. throw Error('暂时不支持!');
  11224. }
  11225. };
  11226. return BpmnTreeController;
  11227. }());
  11228. var controller$6 = new BpmnTreeController();
  11229. function initBpmnTree () {
  11230. Ext.define('com.yvan.studio.BpmnTree', {
  11231. extend: 'Ext.tree.Panel',
  11232. //extend: 'com.yvan.studio.StateTree',
  11233. xtype: 'bpmntree',
  11234. controller: controller$6,
  11235. scope: controller$6,
  11236. tooltip: '表单定义',
  11237. iconCls: 'x-fa fa-random',
  11238. useArrows: true,
  11239. rootVisible: false,
  11240. colspan: 2,
  11241. lines: true,
  11242. multiSelect: true,
  11243. reload: function () {
  11244. this.controller.reload.call(this, arguments);
  11245. },
  11246. openNode: function () {
  11247. var selection = this.getSelection();
  11248. var _a = __read(selection, 1), record = _a[0];
  11249. if (!record) {
  11250. return;
  11251. }
  11252. var raw = record.raw;
  11253. if (raw.type === 'Dir') {
  11254. return;
  11255. }
  11256. if (raw.type === "Module" && raw.module) ;
  11257. },
  11258. listeners: {
  11259. itemdblclick: 'onDblClick',
  11260. afterrender: 'onLoad',
  11261. // itemverify() {
  11262. // this.openNode()
  11263. // },
  11264. itemcontextmenu: 'onLisenContextMenu'
  11265. },
  11266. tbar: {
  11267. xtype: 'toolbar',
  11268. items: [
  11269. {
  11270. xtype: 'button',
  11271. tooltip: '刷新',
  11272. iconCls: 'x-fa fa-refresh',
  11273. listeners: {
  11274. click: 'reload'
  11275. }
  11276. },
  11277. /*{
  11278. xtype: 'button',
  11279. tooltip: '添加',
  11280. iconCls: 'x-fa fa-plus-circle',
  11281. menu: [
  11282. {
  11283. text: '类别',
  11284. listeners: {
  11285. click: 'classAdd'
  11286. }
  11287. },
  11288. {
  11289. text: '查询',
  11290. listeners: {
  11291. click: 'reportAdd'
  11292. }
  11293. },
  11294. '-',
  11295. {
  11296. text: '单表定义',
  11297. listeners: {
  11298. click: 'singleTableAdd'
  11299. }
  11300. },
  11301. {
  11302. text: '多表定义',
  11303. listeners: {
  11304. click: 'complexTableAdd'
  11305. }
  11306. },
  11307. {
  11308. text: '查询窗口定义',
  11309. listeners: {
  11310. click: 'widgetAdd'
  11311. }
  11312. },
  11313. ],
  11314. },
  11315. {
  11316. xtype: 'button',
  11317. tooltip: '删除',
  11318. iconCls: 'x-fa fa-minus-circle',
  11319. listeners: {
  11320. click: 'reportRemove'
  11321. }
  11322. },*/
  11323. {
  11324. xtype: 'textfield',
  11325. flex: 1,
  11326. reference: "txtFilter",
  11327. emptyText: '搜索过滤',
  11328. enableKeyEvents: true,
  11329. listeners: {
  11330. change: {
  11331. fn: 'filterChanged',
  11332. buffer: 50
  11333. }
  11334. }
  11335. },
  11336. ]
  11337. },
  11338. });
  11339. }
  11340. //# sourceMappingURL=BpmnTree.js.map
  11341. // export const idPrefix = "_ds_"
  11342. var _designInstance;
  11343. function setDesignInstance(instance) {
  11344. _designInstance = instance;
  11345. }
  11346. function getDesignInstance() {
  11347. return _designInstance;
  11348. }
  11349. function delegateDragmove(node, source, info) {
  11350. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  11351. //@ts-ignore
  11352. _designInstance.dragmove(node, source, info);
  11353. }
  11354. }
  11355. function delegateDragend(node, source, info) {
  11356. if (_designInstance && typeof _designInstance.dragend === 'function') {
  11357. //@ts-ignore
  11358. _designInstance.dragend(node, source, info);
  11359. }
  11360. }
  11361. //# sourceMappingURL=DropHelper.js.map
  11362. function initToolBox () {
  11363. Ext.define('com.yvan.studio.ToolBox', {
  11364. extend: 'Ext.panel.Panel',
  11365. xtype: 'toolbox',
  11366. tooltip: '工具箱',
  11367. layout: 'fit',
  11368. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  11369. border: false,
  11370. beforeRender: function () {
  11371. console.log('beforeRender', this);
  11372. },
  11373. afterRender: function () {
  11374. var $dom = $(this.body.dom).children('div');
  11375. $dom.append(createComponent());
  11376. $dom.css("height", '100%');
  11377. // @ts-ignore
  11378. $('#_toolbox_list').find('li').each(function () {
  11379. var id = $(this).children(':first').attr('drag_id');
  11380. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  11381. setDrag(this, node);
  11382. });
  11383. }
  11384. });
  11385. }
  11386. function setDrag(el, node) {
  11387. new Ext.drag.Source({
  11388. element: el,
  11389. proxy: {
  11390. type: 'placeholder',
  11391. getElement: function (info) {
  11392. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  11393. return Ext.getBody().createChild({
  11394. html: html
  11395. });
  11396. }
  11397. },
  11398. listeners: {
  11399. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  11400. dragend: delegateDragend.bind(getDesignInstance(), node),
  11401. },
  11402. sourceVjson: node.code,
  11403. dragType: node.dragType
  11404. });
  11405. }
  11406. function createComponent() {
  11407. var template = [];
  11408. for (var i = 0; i < codeLines.length; i++) {
  11409. var item = codeLines[i];
  11410. if (!item.dragHtml) {
  11411. continue;
  11412. }
  11413. var $ele = $("<li>" + item.dragHtml + "</li>");
  11414. $ele.children(':first').attr('drag_id', item.id);
  11415. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  11416. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  11417. }
  11418. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  11419. return html;
  11420. }
  11421. var codeLines = [
  11422. {
  11423. id: '$label',
  11424. value: layoutOrXtypeNameMap.label + ' - label',
  11425. icon: "fa fa-font",
  11426. dragType: "col-item",
  11427. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11428. code: {
  11429. xtype: 'label',
  11430. text: '文本' + _$2.uniqueId('_l')
  11431. }
  11432. },
  11433. {
  11434. id: '$text',
  11435. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  11436. icon: "fa fa-edit",
  11437. dragType: "col-item",
  11438. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11439. code: {
  11440. xtype: 'textfield',
  11441. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11442. }
  11443. },
  11444. {
  11445. id: '$textarea',
  11446. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  11447. icon: "fa fa-edit",
  11448. dragType: "col-item",
  11449. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11450. code: {
  11451. xtype: 'textareafield',
  11452. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11453. }
  11454. },
  11455. {
  11456. id: '$number',
  11457. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  11458. icon: "fa fa-edit",
  11459. dragType: "col-item",
  11460. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11461. code: {
  11462. xtype: 'numberfield',
  11463. fieldLabel: '数字框' + _$2.uniqueId('_n')
  11464. }
  11465. },
  11466. {
  11467. id: '$combo',
  11468. value: layoutOrXtypeNameMap.combo + ' - combo',
  11469. icon: "fa fa-angle-double-down",
  11470. dragType: "col-item",
  11471. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11472. code: {
  11473. xtype: 'combo',
  11474. fieldLabel: '请选择',
  11475. data: [
  11476. { id: 'id1', text: '选项1' },
  11477. { id: 'id2', text: '选项2' },
  11478. { id: 'id3', text: '选项3' },
  11479. ],
  11480. }
  11481. },
  11482. {
  11483. id: '$datebox',
  11484. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  11485. icon: "fa fa-calendar",
  11486. dragType: "col-item",
  11487. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11488. code: {
  11489. xtype: "datefield",
  11490. fieldLabel: '日期',
  11491. }
  11492. },
  11493. {
  11494. id: '$searchbox',
  11495. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  11496. icon: "fa fa-search",
  11497. dragType: "col-item",
  11498. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11499. code: {
  11500. xtype: 'searchfield',
  11501. fieldLabel: '搜索框',
  11502. }
  11503. },
  11504. {
  11505. id: '$combogrid',
  11506. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  11507. icon: "fa fa-table",
  11508. dragType: "col-item",
  11509. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11510. code: {
  11511. xtype: 'combogrid',
  11512. fieldLabel: '下拉表'
  11513. }
  11514. },
  11515. {
  11516. id: '$combotree',
  11517. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  11518. icon: "fa fa-tree",
  11519. dragType: "col-item",
  11520. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11521. code: {
  11522. xtype: 'combotree',
  11523. fieldLabel: '下拉树',
  11524. displayField: 'text',
  11525. rootVisible: false
  11526. }
  11527. },
  11528. {
  11529. id: '$button',
  11530. value: layoutOrXtypeNameMap.button + ' - button',
  11531. icon: 'fa fa-sign-in',
  11532. dragType: "col-item",
  11533. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11534. code: {
  11535. text: '按钮',
  11536. iconCls: 'x-fa fa-bars',
  11537. xtype: 'button'
  11538. }
  11539. },
  11540. {
  11541. id: '$checkbox',
  11542. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  11543. icon: 'fa fa-check-square',
  11544. dragType: "col-item",
  11545. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11546. code: {
  11547. xtype: 'checkbox',
  11548. boxLabel: '勾选框',
  11549. hideLabel: true,
  11550. margin: '0 0 0 15',
  11551. flex: 0,
  11552. }
  11553. },
  11554. {
  11555. id: '$checkboxgroup',
  11556. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  11557. icon: 'fa fa-check-square',
  11558. dragType: "col-item",
  11559. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11560. code: {
  11561. xtype: 'checkboxgroup',
  11562. fieldLabel: '勾选组',
  11563. items: [
  11564. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11565. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11566. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11567. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11568. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11569. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11570. ]
  11571. }
  11572. },
  11573. {
  11574. id: '$radio',
  11575. value: layoutOrXtypeNameMap.radio + ' - radio',
  11576. icon: 'fa fa-dot-circle-o',
  11577. dragType: "col-item",
  11578. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11579. code: {
  11580. xtype: "radio",
  11581. fieldLabel: "请选择",
  11582. }
  11583. },
  11584. {
  11585. id: '$radiogroup',
  11586. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  11587. icon: 'fa fa-dot-circle-o',
  11588. dragType: "col-item",
  11589. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11590. code: {
  11591. xtype: "radiogroup",
  11592. fieldLabel: "请选择",
  11593. items: [
  11594. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11595. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11596. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11597. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11598. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11599. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11600. ]
  11601. }
  11602. },
  11603. {
  11604. id: '$cols',
  11605. value: layoutOrXtypeNameMap.cols + ' - cols',
  11606. icon: 'fa fa-list-alt',
  11607. dragType: "cols-container",
  11608. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11609. code: {
  11610. xtype: 'cols',
  11611. items: [
  11612. {
  11613. xtype: 'textfield',
  11614. fieldLabel: '输入框',
  11615. },
  11616. ],
  11617. }
  11618. },
  11619. {
  11620. id: '$container',
  11621. value: layoutOrXtypeNameMap.container + ' - container',
  11622. icon: 'fa fa-flag',
  11623. dragType: "col-item",
  11624. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11625. code: {
  11626. xtype: 'container',
  11627. border: false,
  11628. layout: 'hbox',
  11629. }
  11630. },
  11631. {
  11632. id: '$fit',
  11633. value: layoutOrXtypeNameMap.fit + ' - fit',
  11634. icon: 'fa fa-flag',
  11635. dragType: "rows-container",
  11636. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11637. code: {
  11638. border: false,
  11639. layout: 'fit',
  11640. items: [
  11641. {
  11642. xtype: 'container',
  11643. border: false,
  11644. layout: 'hbox',
  11645. }
  11646. ]
  11647. }
  11648. },
  11649. ];
  11650. // @ts-ignore
  11651. // export default ToolBoxCmp
  11652. //# sourceMappingURL=ToolBox.js.map
  11653. var that = undefined;
  11654. function initPropertyDesign () {
  11655. Ext.define('com.yvan.studio.PropertyDesign', {
  11656. extend: 'Ext.panel.Panel',
  11657. xtype: 'propertydesign',
  11658. name: "PropertyDesign",
  11659. tooltip: '属性',
  11660. iconCls: 'x-fa fa-newspaper-o',
  11661. reference: 'propertygrid',
  11662. layout: 'border',
  11663. border: false,
  11664. moduleId: null,
  11665. currentComponentVJson: null,
  11666. currentComponentPropertyEditSource: null,
  11667. vjson: null,
  11668. propertyHandle: null,
  11669. moduleSubscribe: null,
  11670. items: [
  11671. new Ext.grid.property.Grid({
  11672. sortableColumns: false,
  11673. region: 'center',
  11674. listeners: {
  11675. propertychange: function (source, propName, value, oldValue, eOpts) {
  11676. value = _.trim(value);
  11677. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  11678. return item.label === propName;
  11679. });
  11680. if (a.type === 'listeners') {
  11681. if (value) {
  11682. if (that.currentComponentVJson.listeners) {
  11683. that.currentComponentVJson.listeners[propName] = value;
  11684. }
  11685. else {
  11686. var t = {};
  11687. t[propName] = value;
  11688. that.currentComponentVJson.listeners = t;
  11689. }
  11690. }
  11691. else {
  11692. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  11693. if (!value1) {
  11694. delete that.currentComponentVJson.listeners[key];
  11695. }
  11696. else if (key === propName) {
  11697. delete that.currentComponentVJson.listeners[key];
  11698. }
  11699. });
  11700. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  11701. delete that.currentComponentVJson.listeners;
  11702. }
  11703. }
  11704. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11705. vjson: that.vjson,
  11706. from: that.name,
  11707. ignoreRenderUI: true
  11708. });
  11709. }
  11710. else if (a.type === 'fix') {
  11711. if (!value) {
  11712. delete that.currentComponentVJson[propName];
  11713. }
  11714. else {
  11715. that.currentComponentVJson[propName] = value.split("\r\n");
  11716. }
  11717. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11718. vjson: that.vjson,
  11719. from: that.name,
  11720. ignoreRenderUI: true
  11721. });
  11722. }
  11723. else if (a.type === 'bind') {
  11724. var bind_1 = that.currentComponentVJson.bind;
  11725. if (typeof bind_1 === 'string' && a.id === "value") {
  11726. if (value) {
  11727. that.currentComponentVJson.bind = value;
  11728. }
  11729. else {
  11730. delete that.currentComponentVJson.bind;
  11731. }
  11732. }
  11733. else {
  11734. // 转成bind对象
  11735. if (typeof bind_1 === 'string') {
  11736. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  11737. }
  11738. if (value) {
  11739. if (bind_1) {
  11740. bind_1[a.id] = value;
  11741. }
  11742. else {
  11743. var t = {};
  11744. t[a.id] = value;
  11745. that.currentComponentVJson.bind = t;
  11746. }
  11747. }
  11748. else {
  11749. _.forOwn(bind_1, function (value1, key) {
  11750. if (!value1) {
  11751. delete bind_1[key];
  11752. }
  11753. else if (key === a.id) {
  11754. delete bind_1[key];
  11755. }
  11756. });
  11757. if (Object.keys(bind_1).length <= 0) {
  11758. delete that.currentComponentVJson.bind;
  11759. }
  11760. }
  11761. }
  11762. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11763. vjson: that.vjson,
  11764. from: that.name,
  11765. ignoreRenderUI: true
  11766. });
  11767. }
  11768. else if (a.type === 'boolean') {
  11769. if (!value) {
  11770. delete that.currentComponentVJson[propName];
  11771. }
  11772. else if (value === 'false') {
  11773. that.currentComponentVJson[propName] = false;
  11774. }
  11775. else if (value === 'true') {
  11776. that.currentComponentVJson[propName] = true;
  11777. }
  11778. else {
  11779. that.currentComponentVJson[propName] = value;
  11780. }
  11781. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11782. vjson: that.vjson,
  11783. from: that.name
  11784. });
  11785. }
  11786. else {
  11787. that.currentComponentVJson[propName] = value;
  11788. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11789. vjson: that.vjson,
  11790. from: that.name
  11791. });
  11792. }
  11793. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  11794. },
  11795. }
  11796. })
  11797. ],
  11798. listeners: {
  11799. // afterrender() {
  11800. // this.propertyHandle.setSource({
  11801. // "(name)": "My Object",
  11802. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  11803. // "Available": false, // boolean type
  11804. // "Version": .01, // decimal type
  11805. // "Description": "A test object"
  11806. // });
  11807. // }
  11808. },
  11809. initComponent: function () {
  11810. var _this = this;
  11811. this.propertyHandle = this.items[0];
  11812. setPropertyPanel(this);
  11813. that = this;
  11814. eventBus.subscribe(EventType.SetVjson, function (_a) {
  11815. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11816. _this.setVjson(moduleId, from, ignoreRenderUI);
  11817. });
  11818. return this.superclass.initComponent.apply(this, arguments);
  11819. },
  11820. setVjson: function (moduleId, from, ignoreRenderUI) {
  11821. var _this = this;
  11822. // if (this.moduleId === null && moduleId) {
  11823. // this.moduleId = moduleId
  11824. // }
  11825. if (moduleId !== this.moduleId || from === this.name) {
  11826. return;
  11827. }
  11828. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  11829. if (!moduleObj) {
  11830. return;
  11831. }
  11832. this.vjson = moduleObj.moduleObj.vjson;
  11833. this.setPropertyAndEventSource();
  11834. if (this.componentSelectionChangeSubscribe) {
  11835. this.componentSelectionChangeSubscribe.cancel();
  11836. this.componentSelectionChangeSubscribe = null;
  11837. }
  11838. if (this.updateVjsonChangeSubscribe) {
  11839. this.updateVjsonChangeSubscribe.cancel();
  11840. this.updateVjsonChangeSubscribe = null;
  11841. }
  11842. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11843. var id = _a.id, from = _a.from;
  11844. _this.onComponentSelectionChange(id, from);
  11845. });
  11846. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11847. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11848. _this.updateVjson(vjson, from, ignoreRenderUI);
  11849. });
  11850. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11851. this.onComponentSelectionChange(id, from);
  11852. },
  11853. updateVjson: function (vjson, from, ignoreRenderUI) {
  11854. if (!vjson || from === this.name) {
  11855. return;
  11856. }
  11857. this.vjson = vjson;
  11858. this.setPropertyAndEventSource();
  11859. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11860. this.onComponentSelectionChange(id, from);
  11861. },
  11862. onComponentSelectionChange: function (id, from) {
  11863. if (from !== this.name) {
  11864. this.currentComponentVJson = findInCode(this.vjson, id);
  11865. this.setPropertyAndEventSource();
  11866. }
  11867. },
  11868. setPropertyAndEventSource: function () {
  11869. var _this = this;
  11870. this.propertyHandle.setSource({});
  11871. if (!this.currentComponentVJson) {
  11872. return;
  11873. }
  11874. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  11875. var v = xtype;
  11876. // 选中的对象可能是组
  11877. if (!v) {
  11878. if (_.has(this.currentComponentVJson, "cols")) {
  11879. v = "cols";
  11880. }
  11881. else if (_.has(this.currentComponentVJson, "rows")) {
  11882. v = "rows";
  11883. }
  11884. }
  11885. var pd = YvanUI.PropertyDescriptionTable.get(v);
  11886. if (!pd) {
  11887. // 这个组件没有属性
  11888. this.propertyHandle.setSource({});
  11889. return;
  11890. }
  11891. var funcArr = this.getAllfuncs();
  11892. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  11893. // disabled: true,
  11894. displayField: 'name',
  11895. valueField: 'name',
  11896. store: funcArr,
  11897. }); };
  11898. // ====================== 属性
  11899. var elements = [];
  11900. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  11901. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  11902. var props = pd.getPropsByGroup(group);
  11903. if (props.length <= 0)
  11904. return; //没有这一组属性
  11905. // 显示 group 的中文名
  11906. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  11907. if (caption[i] === '绑定') {
  11908. _.each(props, function (prop) {
  11909. elements.push({
  11910. label: "_" + prop.name,
  11911. type: "bind",
  11912. id: prop.name,
  11913. desc: prop.desc,
  11914. editor: new Ext.form.field.Text()
  11915. });
  11916. });
  11917. }
  11918. else {
  11919. _.each(props, function (prop) {
  11920. if (_.isArray(prop.type)) {
  11921. elements.push({
  11922. label: prop.name,
  11923. type: "combo",
  11924. options: prop.type,
  11925. id: prop.name,
  11926. desc: prop.desc
  11927. });
  11928. return;
  11929. }
  11930. switch (prop.type) {
  11931. case 'boolean': {
  11932. elements.push({
  11933. label: prop.name,
  11934. id: prop.name,
  11935. desc: prop.desc,
  11936. type: 'boolean',
  11937. editor: new Ext.form.field.ComboBox({
  11938. displayField: 'text',
  11939. valueField: 'id',
  11940. store: new Ext.data.Store({
  11941. field: ['id', 'text'],
  11942. data: [
  11943. { id: 'true', text: 'True' },
  11944. { id: 'false', text: 'False' },
  11945. ]
  11946. })
  11947. }),
  11948. });
  11949. break;
  11950. }
  11951. case 'number': {
  11952. elements.push({
  11953. label: prop.name,
  11954. type: "number",
  11955. id: prop.name,
  11956. isNum: true,
  11957. desc: prop.desc,
  11958. editor: new Ext.form.field.Number()
  11959. });
  11960. break;
  11961. }
  11962. case 'string': {
  11963. elements.push({
  11964. label: prop.name,
  11965. type: "string",
  11966. id: prop.name,
  11967. desc: prop.desc,
  11968. editor: new Ext.form.field.Text()
  11969. });
  11970. break;
  11971. }
  11972. case 'listeners': {
  11973. elements.push({
  11974. label: prop.name,
  11975. type: "listeners",
  11976. id: prop.name,
  11977. desc: prop.desc,
  11978. editor: createFuncEditor()
  11979. });
  11980. break;
  11981. }
  11982. case 'fix': {
  11983. elements.push({
  11984. label: prop.name,
  11985. type: "fix",
  11986. id: prop.name,
  11987. desc: prop.desc,
  11988. editor: new Ext.form.field.Text()
  11989. });
  11990. break;
  11991. }
  11992. case 'object': {
  11993. break;
  11994. }
  11995. // case 'dataSource' : {
  11996. // break;
  11997. // }
  11998. case 'valid': {
  11999. break;
  12000. }
  12001. default:
  12002. elements.push({
  12003. label: prop.name,
  12004. type: prop.type,
  12005. id: prop.name,
  12006. desc: prop.desc,
  12007. editor: new Ext.form.field.Text({ disabled: true })
  12008. });
  12009. console.error('不支持的编辑类型', prop);
  12010. }
  12011. });
  12012. }
  12013. });
  12014. this.currentComponentPropertyEditSource = elements;
  12015. var panel1Source = {};
  12016. var panel1SourceConfig = {};
  12017. _.each(elements, function (item) {
  12018. var _a;
  12019. if (item.type === "listeners") {
  12020. var listeners = _this.currentComponentVJson.listeners;
  12021. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  12022. }
  12023. else if (item.type === "fix") {
  12024. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  12025. }
  12026. else if (item.type === "bind") {
  12027. var bind = _this.currentComponentVJson.bind;
  12028. if (typeof bind === 'string' && item.id === 'value') {
  12029. panel1Source[item.label] = bind;
  12030. }
  12031. else {
  12032. panel1Source[item.label] = bind ? bind[item.id] : '';
  12033. }
  12034. }
  12035. else {
  12036. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  12037. }
  12038. panel1Source[item.label] = panel1Source[item.label] || '';
  12039. panel1SourceConfig[item.label] = { editor: item.editor };
  12040. });
  12041. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  12042. },
  12043. getAllfuncs: function () {
  12044. var _a, _b;
  12045. 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;
  12046. var scopeFuncs = [];
  12047. _.forEach(arr, function (item) {
  12048. scopeFuncs.push({ name: "scope." + item.name });
  12049. });
  12050. return scopeFuncs;
  12051. }
  12052. });
  12053. }
  12054. //# sourceMappingURL=PropertyDesign.js.map
  12055. function initViewOutlineTree () {
  12056. Ext.define('com.yvan.studio.ViewOutlineTree', {
  12057. extend: 'Ext.tree.Panel',
  12058. xtype: 'viewoutlinetree',
  12059. name: "ViewOutlineTree",
  12060. tooltip: '设计大纲',
  12061. iconCls: 'x-fa fa-list',
  12062. rootVisible: false,
  12063. useArrows: true,
  12064. allowDeselect: true,
  12065. colspan: 2,
  12066. lines: false,
  12067. reference: 'viewoutlinetree',
  12068. multiSelect: true,
  12069. _saveStateFlag: true,
  12070. keyMapEnabled: true,
  12071. moduleId: null,
  12072. vjson: null,
  12073. columns: [
  12074. {
  12075. xtype: 'treecolumn',
  12076. text: '布局',
  12077. dataIndex: 'layoutNameDesc',
  12078. flex: 2,
  12079. sortable: true
  12080. }, {
  12081. text: '组件',
  12082. dataIndex: 'xtype',
  12083. flex: 1,
  12084. sortable: true,
  12085. align: 'center',
  12086. }
  12087. ],
  12088. listeners: {
  12089. itemcontextmenu: function (sender, node, element, idx, e) {
  12090. e.preventDefault();
  12091. this.rightClickTreeNode(sender, node, element, idx, e);
  12092. },
  12093. select: function (sender, node, index, e) {
  12094. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  12095. },
  12096. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  12097. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  12098. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  12099. }
  12100. }
  12101. },
  12102. initComponent: function () {
  12103. var _this = this;
  12104. setViewoutlinetree(this);
  12105. eventBus.subscribe(EventType.SetVjson, function (_a) {
  12106. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12107. return _this.setVjson(moduleId, from, ignoreRenderUI);
  12108. });
  12109. return this.superclass.initComponent.apply(this, arguments);
  12110. },
  12111. clear: function () {
  12112. this.setRootNode(null);
  12113. },
  12114. onChangModule: function (moduleId, oldModuleId, from) {
  12115. if (!moduleId || moduleId !== this.moduleId) {
  12116. return;
  12117. }
  12118. if (moduleStore.getModuleObject(moduleId)) {
  12119. this.setVjson(moduleId, from);
  12120. }
  12121. },
  12122. setVjson: function (moduleId, from, ignoreRenderUI) {
  12123. var _this = this;
  12124. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  12125. return;
  12126. }
  12127. this.moduleId = moduleId;
  12128. // if (from === this.name) {
  12129. // return
  12130. // }
  12131. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  12132. this.setTreeValue();
  12133. if (this.componentSelectionChangeSubscribe) {
  12134. this.componentSelectionChangeSubscribe.cancel();
  12135. this.componentSelectionChangeSubscribe = null;
  12136. }
  12137. if (this.setVjsonChangeSubscribe) {
  12138. this.setVjsonChangeSubscribe.cancel();
  12139. this.setVjsonChangeSubscribe = null;
  12140. }
  12141. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  12142. var id = _a.id, from = _a.from;
  12143. return _this.onComponentSelectionChange(id, from);
  12144. });
  12145. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  12146. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12147. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  12148. });
  12149. },
  12150. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  12151. if (!vjson || from === this.name) {
  12152. return;
  12153. }
  12154. this.vjson = vjson;
  12155. this.setTreeValue();
  12156. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  12157. if (id) {
  12158. this.selectPath(id);
  12159. }
  12160. },
  12161. onComponentSelectionChange: function (id, from) {
  12162. if (from !== this.name) {
  12163. if (id) {
  12164. this.selectPath(id);
  12165. }
  12166. else {
  12167. this.setTreeValue();
  12168. }
  12169. }
  12170. },
  12171. setTreeValue: function () {
  12172. var outlineVj = {};
  12173. _.forOwn(this.vjson, function (obj, key) {
  12174. if (key !== 'viewModel' && key !== 'store') {
  12175. outlineVj[key] = _.cloneDeep(obj);
  12176. }
  12177. });
  12178. getLayoutOutline(outlineVj);
  12179. this.setRootNode(outlineVj);
  12180. },
  12181. rightClickTreeNode: function (sender, node, element, idx, e) {
  12182. var raw = node.data;
  12183. var option = {};
  12184. // 右键
  12185. option = {
  12186. shadow: 'frame',
  12187. allowOtherMenus: true,
  12188. items: []
  12189. };
  12190. var switchType = raw.layoutName;
  12191. if (raw.layoutName === 'north' ||
  12192. raw.layoutName === 'south' ||
  12193. raw.layoutName === 'west' ||
  12194. raw.layoutName === 'east' ||
  12195. raw.layoutName === 'center' ||
  12196. raw.layoutName === 'tbar' ||
  12197. raw.layoutName === 'fbar') {
  12198. switchType = raw.xtype || raw.layout;
  12199. }
  12200. var itemArr = [];
  12201. var hasTbar = false, hasFbar = false, hasBody = false;
  12202. if (raw.hasOwnProperty("children")) {
  12203. _.forEach(raw.children, function (value) {
  12204. if (value.layoutName === 'tbar') {
  12205. hasTbar = true;
  12206. }
  12207. else if (value.layoutName === 'fbar') {
  12208. hasFbar = true;
  12209. }
  12210. else {
  12211. hasBody = true;
  12212. }
  12213. });
  12214. }
  12215. switch (switchType) {
  12216. case 'fit':
  12217. if (!hasTbar) {
  12218. itemArr.push('tbar');
  12219. }
  12220. if (!hasFbar) {
  12221. itemArr.push('fbar');
  12222. }
  12223. if (!hasBody) {
  12224. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12225. }
  12226. option.items = this.menuNew(itemArr, raw);
  12227. break;
  12228. case 'border':
  12229. if (!hasTbar) {
  12230. itemArr.push('tbar');
  12231. }
  12232. if (!hasFbar) {
  12233. itemArr.push('fbar');
  12234. }
  12235. itemArr.push('cnsew');
  12236. option.items = this.menuNew(itemArr, raw);
  12237. break;
  12238. // case 'tbar':
  12239. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  12240. // break;
  12241. // case 'fbar':
  12242. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  12243. // break;
  12244. case 'tabpanel':
  12245. if (!hasTbar) {
  12246. itemArr.push('tbar');
  12247. }
  12248. if (!hasFbar) {
  12249. itemArr.push('fbar');
  12250. }
  12251. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12252. option.items = this.menuNew(itemArr, raw);
  12253. break;
  12254. case 'yvgrid':
  12255. if (!hasTbar) {
  12256. itemArr.push('tbar');
  12257. }
  12258. option.items = this.menuNew(itemArr, raw);
  12259. break;
  12260. case 'tree':
  12261. if (!hasTbar) {
  12262. itemArr.push('tbar');
  12263. }
  12264. if (!hasFbar) {
  12265. itemArr.push('fbar');
  12266. }
  12267. option.items = this.menuNew(itemArr, raw);
  12268. break;
  12269. case 'fieldset':
  12270. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  12271. break;
  12272. case 'form':
  12273. if (!hasTbar) {
  12274. itemArr.push('tbar');
  12275. }
  12276. if (!hasFbar) {
  12277. itemArr.push('fbar');
  12278. }
  12279. itemArr.push('form', 'fieldset', 'cols');
  12280. option.items = this.menuNew(itemArr, raw);
  12281. break;
  12282. case 'toolbar':
  12283. itemArr.push('button', 'textfield', 'label', 'combo');
  12284. option.items = this.menuNew(itemArr, raw);
  12285. break;
  12286. // case 'fbar':
  12287. // itemArr.push('button', 'textfield', 'label', 'combo')
  12288. // option.items = this.menuNew(itemArr, raw)
  12289. // break
  12290. default:
  12291. option.items = this.menuNew(itemArr, raw);
  12292. break;
  12293. }
  12294. var treeMenu = new Ext.menu.Menu(option);
  12295. treeMenu.showAt(e.getXY());
  12296. },
  12297. newItem: function (viewType, raw, region) {
  12298. var itemVjson = {};
  12299. switch (viewType) {
  12300. case 'fit':
  12301. itemVjson.layout = 'fit';
  12302. itemVjson.items = [];
  12303. break;
  12304. case 'border':
  12305. itemVjson.layout = 'border';
  12306. itemVjson.items = [];
  12307. break;
  12308. case 'toolbar':
  12309. itemVjson.xtype = 'toolbar';
  12310. itemVjson.title = 'toolbar';
  12311. itemVjson.items = [
  12312. {
  12313. xtype: 'button',
  12314. text: 'button'
  12315. }
  12316. ];
  12317. break;
  12318. case 'tabpanel':
  12319. itemVjson.xtype = 'tabpanel';
  12320. itemVjson.layout = 'fit';
  12321. itemVjson.items = [];
  12322. break;
  12323. case 'yvgrid':
  12324. itemVjson.xtype = 'yvgrid';
  12325. itemVjson.layout = 'fit';
  12326. itemVjson.pagination = false;
  12327. itemVjson.columns = [
  12328. {
  12329. dataIndex: "skuId",
  12330. header: "SKU_ID",
  12331. },
  12332. ];
  12333. break;
  12334. case 'tree':
  12335. itemVjson.xtype = 'treepanel';
  12336. itemVjson.layout = 'fit';
  12337. break;
  12338. case 'fieldset':
  12339. case 'form':
  12340. itemVjson.xtype = viewType;
  12341. itemVjson.title = viewType;
  12342. itemVjson.items = [
  12343. {
  12344. xtype: 'cols',
  12345. items: [
  12346. {
  12347. xtype: 'textfield',
  12348. fieldLabel: '输入框'
  12349. }
  12350. ]
  12351. }
  12352. ];
  12353. break;
  12354. case 'cols':
  12355. itemVjson.xtype = 'cols';
  12356. itemVjson.items = [
  12357. {
  12358. xtype: 'textfield',
  12359. fieldLabel: '输入框'
  12360. }
  12361. ];
  12362. break;
  12363. case 'button':
  12364. itemVjson.xtype = 'button';
  12365. itemVjson.text = '按钮';
  12366. itemVjson.iconCls = 'x-fa fa-plus';
  12367. break;
  12368. case 'textfield':
  12369. itemVjson.xtype = 'textfield';
  12370. itemVjson.fieldLabel = '输入框';
  12371. break;
  12372. case 'combo':
  12373. itemVjson.xtype = 'combo';
  12374. itemVjson.fieldLabel = '下拉框';
  12375. break;
  12376. case 'label':
  12377. itemVjson.xtype = 'label';
  12378. itemVjson.text = '文本';
  12379. break;
  12380. }
  12381. var target = findInCode(this.vjson, raw.id);
  12382. if (region) {
  12383. if (region === 'tbar' || region === 'fbar') {
  12384. target[region] = itemVjson;
  12385. }
  12386. else {
  12387. itemVjson.region = region;
  12388. itemVjson.split = true;
  12389. if (region === 'north' || region === 'south') {
  12390. itemVjson.height = '30%';
  12391. itemVjson.collapsible = true;
  12392. }
  12393. else if (region === 'west' || region === 'east') {
  12394. itemVjson.width = '30%';
  12395. itemVjson.collapsible = true;
  12396. }
  12397. target.items.push(itemVjson);
  12398. }
  12399. }
  12400. else {
  12401. if (target.xtype === 'tabpanel') {
  12402. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  12403. }
  12404. target.items.push(itemVjson);
  12405. }
  12406. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12407. },
  12408. menuNew: function (typeArr, raw, region) {
  12409. var that = this;
  12410. var reArr = [];
  12411. typeArr.forEach(function (value) {
  12412. if (value === 'cnsew') {
  12413. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  12414. }
  12415. else if (value === 'tbar' || value === 'fbar') {
  12416. reArr.push(that.menuNewTFBar(value, raw));
  12417. }
  12418. else {
  12419. reArr.push({
  12420. text: '新建' + layoutOrXtypeNameMap[value],
  12421. iconCls: 'x-fa fa-plus',
  12422. handler: function (sender) {
  12423. that.newItem(value, raw, region);
  12424. }
  12425. });
  12426. }
  12427. reArr.push("-");
  12428. });
  12429. if (region) {
  12430. reArr.pop();
  12431. return reArr;
  12432. }
  12433. reArr.push({
  12434. text: '高级属性',
  12435. iconCls: 'x-fa fa-cog',
  12436. handler: function (sender) {
  12437. var vj = findInCode(that.vjson, raw.id);
  12438. that.advancedSettingWindow(vj);
  12439. }
  12440. }, {
  12441. text: '上移',
  12442. iconCls: 'x-fa fa-trash',
  12443. handler: function (sender) {
  12444. that.moveCmp(raw.id, 'up');
  12445. }
  12446. }, {
  12447. text: '置顶',
  12448. iconCls: 'x-fa fa-trash',
  12449. handler: function (sender) {
  12450. that.moveCmp(raw.id, 'top');
  12451. }
  12452. }, {
  12453. text: '置底',
  12454. iconCls: 'x-fa fa-trash',
  12455. handler: function (sender) {
  12456. that.moveCmp(raw.id, 'bottom');
  12457. }
  12458. }, {
  12459. text: '下移',
  12460. iconCls: 'x-fa fa-trash',
  12461. handler: function (sender) {
  12462. that.moveCmp(raw.id, 'down');
  12463. }
  12464. }, {
  12465. text: '删除',
  12466. iconCls: 'x-fa fa-trash',
  12467. handler: function (sender) {
  12468. deletVjsonById(that.vjson, raw.id);
  12469. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  12470. }
  12471. });
  12472. return reArr;
  12473. },
  12474. menuNewCNSEW: function (raw) {
  12475. var that = this;
  12476. var arr = ['center', 'north', 'south', 'west', 'east'];
  12477. if (raw.hasOwnProperty("children")) {
  12478. _.forEach(raw.children, function (value) {
  12479. _.remove(arr, function (it) {
  12480. return it === value.layoutName;
  12481. });
  12482. });
  12483. }
  12484. var reArr = [];
  12485. arr.forEach(function (value) {
  12486. reArr.push({
  12487. text: layoutOrXtypeNameMap[value],
  12488. iconCls: 'x-fa fa-plus',
  12489. menu: {
  12490. showSeparator: true,
  12491. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  12492. }
  12493. });
  12494. reArr.push("-");
  12495. });
  12496. reArr.pop();
  12497. return reArr;
  12498. },
  12499. menuNewTFBar: function (barType, raw) {
  12500. var that = this;
  12501. var reObj = {
  12502. text: layoutOrXtypeNameMap[barType],
  12503. iconCls: 'x-fa fa-plus',
  12504. menu: {
  12505. showSeparator: true,
  12506. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  12507. }
  12508. };
  12509. return reObj;
  12510. },
  12511. moveCmp: function (id, moveType) {
  12512. var arr = findArrayContainer(this.vjson, id);
  12513. var index = _.findIndex(arr, function (v) { return v.id === id; });
  12514. if (index < 0) {
  12515. return;
  12516. }
  12517. switch (moveType) {
  12518. case 'up':
  12519. if (index > 0) {
  12520. var o = arr[index];
  12521. arr[index] = arr[index - 1];
  12522. arr[index - 1] = o;
  12523. }
  12524. else {
  12525. return;
  12526. }
  12527. break;
  12528. case 'down':
  12529. if (index < arr.length - 1) {
  12530. var o = arr[index];
  12531. arr[index] = arr[index + 1];
  12532. arr[index + 1] = o;
  12533. }
  12534. else {
  12535. return;
  12536. }
  12537. break;
  12538. case 'top':
  12539. if (index > 0) {
  12540. var o = arr[index];
  12541. arr[index] = arr[0];
  12542. arr[0] = o;
  12543. }
  12544. else {
  12545. return;
  12546. }
  12547. break;
  12548. case 'bottom':
  12549. if (index < arr.length - 1) {
  12550. var o = arr[index];
  12551. arr[index] = arr[arr.length - 1];
  12552. arr[arr.length - 1] = o;
  12553. }
  12554. else {
  12555. return;
  12556. }
  12557. break;
  12558. }
  12559. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12560. }
  12561. });
  12562. }
  12563. //# sourceMappingURL=ViewOutlineTree.js.map
  12564. function init$1 () {
  12565. window['native'] = native;
  12566. native.init();
  12567. init();
  12568. initStateTree();
  12569. initDashboard();
  12570. initFileTree();
  12571. initDbTree();
  12572. initReportGrid();
  12573. initGroovyEditor();
  12574. initJsEditor();
  12575. initJsonEditor();
  12576. initSqlEditor();
  12577. initTemplateEditor();
  12578. initDict();
  12579. initBpmnTree();
  12580. initToolBox();
  12581. initPropertyDesign();
  12582. initViewOutlineTree();
  12583. initWidget();
  12584. initWhLayout();
  12585. initApiTree();
  12586. initTaskTree();
  12587. initLogsTree();
  12588. initDevOpsTree();
  12589. initTerminal();
  12590. initMonitorTree();
  12591. initHomeTree();
  12592. }
  12593. //# sourceMappingURL=init.js.map
  12594. var model$c = {
  12595. data: {
  12596. leftTabTitle: ''
  12597. }
  12598. };
  12599. //# sourceMappingURL=Workbench.model.js.map
  12600. var vjson$c = {
  12601. frame: false,
  12602. layout: 'border',
  12603. width: '100%',
  12604. height: '100%',
  12605. border: false,
  12606. defaults: {
  12607. border: false
  12608. },
  12609. items: [
  12610. {
  12611. region: 'north',
  12612. height: 60,
  12613. cls: 'main-header',
  12614. reference: 'mainTop',
  12615. layout: 'hbox',
  12616. items: [
  12617. {
  12618. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  12619. flex: 1,
  12620. border: false
  12621. },
  12622. {
  12623. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  12624. menu: [
  12625. {
  12626. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  12627. reference: 'commonSetting'
  12628. },
  12629. {
  12630. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  12631. listeners: {
  12632. // click: 'scope.ready_api_click'
  12633. }
  12634. },
  12635. ]
  12636. },
  12637. {
  12638. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  12639. cls: 'header-menu',
  12640. menu: [
  12641. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  12642. ]
  12643. },
  12644. ]
  12645. },
  12646. {
  12647. region: 'west',
  12648. bind: {
  12649. title: '{leftTabTitle}',
  12650. },
  12651. titleAlign: 'center',
  12652. border: true, split: true, width: 340, collapsible: true,
  12653. reference: 'leftTab',
  12654. xtype: 'tabpanel',
  12655. tabPosition: 'left',
  12656. tabRotation: 0,
  12657. tabBar: {
  12658. border: false
  12659. },
  12660. listeners: {
  12661. tabchange: 'scope.leftTabChange',
  12662. },
  12663. items: [
  12664. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  12665. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  12666. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  12667. { tooltip: '表单转换', iconCls: 'x-fa fa-exchange', },
  12668. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  12669. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  12670. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  12671. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  12672. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  12673. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  12674. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  12675. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  12676. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  12677. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  12678. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  12679. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  12680. ]
  12681. },
  12682. {
  12683. region: 'east',
  12684. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  12685. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  12686. },
  12687. {
  12688. region: 'center',
  12689. split: true, border: true,
  12690. xtype: 'maintab', reference: 'tt', id: 'TT',
  12691. plain: true,
  12692. listeners: {
  12693. restorypage: 'scope.openScope',
  12694. tabchange: 'scope.tabchange'
  12695. },
  12696. items: []
  12697. },
  12698. ],
  12699. };
  12700. //# sourceMappingURL=Workbench.view.js.map
  12701. var model$d = {
  12702. data: {
  12703. dataSync_isStart: false,
  12704. dataSync: {
  12705. skipError: false,
  12706. clearData: false,
  12707. tables: []
  12708. },
  12709. dataSyncResult: {
  12710. jobId: ''
  12711. },
  12712. dataSource1: '',
  12713. dataSource2: '',
  12714. schema1: '',
  12715. schema2: '',
  12716. hasDiff: false,
  12717. }
  12718. };
  12719. //# sourceMappingURL=DbSync.model.js.map
  12720. var vjson$d = {
  12721. title: '数据库同步',
  12722. layout: 'fit',
  12723. items: [
  12724. {
  12725. reference: 'wizard1',
  12726. layout: 'card',
  12727. items: [
  12728. {
  12729. reference: 'first',
  12730. layout: 'fit',
  12731. bbar: [
  12732. '->',
  12733. {
  12734. xtype: 'button',
  12735. iconCls: 'x-fa fa-road',
  12736. text: '结构同步 &raquo;',
  12737. bind: {
  12738. disabled: '{!hasDiff}'
  12739. },
  12740. listeners: {
  12741. click: 'scope.structCopyTo',
  12742. }
  12743. },
  12744. {
  12745. xtype: 'button',
  12746. iconCls: 'x-fa fa-files-o',
  12747. text: '数据同步 &raquo;',
  12748. bind: {
  12749. disabled: '{!hasDiff}'
  12750. },
  12751. listeners: {
  12752. click: 'scope.dataCopyTo',
  12753. }
  12754. },
  12755. {
  12756. xtype: 'button',
  12757. iconCls: 'x-fa fa-sort-alpha-desc',
  12758. text: '索引同步 &raquo;',
  12759. bind: {
  12760. disabled: '{!hasDiff}'
  12761. },
  12762. listeners: {
  12763. click: 'scope.indexCopyTo',
  12764. }
  12765. },
  12766. {
  12767. xtype: 'button',
  12768. iconCls: 'x-fa fa-product-hunt',
  12769. text: '存储过程同步 &raquo;',
  12770. bind: {
  12771. disabled: '{!hasDiff}'
  12772. },
  12773. listeners: {
  12774. click: 'scope.procedureCopyTo',
  12775. }
  12776. },
  12777. ],
  12778. items: [
  12779. {
  12780. title: '数据库对比',
  12781. reference: 'grid1',
  12782. xtype: 'yvgrid',
  12783. pagination: false,
  12784. border: false,
  12785. cellTip: true,
  12786. selModel: {
  12787. type: 'checkboxmodel',
  12788. mode: 'MULTI',
  12789. },
  12790. tbar: {
  12791. xtype: 'toolbar',
  12792. items: [
  12793. {
  12794. xtype: 'combo',
  12795. fieldLabel: '源数据库',
  12796. bind: {
  12797. value: '{dataSource1}'
  12798. },
  12799. dataSource: 'scope.getDataBaseName'
  12800. },
  12801. {
  12802. xtype: 'combo',
  12803. fieldLabel: '目标数据库',
  12804. bind: {
  12805. value: '{dataSource2}'
  12806. },
  12807. dataSource: 'scope.getDataBaseName'
  12808. },
  12809. {
  12810. xtype: 'button',
  12811. iconCls: 'x-fa fa-flash',
  12812. text: '对比',
  12813. bind: {
  12814. disabled: '{!dataSource1 || !dataSource2}'
  12815. },
  12816. listeners: {
  12817. click: 'scope.diff',
  12818. }
  12819. },
  12820. {
  12821. xtype: 'button',
  12822. iconCls: 'x-fa fa-cloud-download',
  12823. text: '重新拉取结构(耗时!)',
  12824. bind: {
  12825. disabled: '{!dataSource1 || !dataSource2}'
  12826. },
  12827. listeners: {
  12828. click: 'scope.dbToMeta',
  12829. }
  12830. },
  12831. ]
  12832. },
  12833. columns: [
  12834. {
  12835. dataIndex: 'table_name1',
  12836. header: '源表',
  12837. width: 300,
  12838. },
  12839. {
  12840. dataIndex: 'table_name2',
  12841. header: '目标表',
  12842. width: 300,
  12843. },
  12844. {
  12845. dataIndex: 'diff',
  12846. header: '对比结果',
  12847. width: 100,
  12848. },
  12849. {
  12850. xtype: 'actioncolumn',
  12851. width: 30,
  12852. sortable: false,
  12853. menuDisabled: true,
  12854. items: [
  12855. {
  12856. iconCls: 'x-fa fa-bars',
  12857. text: '打开',
  12858. handler: 'scope.showDetail',
  12859. }
  12860. ]
  12861. },
  12862. {
  12863. dataIndex: 'remark',
  12864. header: '详情',
  12865. width: 200,
  12866. sortable: true,
  12867. },
  12868. ],
  12869. },
  12870. ]
  12871. },
  12872. {
  12873. reference: 'ddl',
  12874. layout: {
  12875. type: 'vbox',
  12876. pack: 'start',
  12877. align: 'stretch'
  12878. },
  12879. items: [
  12880. {
  12881. xtype: 'sqleditor',
  12882. reference: 'ddleditor',
  12883. flex: 1,
  12884. },
  12885. {
  12886. xtype: 'toolbar',
  12887. items: [
  12888. '->',
  12889. {
  12890. xtype: 'button',
  12891. text: '&laquo; 上一步',
  12892. listeners: {
  12893. click: 'scope.back'
  12894. }
  12895. },
  12896. {
  12897. xtype: 'button',
  12898. iconCls: 'x-fa fa-flash',
  12899. text: '执行',
  12900. listeners: {
  12901. click: 'scope.executeDDL'
  12902. }
  12903. },
  12904. ]
  12905. }
  12906. ]
  12907. },
  12908. {
  12909. reference: 'ddl_idx',
  12910. layout: {
  12911. type: 'vbox',
  12912. pack: 'start',
  12913. align: 'stretch'
  12914. },
  12915. items: [
  12916. {
  12917. xtype: 'sqleditor',
  12918. reference: 'ddleditor_idx',
  12919. flex: 1,
  12920. },
  12921. {
  12922. xtype: 'toolbar',
  12923. items: [
  12924. '->',
  12925. {
  12926. xtype: 'button',
  12927. text: '&laquo; 上一步',
  12928. listeners: {
  12929. click: 'scope.back'
  12930. }
  12931. },
  12932. {
  12933. xtype: 'button',
  12934. iconCls: 'x-fa fa-flash',
  12935. text: '执行',
  12936. listeners: {
  12937. click: 'scope.executeDDLIdx'
  12938. }
  12939. },
  12940. ]
  12941. }
  12942. ]
  12943. },
  12944. {
  12945. reference: 'ddl_procedure',
  12946. layout: {
  12947. type: 'vbox',
  12948. pack: 'start',
  12949. align: 'stretch'
  12950. },
  12951. items: [
  12952. {
  12953. xtype: 'sqleditor',
  12954. reference: 'ddleditor_procedure',
  12955. flex: 1,
  12956. },
  12957. {
  12958. xtype: 'toolbar',
  12959. items: [
  12960. '->',
  12961. {
  12962. xtype: 'button',
  12963. text: '&laquo; 上一步',
  12964. listeners: {
  12965. click: 'scope.back'
  12966. }
  12967. },
  12968. {
  12969. xtype: 'button',
  12970. iconCls: 'x-fa fa-flash',
  12971. text: '执行',
  12972. listeners: {
  12973. click: 'scope.executeProcedureSQL'
  12974. }
  12975. },
  12976. ]
  12977. }
  12978. ]
  12979. },
  12980. {
  12981. reference: 'datacopy',
  12982. xtype: 'yvgrid',
  12983. pagination: false,
  12984. tbar: {
  12985. xtype: 'toolbar',
  12986. items: [
  12987. {
  12988. xtype: 'checkbox',
  12989. fieldLabel: '忽略错误',
  12990. bind: {
  12991. value: '{dataSync.skipError}'
  12992. },
  12993. },
  12994. {
  12995. xtype: 'checkbox',
  12996. fieldLabel: '清空数据',
  12997. bind: {
  12998. value: '{dataSync.clearData}'
  12999. },
  13000. },
  13001. {
  13002. xtype: 'button',
  13003. iconCls: 'x-fa fa-play-circle',
  13004. text: '开始',
  13005. bind: {
  13006. disabled: '{dataSync_isStart}'
  13007. },
  13008. listeners: { click: 'scope.dataSync_start' }
  13009. },
  13010. {
  13011. xtype: 'button',
  13012. iconCls: 'x-fa fa-stop-circle',
  13013. text: '停止',
  13014. bind: {
  13015. disabled: '{!dataSync_isStart}'
  13016. },
  13017. listeners: { click: 'scope.dataSync_stop' }
  13018. },
  13019. ]
  13020. },
  13021. columns: [
  13022. {
  13023. dataIndex: 'tableName', header: '表名',
  13024. width: 300,
  13025. },
  13026. {
  13027. dataIndex: 'dataCount', header: '总记录数',
  13028. width: 150,
  13029. },
  13030. {
  13031. dataIndex: 'currentIdx', header: '当前记录数',
  13032. width: 150,
  13033. },
  13034. {
  13035. dataIndex: 'syncCount', header: '同步数',
  13036. width: 150,
  13037. },
  13038. {
  13039. dataIndex: 'deleteCount', header: '删除',
  13040. width: 150,
  13041. },
  13042. {
  13043. dataIndex: 'syncProgress', header: '进度',
  13044. width: 150, dataType: 'int', formatter: 'percentRenderer'
  13045. },
  13046. ]
  13047. }
  13048. ]
  13049. }
  13050. ]
  13051. };
  13052. //# sourceMappingURL=DbSync.view.js.map
  13053. /**
  13054. * 对比两个列 是否存在不一致
  13055. */
  13056. function compareColumn(t1, c1, t2, c2) {
  13057. if (typeof c2 === 'undefined') {
  13058. return 'column_name';
  13059. }
  13060. if (c1.column_name !== c2.column_name) {
  13061. return 'column_name';
  13062. }
  13063. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  13064. return 'default_value';
  13065. }
  13066. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  13067. return 'column_comment';
  13068. }
  13069. if (c1.is_primary_key !== c2.is_primary_key) {
  13070. return 'is_primary_key';
  13071. }
  13072. if (c1.not_null !== c2.not_null) {
  13073. return 'not_null';
  13074. }
  13075. var symbol1 = getDataTypeSymbol(t1, c1);
  13076. var symbol2 = getDataTypeSymbol(t2, c2);
  13077. if (symbol1 !== symbol2) {
  13078. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13079. return 'data_type';
  13080. }
  13081. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13082. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  13083. // 只关注长度
  13084. if (c1.column_size != c2.column_size) {
  13085. return 'column_size';
  13086. }
  13087. }
  13088. else {
  13089. // 其他情况,长度和精度都要关注
  13090. if (c1.column_size != c2.column_size) {
  13091. return 'column_size';
  13092. }
  13093. if (c1.decimal_digits !== c2.decimal_digits) {
  13094. return 'decimal_digits';
  13095. }
  13096. }
  13097. }
  13098. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  13099. var symbol1 = getDataTypeSymbol(tableInfo, column);
  13100. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  13101. if (symbol1 !== symbol2) {
  13102. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13103. return 'data_type';
  13104. }
  13105. if (is_fix_size) {
  13106. // 字段域吧大小限制住了
  13107. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13108. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  13109. // 只关注长度
  13110. if (column.column_size != domain.column_size) {
  13111. return 'column_size';
  13112. }
  13113. }
  13114. else {
  13115. // 其他情况,长度和精度都要关注
  13116. if (column.column_size != domain.column_size) {
  13117. return 'column_size';
  13118. }
  13119. if (column.decimal_digits !== domain.decimal_digits) {
  13120. return 'decimal_digits';
  13121. }
  13122. }
  13123. }
  13124. }
  13125. function checkColumn(table, col) {
  13126. if (isEmpty(col.column_name)) {
  13127. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  13128. }
  13129. if (isKeyword(col.column_name)) {
  13130. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  13131. }
  13132. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  13133. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  13134. }
  13135. return undefined;
  13136. }
  13137. function applyDomain(dbType, domain) {
  13138. var editRow = {
  13139. data_type: domain[dbType + '_datatype'],
  13140. };
  13141. domain = _$2.cloneDeep(domain);
  13142. if (!editRow.data_type) {
  13143. throw Error('字段域没有定义数据类型!');
  13144. }
  13145. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  13146. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  13147. if (match) {
  13148. // 类型里面包含括号
  13149. var sz = parseInt(match[2]);
  13150. if (isNaN(sz)) {
  13151. throw Error('字段域的定义错误:' + editRow.data_type);
  13152. }
  13153. domain.is_fix_size = true;
  13154. editRow.data_type = match[1];
  13155. domain.column_size = sz;
  13156. domain.decimal_digits = 0;
  13157. }
  13158. else {
  13159. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  13160. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  13161. if (match2) {
  13162. // 类型里面包含括号
  13163. var sz = parseInt(match2[2]);
  13164. if (isNaN(sz)) {
  13165. throw Error('字段域的定义错误:' + editRow.data_type);
  13166. }
  13167. var dg = parseInt(match2[3]);
  13168. if (isNaN(dg)) {
  13169. throw Error('字段域的定义错误:' + editRow.data_type);
  13170. }
  13171. domain.is_fix_size = true;
  13172. editRow.data_type = match[1];
  13173. domain.column_size = sz;
  13174. domain.decimal_digits = dg;
  13175. }
  13176. }
  13177. if (domain.domain_column_ui) {
  13178. _$2.extend(editRow, {
  13179. column_ui: domain.domain_column_ui,
  13180. });
  13181. }
  13182. if (domain.domain_column_dict) {
  13183. _$2.extend(editRow, {
  13184. column_dict: domain.domain_column_dict,
  13185. });
  13186. }
  13187. if (domain.is_fix_size) {
  13188. _$2.extend(editRow, {
  13189. column_size: domain.column_size,
  13190. decimal_digits: domain.decimal_digits
  13191. });
  13192. }
  13193. if (domain.is_fix_default_value) {
  13194. _$2.extend(editRow, {
  13195. default_value: domain.default_value,
  13196. });
  13197. }
  13198. return editRow;
  13199. }
  13200. /**
  13201. * 获取字段类型代号(用于做跨数据库数据类型对比)
  13202. */
  13203. function getDataTypeSymbol(table, col) {
  13204. if (table.db_type === 'oracle') {
  13205. switch (col.data_type) {
  13206. case 'number':
  13207. if (col.column_size <= 10 && !col.decimal_digits) {
  13208. return 'integer';
  13209. }
  13210. else if (col.column_size <= 19 && !col.decimal_digits) {
  13211. return 'long';
  13212. }
  13213. return 'bigdecimal';
  13214. case 'char':
  13215. if (col.column_size > 3000) {
  13216. return 'clob';
  13217. }
  13218. return 'char';
  13219. case 'integer':
  13220. return 'integer';
  13221. case 'varchar':
  13222. case 'varchar2':
  13223. if (col.column_size > 3000) {
  13224. return 'clob';
  13225. }
  13226. return 'varchar';
  13227. case 'clob':
  13228. return 'clob';
  13229. case 'blob':
  13230. return 'blob';
  13231. case 'date':
  13232. case 'timestamp':
  13233. case 'timestamp(6)':
  13234. case 'timestamp with local time zone':
  13235. case 'timestamp(6) with local time zone':
  13236. case 'timestamp(6) with time zone':
  13237. return 'timestamp';
  13238. }
  13239. return "undefined";
  13240. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  13241. }
  13242. if (table.db_type === 'pgsql') {
  13243. switch (col.data_type) {
  13244. case 'int4':
  13245. return 'integer';
  13246. case 'int8':
  13247. return 'long';
  13248. case 'char':
  13249. return 'char';
  13250. case 'varchar':
  13251. case 'varchar2':
  13252. if (col.column_size > 3000) {
  13253. return 'clob';
  13254. }
  13255. return 'varchar';
  13256. case 'numeric':
  13257. if (col.column_size <= 10 && !col.decimal_digits) {
  13258. return 'integer';
  13259. }
  13260. else if (col.column_size <= 19 && !col.decimal_digits) {
  13261. return 'long';
  13262. }
  13263. return 'bigdecimal';
  13264. case 'timestamp':
  13265. case 'timestamptz':
  13266. return 'timestamp';
  13267. case 'bytea':
  13268. return 'blob';
  13269. }
  13270. return "undefined";
  13271. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  13272. }
  13273. throw Error('未知数据库类型:' + table.db_type);
  13274. }
  13275. /**
  13276. * 判断对象名称是不是数据库关键字(保留字)
  13277. */
  13278. function isKeyword(word) {
  13279. if (!word || typeof word !== 'string') {
  13280. return false;
  13281. }
  13282. var kk = ['access',
  13283. 'add',
  13284. 'all',
  13285. 'alter',
  13286. 'and',
  13287. 'any',
  13288. 'as',
  13289. 'asc',
  13290. 'audit',
  13291. 'between',
  13292. 'by',
  13293. 'char',
  13294. 'check',
  13295. 'cluster',
  13296. 'column',
  13297. 'comment',
  13298. 'compress',
  13299. 'connect',
  13300. 'create',
  13301. 'current',
  13302. 'date',
  13303. 'decimal',
  13304. 'default',
  13305. 'delete',
  13306. 'desc',
  13307. 'distinct',
  13308. 'drop',
  13309. 'else',
  13310. 'exclusive',
  13311. 'exists',
  13312. 'file',
  13313. 'float',
  13314. 'for',
  13315. 'from',
  13316. 'grant',
  13317. 'group',
  13318. 'having',
  13319. 'identified',
  13320. 'immediate',
  13321. 'in',
  13322. 'increment',
  13323. 'index',
  13324. 'initial',
  13325. 'insert',
  13326. 'integer',
  13327. 'intersect',
  13328. 'into',
  13329. 'is',
  13330. 'level',
  13331. 'like',
  13332. 'lock',
  13333. 'long',
  13334. 'maxextents',
  13335. 'minus',
  13336. 'mlslabel',
  13337. 'mode',
  13338. 'modify',
  13339. 'noaudit',
  13340. 'nocompress',
  13341. 'not',
  13342. 'nowait',
  13343. 'null',
  13344. 'number',
  13345. 'of',
  13346. 'offline',
  13347. 'on',
  13348. 'online',
  13349. 'option',
  13350. 'or',
  13351. 'order',
  13352. 'p',
  13353. 'ctfree',
  13354. 'prior',
  13355. 'privileges',
  13356. 'public',
  13357. 'raw',
  13358. 'rename',
  13359. 'resource',
  13360. 'revoke',
  13361. 'row',
  13362. 'rowid',
  13363. 'rownum',
  13364. 'rows',
  13365. 'select',
  13366. 'session',
  13367. 'set',
  13368. 'share',
  13369. 'size',
  13370. 'smallint',
  13371. 'start',
  13372. 'successful',
  13373. 'synonym',
  13374. 'sysdate',
  13375. 'table',
  13376. 'then',
  13377. 'to',
  13378. 'trigger',
  13379. 'uid',
  13380. 'union',
  13381. 'unique',
  13382. 'update',
  13383. 'user',
  13384. 'validate',
  13385. 'values',
  13386. 'varchar',
  13387. 'varchar2',
  13388. 'view',
  13389. 'whenever',
  13390. 'where',
  13391. 'with'];
  13392. return _$2.includes(kk, word.toLowerCase());
  13393. }
  13394. //# sourceMappingURL=DbUtils.js.map
  13395. var DbSync = /** @class */ (function (_super) {
  13396. __extends(DbSync, _super);
  13397. function DbSync() {
  13398. return _super.call(this, { model: model$d, vjson: vjson$d }) || this;
  13399. }
  13400. DbSync.prototype.onLoad = function () {
  13401. };
  13402. DbSync.prototype.getDataBaseName = function (sender, _a) {
  13403. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  13404. getDataBaseNameApi().then(function (res) {
  13405. successCallback(res.data.map(function (name) {
  13406. return {
  13407. id: name, text: name
  13408. };
  13409. }));
  13410. });
  13411. };
  13412. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  13413. showInfoDialog(record.get('remark'));
  13414. };
  13415. DbSync.prototype.diff = function () {
  13416. var _this = this;
  13417. var promise1 = getMateData({
  13418. datasource: this.viewModel.get('dataSource1')
  13419. });
  13420. var promise2 = getMateData({
  13421. datasource: this.viewModel.get('dataSource2')
  13422. });
  13423. this.viewModel.set('schema1', '');
  13424. this.viewModel.set('schema2', '');
  13425. this.refs.grid1.setLoading(true);
  13426. Promise.all([promise1, promise2]).then(function (_a) {
  13427. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13428. var rows = [];
  13429. if (_$2.size(res1) > 0) {
  13430. // res1 起码有一个 schema
  13431. _this.viewModel.set('schema1', res1[0].schema_name);
  13432. _this.viewModel.set('schema2', res2[0].schema_name);
  13433. if (!_this.viewModel.get('schema1')) {
  13434. msg$1('datasource1 最起码需要一张表');
  13435. return;
  13436. }
  13437. if (!_this.viewModel.get('schema2')) {
  13438. msg$1('datasource2 最起码需要一张表');
  13439. return;
  13440. }
  13441. _$2.forEach(res1[0].table_list, function (table1) {
  13442. var _a;
  13443. 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; });
  13444. if (table1.schema_name) {
  13445. _this.viewModel.set('schema1', table1.schema_name);
  13446. }
  13447. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  13448. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  13449. }
  13450. var row = {
  13451. table_name1: table1.table_name,
  13452. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  13453. table_info: table1
  13454. };
  13455. if (!table2) {
  13456. row.diff = '不一致';
  13457. row.remark = '目标表缺失';
  13458. }
  13459. else if (table1.column_list.length !== table2.column_list.length) {
  13460. row.diff = '不一致';
  13461. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  13462. }
  13463. else {
  13464. row.diff = '一致';
  13465. var remark_1 = [];
  13466. _$2.forEach(table1.column_list, function (col1) {
  13467. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  13468. if (!col2) {
  13469. row.diff = '不一致';
  13470. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  13471. }
  13472. else {
  13473. var colDiff = compareColumn(table1, col1, table2, col2);
  13474. if (colDiff) {
  13475. row.diff = '不一致';
  13476. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  13477. }
  13478. }
  13479. });
  13480. row.remark = remark_1.join('\n');
  13481. }
  13482. rows.push(row);
  13483. });
  13484. }
  13485. _this.refs.grid1.setData(rows);
  13486. _this.viewModel.set('hasDiff', true);
  13487. }).finally(function () {
  13488. _this.refs.grid1.setLoading(false);
  13489. });
  13490. };
  13491. DbSync.prototype.structCopyTo = function () {
  13492. var _this = this;
  13493. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13494. msg$1('选择数据源!');
  13495. return;
  13496. }
  13497. var recordList = this.refs.grid1.getSelection();
  13498. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13499. if (_$2.size(tableNameList) <= 0) {
  13500. msg$1('请选择要同步的表');
  13501. return;
  13502. }
  13503. var error = undefined;
  13504. _$2.forEach(tableNameList, function (tableInfo) {
  13505. _$2.forEach(tableInfo.column_list, function (col) {
  13506. error = checkColumn(tableInfo, col);
  13507. return false;
  13508. });
  13509. if (error) {
  13510. return false;
  13511. }
  13512. });
  13513. if (error) {
  13514. msg$1(error);
  13515. return;
  13516. }
  13517. var schema1 = this.viewModel.get('schema1');
  13518. var schema2 = this.viewModel.get('schema2');
  13519. if (!schema1 || !schema2) {
  13520. msg$1('无法识别 schema 名称');
  13521. return;
  13522. }
  13523. this.refs.grid1.setLoading(true);
  13524. getDiffDDLApi({
  13525. datasource1: this.viewModel.get('dataSource1'),
  13526. datasource2: this.viewModel.get('dataSource2'),
  13527. schema1: this.viewModel.get('schema1'),
  13528. schema2: this.viewModel.get('schema2'),
  13529. tables: tableNameList,
  13530. }).then(function (res) {
  13531. if (res.success) {
  13532. _this.refs.ddleditor.setCode(res.data);
  13533. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  13534. }
  13535. }).finally(function () {
  13536. _this.refs.grid1.setLoading(false);
  13537. });
  13538. };
  13539. DbSync.prototype.indexCopyTo = function () {
  13540. var _this = this;
  13541. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13542. msg$1('选择数据源!');
  13543. return;
  13544. }
  13545. var recordList = this.refs.grid1.getSelection();
  13546. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13547. if (_$2.size(tableNameList) <= 0) {
  13548. msg$1('请选择要同步的表');
  13549. return;
  13550. }
  13551. var schema1 = this.viewModel.get('schema1');
  13552. var schema2 = this.viewModel.get('schema2');
  13553. if (!schema1 || !schema2) {
  13554. msg$1('无法识别 schema 名称');
  13555. return;
  13556. }
  13557. this.refs.grid1.setLoading(true);
  13558. getModifyIdxDDL({
  13559. datasource1: this.viewModel.get('dataSource1'),
  13560. datasource2: this.viewModel.get('dataSource2'),
  13561. schema1: this.viewModel.get('schema1'),
  13562. schema2: this.viewModel.get('schema2'),
  13563. tables: tableNameList,
  13564. }).then(function (res) {
  13565. if (res.success) {
  13566. _this.refs.ddleditor_idx.setCode(res.data);
  13567. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  13568. }
  13569. }).finally(function () {
  13570. _this.refs.grid1.setLoading(false);
  13571. });
  13572. };
  13573. DbSync.prototype.procedureCopyTo = function () {
  13574. var _this = this;
  13575. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13576. msg$1('选择数据源!');
  13577. return;
  13578. }
  13579. var schema1 = this.viewModel.get('schema1');
  13580. var schema2 = this.viewModel.get('schema2');
  13581. if (!schema1 || !schema2) {
  13582. msg$1('无法识别 schema 名称');
  13583. return;
  13584. }
  13585. this.refs.grid1.setLoading(true);
  13586. getModifyProcedureSQL({
  13587. datasource1: this.viewModel.get('dataSource1'),
  13588. datasource2: this.viewModel.get('dataSource2'),
  13589. schema1: this.viewModel.get('schema1'),
  13590. schema2: this.viewModel.get('schema2'),
  13591. }).then(function (res) {
  13592. if (res.success) {
  13593. _this.refs.ddleditor_procedure.setCode(res.data);
  13594. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  13595. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  13596. }
  13597. }).finally(function () {
  13598. _this.refs.grid1.setLoading(false);
  13599. });
  13600. };
  13601. DbSync.prototype.dataSync_start = function () {
  13602. var _this = this;
  13603. this.viewModel.set('dataSync_isStart', true);
  13604. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  13605. this.refs.datacopy.setLoading(true);
  13606. dataSyncApi(dataSync)
  13607. .then(function (res) {
  13608. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  13609. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  13610. })
  13611. .finally(function () {
  13612. _this.refs.datacopy.setLoading(false);
  13613. });
  13614. };
  13615. DbSync.prototype.dataSync_process = function () {
  13616. var _this = this;
  13617. var jobId = this.viewModel.get('dataSyncResult.jobId');
  13618. dataSyncInfoApi({ jobId: jobId })
  13619. .then(function (res) {
  13620. if (_$2.isArray(res.tableSyncInfos)) {
  13621. var scrollPosition = _this.refs.datacopy.scrollable.position;
  13622. _this.refs.datacopy.setData(res.tableSyncInfos);
  13623. try {
  13624. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  13625. }
  13626. catch (e) {
  13627. }
  13628. }
  13629. if (res.endTime) {
  13630. // 已经结束
  13631. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  13632. if (res.success) {
  13633. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13634. }
  13635. else {
  13636. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13637. }
  13638. _this.dataSync_stop();
  13639. }
  13640. })
  13641. .catch(function (e) {
  13642. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  13643. console.error(e);
  13644. // this.dataSync_stop()
  13645. })
  13646. .finally(function () {
  13647. _this.refs.datacopy.setLoading(false);
  13648. });
  13649. };
  13650. DbSync.prototype.dataSync_stop = function () {
  13651. this.viewModel.set('dataSync_isStart', false);
  13652. clearInterval(this.dataSyncInterval);
  13653. delete this.dataSyncInterval;
  13654. };
  13655. DbSync.prototype.dataCopyTo = function () {
  13656. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13657. msg$1('选择数据源!');
  13658. return;
  13659. }
  13660. var recordList = this.refs.grid1.getSelection();
  13661. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13662. if (_$2.size(tableNameList) <= 0) {
  13663. msg$1('请选择要同步的表');
  13664. return;
  13665. }
  13666. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  13667. this.viewModel.set('dataSync.tables', tableNameList);
  13668. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  13669. };
  13670. DbSync.prototype.next = function () {
  13671. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  13672. };
  13673. DbSync.prototype.back = function () {
  13674. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  13675. };
  13676. DbSync.prototype.dbToMeta = function () {
  13677. var _this = this;
  13678. var dataSource1 = this.viewModel.get('dataSource1');
  13679. var dataSource2 = this.viewModel.get('dataSource2');
  13680. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  13681. var promise1 = dbToMeta({ datasource: dataSource1 });
  13682. var promise2 = dbToMeta({ datasource: dataSource2 });
  13683. _this.refs.grid1.setLoading(true);
  13684. Promise.all([promise1, promise2]).then(function (_a) {
  13685. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13686. _this.diff();
  13687. }).catch(function (res) {
  13688. _this.refs.grid1.setLoading(false);
  13689. showErrorDialog$1(res);
  13690. });
  13691. });
  13692. };
  13693. DbSync.prototype.executeDDL = function () {
  13694. var _this = this;
  13695. var code = this.refs.ddleditor.getValue();
  13696. var dataSource2 = this.viewModel.get('dataSource2');
  13697. var target_schema_name = this.viewModel.get('schema2');
  13698. var recordList = this.refs.grid1.getSelection();
  13699. var table_infos = _$2.map(recordList, function (r) {
  13700. return r.get('table_info');
  13701. });
  13702. this.setLoading(true);
  13703. pushToDbCommitApi({
  13704. datasource: dataSource2,
  13705. ddl: code,
  13706. table_infos: table_infos,
  13707. target_schema_name: target_schema_name,
  13708. }).then(function (res) {
  13709. if (res === null || res === void 0 ? void 0 : res.success) {
  13710. msg$1('执行成功');
  13711. _this.back();
  13712. _this.diff();
  13713. return;
  13714. }
  13715. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13716. }).finally(function () {
  13717. _this.setLoading(false);
  13718. });
  13719. };
  13720. DbSync.prototype.executeDDLIdx = function () {
  13721. var _this = this;
  13722. var code = this.refs.ddleditor_idx.getValue();
  13723. var dataSource2 = this.viewModel.get('dataSource2');
  13724. this.setLoading(true);
  13725. executeDDL({
  13726. datasource: dataSource2,
  13727. ddl: code,
  13728. }).then(function (res) {
  13729. if (res === null || res === void 0 ? void 0 : res.success) {
  13730. msg$1('执行成功');
  13731. _this.back();
  13732. return;
  13733. }
  13734. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13735. }).finally(function () {
  13736. _this.setLoading(false);
  13737. });
  13738. };
  13739. DbSync.prototype.executeProcedureSQL = function () {
  13740. var _this = this;
  13741. this.setLoading(true);
  13742. executeModifyProcedureSQL({
  13743. datasource1: this.viewModel.get('dataSource1'),
  13744. datasource2: this.viewModel.get('dataSource2'),
  13745. schema1: this.viewModel.get('schema1'),
  13746. schema2: this.viewModel.get('schema2'),
  13747. }).then(function (res) {
  13748. if (res === null || res === void 0 ? void 0 : res.success) {
  13749. msg$1('执行成功');
  13750. _this.back();
  13751. return;
  13752. }
  13753. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13754. }).finally(function () {
  13755. _this.setLoading(false);
  13756. });
  13757. };
  13758. return DbSync;
  13759. }(Scope));
  13760. //# sourceMappingURL=DbSync.js.map
  13761. var model$e = {
  13762. data: {}
  13763. };
  13764. //# sourceMappingURL=DbCodeTemplate.model.js.map
  13765. var vjson$e = {
  13766. title: '示例代码',
  13767. layout: 'fit',
  13768. items: [
  13769. {
  13770. layout: 'border',
  13771. items: [
  13772. {
  13773. region: 'north',
  13774. split: true,
  13775. height: 200,
  13776. title: '表格数据',
  13777. reference: 'dataeditor',
  13778. xtype: 'jsoneditor',
  13779. listeners: {
  13780. change: 'scope.dataChanged'
  13781. },
  13782. },
  13783. {
  13784. region: 'west',
  13785. split: true,
  13786. width: 230,
  13787. title: '模板',
  13788. reference: 'tree1',
  13789. xtype: 'treepanel',
  13790. rootVisible: false,
  13791. useArrows: true,
  13792. colspan: 2,
  13793. lines: true,
  13794. multiSelect: false,
  13795. listeners: {
  13796. itemclick: 'scope.templateChange',
  13797. },
  13798. },
  13799. {
  13800. region: 'center',
  13801. title: '参考代码',
  13802. reference: 'preview',
  13803. xtype: 'jsoneditor',
  13804. },
  13805. ]
  13806. }
  13807. ]
  13808. };
  13809. //# sourceMappingURL=DbCodeTemplate.view.js.map
  13810. var rootNode = {
  13811. id: 'ROOT',
  13812. type: "ROOT",
  13813. path: "",
  13814. expanded: true,
  13815. leaf: false,
  13816. children: [
  13817. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  13818. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  13819. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  13820. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  13821. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  13822. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  13823. ],
  13824. };
  13825. var TemplateDev = /** @class */ (function (_super) {
  13826. __extends(TemplateDev, _super);
  13827. function TemplateDev() {
  13828. var _this = _super.call(this, { model: model$e, vjson: vjson$e }) || this;
  13829. _this.dataChanged = _$2.debounce(function () {
  13830. var me = _this;
  13831. if (me.refs.tree1.selection) {
  13832. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  13833. }
  13834. }, 50);
  13835. return _this;
  13836. }
  13837. TemplateDev.prototype.onDestroy = function () {
  13838. setDbCode(undefined);
  13839. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  13840. };
  13841. TemplateDev.prototype.onLoad = function () {
  13842. setDbCode(this);
  13843. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  13844. this.refs.tree1.setRootNode(rootNode);
  13845. getColumnDomainApi({}).then(function (_a) {
  13846. var data = _a.data;
  13847. return window['dev_column_domain'] = data;
  13848. });
  13849. };
  13850. TemplateDev.prototype.dbTreeNodeChange = function () {
  13851. var me = handles$1.dbcode;
  13852. var tables = [];
  13853. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  13854. var raw = _$2.cloneDeep(r.get('raw'));
  13855. raw.id = r.get('id');
  13856. if (r.get('type') === 'table') {
  13857. tables.push(raw);
  13858. return;
  13859. }
  13860. if (r.get('type') === 'column') {
  13861. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  13862. if (!tableInfo) {
  13863. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  13864. tables.push(tableInfo);
  13865. }
  13866. if (!tableInfo.column_list) {
  13867. tableInfo.column_list = [raw];
  13868. }
  13869. else {
  13870. tableInfo.column_list.push(raw);
  13871. }
  13872. }
  13873. });
  13874. // 对于没有选择列的表格,默认加上所有列
  13875. _$2.forEach(tables, function (tableInfo) {
  13876. if (typeof tableInfo.column_list === 'undefined') {
  13877. tableInfo.column_list = [];
  13878. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  13879. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  13880. });
  13881. }
  13882. });
  13883. var code = JSON.stringify(tables, null, ' ');
  13884. me.refs.dataeditor.setCode(code);
  13885. };
  13886. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  13887. var url = record.data.url;
  13888. var rd = _$2.uniqueId('db_code_request');
  13889. if (url) {
  13890. var data = void 0;
  13891. try {
  13892. data = JSON.parse(this.refs.dataeditor.getCode());
  13893. }
  13894. catch (e) {
  13895. return;
  13896. }
  13897. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  13898. // if (typeof node.default === "function") {
  13899. // const v = toString(node.default(data))
  13900. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  13901. // this.refs.preview.setLanguage("plaintext")
  13902. // this.refs.preview.setCode(v)
  13903. // }
  13904. // })
  13905. showErrorDialog$1('没做这里');
  13906. }
  13907. };
  13908. return TemplateDev;
  13909. }(Scope));
  13910. //# sourceMappingURL=DbCodeTemplate.js.map
  13911. var model$f = {
  13912. data: {
  13913. hasChanged: false,
  13914. }
  13915. };
  13916. //# sourceMappingURL=DbDomain.model.js.map
  13917. var vjson$f = {
  13918. bind: {
  13919. title: '字段域{grid1.ischanged?" *":""}',
  13920. },
  13921. layout: 'fit',
  13922. items: [
  13923. {
  13924. layout: 'border',
  13925. items: [
  13926. {
  13927. region: 'center',
  13928. xtype: 'yvgrid',
  13929. selModel: {
  13930. type: 'spreadsheet',
  13931. columnSelect: true,
  13932. pruneRemoved: false,
  13933. extensible: 'y'
  13934. },
  13935. plugins: {
  13936. clipboard: true,
  13937. selectionreplicator: true
  13938. },
  13939. reference: 'grid1',
  13940. pagination: false,
  13941. tbar: {
  13942. xtype: 'toolbar',
  13943. items: [
  13944. {
  13945. xtype: 'button',
  13946. text: '添加',
  13947. iconCls: 'x-fa fa-plus-circle',
  13948. listeners: {
  13949. click: 'scope.addField'
  13950. }
  13951. },
  13952. {
  13953. xtype: 'button',
  13954. text: '删除',
  13955. iconCls: 'x-fa fa-minus-circle',
  13956. listeners: {
  13957. click: 'scope.removeField'
  13958. }
  13959. },
  13960. {
  13961. xtype: 'button',
  13962. text: '保存',
  13963. iconCls: 'x-fa fa-save',
  13964. bind: {
  13965. disabled: '{!grid1.ischanged}'
  13966. },
  13967. listeners: {
  13968. click: 'scope.save'
  13969. }
  13970. },
  13971. ]
  13972. },
  13973. listeners: {
  13974. editfinish: 'scope.gridEditFinish',
  13975. },
  13976. columns: [
  13977. {
  13978. text: '字段域名称', dataIndex: 'domain_name',
  13979. sortable: false,
  13980. menuDisabled: true,
  13981. locked: true,
  13982. editor: {
  13983. selectOnFocus: true
  13984. }
  13985. },
  13986. {
  13987. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  13988. sortable: false, menuDisabled: true,
  13989. editor: {
  13990. selectOnFocus: true
  13991. }
  13992. },
  13993. {
  13994. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  13995. sortable: false, menuDisabled: true,
  13996. editor: {
  13997. selectOnFocus: true
  13998. }
  13999. },
  14000. {
  14001. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  14002. sortable: false, menuDisabled: true,
  14003. editor: {
  14004. selectOnFocus: true
  14005. }
  14006. },
  14007. {
  14008. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  14009. sortable: false, menuDisabled: true,
  14010. editor: {
  14011. selectOnFocus: true
  14012. }
  14013. },
  14014. {
  14015. text: 'Java类型', dataIndex: 'java_datatype',
  14016. sortable: false, menuDisabled: true,
  14017. editor: {
  14018. selectOnFocus: true
  14019. }
  14020. },
  14021. {
  14022. text: '固定长度', dataIndex: 'is_fix_size',
  14023. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14024. width: 88, resizable: false,
  14025. },
  14026. {
  14027. text: '长度', dataIndex: 'column_size',
  14028. sortable: false, menuDisabled: true, dataType: 'int',
  14029. xtype: 'numbercolumn', format: '0',
  14030. editor: { selectOnFocus: true }
  14031. },
  14032. {
  14033. text: '小数位', dataIndex: 'decimal_digits',
  14034. sortable: false, menuDisabled: true, dataType: 'int',
  14035. xtype: 'numbercolumn', format: '0',
  14036. editor: { selectOnFocus: true }
  14037. },
  14038. {
  14039. text: '字典', dataIndex: 'domain_column_dict',
  14040. sortable: false, menuDisabled: true,
  14041. // fix: ['system.getDict("DICT")'],
  14042. width: 200,
  14043. editor: {
  14044. xtype: 'combo',
  14045. listConfig: {
  14046. minWidth: 350
  14047. },
  14048. }
  14049. },
  14050. {
  14051. text: '固定默认值', dataIndex: 'is_fix_default_value',
  14052. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14053. width: 88, resizable: false,
  14054. },
  14055. {
  14056. text: '默认值', dataIndex: 'default_value',
  14057. sortable: false, menuDisabled: true,
  14058. editor: {
  14059. selectOnFocus: true
  14060. }
  14061. },
  14062. {
  14063. text: 'UI建议', dataIndex: 'domain_column_ui',
  14064. sortable: false, menuDisabled: true,
  14065. // fix: ['system.getDict("column_ui")'],
  14066. editor: {
  14067. xtype: 'combo',
  14068. allowBlank: true,
  14069. listConfig: {
  14070. minWidth: 200
  14071. },
  14072. }
  14073. },
  14074. {
  14075. text: '详细描述', dataIndex: 'domain_note',
  14076. sortable: false, menuDisabled: true,
  14077. editor: {}
  14078. },
  14079. {
  14080. text: '责任人', dataIndex: 'domain_person',
  14081. sortable: false, menuDisabled: true,
  14082. editor: {
  14083. selectOnFocus: true
  14084. }
  14085. },
  14086. {
  14087. text: '版本', dataIndex: 'domain_version',
  14088. sortable: false, menuDisabled: true,
  14089. editor: {
  14090. selectOnFocus: true
  14091. }
  14092. },
  14093. ]
  14094. }
  14095. ]
  14096. },
  14097. ]
  14098. };
  14099. //# sourceMappingURL=DbDomain.view.js.map
  14100. // 字段域数据
  14101. var columnDomain = undefined;
  14102. var DomainStore = /** @class */ (function (_super) {
  14103. __extends(DomainStore, _super);
  14104. function DomainStore() {
  14105. return _super !== null && _super.apply(this, arguments) || this;
  14106. }
  14107. DomainStore.prototype.getCacheKey = function (param) {
  14108. return "domain_data.json";
  14109. };
  14110. DomainStore.prototype.invokeApi = function (param) {
  14111. return getColumnDomainApi();
  14112. };
  14113. /**
  14114. * 设置全局可访问的 字段域数据
  14115. */
  14116. DomainStore.prototype.getColumnDomainComboData = function () {
  14117. var _this = this;
  14118. return new Promise(function (resolve) {
  14119. _this.reloadIfNeedPromise(undefined).then(function (res) {
  14120. resolve(_this.apiResponse.data.map(function (v) {
  14121. return { id: v.domain_id, text: v.domain_name };
  14122. }));
  14123. });
  14124. });
  14125. };
  14126. /**
  14127. * 设置全局可访问的 字段域数据
  14128. */
  14129. DomainStore.prototype.getColumnDomainById = function (value) {
  14130. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  14131. };
  14132. DomainStore.prototype.getAllDomain = function () {
  14133. return new Promise(function (resolve, reject) {
  14134. getColumnDomainApi()
  14135. .then(function (res) {
  14136. if (res.success) {
  14137. columnDomain = res.data;
  14138. resolve(res.data);
  14139. }
  14140. else {
  14141. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  14142. console.error('getColumnDomain', res.msg);
  14143. }
  14144. })
  14145. .catch(function (e) {
  14146. window['showErrorDialog']('getColumnDomain error!');
  14147. console.error('getColumnDomain', e);
  14148. reject(e);
  14149. });
  14150. });
  14151. };
  14152. return DomainStore;
  14153. }(CacheStore));
  14154. var instance$3 = new DomainStore();
  14155. //# sourceMappingURL=DomainStore.js.map
  14156. var DbDomain = /** @class */ (function (_super) {
  14157. __extends(DbDomain, _super);
  14158. function DbDomain() {
  14159. return _super.call(this, { model: model$f, vjson: vjson$f }) || this;
  14160. }
  14161. DbDomain.prototype.onLoad = function () {
  14162. var _this = this;
  14163. instance$3.getAllDomain().then(function (data) {
  14164. _this.refs.grid1.setData(data);
  14165. });
  14166. };
  14167. DbDomain.prototype.gridEditFinish = function () {
  14168. this.viewModel.set('hasChanged', true);
  14169. };
  14170. DbDomain.prototype.addField = function () {
  14171. this.refs.grid1.appendEditRow({
  14172. domainName: '',
  14173. pgSqlDataType: '',
  14174. mysqlDataType: '',
  14175. oracleDataType: '',
  14176. sqlserverDataType: '',
  14177. javaDataType: '',
  14178. isFixSize: true,
  14179. size: '',
  14180. decimalDigits: '',
  14181. isFixDefaultValue: false,
  14182. defaultValue: null,
  14183. domainColumnDict: '',
  14184. domainColumnUI: '',
  14185. note: '',
  14186. domainPerson: '',
  14187. domainVersion: '',
  14188. }, 0);
  14189. };
  14190. DbDomain.prototype.removeField = function () {
  14191. var _this = this;
  14192. var rows = [];
  14193. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  14194. rows.push(r);
  14195. });
  14196. _.forEach(rows, function (r) {
  14197. _this.refs.grid1.getStore().remove(r);
  14198. });
  14199. };
  14200. DbDomain.prototype.save = function () {
  14201. var _this = this;
  14202. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  14203. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  14204. if (err) {
  14205. // 如果有异常就不保存
  14206. return;
  14207. }
  14208. // 进行业务上的逻辑校验,比如说必填校验等等
  14209. var hasError = false;
  14210. _.forEach(rows, function (row, i) {
  14211. if (isEmpty(row.domain_name)) {
  14212. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  14213. hasError = true;
  14214. return false;
  14215. }
  14216. if (isEmpty(row.pgsql_datatype) ||
  14217. isEmpty(row.mysql_datatype) ||
  14218. isEmpty(row.oracle_datatype) ||
  14219. isEmpty(row.sqlserver_datatype)) {
  14220. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  14221. hasError = true;
  14222. return false;
  14223. }
  14224. });
  14225. if (hasError) {
  14226. return;
  14227. }
  14228. // 设置当前界面为 "保存中..." 状态
  14229. this.setLoading(true);
  14230. saveColumnDomain({
  14231. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  14232. newRows: newRows,
  14233. modifyRows: modifyRows,
  14234. removeRecords: removeRecords,
  14235. }).then(function (res) {
  14236. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  14237. system.msg(res.msg);
  14238. instance$3.reloadForce({}).then(function () {
  14239. instance$3.getAllDomain().then(function (data) {
  14240. _this.refs.grid1.setData(data);
  14241. });
  14242. }).finally(function () {
  14243. // 无论正常异常,关闭 "保存中..." 状态
  14244. _this.setLoading(false);
  14245. });
  14246. }).catch(function (e) {
  14247. // 无论正常异常,关闭 "保存中..." 状态
  14248. _this.setLoading(false);
  14249. });
  14250. };
  14251. return DbDomain;
  14252. }(Scope));
  14253. //# sourceMappingURL=DbDomain.js.map
  14254. var model$g = {
  14255. data: {
  14256. report_id: '',
  14257. report_name: '',
  14258. report_enable: false,
  14259. report: {
  14260. dataSource: '',
  14261. grid: {
  14262. pagination: true,
  14263. },
  14264. query: [],
  14265. columns: [],
  14266. summary: [],
  14267. },
  14268. querySql: '',
  14269. summarySql: '',
  14270. createAt: '',
  14271. createBy: '',
  14272. updateAt: '',
  14273. updateBy: '',
  14274. }
  14275. };
  14276. //# sourceMappingURL=ReportDesign.model.js.map
  14277. var vjson$g = {
  14278. bind: {
  14279. title: '报表-{report_name}',
  14280. },
  14281. layout: 'fit',
  14282. items: [
  14283. {
  14284. layout: 'border',
  14285. items: [
  14286. {
  14287. region: 'north',
  14288. items: [
  14289. {
  14290. xtype: 'toolbar',
  14291. border: false,
  14292. items: [
  14293. {
  14294. xtype: 'button',
  14295. text: '刷新',
  14296. iconCls: 'x-fa fa-refresh',
  14297. listeners: {
  14298. click: 'scope.load'
  14299. }
  14300. },
  14301. {
  14302. xtype: 'button',
  14303. text: '保存',
  14304. iconCls: 'x-fa fa-save',
  14305. listeners: {
  14306. click: 'scope.save'
  14307. }
  14308. },
  14309. {
  14310. xtype: 'button',
  14311. text: '预览',
  14312. iconCls: 'x-fa fa-play-circle-o',
  14313. listeners: {
  14314. click: 'scope.preview'
  14315. }
  14316. },
  14317. {
  14318. xtype: 'textfield',
  14319. fieldLabel: '报表名称',
  14320. flex: 1,
  14321. bind: {
  14322. value: '{report_name}'
  14323. }
  14324. },
  14325. {
  14326. xtype: 'checkbox',
  14327. fieldLabel: '启用报表',
  14328. checkedValue: 1,
  14329. uncheckedValue: 0,
  14330. bind: {
  14331. value: '{report_enable}'
  14332. }
  14333. },
  14334. {
  14335. xtype: 'checkbox',
  14336. fieldLabel: '启用分页',
  14337. bind: {
  14338. value: '{report.grid.pagination}'
  14339. }
  14340. },
  14341. {
  14342. xtype: 'textfield',
  14343. fieldLabel: '数据源',
  14344. flex: 1,
  14345. bind: {
  14346. value: '{report.dataSource}'
  14347. }
  14348. },
  14349. ]
  14350. }
  14351. ]
  14352. },
  14353. {
  14354. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  14355. items: [
  14356. {
  14357. title: 'SQL和查询条件',
  14358. layout: 'border',
  14359. border: false,
  14360. items: [
  14361. {
  14362. region: 'north',
  14363. height: 200,
  14364. border: false,
  14365. split: true,
  14366. xtype: 'yvgrid',
  14367. reference: 'gridCondition',
  14368. pagination: false,
  14369. hideFootbar: true,
  14370. plugins: {
  14371. clipboard: true,
  14372. selectionreplicator: true
  14373. },
  14374. selModel: {
  14375. type: 'spreadsheet',
  14376. columnSelect: false,
  14377. pruneRemoved: false,
  14378. extensible: 'y'
  14379. },
  14380. tbar: {
  14381. xtype: 'toolbar',
  14382. border: false,
  14383. items: [
  14384. {
  14385. xtype: 'button',
  14386. text: '添加条件',
  14387. iconCls: 'x-fa fa-plus-circle',
  14388. listeners: {
  14389. click: 'scope.addCondition'
  14390. }
  14391. },
  14392. {
  14393. xtype: 'button',
  14394. text: '删除条件',
  14395. iconCls: 'x-fa fa-minus-circle',
  14396. listeners: {
  14397. click: 'scope.removeCondition'
  14398. }
  14399. },
  14400. '-',
  14401. {
  14402. xtype: 'button',
  14403. text: '自动分析条件变量',
  14404. iconCls: 'x-fa fa-code-fork',
  14405. listeners: {
  14406. click: 'scope.calcCondition'
  14407. }
  14408. },
  14409. {
  14410. xtype: 'button',
  14411. text: '上移',
  14412. iconCls: 'x-fa fa-arrow-up',
  14413. listeners: {
  14414. click: 'scope.moveUp'
  14415. }
  14416. },
  14417. {
  14418. xtype: 'button',
  14419. text: '下移',
  14420. iconCls: 'x-fa fa-arrow-down',
  14421. listeners: {
  14422. click: 'scope.moveDown'
  14423. }
  14424. },
  14425. ]
  14426. },
  14427. columns: [
  14428. {
  14429. text: '条件变量',
  14430. dataIndex: 'conditionFieldBind',
  14431. width: 140,
  14432. sortable: false,
  14433. menuDisabled: true,
  14434. editor: {
  14435. selectOnFocus: true
  14436. },
  14437. },
  14438. {
  14439. text: '中文标题',
  14440. dataIndex: 'conditionFieldLabel',
  14441. width: 120,
  14442. sortable: false,
  14443. menuDisabled: true,
  14444. editor: {
  14445. selectOnFocus: true
  14446. },
  14447. },
  14448. {
  14449. text: '编辑类型',
  14450. dataIndex: 'conditionFieldXtype',
  14451. width: 80,
  14452. sortable: false,
  14453. menuDisabled: true,
  14454. editor: {
  14455. xtype: 'combo',
  14456. typeAhead: true,
  14457. triggerAction: 'all',
  14458. selectOnFocus: true,
  14459. store: [
  14460. ['textfield', 'textfield'],
  14461. ['combo', 'combo'],
  14462. ['datefield', 'datefield'],
  14463. ['datetimefield', 'datetimefield'],
  14464. ['numberfield', 'numberfield'],
  14465. ['multiplesearch', 'multiplesearch'],
  14466. ]
  14467. }
  14468. },
  14469. {
  14470. text: '权重',
  14471. dataIndex: 'conditionFieldFlex',
  14472. align: 'right',
  14473. width: 60,
  14474. sortable: false,
  14475. menuDisabled: true,
  14476. editor: {
  14477. xtype: 'numberfield',
  14478. selectOnFocus: false,
  14479. minValue: 0,
  14480. maxValue: 10
  14481. },
  14482. },
  14483. {
  14484. text: '字典',
  14485. dataIndex: 'conditionFieldDict',
  14486. width: 160,
  14487. sortable: false,
  14488. menuDisabled: true,
  14489. editor: {
  14490. selectOnFocus: false
  14491. },
  14492. },
  14493. {
  14494. xtype: 'checkcolumn',
  14495. dataIndex: "conditionFieldWrap", header: "换行",
  14496. width: 65,
  14497. sortable: false,
  14498. menuDisabled: true,
  14499. },
  14500. {
  14501. text: '扩展参数',
  14502. dataIndex: 'conditionFieldExtend',
  14503. sortable: false,
  14504. menuDisabled: true,
  14505. editor: {
  14506. selectOnFocus: false
  14507. },
  14508. },
  14509. ]
  14510. },
  14511. {
  14512. region: 'center',
  14513. xtype: 'sqleditor',
  14514. layout: 'fit',
  14515. reference: 'sqlEditor',
  14516. split: true,
  14517. },
  14518. ]
  14519. },
  14520. {
  14521. title: '查询结果字段',
  14522. xtype: 'yvgrid',
  14523. reference: 'gridColumn',
  14524. pagination: false,
  14525. hideFootbar: true,
  14526. border: false,
  14527. plugins: {
  14528. clipboard: true,
  14529. selectionreplicator: true
  14530. },
  14531. selModel: {
  14532. type: 'spreadsheet',
  14533. columnSelect: false,
  14534. pruneRemoved: false,
  14535. extensible: 'y'
  14536. },
  14537. tbar: {
  14538. xtype: 'toolbar',
  14539. items: [
  14540. {
  14541. xtype: 'button',
  14542. text: '添加',
  14543. iconCls: 'x-fa fa-plus-circle',
  14544. listeners: {
  14545. click: 'scope.addColumn'
  14546. }
  14547. },
  14548. {
  14549. xtype: 'button',
  14550. text: '删除',
  14551. iconCls: 'x-fa fa-minus-circle',
  14552. listeners: {
  14553. click: 'scope.removeColumn'
  14554. }
  14555. },
  14556. '-',
  14557. {
  14558. xtype: 'button',
  14559. text: '自动分析',
  14560. iconCls: 'x-fa fa-code-fork',
  14561. listeners: {
  14562. click: 'scope.calcColumn'
  14563. }
  14564. },
  14565. {
  14566. xtype: 'button',
  14567. text: '上移',
  14568. iconCls: 'x-fa fa-arrow-up',
  14569. listeners: {
  14570. click: 'scope.moveUp'
  14571. }
  14572. },
  14573. {
  14574. xtype: 'button',
  14575. text: '下移',
  14576. iconCls: 'x-fa fa-arrow-down',
  14577. listeners: {
  14578. click: 'scope.moveDown'
  14579. }
  14580. },
  14581. ]
  14582. },
  14583. columns: [
  14584. { xtype: 'rownumberer' },
  14585. {
  14586. text: '字段',
  14587. dataIndex: 'dataIndex',
  14588. width: 140,
  14589. sortable: false,
  14590. menuDisabled: true,
  14591. editor: {
  14592. selectOnFocus: true
  14593. },
  14594. },
  14595. {
  14596. text: '标题',
  14597. dataIndex: 'header',
  14598. width: 120,
  14599. sortable: false,
  14600. menuDisabled: true,
  14601. editor: {
  14602. selectOnFocus: true
  14603. },
  14604. },
  14605. {
  14606. text: '显示类型',
  14607. dataIndex: 'xtype',
  14608. width: 90,
  14609. sortable: false,
  14610. menuDisabled: true,
  14611. editor: {
  14612. xtype: 'combo',
  14613. typeAhead: true,
  14614. triggerAction: 'all',
  14615. selectOnFocus: true,
  14616. store: [
  14617. ['', ''],
  14618. ['rownum', 'rownum'],
  14619. ['button', 'button'],
  14620. ['checkbox', 'checkbox'],
  14621. ['progres', 'progres'],
  14622. ]
  14623. }
  14624. },
  14625. {
  14626. text: '数据类型',
  14627. dataIndex: 'dataType',
  14628. width: 90,
  14629. sortable: false,
  14630. menuDisabled: true,
  14631. editor: {
  14632. xtype: 'combo',
  14633. typeAhead: true,
  14634. triggerAction: 'all',
  14635. selectOnFocus: true,
  14636. store: [
  14637. ['', ''],
  14638. ['string', 'string'],
  14639. ['number', 'number'],
  14640. ['date', 'date'],
  14641. ]
  14642. }
  14643. },
  14644. {
  14645. text: '宽度',
  14646. dataIndex: 'width',
  14647. align: 'right',
  14648. width: 60,
  14649. sortable: false,
  14650. menuDisabled: true,
  14651. editor: {
  14652. xtype: 'numberfield',
  14653. selectOnFocus: true,
  14654. minValue: 0,
  14655. maxValue: 1000
  14656. },
  14657. },
  14658. {
  14659. text: '权重',
  14660. dataIndex: 'flex',
  14661. align: 'right',
  14662. width: 60,
  14663. sortable: false,
  14664. menuDisabled: true,
  14665. editor: {
  14666. xtype: 'numberfield',
  14667. selectOnFocus: true,
  14668. minValue: 0,
  14669. maxValue: 10
  14670. },
  14671. },
  14672. {
  14673. text: '字典',
  14674. dataIndex: 'dict',
  14675. sortable: false,
  14676. menuDisabled: true,
  14677. width: 120,
  14678. editor: {
  14679. selectOnFocus: true,
  14680. },
  14681. },
  14682. {
  14683. text: '对齐',
  14684. dataIndex: 'align',
  14685. width: 60,
  14686. sortable: false,
  14687. menuDisabled: true,
  14688. editor: {
  14689. xtype: 'combo',
  14690. typeAhead: true,
  14691. triggerAction: 'all',
  14692. selectOnFocus: false,
  14693. store: [
  14694. ['', ''],
  14695. ['start', 'start'],
  14696. ['center', 'center'],
  14697. ['end', 'end'],
  14698. ]
  14699. },
  14700. },
  14701. {
  14702. text: '过滤',
  14703. dataIndex: 'filterable',
  14704. xtype: 'checkcolumn',
  14705. width: 50,
  14706. resizable: false,
  14707. sortable: false,
  14708. menuDisabled: true,
  14709. },
  14710. {
  14711. text: '隐藏',
  14712. dataIndex: 'hidden',
  14713. xtype: 'checkcolumn',
  14714. width: 50,
  14715. resizable: false,
  14716. sortable: false,
  14717. menuDisabled: true,
  14718. },
  14719. {
  14720. text: '排序',
  14721. dataIndex: 'sortable',
  14722. xtype: 'checkcolumn',
  14723. width: 50,
  14724. resizable: false,
  14725. sortable: false,
  14726. menuDisabled: true,
  14727. },
  14728. {
  14729. text: '扩展参数',
  14730. dataIndex: 'fieldExtend',
  14731. sortable: false,
  14732. menuDisabled: true,
  14733. editor: {
  14734. selectOnFocus: false
  14735. },
  14736. },
  14737. ],
  14738. },
  14739. {
  14740. title: '汇总和汇总逻辑',
  14741. layout: 'border',
  14742. border: false,
  14743. items: [
  14744. {
  14745. xtype: 'yvgrid', region: 'north', layout: 'fit',
  14746. reference: 'gridSum',
  14747. pagination: false,
  14748. hideFootbar: true,
  14749. height: 200,
  14750. split: true,
  14751. border: false,
  14752. plugins: {
  14753. clipboard: true,
  14754. selectionreplicator: true
  14755. },
  14756. selModel: {
  14757. type: 'spreadsheet',
  14758. columnSelect: false,
  14759. pruneRemoved: false,
  14760. extensible: 'y'
  14761. },
  14762. tbar: {
  14763. xtype: 'toolbar',
  14764. border: false,
  14765. items: [
  14766. {
  14767. xtype: 'button',
  14768. text: '添加',
  14769. iconCls: 'x-fa fa-plus-circle',
  14770. listeners: {
  14771. click: 'scope.addSum'
  14772. }
  14773. },
  14774. {
  14775. xtype: 'button',
  14776. text: '删除',
  14777. iconCls: 'x-fa fa-minus-circle',
  14778. listeners: {
  14779. click: 'scope.removeSum'
  14780. }
  14781. },
  14782. '-',
  14783. {
  14784. xtype: 'button',
  14785. text: '自动分析',
  14786. iconCls: 'x-fa fa-code-fork',
  14787. listeners: {
  14788. click: 'scope.calcSum'
  14789. }
  14790. },
  14791. {
  14792. xtype: 'button',
  14793. text: '上移',
  14794. iconCls: 'x-fa fa-arrow-up',
  14795. listeners: {
  14796. click: 'scope.moveUp'
  14797. }
  14798. },
  14799. {
  14800. xtype: 'button',
  14801. text: '下移',
  14802. iconCls: 'x-fa fa-arrow-down',
  14803. listeners: {
  14804. click: 'scope.moveDown'
  14805. }
  14806. },
  14807. ]
  14808. },
  14809. columns: [
  14810. {
  14811. text: '字段名',
  14812. dataIndex: 'sumFieldBind',
  14813. width: 140,
  14814. sortable: false,
  14815. menuDisabled: true,
  14816. editor: {
  14817. selectOnFocus: true
  14818. },
  14819. },
  14820. {
  14821. text: '标题',
  14822. dataIndex: 'sumFieldLabel',
  14823. width: 120,
  14824. sortable: false,
  14825. menuDisabled: true,
  14826. editor: {
  14827. selectOnFocus: true
  14828. },
  14829. },
  14830. {
  14831. text: '权重',
  14832. dataIndex: 'sumFieldFlex',
  14833. align: 'right',
  14834. width: 60,
  14835. sortable: false,
  14836. menuDisabled: true,
  14837. editor: {
  14838. xtype: 'numberfield',
  14839. selectOnFocus: false,
  14840. allowBlank: true,
  14841. minValue: 0,
  14842. maxValue: 10
  14843. },
  14844. },
  14845. {
  14846. xtype: 'checkcolumn',
  14847. dataIndex: "sumFieldWrap", header: "换行",
  14848. sortable: false,
  14849. menuDisabled: true,
  14850. width: 65,
  14851. },
  14852. {
  14853. text: '扩展参数',
  14854. dataIndex: 'sumFieldExtend',
  14855. sortable: false,
  14856. menuDisabled: true,
  14857. editor: {
  14858. selectOnFocus: false
  14859. },
  14860. },
  14861. ]
  14862. },
  14863. {
  14864. region: 'center',
  14865. xtype: 'sqleditor',
  14866. layout: 'fit',
  14867. reference: 'sqlSumEditor',
  14868. },
  14869. ]
  14870. },
  14871. ]
  14872. }
  14873. ]
  14874. }
  14875. ]
  14876. }; //
  14877. //
  14878. //# sourceMappingURL=ReportDesign.view.js.map
  14879. var PROJECT_DICT_CACHE = {};
  14880. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  14881. /**
  14882. *项目运行时构建
  14883. **/
  14884. function createRuntime() {
  14885. {
  14886. // 已经构建过了
  14887. return new Promise(function (resolve) {
  14888. resolve();
  14889. });
  14890. }
  14891. }
  14892. //# sourceMappingURL=ProjectRuntime.js.map
  14893. function ReportRunner(reportId, setLoadingFn) {
  14894. return new Promise(function (resolve) {
  14895. setLoadingFn(true);
  14896. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  14897. // const {model, vjson, report} = buildVjson(res.data)
  14898. // const ret = new ReportScope({model, vjson})
  14899. // ret.report_id = reportId
  14900. // ret.report = report
  14901. // resolve(ret)
  14902. var _b = __read(_a, 1), res = _b[0];
  14903. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  14904. resolve(ret);
  14905. }).finally(function () {
  14906. setLoadingFn(false);
  14907. });
  14908. });
  14909. }
  14910. //# sourceMappingURL=ReportRunner.js.map
  14911. //gridCondition
  14912. //gridColumn
  14913. //gridSum
  14914. //sqlSumEditor
  14915. //sqlEditor
  14916. var ReportDesign = /** @class */ (function (_super) {
  14917. __extends(ReportDesign, _super);
  14918. function ReportDesign() {
  14919. return _super.call(this, { model: model$g, vjson: vjson$g }) || this;
  14920. }
  14921. ReportDesign.prototype.onLoad = function () {
  14922. this.load();
  14923. };
  14924. ReportDesign.prototype.save = function (sender) {
  14925. var _this = this;
  14926. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  14927. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  14928. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  14929. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  14930. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  14931. var report = this.viewModel.get('report');
  14932. var data = {
  14933. report_id: this.viewModel.get('report_id'),
  14934. report_name: this.viewModel.get('report_name'),
  14935. report_enable: this.viewModel.get('report_enable'),
  14936. query_sql: this.viewModel.get('querySql'),
  14937. summary_sql: this.viewModel.get('summarySql'),
  14938. report: json5.stringify(report, null, ' '),
  14939. };
  14940. sender.setLoading(true);
  14941. saveReportApi(data).then(function (res) {
  14942. if (res.success) {
  14943. msg$1('保存成功');
  14944. _this.dialogSuccess(data);
  14945. _this.load();
  14946. }
  14947. }).finally(function () {
  14948. sender.setLoading(false);
  14949. });
  14950. };
  14951. ReportDesign.prototype.preview = function (sender) {
  14952. var reportId = this.viewModel.get('report_id');
  14953. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  14954. handles.mainWindow.showReportPreview(reportId, scope);
  14955. });
  14956. };
  14957. ReportDesign.prototype.load = function () {
  14958. var _this = this;
  14959. var reportId = this.viewModel.get('report_id');
  14960. this.setLoading(true);
  14961. reportByIdApi(reportId).then(function (res) {
  14962. 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;
  14963. if (report) {
  14964. report = json5.parse(report);
  14965. }
  14966. else {
  14967. report = {};
  14968. }
  14969. _this.viewModel.set('report_enable', report_enable);
  14970. _this.viewModel.set('report_name', report_name);
  14971. _this.viewModel.set('querySql', query_sql || '');
  14972. _this.viewModel.set('summarySql', summary_sql || '');
  14973. system.mergeViewModel(_this.viewModel, 'report', report, false);
  14974. var query = _this.viewModel.get('report.query') || [];
  14975. var columns = _this.viewModel.get('report.columns') || [];
  14976. var summary = _this.viewModel.get('report.summary') || [];
  14977. var querySql = _this.viewModel.get('querySql');
  14978. var summarySql = _this.viewModel.get('summarySql');
  14979. _this.refs.gridCondition.setData(query);
  14980. _this.refs.gridColumn.setData(columns);
  14981. _this.refs.gridSum.setData(summary);
  14982. _this.refs.sqlEditor.setCode(querySql);
  14983. _this.refs.sqlSumEditor.setCode(summarySql);
  14984. }).finally(function () {
  14985. _this.setLoading(false);
  14986. });
  14987. };
  14988. ReportDesign.prototype.addCondition = function () {
  14989. this.refs.gridCondition.appendEditRow({
  14990. conditionFieldBind: '',
  14991. conditionFieldLabel: '',
  14992. conditionFieldXtype: 'textfield',
  14993. conditionFieldFlex: 1,
  14994. conditionFieldDict: '',
  14995. conditionFieldWrap: false,
  14996. conditionFieldExtend: '{}',
  14997. }, 'conditionFieldBind');
  14998. };
  14999. ReportDesign.prototype.removeCondition = function () {
  15000. var _this = this;
  15001. var rows = [];
  15002. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  15003. rows.push(r);
  15004. });
  15005. _.forEach(rows, function (r) {
  15006. _this.refs.gridCondition.getStore().remove(r);
  15007. });
  15008. };
  15009. ReportDesign.prototype.moveUp = function (sender) {
  15010. var grid = sender.up('grid');
  15011. grid.rowMoveUp();
  15012. };
  15013. ReportDesign.prototype.moveDown = function (sender) {
  15014. var grid = sender.up('grid');
  15015. grid.rowMoveDown();
  15016. };
  15017. ReportDesign.prototype.calcCondition = function () {
  15018. var _this = this;
  15019. var sql = this.refs.sqlEditor.getCode();
  15020. var re = sql.matchAll(/#{(.+?)}/gi);
  15021. var rows = this.refs.gridCondition.getDataRows();
  15022. this.refs.gridCondition.setLoading(true);
  15023. Promise.all([
  15024. parseDynamicSqlApi(sql),
  15025. instance.reloadIfNeedPromise(),
  15026. ]).then(function (_a) {
  15027. var e_1, _b;
  15028. var _c = __read(_a, 1), res1 = _c[0];
  15029. if (res1.success) {
  15030. var tables_1 = [];
  15031. _.forEach(res1.data, function (parseItem) {
  15032. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  15033. if (tableName && !_.includes(tables_1, tableName)) {
  15034. tables_1.push(tableName);
  15035. }
  15036. });
  15037. var _loop_1 = function (m) {
  15038. var e_2, _a;
  15039. var columnName = m[1];
  15040. // 没有这个列才添加
  15041. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  15042. var meta = undefined;
  15043. try {
  15044. 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()) {
  15045. var tableName = tables_2_1.value;
  15046. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  15047. if (meta) {
  15048. break;
  15049. }
  15050. }
  15051. }
  15052. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  15053. finally {
  15054. try {
  15055. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  15056. }
  15057. finally { if (e_2) throw e_2.error; }
  15058. }
  15059. if (meta) {
  15060. // 找到元数据
  15061. var r = {
  15062. conditionFieldBind: meta.column_name,
  15063. conditionFieldLabel: meta.column_comment,
  15064. conditionFieldXtype: 'textfield',
  15065. conditionFieldFlex: 1,
  15066. conditionFieldDict: '',
  15067. conditionFieldWrap: false,
  15068. conditionFieldExtend: '{}',
  15069. };
  15070. if (meta.column_ui === 'combo' && meta.column_dict) {
  15071. r.conditionFieldXtype = 'combo';
  15072. r.conditionFieldDict = meta.column_dict;
  15073. }
  15074. else if (meta.column_ui === "checkbox") {
  15075. r.conditionFieldXtype = 'checkbox';
  15076. }
  15077. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15078. r.conditionFieldXtype = 'numberfield';
  15079. }
  15080. _this.refs.gridCondition.appendEditRow(r);
  15081. }
  15082. else {
  15083. // 没找到元数据,直接添加
  15084. _this.refs.gridCondition.appendEditRow({
  15085. conditionFieldBind: columnName,
  15086. conditionFieldLabel: '',
  15087. conditionFieldXtype: 'textfield',
  15088. conditionFieldFlex: 1,
  15089. conditionFieldDict: '',
  15090. conditionFieldWrap: false,
  15091. conditionFieldExtend: '{}',
  15092. });
  15093. }
  15094. }
  15095. };
  15096. try {
  15097. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  15098. var m = re_1_1.value;
  15099. _loop_1(m);
  15100. }
  15101. }
  15102. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  15103. finally {
  15104. try {
  15105. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  15106. }
  15107. finally { if (e_1) throw e_1.error; }
  15108. }
  15109. }
  15110. }).finally(function () {
  15111. _this.refs.gridCondition.setLoading(false);
  15112. });
  15113. };
  15114. ReportDesign.prototype.addColumn = function () {
  15115. this.refs.gridColumn.appendEditRow({
  15116. dataIndex: '',
  15117. header: '',
  15118. xtype: '',
  15119. dataType: '',
  15120. width: '',
  15121. dict: '',
  15122. align: '',
  15123. filterable: true,
  15124. hidden: false,
  15125. sortable: true,
  15126. fieldExtend: '{}',
  15127. }, 'header');
  15128. };
  15129. ReportDesign.prototype.removeColumn = function () {
  15130. var _this = this;
  15131. var rows = [];
  15132. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  15133. rows.push(r);
  15134. });
  15135. _.forEach(rows, function (r) {
  15136. _this.refs.gridColumn.getStore().remove(r);
  15137. });
  15138. };
  15139. ReportDesign.prototype.calcColumn = function () {
  15140. var _this = this;
  15141. var sql = this.refs.sqlEditor.getCode();
  15142. this.refs.gridColumn.setLoading(true);
  15143. var rows = this.refs.gridColumn.getDataRows();
  15144. Promise.all([
  15145. parseDynamicSqlApi(sql),
  15146. instance.reloadIfNeedPromise(),
  15147. ]).then(function (_a) {
  15148. var _b = __read(_a, 1), res1 = _b[0];
  15149. if (res1.success) {
  15150. _.forEach(res1.data, function (parseItem) {
  15151. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  15152. // 是否找到重复字段
  15153. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  15154. if (exists) {
  15155. if ((columnTypeName || "").toLowerCase() === "number") {
  15156. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  15157. if (record) {
  15158. record.set("dataType", "number");
  15159. record.set("align", "end");
  15160. }
  15161. }
  15162. return;
  15163. }
  15164. if (tableName) {
  15165. // 解出表格名和字段名
  15166. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  15167. if (meta) {
  15168. // 找到了元数据
  15169. var r = {
  15170. dataIndex: meta.column_name,
  15171. header: meta.column_comment,
  15172. xtype: '',
  15173. dataType: '',
  15174. width: '',
  15175. dict: '',
  15176. align: '',
  15177. filterable: true,
  15178. hidden: false,
  15179. sortable: true,
  15180. fieldExtend: '{}',
  15181. };
  15182. if (meta.column_ui === 'combo' && meta.column_dict) {
  15183. r.dict = meta.column_dict;
  15184. }
  15185. else if (meta.column_ui === "checkbox") {
  15186. r.xtype = 'checkbox';
  15187. }
  15188. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15189. r.dataType = meta.data_type;
  15190. r.align = 'end';
  15191. }
  15192. if ((columnTypeName || "").toLowerCase() === "number") {
  15193. r.dataType = "number";
  15194. r.align = 'end';
  15195. }
  15196. _this.refs.gridColumn.appendEditRow(r);
  15197. return;
  15198. }
  15199. }
  15200. if (columnName) {
  15201. // 解出字段名
  15202. var r = {
  15203. dataIndex: columnName,
  15204. header: columnName,
  15205. xtype: '',
  15206. dataType: '',
  15207. width: '',
  15208. dict: '',
  15209. align: '',
  15210. filterable: true,
  15211. hidden: false,
  15212. sortable: true,
  15213. fieldExtend: '{}',
  15214. };
  15215. if ((columnTypeName || "").toLowerCase() === "number") {
  15216. r.dataType = "number";
  15217. r.align = 'end';
  15218. }
  15219. _this.refs.gridColumn.appendEditRow(r);
  15220. }
  15221. });
  15222. }
  15223. }).finally(function () {
  15224. _this.refs.gridColumn.setLoading(false);
  15225. });
  15226. };
  15227. ReportDesign.prototype.addSum = function () {
  15228. this.refs.gridSum.appendEditRow({
  15229. sumFieldBind: '',
  15230. sumFieldLabel: '',
  15231. sumFieldFlex: 1,
  15232. sumFieldWrap: false,
  15233. sumFieldExtend: '{}',
  15234. }, 'sumFieldBind');
  15235. };
  15236. ReportDesign.prototype.removeSum = function () {
  15237. var _this = this;
  15238. var rows = [];
  15239. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  15240. rows.push(r);
  15241. });
  15242. _.forEach(rows, function (r) {
  15243. _this.refs.gridSum.getStore().remove(r);
  15244. });
  15245. };
  15246. ReportDesign.prototype.calcSum = function () {
  15247. var _this = this;
  15248. var sql = this.refs.sqlSumEditor.getCode();
  15249. var rows = this.refs.gridSum.getDataRows();
  15250. this.refs.gridSum.setLoading(true);
  15251. parseDynamicSqlApi(sql).then(function (res1) {
  15252. if (res1.success) {
  15253. _.forEach(res1.data, function (parseItem) {
  15254. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  15255. // 是否找到重复字段
  15256. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  15257. return;
  15258. }
  15259. if (columnName) {
  15260. // 解出字段名
  15261. _this.refs.gridSum.appendEditRow({
  15262. sumFieldBind: columnName,
  15263. sumFieldLabel: columnName,
  15264. sumFieldFlex: 1,
  15265. sumFieldWrap: false,
  15266. sumFieldExtend: '{}',
  15267. });
  15268. }
  15269. });
  15270. }
  15271. }).finally(function () {
  15272. _this.refs.gridSum.setLoading(false);
  15273. });
  15274. };
  15275. Object.defineProperty(ReportDesign.prototype, "reportId", {
  15276. get: function () {
  15277. return this.viewModel.get('report_id');
  15278. },
  15279. enumerable: true,
  15280. configurable: true
  15281. });
  15282. return ReportDesign;
  15283. }(Scope));
  15284. //# sourceMappingURL=ReportDesign.js.map
  15285. var model$h = {
  15286. data: {
  15287. originalTableInfo: {
  15288. table_name: '',
  15289. description: '',
  15290. },
  15291. hasChanged: false,
  15292. schema_name: undefined,
  15293. table_name: undefined,
  15294. column_name: undefined,
  15295. tableInfo: {
  15296. schema_name: '',
  15297. table_name: '',
  15298. description: '',
  15299. biz_category: '',
  15300. note: '',
  15301. archive_enable: false,
  15302. archive_cron: '',
  15303. archive_condition: '',
  15304. column_list: []
  15305. },
  15306. },
  15307. formulas: {
  15308. shouldSave: function (get) {
  15309. // console.log("-->", get('grid1.ischanged'))
  15310. return get('grid1.ischanged')
  15311. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  15312. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  15313. },
  15314. },
  15315. };
  15316. //# sourceMappingURL=DbColumn.model.js.map
  15317. var vjson$h = {
  15318. bind: {
  15319. title: '{tableName}{shouldSave?" *":""}',
  15320. },
  15321. layout: 'fit',
  15322. items: [
  15323. {
  15324. layout: 'border',
  15325. tbar: {
  15326. xtype: 'toolbar',
  15327. items: [
  15328. // {
  15329. // xtype: 'button',
  15330. // text: '拉取库结构',
  15331. // iconCls: 'x-fa fa-cloud-download',
  15332. // listeners: {
  15333. // click: 'scope.pullFromDb'
  15334. // }
  15335. // },
  15336. {
  15337. xtype: 'button',
  15338. text: '保存至数据库',
  15339. iconCls: 'x-fa fa-save',
  15340. bind: {
  15341. disabled: '{!shouldSave}'
  15342. },
  15343. listeners: {
  15344. click: 'scope.pushToDb'
  15345. }
  15346. },
  15347. '-',
  15348. {
  15349. xtype: 'button',
  15350. text: '刷新 QueryDSL',
  15351. iconCls: 'x-fa fa-refresh',
  15352. listeners: {
  15353. click: 'scope.syncQueryDSL'
  15354. }
  15355. },
  15356. {
  15357. xtype: 'button',
  15358. text: '生成 DDL',
  15359. iconCls: 'x-fa fa-file-text',
  15360. listeners: {
  15361. click: 'scope.buildDDL'
  15362. }
  15363. }
  15364. ]
  15365. },
  15366. items: [
  15367. {
  15368. region: 'center',
  15369. xtype: 'tabpanel',
  15370. items: [
  15371. {
  15372. title: '字段',
  15373. xtype: 'yvgrid',
  15374. selModel: {
  15375. type: 'spreadsheet',
  15376. columnSelect: true,
  15377. pruneRemoved: false,
  15378. extensible: 'y'
  15379. },
  15380. enableLocking: false,
  15381. idField: 'column_name',
  15382. plugins: {
  15383. clipboard: true,
  15384. selectionreplicator: true
  15385. },
  15386. reference: 'grid1',
  15387. pagination: false,
  15388. // hideFootbar: true,
  15389. tbar: {
  15390. xtype: 'form',
  15391. items: [
  15392. {
  15393. xtype: 'cols',
  15394. items: [
  15395. {
  15396. xtype: 'textfield',
  15397. fieldLabel: '表格名',
  15398. reference: 'text_table_name',
  15399. readOnly: true,
  15400. bind: {
  15401. value: '{tableInfo.table_name}'
  15402. }
  15403. },
  15404. {
  15405. xtype: 'textfield',
  15406. fieldLabel: '描述',
  15407. // readOnly: true,
  15408. bind: {
  15409. value: '{tableInfo.description}'
  15410. }
  15411. },
  15412. ]
  15413. },
  15414. {
  15415. xtype: 'toolbar',
  15416. items: [
  15417. {
  15418. xtype: 'button',
  15419. text: '添加',
  15420. iconCls: 'x-fa fa-plus-circle',
  15421. listeners: {
  15422. click: 'scope.addField'
  15423. }
  15424. },
  15425. {
  15426. xtype: 'button',
  15427. text: '删除',
  15428. iconCls: 'x-fa fa-minus-circle',
  15429. listeners: {
  15430. click: 'scope.removeField'
  15431. }
  15432. },
  15433. ]
  15434. },
  15435. ]
  15436. },
  15437. listeners: {
  15438. editbefore: 'scope.gridEditBefore'
  15439. },
  15440. columns: [
  15441. {
  15442. text: '字段名', dataIndex: 'column_name',
  15443. sortable: false,
  15444. menuDisabled: true,
  15445. width: 120,
  15446. editor: {
  15447. allowBlank: true,
  15448. selectOnFocus: false
  15449. }
  15450. },
  15451. {
  15452. text: '字段中文', dataIndex: 'column_comment',
  15453. width: 130,
  15454. sortable: false,
  15455. menuDisabled: true,
  15456. editor: {
  15457. allowBlank: true,
  15458. selectOnFocus: false
  15459. }
  15460. },
  15461. {
  15462. text: '主键', dataIndex: 'is_primary_key',
  15463. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15464. width: 48, resizable: false,
  15465. },
  15466. {
  15467. text: '必填', dataIndex: 'not_null',
  15468. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15469. width: 48, resizable: false,
  15470. },
  15471. {
  15472. text: '字段域', dataIndex: 'column_domain',
  15473. sortable: false, menuDisabled: true,
  15474. width: 148,
  15475. fix: ['system.getDict("column_domain")'],
  15476. editor: {
  15477. xtype: 'combo',
  15478. allowBlank: true,
  15479. selectOnFocus: true,
  15480. fix: ['system.getDict("column_domain")'],
  15481. listConfig: {
  15482. minWidth: 200
  15483. },
  15484. listeners: {
  15485. change: 'scope.columnDomainChange',
  15486. }
  15487. }
  15488. },
  15489. {
  15490. text: '数据类型', dataIndex: 'data_type',
  15491. sortable: false, menuDisabled: true,
  15492. editor: { allowBlank: true, selectOnFocus: true }
  15493. },
  15494. {
  15495. text: '长度', dataIndex: 'column_size',
  15496. sortable: false, menuDisabled: true,
  15497. xtype: 'numbercolumn', format: '0',
  15498. editor: { allowBlank: true, selectOnFocus: true }
  15499. },
  15500. {
  15501. text: '小数位', dataIndex: 'decimal_digits',
  15502. sortable: false, menuDisabled: true,
  15503. xtype: 'numbercolumn', format: '0',
  15504. editor: { allowBlank: true, selectOnFocus: true }
  15505. },
  15506. {
  15507. text: '默认值', dataIndex: 'default_value',
  15508. sortable: false, menuDisabled: true,
  15509. editor: { allowBlank: true, selectOnFocus: true }
  15510. },
  15511. {
  15512. text: '字典', dataIndex: 'column_dict',
  15513. sortable: false, menuDisabled: true,
  15514. // fix: ['system.getDict("DICT")'],
  15515. width: 200,
  15516. editor: {
  15517. xtype: 'combo',
  15518. allowBlank: true,
  15519. listConfig: {
  15520. minWidth: 350
  15521. },
  15522. }
  15523. },
  15524. {
  15525. text: 'UI建议', dataIndex: 'column_ui',
  15526. sortable: false, menuDisabled: true,
  15527. // fix: ['system.getDict("column_ui")'],
  15528. editor: {
  15529. xtype: 'combo',
  15530. allowBlank: true,
  15531. listConfig: {
  15532. minWidth: 200
  15533. },
  15534. }
  15535. },
  15536. {
  15537. text: '详细描述', dataIndex: 'column_note',
  15538. sortable: false, menuDisabled: true,
  15539. editor: { allowBlank: true, }
  15540. },
  15541. ]
  15542. },
  15543. {
  15544. title: '高级属性',
  15545. xtype: 'form',
  15546. items: [
  15547. // {
  15548. // xtype: 'textfield',
  15549. // fieldLabel: '表格名',
  15550. // bind: {
  15551. // value: '{tableName}'
  15552. // }
  15553. // },
  15554. // {
  15555. // xtype: 'textfield',
  15556. // fieldLabel: '中文含义',
  15557. // bind: {
  15558. // value: '{tableInfo.description}'
  15559. // }
  15560. // },
  15561. {
  15562. xtype: 'combo',
  15563. fieldLabel: '业务类型',
  15564. bind: {
  15565. value: '{tableInfo.biz_category}'
  15566. },
  15567. store: [
  15568. '基础资料',
  15569. '系统',
  15570. '账目与库存',
  15571. '单据',
  15572. '指令',
  15573. '规则与流程',
  15574. '开发辅助',
  15575. ]
  15576. },
  15577. {
  15578. xtype: 'textfield',
  15579. fieldLabel: '详细描述',
  15580. bind: {
  15581. value: '{tableInfo.note}'
  15582. },
  15583. },
  15584. {
  15585. xtype: 'checkbox',
  15586. fieldLabel: '允许归档',
  15587. bind: "{tableInfo.archive_enable}",
  15588. },
  15589. {
  15590. xtype: 'textfield',
  15591. fieldLabel: '归档周期',
  15592. bind: {
  15593. value: '{tableInfo.archive_cron}',
  15594. hidden: '{!tableInfo.archive_enable}',
  15595. }
  15596. },
  15597. {
  15598. xtype: 'textfield',
  15599. fieldLabel: '归档条件',
  15600. bind: {
  15601. value: '{tableInfo.archive_condition}',
  15602. hidden: '{!tableInfo.archive_enable}',
  15603. }
  15604. },
  15605. ]
  15606. },
  15607. ]
  15608. }
  15609. ]
  15610. },
  15611. ]
  15612. };
  15613. //# sourceMappingURL=DbColumn.view.js.map
  15614. var DbColumn = /** @class */ (function (_super) {
  15615. __extends(DbColumn, _super);
  15616. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  15617. var _this = _super.call(this, {
  15618. model: getModel(model$h, schemaName, tableName, columnName, isCreateTable),
  15619. vjson: vjson$h
  15620. }) || this;
  15621. _this.isCreate = false;
  15622. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  15623. return _this;
  15624. }
  15625. DbColumn.prototype.onLoad = function () {
  15626. var _this = this;
  15627. var _a, _b, _c, _d, _e, _f, _g, _h;
  15628. console.log('me', this);
  15629. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  15630. this.refs.grid1.autoSizeColumns();
  15631. // this.refs.grid1.columns[0].hide()
  15632. // 自动定位到选定的列
  15633. if (this.viewModel.get('column_name')) {
  15634. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  15635. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  15636. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  15637. return;
  15638. }
  15639. }
  15640. }
  15641. instance$3.getColumnDomainComboData().then(function () {
  15642. _this.checkDomain();
  15643. });
  15644. 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 : "");
  15645. 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 : "");
  15646. if (this.isCreate)
  15647. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  15648. };
  15649. DbColumn.prototype.checkDomain = function () {
  15650. // 走查一遍 domain
  15651. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15652. var dbType = this.viewModel.get('tableInfo.db_type');
  15653. var diffColumnName = [];
  15654. var tableInfo = this.viewModel.get('tableInfo');
  15655. this.refs.grid1.store.data.items.forEach(function (record) {
  15656. var data = record.data;
  15657. var column_domain = data.column_domain;
  15658. var domain = instance$3.getColumnDomainById(column_domain);
  15659. if (!domain) {
  15660. // 没有找到 domain
  15661. return;
  15662. }
  15663. var editRow = applyDomain(dbType, domain);
  15664. // 字段跟领域做对比
  15665. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  15666. if (typeof compareResult === 'string') {
  15667. // 不一样的情况下,要改成一致
  15668. _$2.forOwn(editRow, function (value, key) {
  15669. // 改成与 domain 一致
  15670. record.set(key, value);
  15671. });
  15672. diffColumnName.push(data.column_name + '.' + compareResult);
  15673. }
  15674. });
  15675. if (diffColumnName.length > 0) {
  15676. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  15677. }
  15678. };
  15679. DbColumn.prototype.addField = function () {
  15680. this.refs.grid1.appendEditRow({
  15681. column_name: '',
  15682. column_comment: '',
  15683. is_primary_key: false,
  15684. not_null: true,
  15685. column_domain: '',
  15686. data_type: '',
  15687. column_size: 0,
  15688. decimal_digits: 0,
  15689. default_value: '',
  15690. column_dict: '',
  15691. column_ui: '',
  15692. column_note: '',
  15693. }, 'column_name');
  15694. };
  15695. DbColumn.prototype.removeField = function () {
  15696. var _this = this;
  15697. var rows = [];
  15698. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  15699. rows.push(r);
  15700. });
  15701. _$2.forEach(rows, function (r) {
  15702. _this.refs.grid1.getStore().remove(r);
  15703. });
  15704. };
  15705. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  15706. instance$3.getColumnDomainComboData().then(function (data) {
  15707. editor.cmp.columns[5].getEditor().setStore({ data: data });
  15708. });
  15709. // 被字段域锁定的内容,不允许修改
  15710. var record = context.record, field = context.field;
  15711. var domainId = record.get('column_domain');
  15712. if (!domainId) {
  15713. return;
  15714. }
  15715. var domain = instance$3.getColumnDomainById(domainId);
  15716. if (!domain) {
  15717. msg$1('没有找到字段域' + domainId);
  15718. return;
  15719. }
  15720. if (field === "data_type") {
  15721. // 字段类型不允许修改
  15722. context.cancel = true;
  15723. return;
  15724. }
  15725. if (domain.is_fix_size &&
  15726. (field === "column_size" ||
  15727. field === "decimal_digits")) {
  15728. // 锁定长度的情况下,大小不允许修改
  15729. context.cancel = true;
  15730. return;
  15731. }
  15732. if (domain.is_fix_default_value && field === "default_value") {
  15733. // 锁定默认值的情况下,默认值不允许修改
  15734. context.cancel = true;
  15735. return;
  15736. }
  15737. };
  15738. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  15739. if (!newValue) {
  15740. return;
  15741. }
  15742. var grid = editor.up('grid').ownerGrid;
  15743. var domain = instance$3.getColumnDomainById(newValue);
  15744. if (!domain) {
  15745. msg$1('没有找到 domain:' + newValue);
  15746. return;
  15747. }
  15748. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15749. var dbType = this.viewModel.get('tableInfo.db_type');
  15750. var editRow = applyDomain(dbType, domain);
  15751. grid.setEditRow(editRow);
  15752. };
  15753. DbColumn.prototype.pullFromDb = function () {
  15754. };
  15755. DbColumn.prototype.pushToDb = function (sender) {
  15756. var _this = this;
  15757. // 设置当前界面为 "保存中..." 状态
  15758. var me = this;
  15759. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  15760. this.viewModel.set('tableInfo.table_name', table_name);
  15761. this.viewModel.set('tableInfo.schema_name', schema_name);
  15762. var tableInfo = this.viewModel.get('tableInfo');
  15763. var column_list = this.refs.grid1.getDataRows();
  15764. var hasError = false;
  15765. if (column_list.length <= 0) {
  15766. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  15767. hasError = true;
  15768. }
  15769. var columnNameExistsCheck = {};
  15770. _$2.forEach(column_list, function (row, i) {
  15771. var checkResult = checkColumn(tableInfo, row);
  15772. if (typeof checkResult !== 'undefined') {
  15773. msg$1(checkResult);
  15774. hasError = true;
  15775. _this.refs.grid1.beginEdit(i, 'column_name');
  15776. return false;
  15777. }
  15778. if (!row.column_domain || row.column_domain === '0') {
  15779. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  15780. hasError = true;
  15781. _this.refs.grid1.beginEdit(i, 'column_domain');
  15782. return false;
  15783. }
  15784. if (isEmpty(row.data_type)) {
  15785. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  15786. hasError = true;
  15787. _this.refs.grid1.beginEdit(i, 'data_type');
  15788. return false;
  15789. }
  15790. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  15791. // 列名已存在
  15792. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  15793. hasError = true;
  15794. _this.refs.grid1.beginEdit(i, 'column_name');
  15795. return false;
  15796. }
  15797. columnNameExistsCheck[row.column_name] = true;
  15798. });
  15799. if (hasError)
  15800. return;
  15801. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  15802. me.setLoading(true);
  15803. instance.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  15804. .then(function (res) {
  15805. var _a;
  15806. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  15807. // 返回 DDL 就要显示出来
  15808. var window_1 = Ext.create('Ext.window.Window', {
  15809. title: 'SQL 预览',
  15810. height: 400,
  15811. width: 600,
  15812. modal: true,
  15813. animateTarget: sender,
  15814. maximizable: true,
  15815. layout: 'fit',
  15816. items: {
  15817. xtype: 'sqleditor',
  15818. value: res.data.ddl
  15819. },
  15820. buttons: [
  15821. {
  15822. xtype: 'button',
  15823. text: '执行',
  15824. iconCls: 'x-fa fa-save',
  15825. handler: function (sender) {
  15826. var editor = sender.up('window').down('sqleditor');
  15827. var ddl = editor.getValue();
  15828. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  15829. }
  15830. },
  15831. {
  15832. xtype: 'button',
  15833. text: '取消',
  15834. iconCls: 'x-fa fa-times',
  15835. handler: function () {
  15836. window_1.close();
  15837. }
  15838. }
  15839. ]
  15840. }).show();
  15841. return;
  15842. }
  15843. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15844. var tableRow = instance.getTableByName(schema_name, table_name);
  15845. if (!tableRow) {
  15846. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15847. console.log('这是一个新 table');
  15848. instance.appendNewTable(tableInfo);
  15849. }
  15850. _this.viewModel.set('schema_name', schema_name);
  15851. _this.viewModel.set('table_name', table_name);
  15852. _this.viewModel.set('tableInfo', tableInfo);
  15853. _this.refs.grid1.setData(tableInfo.column_list);
  15854. if (tableRow)
  15855. Object.assign(tableRow, tableInfo);
  15856. msg$1('保存成功');
  15857. _this.viewModel.set('hasChanged', false);
  15858. })
  15859. .finally(function () {
  15860. me.setLoading(false);
  15861. });
  15862. };
  15863. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  15864. var _this = this;
  15865. window.setLoading(true);
  15866. instance.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  15867. .then(function (res) {
  15868. var _a, _b, _c, _d;
  15869. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15870. // 保存成功就提示一下,并重新载入数据
  15871. msg$1(res.msg);
  15872. instance.reloadForce(undefined);
  15873. var tableRow = instance.getTableByName(schema_name, table_name);
  15874. if (!tableRow) {
  15875. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15876. console.log('这是一个新 table');
  15877. instance.appendNewTable(tableInfo);
  15878. }
  15879. _this.viewModel.set('schema_name', schema_name);
  15880. _this.viewModel.set('table_name', table_name);
  15881. _this.viewModel.set('tableInfo', tableInfo);
  15882. _this.refs.grid1.setData(tableInfo.column_list);
  15883. if (tableRow)
  15884. Object.assign(tableRow, tableInfo);
  15885. instance.notifyRefresh();
  15886. window.close();
  15887. _this.viewModel.set('hasChanged', false);
  15888. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  15889. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  15890. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  15891. })
  15892. .finally(function () {
  15893. // 无论正常异常,关闭 "保存中..." 状态
  15894. window.setLoading(false);
  15895. });
  15896. };
  15897. DbColumn.prototype.syncQueryDSL = function () {
  15898. var _this = this;
  15899. var tableInfo = this.viewModel.get("tableInfo");
  15900. this.setLoading(true);
  15901. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  15902. .then(function () {
  15903. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  15904. })
  15905. .finally(function () {
  15906. _this.setLoading(false);
  15907. });
  15908. };
  15909. DbColumn.prototype.buildDDL = function () {
  15910. };
  15911. return DbColumn;
  15912. }(Scope));
  15913. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  15914. model.data.schema_name = schemaName;
  15915. model.data.table_name = tableName;
  15916. model.data.column_name = columnName;
  15917. if (isCreateTable) {
  15918. var dbType = instance.getSchemaDbType(schemaName);
  15919. if (!dbType) {
  15920. throw Error('无法识别数据库类型' + schemaName);
  15921. }
  15922. model.data.tableInfo.schema_name = model.data.schema_name;
  15923. model.data.tableInfo.table_name = model.data.table_name;
  15924. model.data.tableInfo.db_type = dbType;
  15925. model.data.tableInfo.column_list = [];
  15926. model.data.tableInfo.is_create = true;
  15927. return model;
  15928. }
  15929. var tableRow = instance.getTableByName(schemaName, tableName);
  15930. if (!tableRow) {
  15931. throw Error('没有找到 table' + schemaName + tableName + columnName);
  15932. }
  15933. model.data.tableInfo = _$2.cloneDeep(tableRow);
  15934. model.data.tableInfo.is_create = false;
  15935. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  15936. return model;
  15937. }
  15938. //# sourceMappingURL=DbColumn.js.map
  15939. var model$i = {
  15940. data: {
  15941. id: '',
  15942. path: '',
  15943. form: {
  15944. title: '',
  15945. sqlId: '',
  15946. }
  15947. }
  15948. };
  15949. //# sourceMappingURL=WidgetDesign.model.js.map
  15950. var vjson$i = {
  15951. bind: {
  15952. title: '{title}',
  15953. },
  15954. layout: 'fit',
  15955. items: [
  15956. {
  15957. layout: 'border',
  15958. items: [
  15959. {
  15960. region: 'center',
  15961. layout: 'border',
  15962. items: [
  15963. {
  15964. region: 'north',
  15965. items: [
  15966. {
  15967. xtype: 'toolbar',
  15968. border: false,
  15969. items: [
  15970. {
  15971. xtype: 'button',
  15972. text: '刷新',
  15973. iconCls: 'x-fa fa-refresh',
  15974. listeners: {
  15975. click: 'scope.load'
  15976. }
  15977. },
  15978. {
  15979. xtype: 'button',
  15980. text: '保存',
  15981. iconCls: 'x-fa fa-save',
  15982. listeners: {
  15983. click: 'scope.widgetSave'
  15984. }
  15985. },
  15986. {
  15987. xtype: 'button',
  15988. text: '预览',
  15989. iconCls: 'x-fa fa-play-circle-o',
  15990. listeners: {
  15991. //click: 'scope.preview'
  15992. }
  15993. },
  15994. {
  15995. xtype: 'textfield',
  15996. fieldLabel: '弹窗文件',
  15997. reference: "wPath",
  15998. labelWidth: 80,
  15999. //width: 200,
  16000. bind: {
  16001. value: '{widgetPath}',
  16002. },
  16003. readOnly: true,
  16004. },
  16005. {
  16006. xtype: 'textfield',
  16007. fieldLabel: '弹窗名称',
  16008. reference: "wTitle",
  16009. labelWidth: 80,
  16010. //width: 200,
  16011. bind: {
  16012. value: '{form.title}',
  16013. },
  16014. readOnly: true,
  16015. },
  16016. {
  16017. xtype: 'textfield',
  16018. fieldLabel: 'sqlId',
  16019. bind: {
  16020. value: '{form.sqlId}',
  16021. },
  16022. readOnly: true,
  16023. },
  16024. ]
  16025. },
  16026. ]
  16027. },
  16028. {
  16029. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  16030. items: [
  16031. {
  16032. title: "SQL和条件",
  16033. layout: 'border',
  16034. border: false,
  16035. items: [
  16036. {
  16037. region: 'north',
  16038. height: 200,
  16039. xtype: 'yvgrid',
  16040. reference: "grid2",
  16041. split: true,
  16042. selModel: {
  16043. selType: 'rowmodel',
  16044. mode: 'SINGLE',
  16045. },
  16046. store: {},
  16047. pagination: false,
  16048. hideFootbar: true,
  16049. tbar: {
  16050. xtype: 'toolbar',
  16051. items: [
  16052. {
  16053. xtype: 'button',
  16054. text: '添加',
  16055. iconCls: 'x-fa fa-plus-circle',
  16056. listeners: {}
  16057. },
  16058. {
  16059. xtype: 'button',
  16060. text: '删除',
  16061. iconCls: 'x-fa fa-minus-circle',
  16062. listeners: {
  16063. click: 'scope.delCondition'
  16064. }
  16065. },
  16066. '-',
  16067. {
  16068. xtype: 'button',
  16069. text: '上移',
  16070. iconCls: 'x-fa fa-refresh',
  16071. listeners: {
  16072. //click: 'scope.saveAll'
  16073. }
  16074. },
  16075. {
  16076. xtype: 'button',
  16077. text: '下移',
  16078. iconCls: 'x-fa fa-refresh',
  16079. listeners: {
  16080. //click: 'scope.saveAll'
  16081. }
  16082. },
  16083. '-',
  16084. {
  16085. xtype: 'button',
  16086. text: '自动分析',
  16087. iconCls: 'x-fa fa-refresh',
  16088. listeners: {
  16089. click: 'scope.calcCondition'
  16090. }
  16091. },
  16092. ]
  16093. },
  16094. columns: [
  16095. {
  16096. text: '条件变量',
  16097. dataIndex: 'conditionFieldBind',
  16098. width: 140,
  16099. sortable: false,
  16100. menuDisabled: true,
  16101. editor: {
  16102. selectOnFocus: true
  16103. },
  16104. },
  16105. {
  16106. text: '中文标题',
  16107. dataIndex: 'conditionFieldLabel',
  16108. width: 120,
  16109. sortable: false,
  16110. menuDisabled: true,
  16111. editor: {
  16112. selectOnFocus: true
  16113. },
  16114. },
  16115. {
  16116. text: '编辑类型',
  16117. dataIndex: 'xtype',
  16118. sortable: false,
  16119. menuDisabled: true,
  16120. editor: {
  16121. xtype: 'combo',
  16122. typeAhead: true,
  16123. triggerAction: 'all',
  16124. selectOnFocus: true,
  16125. store: [
  16126. ['textfield', 'textfield'],
  16127. ['combo', 'combo'],
  16128. ['datefield', 'datefield'],
  16129. ['datetimefield', 'datetimefield'],
  16130. ['numberfield', 'numberfield'],
  16131. ['multiplesearch', 'multiplesearch'],
  16132. ]
  16133. }
  16134. },
  16135. {
  16136. text: '权重',
  16137. dataIndex: 'conditionFieldFlex',
  16138. align: 'right',
  16139. sortable: false,
  16140. menuDisabled: true,
  16141. editor: {
  16142. xtype: 'numberfield',
  16143. selectOnFocus: false,
  16144. minValue: 0,
  16145. maxValue: 10
  16146. },
  16147. },
  16148. {
  16149. text: '字典',
  16150. dataIndex: 'conditionFieldDict',
  16151. width: 160,
  16152. sortable: false,
  16153. menuDisabled: true,
  16154. editor: {
  16155. selectOnFocus: false
  16156. },
  16157. },
  16158. {
  16159. xtype: 'checkcolumn',
  16160. dataIndex: "conditionFieldWrap", header: "换行",
  16161. width: 65,
  16162. sortable: false,
  16163. menuDisabled: true,
  16164. },
  16165. ]
  16166. },
  16167. {
  16168. region: 'center',
  16169. xtype: 'sqleditor',
  16170. layout: 'fit',
  16171. reference: 'sqlEditor',
  16172. split: true,
  16173. bind: {
  16174. value: "{form.sql}"
  16175. },
  16176. },
  16177. ]
  16178. },
  16179. {
  16180. title: "结果字段定义",
  16181. border: false,
  16182. xtype: 'yvgrid',
  16183. reference: "grid3",
  16184. selModel: {
  16185. selType: 'rowmodel',
  16186. mode: 'SINGLE',
  16187. },
  16188. store: {},
  16189. pagination: false,
  16190. hideFootbar: true,
  16191. tbar: {
  16192. xtype: 'toolbar',
  16193. items: [
  16194. {
  16195. xtype: 'button',
  16196. text: '添加',
  16197. iconCls: 'x-fa fa-plus-circle',
  16198. listeners: {}
  16199. },
  16200. {
  16201. xtype: 'button',
  16202. text: '删除',
  16203. iconCls: 'x-fa fa-minus-circle',
  16204. listeners: {
  16205. click: 'scope.delColumn'
  16206. }
  16207. },
  16208. '-',
  16209. {
  16210. xtype: 'button',
  16211. text: '上移',
  16212. iconCls: 'x-fa fa-refresh',
  16213. listeners: {
  16214. //click: 'scope.saveAll'
  16215. }
  16216. },
  16217. {
  16218. xtype: 'button',
  16219. text: '下移',
  16220. iconCls: 'x-fa fa-refresh',
  16221. listeners: {
  16222. //click: 'scope.saveAll'
  16223. }
  16224. },
  16225. '-',
  16226. {
  16227. xtype: 'button',
  16228. text: '自动分析',
  16229. iconCls: 'x-fa fa-refresh',
  16230. listeners: {
  16231. click: 'scope.calcColumn'
  16232. }
  16233. },
  16234. ]
  16235. },
  16236. columns: [
  16237. { xtype: 'rownumberer' },
  16238. {
  16239. text: '字段',
  16240. dataIndex: 'dataIndex',
  16241. width: 140,
  16242. sortable: false,
  16243. menuDisabled: true,
  16244. editor: {
  16245. selectOnFocus: true
  16246. },
  16247. },
  16248. {
  16249. text: '标题',
  16250. dataIndex: 'header',
  16251. width: 120,
  16252. sortable: false,
  16253. menuDisabled: true,
  16254. editor: {
  16255. selectOnFocus: true
  16256. },
  16257. },
  16258. {
  16259. text: '显示类型',
  16260. dataIndex: 'xtype',
  16261. width: 90,
  16262. sortable: false,
  16263. menuDisabled: true,
  16264. editor: {
  16265. xtype: 'combo',
  16266. typeAhead: true,
  16267. triggerAction: 'all',
  16268. selectOnFocus: true,
  16269. store: [
  16270. ['', ''],
  16271. ['rownum', 'rownum'],
  16272. ['button', 'button'],
  16273. ['checkbox', 'checkbox'],
  16274. ['progres', 'progres'],
  16275. ]
  16276. }
  16277. },
  16278. {
  16279. text: '数据类型',
  16280. dataIndex: 'dataType',
  16281. width: 90,
  16282. sortable: false,
  16283. menuDisabled: true,
  16284. editor: {
  16285. xtype: 'combo',
  16286. typeAhead: true,
  16287. triggerAction: 'all',
  16288. selectOnFocus: true,
  16289. store: [
  16290. ['', ''],
  16291. ['string', 'string'],
  16292. ['number', 'number'],
  16293. ['date', 'date'],
  16294. ]
  16295. }
  16296. },
  16297. {
  16298. text: '数据字典',
  16299. dataIndex: 'dict',
  16300. sortable: false,
  16301. menuDisabled: true,
  16302. width: 120,
  16303. editor: {
  16304. selectOnFocus: true,
  16305. },
  16306. },
  16307. ],
  16308. },
  16309. ]
  16310. },
  16311. ]
  16312. },
  16313. ]
  16314. }
  16315. ]
  16316. }; //
  16317. //
  16318. //# sourceMappingURL=WidgetDesign.view.js.map
  16319. var WidgetDesign = /** @class */ (function (_super) {
  16320. __extends(WidgetDesign, _super);
  16321. function WidgetDesign(widgetPath, widgetName) {
  16322. var _this = _super.call(this, { model: model$i, vjson: vjson$i }) || this;
  16323. _this.widgetPath = widgetPath;
  16324. _this.widgetName = widgetName;
  16325. return _this;
  16326. }
  16327. WidgetDesign.prototype.onLoad = function () {
  16328. if (this.widgetPath) {
  16329. this.loadForm(this.widgetPath);
  16330. this.viewModel.set("widgetPath", this.widgetPath);
  16331. this.refs.wTitle.setReadOnly(true);
  16332. this.refs.wPath.setReadOnly(true);
  16333. }
  16334. else {
  16335. this.refs.wTitle.setReadOnly(false);
  16336. this.refs.wPath.setReadOnly(false);
  16337. }
  16338. };
  16339. WidgetDesign.prototype.load = function () {
  16340. var widgetPath = this.viewModel.get("widgetPath");
  16341. if (widgetPath) {
  16342. this.loadForm(widgetPath);
  16343. }
  16344. };
  16345. WidgetDesign.prototype.loadForm = function (widgetPath) {
  16346. var _this = this;
  16347. var me = this;
  16348. me.setLoading(true);
  16349. readWidget({ widgetPath: widgetPath }).then(function (res) {
  16350. msg$1(res.msg);
  16351. if (res.success) {
  16352. _this.viewModel.set("widgetPath", widgetPath);
  16353. me.refs.grid3.getStore().removeAll();
  16354. if (res.data.form.columns) {
  16355. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  16356. }
  16357. _this.viewModel.set("form.title", res.data.form.title);
  16358. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  16359. // set sql
  16360. _this.refs.sqlEditor.setCode(res.data.sql);
  16361. }
  16362. }).finally(function () {
  16363. me.setLoading(false);
  16364. });
  16365. };
  16366. WidgetDesign.prototype.widgetAdd = function (sender) {
  16367. var _this = this;
  16368. var title = this.viewModel.get("form.title");
  16369. if (title) {
  16370. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  16371. if (btn == 'yes') {
  16372. alert(1);
  16373. }
  16374. else {
  16375. alert(2);
  16376. }
  16377. });
  16378. }
  16379. else {
  16380. var me_1 = this;
  16381. var win_1 = new Ext.Window({
  16382. autoDestroy: true,
  16383. title: "新建弹框",
  16384. width: 400,
  16385. height: 220,
  16386. resizable: true,
  16387. closable: true,
  16388. maximizable: true,
  16389. minimizable: true,
  16390. plain: true,
  16391. // constrainHeader: true,
  16392. constrain: true,
  16393. layout: 'fit',
  16394. animateTarget: sender,
  16395. buttonAlign: 'center',
  16396. items: [
  16397. {
  16398. xtype: "form",
  16399. layout: "hbox",
  16400. margin: '10px 20px',
  16401. border: 0,
  16402. items: [
  16403. {
  16404. flex: 1,
  16405. layout: 'vbox',
  16406. items: [
  16407. {
  16408. xtype: "textfield",
  16409. name: "widgetcode",
  16410. fieldLabel: "弹框编号",
  16411. flex: 1,
  16412. allowBlank: false,
  16413. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  16414. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  16415. labelWidth: 50,
  16416. width: "100%",
  16417. },
  16418. {
  16419. xtype: "textfield",
  16420. name: "widgetname",
  16421. fieldLabel: "弹框名称",
  16422. flex: 1,
  16423. allowBlank: false,
  16424. labelWidth: 50,
  16425. width: "100%",
  16426. },
  16427. ]
  16428. },
  16429. ]
  16430. }
  16431. ],
  16432. //窗口按钮
  16433. buttons: [
  16434. {
  16435. xtype: 'button', text: '保存', handler: function (btn) {
  16436. //窗口获取表单
  16437. var form = win_1.down('form');
  16438. var vaildSuccess = form.isValid();
  16439. if (!vaildSuccess) {
  16440. return;
  16441. }
  16442. var title = form.down('textfield[name="widgetname"]').getValue();
  16443. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  16444. me_1.viewModel.set("form.title", title);
  16445. me_1.viewModel.set("widgetPath", widgetPath);
  16446. var formdata = _this.viewModel.get("form");
  16447. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  16448. if (res.success) {
  16449. msg$1('添加成功');
  16450. }
  16451. me_1.loadForm(widgetPath);
  16452. win_1.close();
  16453. });
  16454. }
  16455. },
  16456. {
  16457. xtype: 'button', text: '取消', handler: function (btn) {
  16458. //窗口关闭
  16459. win_1.close();
  16460. }
  16461. }
  16462. ]
  16463. });
  16464. win_1.show();
  16465. }
  16466. };
  16467. WidgetDesign.prototype.widgetSave = function () {
  16468. var _this = this;
  16469. var _a, _b;
  16470. var widgetPath = this.viewModel.get("widgetPath");
  16471. if (!widgetPath) {
  16472. msg$1("请选择或添加弹框后再保存!");
  16473. return;
  16474. }
  16475. var title = this.viewModel.get("form.title");
  16476. if (!title) {
  16477. msg$1("请选择或添加弹框后再保存!");
  16478. return;
  16479. }
  16480. // 获取条件
  16481. 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) {
  16482. delete r.id;
  16483. return r;
  16484. });
  16485. this.viewModel.set("form.conditions", conditions);
  16486. // 获取查询列
  16487. 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) {
  16488. delete r.id;
  16489. if (r.dict) {
  16490. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  16491. }
  16492. return r;
  16493. });
  16494. this.viewModel.set("form.columns", columns);
  16495. // sql
  16496. var sql = this.refs.sqlEditor.getCode();
  16497. this.viewModel.set("form.sql", sql);
  16498. var form = this.viewModel.get("form");
  16499. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  16500. msg$1(res.msg);
  16501. if (res.success) {
  16502. msg$1('保存成功');
  16503. _this.loadForm(widgetPath);
  16504. }
  16505. }).catch(function (res) {
  16506. });
  16507. };
  16508. WidgetDesign.prototype.delCondition = function () {
  16509. var _a;
  16510. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16511. };
  16512. WidgetDesign.prototype.delColumn = function () {
  16513. var _a;
  16514. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16515. };
  16516. WidgetDesign.prototype.calcCondition = function () {
  16517. var _this = this;
  16518. var sql = this.refs.sqlEditor.getCode();
  16519. var re = sql.matchAll(/#{(.+?)}/gi);
  16520. var rows = this.refs.grid2.getDataRows();
  16521. this.refs.grid2.setLoading(true);
  16522. parseDynamicSqlApi(sql).then(function (res) {
  16523. var e_1, _a;
  16524. if (res.success) {
  16525. var tables_1 = [];
  16526. _.forEach(res.data, function (parseItem) {
  16527. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  16528. if (tableName && !_.includes(tables_1, tableName)) {
  16529. tables_1.push(tableName);
  16530. }
  16531. });
  16532. var _loop_1 = function (m) {
  16533. var e_2, _a;
  16534. var columnName = m[1];
  16535. // 没有这个列才添加
  16536. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  16537. var meta = undefined;
  16538. try {
  16539. 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()) {
  16540. var tableName = tables_2_1.value;
  16541. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16542. if (meta) {
  16543. break;
  16544. }
  16545. }
  16546. }
  16547. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  16548. finally {
  16549. try {
  16550. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  16551. }
  16552. finally { if (e_2) throw e_2.error; }
  16553. }
  16554. if (meta) {
  16555. // 没找到元数据,直接添加
  16556. _this.refs.grid2.appendEditRow({
  16557. conditionFieldBind: columnName,
  16558. conditionFieldLabel: meta.column_comment,
  16559. conditionFieldXtype: 'textfield',
  16560. conditionFieldFlex: 1,
  16561. conditionFieldDict: '',
  16562. conditionFieldWrap: false,
  16563. });
  16564. }
  16565. else {
  16566. _this.refs.grid2.appendEditRow({
  16567. conditionFieldBind: columnName,
  16568. conditionFieldLabel: '',
  16569. conditionFieldXtype: 'textfield',
  16570. conditionFieldFlex: 1,
  16571. conditionFieldDict: '',
  16572. conditionFieldWrap: false,
  16573. });
  16574. }
  16575. }
  16576. };
  16577. try {
  16578. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  16579. var m = re_1_1.value;
  16580. _loop_1(m);
  16581. }
  16582. }
  16583. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  16584. finally {
  16585. try {
  16586. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  16587. }
  16588. finally { if (e_1) throw e_1.error; }
  16589. }
  16590. }
  16591. }).finally(function () {
  16592. _this.refs.grid2.setLoading(false);
  16593. });
  16594. };
  16595. WidgetDesign.prototype.calcColumn = function () {
  16596. var _this = this;
  16597. var sql = this.refs.sqlEditor.getCode();
  16598. var rows = this.refs.grid3.getDataRows();
  16599. this.refs.grid3.setLoading(true);
  16600. parseDynamicSqlApi(sql).then(function (res) {
  16601. _.forEach(res.data, function (parseItem) {
  16602. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  16603. // 是否找到重复字段
  16604. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  16605. if (exists) {
  16606. return;
  16607. }
  16608. if (tableName) {
  16609. // 解出表格名和字段名
  16610. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16611. if (meta) {
  16612. // 找到了元数据
  16613. var r = {
  16614. dataIndex: meta.column_name,
  16615. header: meta.column_comment,
  16616. xtype: '',
  16617. dataType: 'string',
  16618. dict: '',
  16619. };
  16620. if (meta.column_ui === 'combo' && meta.column_dict) {
  16621. r.dict = meta.column_dict;
  16622. }
  16623. else if (meta.column_ui === "checkbox") {
  16624. r.xtype = 'checkbox';
  16625. }
  16626. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  16627. r.dataType = meta.data_type;
  16628. }
  16629. _this.refs.grid3.appendEditRow(r);
  16630. return;
  16631. }
  16632. }
  16633. if (columnName) {
  16634. // 解出字段名
  16635. var r = {
  16636. dataIndex: columnName,
  16637. header: columnName,
  16638. xtype: '',
  16639. dataType: 'string',
  16640. dict: '',
  16641. };
  16642. _this.refs.grid3.appendEditRow(r);
  16643. }
  16644. });
  16645. }).finally(function () {
  16646. _this.refs.grid3.setLoading(false);
  16647. });
  16648. };
  16649. return WidgetDesign;
  16650. }(Scope));
  16651. //# sourceMappingURL=WidgetDesign.js.map
  16652. var model$j = {
  16653. data: {
  16654. // spreadsheet: false,
  16655. // multSelect: false,
  16656. // showCheckColumn: false,
  16657. // checkColumncheckOnly: false,
  16658. // disableSelection: false,
  16659. vjson: {
  16660. reference: '',
  16661. pagination: false,
  16662. pageSize: false,
  16663. pageSizeOption: false,
  16664. hideFootbar: false,
  16665. hideRefresh: false,
  16666. hideExport: false,
  16667. hideAutoSize: false,
  16668. hideClearFilter: false,
  16669. hideSaveGridUIConfig: false,
  16670. hideClearGridUIConfig: false,
  16671. selectMode: '',
  16672. cellediting_clicksToEdit: 1,
  16673. columnLines: false,
  16674. rowLines: false,
  16675. border: false,
  16676. autoLoad: false,
  16677. remoteSort: false,
  16678. remoteFilter: false,
  16679. enableLocking: false,
  16680. enableColumnHide: false,
  16681. enableColumnMove: false,
  16682. gridfilters: false,
  16683. enableColumnResize: false,
  16684. sortOnClick: false,
  16685. hidden: false,
  16686. cls: '',
  16687. dataSource: {
  16688. url: '',
  16689. params: {
  16690. formData: '{form}',
  16691. },
  16692. },
  16693. listeners: {
  16694. beforeselect: '',
  16695. selectionchange: '',
  16696. itemclick: '',
  16697. itemdblclick: '',
  16698. cellClick: '',
  16699. celldblclick: '',
  16700. afterrender: '',
  16701. destory: '',
  16702. }
  16703. },
  16704. }
  16705. };
  16706. //# sourceMappingURL=YvgridDesign.model.js.map
  16707. var vjson$j = {
  16708. title: '表格-高级',
  16709. height: 450,
  16710. width: 970,
  16711. layout: 'fit',
  16712. modal: true,
  16713. items: [
  16714. {
  16715. xtype: 'tabpanel',
  16716. items: [
  16717. {
  16718. title: '属性',
  16719. xtype: 'form',
  16720. scrollable: true,
  16721. items: [
  16722. {
  16723. xtype: 'cols',
  16724. items: [
  16725. {
  16726. xtype: 'textfield',
  16727. fieldLabel: '引用名',
  16728. tooltip: 'reference',
  16729. bind: '{vjson.reference}',
  16730. },
  16731. ]
  16732. },
  16733. {
  16734. xtype: 'cols',
  16735. border: false,
  16736. items: [
  16737. // 允许分页、页大小、页大小选项
  16738. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  16739. // 多选、显示勾选、自动勾选、
  16740. // 单击编辑、列分割线、行分割线、边框
  16741. // 数据源自动加载、后端排序、后端过滤
  16742. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  16743. {
  16744. xtype: 'checkbox',
  16745. fieldLabel: '允许分页',
  16746. bind: {
  16747. value: "{vjson.pagination}"
  16748. }
  16749. },
  16750. {
  16751. xtype: 'numberfield',
  16752. fieldLabel: '页大小',
  16753. bind: '{vjson.pageSize}',
  16754. },
  16755. {
  16756. xtype: 'textfield',
  16757. fieldLabel: '页大小选项',
  16758. flex: 2,
  16759. bind: '{vjson.pageSizeOption}',
  16760. },
  16761. ]
  16762. },
  16763. {
  16764. layout: 'hbox',
  16765. border: false,
  16766. items: [
  16767. {
  16768. xtype: 'combo',
  16769. fieldLabel: '选择模式',
  16770. flex: 4,
  16771. data: [
  16772. { id: 'spreadsheet', text: 'Excel模式' },
  16773. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  16774. { id: 'checkColumn', text: '勾选框' },
  16775. { id: 'row_mulity', text: '行选择-允许多选' },
  16776. { id: 'row_single', text: '行选择-单选' },
  16777. { id: 'disableSelection', text: '禁用' },
  16778. ],
  16779. bind: {
  16780. value: '{vjson.selectMode}'
  16781. }
  16782. }
  16783. ]
  16784. },
  16785. {
  16786. layout: 'hbox',
  16787. border: false,
  16788. defaults: {
  16789. xtype: 'checkbox',
  16790. margin: '0 15 0 0',
  16791. },
  16792. items: [
  16793. {
  16794. xtype: 'container',
  16795. margin: '3',
  16796. border: false,
  16797. width: 80,
  16798. },
  16799. {
  16800. boxLabel: '隐藏底部',
  16801. bind: {
  16802. value: "{vjson.hideFootbar}"
  16803. }
  16804. },
  16805. {
  16806. boxLabel: '隐藏刷新',
  16807. bind: {
  16808. value: "{vjson.hideRefresh}"
  16809. }
  16810. },
  16811. {
  16812. boxLabel: '隐藏导出',
  16813. bind: {
  16814. value: "{vjson.hideExport}"
  16815. }
  16816. },
  16817. {
  16818. boxLabel: '隐藏自动调宽',
  16819. bind: {
  16820. value: "{vjson.hideAutoSize}"
  16821. }
  16822. },
  16823. {
  16824. boxLabel: '隐藏清空筛选',
  16825. bind: {
  16826. value: "{vjson.hideClearFilter}"
  16827. }
  16828. },
  16829. {
  16830. boxLabel: '隐藏保存布局',
  16831. bind: {
  16832. value: "{vjson.hideSaveGridUIConfig}"
  16833. }
  16834. },
  16835. {
  16836. boxLabel: '隐藏重置布局',
  16837. bind: {
  16838. value: "{vjson.hideClearGridUIConfig}"
  16839. }
  16840. },
  16841. ]
  16842. },
  16843. {
  16844. layout: 'hbox',
  16845. border: false,
  16846. defaults: {
  16847. xtype: 'checkbox',
  16848. margin: '0 15 0 0',
  16849. },
  16850. items: [
  16851. {
  16852. xtype: 'container',
  16853. margin: '3',
  16854. border: false,
  16855. width: 80
  16856. },
  16857. {
  16858. boxLabel: '单击编辑',
  16859. bind: {
  16860. value: "{vjson.cellediting_clicksToEdit}"
  16861. }
  16862. },
  16863. {
  16864. boxLabel: '列分隔线',
  16865. bind: {
  16866. value: "{vjson.columnLines}"
  16867. }
  16868. },
  16869. {
  16870. boxLabel: '行分隔线',
  16871. bind: {
  16872. value: "{vjson.rowLines}"
  16873. }
  16874. },
  16875. {
  16876. boxLabel: '边框',
  16877. bind: {
  16878. value: "{vjson.border}"
  16879. }
  16880. },
  16881. ]
  16882. },
  16883. {
  16884. layout: 'hbox',
  16885. border: false,
  16886. defaults: {
  16887. xtype: 'checkbox',
  16888. margin: '0 15 0 0',
  16889. },
  16890. items: [
  16891. {
  16892. xtype: 'container',
  16893. margin: '3',
  16894. border: false,
  16895. width: 80
  16896. },
  16897. {
  16898. boxLabel: '数据源自动加载',
  16899. bind: {
  16900. value: "{vjson.autoLoad}"
  16901. }
  16902. },
  16903. {
  16904. boxLabel: '后端排序',
  16905. bind: {
  16906. value: "{vjson.remoteSort}"
  16907. }
  16908. },
  16909. {
  16910. boxLabel: '后端过滤',
  16911. bind: {
  16912. value: "{vjson.remoteFilter}"
  16913. }
  16914. },
  16915. ]
  16916. },
  16917. {
  16918. layout: 'hbox',
  16919. border: false,
  16920. defaults: {
  16921. xtype: 'checkbox',
  16922. margin: '0 15 0 0',
  16923. },
  16924. items: [
  16925. {
  16926. xtype: 'container',
  16927. margin: '3',
  16928. border: false,
  16929. width: 80
  16930. },
  16931. {
  16932. boxLabel: '自定义锁定',
  16933. bind: {
  16934. value: "{vjson.enableLocking}"
  16935. }
  16936. },
  16937. {
  16938. boxLabel: '自定义隐藏',
  16939. bind: {
  16940. value: "{vjson.enableColumnHide}"
  16941. }
  16942. },
  16943. {
  16944. boxLabel: '用户拖拽字段',
  16945. bind: {
  16946. value: "{vjson.enableColumnMove}"
  16947. }
  16948. },
  16949. {
  16950. boxLabel: '自定义筛选',
  16951. bind: {
  16952. value: "{vjson.gridfilters}"
  16953. }
  16954. },
  16955. {
  16956. boxLabel: '用户拖拽字段宽度',
  16957. bind: {
  16958. value: "{vjson.enableColumnResize}"
  16959. }
  16960. },
  16961. {
  16962. boxLabel: '点击列头排序',
  16963. bind: {
  16964. value: "{vjson.sortOnClick}"
  16965. }
  16966. },
  16967. {
  16968. xtype: 'checkbox',
  16969. boxLabel: '隐藏',
  16970. bind: {
  16971. value: "{vjson.hidden}"
  16972. }
  16973. },
  16974. ]
  16975. },
  16976. {
  16977. xtype: 'cols',
  16978. items: [
  16979. {
  16980. xtype: 'textfield',
  16981. fieldLabel: '样式',
  16982. bind: '{vjson.cls}',
  16983. flex: 4
  16984. },
  16985. ]
  16986. },
  16987. ]
  16988. },
  16989. {
  16990. title: '字段',
  16991. xtype: 'yvgrid',
  16992. reference: 'grid1',
  16993. pagination: false,
  16994. hideFootbar: true,
  16995. plugins: {
  16996. clipboard: true,
  16997. selectionreplicator: true
  16998. },
  16999. selModel: {
  17000. type: 'spreadsheet',
  17001. columnSelect: true,
  17002. pruneRemoved: false,
  17003. extensible: 'y'
  17004. },
  17005. listeners: {
  17006. editfinish: 'scope.gridEditFinish',
  17007. },
  17008. tbar: {
  17009. xtype: 'toolbar',
  17010. items: [
  17011. {
  17012. xtype: 'button',
  17013. text: '添加',
  17014. iconCls: 'x-fa fa-plus-circle',
  17015. listeners: {
  17016. click: 'scope.addColumn'
  17017. }
  17018. },
  17019. {
  17020. xtype: 'button',
  17021. text: '删除',
  17022. iconCls: 'x-fa fa-minus-circle',
  17023. listeners: {
  17024. click: 'scope.removeColumn'
  17025. }
  17026. },
  17027. '-',
  17028. {
  17029. xtype: 'button',
  17030. text: '自动分析',
  17031. iconCls: 'x-fa fa-code-fork',
  17032. listeners: {
  17033. click: 'scope.calcColumn'
  17034. }
  17035. },
  17036. {
  17037. xtype: 'button',
  17038. text: '上移',
  17039. iconCls: 'x-fa fa-arrow-up',
  17040. listeners: {
  17041. click: 'scope.moveUp'
  17042. }
  17043. },
  17044. {
  17045. xtype: 'button',
  17046. text: '下移',
  17047. iconCls: 'x-fa fa-arrow-down',
  17048. listeners: {
  17049. click: 'scope.moveDown'
  17050. }
  17051. },
  17052. ]
  17053. },
  17054. columns: [
  17055. { xtype: 'rownumberer' },
  17056. {
  17057. text: '字段',
  17058. dataIndex: 'dataIndex',
  17059. width: 140,
  17060. sortable: false,
  17061. menuDisabled: true,
  17062. editor: {
  17063. selectOnFocus: true,
  17064. },
  17065. },
  17066. {
  17067. text: '标题',
  17068. dataIndex: 'header',
  17069. width: 120,
  17070. sortable: false,
  17071. menuDisabled: true,
  17072. editor: {
  17073. selectOnFocus: true,
  17074. },
  17075. },
  17076. {
  17077. text: '类型',
  17078. dataIndex: 'xtype',
  17079. width: 100,
  17080. sortable: false,
  17081. menuDisabled: true,
  17082. editor: {
  17083. xtype: 'combo',
  17084. typeAhead: true,
  17085. triggerAction: 'all',
  17086. selectOnFocus: false,
  17087. listConfig: {
  17088. minWidth: 200
  17089. },
  17090. store: [
  17091. ['', '默认'],
  17092. ['rownum', 'rownum'],
  17093. ['checkcolumn', 'checkcolumn'],
  17094. ]
  17095. },
  17096. },
  17097. {
  17098. text: '数据类型',
  17099. dataIndex: 'dataType',
  17100. width: 100,
  17101. sortable: false,
  17102. menuDisabled: true,
  17103. editor: {
  17104. xtype: 'combo',
  17105. selectOnFocus: true,
  17106. listConfig: {
  17107. minWidth: 200
  17108. },
  17109. store: [
  17110. ['', '默认'],
  17111. ['string', 'string'],
  17112. ['number', 'number'],
  17113. ['date', 'date'],
  17114. ]
  17115. },
  17116. },
  17117. {
  17118. text: '编辑模式',
  17119. dataIndex: 'editor',
  17120. width: 100,
  17121. sortable: false,
  17122. menuDisabled: true,
  17123. editor: {
  17124. xtype: 'combo',
  17125. selectOnFocus: true,
  17126. listConfig: {
  17127. minWidth: 200
  17128. },
  17129. store: [
  17130. ['', ''],
  17131. ['textfield', 'textfield'],
  17132. ['numberfield', 'numberfield'],
  17133. ['combo', 'combo'],
  17134. ['combogrid', 'combogrid'],
  17135. ['datefield', 'datefield'],
  17136. ]
  17137. },
  17138. },
  17139. {
  17140. text: '宽度',
  17141. dataIndex: 'width',
  17142. align: 'right',
  17143. width: 100,
  17144. sortable: false,
  17145. menuDisabled: true,
  17146. editor: {
  17147. xtype: 'numberfield',
  17148. selectOnFocus: true,
  17149. minValue: 0,
  17150. maxValue: 1000
  17151. },
  17152. },
  17153. {
  17154. text: '权重',
  17155. dataIndex: 'flex',
  17156. align: 'right',
  17157. width: 90,
  17158. sortable: false,
  17159. menuDisabled: true,
  17160. editor: {
  17161. xtype: 'numberfield',
  17162. selectOnFocus: true,
  17163. minValue: 0,
  17164. maxValue: 10
  17165. },
  17166. },
  17167. {
  17168. text: '字典',
  17169. dataIndex: 'dict',
  17170. sortable: false,
  17171. menuDisabled: true,
  17172. width: 210,
  17173. editor: {
  17174. selectOnFocus: true,
  17175. },
  17176. },
  17177. {
  17178. text: '对齐',
  17179. dataIndex: 'align',
  17180. width: 90,
  17181. sortable: false,
  17182. menuDisabled: true,
  17183. editor: {
  17184. xtype: 'combo',
  17185. selectOnFocus: true,
  17186. listConfig: {
  17187. minWidth: 120
  17188. },
  17189. store: [
  17190. ['start', 'start'],
  17191. ['center', 'center'],
  17192. ['end', 'end'],
  17193. ]
  17194. },
  17195. },
  17196. {
  17197. text: '必填',
  17198. dataIndex: 'notAllowBlank',
  17199. width: 50,
  17200. resizable: false,
  17201. sortable: false,
  17202. menuDisabled: true,
  17203. xtype: 'checkcolumn',
  17204. },
  17205. {
  17206. text: '禁用',
  17207. dataIndex: 'disabled',
  17208. width: 50,
  17209. resizable: false,
  17210. sortable: false,
  17211. menuDisabled: true,
  17212. xtype: 'checkcolumn',
  17213. },
  17214. {
  17215. text: '禁菜',
  17216. dataIndex: 'menuDisabled',
  17217. width: 50,
  17218. resizable: false,
  17219. sortable: false,
  17220. menuDisabled: true,
  17221. xtype: 'checkcolumn',
  17222. },
  17223. {
  17224. text: '过滤',
  17225. dataIndex: 'filterable',
  17226. xtype: 'checkcolumn',
  17227. width: 50,
  17228. resizable: false,
  17229. sortable: false,
  17230. menuDisabled: true,
  17231. },
  17232. {
  17233. text: '隐藏',
  17234. dataIndex: 'hidden',
  17235. xtype: 'checkcolumn',
  17236. width: 50,
  17237. resizable: false,
  17238. sortable: false,
  17239. menuDisabled: true,
  17240. },
  17241. {
  17242. text: '可隐',
  17243. dataIndex: 'hideable',
  17244. xtype: 'checkcolumn',
  17245. width: 50,
  17246. resizable: false,
  17247. sortable: false,
  17248. menuDisabled: true,
  17249. },
  17250. {
  17251. text: '调宽',
  17252. dataIndex: 'resizable',
  17253. xtype: 'checkcolumn',
  17254. width: 50,
  17255. resizable: false,
  17256. sortable: false,
  17257. menuDisabled: true,
  17258. },
  17259. {
  17260. text: '排序',
  17261. dataIndex: 'sortable',
  17262. xtype: 'checkcolumn',
  17263. width: 50,
  17264. resizable: false,
  17265. sortable: false,
  17266. menuDisabled: true,
  17267. },
  17268. {
  17269. text: '适宽',
  17270. dataIndex: 'autoSize',
  17271. xtype: 'checkcolumn',
  17272. width: 50,
  17273. resizable: false,
  17274. sortable: false,
  17275. menuDisabled: true,
  17276. },
  17277. ],
  17278. },
  17279. {
  17280. title: '数据源',
  17281. layout: 'border',
  17282. listeners: {
  17283. activate: 'scope.dataSourceActivate'
  17284. },
  17285. items: [
  17286. {
  17287. region: 'north',
  17288. xtype: 'toolbar',
  17289. border: false,
  17290. items: [
  17291. {
  17292. xtype: 'textfield',
  17293. fieldLabel: '数据源',
  17294. flex: 1,
  17295. bind: {
  17296. value: '{vjson.dataSource.url}'
  17297. }
  17298. },
  17299. {
  17300. xtype: 'button',
  17301. text: '保存',
  17302. iconCls: 'x-fa fa-save',
  17303. listeners: {
  17304. click: 'scope.dataSourceSave'
  17305. }
  17306. },
  17307. {
  17308. xtype: 'button',
  17309. text: '读取',
  17310. iconCls: 'x-fa fa-folder-open',
  17311. listeners: {
  17312. click: 'scope.reloadSqlContent'
  17313. }
  17314. },
  17315. ]
  17316. },
  17317. {
  17318. region: 'center',
  17319. xtype: 'sqleditor',
  17320. layout: 'fit',
  17321. reference: 'sqlEditor',
  17322. },
  17323. {
  17324. region: 'south',
  17325. xtype: 'jsoneditor',
  17326. height: 200,
  17327. split: true,
  17328. collapsible: true,
  17329. title: '参数',
  17330. reference: 'sqlParams',
  17331. }
  17332. ]
  17333. },
  17334. {
  17335. title: '事件',
  17336. xtype: 'form',
  17337. scrollable: true,
  17338. margin: '10',
  17339. defaults: {
  17340. width: '100%',
  17341. labelAlign: 'top',
  17342. },
  17343. items: [
  17344. {
  17345. xtype: 'textfield',
  17346. fieldLabel: '选中前触发 beforeSelect',
  17347. bind: {
  17348. value: '{vjson.listeners.beforeselect}'
  17349. },
  17350. },
  17351. {
  17352. xtype: 'textfield',
  17353. fieldLabel: '选择范围改变 selectionChange',
  17354. bind: {
  17355. value: '{vjson.listeners.selectionchange}'
  17356. },
  17357. },
  17358. {
  17359. xtype: 'textfield',
  17360. fieldLabel: '行点击 itemClick',
  17361. bind: {
  17362. value: '{vjson.listeners.itemclick}'
  17363. },
  17364. },
  17365. {
  17366. xtype: 'textfield',
  17367. fieldLabel: '行双击 itemDblClick',
  17368. bind: {
  17369. value: '{vjson.listeners.itemdblclick}'
  17370. },
  17371. },
  17372. {
  17373. xtype: 'textfield',
  17374. fieldLabel: '单元格点击 cellClick',
  17375. bind: {
  17376. value: '{vjson.listeners.cellClick}'
  17377. },
  17378. },
  17379. {
  17380. xtype: 'textfield',
  17381. fieldLabel: '单元格双击 cellDblClick',
  17382. bind: {
  17383. value: '{vjson.listeners.celldblclick}'
  17384. },
  17385. },
  17386. {
  17387. xtype: 'textfield',
  17388. fieldLabel: '渲染后触发 afterrender',
  17389. bind: {
  17390. value: '{vjson.listeners.afterrender}'
  17391. },
  17392. },
  17393. {
  17394. xtype: 'textfield',
  17395. fieldLabel: '销毁后触发 destory',
  17396. bind: {
  17397. value: '{vjson.listeners.destory}'
  17398. },
  17399. },
  17400. ]
  17401. },
  17402. ],
  17403. }
  17404. ],
  17405. fbar: [
  17406. {
  17407. text: '应用', iconCls: 'x-fa fa-save',
  17408. listeners: {
  17409. click: 'scope.save'
  17410. }
  17411. },
  17412. '-',
  17413. {
  17414. text: '确定', iconCls: 'x-fa fa-check-circle',
  17415. listeners: {
  17416. click: 'scope.saveClose'
  17417. }
  17418. },
  17419. {
  17420. text: '取消', iconCls: 'x-fa fa-times-circle',
  17421. listeners: {
  17422. click: 'system.closeMe()'
  17423. }
  17424. },
  17425. ]
  17426. };
  17427. //# sourceMappingURL=YvgridDesign.view.js.map
  17428. var VjsonExchange = /** @class */ (function () {
  17429. function VjsonExchange(vjson) {
  17430. this.pendingSet = true;
  17431. this.vjsonOrigin = _$2.cloneDeep(vjson);
  17432. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  17433. }
  17434. /**
  17435. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  17436. * @param propName
  17437. * @param value
  17438. */
  17439. VjsonExchange.prototype.setPropValue = function (propName, value) {
  17440. if (this.pendingSet) {
  17441. return;
  17442. }
  17443. // selectMode
  17444. // pageSizeOption
  17445. // cellediting_clicksToEdit
  17446. msg$1('' + propName + '=' + value);
  17447. _$2.set(this.vjson, propName, value);
  17448. };
  17449. /**
  17450. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  17451. */
  17452. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  17453. var _a, _b, _c;
  17454. if (this.pendingSet) {
  17455. return;
  17456. }
  17457. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  17458. // 如果不使用默认属性,就直接设定 undefined
  17459. var vs = {
  17460. dataIndex: undefined,
  17461. header: undefined,
  17462. xtype: '',
  17463. width: undefined,
  17464. flex: undefined,
  17465. align: 'start',
  17466. editor: undefined,
  17467. dataType: 'string',
  17468. dict: undefined,
  17469. disabled: false,
  17470. menuDisabled: false,
  17471. notAllowBlank: false,
  17472. filterable: true,
  17473. hidden: false,
  17474. hideable: true,
  17475. resizable: true,
  17476. sortable: true,
  17477. autoSize: true,
  17478. };
  17479. var raw = record.get('raw');
  17480. if (raw === undefined || raw == null) {
  17481. raw = {};
  17482. record.set('raw', raw);
  17483. }
  17484. var setRaw = function (propName, value) {
  17485. if (typeof value === 'undefined' || value == null) {
  17486. msg$1("delete columns[" + rowIdx + "]." + propName);
  17487. delete raw[propName];
  17488. return;
  17489. }
  17490. var defaultValue = vs[propName];
  17491. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  17492. // 要设的值,与默认值相同,就直接删除这个属性
  17493. msg$1("delete columns[" + rowIdx + "]." + propName);
  17494. delete raw[propName];
  17495. return;
  17496. }
  17497. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  17498. _$2.set(raw, propName, value);
  17499. };
  17500. if (!vs.hasOwnProperty(propName)) {
  17501. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  17502. return;
  17503. }
  17504. else if (propName === 'dict') {
  17505. if (value) {
  17506. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  17507. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  17508. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  17509. }
  17510. }
  17511. else {
  17512. setRaw('fix', undefined);
  17513. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  17514. msg$1("delete columns[" + rowIdx + "].editor.fix");
  17515. delete raw.editor.fix;
  17516. }
  17517. }
  17518. }
  17519. else if (propName === 'xtype') {
  17520. if (!value) {
  17521. setRaw('xtype', undefined);
  17522. }
  17523. else {
  17524. setRaw('xtype', value);
  17525. }
  17526. }
  17527. else if (propName === 'notAllowBlank') {
  17528. setRaw('editor.allowBlank', !value);
  17529. }
  17530. else if (propName === 'editor') {
  17531. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  17532. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  17533. value = undefined;
  17534. }
  17535. // editor.xtype
  17536. if (!value) {
  17537. // 不需要编辑器
  17538. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  17539. msg$1("delete columns[" + rowIdx + "].editor");
  17540. delete raw.editor;
  17541. record.set('notAllowBlank', false);
  17542. }
  17543. }
  17544. else {
  17545. setRaw('editor.xtype', value);
  17546. var dict = record.get('dict');
  17547. if (value === 'combo' && dict) {
  17548. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  17549. }
  17550. }
  17551. }
  17552. else if (propName === 'width') {
  17553. var width = value;
  17554. var flex = record.get('flex');
  17555. if (!width && !flex) {
  17556. setRaw('width', undefined);
  17557. setRaw('flex', undefined);
  17558. record.set('flex', undefined);
  17559. record.set('width', undefined);
  17560. return;
  17561. }
  17562. else if (!!width) {
  17563. setRaw('flex', undefined);
  17564. record.set('flex', undefined);
  17565. setRaw('width', width);
  17566. return;
  17567. }
  17568. }
  17569. else if (propName === 'flex') {
  17570. var width = record.get('width');
  17571. var flex = value;
  17572. if (!width && !flex) {
  17573. setRaw('width', undefined);
  17574. setRaw('flex', undefined);
  17575. record.set('flex', undefined);
  17576. record.set('width', undefined);
  17577. return;
  17578. }
  17579. else if (!!flex) {
  17580. setRaw('width', undefined);
  17581. record.set('width', undefined);
  17582. setRaw('flex', flex);
  17583. return;
  17584. }
  17585. }
  17586. else {
  17587. // 其他属性,作为同名属性,与 raw 同步
  17588. setRaw(propName, value);
  17589. }
  17590. };
  17591. /**
  17592. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  17593. */
  17594. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  17595. var _this = this;
  17596. var vs = [
  17597. 'reference', 'pagination', 'pageSize',
  17598. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  17599. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  17600. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  17601. 'listeners.beforeselect',
  17602. 'listeners.selectionchange',
  17603. 'listeners.itemclick',
  17604. 'listeners.itemdblclick',
  17605. 'listeners.cellClick',
  17606. 'listeners.celldblclick',
  17607. 'listeners.afterrender',
  17608. 'listeners.destory',
  17609. ];
  17610. _$2.forEach(vs, function (v) {
  17611. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  17612. });
  17613. };
  17614. VjsonExchange.prototype.bindChangeProp = function (propName) {
  17615. var me = this;
  17616. return function (value) {
  17617. me.setPropValue(propName, value);
  17618. };
  17619. };
  17620. VjsonExchange.prototype.parseModel = function () {
  17621. var _this = this;
  17622. 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;
  17623. //@ts-ignore
  17624. var df = YvanUI.Defaults.grid;
  17625. var vjson = _$2.assign({}, df, this.vjson);
  17626. var model = {
  17627. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  17628. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  17629. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  17630. pageSizeOption: '["20", "50", "100", "200", "300"]',
  17631. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  17632. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  17633. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  17634. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  17635. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  17636. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  17637. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  17638. selectMode: 'spreadsheet',
  17639. cellediting_clicksToEdit: true,
  17640. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  17641. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  17642. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  17643. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  17644. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  17645. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  17646. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  17647. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  17648. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  17649. gridfilters: true,
  17650. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  17651. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  17652. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  17653. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  17654. columns: [],
  17655. listeners: {
  17656. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  17657. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  17658. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  17659. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  17660. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  17661. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  17662. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  17663. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  17664. }
  17665. };
  17666. if (_$2.isArray(this.vjson.pageSizeOption)) {
  17667. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  17668. }
  17669. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  17670. if (_$2.get(vjson, 'disableSelection') == true) {
  17671. model.selectMode = 'disableSelection';
  17672. }
  17673. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  17674. model.selectMode = 'spreadsheet';
  17675. }
  17676. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  17677. model.selectMode = 'onlyCheckColumn';
  17678. }
  17679. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  17680. model.selectMode = 'checkColumn';
  17681. }
  17682. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  17683. model.selectMode = 'row_mulity';
  17684. }
  17685. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  17686. model.selectMode = 'row_single';
  17687. }
  17688. else {
  17689. model.selectMode = 'row_single';
  17690. }
  17691. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  17692. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  17693. model.dataSource = {
  17694. url: _$2.get(vjson, 'dataSource.url'),
  17695. //@ts-ignore
  17696. params: _$2.get(vjson, 'dataSource.params')
  17697. };
  17698. }
  17699. _$2.forEach(vjson.columns, function (column) {
  17700. model.columns.push(_this.parseColumn(column));
  17701. });
  17702. return model;
  17703. };
  17704. VjsonExchange.prototype.parseColumn = function (column) {
  17705. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  17706. var model = {
  17707. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  17708. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  17709. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  17710. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  17711. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  17712. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  17713. editor: '',
  17714. editParam: '',
  17715. dict: '',
  17716. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  17717. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  17718. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  17719. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  17720. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  17721. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  17722. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  17723. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  17724. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  17725. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  17726. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  17727. raw: _$2.cloneDeep(column),
  17728. };
  17729. // width / flex 只能留一个属性, 或者全不留
  17730. if (model.width <= 0 && model.flex <= 0) {
  17731. delete model.width;
  17732. delete model.flex;
  17733. }
  17734. else if (model.width > 0) {
  17735. delete model.flex;
  17736. }
  17737. else {
  17738. delete model.width;
  17739. }
  17740. // editor
  17741. if (_$2.isObject(_$2.get(column, 'editor'))) {
  17742. model.editor = _$2.get(column, 'editor.xtype');
  17743. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  17744. if (!model.editor) {
  17745. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  17746. model.editor = 'textfield';
  17747. }
  17748. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  17749. msg$1('不可识别的 editor.xtype=' + model.editor);
  17750. console.error('不可识别的 editor.xtype', column);
  17751. }
  17752. if (_$2.get(column, 'editor.allowBlank') === false) {
  17753. model.notAllowBlank = true;
  17754. }
  17755. }
  17756. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  17757. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  17758. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  17759. if (match && match[1]) {
  17760. model.dict = match[1];
  17761. }
  17762. }
  17763. return model;
  17764. };
  17765. return VjsonExchange;
  17766. }());
  17767. //
  17768. //# sourceMappingURL=YvgridExchange.js.map
  17769. var YvgridDesign = /** @class */ (function (_super) {
  17770. __extends(YvgridDesign, _super);
  17771. function YvgridDesign(moduleId) {
  17772. var _this = _super.call(this, { model: model$j, vjson: vjson$j }) || this;
  17773. _this.moduleId = '';
  17774. _this.name = 'YvgridDesign';
  17775. _this.dataSourceIsActived = false;
  17776. _this.setModuleId(moduleId);
  17777. return _this;
  17778. }
  17779. YvgridDesign.prototype.setModuleId = function (moduleId) {
  17780. var _this = this;
  17781. this.moduleId = moduleId;
  17782. if (this.componentSelectionChangeSubscribe) {
  17783. this.componentSelectionChangeSubscribe.cancel();
  17784. this.componentSelectionChangeSubscribe = null;
  17785. }
  17786. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  17787. var id = _a.id, from = _a.from;
  17788. _this.onComponentSelectionChange(id, from);
  17789. });
  17790. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  17791. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  17792. if (vj.xtype !== 'yvgrid') {
  17793. throw Error('非 yvgrid 组件');
  17794. }
  17795. this.vjsonExchange = new VjsonExchange(vj);
  17796. };
  17797. YvgridDesign.prototype.onLoad = function () {
  17798. var _this = this;
  17799. var model = this.vjsonExchange.parseModel();
  17800. this.vjsonExchange.pendingSet = true;
  17801. mergeViewModel(this.viewModel, "vjson", model, false);
  17802. this.refs.grid1.setData(model.columns);
  17803. this.vjsonExchange.attachViewModel(this.viewModel);
  17804. _$2.defer(function () {
  17805. _this.vjsonExchange.pendingSet = false;
  17806. });
  17807. };
  17808. YvgridDesign.prototype.moveUp = function (sender) {
  17809. var grid = sender.up('grid');
  17810. grid.rowMoveUp();
  17811. };
  17812. YvgridDesign.prototype.moveDown = function (sender) {
  17813. var grid = sender.up('grid');
  17814. grid.rowMoveDown();
  17815. };
  17816. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  17817. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  17818. };
  17819. YvgridDesign.prototype.reloadSqlContent = function () {
  17820. var _this = this;
  17821. var url = this.viewModel.get('vjson.dataSource.url');
  17822. if (url) {
  17823. loadSqlContentApi(url).then(function (res) {
  17824. _this.refs.sqlEditor.setCode('');
  17825. if (res.success) {
  17826. _this.refs.sqlEditor.setCode(res.data.content);
  17827. }
  17828. }).catch(function () {
  17829. _this.refs.sqlEditor.setCode('');
  17830. });
  17831. }
  17832. };
  17833. YvgridDesign.prototype.dataSourceSave = function () {
  17834. var url = this.viewModel.get('vjson.dataSource.url');
  17835. if (!url) {
  17836. msg$1('必须填写 groovy/SQL 模块路径');
  17837. return;
  17838. }
  17839. var content = this.refs.sqlEditor.getCode();
  17840. saveSqlContentApi(url, content).then(function (res) {
  17841. if (res.success) {
  17842. msg$1('保存成功');
  17843. }
  17844. else {
  17845. msg$1(res.msg);
  17846. }
  17847. });
  17848. };
  17849. YvgridDesign.prototype.dataSourceActivate = function () {
  17850. if (!this.dataSourceIsActived) {
  17851. // 激活
  17852. this.reloadSqlContent();
  17853. var params = this.viewModel.get('vjson.dataSource.params');
  17854. if (_$2.isObject(params)) {
  17855. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  17856. }
  17857. this.dataSourceIsActived = true;
  17858. }
  17859. };
  17860. // 外部控件选择发生改变
  17861. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  17862. if (!id || from === this.name) {
  17863. return;
  17864. }
  17865. this.setVjson(id);
  17866. };
  17867. YvgridDesign.prototype.setVjson = function (id) {
  17868. // 找到对应的组件 判断是不是表格
  17869. };
  17870. YvgridDesign.prototype.save = function () {
  17871. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  17872. if (this.dataSourceIsActived) {
  17873. var url = this.viewModel.get('vjson.dataSource.url');
  17874. // 解析 params
  17875. var paramsString = this.refs.sqlParams.getCode('');
  17876. var params = undefined;
  17877. if (paramsString) {
  17878. try {
  17879. params = window['YvanUI'].json5.parse(paramsString);
  17880. }
  17881. catch (e) {
  17882. msg$1('dataSource.params 格式非法,请检查');
  17883. return;
  17884. }
  17885. }
  17886. if (typeof params === 'undefined') {
  17887. params = this.viewModel.get('vjson.dataSource.params');
  17888. }
  17889. if (url) {
  17890. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  17891. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  17892. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  17893. }
  17894. else {
  17895. delete this.vjsonExchange.vjson['dataSource'];
  17896. }
  17897. }
  17898. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  17899. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  17900. from: this.name,
  17901. ignoreRenderUI: false
  17902. });
  17903. };
  17904. YvgridDesign.prototype.saveClose = function () {
  17905. this.save();
  17906. this.close();
  17907. };
  17908. YvgridDesign.prototype.addColumn = function () {
  17909. this.refs.grid1.appendEditRow({
  17910. dataIndex: '',
  17911. header: '',
  17912. xtype: '',
  17913. width: 80,
  17914. align: '',
  17915. editor: '',
  17916. editParam: '',
  17917. dict: '',
  17918. disabled: false,
  17919. notAllowBlank: false,
  17920. menuDisabled: false,
  17921. filterable: false,
  17922. hidden: false,
  17923. hideable: true,
  17924. resizable: true,
  17925. sortable: true,
  17926. locked: false,
  17927. lockable: false,
  17928. autoSize: true,
  17929. raw: undefined,
  17930. }, 'header');
  17931. };
  17932. YvgridDesign.prototype.removeColumn = function () {
  17933. var _this = this;
  17934. var rows = [];
  17935. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  17936. rows.push(r);
  17937. });
  17938. _$2.forEach(rows, function (r) {
  17939. _this.refs.grid1.getStore().remove(r);
  17940. });
  17941. };
  17942. YvgridDesign.prototype.calcColumn = function () {
  17943. msg$1('暂未实现');
  17944. };
  17945. YvgridDesign.prototype.onDestroy = function () {
  17946. if (this.componentSelectionChangeSubscribe) {
  17947. this.componentSelectionChangeSubscribe.cancel();
  17948. this.componentSelectionChangeSubscribe = null;
  17949. }
  17950. };
  17951. return YvgridDesign;
  17952. }(Scope));
  17953. //# sourceMappingURL=YvgridDesign.js.map
  17954. var YvanUI$1 = window['YvanUI'];
  17955. var _$1 = window["_"];
  17956. var Ext$1 = window['Ext'];
  17957. var $$1 = window["$"];
  17958. var historySize = 100;
  17959. var ViewDesign = /** @class */ (function () {
  17960. function ViewDesign(moduleId, reference) {
  17961. var _this = this;
  17962. this.name = "ViewDesign";
  17963. this.expandedVjsonObjArray = [];
  17964. // 编辑历史
  17965. this.undoVjsonList = [];
  17966. // 撤销历史
  17967. this.redoVjsonList = [];
  17968. // 订阅事件列表
  17969. this.subscribeList = [];
  17970. // private getOuterCopyValueTimer: any = null
  17971. /**
  17972. * 唯一编号
  17973. */
  17974. this.id = _$1.uniqueId("_dv");
  17975. this.moduleId = moduleId;
  17976. this.moduleObject = moduleStore.getModuleObject(moduleId);
  17977. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  17978. this.designReference = reference;
  17979. this.designElement = reference.ariaEl.dom;
  17980. this.$overlay.appendTo(this.designElement);
  17981. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  17982. // 添加到撤销
  17983. this.lastVjson = _$1.cloneDeep(this.vjson);
  17984. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  17985. event.stopPropagation();
  17986. event.preventDefault();
  17987. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  17988. });
  17989. this.$overlay.on('click', '.studio_mask', function (event) {
  17990. event.stopPropagation();
  17991. event.preventDefault();
  17992. _this.clearSelection();
  17993. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  17994. _$1.defer(function () {
  17995. _this.$overlay.focus();
  17996. });
  17997. });
  17998. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  17999. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  18000. this.$overlay.on('copy', this.onCopy.bind(this));
  18001. this.$overlay.on('paste', this.onPaste.bind(this));
  18002. this.$overlay.on('focus', this.onfocus.bind(this));
  18003. // this.$overlay.on('mouseenter', ()=>{
  18004. // clearTimeout(this.getOuterCopyValueTimer);
  18005. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  18006. // })
  18007. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  18008. _this.onMousemove(event);
  18009. }, 300, { maxWait: 500 }).bind(this));
  18010. window.addEventListener('message', this.onMessageEvent.bind(this));
  18011. this.subscribe();
  18012. setDesignInstance(this);
  18013. }
  18014. // todo ======== 方法 ==========
  18015. ViewDesign.prototype.subscribe = function () {
  18016. var _this = this;
  18017. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  18018. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  18019. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18020. _this.setVjson(vjson, from, ignoreRenderUI);
  18021. }));
  18022. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  18023. var id = _a.id, from = _a.from;
  18024. _this.onComponentSelectionChange(id, from);
  18025. }));
  18026. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  18027. var id = _a.id, from = _a.from;
  18028. _this.onComponentDelete(id, from);
  18029. }));
  18030. };
  18031. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  18032. if (vjson === void 0) { vjson = this.vjson; }
  18033. if (from === void 0) { from = this.name; }
  18034. this.vjson = vjson;
  18035. if (from !== "undo" && from !== "redo") {
  18036. if (this.undoVjsonList.length >= 100) {
  18037. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  18038. }
  18039. this.undoVjsonList.push(this.lastVjson);
  18040. }
  18041. this.lastVjson = _$1.cloneDeep(vjson);
  18042. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  18043. };
  18044. /**
  18045. * 覆盖层点击事件
  18046. */
  18047. ViewDesign.prototype.overlayClickFunction = function (event) {
  18048. if (!event.altKey && !event.shiftKey) {
  18049. var target = this.findElByXY(event.clientX, event.clientY);
  18050. if (target) {
  18051. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  18052. var extHandle = Ext$1.get(target).component;
  18053. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18054. rect.x = position.x;
  18055. rect.y = position.y;
  18056. this.clearSelection();
  18057. this.appendMaskbox(rect, extHandle.id);
  18058. }
  18059. }
  18060. };
  18061. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  18062. if (dragType === void 0) { dragType = ""; }
  18063. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  18064. var ele = document.elementsFromPoint(x, y);
  18065. if (ele.length <= 1) {
  18066. return;
  18067. }
  18068. var target = null;
  18069. for (var i = 0; i < ele.length; i++) {
  18070. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  18071. 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) {
  18072. switch (dragType) {
  18073. case "cols-container":
  18074. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  18075. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  18076. target = ele[i];
  18077. }
  18078. break;
  18079. case "col-item":
  18080. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  18081. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  18082. target = ele[i];
  18083. }
  18084. break;
  18085. case "rows-container":
  18086. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  18087. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  18088. target = ele[i];
  18089. }
  18090. break;
  18091. case "row-item":
  18092. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  18093. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  18094. target = ele[i];
  18095. }
  18096. break;
  18097. default:
  18098. target = ele[i];
  18099. break;
  18100. }
  18101. if (target) {
  18102. break;
  18103. }
  18104. }
  18105. }
  18106. return target;
  18107. };
  18108. /**
  18109. * 清空选择项
  18110. */
  18111. ViewDesign.prototype.clearSelection = function () {
  18112. // $(this.designElement).removeClass('selected');
  18113. // // $(this.designElement).find('.selected').removeClass('selected')
  18114. // $(this.designElement).find('.ds_mask')
  18115. // .not('.mask_not_hide')
  18116. // .remove();
  18117. $$1('.studio_mask').remove();
  18118. // $(this.designElement).find('.selected').each(function () {
  18119. // $(this).removeClass('selected');
  18120. // // const extHandle = Ext.get(this).component
  18121. // // if (extHandle) {
  18122. // // extHandle.removeCls('selected')
  18123. // // }
  18124. // })
  18125. };
  18126. /**
  18127. * 添加遮罩层
  18128. */
  18129. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  18130. var that = this;
  18131. if (vjsonId) {
  18132. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  18133. }
  18134. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  18135. // return item === cj.xtype
  18136. // }) >= 0
  18137. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18138. 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>");
  18139. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  18140. this.$mask.css({
  18141. position: 'absolute',
  18142. top: top, left: left, width: width, height: height,
  18143. border: '2px dashed #1890ff',
  18144. zIndex: 100,
  18145. });
  18146. this.$mask.appendTo(this.$overlay);
  18147. this.$mask.on("click", ".ds_del", function (e) {
  18148. e.stopPropagation();
  18149. e.preventDefault();
  18150. that.deleteComponent(vjsonId);
  18151. });
  18152. // 点击选中父级
  18153. this.$mask.on('click', '.ds_parent', function (e) {
  18154. e.stopPropagation();
  18155. e.preventDefault();
  18156. that.selectParent(vjsonId);
  18157. });
  18158. var sel = document.getElementById(vjsonId);
  18159. var sVjosn = findInCode(this.vjson, vjsonId);
  18160. // 限制可以拖动的组件
  18161. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  18162. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  18163. this.dragSource = new Ext$1.drag.Source({
  18164. element: this.$mask[0],
  18165. constrain: this.$overlay[0],
  18166. listeners: {
  18167. dragmove: this.dragmove.bind(that, this.vjson),
  18168. dragend: this.dragend.bind(that, this.vjson)
  18169. },
  18170. startRect: rect,
  18171. sourceVjson: findInCode(this.vjson, vjsonId),
  18172. sourceVjsonId: vjsonId,
  18173. dragType: dragType
  18174. });
  18175. }
  18176. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  18177. };
  18178. /**
  18179. * 选中某个选项
  18180. */
  18181. ViewDesign.prototype.setSelection = function (id) {
  18182. var _a, _b;
  18183. if (!this.designElement) {
  18184. return;
  18185. }
  18186. // 清空选中内容
  18187. this.clearSelection();
  18188. if (!id) {
  18189. return;
  18190. }
  18191. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  18192. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18193. rect.x = position.x;
  18194. rect.y = position.y;
  18195. this.appendMaskbox(rect, id);
  18196. };
  18197. /**
  18198. * 删除组件
  18199. * @param id
  18200. */
  18201. ViewDesign.prototype.deleteComponent = function (id) {
  18202. deletVjsonById(this.vjson, id);
  18203. this.moduleObject.modulePage.currentComponentSelectId = null;
  18204. this.setVjson();
  18205. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  18206. this.clearSelection();
  18207. };
  18208. ViewDesign.prototype.selectParent = function (id) {
  18209. var pid = getSuperVjsonId(this.vjson, id);
  18210. this.moduleObject.modulePage.currentComponentSelectId = pid;
  18211. this.setSelection(pid);
  18212. };
  18213. // todo ====== 拖拽事件 ======
  18214. ViewDesign.prototype.dragmove = function (node, source, info) {
  18215. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18216. if (!target) {
  18217. return;
  18218. }
  18219. var rect = target.getBoundingClientRect();
  18220. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18221. var extHandle = Ext$1.get(target).component;
  18222. if (!extHandle) {
  18223. return;
  18224. }
  18225. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18226. rect.x = position.x;
  18227. rect.y = position.y;
  18228. this.appendDirection(rect, extHandle.id, direction);
  18229. };
  18230. ViewDesign.prototype.dragend = function (node, source, info) {
  18231. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18232. if (!target) {
  18233. return;
  18234. }
  18235. var rect = target.getBoundingClientRect();
  18236. var extHandle = Ext$1.get(target).component;
  18237. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18238. if (!extHandle) {
  18239. return;
  18240. }
  18241. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  18242. this.removeDirection();
  18243. };
  18244. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  18245. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18246. var cv = findInCode(this.vjson, vjsonId);
  18247. if (this.$direction) {
  18248. $$1('#direction' + this.id).remove();
  18249. }
  18250. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  18251. //
  18252. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  18253. if (direction) {
  18254. if (direction === "top") {
  18255. // direction = 'center'
  18256. height = height / 4;
  18257. }
  18258. else if (direction === "bottom") {
  18259. // direction = 'center'
  18260. top = top + height / 4 * 3;
  18261. height = height / 4;
  18262. }
  18263. else if (direction === "left") {
  18264. width = width / 4;
  18265. }
  18266. else if (direction === "right") {
  18267. left = left + width / 4 * 3;
  18268. width = width / 4;
  18269. }
  18270. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18271. this.$direction.css({
  18272. position: 'absolute',
  18273. top: top, left: left, width: width, height: height,
  18274. // border: '2px dashed #1890ff',
  18275. background: 'rgba(40,224,218,0.75)',
  18276. zIndex: 100,
  18277. });
  18278. this.$direction.appendTo(this.$overlay);
  18279. // }
  18280. }
  18281. };
  18282. ViewDesign.prototype.removeDirection = function () {
  18283. if (this.$direction) {
  18284. this.$direction.remove();
  18285. this.$direction = null;
  18286. }
  18287. };
  18288. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  18289. var arrS;
  18290. if (sourceVjId) {
  18291. arrS = findArrayContainer(this.vjson, sourceVjId);
  18292. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  18293. var indexS = _$1.findIndex(arrS, function (v) {
  18294. return v.id === sourceVjId;
  18295. });
  18296. if (indexS < 0) {
  18297. return;
  18298. }
  18299. }
  18300. delete sourceVjson.id;
  18301. var vjsonT = findInCode(this.vjson, targetVjId);
  18302. var arrT = findArrayContainer(this.vjson, targetVjId);
  18303. var indexT = _$1.findIndex(arrT, function (v) {
  18304. return v.id === targetVjId;
  18305. });
  18306. if (indexT < 0) {
  18307. return;
  18308. }
  18309. switch (direction) {
  18310. case 'top':
  18311. case 'left':
  18312. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18313. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18314. vjsonT.items.splice(0, 0, sourceVjson);
  18315. }
  18316. else {
  18317. arrT.splice(indexT, 0, sourceVjson);
  18318. }
  18319. break;
  18320. case 'bottom':
  18321. case 'right':
  18322. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18323. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18324. vjsonT.items.push(sourceVjson);
  18325. }
  18326. else {
  18327. arrT.splice(indexT + 1, 0, sourceVjson);
  18328. }
  18329. break;
  18330. case 'center':
  18331. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18332. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18333. vjsonT.items.push(sourceVjson);
  18334. }
  18335. else {
  18336. arrT.splice(indexT, 1, sourceVjson);
  18337. }
  18338. break;
  18339. }
  18340. if (sourceVjId) {
  18341. deletVjsonById(this.vjson, sourceVjId);
  18342. sourceVjson.id = sourceVjId;
  18343. }
  18344. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  18345. };
  18346. // todo ======== 事件 ==========
  18347. // 接收 postMessage 事件分发
  18348. ViewDesign.prototype.onMessageEvent = function (event) {
  18349. var _a, _b;
  18350. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  18351. if (fucName && typeof this[fucName] === 'function') {
  18352. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  18353. }
  18354. };
  18355. // 接收外部选中组件事件
  18356. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  18357. if (from !== this.name) {
  18358. this.setSelection(id);
  18359. }
  18360. };
  18361. // 接收外部组件删除事件
  18362. ViewDesign.prototype.onComponentDelete = function (id, from) {
  18363. if (from !== this.name) {
  18364. this.deleteComponent(id);
  18365. }
  18366. };
  18367. // 组件被选中
  18368. ViewDesign.prototype.onComponentSelect = function (args) {
  18369. if (args[2] != this.moduleId) {
  18370. return;
  18371. }
  18372. if (args[0]) {
  18373. var rect = args[0];
  18374. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18375. rect.x = position.x;
  18376. rect.y = position.y;
  18377. this.clearSelection();
  18378. this.appendMaskbox(rect, args[1]);
  18379. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  18380. }
  18381. };
  18382. ViewDesign.prototype.onComponentInfo = function (_a) {
  18383. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  18384. if (moduleId != this.moduleId) {
  18385. return;
  18386. }
  18387. if (rect) {
  18388. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18389. rect.x = position.x;
  18390. rect.y = position.y;
  18391. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18392. var cv_1 = findInCode(this.vjson, vjsonId);
  18393. if (this.$direction) {
  18394. $$1('#direction' + this.id).remove();
  18395. }
  18396. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  18397. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  18398. if (direction) {
  18399. if (direction === "top") {
  18400. direction = 'center';
  18401. //height = height/3
  18402. }
  18403. else if (direction === "bottom") {
  18404. direction = 'center';
  18405. // top=top+height/3*2
  18406. // height = height/3
  18407. }
  18408. else if (direction === "left") {
  18409. width = width / 3;
  18410. }
  18411. else if (direction === "right") {
  18412. left = left + width / 3 * 2;
  18413. width = width / 3;
  18414. }
  18415. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18416. this.$direction.css({
  18417. position: 'absolute',
  18418. top: top, left: left, width: width, height: height,
  18419. // border: '2px dashed #1890ff',
  18420. background: 'rgba(74,106,201,0.42)',
  18421. zIndex: 100,
  18422. });
  18423. this.$direction.appendTo(this.$overlay);
  18424. }
  18425. }
  18426. console.log("direction", direction);
  18427. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  18428. // rect.x = position.x
  18429. // rect.y = position.y
  18430. // this.clearSelection()
  18431. // this.appendMaskbox(rect, args[1])
  18432. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  18433. }
  18434. };
  18435. ViewDesign.prototype.onUndo = function () {
  18436. if (this.undoVjsonList.length > 0) {
  18437. if (this.redoVjsonList.length >= 100) {
  18438. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  18439. }
  18440. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18441. this.vjson = this.undoVjsonList.pop();
  18442. // this.setVjson(this.vjson, "", false, "undo")
  18443. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  18444. }
  18445. };
  18446. ViewDesign.prototype.onRedo = function () {
  18447. if (this.redoVjsonList.length > 0) {
  18448. if (this.undoVjsonList.length >= 100) {
  18449. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  18450. }
  18451. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18452. this.vjson = this.redoVjsonList.pop();
  18453. // this.setVjson(this.vjson, "", false, "redo")
  18454. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  18455. }
  18456. };
  18457. ViewDesign.prototype.onKeyPress = function (event) {
  18458. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  18459. // if (this.backStep()) {
  18460. // event.stopPropagation()
  18461. // event.preventDefault()
  18462. // return
  18463. // }
  18464. // }
  18465. //
  18466. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  18467. // if (this.recoverStep()) {
  18468. // event.stopPropagation()
  18469. // event.preventDefault()
  18470. // return
  18471. // }
  18472. // }
  18473. // if (event.key === 'ArrowUp') {
  18474. // if (this.selectParent()) {
  18475. // event.stopPropagation()
  18476. // event.preventDefault()
  18477. // return;
  18478. // }
  18479. // }
  18480. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  18481. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  18482. event.stopPropagation();
  18483. event.preventDefault();
  18484. return;
  18485. }
  18486. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  18487. // if (this.copyView()) {
  18488. // event.stopPropagation()
  18489. // event.preventDefault()
  18490. // return;
  18491. // }
  18492. // }
  18493. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  18494. // if (this.copyView(true)) {
  18495. // event.stopPropagation()
  18496. // event.preventDefault()
  18497. // return;
  18498. // }
  18499. // }
  18500. //
  18501. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  18502. // if (this.selectRoot()) {
  18503. // event.stopPropagation()
  18504. // event.preventDefault()
  18505. // return;
  18506. // }
  18507. //
  18508. };
  18509. ViewDesign.prototype.onCopy = function (event) {
  18510. if (this.moduleObject.modulePage.currentComponentSelectId) {
  18511. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  18512. if (copyVjson) {
  18513. removeDesignProp(copyVjson);
  18514. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  18515. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  18516. }
  18517. }
  18518. };
  18519. ViewDesign.prototype.onPaste = function (event) {
  18520. debugger;
  18521. };
  18522. ViewDesign.prototype.onfocus = function () {
  18523. console.log("getCopy");
  18524. console.log("document.activeElement", document.activeElement.id);
  18525. // clearTimeout(this.getOuterCopyValueTimer);
  18526. // native.clipboardRead()
  18527. };
  18528. ViewDesign.prototype.onMousemove = function (event) {
  18529. var _a;
  18530. if (document.activeElement.id === this.$overlay[0].id) {
  18531. // console.log(event.clientX, event.clientY)
  18532. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  18533. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  18534. // this.iframeWindow.postMessage({
  18535. // method: 'overlayGetInfo',
  18536. // args: [position, this.moduleId]
  18537. // }, '*')
  18538. }
  18539. }
  18540. };
  18541. ViewDesign.prototype.onDestroy = function () {
  18542. window.removeEventListener('message', this.onMessageEvent.bind(this));
  18543. for (var i = 0; i < this.subscribeList.length; i++) {
  18544. this.subscribeList[i].cancel();
  18545. }
  18546. };
  18547. // todo ======== 工具方法 ==========
  18548. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  18549. if (relative === void 0) { relative = null; }
  18550. if (from === "main" && to === "overlay") {
  18551. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18552. var x = overlayRect.x;
  18553. var y = overlayRect.y;
  18554. if (relative) {
  18555. var relativeRect = relative.getBoundingClientRect();
  18556. console.log("main->", relativeRect.x, relativeRect.y);
  18557. x = x - relativeRect.x;
  18558. y = y - relativeRect.y;
  18559. }
  18560. pos.x = pos.x - x;
  18561. pos.y = pos.y - y;
  18562. }
  18563. else if (from === "overlay" && to === "main") {
  18564. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18565. var x = overlayRect.x;
  18566. var y = overlayRect.y;
  18567. if (relative) {
  18568. var relativeRect = relative.getBoundingClientRect();
  18569. console.log("iframe->", relativeRect.x, relativeRect.y);
  18570. x = x - relativeRect.x;
  18571. y = y - relativeRect.y;
  18572. }
  18573. pos.x = pos.x + x;
  18574. pos.y = pos.y + y;
  18575. }
  18576. return pos;
  18577. };
  18578. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  18579. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  18580. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  18581. return "center";
  18582. }
  18583. // col-item 只能放左右
  18584. if (dragType === "col-item" || dragType === "") {
  18585. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  18586. if (x > rect.x && x < rect.x + rect.width / 3) {
  18587. return "left";
  18588. }
  18589. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  18590. return "right";
  18591. }
  18592. }
  18593. }
  18594. // cols-container 只能放上下
  18595. if (dragType === "cols-container" || dragType === "") {
  18596. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  18597. if (y > rect.y && y < rect.y + rect.height / 3) {
  18598. return "top";
  18599. }
  18600. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  18601. return "bottom";
  18602. }
  18603. }
  18604. }
  18605. return "";
  18606. };
  18607. return ViewDesign;
  18608. }());
  18609. //
  18610. //# sourceMappingURL=ViewDesign.js.map
  18611. var model$k = {
  18612. data: {
  18613. iframeSrc: ''
  18614. }
  18615. };
  18616. //# sourceMappingURL=ModulePage.model.js.map
  18617. var vjson$k = {
  18618. layout: 'fit',
  18619. border: false,
  18620. iconCls: 'x-fa fa-newspaper-o',
  18621. referenceHolder: true,
  18622. items: [
  18623. {
  18624. layout: 'border',
  18625. border: false,
  18626. items: [
  18627. {
  18628. region: 'center',
  18629. xtype: 'tabpanel',
  18630. border: false,
  18631. tabPosition: 'bottom',
  18632. reference: 'tabPanel',
  18633. listeners: {
  18634. tabchange: 'scope.tabchange'
  18635. },
  18636. defaults: {
  18637. border: false,
  18638. },
  18639. items: [
  18640. {
  18641. title: 'controller.js',
  18642. xtype: 'jseditor',
  18643. reference: 'controllerEditor',
  18644. },
  18645. {
  18646. title: 'view.design',
  18647. xtype: 'designer',
  18648. reference: 'designer',
  18649. listeners: {
  18650. afterrender: 'scope.previewRender'
  18651. },
  18652. },
  18653. {
  18654. title: 'view.js',
  18655. xtype: 'jseditor',
  18656. reference: 'viewEditor',
  18657. },
  18658. {
  18659. title: 'model.js',
  18660. xtype: 'jseditor',
  18661. reference: 'modelEditor',
  18662. },
  18663. {
  18664. title: 'groovy',
  18665. xtype: 'groovyeditor',
  18666. reference: 'groovyEditor',
  18667. },
  18668. {
  18669. title: 'SQL',
  18670. xtype: 'sqleditor',
  18671. reference: 'sqlEditor',
  18672. }
  18673. ]
  18674. }
  18675. ]
  18676. }
  18677. ]
  18678. };
  18679. //# sourceMappingURL=ModulePage.view.js.map
  18680. var ModulePage = /** @class */ (function (_super) {
  18681. __extends(ModulePage, _super);
  18682. function ModulePage(moduleId, module) {
  18683. var _this = _super.call(this, { model: model$k, vjson: vjson$k }) || this;
  18684. _this.name = "ModulePage";
  18685. _this.viewDesign = null;
  18686. _this.maxViewId = 0;
  18687. _this.moduleEventBus = new EventBus();
  18688. _this.codeChange = _$2.debounce(function (code, from, e) {
  18689. try {
  18690. switch (from) {
  18691. case _this.refs.controllerEditor.name:
  18692. moduleStore.updateJsController(_this.moduleId, code, from);
  18693. break;
  18694. case _this.refs.viewEditor.name:
  18695. moduleStore.updateJsView(_this.moduleId, code, from);
  18696. break;
  18697. case _this.refs.modelEditor.name:
  18698. moduleStore.updateJsModel(_this.moduleId, code, from);
  18699. break;
  18700. case _this.refs.groovyEditor.name:
  18701. moduleStore.updateGroovy(_this.moduleId, code, from);
  18702. break;
  18703. case _this.refs.sqlEditor.name:
  18704. moduleStore.updateMybatis(_this.moduleId, code, from);
  18705. break;
  18706. }
  18707. }
  18708. catch (e) {
  18709. }
  18710. }, 500, { maxWait: 10000 });
  18711. _this.moduleId = moduleId;
  18712. _this.module = module;
  18713. _this.cancelSubscribe = [];
  18714. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  18715. _this.initEditor(moduleItem);
  18716. }));
  18717. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  18718. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18719. _this.previewReRender();
  18720. }));
  18721. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  18722. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18723. _this.updateVjson(vjson, from, ignoreRenderUI);
  18724. }));
  18725. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  18726. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18727. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  18728. }));
  18729. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  18730. var id = _a.id, from = _a.from;
  18731. _this.onComponentSelectionChange(id, from);
  18732. }));
  18733. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  18734. _this.onUndo();
  18735. }));
  18736. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  18737. _this.onRedo();
  18738. }));
  18739. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  18740. _this.currentCopyVjson = stringToJsonObj(value);
  18741. }));
  18742. return _this;
  18743. }
  18744. ModulePage.prototype.onLoad = function () {
  18745. var _this = this;
  18746. // this.refs.preview.src = href
  18747. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  18748. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  18749. _this.saveCall();
  18750. }));
  18751. this.activeEditor = this.refs.controllerEditor;
  18752. this.refs.controllerEditor.modulePage = this;
  18753. this.refs.viewEditor.modulePage = this;
  18754. this.refs.modelEditor.modulePage = this;
  18755. this.refs.groovyEditor.modulePage = this;
  18756. this.refs.sqlEditor.modulePage = this;
  18757. this.refs.controllerEditor.name = "controllerEditor";
  18758. this.refs.viewEditor.name = "viewEditor";
  18759. this.refs.modelEditor.name = "modelEditor";
  18760. this.refs.groovyEditor.name = "groovyEditor";
  18761. this.refs.sqlEditor.name = "sqlEditor";
  18762. this.refs.controllerEditor.codeChange = this.codeChange;
  18763. this.refs.viewEditor.codeChange = this.codeChange;
  18764. this.refs.modelEditor.codeChange = this.codeChange;
  18765. this.refs.groovyEditor.codeChange = this.codeChange;
  18766. this.refs.sqlEditor.codeChange = this.codeChange;
  18767. };
  18768. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  18769. if (!cmpVjson || from === this.name) {
  18770. return;
  18771. }
  18772. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18773. replaceVjsonById(vj, cmpVjson);
  18774. this.updateVjson(vj, from, ignoreRenderUI);
  18775. };
  18776. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  18777. var _this = this;
  18778. var _a, _b;
  18779. if (!vjson || from === this.name) {
  18780. return;
  18781. }
  18782. this.addViewId(vjson);
  18783. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  18784. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  18785. (_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);
  18786. this.previewReRender();
  18787. _$2.defer(function () {
  18788. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  18789. });
  18790. };
  18791. ModulePage.prototype.previewRender = function (sender) {
  18792. var _this = this;
  18793. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18794. if (!this.designScope) {
  18795. this.designScope = new Scope({
  18796. vjson: vjson,
  18797. model: {
  18798. data: {}
  18799. }
  18800. });
  18801. }
  18802. else {
  18803. this.designScope.vjson = vjson;
  18804. }
  18805. this.designScope.showDesigner(sender, {
  18806. moduleId: this.moduleId,
  18807. });
  18808. if (this.viewDesign) {
  18809. return;
  18810. }
  18811. _$2.defer(function () {
  18812. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  18813. handles$1.mainWindow.setLoading(false);
  18814. });
  18815. };
  18816. ModulePage.prototype.previewReRender = function () {
  18817. var designer = this.refs.designer;
  18818. this.previewRender(designer);
  18819. };
  18820. ModulePage.prototype.initEditor = function (moduleItem) {
  18821. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  18822. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  18823. return;
  18824. (_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);
  18825. (_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);
  18826. (_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);
  18827. (_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);
  18828. (_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);
  18829. };
  18830. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  18831. this.currentComponentSelectId = id;
  18832. };
  18833. ModulePage.prototype.onUndo = function () {
  18834. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18835. this.viewDesign.onUndo();
  18836. }
  18837. };
  18838. ModulePage.prototype.onRedo = function () {
  18839. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18840. this.viewDesign.onRedo();
  18841. }
  18842. };
  18843. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  18844. this.activeEditor = newCard;
  18845. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  18846. };
  18847. ModulePage.prototype.saveCall = function () {
  18848. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  18849. moduleStore.saveFile(this.moduleId, "jsView");
  18850. }
  18851. else if (this.activeEditor === this.refs.controllerEditor) {
  18852. moduleStore.saveFile(this.moduleId, "jsController");
  18853. }
  18854. else if (this.activeEditor === this.refs.modelEditor) {
  18855. moduleStore.saveFile(this.moduleId, "jsModel");
  18856. }
  18857. else if (this.activeEditor === this.refs.groovyEditor) {
  18858. moduleStore.saveFile(this.moduleId, "groovy");
  18859. }
  18860. else if (this.activeEditor === this.refs.sqlEditor) {
  18861. moduleStore.saveFile(this.moduleId, "mybatis");
  18862. }
  18863. };
  18864. ModulePage.prototype.check = function () {
  18865. moduleStore.check(this.moduleId);
  18866. };
  18867. /**
  18868. * 为vjson添加id
  18869. * @param vjson
  18870. * @param isAll
  18871. */
  18872. ModulePage.prototype.addViewId = function (vjson, isAll) {
  18873. var _this = this;
  18874. if (isAll === void 0) { isAll = false; }
  18875. var maxIdTag = 0;
  18876. // 先提取当前的最大id
  18877. deepTravVJson(vjson, function (obj) {
  18878. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18879. return;
  18880. }
  18881. if (obj.id && obj.id.indexOf(idPrefix)) {
  18882. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  18883. if (sutr.length > 0) {
  18884. var tid = sutr.replace(idPrefix, "");
  18885. var idNum = parseInt(tid);
  18886. if (idNum && maxIdTag < idNum) {
  18887. maxIdTag = idNum;
  18888. }
  18889. }
  18890. }
  18891. });
  18892. // 标记最大的id号,避免重复
  18893. this.maxViewId = maxIdTag;
  18894. deepTravVJson(vjson, function (obj) {
  18895. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18896. return;
  18897. }
  18898. if (!obj.hasOwnProperty('id')) {
  18899. obj.id = _this.createViewId();
  18900. }
  18901. if (!obj.hasOwnProperty('designMode')) {
  18902. obj.designMode = true;
  18903. }
  18904. // if (obj.xtype == "tabview" && obj.activeTab) {
  18905. // // 设置默认的选项
  18906. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  18907. // if (typeof obj.activeTab === 'number') {
  18908. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  18909. // } else if (typeof obj.activeTab === 'string') {
  18910. // this._tabViewSelect[obj.id] = obj.activeTab
  18911. // }
  18912. //
  18913. // }
  18914. // }
  18915. if (isAll && obj.hasOwnProperty("view")) ;
  18916. });
  18917. return vjson;
  18918. };
  18919. /**
  18920. * 为组件创建 ID
  18921. */
  18922. ModulePage.prototype.createViewId = function () {
  18923. this.maxViewId++;
  18924. return this.id + idPrefix + this.maxViewId;
  18925. };
  18926. ModulePage.prototype.onDestroy = function () {
  18927. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  18928. this.cancelSubscribe[i].cancel();
  18929. }
  18930. _super.prototype.onDestroy.call(this);
  18931. };
  18932. return ModulePage;
  18933. }(Scope));
  18934. //# sourceMappingURL=ModulePage.js.map
  18935. var camundaModdleDescriptor = {
  18936. "name": "Camunda",
  18937. "uri": "http://camunda.org/schema/1.0/bpmn",
  18938. "prefix": "camunda",
  18939. "xml": {
  18940. "tagAlias": "lowerCase"
  18941. },
  18942. "associations": [],
  18943. "types": [
  18944. {
  18945. "name": "Definitions",
  18946. "isAbstract": true,
  18947. "extends": [
  18948. "bpmn:Definitions"
  18949. ],
  18950. "properties": [
  18951. {
  18952. "name": "diagramRelationId",
  18953. "isAttr": true,
  18954. "type": "String"
  18955. }
  18956. ]
  18957. },
  18958. {
  18959. "name": "InOutBinding",
  18960. "superClass": [
  18961. "Element"
  18962. ],
  18963. "isAbstract": true,
  18964. "properties": [
  18965. {
  18966. "name": "source",
  18967. "isAttr": true,
  18968. "type": "String"
  18969. },
  18970. {
  18971. "name": "sourceExpression",
  18972. "isAttr": true,
  18973. "type": "String"
  18974. },
  18975. {
  18976. "name": "target",
  18977. "isAttr": true,
  18978. "type": "String"
  18979. },
  18980. {
  18981. "name": "businessKey",
  18982. "isAttr": true,
  18983. "type": "String"
  18984. },
  18985. {
  18986. "name": "local",
  18987. "isAttr": true,
  18988. "type": "Boolean",
  18989. "default": false
  18990. },
  18991. {
  18992. "name": "variables",
  18993. "isAttr": true,
  18994. "type": "String"
  18995. }
  18996. ]
  18997. },
  18998. {
  18999. "name": "In",
  19000. "superClass": [
  19001. "InOutBinding"
  19002. ],
  19003. "meta": {
  19004. "allowedIn": [
  19005. "bpmn:CallActivity",
  19006. "bpmn:SignalEventDefinition"
  19007. ]
  19008. }
  19009. },
  19010. {
  19011. "name": "Out",
  19012. "superClass": [
  19013. "InOutBinding"
  19014. ],
  19015. "meta": {
  19016. "allowedIn": [
  19017. "bpmn:CallActivity"
  19018. ]
  19019. }
  19020. },
  19021. {
  19022. "name": "AsyncCapable",
  19023. "isAbstract": true,
  19024. "extends": [
  19025. "bpmn:Activity",
  19026. "bpmn:Gateway",
  19027. "bpmn:Event"
  19028. ],
  19029. "properties": [
  19030. {
  19031. "name": "async",
  19032. "isAttr": true,
  19033. "type": "Boolean",
  19034. "default": false
  19035. },
  19036. {
  19037. "name": "asyncBefore",
  19038. "isAttr": true,
  19039. "type": "Boolean",
  19040. "default": false
  19041. },
  19042. {
  19043. "name": "asyncAfter",
  19044. "isAttr": true,
  19045. "type": "Boolean",
  19046. "default": false
  19047. },
  19048. {
  19049. "name": "exclusive",
  19050. "isAttr": true,
  19051. "type": "Boolean",
  19052. "default": true
  19053. }
  19054. ]
  19055. },
  19056. {
  19057. "name": "JobPriorized",
  19058. "isAbstract": true,
  19059. "extends": [
  19060. "bpmn:Process",
  19061. "camunda:AsyncCapable"
  19062. ],
  19063. "properties": [
  19064. {
  19065. "name": "jobPriority",
  19066. "isAttr": true,
  19067. "type": "String"
  19068. }
  19069. ]
  19070. },
  19071. {
  19072. "name": "SignalEventDefinitionExtension",
  19073. "isAbstract": true,
  19074. "extends": [
  19075. "bpmn:SignalEventDefinition"
  19076. ],
  19077. "properties": [
  19078. {
  19079. "name": "async",
  19080. "isAttr": true,
  19081. "type": "Boolean",
  19082. "default": false
  19083. }
  19084. ]
  19085. },
  19086. {
  19087. "name": "ErrorEventDefinitionExtension",
  19088. "isAbstract": true,
  19089. "extends": [
  19090. "bpmn:ErrorEventDefinition"
  19091. ],
  19092. "properties": [
  19093. {
  19094. "name": "errorCodeVariable",
  19095. "isAttr": true,
  19096. "type": "String"
  19097. },
  19098. {
  19099. "name": "errorMessageVariable",
  19100. "isAttr": true,
  19101. "type": "String"
  19102. }
  19103. ]
  19104. },
  19105. {
  19106. "name": "ErrorEventDefinition",
  19107. "superClass": [
  19108. "bpmn:ErrorEventDefinition",
  19109. "Element"
  19110. ],
  19111. "properties": [
  19112. {
  19113. "name": "expression",
  19114. "isAttr": true,
  19115. "type": "String"
  19116. }
  19117. ],
  19118. "meta": {
  19119. "allowedIn": ["bpmn:ServiceTask"]
  19120. }
  19121. },
  19122. {
  19123. "name": "Error",
  19124. "isAbstract": true,
  19125. "extends": [
  19126. "bpmn:Error"
  19127. ],
  19128. "properties": [
  19129. {
  19130. "name": "camunda:errorMessage",
  19131. "isAttr": true,
  19132. "type": "String"
  19133. }
  19134. ]
  19135. },
  19136. {
  19137. "name": "PotentialStarter",
  19138. "superClass": [
  19139. "Element"
  19140. ],
  19141. "properties": [
  19142. {
  19143. "name": "resourceAssignmentExpression",
  19144. "type": "bpmn:ResourceAssignmentExpression"
  19145. }
  19146. ]
  19147. },
  19148. {
  19149. "name": "FormSupported",
  19150. "isAbstract": true,
  19151. "extends": [
  19152. "bpmn:StartEvent",
  19153. "bpmn:UserTask"
  19154. ],
  19155. "properties": [
  19156. {
  19157. "name": "formHandlerClass",
  19158. "isAttr": true,
  19159. "type": "String"
  19160. },
  19161. {
  19162. "name": "formKey",
  19163. "isAttr": true,
  19164. "type": "String"
  19165. },
  19166. {
  19167. "name": "formRef",
  19168. "isAttr": true,
  19169. "type": "String"
  19170. },
  19171. {
  19172. "name": "formRefBinding",
  19173. "isAttr": true,
  19174. "type": "String"
  19175. },
  19176. {
  19177. "name": "formRefVersion",
  19178. "isAttr": true,
  19179. "type": "String"
  19180. }
  19181. ]
  19182. },
  19183. {
  19184. "name": "TemplateSupported",
  19185. "isAbstract": true,
  19186. "extends": [
  19187. "bpmn:Collaboration",
  19188. "bpmn:Process",
  19189. "bpmn:FlowElement"
  19190. ],
  19191. "properties": [
  19192. {
  19193. "name": "modelerTemplate",
  19194. "isAttr": true,
  19195. "type": "String"
  19196. },
  19197. {
  19198. "name": "modelerTemplateVersion",
  19199. "isAttr": true,
  19200. "type": "Integer"
  19201. }
  19202. ]
  19203. },
  19204. {
  19205. "name": "Initiator",
  19206. "isAbstract": true,
  19207. "extends": ["bpmn:StartEvent"],
  19208. "properties": [
  19209. {
  19210. "name": "initiator",
  19211. "isAttr": true,
  19212. "type": "String"
  19213. }
  19214. ]
  19215. },
  19216. {
  19217. "name": "ScriptTask",
  19218. "isAbstract": true,
  19219. "extends": [
  19220. "bpmn:ScriptTask"
  19221. ],
  19222. "properties": [
  19223. {
  19224. "name": "resultVariable",
  19225. "isAttr": true,
  19226. "type": "String"
  19227. },
  19228. {
  19229. "name": "resource",
  19230. "isAttr": true,
  19231. "type": "String"
  19232. }
  19233. ]
  19234. },
  19235. {
  19236. "name": "Process",
  19237. "isAbstract": true,
  19238. "extends": [
  19239. "bpmn:Process"
  19240. ],
  19241. "properties": [
  19242. {
  19243. "name": "candidateStarterGroups",
  19244. "isAttr": true,
  19245. "type": "String"
  19246. },
  19247. {
  19248. "name": "candidateStarterUsers",
  19249. "isAttr": true,
  19250. "type": "String"
  19251. },
  19252. {
  19253. "name": "versionTag",
  19254. "isAttr": true,
  19255. "type": "String"
  19256. },
  19257. {
  19258. "name": "historyTimeToLive",
  19259. "isAttr": true,
  19260. "type": "String"
  19261. },
  19262. {
  19263. "name": "isStartableInTasklist",
  19264. "isAttr": true,
  19265. "type": "Boolean",
  19266. "default": true
  19267. }
  19268. ]
  19269. },
  19270. {
  19271. "name": "EscalationEventDefinitionExtension",
  19272. "isAbstract": true,
  19273. "extends": [
  19274. "bpmn:EscalationEventDefinition"
  19275. ],
  19276. "properties": [
  19277. {
  19278. "name": "escalationCodeVariable",
  19279. "isAttr": true,
  19280. "type": "String"
  19281. }
  19282. ]
  19283. },
  19284. {
  19285. "name": "FormalExpression",
  19286. "isAbstract": true,
  19287. "extends": [
  19288. "bpmn:FormalExpression"
  19289. ],
  19290. "properties": [
  19291. {
  19292. "name": "resource",
  19293. "isAttr": true,
  19294. "type": "String"
  19295. }
  19296. ]
  19297. },
  19298. {
  19299. "name": "Assignable",
  19300. "extends": ["bpmn:UserTask"],
  19301. "properties": [
  19302. {
  19303. "name": "assignee",
  19304. "isAttr": true,
  19305. "type": "String"
  19306. },
  19307. {
  19308. "name": "candidateUsers",
  19309. "isAttr": true,
  19310. "type": "String"
  19311. },
  19312. {
  19313. "name": "candidateGroups",
  19314. "isAttr": true,
  19315. "type": "String"
  19316. },
  19317. {
  19318. "name": "dueDate",
  19319. "isAttr": true,
  19320. "type": "String"
  19321. },
  19322. {
  19323. "name": "followUpDate",
  19324. "isAttr": true,
  19325. "type": "String"
  19326. },
  19327. {
  19328. "name": "priority",
  19329. "isAttr": true,
  19330. "type": "String"
  19331. }
  19332. ]
  19333. },
  19334. {
  19335. "name": "CallActivity",
  19336. "extends": ["bpmn:CallActivity"],
  19337. "properties": [
  19338. {
  19339. "name": "calledElementBinding",
  19340. "isAttr": true,
  19341. "type": "String",
  19342. "default": "latest"
  19343. },
  19344. {
  19345. "name": "calledElementVersion",
  19346. "isAttr": true,
  19347. "type": "String"
  19348. },
  19349. {
  19350. "name": "calledElementVersionTag",
  19351. "isAttr": true,
  19352. "type": "String"
  19353. },
  19354. {
  19355. "name": "calledElementTenantId",
  19356. "isAttr": true,
  19357. "type": "String"
  19358. },
  19359. {
  19360. "name": "caseRef",
  19361. "isAttr": true,
  19362. "type": "String"
  19363. },
  19364. {
  19365. "name": "caseBinding",
  19366. "isAttr": true,
  19367. "type": "String",
  19368. "default": "latest"
  19369. },
  19370. {
  19371. "name": "caseVersion",
  19372. "isAttr": true,
  19373. "type": "String"
  19374. },
  19375. {
  19376. "name": "caseTenantId",
  19377. "isAttr": true,
  19378. "type": "String"
  19379. },
  19380. {
  19381. "name": "variableMappingClass",
  19382. "isAttr": true,
  19383. "type": "String"
  19384. },
  19385. {
  19386. "name": "variableMappingDelegateExpression",
  19387. "isAttr": true,
  19388. "type": "String"
  19389. }
  19390. ]
  19391. },
  19392. {
  19393. "name": "ServiceTaskLike",
  19394. "extends": [
  19395. "bpmn:ServiceTask",
  19396. "bpmn:BusinessRuleTask",
  19397. "bpmn:SendTask",
  19398. "bpmn:MessageEventDefinition"
  19399. ],
  19400. "properties": [
  19401. {
  19402. "name": "expression",
  19403. "isAttr": true,
  19404. "type": "String"
  19405. },
  19406. {
  19407. "name": "class",
  19408. "isAttr": true,
  19409. "type": "String"
  19410. },
  19411. {
  19412. "name": "delegateExpression",
  19413. "isAttr": true,
  19414. "type": "String"
  19415. },
  19416. {
  19417. "name": "resultVariable",
  19418. "isAttr": true,
  19419. "type": "String"
  19420. }
  19421. ]
  19422. },
  19423. {
  19424. "name": "DmnCapable",
  19425. "extends": [
  19426. "bpmn:BusinessRuleTask"
  19427. ],
  19428. "properties": [
  19429. {
  19430. "name": "decisionRef",
  19431. "isAttr": true,
  19432. "type": "String"
  19433. },
  19434. {
  19435. "name": "decisionRefBinding",
  19436. "isAttr": true,
  19437. "type": "String",
  19438. "default": "latest"
  19439. },
  19440. {
  19441. "name": "decisionRefVersion",
  19442. "isAttr": true,
  19443. "type": "String"
  19444. },
  19445. {
  19446. "name": "mapDecisionResult",
  19447. "isAttr": true,
  19448. "type": "String",
  19449. "default": "resultList"
  19450. },
  19451. {
  19452. "name": "decisionRefTenantId",
  19453. "isAttr": true,
  19454. "type": "String"
  19455. }
  19456. ]
  19457. },
  19458. {
  19459. "name": "ExternalCapable",
  19460. "extends": [
  19461. "camunda:ServiceTaskLike"
  19462. ],
  19463. "properties": [
  19464. {
  19465. "name": "type",
  19466. "isAttr": true,
  19467. "type": "String"
  19468. },
  19469. {
  19470. "name": "topic",
  19471. "isAttr": true,
  19472. "type": "String"
  19473. }
  19474. ]
  19475. },
  19476. {
  19477. "name": "TaskPriorized",
  19478. "extends": [
  19479. "bpmn:Process",
  19480. "camunda:ExternalCapable"
  19481. ],
  19482. "properties": [
  19483. {
  19484. "name": "taskPriority",
  19485. "isAttr": true,
  19486. "type": "String"
  19487. }
  19488. ]
  19489. },
  19490. {
  19491. "name": "Properties",
  19492. "superClass": [
  19493. "Element"
  19494. ],
  19495. "meta": {
  19496. "allowedIn": ["*"]
  19497. },
  19498. "properties": [
  19499. {
  19500. "name": "values",
  19501. "type": "Property",
  19502. "isMany": true
  19503. }
  19504. ]
  19505. },
  19506. {
  19507. "name": "Property",
  19508. "superClass": [
  19509. "Element"
  19510. ],
  19511. "properties": [
  19512. {
  19513. "name": "id",
  19514. "type": "String",
  19515. "isAttr": true
  19516. },
  19517. {
  19518. "name": "name",
  19519. "type": "String",
  19520. "isAttr": true
  19521. },
  19522. {
  19523. "name": "value",
  19524. "type": "String",
  19525. "isAttr": true
  19526. }
  19527. ]
  19528. },
  19529. {
  19530. "name": "Connector",
  19531. "superClass": [
  19532. "Element"
  19533. ],
  19534. "meta": {
  19535. "allowedIn": [
  19536. "camunda:ServiceTaskLike"
  19537. ]
  19538. },
  19539. "properties": [
  19540. {
  19541. "name": "inputOutput",
  19542. "type": "InputOutput"
  19543. },
  19544. {
  19545. "name": "connectorId",
  19546. "type": "String"
  19547. }
  19548. ]
  19549. },
  19550. {
  19551. "name": "InputOutput",
  19552. "superClass": [
  19553. "Element"
  19554. ],
  19555. "meta": {
  19556. "allowedIn": [
  19557. "bpmn:FlowNode",
  19558. "camunda:Connector"
  19559. ]
  19560. },
  19561. "properties": [
  19562. {
  19563. "name": "inputOutput",
  19564. "type": "InputOutput"
  19565. },
  19566. {
  19567. "name": "connectorId",
  19568. "type": "String"
  19569. },
  19570. {
  19571. "name": "inputParameters",
  19572. "isMany": true,
  19573. "type": "InputParameter"
  19574. },
  19575. {
  19576. "name": "outputParameters",
  19577. "isMany": true,
  19578. "type": "OutputParameter"
  19579. }
  19580. ]
  19581. },
  19582. {
  19583. "name": "InputOutputParameter",
  19584. "properties": [
  19585. {
  19586. "name": "name",
  19587. "isAttr": true,
  19588. "type": "String"
  19589. },
  19590. {
  19591. "name": "value",
  19592. "isBody": true,
  19593. "type": "String"
  19594. },
  19595. {
  19596. "name": "definition",
  19597. "type": "InputOutputParameterDefinition"
  19598. }
  19599. ]
  19600. },
  19601. {
  19602. "name": "InputOutputParameterDefinition",
  19603. "isAbstract": true
  19604. },
  19605. {
  19606. "name": "List",
  19607. "superClass": ["InputOutputParameterDefinition"],
  19608. "properties": [
  19609. {
  19610. "name": "items",
  19611. "isMany": true,
  19612. "type": "InputOutputParameterDefinition"
  19613. }
  19614. ]
  19615. },
  19616. {
  19617. "name": "Map",
  19618. "superClass": ["InputOutputParameterDefinition"],
  19619. "properties": [
  19620. {
  19621. "name": "entries",
  19622. "isMany": true,
  19623. "type": "Entry"
  19624. }
  19625. ]
  19626. },
  19627. {
  19628. "name": "Entry",
  19629. "properties": [
  19630. {
  19631. "name": "key",
  19632. "isAttr": true,
  19633. "type": "String"
  19634. },
  19635. {
  19636. "name": "value",
  19637. "isBody": true,
  19638. "type": "String"
  19639. },
  19640. {
  19641. "name": "definition",
  19642. "type": "InputOutputParameterDefinition"
  19643. }
  19644. ]
  19645. },
  19646. {
  19647. "name": "Value",
  19648. "superClass": [
  19649. "InputOutputParameterDefinition"
  19650. ],
  19651. "properties": [
  19652. {
  19653. "name": "id",
  19654. "isAttr": true,
  19655. "type": "String"
  19656. },
  19657. {
  19658. "name": "name",
  19659. "isAttr": true,
  19660. "type": "String"
  19661. },
  19662. {
  19663. "name": "value",
  19664. "isBody": true,
  19665. "type": "String"
  19666. }
  19667. ]
  19668. },
  19669. {
  19670. "name": "Script",
  19671. "superClass": ["InputOutputParameterDefinition"],
  19672. "properties": [
  19673. {
  19674. "name": "scriptFormat",
  19675. "isAttr": true,
  19676. "type": "String"
  19677. },
  19678. {
  19679. "name": "resource",
  19680. "isAttr": true,
  19681. "type": "String"
  19682. },
  19683. {
  19684. "name": "value",
  19685. "isBody": true,
  19686. "type": "String"
  19687. }
  19688. ]
  19689. },
  19690. {
  19691. "name": "Field",
  19692. "superClass": ["Element"],
  19693. "meta": {
  19694. "allowedIn": [
  19695. "camunda:ServiceTaskLike",
  19696. "camunda:ExecutionListener",
  19697. "camunda:TaskListener"
  19698. ]
  19699. },
  19700. "properties": [
  19701. {
  19702. "name": "name",
  19703. "isAttr": true,
  19704. "type": "String"
  19705. },
  19706. {
  19707. "name": "expression",
  19708. "type": "String"
  19709. },
  19710. {
  19711. "name": "stringValue",
  19712. "isAttr": true,
  19713. "type": "String"
  19714. },
  19715. {
  19716. "name": "string",
  19717. "type": "String"
  19718. }
  19719. ]
  19720. },
  19721. {
  19722. "name": "InputParameter",
  19723. "superClass": ["InputOutputParameter"]
  19724. },
  19725. {
  19726. "name": "OutputParameter",
  19727. "superClass": ["InputOutputParameter"]
  19728. },
  19729. {
  19730. "name": "Collectable",
  19731. "isAbstract": true,
  19732. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  19733. "superClass": ["camunda:AsyncCapable"],
  19734. "properties": [
  19735. {
  19736. "name": "collection",
  19737. "isAttr": true,
  19738. "type": "String"
  19739. },
  19740. {
  19741. "name": "elementVariable",
  19742. "isAttr": true,
  19743. "type": "String"
  19744. }
  19745. ]
  19746. },
  19747. {
  19748. "name": "FailedJobRetryTimeCycle",
  19749. "superClass": ["Element"],
  19750. "meta": {
  19751. "allowedIn": [
  19752. "camunda:AsyncCapable",
  19753. "bpmn:MultiInstanceLoopCharacteristics"
  19754. ]
  19755. },
  19756. "properties": [
  19757. {
  19758. "name": "body",
  19759. "isBody": true,
  19760. "type": "String"
  19761. }
  19762. ]
  19763. },
  19764. {
  19765. "name": "ExecutionListener",
  19766. "superClass": ["Element"],
  19767. "meta": {
  19768. "allowedIn": [
  19769. "bpmn:Task",
  19770. "bpmn:ServiceTask",
  19771. "bpmn:UserTask",
  19772. "bpmn:BusinessRuleTask",
  19773. "bpmn:ScriptTask",
  19774. "bpmn:ReceiveTask",
  19775. "bpmn:ManualTask",
  19776. "bpmn:ExclusiveGateway",
  19777. "bpmn:SequenceFlow",
  19778. "bpmn:ParallelGateway",
  19779. "bpmn:InclusiveGateway",
  19780. "bpmn:EventBasedGateway",
  19781. "bpmn:StartEvent",
  19782. "bpmn:IntermediateCatchEvent",
  19783. "bpmn:IntermediateThrowEvent",
  19784. "bpmn:EndEvent",
  19785. "bpmn:BoundaryEvent",
  19786. "bpmn:CallActivity",
  19787. "bpmn:SubProcess",
  19788. "bpmn:Process"
  19789. ]
  19790. },
  19791. "properties": [
  19792. {
  19793. "name": "expression",
  19794. "isAttr": true,
  19795. "type": "String"
  19796. },
  19797. {
  19798. "name": "class",
  19799. "isAttr": true,
  19800. "type": "String"
  19801. },
  19802. {
  19803. "name": "delegateExpression",
  19804. "isAttr": true,
  19805. "type": "String"
  19806. },
  19807. {
  19808. "name": "event",
  19809. "isAttr": true,
  19810. "type": "String"
  19811. },
  19812. {
  19813. "name": "script",
  19814. "type": "Script"
  19815. },
  19816. {
  19817. "name": "fields",
  19818. "type": "Field",
  19819. "isMany": true
  19820. }
  19821. ]
  19822. },
  19823. {
  19824. "name": "TaskListener",
  19825. "superClass": ["Element"],
  19826. "meta": {
  19827. "allowedIn": [
  19828. "bpmn:UserTask"
  19829. ]
  19830. },
  19831. "properties": [
  19832. {
  19833. "name": "expression",
  19834. "isAttr": true,
  19835. "type": "String"
  19836. },
  19837. {
  19838. "name": "class",
  19839. "isAttr": true,
  19840. "type": "String"
  19841. },
  19842. {
  19843. "name": "delegateExpression",
  19844. "isAttr": true,
  19845. "type": "String"
  19846. },
  19847. {
  19848. "name": "event",
  19849. "isAttr": true,
  19850. "type": "String"
  19851. },
  19852. {
  19853. "name": "script",
  19854. "type": "Script"
  19855. },
  19856. {
  19857. "name": "fields",
  19858. "type": "Field",
  19859. "isMany": true
  19860. },
  19861. {
  19862. "name": "id",
  19863. "type": "String",
  19864. "isAttr": true
  19865. },
  19866. {
  19867. "name": "eventDefinitions",
  19868. "type": "bpmn:TimerEventDefinition",
  19869. "isMany": true
  19870. }
  19871. ]
  19872. },
  19873. {
  19874. "name": "FormProperty",
  19875. "superClass": ["Element"],
  19876. "meta": {
  19877. "allowedIn": [
  19878. "bpmn:StartEvent",
  19879. "bpmn:UserTask"
  19880. ]
  19881. },
  19882. "properties": [
  19883. {
  19884. "name": "id",
  19885. "type": "String",
  19886. "isAttr": true
  19887. },
  19888. {
  19889. "name": "name",
  19890. "type": "String",
  19891. "isAttr": true
  19892. },
  19893. {
  19894. "name": "type",
  19895. "type": "String",
  19896. "isAttr": true
  19897. },
  19898. {
  19899. "name": "required",
  19900. "type": "String",
  19901. "isAttr": true
  19902. },
  19903. {
  19904. "name": "readable",
  19905. "type": "String",
  19906. "isAttr": true
  19907. },
  19908. {
  19909. "name": "writable",
  19910. "type": "String",
  19911. "isAttr": true
  19912. },
  19913. {
  19914. "name": "variable",
  19915. "type": "String",
  19916. "isAttr": true
  19917. },
  19918. {
  19919. "name": "expression",
  19920. "type": "String",
  19921. "isAttr": true
  19922. },
  19923. {
  19924. "name": "datePattern",
  19925. "type": "String",
  19926. "isAttr": true
  19927. },
  19928. {
  19929. "name": "default",
  19930. "type": "String",
  19931. "isAttr": true
  19932. },
  19933. {
  19934. "name": "values",
  19935. "type": "Value",
  19936. "isMany": true
  19937. }
  19938. ]
  19939. },
  19940. {
  19941. "name": "FormData",
  19942. "superClass": ["Element"],
  19943. "meta": {
  19944. "allowedIn": [
  19945. "bpmn:StartEvent",
  19946. "bpmn:UserTask"
  19947. ]
  19948. },
  19949. "properties": [
  19950. {
  19951. "name": "fields",
  19952. "type": "FormField",
  19953. "isMany": true
  19954. },
  19955. {
  19956. "name": "businessKey",
  19957. "type": "String",
  19958. "isAttr": true
  19959. }
  19960. ]
  19961. },
  19962. {
  19963. "name": "FormField",
  19964. "superClass": ["Element"],
  19965. "properties": [
  19966. {
  19967. "name": "id",
  19968. "type": "String",
  19969. "isAttr": true
  19970. },
  19971. {
  19972. "name": "label",
  19973. "type": "String",
  19974. "isAttr": true
  19975. },
  19976. {
  19977. "name": "type",
  19978. "type": "String",
  19979. "isAttr": true
  19980. },
  19981. {
  19982. "name": "datePattern",
  19983. "type": "String",
  19984. "isAttr": true
  19985. },
  19986. {
  19987. "name": "defaultValue",
  19988. "type": "String",
  19989. "isAttr": true
  19990. },
  19991. {
  19992. "name": "properties",
  19993. "type": "Properties"
  19994. },
  19995. {
  19996. "name": "validation",
  19997. "type": "Validation"
  19998. },
  19999. {
  20000. "name": "values",
  20001. "type": "Value",
  20002. "isMany": true
  20003. }
  20004. ]
  20005. },
  20006. {
  20007. "name": "Validation",
  20008. "superClass": ["Element"],
  20009. "properties": [
  20010. {
  20011. "name": "constraints",
  20012. "type": "Constraint",
  20013. "isMany": true
  20014. }
  20015. ]
  20016. },
  20017. {
  20018. "name": "Constraint",
  20019. "superClass": ["Element"],
  20020. "properties": [
  20021. {
  20022. "name": "name",
  20023. "type": "String",
  20024. "isAttr": true
  20025. },
  20026. {
  20027. "name": "config",
  20028. "type": "String",
  20029. "isAttr": true
  20030. }
  20031. ]
  20032. },
  20033. {
  20034. "name": "ConditionalEventDefinitionExtension",
  20035. "isAbstract": true,
  20036. "extends": [
  20037. "bpmn:ConditionalEventDefinition"
  20038. ],
  20039. "properties": [
  20040. {
  20041. "name": "variableName",
  20042. "isAttr": true,
  20043. "type": "String"
  20044. },
  20045. {
  20046. "name": "variableEvents",
  20047. "isAttr": true,
  20048. "type": "String"
  20049. }
  20050. ]
  20051. }
  20052. ],
  20053. "emumerations": []
  20054. };
  20055. //# sourceMappingURL=camundaModdleDescriptor.js.map
  20056. /**
  20057. * This is a sample file that should be replaced with the actual translation.
  20058. *
  20059. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  20060. * translations and labels to translate.
  20061. */
  20062. var translations = {
  20063. // Labels
  20064. 'Activate the global connect tool': '激活全局连接工具',
  20065. 'Append {type}': '追加 {type}',
  20066. 'Append EndEvent': '追加 结束事件 ',
  20067. 'Append Task': '追加 任务',
  20068. 'Append Gateway': '追加 网关',
  20069. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  20070. 'Add Lane above': '在上面添加道',
  20071. 'Divide into two Lanes': '分割成两个道',
  20072. 'Divide into three Lanes': '分割成三个道',
  20073. 'Add Lane below': '在下面添加道',
  20074. 'Append compensation activity': '追加补偿活动',
  20075. 'Change type': '修改类型',
  20076. 'Connect using Association': '使用关联连接',
  20077. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  20078. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  20079. 'Remove': '移除',
  20080. 'Activate the hand tool': '激活抓手工具',
  20081. 'Activate the lasso tool': '激活套索工具',
  20082. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  20083. 'Create expanded SubProcess': '创建扩展子过程',
  20084. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  20085. 'Create Pool/Participant': '创建池/参与者',
  20086. 'Parallel Multi Instance': '并行多重事件',
  20087. 'Sequential Multi Instance': '时序多重事件',
  20088. 'DataObjectReference': '数据对象参考',
  20089. 'DataStoreReference': '数据存储参考',
  20090. 'Loop': '循环',
  20091. 'Ad-hoc': '即席',
  20092. 'Create {type}': '创建 {type}',
  20093. 'Create Task': '创建任务',
  20094. 'Create StartEvent': '创建开始事件',
  20095. 'Create EndEvent': '创建结束事件',
  20096. 'Create Group': '创建组',
  20097. 'Task': '任务',
  20098. 'Send Task': '发送任务',
  20099. 'Receive Task': '接收任务',
  20100. 'User Task': '用户任务',
  20101. 'Manual Task': '手工任务',
  20102. 'Business Rule Task': '业务规则任务',
  20103. 'Service Task': '服务任务',
  20104. 'Script Task': '脚本任务',
  20105. 'Call Activity': '调用活动',
  20106. 'Sub Process (collapsed)': '子流程(折叠的)',
  20107. 'Sub Process (expanded)': '子流程(展开的)',
  20108. 'Start Event': '开始事件',
  20109. 'StartEvent': '开始事件',
  20110. 'Intermediate Throw Event': '中间事件',
  20111. 'End Event': '结束事件',
  20112. 'EndEvent': '结束事件',
  20113. 'Create Gateway': '创建网关',
  20114. 'GateWay': '网关',
  20115. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  20116. 'Message Start Event': '消息开始事件',
  20117. 'Timer Start Event': '定时开始事件',
  20118. 'Conditional Start Event': '条件开始事件',
  20119. 'Signal Start Event': '信号开始事件',
  20120. 'Error Start Event': '错误开始事件',
  20121. 'Escalation Start Event': '升级开始事件',
  20122. 'Compensation Start Event': '补偿开始事件',
  20123. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  20124. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  20125. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  20126. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  20127. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  20128. 'Message Intermediate Catch Event': '消息中间捕获事件',
  20129. 'Message Intermediate Throw Event': '消息中间抛出事件',
  20130. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  20131. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  20132. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  20133. 'Link Intermediate Catch Event': '链接中间捕获事件',
  20134. 'Link Intermediate Throw Event': '链接中间抛出事件',
  20135. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  20136. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  20137. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  20138. 'Message End Event': '消息结束事件',
  20139. 'Escalation End Event': '定时结束事件',
  20140. 'Error End Event': '错误结束事件',
  20141. 'Cancel End Event': '取消结束事件',
  20142. 'Compensation End Event': '补偿结束事件',
  20143. 'Signal End Event': '信号结束事件',
  20144. 'Terminate End Event': '终止结束事件',
  20145. 'Message Boundary Event': '消息边界事件',
  20146. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  20147. 'Timer Boundary Event': '定时边界事件',
  20148. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  20149. 'Escalation Boundary Event': '升级边界事件',
  20150. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  20151. 'Conditional Boundary Event': '条件边界事件',
  20152. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  20153. 'Error Boundary Event': '错误边界事件',
  20154. 'Cancel Boundary Event': '取消边界事件',
  20155. 'Signal Boundary Event': '信号边界事件',
  20156. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  20157. 'Compensation Boundary Event': '补偿边界事件',
  20158. 'Exclusive Gateway': '互斥网关',
  20159. 'Parallel Gateway': '并行网关',
  20160. 'Inclusive Gateway': '相容网关',
  20161. 'Complex Gateway': '复杂网关',
  20162. 'Event based Gateway': '事件网关',
  20163. 'Transaction': '转运',
  20164. 'Sub Process': '子流程',
  20165. 'Event Sub Process': '事件子流程',
  20166. 'Collapsed Pool': '折叠池',
  20167. 'Expanded Pool': '展开池',
  20168. // Errors
  20169. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  20170. 'no shape type specified': '没有指定的形状类型',
  20171. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  20172. 'out of bounds release': 'out of bounds release',
  20173. 'more than {count} child lanes': '子道大于{count} ',
  20174. 'element required': '元素不能为空',
  20175. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  20176. 'no diagram to display': '没有可展示的流程图',
  20177. 'no process or collaboration to display': '没有可展示的流程/协作',
  20178. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  20179. 'already rendered {element}': '{element} 已被渲染',
  20180. 'failed to import {element}': '导入{element}失败',
  20181. // 属性面板的参数
  20182. 'Id': '编号',
  20183. 'Name': '名称',
  20184. 'General': '常规',
  20185. 'Details': '详情',
  20186. 'Message Name': '消息名称',
  20187. 'Message': '消息',
  20188. 'Initiator': '创建者',
  20189. 'Asynchronous Continuations': '持续异步',
  20190. 'Asynchronous Before': '异步前',
  20191. 'Asynchronous After': '异步后',
  20192. 'Job Configuration': '工作配置',
  20193. 'Exclusive': '排除',
  20194. 'Job Priority': '工作优先级',
  20195. 'Retry Time Cycle': '重试时间周期',
  20196. 'Documentation': '文档',
  20197. 'Element Documentation': '元素文档',
  20198. 'History Configuration': '历史配置',
  20199. 'History Time To Live': '历史的生存时间',
  20200. 'Forms': '表单',
  20201. 'Form Key': '表单key',
  20202. 'Form Fields': '表单字段',
  20203. 'Business Key': '业务key',
  20204. 'Form Field': '表单字段',
  20205. 'ID': '编号',
  20206. 'Type': '类型',
  20207. 'Label': '名称',
  20208. 'Default Value': '默认值',
  20209. 'Validation': '校验',
  20210. 'Add Constraint': '添加约束',
  20211. 'Config': '配置',
  20212. 'Properties': '属性',
  20213. 'Add Property': '添加属性',
  20214. 'Value': '值',
  20215. 'Add': '添加',
  20216. 'Values': '值',
  20217. 'Add Value': '添加值',
  20218. 'Listeners': '监听器',
  20219. 'Execution Listener': '执行监听',
  20220. 'Event Type': '事件类型',
  20221. 'Listener Type': '监听器类型',
  20222. 'Java Class': 'Java类',
  20223. 'Expression': '表达式',
  20224. 'Must provide a value': '必须提供一个值',
  20225. 'Delegate Expression': '代理表达式',
  20226. 'Script': '脚本',
  20227. 'Script Format': '脚本格式',
  20228. 'Script Type': '脚本类型',
  20229. 'Inline Script': '内联脚本',
  20230. 'External Script': '外部脚本',
  20231. 'Resource': '资源',
  20232. 'Field Injection': '字段注入',
  20233. 'Extensions': '扩展',
  20234. 'Input/Output': '输入/输出',
  20235. 'Input Parameters': '输入参数',
  20236. 'Output Parameters': '输出参数',
  20237. 'Parameters': '参数',
  20238. 'Output Parameter': '输出参数',
  20239. 'Timer Definition Type': '定时器定义类型',
  20240. 'Timer Definition': '定时器定义',
  20241. 'Date': '日期',
  20242. 'Duration': '持续',
  20243. 'Cycle': '循环',
  20244. 'Signal': '信号',
  20245. 'Signal Name': '信号名称',
  20246. 'Escalation': '升级',
  20247. 'Error': '错误',
  20248. 'Link Name': '链接名称',
  20249. 'Condition': '条件名称',
  20250. 'Variable Name': '变量名称',
  20251. 'Variable Event': '变量事件',
  20252. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  20253. 'Wait for Completion': '等待完成',
  20254. 'Activity Ref': '活动参考',
  20255. 'Version Tag': '版本标签',
  20256. 'Executable': '可执行文件',
  20257. 'External Task Configuration': '扩展任务配置',
  20258. 'Task Priority': '任务优先级',
  20259. 'External': '外部',
  20260. 'Connector': '连接器',
  20261. 'Must configure Connector': '必须配置连接器',
  20262. 'Connector Id': '连接器编号',
  20263. 'Implementation': '实现方式',
  20264. 'Field Injections': '字段注入',
  20265. 'Fields': '字段',
  20266. 'Result Variable': '结果变量',
  20267. 'Topic': '主题',
  20268. 'Configure Connector': '配置连接器',
  20269. 'Input Parameter': '输入参数',
  20270. 'Assignee': '代理人',
  20271. 'Candidate Users': '候选用户',
  20272. 'Candidate Groups': '候选组',
  20273. 'Due Date': '到期时间',
  20274. 'Follow Up Date': '跟踪日期',
  20275. 'Priority': '优先级',
  20276. // eslint-disable-next-line no-template-curly-in-string
  20277. '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',
  20278. // eslint-disable-next-line no-template-curly-in-string
  20279. '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',
  20280. 'Variables': '变量',
  20281. 'Candidate Starter Configuration': '候选开始配置',
  20282. 'Task Listener': '任务监听器',
  20283. 'Candidate Starter Groups': '候选开始组',
  20284. 'Candidate Starter Users': '候选开始用户',
  20285. 'Tasklist Configuration': '任务列表配置',
  20286. 'Startable': '启动',
  20287. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  20288. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  20289. 'This maps to the process definition key.': '这会映射为流程定义的键',
  20290. 'CallActivity Type': '调用活动类型',
  20291. 'Condition Type': '条件类型',
  20292. 'Create UserTask': '创建用户任务',
  20293. 'Create CallActivity': '创建调用活动',
  20294. 'Called Element': '调用元素',
  20295. 'Create DataObjectReference': '创建数据对象引用',
  20296. 'Create DataStoreReference': '创建数据存储引用',
  20297. 'Multi Instance': '多实例',
  20298. 'Loop Cardinality': '实例数量',
  20299. Collection: '任务参与人列表',
  20300. 'Element Variable': '元素变量',
  20301. 'Completion Condition': '完成条件'
  20302. };
  20303. //# sourceMappingURL=translations.js.map
  20304. function customTranslate(template, replacements) {
  20305. replacements = replacements || {};
  20306. // Translate
  20307. template = translations[template] || template;
  20308. // Replace
  20309. return template.replace(/{([^}]+)}/g, function (_, key) {
  20310. return replacements[key] || '{' + key + '}';
  20311. });
  20312. }
  20313. //# sourceMappingURL=customTranslate.js.map
  20314. var vjson$l = {
  20315. title: '导入流程',
  20316. layout: 'fit',
  20317. width: 400,
  20318. height: 400,
  20319. items: [
  20320. {
  20321. layout: 'border',
  20322. items: [
  20323. {
  20324. xtype: 'form',
  20325. items: [
  20326. // {
  20327. // xtype: 'cols',
  20328. // items: [
  20329. // {
  20330. // xtype: 'textfield',
  20331. // allowBlank: false,
  20332. // fieldLabel: '流程名称',
  20333. // bind: '{name}'
  20334. // },
  20335. // ],
  20336. // },
  20337. {
  20338. xtype: 'cols',
  20339. items: [
  20340. {
  20341. xtype: 'filefield',
  20342. name: 'deployFile',
  20343. fieldLabel: '文件名称',
  20344. // labelWidth: '100%',
  20345. msgTarget: 'side',
  20346. reference: 'MOBANB_FILE',
  20347. fileUpload: true,
  20348. allowBlank: false,
  20349. // flex: 1,
  20350. // width: '100%',
  20351. buttonText: '请选择文件位置',
  20352. listeners: {
  20353. change: 'scope.fileChange'
  20354. }
  20355. // bind: '{FILE}'
  20356. },
  20357. ]
  20358. }
  20359. ],
  20360. region: 'center',
  20361. split: true,
  20362. },
  20363. ],
  20364. },
  20365. ],
  20366. fbar: {
  20367. xtype: 'toolbar',
  20368. items: [
  20369. {
  20370. xtype: 'button',
  20371. text: '保存',
  20372. iconCls: 'x-fa fa-save',
  20373. listeners: {
  20374. click: 'scope.save',
  20375. },
  20376. }
  20377. ],
  20378. },
  20379. };
  20380. //# sourceMappingURL=ImportBpmn.view.js.map
  20381. var model$l = {
  20382. data: {
  20383. name: '',
  20384. file_content: ''
  20385. }
  20386. };
  20387. //# sourceMappingURL=ImportBpmn.model.js.map
  20388. var ImportBpmn = /** @class */ (function (_super) {
  20389. __extends(ImportBpmn, _super);
  20390. function ImportBpmn() {
  20391. return _super.call(this, { model: model$l, vjson: vjson$l }) || this;
  20392. }
  20393. ImportBpmn.prototype.onLoad = function () {
  20394. };
  20395. ImportBpmn.prototype.save = function (sender) {
  20396. if (this.data.file_content) {
  20397. this.dialogSuccess(this.data);
  20398. }
  20399. else {
  20400. Ext.Msg.alert('提示', "请先上传文件");
  20401. }
  20402. };
  20403. ImportBpmn.prototype.fileChange = function (e) {
  20404. var _this = this;
  20405. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  20406. var file = e.fileInputEl.dom.files[0]; //获取文件
  20407. var reader = new FileReader();
  20408. reader.readAsText(file, "UTF-8");
  20409. reader.onload = function () {
  20410. _this.data.file_content = reader.result;
  20411. };
  20412. };
  20413. return ImportBpmn;
  20414. }(Scope));
  20415. //# sourceMappingURL=ImportBpmn.js.map
  20416. var model$m = {
  20417. data: {
  20418. form_id: '',
  20419. form_name: '',
  20420. save_dir_path: '',
  20421. absolute_path: '',
  20422. form: {
  20423. id: '',
  20424. code: '',
  20425. name: '',
  20426. table: '',
  20427. controller: '',
  20428. groovy: '',
  20429. fields: [],
  20430. buttons: [],
  20431. },
  20432. }
  20433. };
  20434. //# sourceMappingURL=ConfigStrategy.model.js.map
  20435. var vjson$m = {
  20436. title: '配置适配策略',
  20437. layout: 'fit',
  20438. items: [
  20439. {
  20440. layout: 'border',
  20441. items: [
  20442. {
  20443. region: 'center',
  20444. xtype: 'yvgrid',
  20445. pagination: false,
  20446. hideFootbar: true,
  20447. plugins: {
  20448. clipboard: true,
  20449. selectionreplicator: true
  20450. },
  20451. tbar: {
  20452. xtype: 'toolbar',
  20453. items: [
  20454. {
  20455. xtype: 'button',
  20456. text: '添加策略',
  20457. iconCls: 'x-fa fa-plus-circle',
  20458. listeners: {
  20459. click: 'scope.addStrategy'
  20460. }
  20461. },
  20462. {
  20463. xtype: 'button',
  20464. text: '删除',
  20465. iconCls: 'x-fa fa-minus-circle',
  20466. listeners: {}
  20467. },
  20468. '-',
  20469. {
  20470. xtype: 'button',
  20471. text: '上移',
  20472. iconCls: 'x-fa fa-arrow-up',
  20473. listeners: {}
  20474. },
  20475. {
  20476. xtype: 'button',
  20477. text: '下移',
  20478. iconCls: 'x-fa fa-arrow-down',
  20479. listeners: {}
  20480. },
  20481. ]
  20482. },
  20483. columns: [
  20484. { xtype: 'rownumberer' },
  20485. {
  20486. header: '优先级',
  20487. dataIndex: 'priority',
  20488. width: 140,
  20489. sortable: false,
  20490. menuDisabled: true,
  20491. editor: {
  20492. selectOnFocus: true
  20493. },
  20494. },
  20495. {
  20496. header: '策略编号',
  20497. dataIndex: 'strategy_code',
  20498. width: 140,
  20499. sortable: false,
  20500. menuDisabled: true,
  20501. editor: {
  20502. selectOnFocus: true
  20503. },
  20504. },
  20505. {
  20506. header: '策略名称',
  20507. dataIndex: 'strategy_name',
  20508. width: 140,
  20509. sortable: false,
  20510. menuDisabled: true,
  20511. editor: {
  20512. selectOnFocus: true
  20513. },
  20514. },
  20515. {
  20516. header: "条件表达式",
  20517. dataIndex: "strategy_exp",
  20518. },
  20519. ],
  20520. },
  20521. {
  20522. title: '适配条件',
  20523. region: 'south',
  20524. height: '50%',
  20525. xtype: 'form',
  20526. items: [
  20527. {
  20528. xtype: 'cols',
  20529. items: [
  20530. {
  20531. xtype: 'rows',
  20532. items: [
  20533. {
  20534. xtype: 'textfield',
  20535. fieldLabel: "仓库",
  20536. },
  20537. {
  20538. xtype: 'textfield',
  20539. fieldLabel: "货主",
  20540. },
  20541. {
  20542. xtype: 'textfield',
  20543. fieldLabel: "项目",
  20544. },
  20545. {
  20546. xtype: 'textfield',
  20547. fieldLabel: "行政区划",
  20548. },
  20549. {
  20550. xtype: 'textfield',
  20551. fieldLabel: "客户",
  20552. },
  20553. {
  20554. xtype: 'textfield',
  20555. fieldLabel: "商品",
  20556. }
  20557. ]
  20558. },
  20559. {
  20560. xtype: 'rows',
  20561. margin: '8 0 0 10',
  20562. items: [
  20563. {
  20564. xtype: 'label',
  20565. html: '自定义表达式',
  20566. },
  20567. {
  20568. xtype: 'textarea',
  20569. }
  20570. ]
  20571. }
  20572. ]
  20573. }
  20574. ]
  20575. }
  20576. ]
  20577. }
  20578. ]
  20579. };
  20580. //
  20581. //# sourceMappingURL=ConfigStrategy.view.js.map
  20582. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  20583. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  20584. // import ReportRunner from "./ReportRunner";
  20585. var ConfigStrategy = /** @class */ (function (_super) {
  20586. __extends(ConfigStrategy, _super);
  20587. function ConfigStrategy() {
  20588. return _super.call(this, { model: model$m, vjson: vjson$m }) || this;
  20589. }
  20590. ConfigStrategy.prototype.onLoad = function () {
  20591. this.load();
  20592. };
  20593. ConfigStrategy.prototype.load = function () {
  20594. var _this = this;
  20595. var form_id = this.viewModel.get("form_id");
  20596. var absolute_path = this.viewModel.get("absolute_path");
  20597. var save_dir_path = this.viewModel.get("save_dir_path");
  20598. if (absolute_path && form_id) {
  20599. this.setLoading(true);
  20600. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  20601. if (res.success) {
  20602. // 基础属性
  20603. _this.viewModel.set('form', res.data.form);
  20604. // 字段定义
  20605. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  20606. // 按钮
  20607. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  20608. }
  20609. }).finally(function () {
  20610. _this.setLoading(false);
  20611. });
  20612. }
  20613. };
  20614. ConfigStrategy.prototype.saveAll = function () {
  20615. var _this = this;
  20616. var save_dir_path = this.viewModel.get("save_dir_path");
  20617. if (!save_dir_path) {
  20618. msg("save_dir_path error");
  20619. return;
  20620. }
  20621. var form_id = this.viewModel.get("form_id");
  20622. var absolute_path = this.viewModel.get("absolute_path");
  20623. // 表格校验
  20624. if (!this.refs.form1.isValid()) {
  20625. msg("请检查表单必填项!");
  20626. return;
  20627. }
  20628. // 字段数据
  20629. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  20630. delete item.id;
  20631. if (item.hide) {
  20632. delete item.hide_text;
  20633. }
  20634. else {
  20635. item.hide = item.hide_text;
  20636. delete item.hide_text;
  20637. }
  20638. if (item.readonly) {
  20639. delete item.readonly_text;
  20640. }
  20641. else {
  20642. item.readonly = item.readonly_text;
  20643. delete item.readonly_text;
  20644. }
  20645. if (item.disabled) {
  20646. delete item.disabled_text;
  20647. }
  20648. else {
  20649. item.disabled = item.disabled_text;
  20650. delete item.disabled_text;
  20651. }
  20652. if (item.required) {
  20653. delete item.required_text;
  20654. }
  20655. else {
  20656. item.required = item.required_text;
  20657. delete item.required_text;
  20658. }
  20659. return item;
  20660. });
  20661. this.viewModel.set("form.fields", gridColumnRows);
  20662. // 按钮数据
  20663. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  20664. delete item.id;
  20665. return item;
  20666. });
  20667. this.viewModel.set("form.buttons", gridBtnRows);
  20668. // 查询条件
  20669. // 策略
  20670. var form = this.viewModel.get("form");
  20671. this.setLoading(true);
  20672. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  20673. if (res.success) {
  20674. msg('保存成功');
  20675. handles$1.mainWindow.refs['exporerTree'].reload();
  20676. }
  20677. }).finally(function () {
  20678. _this.setLoading(false);
  20679. });
  20680. };
  20681. ConfigStrategy.prototype.addColumn = function () {
  20682. this.refs.gridColumn.getStore().add({});
  20683. };
  20684. ConfigStrategy.prototype.removeColumn = function () {
  20685. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  20686. };
  20687. ConfigStrategy.prototype.calcColumn = function (sender) {
  20688. var _this = this;
  20689. var table = this.viewModel.get("form.table");
  20690. if (!table) {
  20691. msg("表名不存在!");
  20692. return;
  20693. }
  20694. this.setLoading(true);
  20695. calcColumnForm({ table: table }).then(function (res) {
  20696. if (res.success) {
  20697. msg(res.msg);
  20698. if (res.data.columns.length > 0) {
  20699. _$2.forEach(res.data.columns, function (it) {
  20700. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  20701. });
  20702. }
  20703. }
  20704. }).finally(function () {
  20705. _this.setLoading(false);
  20706. });
  20707. };
  20708. ConfigStrategy.prototype.addButton = function () {
  20709. this.refs.gridButton.getStore().add({});
  20710. };
  20711. ConfigStrategy.prototype.moveUp = function (sender) {
  20712. var grid = sender.up('grid');
  20713. grid.rowMoveUp();
  20714. };
  20715. ConfigStrategy.prototype.moveDown = function (sender) {
  20716. var grid = sender.up('grid');
  20717. grid.rowMoveDown();
  20718. };
  20719. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  20720. var win = new Ext.Window({
  20721. autoDestroy: true,
  20722. title: "添加(编辑)策略",
  20723. width: 400,
  20724. height: 300,
  20725. resizable: true,
  20726. closable: true,
  20727. maximizable: true,
  20728. minimizable: true,
  20729. plain: true,
  20730. // constrainHeader: true,
  20731. constrain: true,
  20732. layout: 'fit',
  20733. animateTarget: sender,
  20734. buttonAlign: 'center',
  20735. items: [
  20736. {
  20737. xtype: "form",
  20738. layout: "hbox",
  20739. margin: '10px 20px',
  20740. border: 0,
  20741. items: [
  20742. {
  20743. flex: 1,
  20744. layout: 'vbox',
  20745. items: [
  20746. {
  20747. xtype: "numberfield",
  20748. fieldLabel: "优先级",
  20749. flex: 1,
  20750. allowBlank: false,
  20751. labelWidth: 50,
  20752. width: "100%",
  20753. },
  20754. {
  20755. xtype: "textfield",
  20756. fieldLabel: "策略名称",
  20757. flex: 1,
  20758. allowBlank: false,
  20759. labelWidth: 50,
  20760. width: "100%",
  20761. },
  20762. {
  20763. xtype: "textfield",
  20764. fieldLabel: "策略编号",
  20765. flex: 1,
  20766. allowBlank: false,
  20767. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20768. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20769. labelWidth: 50,
  20770. width: "100%",
  20771. },
  20772. {
  20773. xtype: "textfield",
  20774. fieldLabel: "仓库ID",
  20775. flex: 1,
  20776. allowBlank: false,
  20777. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20778. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20779. labelWidth: 50,
  20780. width: "100%",
  20781. },
  20782. ]
  20783. },
  20784. ]
  20785. }
  20786. ],
  20787. //窗口按钮
  20788. buttons: [
  20789. {
  20790. xtype: 'button', text: '保存', handler: function (btn) {
  20791. //窗口获取表单
  20792. var form = win.down('form');
  20793. var vaildSuccess = form.isValid();
  20794. if (!vaildSuccess) {
  20795. return;
  20796. }
  20797. var filename = form.down('textfield[name="filename"]').getValue();
  20798. }
  20799. },
  20800. {
  20801. xtype: 'button', text: '取消', handler: function (btn) {
  20802. //窗口关闭
  20803. win.close();
  20804. }
  20805. }
  20806. ]
  20807. });
  20808. win.show();
  20809. };
  20810. return ConfigStrategy;
  20811. }(Scope));
  20812. //# sourceMappingURL=ConfigStrategy.js.map
  20813. var buildVjson = function () {
  20814. return {
  20815. bind: {
  20816. title: '流程编辑-{text}',
  20817. },
  20818. layout: 'fit',
  20819. items: [{
  20820. layout: 'border',
  20821. tbar: {
  20822. xtype: 'toolbar',
  20823. items: [
  20824. {
  20825. xtype: 'button',
  20826. text: '撤销',
  20827. listeners: {
  20828. click: "scope.undo"
  20829. }
  20830. },
  20831. {
  20832. xtype: 'button',
  20833. text: '还原',
  20834. listeners: {
  20835. click: "scope.redo"
  20836. }
  20837. },
  20838. {
  20839. xtype: 'button',
  20840. text: '保存',
  20841. listeners: {
  20842. click: "scope.save"
  20843. }
  20844. },
  20845. {
  20846. xtype: 'button',
  20847. text: '导入BPM',
  20848. listeners: {
  20849. click: "scope.importBpm"
  20850. }
  20851. },
  20852. {
  20853. xtype: 'button',
  20854. text: '配置适配策略',
  20855. listeners: {
  20856. click: "scope.configStrategy"
  20857. }
  20858. },
  20859. {
  20860. fieldLabel: '选择配置分支',
  20861. xtype: 'combogrid',
  20862. },
  20863. ]
  20864. },
  20865. items: [
  20866. {
  20867. xtype: "panel",
  20868. region: 'center',
  20869. reference: "bpmn_view",
  20870. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  20871. },
  20872. {
  20873. split: true,
  20874. xtype: "panel",
  20875. region: 'east',
  20876. width: '30%',
  20877. reference: "bpmn_properties",
  20878. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  20879. }
  20880. ],
  20881. }],
  20882. listeners: {
  20883. afterrender: 'scope.onViewRender'
  20884. }
  20885. };
  20886. };
  20887. var BpmnDesign = /** @class */ (function (_super) {
  20888. __extends(BpmnDesign, _super);
  20889. function BpmnDesign() {
  20890. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  20891. _this.bpmnModeler = null;
  20892. _this.bpmnModelerName = "";
  20893. return _this;
  20894. }
  20895. BpmnDesign.prototype.onLoad = function () {
  20896. var _this = this;
  20897. _super.prototype.onLoad.call(this);
  20898. this.setLoading(true);
  20899. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  20900. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  20901. if (res && res.success && res.data && res.data.bpmn) {
  20902. var diagramXML = res.data.bpmn;
  20903. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  20904. var elements = _this.bpmnModeler._definitions.rootElements;
  20905. if (Array.isArray(elements) && elements.length > 0) {
  20906. elements[0].name = _this.bpmnModelerName;
  20907. }
  20908. }).catch(function (err) {
  20909. msgError(err);
  20910. });
  20911. }
  20912. else {
  20913. msgError(res.msg);
  20914. }
  20915. }).finally(function () {
  20916. _this.setLoading(false);
  20917. });
  20918. };
  20919. BpmnDesign.prototype.onViewRender = function (sender) {
  20920. var customTranslateModule = {
  20921. translate: ['value', customTranslate]
  20922. };
  20923. this.bpmnModeler = new BpmnModeler({
  20924. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  20925. propertiesPanel: {
  20926. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  20927. },
  20928. additionalModules: [
  20929. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  20930. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  20931. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  20932. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  20933. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  20934. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  20935. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  20936. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  20937. customTranslateModule,
  20938. ],
  20939. moddleExtensions: {
  20940. camunda: camundaModdleDescriptor
  20941. },
  20942. keyboard: { bindTo: document } // 使用键盘快捷键
  20943. });
  20944. };
  20945. //开启快捷键
  20946. //modeler.get('keyboard').bind(document);
  20947. //关闭快捷键
  20948. //modeler.get('keyboard').unbind();
  20949. BpmnDesign.prototype.undo = function (sender) {
  20950. this.bpmnModeler.get('commandStack').undo();
  20951. };
  20952. BpmnDesign.prototype.redo = function (sender) {
  20953. this.bpmnModeler.get('commandStack').redo();
  20954. };
  20955. BpmnDesign.prototype.save = function (sender) {
  20956. var _this = this;
  20957. this.setLoading(true);
  20958. this.bpmnModeler.saveXML().then(function (resBpm) {
  20959. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  20960. if (res.success) {
  20961. msg$1("保存成功");
  20962. }
  20963. else {
  20964. msgError(res.msg);
  20965. }
  20966. }).catch(function (e) {
  20967. var _a, _b;
  20968. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  20969. msgError(msg);
  20970. }).finally(function () {
  20971. _this.setLoading(false);
  20972. });
  20973. }).catch(function (e) {
  20974. msgError(e);
  20975. _this.setLoading(false);
  20976. });
  20977. };
  20978. BpmnDesign.prototype.importBpm = function (sender) {
  20979. var _this = this;
  20980. var dlg = new ImportBpmn();
  20981. //@ts-ignore
  20982. dlg.success = function (sen, data) {
  20983. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  20984. var elements = _this.bpmnModeler._definitions.rootElements;
  20985. if (Array.isArray(elements) && elements.length > 0) {
  20986. elements[0].name = _this.bpmnModelerName;
  20987. }
  20988. }).catch(function (err) {
  20989. msgError(err);
  20990. });
  20991. };
  20992. dlg.showDialog(sender, {}, {});
  20993. // this.bpmnModeler.importXML()
  20994. };
  20995. BpmnDesign.prototype.configStrategy = function (sender) {
  20996. var configStrategy = new ConfigStrategy();
  20997. configStrategy.showDialog(sender, {}, {});
  20998. };
  20999. return BpmnDesign;
  21000. }(Scope));
  21001. //# sourceMappingURL=BpmnDesign.js.map
  21002. var model$n = {
  21003. data: {
  21004. id: '',
  21005. path: '',
  21006. form: {
  21007. title: '',
  21008. sqlId: '',
  21009. }
  21010. }
  21011. };
  21012. //# sourceMappingURL=WhLayoutDesign.model.js.map
  21013. var vjson$n = {
  21014. bind: {
  21015. title: '{title}',
  21016. },
  21017. layout: 'fit',
  21018. items: [
  21019. {
  21020. layout: 'border',
  21021. items: [
  21022. {
  21023. region: 'center',
  21024. reference: 'editor',
  21025. border: true,
  21026. // html: '<div class="geEditor"></div>',
  21027. // listeners: {
  21028. // afterrender: 'scope.editorInit'
  21029. // }
  21030. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  21031. listeners: {
  21032. afterrender: 'scope.iframeRender'
  21033. }
  21034. },
  21035. ]
  21036. }
  21037. ]
  21038. }; //
  21039. //
  21040. //# sourceMappingURL=WhLayoutDesign.view.js.map
  21041. var WidgetDesign$1 = /** @class */ (function (_super) {
  21042. __extends(WidgetDesign, _super);
  21043. function WidgetDesign(layoutCode, layoutName) {
  21044. var _this = _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  21045. _this.layoutCode = layoutCode;
  21046. _this.layoutName = layoutName;
  21047. return _this;
  21048. }
  21049. WidgetDesign.prototype.onLoad = function () {
  21050. this.viewModel.set('layoutCode', this.layoutCode);
  21051. this.viewModel.set('layoutName', this.layoutName);
  21052. if (this.layoutCode) {
  21053. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  21054. }
  21055. else {
  21056. this.viewModel.set('title', '新建图纸');
  21057. }
  21058. };
  21059. WidgetDesign.prototype.reload = function () {
  21060. var _this = this;
  21061. this.setLoading(true);
  21062. loadWhLayout({
  21063. layoutCode: this.layoutCode,
  21064. layoutName: this.layoutName,
  21065. }).then(function (res) {
  21066. if (res.success) {
  21067. var xml = res.data.layoutContent;
  21068. var doc = _this.mxUtils.parseXml(xml);
  21069. var graph = _this.editorUi.editor.graph;
  21070. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  21071. }
  21072. }).finally(function () {
  21073. _this.setLoading(false);
  21074. });
  21075. };
  21076. WidgetDesign.prototype.editorInit = function (sender) {
  21077. var that = this;
  21078. var dom = $(sender.el.dom).find('.geEditor')[0];
  21079. //@ts-ignore
  21080. require(['mxgraph'], function () {
  21081. var editorUiInit = EditorUi.prototype.init;
  21082. EditorUi.prototype.init = function () {
  21083. editorUiInit.apply(this, arguments);
  21084. this.actions.get('save').funct = that.onFileSave.bind(that);
  21085. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21086. this.actions.get('open').visible = false;
  21087. this.actions.get('new').visible = false;
  21088. this.actions.get('preview').visible = false;
  21089. this.actions.get('print').visible = false;
  21090. this.actions.get('pageSetup').visible = false;
  21091. this.actions.get('help').visible = false;
  21092. this.actions.get('export').visible = false;
  21093. this.actions.get('about').visible = false;
  21094. this.menus.menus.help.setEnabled(false);
  21095. that.editorUi = this;
  21096. if (that.layoutCode) {
  21097. that.reload();
  21098. }
  21099. };
  21100. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  21101. var mxLanguage = 'zh';
  21102. mxResources.loadDefaultBundle = false;
  21103. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  21104. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  21105. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  21106. // Fixes possible asynchronous requests
  21107. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  21108. // Adds bundle text to resources
  21109. mxResources.parse(xhr[0].getText());
  21110. // Configures the default graph theme
  21111. var themes = new Object();
  21112. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  21113. // Main
  21114. new EditorUi(new Editor(false, themes), dom);
  21115. }, function () {
  21116. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  21117. });
  21118. });
  21119. };
  21120. WidgetDesign.prototype.iframeRender = function (sender) {
  21121. var that = this;
  21122. var iframe = $(sender.el.dom).find('iframe')[0];
  21123. iframe.contentWindow['designer'] = that;
  21124. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  21125. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  21126. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21127. editorUi.actions.get('open').visible = false;
  21128. editorUi.actions.get('new').visible = false;
  21129. editorUi.actions.get('preview').visible = false;
  21130. editorUi.actions.get('print').visible = false;
  21131. editorUi.actions.get('pageSetup').visible = false;
  21132. editorUi.actions.get('help').visible = false;
  21133. editorUi.actions.get('export').visible = false;
  21134. editorUi.actions.get('about').visible = false;
  21135. editorUi.menus.menus.help.setEnabled(false);
  21136. that.editorUi = editorUi;
  21137. that.mxUtils = iframe.contentWindow['mxUtils'];
  21138. if (that.layoutCode) {
  21139. that.reload();
  21140. }
  21141. };
  21142. };
  21143. WidgetDesign.prototype.onDestroy = function () {
  21144. var _a;
  21145. try {
  21146. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  21147. }
  21148. catch (e) {
  21149. }
  21150. };
  21151. WidgetDesign.prototype.onFileSaveAs = function () {
  21152. var _this = this;
  21153. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  21154. .then(function (_a) {
  21155. var code = _a.code, name = _a.name;
  21156. _this.layoutCode = code;
  21157. _this.layoutName = name;
  21158. _this.onSave();
  21159. });
  21160. };
  21161. WidgetDesign.prototype.onSave = function () {
  21162. var _this = this;
  21163. var layoutContent = this.editorUi.getEditBlankXml();
  21164. var layoutCode = this.layoutCode;
  21165. var layoutName = this.layoutName;
  21166. if (!layoutCode || !layoutName) {
  21167. msg$1('图形编号和图形名称必填');
  21168. return;
  21169. }
  21170. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  21171. this.setLoading(true);
  21172. saveWhLayout({
  21173. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  21174. }).then(function (res) {
  21175. msg$1(res.msg);
  21176. handles$1.whLayout.reload();
  21177. }).finally(function () {
  21178. _this.setLoading(false);
  21179. });
  21180. };
  21181. WidgetDesign.prototype.onFileSave = function () {
  21182. if (!this.layoutCode || !this.layoutName) {
  21183. this.onFileSaveAs();
  21184. }
  21185. else {
  21186. this.onSave();
  21187. }
  21188. };
  21189. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  21190. var code = _a.code, name = _a.name;
  21191. return new Promise(function (resolve, reject) {
  21192. var viewModel = new Ext.app.ViewModel({
  21193. data: {
  21194. code: code !== null && code !== void 0 ? code : '',
  21195. name: name !== null && name !== void 0 ? name : '',
  21196. }
  21197. });
  21198. var dlg = Ext.create('Ext.window.Window', {
  21199. title: '保存',
  21200. viewModel: viewModel,
  21201. layout: {
  21202. type: "vbox",
  21203. pack: "start",
  21204. align: "stretch"
  21205. },
  21206. items: [
  21207. {
  21208. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  21209. bind: '{code}'
  21210. },
  21211. {
  21212. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  21213. bind: '{name}'
  21214. }
  21215. ],
  21216. fbar: [
  21217. {
  21218. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  21219. click: function () {
  21220. var code = viewModel.get('code');
  21221. var name = viewModel.get('name');
  21222. resolve({ code: code, name: name });
  21223. dlg.close();
  21224. }
  21225. }
  21226. },
  21227. {
  21228. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  21229. click: function () {
  21230. dlg.close();
  21231. }
  21232. }
  21233. },
  21234. ]
  21235. });
  21236. dlg.show();
  21237. });
  21238. };
  21239. return WidgetDesign;
  21240. }(Scope));
  21241. //# sourceMappingURL=WhLayoutDesign.js.map
  21242. // init()
  21243. var Workbench = /** @class */ (function (_super) {
  21244. __extends(Workbench, _super);
  21245. // activeModulePage: ModulePage = null
  21246. function Workbench() {
  21247. var _this = _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  21248. _this.name = "MainWindow";
  21249. _this.modules = [];
  21250. _this.yvgridDesign = null;
  21251. return _this;
  21252. }
  21253. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  21254. if (newCard) {
  21255. this.viewModel.set('leftTabTitle', newCard.tooltip);
  21256. }
  21257. else {
  21258. this.viewModel.set('leftTabTitle', '未选中');
  21259. }
  21260. };
  21261. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  21262. get: function () {
  21263. var _a;
  21264. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  21265. },
  21266. enumerable: true,
  21267. configurable: true
  21268. });
  21269. Workbench.prototype.documentKeydown = function (event) {
  21270. if (event.ctrlKey || event.metaKey) {
  21271. if (event.key.toLowerCase() === 's') {
  21272. eventBus.publish(EventType.SaveCall, {});
  21273. event.stopPropagation();
  21274. event.preventDefault();
  21275. }
  21276. else if (event.key.toLowerCase() === 'z') {
  21277. if (event.shiftKey) {
  21278. eventBus.publish(EventType.Redo, {});
  21279. event.stopPropagation();
  21280. event.preventDefault();
  21281. }
  21282. else {
  21283. eventBus.publish(EventType.Undo, {});
  21284. event.stopPropagation();
  21285. event.preventDefault();
  21286. }
  21287. }
  21288. }
  21289. };
  21290. Workbench.prototype.onLoad = function () {
  21291. var _this = this;
  21292. window["tt"] = this.refs['tt'];
  21293. window["vm"] = this.viewModel;
  21294. $('#loading').remove();
  21295. setMainWindow(this);
  21296. setStatusbar(this.down('statusbar'));
  21297. document.addEventListener('keydown', this.documentKeydown.bind(this));
  21298. var currentProject = getCurrentProject();
  21299. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  21300. // handles.fileTree.reload()
  21301. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  21302. _this.showModule(rawData);
  21303. });
  21304. eventBus.subscribe(EventType.Undo, function () {
  21305. _this.onUndo();
  21306. });
  21307. eventBus.subscribe(EventType.Redo, function () {
  21308. _this.onRedo();
  21309. });
  21310. eventBus.subscribe(EventType.Cut, function (_a) {
  21311. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21312. _this.onCut(a, b, c, d);
  21313. });
  21314. eventBus.subscribe(EventType.Copy, function (_a) {
  21315. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21316. _this.onCopy(a, b, c, d);
  21317. });
  21318. eventBus.subscribe(EventType.Paste, function (_a) {
  21319. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21320. _this.onPaste(a, b, c, d);
  21321. });
  21322. eventBus.subscribe(EventType.SelectAll, function () {
  21323. _this.onSelectAll();
  21324. });
  21325. eventBus.subscribe(EventType.SelectAll, function () {
  21326. _this.onSelectAll();
  21327. });
  21328. eventBus.subscribe(EventType.RunCheckModule, function () {
  21329. _this.runCheckModule();
  21330. });
  21331. eventBus.subscribe(EventType.StopCheckModule, function () {
  21332. _this.stopCheckModule();
  21333. });
  21334. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  21335. _this.onCompoentContextMenu(args);
  21336. });
  21337. this.runCheckModule();
  21338. };
  21339. Workbench.prototype.onCompoentContextMenu = function (args) {
  21340. var _this = this;
  21341. if (!this.yvgridDesign) {
  21342. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  21343. this.yvgridDesign.showDialog(null, {}, {});
  21344. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  21345. this.yvgridDesign.onDestroy = function () {
  21346. fn_1();
  21347. _this.yvgridDesign = null;
  21348. };
  21349. }
  21350. };
  21351. Workbench.prototype.runCheckModule = function () {
  21352. var _this = this;
  21353. if (this.checkTimer) {
  21354. return;
  21355. }
  21356. this.checkTimer = setInterval(function () {
  21357. var _a;
  21358. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  21359. _this.activeModulePage.check();
  21360. }
  21361. }, 5000);
  21362. };
  21363. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  21364. var dlg = new WidgetDesign(widgetPath, widgetName);
  21365. dlg.showPage({
  21366. id: 'widget_' + widgetPath,
  21367. path: 'widget_' + widgetPath,
  21368. }, {
  21369. data: {
  21370. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  21371. }
  21372. });
  21373. dlg.dialogSuccess = successCallback;
  21374. };
  21375. Workbench.prototype.stopCheckModule = function () {
  21376. clearInterval(this.checkTimer);
  21377. this.checkTimer = null;
  21378. };
  21379. Workbench.prototype.showDataSync = function () {
  21380. var ins = new DbSync();
  21381. ins.showPage({
  21382. id: 'db_sync__',
  21383. path: 'db_sync__',
  21384. }, {
  21385. data: {}
  21386. });
  21387. };
  21388. /**
  21389. * 打开一个项目
  21390. */
  21391. Workbench.prototype.openProject = function (project) {
  21392. setCurrentProject(project);
  21393. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  21394. handles$1.fileTree.reload();
  21395. };
  21396. /**
  21397. * 打开模板开发面板
  21398. */
  21399. Workbench.prototype.showTemplateDev = function () {
  21400. var ins = new TemplateDev();
  21401. ins.showPage({
  21402. id: 'template_dev__',
  21403. path: 'template_dev__',
  21404. }, {
  21405. data: {}
  21406. });
  21407. };
  21408. Workbench.prototype.openScope = function () {
  21409. };
  21410. /**
  21411. * 显示字段域管理器
  21412. */
  21413. Workbench.prototype.showColumnDomain = function () {
  21414. var instance = new DbDomain();
  21415. instance.showPage({
  21416. id: 'domain__',
  21417. path: 'domain__',
  21418. }, {
  21419. data: {}
  21420. });
  21421. };
  21422. /**
  21423. * 显示性能统计
  21424. */
  21425. Workbench.prototype.showPerform = function () {
  21426. // const instance = new PerformStats()
  21427. // instance.showPage({
  21428. // id: 'perform__',
  21429. // path: 'perform__',
  21430. //
  21431. // }, {
  21432. // data: {}
  21433. // })
  21434. };
  21435. /**
  21436. * 显示数据库代码模板库
  21437. */
  21438. Workbench.prototype.showDbCodeTemplate = function () {
  21439. // const instance = new DbCodeTemplate()
  21440. // instance.showPage({
  21441. // id: 'dbcode__',
  21442. // path: 'dbcode__',
  21443. //
  21444. // }, {
  21445. // data: {}
  21446. // })
  21447. };
  21448. /**
  21449. * 显示数据库代码模板库
  21450. */
  21451. Workbench.prototype.showReport = function (report_id, report_name, success) {
  21452. var instance = new ReportDesign();
  21453. instance.showPage({
  21454. id: 'report_' + report_id,
  21455. path: 'report_' + report_id,
  21456. }, {
  21457. data: {
  21458. report_id: report_id,
  21459. report_name: report_name,
  21460. }
  21461. });
  21462. instance.dialogSuccess = success;
  21463. };
  21464. /**
  21465. * 显示报表
  21466. */
  21467. Workbench.prototype.showReportPreview = function (report_id, instance) {
  21468. instance.showPage({
  21469. id: 'REPORT__' + report_id,
  21470. path: 'REPORT__' + report_id,
  21471. }, {
  21472. data: {
  21473. report_id: report_id,
  21474. }
  21475. });
  21476. var reportName = instance.viewModel.get('report_name');
  21477. instance.viewModel.set('report_name', '[预览]-' + reportName);
  21478. };
  21479. /**
  21480. * 显示运维页面
  21481. */
  21482. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  21483. // const instance = new DevOpsTerminal()
  21484. // instance.showPage({
  21485. // id: 'ops_' + opsId,
  21486. // path: 'ops_' + opsId,
  21487. //
  21488. // }, {
  21489. // data: {
  21490. // opsId: opsId,
  21491. // name: name,
  21492. // }
  21493. // })
  21494. // instance.dialogSuccess = success
  21495. };
  21496. /**
  21497. * 显示表结构
  21498. * tableName 为空的情况就是新建表,否则就是要编辑的表
  21499. * columnName 可以为空
  21500. */
  21501. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  21502. var id = 'tableColumn_' + tableName;
  21503. var isCreateTable = false;
  21504. // /ROOT/schema$public/schema$public$bas_location_group_rel
  21505. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  21506. if (!tableName) {
  21507. id = _$2.uniqueId('new_table');
  21508. tableName = id;
  21509. isCreateTable = true;
  21510. }
  21511. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  21512. instance.showPage({
  21513. id: id,
  21514. path: id,
  21515. locatPath: locatPath
  21516. }, {
  21517. data: {
  21518. tableName: tableName,
  21519. columnName: columnName
  21520. }
  21521. });
  21522. };
  21523. /**
  21524. * 打开某个模块
  21525. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  21526. */
  21527. Workbench.prototype.showModule = function (rawData) {
  21528. var id = rawData.id, path = rawData.path;
  21529. var separator = '/';
  21530. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  21531. var module = this.modules[idx];
  21532. var pageId = path.replaceAll('/', '_');
  21533. console.log('open module', module);
  21534. var instance = new ModulePage(id, module);
  21535. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  21536. instance.showPage({
  21537. id: 'module_' + pageId,
  21538. path: path,
  21539. title: module.name
  21540. }, {
  21541. data: {}
  21542. });
  21543. };
  21544. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  21545. var bpmnDesign = new BpmnDesign();
  21546. bpmnDesign.showPage({}, {
  21547. data: {
  21548. absolutePath: absolutePath,
  21549. id: id,
  21550. text: text
  21551. }
  21552. });
  21553. };
  21554. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  21555. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  21556. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  21557. layoutDesign.showPage({
  21558. id: id,
  21559. path: id,
  21560. }, {
  21561. data: {}
  21562. });
  21563. };
  21564. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  21565. var _a;
  21566. // this.activeModulePage = newCard.yvanScope
  21567. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  21568. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  21569. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  21570. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  21571. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  21572. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  21573. eventBus.publish(EventType.MainTabChange, {
  21574. moduleId: newCard.yvanScope.moduleId,
  21575. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  21576. from: this.name
  21577. });
  21578. };
  21579. Workbench.prototype.onUndo = function () {
  21580. var _a;
  21581. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  21582. };
  21583. Workbench.prototype.onRedo = function () {
  21584. var _a;
  21585. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  21586. };
  21587. Workbench.prototype.onCut = function (a, b, c, d) {
  21588. var _a;
  21589. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  21590. };
  21591. Workbench.prototype.onCopy = function (a, b, c, d) {
  21592. var _a;
  21593. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  21594. };
  21595. Workbench.prototype.onPaste = function (a, b, c, d) {
  21596. var _a;
  21597. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  21598. };
  21599. Workbench.prototype.onSelectAll = function () {
  21600. var _a;
  21601. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  21602. };
  21603. return Workbench;
  21604. }(Scope));
  21605. //# sourceMappingURL=Workbench.js.map
  21606. (function (FuncDomain) {
  21607. FuncDomain["SCOPE"] = "scope";
  21608. FuncDomain["SYSTEM"] = "system";
  21609. })(exports.FuncDomain || (exports.FuncDomain = {}));
  21610. (function (BizMode) {
  21611. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  21612. BizMode[BizMode["query"] = 1] = "query";
  21613. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  21614. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  21615. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  21616. })(exports.BizMode || (exports.BizMode = {}));
  21617. (function (BizFormat) {
  21618. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  21619. BizFormat[BizFormat["button"] = 1] = "button";
  21620. BizFormat[BizFormat["progress"] = 2] = "progress";
  21621. BizFormat[BizFormat["date"] = 3] = "date";
  21622. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  21623. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  21624. })(exports.BizFormat || (exports.BizFormat = {}));
  21625. (function (BizUnique) {
  21626. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  21627. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  21628. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  21629. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  21630. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  21631. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  21632. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  21633. })(exports.BizUnique || (exports.BizUnique = {}));
  21634. var ScopeEngine = /** @class */ (function () {
  21635. function ScopeEngine() {
  21636. }
  21637. ScopeEngine.getBizFile = function (director) {
  21638. return new Promise(function (resolve, reject) {
  21639. debugger;
  21640. });
  21641. };
  21642. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  21643. return new Promise(function (resolve, reject) {
  21644. var requireArr = [];
  21645. var requireKeyArr = [];
  21646. _$2.forOwn(billFile.domains, function (v, k) {
  21647. requireArr.push(v.domain);
  21648. requireKeyArr.push(k);
  21649. if (v.layout) {
  21650. requireArr.push(v.layout);
  21651. requireKeyArr.push(k + "_layout");
  21652. }
  21653. });
  21654. requireArr.push(billFile.layout);
  21655. requireKeyArr.push("layout");
  21656. requireArr.push(billFile.converter);
  21657. requireKeyArr.push("converter");
  21658. // @ts-ignore
  21659. require(requireArr, function () {
  21660. var requireReArr = [];
  21661. for (var _i = 0; _i < arguments.length; _i++) {
  21662. requireReArr[_i] = arguments[_i];
  21663. }
  21664. if (requireReArr.length <= 0) {
  21665. reject(new Error("没有加载到相关的文件!"));
  21666. }
  21667. var domains = {};
  21668. for (var i = 0; i < requireReArr.length - 2; i++) {
  21669. if (requireKeyArr[i].endsWith("_layout")) {
  21670. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  21671. domains[key_d].layout = requireReArr[i].default;
  21672. }
  21673. else {
  21674. domains[requireKeyArr[i]] = requireReArr[i].default;
  21675. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  21676. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  21677. }
  21678. }
  21679. var bizFile = {
  21680. bill: billFile,
  21681. domains: domains,
  21682. layout: requireReArr[requireReArr.length - 2].default,
  21683. converter: requireReArr[requireReArr.length - 1].default,
  21684. };
  21685. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  21686. scope.billSetting = bizFile;
  21687. resolve(scope);
  21688. });
  21689. });
  21690. };
  21691. ScopeEngine.buildScopeFromPath = function (path) {
  21692. return new Promise(function (resolve, reject) {
  21693. // @ts-ignore
  21694. require([path], function (bill) {
  21695. bill = bill.default;
  21696. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  21697. resolve(scope);
  21698. }).catch(function (e) {
  21699. reject(e);
  21700. });
  21701. });
  21702. });
  21703. };
  21704. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  21705. var controller = {};
  21706. var vjson = {
  21707. layout: 'fit',
  21708. title: bizFile.bill.name,
  21709. items: []
  21710. };
  21711. var model = {};
  21712. if (bizFile.layout.layout === "fit") {
  21713. vjson.items = bizFile.layout.items;
  21714. }
  21715. else if (bizFile.layout.layout === "border") {
  21716. vjson.items = [bizFile.layout];
  21717. }
  21718. var domainsVjson = {};
  21719. _$2.forOwn(bizFile.domains, function (v, k) {
  21720. var domainVjson = null;
  21721. var buttons = bizFile.domains[k].buttons;
  21722. if (bizFile.bill.domains[k].mode === "form") {
  21723. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  21724. if (Array.isArray(buttons) && buttons.length > 0) {
  21725. if (bizFile.bill.domains[k].type === "header") {
  21726. vjson.tbar = {
  21727. xtype: 'toolbar',
  21728. items: ScopeEngine.buildButton(controller, buttons)
  21729. };
  21730. }
  21731. else {
  21732. domainVjson.items.push({
  21733. xtype: "cols",
  21734. items: ScopeEngine.buildButton(controller, buttons)
  21735. });
  21736. }
  21737. }
  21738. }
  21739. else if (bizFile.bill.domains[k].mode === "table") {
  21740. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  21741. if (Array.isArray(buttons) && buttons.length > 0) {
  21742. if (bizFile.bill.domains[k].type === "header") {
  21743. vjson.tbar = {
  21744. xtype: 'toolbar',
  21745. items: ScopeEngine.buildButton(controller, buttons)
  21746. };
  21747. }
  21748. else {
  21749. domainVjson.tbar = {
  21750. xtype: 'toolbar',
  21751. items: ScopeEngine.buildButton(controller, buttons)
  21752. };
  21753. }
  21754. }
  21755. }
  21756. if (domainVjson) {
  21757. domainsVjson[k] = domainVjson;
  21758. }
  21759. });
  21760. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  21761. var scope = new Scope({ model: model, vjson: vjson });
  21762. scope['bill_define'] = bizFile;
  21763. _$2.merge(scope, controller);
  21764. console.log('bill_define', vjson, scope, scope['bill_define']);
  21765. return scope;
  21766. };
  21767. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  21768. var fieldGroups = {};
  21769. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21770. var field = bizFile.domains[domainKey].fields[i];
  21771. var item = { sort: field.form_sort };
  21772. item.xtype = field.xtype;
  21773. item.fieldLabel = field.column_desc;
  21774. item.bind = {
  21775. value: "{" + domainKey + "." + field.column_name + "}",
  21776. };
  21777. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  21778. // if (field.disabled !== "true" && field.disabled !== "false") {
  21779. // item.bind.disabled = eval(field.disabled)
  21780. // } else {
  21781. // item.disabled = (field.disabled === "true")
  21782. // }
  21783. // if (field.readonly !== "true" && field.readonly !== "false") {
  21784. // item.bind.disabled = eval(field.readonly)
  21785. // } else {
  21786. // item.readonly = (field.readonly === "true")
  21787. // }
  21788. // if (field.required !== "true" && field.required !== "false") {
  21789. // item.bind.required = eval(field.required)
  21790. // } else {
  21791. // item.required = (field.required === "true")
  21792. // }
  21793. // if (field.hide !== "true" && field.hide !== "false") {
  21794. // item.bind.hidden = eval(field.hide)
  21795. // } else {
  21796. // item.hidden = (field.hide === "true")
  21797. // }
  21798. // item.flex = field.
  21799. if (field.dict) {
  21800. item.fix = eval(field.dict);
  21801. }
  21802. // _.set(formModel, "", "")
  21803. item.field = field;
  21804. if (field.form_group) {
  21805. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  21806. fieldGroups[field.form_group] = [item];
  21807. }
  21808. else {
  21809. fieldGroups[field.form_group].push(item);
  21810. }
  21811. }
  21812. }
  21813. var formVjson = {
  21814. xtype: "form",
  21815. title: bizFile.domains[domainKey].name,
  21816. items: []
  21817. };
  21818. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  21819. var items = ScopeEngine.buildFieldSet(fieldGroup);
  21820. if (items) {
  21821. var fieldsetVjson = {
  21822. xtype: "fieldset",
  21823. title: k,
  21824. items: items
  21825. };
  21826. formVjson.items.push(fieldsetVjson);
  21827. }
  21828. });
  21829. return formVjson;
  21830. };
  21831. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  21832. // const vjson = { xtype: "grid", items: []}
  21833. var gridVjson = {
  21834. xtype: "yvgrid",
  21835. columns: [],
  21836. split: true,
  21837. reference: domainKey,
  21838. listeners: {
  21839. itemdblclick: function () {
  21840. },
  21841. },
  21842. };
  21843. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21844. var field = bizFile.domains[domainKey].fields[i];
  21845. gridVjson.columns.push({
  21846. dataIndex: field.column_name,
  21847. header: field.column_desc,
  21848. });
  21849. }
  21850. return gridVjson;
  21851. };
  21852. ScopeEngine.buildFieldSet = function (fieldGroup) {
  21853. var colGroups = [{
  21854. xtype: "cols",
  21855. items: []
  21856. }];
  21857. var colGroup = colGroups[0];
  21858. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  21859. for (var i = 0; i < fieldGroup.length; i++) {
  21860. var field = fieldGroup[i];
  21861. if (field.field.form_newline === "true") {
  21862. if (colGroup.items.length > 0) {
  21863. colGroup = {
  21864. xtype: "cols",
  21865. items: [field]
  21866. };
  21867. colGroups.push(colGroup);
  21868. }
  21869. }
  21870. else {
  21871. colGroup.items.push(field);
  21872. }
  21873. delete field.field;
  21874. }
  21875. return colGroups;
  21876. };
  21877. ScopeEngine.buildButton = function (controller, buttons) {
  21878. var buttonsVjson = [];
  21879. var _loop_1 = function (i) {
  21880. var item = buttons[i];
  21881. var button = {
  21882. xtype: "button",
  21883. text: item.btn_name,
  21884. iconCls: item.icon
  21885. };
  21886. if (item.hidden === "true" || item.hidden === "false") {
  21887. button.hidden = (item.hidden === "true");
  21888. }
  21889. if (item.listeners) {
  21890. var listeners_1 = {};
  21891. _$2.forOwn(item.listeners, function (v, k) {
  21892. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  21893. listeners_1[k] = v;
  21894. }
  21895. else {
  21896. try {
  21897. listeners_1[k] = eval(v);
  21898. }
  21899. catch (e) {
  21900. throw e;
  21901. }
  21902. }
  21903. });
  21904. button.listeners = listeners_1;
  21905. }
  21906. buttonsVjson.push(button);
  21907. };
  21908. for (var i = 0; i < buttons.length; i++) {
  21909. _loop_1(i);
  21910. }
  21911. return buttonsVjson;
  21912. };
  21913. ScopeEngine.buildListeners = function (controller, item) {
  21914. if (!item.hasOwnProperty("listeners")) {
  21915. return;
  21916. }
  21917. _$2.forOwn(item.listeners, function (v, k) {
  21918. if (v && typeof v === "string") {
  21919. if (v.indexOf(".") > -1) {
  21920. var strArr = v.split(".");
  21921. if (strArr.length != 2) {
  21922. console.error(item.listeners, "语法解析错误,请检查!");
  21923. }
  21924. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  21925. switch (funcDomain) {
  21926. case exports.FuncDomain.SCOPE:
  21927. controller[k] = findCustFunc(item, k);
  21928. break;
  21929. case exports.FuncDomain.SYSTEM:
  21930. break;
  21931. default:
  21932. throw new Error("错误的函数域定义");
  21933. }
  21934. }
  21935. else {
  21936. var func = eval(v);
  21937. if (typeof func === 'function') {
  21938. controller[k] = func;
  21939. }
  21940. throw new Error("解析自定义函数出错");
  21941. }
  21942. }
  21943. });
  21944. var findCustFunc = function (item, funcName) {
  21945. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  21946. throw new Error("没有找到相关的函数定义");
  21947. }
  21948. var func = eval(item[funcName]);
  21949. if (typeof func === 'function') {
  21950. return func;
  21951. }
  21952. throw new Error("解析自定义函数出错");
  21953. };
  21954. };
  21955. /**
  21956. * 只检索 items 的模式,深度遍历 vjson
  21957. */
  21958. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  21959. if (Array.isArray(vjson)) {
  21960. for (var i = 0; i < vjson.length; i++) {
  21961. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  21962. }
  21963. }
  21964. else {
  21965. _$2.forOwn(vjson, function (v, k) {
  21966. if (k !== "domain") {
  21967. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  21968. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  21969. }
  21970. }
  21971. else {
  21972. delete vjson.domain;
  21973. _$2.merge(vjson, domainsVjson[v]);
  21974. }
  21975. });
  21976. }
  21977. };
  21978. return ScopeEngine;
  21979. }());
  21980. //# sourceMappingURL=ScopeEngine.js.map
  21981. function initComponent () {
  21982. var ct = Ext.Component.prototype.constructor;
  21983. Ext.Component.override({
  21984. constructor: function (config) {
  21985. var _a;
  21986. if (!isDesignMode(this, config)) {
  21987. var me_1 = this;
  21988. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  21989. _$2.each(baseConfigProcessList, function (process) {
  21990. process.call(me_1, me_1, config);
  21991. });
  21992. }
  21993. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  21994. config.i18nPath = config.$initParent.i18nPath;
  21995. }
  21996. var WMSTranslate = window["WMSTranslate"];
  21997. if (WMSTranslate) {
  21998. if (typeof window['viewTranslate'] === 'function') {
  21999. window['viewTranslate'](config, config.text, "text");
  22000. window['viewTranslate'](config, config.title, "title");
  22001. window['viewTranslate'](config, config.header, "header");
  22002. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  22003. }
  22004. }
  22005. ct.call(this, config);
  22006. }
  22007. });
  22008. var _initComponent = Ext.picker.Date.prototype.initComponent;
  22009. Ext.picker.Date.override({
  22010. initComponent: function () {
  22011. var me = this;
  22012. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  22013. _initComponent.call(me);
  22014. },
  22015. selectToday: function () {
  22016. var me = this, btn = me.todayBtn, handler = me.handler;
  22017. if (btn && !btn.disabled) {
  22018. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  22019. me.fireEvent('select', me, me.value);
  22020. if (handler) {
  22021. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  22022. }
  22023. me.onSelect();
  22024. }
  22025. return me;
  22026. },
  22027. });
  22028. }
  22029. //# sourceMappingURL=component.js.map
  22030. function initMainTab () {
  22031. Ext.define('Yvan.MainTab', {
  22032. extend: 'Ext.tab.Panel',
  22033. xtype: 'maintab',
  22034. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  22035. closeTabText: '关闭',
  22036. closeOthersTabsText: '关闭其他',
  22037. closeAllTabsText: '关闭所有'
  22038. }),
  22039. constructor: function (config) {
  22040. var me = this;
  22041. var newConfig = _$2.defaultsDeep({
  22042. // 强制属性
  22043. }, config);
  22044. this.superclass.constructor.call(me, newConfig);
  22045. },
  22046. initComponent: function () {
  22047. var me = this;
  22048. this.on({
  22049. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  22050. _$2.defer(function () {
  22051. me.changeHash(newCard.id);
  22052. window['cp'] = newCard.yvanScope;
  22053. });
  22054. $$2(window).trigger('tabChange', {
  22055. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  22056. });
  22057. },
  22058. afterrender: function () {
  22059. _$2.defer(function () {
  22060. me.tryRestoryPage();
  22061. });
  22062. }
  22063. });
  22064. this.superclass.initComponent.call(me);
  22065. },
  22066. tryRestoryPage: function () {
  22067. var me = this;
  22068. var hash = '' + window.location.hash;
  22069. if (hash && hash.indexOf('page=') > 0) {
  22070. if (hash.startsWith('#')) {
  22071. hash = hash.substr(1);
  22072. }
  22073. if (hash) {
  22074. var page = Qs.parse(hash).page;
  22075. if (page) {
  22076. // this.openScope(page)
  22077. me.fireEvent('restorypage', page);
  22078. }
  22079. }
  22080. }
  22081. },
  22082. changeHash: function (id) {
  22083. window.location.hash = Qs.stringify({ page: id });
  22084. },
  22085. /**
  22086. * 添加一个业务模块实例到选项卡
  22087. * @param scopeInstance 业务对象实例
  22088. * @param config ExtJS配置对象
  22089. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  22090. */
  22091. addScope: function (scopeInstance, config, panelInitCallback) {
  22092. scopeInstance.topScope = scopeInstance;
  22093. var me = this;
  22094. if (config.path) {
  22095. for (var i = 0; i < this.items.items.length; i++) {
  22096. // 找到当前 tabs 里有没有已经打开过
  22097. var tab = this.items.items[i];
  22098. if (_$2.isEqual(tab.path, config.path)) {
  22099. // 激活
  22100. this.setActiveTab(tab);
  22101. return tab;
  22102. }
  22103. }
  22104. }
  22105. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  22106. if (typeof panelInitCallback === 'function') {
  22107. panelInitCallback(newPanel);
  22108. }
  22109. // 添加业务模块
  22110. var newTab = this.add(newPanel);
  22111. this.setActiveTab(newTab);
  22112. newTab.on({
  22113. destroy: function (sender) {
  22114. me.changeHash('');
  22115. delete window['cp'];
  22116. }
  22117. });
  22118. return newTab;
  22119. }
  22120. });
  22121. }
  22122. //# sourceMappingURL=MainTab.js.map
  22123. /**
  22124. * 构建所有组件的公共属性
  22125. * @param config 原始config
  22126. * @param dragType 组件模式
  22127. * 不填,代表不能在设计时被拖拽
  22128. * row-container 是一个rows容器
  22129. * col-container 是一个cols容器
  22130. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  22131. * row-item rows中的一行,比如 tree / grid / panel 等等
  22132. */
  22133. function baseConfig(config, dragType) {
  22134. // if (isDesignMode(config, undefined) && dragType) {
  22135. if (typeof config === 'object') {
  22136. var cc = '';
  22137. switch (dragType) {
  22138. case "cols-container":
  22139. cc = 'design_cols_container';
  22140. break;
  22141. case "col-item":
  22142. cc = 'design_col_item';
  22143. break;
  22144. case "rows-container":
  22145. cc = 'design_rows_container';
  22146. break;
  22147. case "row-item":
  22148. cc = 'design_row_item';
  22149. break;
  22150. }
  22151. if (typeof config.cls === 'string') {
  22152. _$2.extend(config, {
  22153. cls: [config.cls, 'yvan_design', cc]
  22154. });
  22155. }
  22156. else if (_$2.isArray(config.cls)) {
  22157. _$2.extend(config, {
  22158. cls: __spread(config.cls, ['yvan_design', cc])
  22159. });
  22160. }
  22161. else {
  22162. _$2.extend(config, {
  22163. cls: ['yvan_design', cc]
  22164. });
  22165. }
  22166. }
  22167. return config;
  22168. }
  22169. //# sourceMappingURL=base.js.map
  22170. function initPanel () {
  22171. /**
  22172. *
  22173. */
  22174. var ct = Ext.panel.Panel.prototype.constructor;
  22175. Ext.panel.Panel.override({
  22176. constructor: function (config) {
  22177. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  22178. ct.call(this, newConfig);
  22179. }
  22180. });
  22181. var ss = Ext.form.FieldContainer.prototype;
  22182. Ext.form.FieldContainer.override({
  22183. config: __assign({}, fieldContainer)
  22184. });
  22185. }
  22186. //# sourceMappingURL=panel.js.map
  22187. function initGridColumn () {
  22188. var ct = Ext.grid.column.Column.prototype.constructor;
  22189. Ext.grid.column.Column.override({
  22190. constructor: function (config) {
  22191. var scope = lookupScope(config.$initParent.$initParent);
  22192. var newConfig = _$2.defaults({}, config, column);
  22193. if (typeof newConfig.summaryRenderer === 'string') {
  22194. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  22195. if (typeof newConfig.summaryRenderer === 'function') {
  22196. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  22197. }
  22198. }
  22199. if (config.formatter === 'datetime') {
  22200. newConfig.fix = ['system.formatDate()'];
  22201. delete newConfig.formatter;
  22202. }
  22203. // 在 grid.constructor 已经转换过了
  22204. // if (typeof newConfig.renderer === 'string') {
  22205. // newConfig.renderer = lookupFn(scope, config.renderer)
  22206. // if (typeof newConfig.renderer === 'function') {
  22207. // newConfig.renderer = newConfig.renderer.bind(scope)
  22208. // }
  22209. // }
  22210. ct.call(this, newConfig);
  22211. }
  22212. });
  22213. var ctAction = Ext.grid.column.Action.prototype.constructor;
  22214. Ext.grid.column.Action.override({
  22215. constructor: function (config) {
  22216. var scope = lookupScope(config.$initParent.$initParent);
  22217. _$2.forEach(config.items, function (item) {
  22218. if (typeof item.handler === 'string') {
  22219. item.handler = lookupFn(scope, item.handler);
  22220. if (typeof item.handler === 'function') {
  22221. item.handler = item.handler.bind(scope);
  22222. }
  22223. }
  22224. });
  22225. ctAction.call(this, config);
  22226. }
  22227. });
  22228. var ck = Ext.grid.column.Check.prototype.constructor;
  22229. Ext.grid.column.Check.override({
  22230. constructor: function (config) {
  22231. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  22232. var grid = sender.view.grid.ownerGrid;
  22233. var column = grid.getColumns()[sender.fullColumnIndex];
  22234. var context = {
  22235. event: e,
  22236. column: column,
  22237. field: sender.dataIndex,
  22238. value: checked,
  22239. record: record,
  22240. rowIdx: rowIndex
  22241. };
  22242. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  22243. });
  22244. ck.call(this, config);
  22245. }
  22246. });
  22247. // 227573
  22248. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  22249. // Ext.define('Yvan.ColumnOverride', {
  22250. // override: 'Ext.grid.column.Column',
  22251. //
  22252. // config: {
  22253. // enableSortOnClick: false,
  22254. // },
  22255. //
  22256. // // /**@Overrides*/
  22257. // onTitleElClick: function (e, t, sortOnClick) {
  22258. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  22259. // if (!$(e.target).is('.x-column-header-trigger')) {
  22260. // // 不是点击菜单的情况下,让列自适应宽度
  22261. // this.autoSize()
  22262. // }
  22263. // return onTitleElClick.call(this, e, t, false)
  22264. // }
  22265. // });
  22266. }
  22267. //# sourceMappingURL=gridcolumn.js.map
  22268. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  22269. /**
  22270. * 判断目标字符串与关键字是否重叠
  22271. * @param target 目标字符串
  22272. * @param keyword 搜索关键字
  22273. */
  22274. function pinyinMatch(target, keyword) {
  22275. if (typeof target != 'string' || typeof keyword != 'string') {
  22276. return false;
  22277. }
  22278. if (!keyword || !target) {
  22279. return false;
  22280. }
  22281. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  22282. keyword = _$2.toLower(keyword);
  22283. var pos1 = _$2.toLower(target).indexOf(keyword);
  22284. if (pos1 >= 0) {
  22285. return true;
  22286. }
  22287. var len = _$2.intersection(keyword.split('')).length;
  22288. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  22289. return true;
  22290. }
  22291. return false;
  22292. }
  22293. /**
  22294. * 对某个表达式进行求值
  22295. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  22296. *
  22297. * @example
  22298. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  22299. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  22300. *
  22301. * @param data 数据环境对象
  22302. * @param express 表达式对象
  22303. */
  22304. function calcExpress(data, express) {
  22305. var result = express;
  22306. if (SIMPLE_RE.test(express)) {
  22307. // '{foo}' 简单表达式
  22308. var path = express.substring(1, express.length - 1);
  22309. var ret = _$2.get(data, path);
  22310. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  22311. }
  22312. while (true) {
  22313. var mlist = result.match(/{(.*?)}/);
  22314. if (!mlist) {
  22315. break;
  22316. }
  22317. var pathC = mlist[0]; // {query.a}
  22318. var path = mlist[1]; // query.a
  22319. var value = _$2.get(data, path);
  22320. result = result.replaceAll(pathC, value || '');
  22321. }
  22322. return result;
  22323. }
  22324. /**
  22325. * 对个对象进行表达式求值,不用回调
  22326. * @example
  22327. * 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}'] })
  22328. *
  22329. * {
  22330. * a: '{query.a}',
  22331. * b: {
  22332. * b1: '{query.b1}',
  22333. * b2: '{query.b2}',
  22334. * },
  22335. * c: 'aa',
  22336. * d: [
  22337. * '{query.d1}',
  22338. * '{query.d2}'
  22339. * ]
  22340. * }
  22341. *
  22342. * 计算结果为
  22343. * {
  22344. * a: 'aValue',
  22345. * b: {
  22346. * b1: 'b1Value',
  22347. * b2: 'b2Value'
  22348. * },
  22349. * c: 'aa'
  22350. * d: [
  22351. * '1',
  22352. * '2'
  22353. * ]
  22354. * }
  22355. *
  22356. * @param data
  22357. * @param paramObject
  22358. */
  22359. function calcObjectFlat(data, paramObject) {
  22360. var result = _$2.cloneDeep(paramObject);
  22361. if (typeof paramObject === 'string') {
  22362. return calcExpress(data, paramObject);
  22363. }
  22364. var trav = function (param) {
  22365. _$2.forOwn(param, function (value, key) {
  22366. if (_$2.isPlainObject(value)) {
  22367. // 深度递归,对子对象进行求解
  22368. trav(value);
  22369. }
  22370. else if (_$2.isString(value)) {
  22371. // 字符串直接用 calcExpress 表达式求解
  22372. param[key] = calcExpress(data, param[key]);
  22373. }
  22374. else if (_$2.isArray(value)) {
  22375. // 数组求解
  22376. _$2.each(value, function (v, idx) {
  22377. value[idx] = calcExpress(data, v);
  22378. });
  22379. }
  22380. });
  22381. };
  22382. trav(result);
  22383. return result;
  22384. }
  22385. /**
  22386. * 合併 data 到當前的 ViewModel 對象
  22387. */
  22388. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  22389. var newRow = {};
  22390. if (isFlat == false) {
  22391. newRow = data;
  22392. }
  22393. else {
  22394. flatObject(newRow, '', data);
  22395. }
  22396. if (!propertyName) {
  22397. _$2.forOwn(newRow, function (value, key) {
  22398. viewModel.set(key, value);
  22399. });
  22400. }
  22401. else {
  22402. _$2.forOwn(newRow, function (value, key) {
  22403. viewModel.set(propertyName + "." + key, value);
  22404. });
  22405. }
  22406. }
  22407. /**
  22408. * 转换内联结构的行,到平面结构
  22409. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  22410. *
  22411. * @param array
  22412. * @param flatOption
  22413. * @return {[]}
  22414. */
  22415. function flatRow(array) {
  22416. var ret = [];
  22417. _$2.forEach(array, function (row) {
  22418. var newRow = {};
  22419. flatObject(newRow, '', row);
  22420. ret.push(newRow);
  22421. });
  22422. return ret;
  22423. }
  22424. function flatObject(parentObj, parentProp, obj) {
  22425. _$2.forOwn(obj, function (value, key) {
  22426. var fullKey = parentProp ? parentProp + '_' + key : key;
  22427. if (_$2.isArray(value)) {
  22428. parentObj[fullKey] = _$2.map(value, function (row) {
  22429. var newRow = {};
  22430. flatObject(newRow, '', row);
  22431. return newRow;
  22432. });
  22433. }
  22434. else {
  22435. if (typeof value === 'object') {
  22436. flatObject(parentObj, fullKey, value);
  22437. }
  22438. else {
  22439. parentObj[fullKey] = value;
  22440. }
  22441. }
  22442. });
  22443. }
  22444. /**
  22445. * 替换内部结构中,所有 N/A
  22446. */
  22447. function replaceNA(obj) {
  22448. if (obj === 'N/A') {
  22449. return '';
  22450. }
  22451. if (_$2.isArray(obj)) {
  22452. _$2.forEach(obj, function (value, idx) {
  22453. if (value === 'N/A') {
  22454. obj[idx] = '';
  22455. }
  22456. else {
  22457. replaceNA(value);
  22458. }
  22459. });
  22460. }
  22461. else if (_$2.isPlainObject(obj)) {
  22462. _$2.forOwn(obj, function (value, key) {
  22463. if (value === 'N/A') {
  22464. obj[key] = '';
  22465. }
  22466. else {
  22467. replaceNA(value);
  22468. }
  22469. });
  22470. }
  22471. }
  22472. function deepTravJson(obj, resolver) {
  22473. if (_$2.isArray(obj)) {
  22474. _$2.forEach(obj, function (value, idx) {
  22475. if (typeof value === 'string') {
  22476. resolver(obj, value, idx);
  22477. }
  22478. else {
  22479. deepTravJson(value, resolver);
  22480. }
  22481. });
  22482. }
  22483. else if (_$2.isPlainObject(obj)) {
  22484. _$2.forOwn(obj, function (value, key) {
  22485. if (typeof value === 'string') {
  22486. resolver(obj, value, key);
  22487. }
  22488. else {
  22489. deepTravJson(value, resolver);
  22490. }
  22491. });
  22492. }
  22493. }
  22494. /**
  22495. * 根据表达式进入写值
  22496. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  22497. * express="test-{query.a}" 写值就会失败
  22498. *
  22499. * @example
  22500. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  22501. * 写值成功
  22502. *
  22503. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  22504. * 写值失败
  22505. *
  22506. * @param viewModel VM对象
  22507. * @param express 表达式对象
  22508. * @param value 目标值
  22509. */
  22510. function tryWriteByExpress(viewModel, express, value) {
  22511. if (SIMPLE_RE.test(express)) {
  22512. // '{foo}' 简单表达式
  22513. express = express.substring(1, express.length - 1);
  22514. viewModel.set(express, value);
  22515. }
  22516. }
  22517. /**
  22518. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  22519. * @example
  22520. * 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]})
  22521. *
  22522. * expressObject:
  22523. * {
  22524. * a: '{query.a}',
  22525. * b: {
  22526. * b1: '{query.b1}',
  22527. * b2: '{query.b2}',
  22528. * },
  22529. * c: 'aa',
  22530. * d: [
  22531. * '{query.a}',
  22532. * '{query.b2}'
  22533. * ]
  22534. * }
  22535. *
  22536. * valueObject:
  22537. * {
  22538. * a: 'aValue',
  22539. * b: {
  22540. * b1: 'b1Value',
  22541. * b2: 'b2Value'
  22542. * },
  22543. * c: 'aa'
  22544. * c: [
  22545. * 'aValue',
  22546. * 'b2Value'
  22547. * ]
  22548. * }
  22549. *
  22550. * 系统会尝试回写
  22551. * viewModel.set('query.a', 'aValue')
  22552. * viewModel.set('query.b1', 'b1Value')
  22553. * viewModel.set('query.b2', 'b2Value')
  22554. *
  22555. * @param expressObject 含表达式的对象
  22556. * @param valueObject 表达式计算完成之后的结果对象
  22557. * @param writeFn 写入的方法 (path, value)=>void
  22558. */
  22559. function tryWriteObject(expressObject, valueObject, writeFn) {
  22560. var trav = function (pathPrefix) {
  22561. var parent = expressObject;
  22562. if (_$2.size(pathPrefix) > 1) {
  22563. parent = _$2.get(parent, pathPrefix.substring(1));
  22564. }
  22565. _$2.forOwn(parent, function (value, key) {
  22566. if (_$2.isPlainObject(value)) {
  22567. // 深度递归,对子对象进行求解
  22568. trav(pathPrefix + "." + key);
  22569. }
  22570. else if (_$2.isString(value)) {
  22571. // 字符串直接用 calcExpress 表达式求解
  22572. if (SIMPLE_RE.test(value)) {
  22573. // If we have '{foo}' alone it is a literal 简单表达式
  22574. var targetPath = value.substring(1, value.length - 1);
  22575. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  22576. if (!writeFn) {
  22577. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22578. }
  22579. else {
  22580. writeFn(targetPath, targetValue);
  22581. }
  22582. }
  22583. }
  22584. else if (_$2.isArray(value)) {
  22585. _$2.each(value, function (v, idx) {
  22586. if (SIMPLE_RE.test(v)) {
  22587. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  22588. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  22589. if (!writeFn) {
  22590. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22591. }
  22592. else {
  22593. writeFn(targetPath, targetValue);
  22594. }
  22595. }
  22596. });
  22597. }
  22598. });
  22599. };
  22600. trav("");
  22601. }
  22602. /**
  22603. * 尝试去掉变量两边括号
  22604. * {a} => a
  22605. * a => a
  22606. */
  22607. function tryVarSimple(value) {
  22608. if (SIMPLE_RE.test(value)) {
  22609. // If we have '{foo}' alone it is a literal 简单表达式
  22610. return value.substring(1, value.length - 1);
  22611. }
  22612. return value;
  22613. }
  22614. /**
  22615. * 对多个表达式进行求值. 异步回调的方式返回
  22616. * {
  22617. * a: 1,
  22618. * b: '{someBind}',
  22619. * c: ['a', 'b', 'c'],
  22620. * d: ['a', 'b', '{someBind}'],
  22621. * e: {
  22622. * y: 1,
  22623. * z: 2
  22624. * },
  22625. * f: {
  22626. * y: 1,
  22627. * z: '{someBind}'
  22628. * }
  22629. * }
  22630. *
  22631. * // Will produce
  22632. * {
  22633. * b: value,
  22634. * d: ['a', 'b', value],
  22635. * f: {
  22636. * y: 1,
  22637. * z: value
  22638. * }
  22639. * }
  22640. * @param viewModel scope.viewModel对象
  22641. * @param paramObject 求值对象
  22642. */
  22643. function calcObject(viewModel, paramObject) {
  22644. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  22645. return new Promise(function (resolve) {
  22646. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  22647. schedule.destroy();
  22648. // 从 Ext.data.Model 对象转换为 js-object 对象
  22649. ret = toPlainObject(ret);
  22650. resolve(ret);
  22651. }, viewModel, { single: true });
  22652. });
  22653. }
  22654. /**
  22655. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  22656. * @param config 组件构造函数传入的 config 配置文件
  22657. */
  22658. function getParentGrid(config) {
  22659. var _a;
  22660. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  22661. }
  22662. /**
  22663. * 解析
  22664. * {
  22665. * condition: "{skuId}",
  22666. * errorMsg: "无法编辑",
  22667. * notice: 'msg'
  22668. * }
  22669. */
  22670. function tryEnable(data, enableSetting) {
  22671. if (!enableSetting) {
  22672. // 没有这一段配置,可以编辑
  22673. return true;
  22674. }
  22675. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  22676. if (!evalFunction(data, condition)) {
  22677. // 没有达成 condition 条件
  22678. // 计算 msg 消息内容
  22679. var msgContent = calcExpress(data, errorMsg);
  22680. if (msgContent) {
  22681. if (!notice || notice === 'msg') {
  22682. // 进行提示
  22683. msg$1(msgContent);
  22684. }
  22685. }
  22686. return false;
  22687. }
  22688. return true;
  22689. }
  22690. /**
  22691. * 动态的为 combo 或 columns.combo 设置下拉框的值
  22692. * @param sender 目标对象
  22693. * @param config 目标对象的配置(在构造函数之前也可以)
  22694. * @param getDictFn 获取字典的方法
  22695. * @param bizKey 传入字典的参数
  22696. * @param multiValueSeparator 多个字典值的分割符号
  22697. */
  22698. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  22699. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  22700. // sender 和 config为空的时候获取值、
  22701. if (_$2.isArray(getDictFn)) {
  22702. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  22703. var realArray_1 = getDictFn;
  22704. getDictFn = function () {
  22705. return realArray_1;
  22706. };
  22707. }
  22708. if (!sender) {
  22709. return new Promise(function (resolve, reject) {
  22710. getDictFn(bizKey, function (r) {
  22711. resolve({ config: config, r: r });
  22712. });
  22713. });
  22714. }
  22715. if (sender.xtype === 'combotree') {
  22716. getDictFn(bizKey, function (r) {
  22717. if (sender.store) {
  22718. // 异步回传
  22719. sender.setStore(new Ext.data.TreeStore({ root: r }));
  22720. }
  22721. else {
  22722. // 同步回传
  22723. config.store = new Ext.data.TreeStore({ root: r });
  22724. }
  22725. });
  22726. return;
  22727. }
  22728. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  22729. getDictFn(bizKey, function (r) {
  22730. var _a, _b;
  22731. if (sender.store) {
  22732. // 异步回传
  22733. sender.setStore(new Ext.data.Store(r));
  22734. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  22735. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  22736. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  22737. if (typeof realValue !== 'undefined') {
  22738. sender.setValue(realValue);
  22739. }
  22740. }
  22741. else {
  22742. // 同步回传
  22743. config.store = new Ext.data.Store(r);
  22744. }
  22745. });
  22746. return;
  22747. }
  22748. else if (sender.xtype === 'gridcolumn') {
  22749. var grid = getParentGrid(config);
  22750. var editor_1 = config.editor, renderer = config.renderer;
  22751. getDictFn(bizKey, function (r) {
  22752. if (sender.store) {
  22753. // 已经渲染出来了, 用方法进行修改
  22754. var editor_2 = sender.getEditor();
  22755. if (editor_2 && editor_2.xtype === 'combo') {
  22756. var valueField_1 = r.field[0];
  22757. var displayField_1 = r.field[1];
  22758. editor_2.valueField = valueField_1;
  22759. editor_2.setDisplayField(displayField_1);
  22760. editor_2.setStore(new Ext.data.Store(r));
  22761. }
  22762. sender.setFilter({
  22763. type: 'list',
  22764. options: _$2.map(r.data, function (r) { return ({
  22765. id: '' + r.id,
  22766. text: r.text,
  22767. }); })
  22768. });
  22769. }
  22770. else {
  22771. // 没有渲染之前,修改 config 即可
  22772. if (editor_1 && editor_1.xtype === 'combo') {
  22773. // 带编辑模式
  22774. editor_1.store = new Ext.data.Store(r);
  22775. }
  22776. config.filter = {
  22777. type: 'list',
  22778. options: _$2.map(r.data, function (r) { return ({
  22779. id: '' + r.id,
  22780. text: r.text,
  22781. }); })
  22782. };
  22783. }
  22784. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  22785. var renderer = function (value, metaData) {
  22786. if (metaData === void 0) { metaData = false; }
  22787. if (!value && value != 0) {
  22788. return '';
  22789. }
  22790. var valueField = r.field[metaData === true ? 1 : 0];
  22791. var displayField = r.field[metaData === true ? 0 : 1];
  22792. var separator = multiValueSeparator;
  22793. if (separator) {
  22794. var arr = value.split(separator);
  22795. var displayValue_1 = "";
  22796. var _loop_1 = function (i) {
  22797. var itv = arr[i];
  22798. if (i > 0) {
  22799. displayValue_1 += separator;
  22800. }
  22801. _$2.each(r.data, function (row) {
  22802. // 从 valueField 找到要显示的 displayField
  22803. if (row[valueField] == itv) {
  22804. displayValue_1 += row[displayField];
  22805. return false;
  22806. }
  22807. else {
  22808. if (i >= r.data.length - 1) {
  22809. displayValue_1 += itv;
  22810. }
  22811. }
  22812. });
  22813. };
  22814. for (var i = 0; i < arr.length; i++) {
  22815. _loop_1(i);
  22816. }
  22817. return displayValue_1;
  22818. }
  22819. _$2.each(r.data, function (row) {
  22820. // 从 valueField 找到要显示的 displayField
  22821. if (row[valueField] == value) {
  22822. value = row[displayField];
  22823. return false;
  22824. }
  22825. });
  22826. return value;
  22827. };
  22828. var dictForExcel = {};
  22829. var valueField = r.field[0];
  22830. var displayField = r.field[1];
  22831. _$2.each(r.data, function (row) {
  22832. // 从 valueField 找到要显示的 displayField
  22833. var key = row[valueField];
  22834. if (key != '' && typeof key != "undefined" && key != null) {
  22835. dictForExcel[key] = row[displayField];
  22836. }
  22837. });
  22838. if (sender.rendered) {
  22839. // 已经渲染出来了, 对列进行渲染
  22840. sender.renderer = renderer;
  22841. sender.dictForExcel = dictForExcel;
  22842. sender.getView().refresh();
  22843. }
  22844. else {
  22845. sender.renderer = renderer;
  22846. sender.dictForExcel = dictForExcel;
  22847. config.renderer = renderer;
  22848. config.dictForExcel = dictForExcel;
  22849. }
  22850. });
  22851. return;
  22852. }
  22853. throw new TypeError("无法识别的组件类型");
  22854. }
  22855. /**
  22856. * 调用服务器 Ajax
  22857. */
  22858. function invokeServer$1(url) {
  22859. var args = [];
  22860. for (var _i = 1; _i < arguments.length; _i++) {
  22861. args[_i - 1] = arguments[_i];
  22862. }
  22863. // @ts-ignore
  22864. return ajax.func({
  22865. url: url,
  22866. method: 'invoke',
  22867. args: args
  22868. });
  22869. }
  22870. function clearViewModelValues(viewModel, propertyName) {
  22871. if (!propertyName) {
  22872. var dd_1 = viewModel.getData();
  22873. _$2.forOwn(dd_1, function (value, key) {
  22874. viewModel.set(key, '');
  22875. });
  22876. return;
  22877. }
  22878. var dd = _$2.get(viewModel.getData(), propertyName);
  22879. _$2.forOwn(dd, function (value, key) {
  22880. viewModel.set(propertyName + '.' + key, '');
  22881. });
  22882. }
  22883. function reloadGrid(scope, gridRefName) {
  22884. var _a;
  22885. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  22886. }
  22887. /**
  22888. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  22889. */
  22890. function toPlainObject(obj) {
  22891. if (obj.isModel) {
  22892. obj = obj.data;
  22893. }
  22894. _$2.forOwn(obj, function (v, k) {
  22895. // Ext.data.Model.constructor
  22896. if (!v) {
  22897. return;
  22898. }
  22899. if (v.isModel) {
  22900. v = v.data;
  22901. }
  22902. if (typeof v === 'object') {
  22903. obj[k] = toPlainObject(v);
  22904. }
  22905. else {
  22906. obj[k] = v;
  22907. }
  22908. });
  22909. return obj;
  22910. }
  22911. function confirm(msg, sender) {
  22912. return new Promise(function (resolve) {
  22913. var _a, _b;
  22914. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  22915. var config = {
  22916. title: '请确认',
  22917. modal: true,
  22918. animateTarget: sender,
  22919. // resizable: false,
  22920. // constrainHeader: true,
  22921. // constrain: true,
  22922. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  22923. layout: {
  22924. type: 'hbox',
  22925. pack: 'start',
  22926. align: 'stretch'
  22927. },
  22928. items: [
  22929. {
  22930. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  22931. border: false,
  22932. },
  22933. {
  22934. flex: 1,
  22935. border: false,
  22936. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(msg) + "</div>"
  22937. }
  22938. ],
  22939. buttons: [
  22940. {
  22941. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  22942. handler: function () {
  22943. resolve();
  22944. win.close();
  22945. }
  22946. },
  22947. {
  22948. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  22949. handler: function () {
  22950. win.close();
  22951. }
  22952. }
  22953. ],
  22954. keyMapEnabled: true,
  22955. keyMap: {
  22956. ENTER: function () {
  22957. resolve();
  22958. win.close();
  22959. }
  22960. }
  22961. };
  22962. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22963. config.constrain = true;
  22964. }
  22965. var win = new Ext.Window(config);
  22966. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22967. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  22968. }
  22969. win.show();
  22970. });
  22971. }
  22972. /**
  22973. * 任何符号字符串都替换成下换线
  22974. */
  22975. function normId(value) {
  22976. return _$2.replace(value, /[^\w]/g, '_');
  22977. }
  22978. /**
  22979. *
  22980. * @param sender
  22981. * @param propertyName
  22982. * @param gridRefName
  22983. */
  22984. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  22985. var _a, _b;
  22986. var scope = lookupScope(sender);
  22987. clearViewModelValues(scope.viewModel, propertyName);
  22988. if (!gridRefName) {
  22989. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  22990. }
  22991. else {
  22992. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  22993. }
  22994. }
  22995. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  22996. if ([10, 13, 20, 40].includes(event.keyCode)) {
  22997. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  22998. var value = _$2.trim(sender.rawValue);
  22999. raiseClick(eOpts.handle);
  23000. }
  23001. }, 150);
  23002. function saveGridRow(grid1) {
  23003. var _a;
  23004. var config = grid1.config;
  23005. var scope = lookupScope(grid1);
  23006. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  23007. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  23008. // "表格保存"的相关配置
  23009. var dbSaveConfig = {
  23010. columns: [],
  23011. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  23012. saveRowValues: saveRowValues,
  23013. path: scope.originalVjson.__custom_path,
  23014. };
  23015. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  23016. if (err) {
  23017. // 如果有异常就不保存
  23018. return;
  23019. }
  23020. // 构建"表格保存"的相关配置
  23021. for (var i = 0; i < config.columns.length; i++) {
  23022. var c = config.columns[i];
  23023. var v = {
  23024. dataIndex: c.dataIndex,
  23025. header: c.header,
  23026. dbColumn: c.dbColumn,
  23027. serverCreateValue: c.serverCreateValue,
  23028. dbIsDeleteKey: c.dbIsDeleteKey,
  23029. dbIsUpdateKey: c.dbIsUpdateKey,
  23030. dbUpdateEnable: c.dbUpdateEnable,
  23031. serverValueConvert: c.dbUpdateEnable,
  23032. };
  23033. if (c.editor) {
  23034. v.editor = {
  23035. xtype: c.editor.xtype,
  23036. required: c.editor.required,
  23037. };
  23038. }
  23039. dbSaveConfig.columns.push(v);
  23040. }
  23041. // 进行业务上的逻辑校验
  23042. var hasError = false;
  23043. _$2.forEach(rows, function (row, i) {
  23044. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  23045. var c = config.columns[i_1];
  23046. var value = row[c.dataIndex];
  23047. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  23048. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  23049. hasError = true;
  23050. return false;
  23051. }
  23052. if (c.xtype === 'checkcolumn') {
  23053. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  23054. row[c.dataIndex] = c.uncheckedValue;
  23055. }
  23056. if (value === true && typeof c.checkedValue !== 'undefined') {
  23057. row[c.dataIndex] = c.checkedValue;
  23058. }
  23059. }
  23060. }
  23061. });
  23062. if (hasError) {
  23063. return;
  23064. }
  23065. // 设置当前界面为 "保存中..." 状态
  23066. grid1.setLoading(true);
  23067. invokeServer$1('/Dev@batchSave', {
  23068. newRows: newRows,
  23069. modifyRows: modifyRows,
  23070. removeRecords: removeRecords,
  23071. config: dbSaveConfig,
  23072. }).then(function (res) {
  23073. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  23074. msg$1(res.msg);
  23075. grid1.reload();
  23076. }).catch(function (e) {
  23077. console.error(e);
  23078. showErrorDialog$1(_$2.toString(e));
  23079. }).finally(function () {
  23080. // 无论正常异常,关闭 "保存中..." 状态
  23081. grid1.setLoading(false);
  23082. });
  23083. }
  23084. function insertGridRow(grid1) {
  23085. var config = grid1.config;
  23086. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  23087. var insertRow = {};
  23088. _$2.forEach(config.columns, function (c) {
  23089. var fn = c.createValue;
  23090. if (_$2.startsWith(fn, 'scope.') ||
  23091. _$2.startsWith(fn, 'system.')) {
  23092. var scope = lookupScope(grid1);
  23093. var fn2 = lookupFn(scope, fn, c);
  23094. if (_$2.isFunction(fn2)) {
  23095. var newValue = fn2();
  23096. if (!_$2.isUndefined(newValue)) {
  23097. insertRow[c.dataIndex] = newValue;
  23098. }
  23099. }
  23100. }
  23101. else if (_$2.isString(fn) && fn) {
  23102. insertRow[c.dataIndex] = fn;
  23103. }
  23104. });
  23105. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  23106. }
  23107. function commitMe(sender) {
  23108. var window = sender.up('window');
  23109. var scope = lookupScope(sender);
  23110. if (typeof scope['commit'] === 'function') {
  23111. scope['commit']().then(function (res) {
  23112. window.close();
  23113. });
  23114. }
  23115. }
  23116. function removeGridRow(grid1) {
  23117. var _a;
  23118. var config = grid1.config;
  23119. var rows = [];
  23120. if (grid1.selModel.selType === "rowmodel") {
  23121. rows.push(grid1.selection);
  23122. }
  23123. else {
  23124. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  23125. rows.push(r);
  23126. });
  23127. }
  23128. if (rows.length > 1) {
  23129. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  23130. if (_$2.isUndefined(batchRemoveConfirm)) {
  23131. //不需要提示
  23132. _$2.forEach(rows, function (r) {
  23133. grid1.getStore().remove(r);
  23134. });
  23135. }
  23136. else {
  23137. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  23138. confirm(tip).then(function () {
  23139. _$2.forEach(rows, function (r) {
  23140. grid1.getStore().remove(r);
  23141. });
  23142. });
  23143. }
  23144. }
  23145. else if (rows.length === 1) {
  23146. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  23147. if (_$2.isUndefined(singleRemoveConfirm)) {
  23148. //不需要提示
  23149. grid1.getStore().remove(rows[0]);
  23150. }
  23151. else {
  23152. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  23153. _$2.forEach(config.columns, function (c) {
  23154. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  23155. });
  23156. confirm(tip_1).then(function () {
  23157. grid1.getStore().remove(rows[0]);
  23158. });
  23159. }
  23160. }
  23161. else {
  23162. msg$1('请选择要删除的数据!');
  23163. }
  23164. }
  23165. function moveUpGridRow(grid) {
  23166. grid.rowMoveUp();
  23167. }
  23168. function moveDownGridRow(grid) {
  23169. grid.rowMoveDown();
  23170. }
  23171. var SystemEventFu = /** @class */ (function () {
  23172. function SystemEventFu() {
  23173. }
  23174. SystemEventFu.prototype.moveUpGridRow = function () {
  23175. return function (sender) {
  23176. var grid1 = sender.up('yvgrid');
  23177. moveUpGridRow(grid1);
  23178. };
  23179. };
  23180. SystemEventFu.prototype.commitMe = function () {
  23181. return function (sender) {
  23182. commitMe(sender);
  23183. };
  23184. };
  23185. SystemEventFu.prototype.moveDownGridRow = function () {
  23186. return function (sender) {
  23187. var grid1 = sender.up('yvgrid');
  23188. moveDownGridRow(grid1);
  23189. };
  23190. };
  23191. SystemEventFu.prototype.saveGridRow = function () {
  23192. return function (sender) {
  23193. var grid1 = sender.up('yvgrid');
  23194. saveGridRow(grid1);
  23195. };
  23196. };
  23197. SystemEventFu.prototype.insertGridRow = function () {
  23198. return function (sender) {
  23199. var grid1 = sender.up('yvgrid');
  23200. insertGridRow(grid1);
  23201. };
  23202. };
  23203. SystemEventFu.prototype.removeGridRow = function () {
  23204. return function (sender) {
  23205. var grid1 = sender.up('yvgrid');
  23206. removeGridRow(grid1);
  23207. };
  23208. };
  23209. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  23210. return function (sender, config) {
  23211. if (!config.listeners) {
  23212. config.listeners = {};
  23213. }
  23214. config.listeners.afterrender = function (sender) {
  23215. var scope = lookupScope(sender);
  23216. // $(sender.el.dom).on('keydown', (e) => {
  23217. // const xtype = Ext.fly(e.target).component.xtype
  23218. // if (xtype === 'textfield' && e.keyCode === 13) {
  23219. // Ext.defer(() => {
  23220. // raiseClick(scope.refs[btnReferenceName])
  23221. // })
  23222. // e.preventDefault()
  23223. // e.stopPropagation()
  23224. // return false
  23225. // }
  23226. // })
  23227. $(sender.el.dom).on('keyup', function (e) {
  23228. var tt = Ext.fly(e.target).component;
  23229. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  23230. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  23231. ![10, 13, 20, 40].includes(e.keyCode)) {
  23232. return;
  23233. }
  23234. e.preventDefault();
  23235. e.stopPropagation();
  23236. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  23237. return;
  23238. });
  23239. };
  23240. };
  23241. };
  23242. SystemEventFu.prototype.confirm = function (text, fn) {
  23243. return function (sender) {
  23244. var scope = lookupScope(sender);
  23245. var msg = calcExpress(scope.viewModel.data, text);
  23246. confirm(msg, sender).then(function () {
  23247. fn.call(scope, sender);
  23248. });
  23249. };
  23250. };
  23251. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  23252. return function (sender) {
  23253. var scope = lookupScope(sender);
  23254. var grid = scope.refs[gridRefName];
  23255. if (grid) {
  23256. var records = grid.getSelectionModel().getLastSelected();
  23257. grid.store.remove(records);
  23258. }
  23259. };
  23260. };
  23261. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  23262. //可以是 scope.XX / system.XX / string / lookup表达式
  23263. writeTarget) {
  23264. return function (sender) {
  23265. if (!invokeUrl) {
  23266. return;
  23267. }
  23268. var scope = lookupScope(sender);
  23269. scope.setLoading(true);
  23270. var data = scope.viewModel.data;
  23271. if (invokeParam) {
  23272. data = calcObjectFlat(data, invokeParam);
  23273. }
  23274. invokeServer$1(invokeUrl, data).then(function (res) {
  23275. if (res.success) {
  23276. if (typeof writeTarget === "string") {
  23277. _$2.forOwn(res.data, function (v, k) {
  23278. scope.viewModel.set(writeTarget + "." + k, v);
  23279. });
  23280. }
  23281. else if (typeof writeTarget === 'function') {
  23282. writeTarget.call(scope, res.data);
  23283. }
  23284. else if (typeof writeTarget === 'object') {
  23285. var ret = calcObjectFlat(res.data, writeTarget);
  23286. _$2.forOwn(ret, function (v, k) {
  23287. scope.viewModel.set(k, v);
  23288. });
  23289. }
  23290. }
  23291. else {
  23292. showErrorDialog$1(res.msg || '未知错误', sender);
  23293. }
  23294. }).catch(function (e) {
  23295. var _a, _b;
  23296. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23297. showErrorDialog$1(msg || e.toString(), sender);
  23298. }).finally(function () {
  23299. scope.setLoading(false);
  23300. });
  23301. };
  23302. };
  23303. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  23304. return function (sender) {
  23305. var scope = lookupScope(sender);
  23306. scope.setLoading(true);
  23307. var data = scope.viewModel.data;
  23308. if (arg0) {
  23309. data = calcObjectFlat(data, arg0);
  23310. }
  23311. invokeServer$1(groovyUrl, data).then(function (res) {
  23312. if (res.success) {
  23313. if (res.msg) {
  23314. msg(res.msg);
  23315. }
  23316. if (typeof successCallback === 'function') {
  23317. successCallback.call(scope, sender, res.data);
  23318. }
  23319. }
  23320. else {
  23321. showErrorDialog$1(res.msg || '未知错误', sender);
  23322. }
  23323. }).catch(function (e) {
  23324. var _a, _b;
  23325. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23326. showErrorDialog$1(msg || e.toString(), sender);
  23327. }).finally(function () {
  23328. scope.setLoading(false);
  23329. });
  23330. };
  23331. };
  23332. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  23333. return function (sender) {
  23334. var scope = lookupScope(sender);
  23335. var form = scope.down('form');
  23336. if (form) {
  23337. // 如果下级有表单,就做表单校验
  23338. var valid = form.isValid();
  23339. if (!valid) {
  23340. return;
  23341. }
  23342. }
  23343. scope.setLoading(true);
  23344. var data = scope.viewModel.data;
  23345. if (arg0) {
  23346. data = calcObjectFlat(data, arg0);
  23347. }
  23348. invokeServer$1(groovyUrl, data).then(function (res) {
  23349. if (res.success) {
  23350. if (res.msg) {
  23351. msg(res.msg);
  23352. }
  23353. scope.dialogSuccess(res);
  23354. }
  23355. else {
  23356. showErrorDialog$1(res.msg || '未知错误', sender);
  23357. }
  23358. }).catch(function (e) {
  23359. var _a, _b;
  23360. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23361. showErrorDialog$1(msg || e.toString(), sender);
  23362. }).finally(function () {
  23363. scope.setLoading(false);
  23364. });
  23365. };
  23366. };
  23367. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  23368. return function (sender) {
  23369. var scope = lookupScope(sender);
  23370. if (lookupObject) {
  23371. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  23372. }
  23373. else {
  23374. scope.dialogSuccess();
  23375. }
  23376. };
  23377. };
  23378. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  23379. return function (sender) {
  23380. var scope = lookupScope(sender);
  23381. clearViewModelValues(scope.viewModel, propertyName);
  23382. };
  23383. };
  23384. SystemEventFu.prototype.getGrid = function (url) {
  23385. return function (sender, config) {
  23386. if (config.xtype == "combogridmulti") {
  23387. // @ts-ignore
  23388. require([url], function (grid) {
  23389. _$2.forOwn(grid.default, function (v, k) {
  23390. sender[k] = v;
  23391. sender.config[k] = v;
  23392. if (sender.rendered) {
  23393. // 已经渲染出来了,重新调用 reload 强制刷新
  23394. sender.reload();
  23395. }
  23396. });
  23397. });
  23398. }
  23399. else {
  23400. // @ts-ignore
  23401. require([url], function (grid) {
  23402. sender.grid = grid.default;
  23403. config.grid = grid.default;
  23404. });
  23405. }
  23406. };
  23407. };
  23408. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  23409. return function (sender) {
  23410. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  23411. };
  23412. };
  23413. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  23414. return function (sender) {
  23415. var _a, _b;
  23416. var scope = lookupScope(sender);
  23417. if (!gridRefName) {
  23418. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  23419. }
  23420. else {
  23421. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  23422. }
  23423. };
  23424. };
  23425. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  23426. return function (sender) {
  23427. var scope = lookupScope(sender);
  23428. var data = scope.viewModel.data;
  23429. var param = calcObjectFlat(data, lookupForData);
  23430. // @ts-ignore
  23431. require([url], function (module) {
  23432. var ScopeClass = module.default;
  23433. var scope = new ScopeClass();
  23434. scope.success = successCallback;
  23435. scope.showDialog(sender, {}, { data: param });
  23436. });
  23437. };
  23438. };
  23439. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  23440. return function (sender, queryValue) {
  23441. showWidget(widgetUrl, lookup, sender, queryValue);
  23442. };
  23443. };
  23444. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  23445. return function (sender) {
  23446. clearViewModelByLookup(sender, lookup);
  23447. };
  23448. };
  23449. SystemEventFu.prototype.closeMe = function (callBack) {
  23450. return function (sender) {
  23451. var scope = lookupScope(sender);
  23452. scope.close();
  23453. if (callBack) {
  23454. callBack.call(sender);
  23455. }
  23456. };
  23457. };
  23458. // 未完成
  23459. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  23460. return function (sender) {
  23461. var scope = lookupScope(sender);
  23462. var data = scope.viewModel.data;
  23463. var billSetting = scope.billSetting;
  23464. var param = calcObjectFlat(data, lookupForData);
  23465. return new Promise(function (resolve, reject) {
  23466. var sf = function (scope) {
  23467. scope.success = function (dlgScope, dlgSender, reData) {
  23468. };
  23469. scope.showDialog(sender, {}, { data: param });
  23470. };
  23471. // @ts-ignore
  23472. require([url], function (module) {
  23473. // 业务描述文件
  23474. if (url.endsWith(".bill")) {
  23475. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  23476. sf(scope);
  23477. });
  23478. }
  23479. else { //原生yvanui文件
  23480. var ScopeClass = module.default;
  23481. var scope_1 = new ScopeClass();
  23482. sf(scope_1);
  23483. }
  23484. });
  23485. });
  23486. };
  23487. };
  23488. __decorate([
  23489. Lib({
  23490. title: '为某个表格,上移行',
  23491. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23492. }),
  23493. __metadata("design:type", Function),
  23494. __metadata("design:paramtypes", []),
  23495. __metadata("design:returntype", void 0)
  23496. ], SystemEventFu.prototype, "moveUpGridRow", null);
  23497. __decorate([
  23498. Lib({
  23499. title: '为某个表格,上移行',
  23500. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23501. }),
  23502. __metadata("design:type", Function),
  23503. __metadata("design:paramtypes", []),
  23504. __metadata("design:returntype", void 0)
  23505. ], SystemEventFu.prototype, "commitMe", null);
  23506. __decorate([
  23507. Lib({
  23508. title: '为某个表格,下移行',
  23509. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23510. }),
  23511. __metadata("design:type", Function),
  23512. __metadata("design:paramtypes", []),
  23513. __metadata("design:returntype", void 0)
  23514. ], SystemEventFu.prototype, "moveDownGridRow", null);
  23515. __decorate([
  23516. Lib({
  23517. title: '为某个表格,批量保存至数据库',
  23518. author: '罗一帆',
  23519. createAt: '2022-07-19',
  23520. updateAt: '2022-07-19',
  23521. type: 'system',
  23522. category: '表格',
  23523. }),
  23524. __metadata("design:type", Function),
  23525. __metadata("design:paramtypes", []),
  23526. __metadata("design:returntype", void 0)
  23527. ], SystemEventFu.prototype, "saveGridRow", null);
  23528. __decorate([
  23529. Lib({
  23530. title: '为某个表格插入数据行',
  23531. author: '罗一帆',
  23532. createAt: '2022-07-19',
  23533. updateAt: '2022-07-19',
  23534. type: 'system',
  23535. category: '表格',
  23536. }),
  23537. __metadata("design:type", Function),
  23538. __metadata("design:paramtypes", []),
  23539. __metadata("design:returntype", void 0)
  23540. ], SystemEventFu.prototype, "insertGridRow", null);
  23541. __decorate([
  23542. Lib({
  23543. title: '为某个表格删除所选数据行',
  23544. author: '罗一帆',
  23545. createAt: '2022-07-19',
  23546. updateAt: '2022-07-19',
  23547. type: 'system',
  23548. category: '表格',
  23549. }),
  23550. __metadata("design:type", Function),
  23551. __metadata("design:paramtypes", []),
  23552. __metadata("design:returntype", void 0)
  23553. ], SystemEventFu.prototype, "removeGridRow", null);
  23554. __decorate([
  23555. Lib({
  23556. title: '按下回车键之后默认是否按下某个按钮',
  23557. author: '罗一帆',
  23558. createAt: '2021-07-02',
  23559. updateAt: '2021-07-02',
  23560. type: 'system',
  23561. category: '字典',
  23562. }),
  23563. __metadata("design:type", Function),
  23564. __metadata("design:paramtypes", [Object]),
  23565. __metadata("design:returntype", void 0)
  23566. ], SystemEventFu.prototype, "enterToClick", null);
  23567. __decorate([
  23568. Lib({
  23569. title: '弹出确认对话框,回答 YES 之后调用某方法',
  23570. author: '罗一帆',
  23571. createAt: '2021-07-06',
  23572. updateAt: '2021-07-06',
  23573. type: 'system',
  23574. category: '对话框',
  23575. }),
  23576. __param(0, LibParam('对话框的确认文字', 'string')),
  23577. __param(1, LibParam('确认之后的调用的方法', 'event')),
  23578. __metadata("design:type", Function),
  23579. __metadata("design:paramtypes", [Object, Object]),
  23580. __metadata("design:returntype", void 0)
  23581. ], SystemEventFu.prototype, "confirm", null);
  23582. __decorate([
  23583. Lib({
  23584. title: '删除表格当前的选中行(前端删除)',
  23585. author: '罗一帆',
  23586. createAt: '2021-07-08',
  23587. updateAt: '2021-07-08',
  23588. type: 'system',
  23589. category: '表格',
  23590. }),
  23591. __param(0, LibParam('表格引用名', 'refs')),
  23592. __metadata("design:type", Function),
  23593. __metadata("design:paramtypes", [Object]),
  23594. __metadata("design:returntype", void 0)
  23595. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  23596. __decorate([
  23597. Lib({
  23598. title: '查询表单,如果 url 为空值,就取消查询',
  23599. author: '罗一帆',
  23600. createAt: '2021-07-06',
  23601. updateAt: '2021-07-06',
  23602. type: 'system',
  23603. category: '表单',
  23604. }),
  23605. __param(0, LibParam('后端服务路径', 'string')),
  23606. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23607. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  23608. __metadata("design:type", Function),
  23609. __metadata("design:paramtypes", [String, Object, Object]),
  23610. __metadata("design:returntype", void 0)
  23611. ], SystemEventFu.prototype, "loadForm", null);
  23612. __decorate([
  23613. Lib({
  23614. title: '提交(不做校验、不关闭窗体)',
  23615. author: '罗一帆',
  23616. createAt: '2021-07-02',
  23617. updateAt: '2021-07-02',
  23618. type: 'system',
  23619. category: '表单',
  23620. }),
  23621. __param(0, LibParam('后端服务路径', 'string')),
  23622. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23623. __param(2, LibParam('提交成功后的回调', 'event', true)),
  23624. __metadata("design:type", Function),
  23625. __metadata("design:paramtypes", [String, Object, Object]),
  23626. __metadata("design:returntype", void 0)
  23627. ], SystemEventFu.prototype, "commit", null);
  23628. __decorate([
  23629. Lib({
  23630. title: '提交表单',
  23631. author: '罗一帆',
  23632. createAt: '2021-07-02',
  23633. updateAt: '2021-07-02',
  23634. type: 'system',
  23635. category: '表单',
  23636. }),
  23637. __param(0, LibParam('后端服务路径', 'string')),
  23638. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  23639. __metadata("design:type", Function),
  23640. __metadata("design:paramtypes", [String, Object]),
  23641. __metadata("design:returntype", void 0)
  23642. ], SystemEventFu.prototype, "formCommit", null);
  23643. __decorate([
  23644. Lib({
  23645. title: '对话框成功回调',
  23646. author: '罗一帆',
  23647. createAt: '2021-07-02',
  23648. updateAt: '2021-07-02',
  23649. type: 'system',
  23650. category: '对话框',
  23651. }),
  23652. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  23653. __metadata("design:type", Function),
  23654. __metadata("design:paramtypes", [Object]),
  23655. __metadata("design:returntype", void 0)
  23656. ], SystemEventFu.prototype, "dialogSuccess", null);
  23657. __decorate([
  23658. Lib({
  23659. title: '清空 viewModel 某个属性',
  23660. author: '罗一帆',
  23661. createAt: '2021-07-02',
  23662. updateAt: '2021-07-02',
  23663. type: 'system',
  23664. category: '表单',
  23665. }),
  23666. __param(0, LibParam('属性路径', 'viewModel', true)),
  23667. __metadata("design:type", Function),
  23668. __metadata("design:paramtypes", [String]),
  23669. __metadata("design:returntype", void 0)
  23670. ], SystemEventFu.prototype, "clearViewModelValues", null);
  23671. __decorate([
  23672. Lib({
  23673. title: '从其他资源获取表格设置',
  23674. author: '罗一帆',
  23675. createAt: '2021-07-02',
  23676. updateAt: '2021-07-02',
  23677. type: 'system',
  23678. category: '表单',
  23679. }),
  23680. __param(0, LibParam('定义文件', 'module')),
  23681. __metadata("design:type", Function),
  23682. __metadata("design:paramtypes", [Object]),
  23683. __metadata("design:returntype", void 0)
  23684. ], SystemEventFu.prototype, "getGrid", null);
  23685. __decorate([
  23686. Lib({
  23687. title: '清空 viewModel 某个属性,并刷新表格',
  23688. author: '罗一帆',
  23689. createAt: '2021-07-02',
  23690. updateAt: '2021-07-02',
  23691. type: 'system',
  23692. category: '表单',
  23693. }),
  23694. __param(0, LibParam('清空的属性', 'viewModel')),
  23695. __param(1, LibParam('要刷新的表格', 'refs', true)),
  23696. __metadata("design:type", Function),
  23697. __metadata("design:paramtypes", [String, String]),
  23698. __metadata("design:returntype", void 0)
  23699. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  23700. __decorate([
  23701. Lib({
  23702. title: '刷新表格',
  23703. author: '罗一帆',
  23704. createAt: '2021-07-02',
  23705. updateAt: '2021-07-02',
  23706. type: 'system',
  23707. category: '表单',
  23708. }),
  23709. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  23710. __metadata("design:type", Function),
  23711. __metadata("design:paramtypes", [String]),
  23712. __metadata("design:returntype", void 0)
  23713. ], SystemEventFu.prototype, "reloadGrid", null);
  23714. __decorate([
  23715. Lib({
  23716. title: '显示对话框',
  23717. author: '罗一帆',
  23718. createAt: '2021-07-02',
  23719. updateAt: '2021-07-02',
  23720. type: 'system',
  23721. category: '对话框',
  23722. }),
  23723. __param(0, LibParam('业务模块名', 'module')),
  23724. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23725. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  23726. __metadata("design:type", Function),
  23727. __metadata("design:paramtypes", [String, Object, Object]),
  23728. __metadata("design:returntype", void 0)
  23729. ], SystemEventFu.prototype, "showDialog", null);
  23730. __decorate([
  23731. Lib({
  23732. title: '弹出查找框(不借助 search)',
  23733. author: '罗一帆',
  23734. createAt: '2021-07-02',
  23735. updateAt: '2021-07-02',
  23736. type: 'system',
  23737. category: '对话框',
  23738. }),
  23739. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  23740. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  23741. __metadata("design:type", Function),
  23742. __metadata("design:paramtypes", [Object, Object]),
  23743. __metadata("design:returntype", void 0)
  23744. ], SystemEventFu.prototype, "showWidget", null);
  23745. __decorate([
  23746. Lib({
  23747. title: '根据 lookup 清空 viewModel',
  23748. author: '罗一帆',
  23749. createAt: '2021-07-05',
  23750. updateAt: '2021-07-05',
  23751. type: 'system',
  23752. category: '表单',
  23753. }),
  23754. __param(0, LibParam('设值表达式', 'lookup')),
  23755. __metadata("design:type", Function),
  23756. __metadata("design:paramtypes", [Object]),
  23757. __metadata("design:returntype", void 0)
  23758. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  23759. __decorate([
  23760. Lib({
  23761. title: '关闭对话框',
  23762. author: '罗一帆',
  23763. createAt: '2021-07-05',
  23764. updateAt: '2021-07-05',
  23765. type: 'system',
  23766. category: '对话框',
  23767. }),
  23768. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  23769. __metadata("design:type", Function),
  23770. __metadata("design:paramtypes", [Object]),
  23771. __metadata("design:returntype", void 0)
  23772. ], SystemEventFu.prototype, "closeMe", null);
  23773. __decorate([
  23774. Lib({
  23775. title: '打开对话框并返回数据',
  23776. author: '余亮',
  23777. createAt: '2022-07-07',
  23778. updateAt: '2022-07-07',
  23779. type: 'system',
  23780. category: '对话框',
  23781. }),
  23782. __param(0, LibParam('业务模块名', 'module')),
  23783. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23784. __param(2, LibParam('结果映射关系', 'string', true)),
  23785. __metadata("design:type", Function),
  23786. __metadata("design:paramtypes", [String, Object, Object]),
  23787. __metadata("design:returntype", void 0)
  23788. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  23789. return SystemEventFu;
  23790. }());
  23791. /**
  23792. * 清空 viewmodel 里下属的所有属性
  23793. * @param viewModel VM对象
  23794. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  23795. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  23796. */
  23797. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  23798. var data = viewModel.data;
  23799. if (propertyKey) {
  23800. data = _$2.get(data, propertyKey);
  23801. }
  23802. _$2.forOwn(data, function (value, key) {
  23803. var targetKey = propertyKey ? propertyKey + "." + key : key;
  23804. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  23805. return;
  23806. }
  23807. viewModel.set(targetKey, '');
  23808. });
  23809. }
  23810. function clearViewModelByLookup(sender, lookup) {
  23811. if (_$2.isPlainObject(lookup)) {
  23812. var parentScope_1 = lookupScope(sender);
  23813. _$2.forOwn(lookup, function (value, key) {
  23814. if (SIMPLE_RE.test(value)) {
  23815. // '{foo}' 简单表达式
  23816. var path = value.substring(1, value.length - 1);
  23817. if (path !== 'queryValue') {
  23818. parentScope_1.viewModel.set(path, '');
  23819. }
  23820. }
  23821. });
  23822. }
  23823. }
  23824. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  23825. if (vjson === void 0) { vjson = {}; }
  23826. var parentScope = lookupScope(sender);
  23827. var me = sender;
  23828. // @ts-ignore
  23829. require([widgetUrl], function (widgetScope) {
  23830. var WidgetScopeClass = widgetScope.default;
  23831. widgetScope = new WidgetScopeClass();
  23832. // 传递进 widget.model 的数据
  23833. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  23834. widgetScope.parentScope = parentScope;
  23835. widgetScope.searchWidgetSuccess = function (data) {
  23836. if (typeof lookup === 'string') {
  23837. // lookup 是字符串的情况下,就是取某个列作为 value 值
  23838. me.setValue(data[lookup]);
  23839. return;
  23840. }
  23841. /**
  23842. * lookup: {
  23843. * // 扩展到 viewModel 的值做更改
  23844. * WH_CODE: "{queryValue}",
  23845. * WH_NAME: "{query.WH_NAME}",
  23846. * }
  23847. */
  23848. if (_$2.isPlainObject(lookup)) {
  23849. var parentScope_2 = lookupScope(sender);
  23850. tryWriteObject(lookup, data, function (path, value) {
  23851. if (path === 'queryValue') {
  23852. me.setValue(value);
  23853. }
  23854. else {
  23855. parentScope_2.viewModel.set(path, value);
  23856. }
  23857. });
  23858. }
  23859. return true;
  23860. };
  23861. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  23862. });
  23863. }
  23864. /**
  23865. * 停止事件的默认行为
  23866. * @param e
  23867. */
  23868. function stopEvent(e) {
  23869. e.preventDefault();
  23870. e.stopPropagation();
  23871. // @ts-ignore
  23872. window.event.cancelBubble = true;
  23873. e.returnValue = false;
  23874. e.cancelBubble = true;
  23875. }
  23876. /**
  23877. * 屏幕中央显示一个黑框提示
  23878. */
  23879. function msg$1(content) {
  23880. msg(content);
  23881. }
  23882. /**
  23883. * 错误对话框的强提醒
  23884. */
  23885. function showErrorDialog$1(msg, sender) {
  23886. showErrorDialog(msg, sender);
  23887. }
  23888. /**
  23889. * 错误对话框的强提醒
  23890. */
  23891. function showInfoDialog(msg, sender) {
  23892. showInfoDialogSimple(msg, sender);
  23893. }
  23894. /**
  23895. * 错误对话框的强提醒
  23896. */
  23897. function prompt$2(message, defaultValue, multiLine) {
  23898. if (defaultValue === void 0) { defaultValue = ""; }
  23899. if (multiLine === void 0) { multiLine = false; }
  23900. return prompt$1(message, defaultValue, multiLine);
  23901. }
  23902. /**
  23903. * 用于计算 express 表达式
  23904. */
  23905. function evalFunction(data, express) {
  23906. var keys = [];
  23907. var values = [];
  23908. _$2.forOwn(data, function (value, key) {
  23909. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  23910. if (match) {
  23911. key = key.substring(0, match.index);
  23912. }
  23913. keys.push(key);
  23914. values.push(value);
  23915. });
  23916. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  23917. try {
  23918. return func.apply(void 0, __spread(values));
  23919. }
  23920. catch (e) {
  23921. return;
  23922. }
  23923. }
  23924. /**
  23925. * 获取表格编辑的行数据
  23926. */
  23927. function getGridEditRows(grid) {
  23928. return grid.getGridEditRows();
  23929. }
  23930. //# sourceMappingURL=systemLib.js.map
  23931. var SystemLib = /*#__PURE__*/Object.freeze({
  23932. __proto__: null,
  23933. SIMPLE_RE: SIMPLE_RE,
  23934. pinyinMatch: pinyinMatch,
  23935. calcExpress: calcExpress,
  23936. calcObjectFlat: calcObjectFlat,
  23937. mergeViewModel: mergeViewModel,
  23938. flatRow: flatRow,
  23939. replaceNA: replaceNA,
  23940. deepTravJson: deepTravJson,
  23941. tryWriteByExpress: tryWriteByExpress,
  23942. tryWriteObject: tryWriteObject,
  23943. tryVarSimple: tryVarSimple,
  23944. calcObject: calcObject,
  23945. getParentGrid: getParentGrid,
  23946. tryEnable: tryEnable,
  23947. setComboStore: setComboStore,
  23948. invokeServer: invokeServer$1,
  23949. clearViewModelValues: clearViewModelValues,
  23950. reloadGrid: reloadGrid,
  23951. toPlainObject: toPlainObject,
  23952. confirm: confirm,
  23953. normId: normId,
  23954. clearViewModelReloadGrid: clearViewModelReloadGrid,
  23955. saveGridRow: saveGridRow,
  23956. insertGridRow: insertGridRow,
  23957. commitMe: commitMe,
  23958. removeGridRow: removeGridRow,
  23959. moveUpGridRow: moveUpGridRow,
  23960. moveDownGridRow: moveDownGridRow,
  23961. SystemEventFu: SystemEventFu,
  23962. clearViewModel: clearViewModel,
  23963. clearViewModelByLookup: clearViewModelByLookup,
  23964. showWidget: showWidget,
  23965. stopEvent: stopEvent,
  23966. msg: msg$1,
  23967. showErrorDialog: showErrorDialog$1,
  23968. showInfoDialog: showInfoDialog,
  23969. prompt: prompt$2,
  23970. evalFunction: evalFunction,
  23971. getGridEditRows: getGridEditRows
  23972. });
  23973. function initTree () {
  23974. Ext.define('Yvan.Tree', {
  23975. extend: 'Ext.tree.Panel',
  23976. alias: 'widget.yvtree',
  23977. xtype: 'yvtree',
  23978. constructor: function (config) {
  23979. var newConfig = _$2.defaultsDeep({
  23980. // 强制性属性
  23981. }, baseConfig(config, 'row-item'), config, tree);
  23982. _$2.assign(newConfig, {
  23983. tbar: [
  23984. {
  23985. xtype: 'textfield',
  23986. // triggerCls: 'x-form-clear-trigger',
  23987. flex: 1,
  23988. emptyText: '搜索过滤',
  23989. enableKeyEvents: true,
  23990. listeners: {
  23991. change: function (sender) {
  23992. var tree = sender.up("treepanel");
  23993. tree.filterByText(this.getRawValue());
  23994. },
  23995. keyup: function (sender, e) {
  23996. var tree = sender.up("treepanel");
  23997. if (e.ESC === e.getKey()) {
  23998. sender.setValue('');
  23999. tree.filterByText('');
  24000. }
  24001. }
  24002. }
  24003. },
  24004. ],
  24005. });
  24006. if (!newConfig.hideRefresh) {
  24007. newConfig.tbar.push({
  24008. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  24009. listeners: {
  24010. click: function (sender) {
  24011. var scope = sender.up("yvtree");
  24012. scope.reload();
  24013. }
  24014. }
  24015. });
  24016. }
  24017. if (!newConfig.hideExpand) {
  24018. newConfig.tbar.push({
  24019. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  24020. listeners: {
  24021. click: function (sender) {
  24022. var scope = sender.up("yvtree");
  24023. scope.expandAll();
  24024. }
  24025. }
  24026. });
  24027. }
  24028. if (!newConfig.hideCollapse) {
  24029. newConfig.tbar.push({
  24030. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  24031. listeners: {
  24032. click: function (sender) {
  24033. var scope = sender.up("yvtree");
  24034. scope.collapseAll();
  24035. }
  24036. }
  24037. });
  24038. }
  24039. this.superclass.constructor.call(this, newConfig);
  24040. },
  24041. /**
  24042. * 在根节点上增加一个节点,会触发 addNode 事件
  24043. * @param props
  24044. */
  24045. addRoot: function (props) {
  24046. var me = this;
  24047. var tableNode = me.getRootNode();
  24048. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  24049. if (_$2.isFunction(props)) {
  24050. props = props.call(this, parent);
  24051. }
  24052. _$2.forOwn(props, function (value, key) {
  24053. fieldNode.set(key, value);
  24054. });
  24055. var node = tableNode.appendChild(fieldNode);
  24056. me.ensureVisible(node);
  24057. me.setSelection(node);
  24058. me.fireEvent('addNode', me, {
  24059. parent: tableNode,
  24060. node: node,
  24061. });
  24062. },
  24063. addLast: function (props) {
  24064. var me = this;
  24065. var sel = me.selModel.getSelection();
  24066. if (!sel || sel.length <= 0) {
  24067. msg('请选择一个要添加的同级节点路径');
  24068. return;
  24069. }
  24070. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  24071. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24072. if (_$2.isFunction(props)) {
  24073. props = props.call(this, parent);
  24074. }
  24075. _$2.forOwn(props, function (value, key) {
  24076. fieldNode.set(key, value);
  24077. });
  24078. var node = parent.appendChild(fieldNode);
  24079. me.ensureVisible(node);
  24080. me.setSelection(node);
  24081. me.fireEvent('addNode', me, {
  24082. parent: parent,
  24083. node: node,
  24084. });
  24085. },
  24086. addChildren: function (props) {
  24087. var me = this;
  24088. var sel = me.selModel.getSelection();
  24089. if (!sel || sel.length <= 0) {
  24090. msg('请选择一个要添加子节点的路径');
  24091. return;
  24092. }
  24093. var parent = sel[0];
  24094. if (_$2.isFunction(props)) {
  24095. props = props.call(this, parent);
  24096. }
  24097. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24098. _$2.forOwn(props, function (value, key) {
  24099. fieldNode.set(key, value);
  24100. });
  24101. var node = parent.appendChild(fieldNode);
  24102. parent.expand();
  24103. me.ensureVisible(node);
  24104. me.setSelection(node);
  24105. me.fireEvent('addNode', me, {
  24106. parent: parent,
  24107. node: node,
  24108. });
  24109. },
  24110. initComponent: function () {
  24111. var me = this;
  24112. var config = me.config;
  24113. var scope = lookupScope(this);
  24114. if (!isDesignMode(scope, config)) {
  24115. // 转换 dataSource 属性
  24116. convertDataSource(me, scope, config);
  24117. }
  24118. this.superclass.initComponent.call(this);
  24119. this.on({
  24120. afterrender: function (sender) {
  24121. var me = this;
  24122. var config = this.config;
  24123. var dataSource = config.dataSource;
  24124. if (config.autoLoad) {
  24125. if (config.dataSourceCallbackFn) {
  24126. me.reload();
  24127. }
  24128. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  24129. me.reload();
  24130. }
  24131. }
  24132. }
  24133. });
  24134. },
  24135. _setDataReal: function (value) {
  24136. var me = this;
  24137. // me.setStore(new Ext.data.TreeStore({
  24138. // root: {
  24139. // expanded: true,
  24140. // // children: value
  24141. // children: [
  24142. // {
  24143. // id: '1', text: 'A',
  24144. // children: [
  24145. // {id: '1', text: 'A',},
  24146. // {id: '2', text: 'B'},
  24147. // ]
  24148. // },
  24149. // {id: '2', text: 'B'},
  24150. // ]
  24151. // }
  24152. // }))
  24153. me.store.setRoot({
  24154. expanded: true,
  24155. children: value
  24156. });
  24157. // me.store = new Ext.data.TreeStore({
  24158. // root: {
  24159. // expanded: true,
  24160. // // children: value
  24161. // children: [
  24162. // {
  24163. // id: '1', text: 'A',
  24164. // children: [
  24165. // {id: '1', text: 'A',},
  24166. // {id: '2', text: 'B'},
  24167. // ]
  24168. // },
  24169. // {id: '2', text: 'B'},
  24170. // ]
  24171. // }
  24172. // })
  24173. },
  24174. /**
  24175. * 重新载入数据(重新计算参数)
  24176. */
  24177. reload: function (reloadParams) {
  24178. if (reloadParams === void 0) { reloadParams = {}; }
  24179. var me = this;
  24180. var config = me.config;
  24181. if (config.dataSourceCallbackFn) {
  24182. // 函数请求刷新
  24183. var scope_1 = lookupScope(this);
  24184. // me.setLoading(true)
  24185. config.dataSourceCallbackFn.call(scope_1, me, {
  24186. successCallback: function (value) {
  24187. me._setDataReal(value);
  24188. // me.setLoading(false)
  24189. me.fireEvent('dataLoadComplete', me, true, value);
  24190. },
  24191. failCallback: function (error) {
  24192. // me.setLoading(false)
  24193. me.fireEvent('dataLoadComplete', me, false, error);
  24194. }
  24195. });
  24196. return;
  24197. }
  24198. var scope = lookupScope(me);
  24199. var dataSource = config.dataSource;
  24200. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  24201. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  24202. me.setLoading(true);
  24203. invokeServer$1(dataSource.url, params)
  24204. .then(function (res) {
  24205. me._setDataReal(res.data);
  24206. me.fireEvent('dataLoadComplete', me, res);
  24207. })
  24208. .finally(function () {
  24209. me.setLoading(false);
  24210. });
  24211. }
  24212. },
  24213. filterByText: function (text) {
  24214. this._filterText = text;
  24215. this._filterBy(this, text, 'text');
  24216. },
  24217. _filterBy: _$2.debounce(function (me, text, by) {
  24218. var view = me.getView();
  24219. me.store.clearFilter();
  24220. if (!me._filterText) {
  24221. // 没有筛选内容,还原状态
  24222. var selections = me.getSelection();
  24223. var selectionPaths_1 = [];
  24224. _$2.forEach(me.getSelection(), function (item) {
  24225. selectionPaths_1.push(item.getPath());
  24226. });
  24227. me.collapseAll();
  24228. _$2.forEach(selectionPaths_1, function (path) {
  24229. me.expandPath(path);
  24230. });
  24231. me.setSelection(selections);
  24232. return;
  24233. }
  24234. // 递归查找所有需要可见的节点 id 数组
  24235. var nodesAndParents = [];
  24236. var expandPaths = [];
  24237. me.getRootNode().cascadeBy(function (tree, view) {
  24238. var currNode = this;
  24239. currNode.collapse();
  24240. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  24241. // 展开到匹配的路径
  24242. // me.expandPath(currNode.getPath());
  24243. expandPaths.push(currNode.getPath());
  24244. // 沿途父节点全部设定为可见
  24245. while (currNode.parentNode) {
  24246. nodesAndParents.push(currNode.id);
  24247. currNode = currNode.parentNode;
  24248. }
  24249. }
  24250. }, null, [me, view]);
  24251. me.store.filterBy(function (r) {
  24252. return Ext.Array.contains(nodesAndParents, r.get('id'));
  24253. });
  24254. _$2.forEach(expandPaths, function (path) {
  24255. me.expandPath(path);
  24256. });
  24257. }, 1000),
  24258. });
  24259. }
  24260. function convertDataSource(sender, scope, newConfig) {
  24261. if (typeof newConfig.store !== 'undefined') {
  24262. // 有 store 属性的情况下,不做任何事
  24263. return;
  24264. }
  24265. if (typeof newConfig.dataSource === 'undefined') {
  24266. // 没有定义 dataSource 的情况下,不做任何事
  24267. return;
  24268. }
  24269. var dataSource = newConfig.dataSource;
  24270. if (typeof dataSource === 'string') {
  24271. // dataSource 是字符串的情况下,找到成员函数
  24272. dataSource = lookupFn(scope, dataSource);
  24273. }
  24274. if (typeof dataSource === 'function') {
  24275. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  24276. newConfig.store = new Ext.data.TreeStore({
  24277. root: {
  24278. expanded: true,
  24279. children: []
  24280. }
  24281. });
  24282. newConfig.dataSourceCallbackFn = dataSource;
  24283. return;
  24284. }
  24285. // throw new TypeError('无法识别的调用方法')
  24286. }
  24287. //# sourceMappingURL=yvtree.js.map
  24288. /**
  24289. * 构建一个 grid 支持的 dataSource
  24290. */
  24291. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  24292. if (reloadParams === void 0) { reloadParams = {}; }
  24293. if (isExcelExport === void 0) { isExcelExport = false; }
  24294. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  24295. var _a;
  24296. var me = grid;
  24297. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  24298. var storeOption = {};
  24299. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  24300. if (dataSource.sqlId) {
  24301. dataSource.method = 'invoke';
  24302. dataSource.url = '/Dev@executeSQL';
  24303. if (_$2.startsWith(dataSource.sqlId, '@')) {
  24304. // sqlId 是 @ 开头,代表直接带中文名
  24305. var scope_1 = lookupScope(grid);
  24306. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  24307. params.sqlId = dataSource.sqlId.substring(1);
  24308. }
  24309. else {
  24310. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  24311. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  24312. params.path = path;
  24313. params.sqlId = sqlId;
  24314. }
  24315. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  24316. }
  24317. var fields_1 = [];
  24318. _$2.forEach(grid.columns, function (col) {
  24319. var c = {};
  24320. if (col.dataIndex) {
  24321. c.name = col.dataIndex;
  24322. fields_1.push(c);
  24323. }
  24324. if (col.dataType) {
  24325. c.type = col.dataType;
  24326. }
  24327. });
  24328. // 默认支持 gridInvoke
  24329. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  24330. //@ts-ignore
  24331. storeOption = {
  24332. fields: fields_1,
  24333. remoteSort: config.remoteSort,
  24334. remoteFilter: config.remoteFilter,
  24335. autoLoad: true,
  24336. pageSize: me.store.pageSize || config.pageSize,
  24337. proxy: {
  24338. type: 'jsonAjax',
  24339. $owner: me,
  24340. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  24341. extraParams: extraParams,
  24342. reader: {
  24343. type: 'json',
  24344. rootProperty: 'data',
  24345. totalProperty: 'pagination.total',
  24346. successProperty: 'success',
  24347. messageProperty: 'msg',
  24348. transform: function (data) {
  24349. if (typeof window['ajaxProcess'] === 'function') {
  24350. window['ajaxProcess'](data);
  24351. }
  24352. if (typeof window['apiTranslate'] === 'function') {
  24353. window['apiTranslate'](data, dataSource.url);
  24354. }
  24355. if (typeof grid._transform === 'function') {
  24356. // 系统转换函数
  24357. grid._transform(data.data);
  24358. }
  24359. if (grid.dataTransform) {
  24360. if (typeof grid.dataTransform === 'string') {
  24361. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  24362. }
  24363. return grid.dataTransform.call(scope, grid, data);
  24364. }
  24365. return data;
  24366. }
  24367. }
  24368. },
  24369. listeners: {
  24370. load: function (store, records, successful, operation) {
  24371. var _a, _b, _c;
  24372. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  24373. if (rep.pagination) {
  24374. grid.dbInfo = rep.pagination.dbInfo;
  24375. grid.exportDataSql = rep.pagination.exportDataSql;
  24376. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  24377. }
  24378. 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;
  24379. if (isExcelExport) {
  24380. if (typeof excelExportCallBack === 'function') {
  24381. excelExportCallBack(rep);
  24382. }
  24383. else if (excelExportCallBack) {
  24384. console.error("导出回调方法错误!");
  24385. }
  24386. me.fireEvent('excelDataLoadComplete', me, successful, records);
  24387. }
  24388. else {
  24389. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  24390. // 自动选中第一行
  24391. var data = grid.getStore().data;
  24392. if (data.length > 0) {
  24393. grid.setSelection(data.items[0]);
  24394. }
  24395. }
  24396. me.fireEvent('dataLoadComplete', me, successful, records);
  24397. }
  24398. }
  24399. }
  24400. };
  24401. }
  24402. else if (exports.apiConvert) {
  24403. // 外部扩展的 apiConvert
  24404. //@ts-ignore
  24405. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams);
  24406. }
  24407. else {
  24408. throw new TypeError("不支持的 API 请求方式");
  24409. }
  24410. if (isExcelExport) {
  24411. var excelStore = new Ext.data.Store(storeOption);
  24412. excelStore.load();
  24413. }
  24414. else {
  24415. if (me.groupField) {
  24416. console.log('groupField', storeOption.groupField);
  24417. storeOption.groupField = me.groupField;
  24418. }
  24419. me.setStore(new Ext.data.Store(storeOption));
  24420. }
  24421. }
  24422. function initStores () {
  24423. Ext.define('Yvan.JsonAjaxProxy', {
  24424. extend: 'Ext.data.proxy.Ajax',
  24425. alias: 'proxy.jsonAjax',
  24426. actionMethods: {
  24427. create: "POST",
  24428. read: "POST",
  24429. update: "POST",
  24430. destroy: "POST"
  24431. },
  24432. timeout: storeAjax.timeout,
  24433. buildRequest: function (operation) {
  24434. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  24435. var me = this;
  24436. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  24437. var scope = lookupScope($owner);
  24438. var gridParam = me.getParams(operation);
  24439. var customParam = {};
  24440. // 提取 srot 元素
  24441. if (gridParam.sort) {
  24442. var sort = JSON.parse(gridParam.sort);
  24443. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  24444. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  24445. customParam.sortModel = [];
  24446. _$2.forEach(sort, function (s) {
  24447. customParam.sortModel.push({
  24448. colId: s.property,
  24449. sort: _$2.toLower(s.direction)
  24450. });
  24451. });
  24452. delete gridParam.sort;
  24453. }
  24454. // 提取筛选元素
  24455. if (gridParam.filter) {
  24456. var filter = JSON.parse(gridParam.filter);
  24457. console.log('gridParam.filter', gridParam.filter);
  24458. // "[{"operator":"like","value":"1","property":"id"}]"
  24459. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  24460. customParam.filterModel = {};
  24461. _$2.forEach(filter, function (s) {
  24462. var newFilterItem = {};
  24463. if (s.operator === 'like') {
  24464. newFilterItem.filterType = 'text';
  24465. newFilterItem.type = 'contains';
  24466. newFilterItem.filter = s.value;
  24467. }
  24468. else {
  24469. // 无法识别的筛选类型
  24470. newFilterItem.filterType = 'dict';
  24471. newFilterItem.type = 'in';
  24472. newFilterItem.filter = s.value;
  24473. }
  24474. customParam.filterModel[s.property] = newFilterItem;
  24475. });
  24476. delete gridParam.filter;
  24477. }
  24478. // 被 grid.constructor 作为方法存在
  24479. var extraParams = _$2.cloneDeep(me.getExtraParams());
  24480. var params = _$2.defaultsDeep(gridParam, extraParams);
  24481. // var request = this.superclass.buildRequest.apply(this, arguments);
  24482. var request = new Ext.data.Request({
  24483. params: {},
  24484. action: operation.getAction(),
  24485. records: operation.getRecords(),
  24486. url: me.buildUrl(),
  24487. jsonData: __assign({ args: [
  24488. params
  24489. ] }, customParam),
  24490. proxy: me
  24491. });
  24492. operation.setRequest(request);
  24493. return request;
  24494. },
  24495. afterRequest: function (req, res) {
  24496. // Extend.afterExtRequest(req, res)
  24497. }
  24498. });
  24499. Ext.define('Ext.ux.data.MyReader', {
  24500. extend: 'Ext.data.reader.Json',
  24501. xtype: 'yvgridreader',
  24502. useSimpleAccessors: false,
  24503. });
  24504. }
  24505. //# sourceMappingURL=stores.js.map
  24506. function initBehaviorEdit(config) {
  24507. var _a, _b, _c;
  24508. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  24509. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  24510. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  24511. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  24512. if (dbTableName) {
  24513. // 生成增删查改
  24514. var tbar = [
  24515. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  24516. click: 'system.saveGridRow()'
  24517. }, bind: {
  24518. disabled: '{!' + config.reference + '.ischanged}'
  24519. } }, saveButtonConfig),
  24520. '-',
  24521. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  24522. click: 'system.insertGridRow()'
  24523. } }, addButtonConfig),
  24524. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  24525. click: 'system.removeGridRow()'
  24526. } }, deleteButtonConfig),
  24527. ];
  24528. if (_$2.isArray(config.tbar)) {
  24529. config.tbar = __spread(tbar, [
  24530. '-'
  24531. ], config.tbar);
  24532. }
  24533. else if (_$2.isPlainObject(config.tbar)) {
  24534. config.tbar = {
  24535. border: false,
  24536. layout: {
  24537. type: 'vbox',
  24538. align: 'stretch'
  24539. },
  24540. items: [
  24541. {
  24542. xtype: 'toolbar',
  24543. border: false,
  24544. items: tbar
  24545. },
  24546. config.tbar,
  24547. ]
  24548. };
  24549. }
  24550. else if (_$2.isUndefined(config.tbar)) {
  24551. config.tbar = tbar;
  24552. }
  24553. else {
  24554. console.error("can't build tbar property!", config.tbar);
  24555. }
  24556. }
  24557. }
  24558. //# sourceMappingURL=grid_behavior.js.map
  24559. function initGridDialog(config) {
  24560. var detailDialog = _$2.get(config, 'detailDialog');
  24561. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  24562. if (_$2.isPlainObject(detailDialog)) {
  24563. var tbar = [
  24564. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  24565. click: 'system.showGridRowDetail()',
  24566. }, bind: {
  24567. disabled: '{!' + config.reference + '.selection}'
  24568. } }, detailButtonConfig)
  24569. ];
  24570. if (_$2.isArray(config.tbar)) {
  24571. config.tbar = __spread(config.tbar, [
  24572. '-'
  24573. ], tbar);
  24574. }
  24575. else if (_$2.isPlainObject(config.tbar)) {
  24576. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  24577. config.tbar.items = __spread(config.tbar.items);
  24578. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  24579. if (!toolbar) {
  24580. config.tbar.items = __spread(config.tbar.items, [
  24581. {
  24582. xtype: 'toolbar',
  24583. border: false,
  24584. items: tbar
  24585. },
  24586. ]);
  24587. }
  24588. else {
  24589. toolbar.items = __spread(toolbar.items, [
  24590. '-'
  24591. ], tbar);
  24592. }
  24593. }
  24594. else {
  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. }
  24612. else if (_$2.isUndefined(config.tbar)) {
  24613. config.tbar = tbar;
  24614. }
  24615. else {
  24616. console.error("can't build tbar property!", config.tbar);
  24617. }
  24618. }
  24619. }
  24620. var SystemEventFu$1 = /** @class */ (function () {
  24621. function SystemEventFu() {
  24622. }
  24623. SystemEventFu.prototype.showGridRowDetail = function () {
  24624. return function (sender) {
  24625. var grid1 = sender.up('yvgrid');
  24626. showGridRowDetail(grid1);
  24627. };
  24628. };
  24629. __decorate([
  24630. Lib({
  24631. title: '为某个表格所选数据行, 显示其对话框',
  24632. author: '罗一帆',
  24633. createAt: '2022-07-27',
  24634. updateAt: '2022-07-27',
  24635. type: 'system',
  24636. category: '表格',
  24637. }),
  24638. __metadata("design:type", Function),
  24639. __metadata("design:paramtypes", []),
  24640. __metadata("design:returntype", void 0)
  24641. ], SystemEventFu.prototype, "showGridRowDetail", null);
  24642. return SystemEventFu;
  24643. }());
  24644. function showGridRowDetail(grid1, isEdit) {
  24645. if (isEdit === void 0) { isEdit = true; }
  24646. var _a, _b, _c;
  24647. if (!grid1.selection) {
  24648. msg$1('请选中要展示的数据行!');
  24649. return;
  24650. }
  24651. var record = grid1.selection;
  24652. if (_$2.isArray(record)) {
  24653. record = record[0];
  24654. }
  24655. if (!record) {
  24656. msg$1('请选中要展示的数据行!');
  24657. return;
  24658. }
  24659. var config = grid1._originVJson;
  24660. var detailDialog = config.detailDialog;
  24661. var vjson = {};
  24662. var parentScope = lookupScope(grid1);
  24663. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  24664. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  24665. _$2.defaultsDeep(vjson, {
  24666. // 强制属性
  24667. layout: 'fit',
  24668. __custom_path: __custom_path,
  24669. __custom_version: __custom_version,
  24670. fbar: __spread([
  24671. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  24672. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  24673. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  24674. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  24675. }, detailDialog, {
  24676. // 默认属性
  24677. width: 800,
  24678. height: 450,
  24679. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  24680. });
  24681. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  24682. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  24683. vjson.items.push(tabpanel);
  24684. if (tabpanel) {
  24685. // 有多个选项卡,按每个选项卡进行过滤
  24686. _$2.forEach(tabpanel.items, function (tab) {
  24687. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  24688. if (tabColumns.length > 0) {
  24689. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  24690. _$2.extend(tab, tabVjson);
  24691. }
  24692. });
  24693. }
  24694. }
  24695. else {
  24696. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  24697. }
  24698. var model = {
  24699. data: {
  24700. _edit: isEdit,
  24701. _editType: isEdit ? '编辑' : '添加',
  24702. }
  24703. };
  24704. _$2.forOwn(record.data, function (value, key) {
  24705. if (key === 'id') {
  24706. // 忽略 ID 属性
  24707. return;
  24708. }
  24709. if (_$2.startsWith(key, '_')) {
  24710. // 忽略 _ 开头的所有属性
  24711. return;
  24712. }
  24713. model.data[key] = value;
  24714. });
  24715. console.log(vjson);
  24716. var scope = new Scope({ vjson: vjson, model: model, });
  24717. //@ts-ignore
  24718. scope.commit = function () {
  24719. return new Promise(function (resolve) {
  24720. _$2.forOwn(scope.viewModel.data, function (value, key) {
  24721. if (_$2.startsWith(key, '_')) {
  24722. // _origin 等属性可以被忽略
  24723. return;
  24724. }
  24725. if (key === 'id') {
  24726. // id 属性被忽略
  24727. return;
  24728. }
  24729. record.set(key, value);
  24730. });
  24731. resolve();
  24732. });
  24733. };
  24734. scope.showDialog(grid1, {}, {});
  24735. }
  24736. function buildForm(columns, tabpanel, detailDialog) {
  24737. var vjson = __assign({ border: false, layout: {
  24738. type: 'vbox',
  24739. pack: 'start',
  24740. align: 'stretch'
  24741. }, defaults: {
  24742. border: false,
  24743. anchor: '100%',
  24744. margin: '5',
  24745. }, scrollable: true, items: [] }, detailDialog.form);
  24746. var emptyFieldset = [];
  24747. var fieldsetList = [];
  24748. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  24749. _$2.forEach(columns, function (c) {
  24750. var fieldset = _$2.get(c, 'form.fieldset');
  24751. if (fieldset) {
  24752. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  24753. if (idx < 0) {
  24754. fieldsetList.push({
  24755. fieldset: fieldset,
  24756. columns: [c]
  24757. });
  24758. }
  24759. else {
  24760. fieldsetList[idx].columns.push(c);
  24761. }
  24762. }
  24763. else {
  24764. emptyFieldset.push(c);
  24765. }
  24766. });
  24767. _$2.forEach(fieldsetList, function (fs) {
  24768. var fieldSetVjson = {
  24769. xtype: 'fieldset',
  24770. title: fs.fieldset,
  24771. items: []
  24772. };
  24773. buildFieldItems(fieldSetVjson.items, fs.columns);
  24774. vjson.items.push(fieldSetVjson);
  24775. });
  24776. buildFieldItems(vjson.items, emptyFieldset);
  24777. return vjson;
  24778. }
  24779. // 构建字段组
  24780. function buildFieldItems(items, columns) {
  24781. var _a, _b, _c, _d, _e;
  24782. var row = {
  24783. xtype: 'cols',
  24784. items: []
  24785. };
  24786. for (var i = 0; i < columns.length; i++) {
  24787. var column = columns[i];
  24788. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  24789. delete row.xtype;
  24790. row.layout = column.form.rowlayout;
  24791. }
  24792. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  24793. row.items.push({ border: false, flex: column.form.prefix });
  24794. }
  24795. var fieldVjson = buildField(column, row.items.length);
  24796. if (!fieldVjson) {
  24797. continue;
  24798. }
  24799. row.items.push(fieldVjson);
  24800. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  24801. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  24802. }
  24803. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  24804. items.push(row);
  24805. row = {
  24806. xtype: 'cols',
  24807. items: []
  24808. };
  24809. }
  24810. }
  24811. if (row.items.length > 0) {
  24812. items.push(row);
  24813. }
  24814. }
  24815. // 构建字段
  24816. function buildField(column, colIdx) {
  24817. var ret;
  24818. if (column.xtype === 'checkcolumn') {
  24819. ret = _$2.defaultsDeep({
  24820. xtype: 'checkbox',
  24821. uncheckedValue: column.uncheckedValue,
  24822. checkedValue: column.checkedValue,
  24823. boxLabel: column.header,
  24824. bind: {
  24825. value: '{' + column.dataIndex + '}'
  24826. }
  24827. }, column.form);
  24828. if (colIdx == 0) {
  24829. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  24830. ret.margin = '0 0 0 85';
  24831. }
  24832. }
  24833. else {
  24834. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  24835. fieldLabel: column.header,
  24836. bind: {
  24837. value: '{' + column.dataIndex + '}'
  24838. },
  24839. });
  24840. }
  24841. if (!ret.xtype) {
  24842. return;
  24843. }
  24844. if (!ret.dict && ret.xtype === 'combo') {
  24845. ret.dict = column.dict;
  24846. }
  24847. // 删除辅助属性
  24848. delete ret.order;
  24849. delete ret.wrap;
  24850. return ret;
  24851. }
  24852. //# sourceMappingURL=grid_dialog.js.map
  24853. var model$o = {
  24854. data: {}
  24855. };
  24856. //# sourceMappingURL=GridColumnCustom.model.js.map
  24857. var vjson$o = {
  24858. title: '自定义表格属性',
  24859. layout: 'fit',
  24860. width: 980,
  24861. height: 500,
  24862. fbar: [
  24863. {
  24864. xtype: "button",
  24865. text: "保存",
  24866. iconCls: 'x-fa fa-save',
  24867. listeners: {
  24868. click: 'scope.commit',
  24869. }
  24870. },
  24871. {
  24872. xtype: "button",
  24873. text: "关闭",
  24874. iconCls: 'x-fa fa-times',
  24875. listeners: {
  24876. click: 'system.closeMe()',
  24877. }
  24878. },
  24879. ],
  24880. items: [
  24881. {
  24882. region: 'center',
  24883. xtype: 'tabpanel',
  24884. items: [
  24885. {
  24886. title: '基本信息', reference: 'basic',
  24887. layout: {
  24888. type: 'vbox',
  24889. pack: 'start',
  24890. align: 'stretch'
  24891. },
  24892. defaults: {
  24893. border: false,
  24894. anchor: '100%',
  24895. margin: '5',
  24896. },
  24897. scrollable: true,
  24898. items: [
  24899. {
  24900. xtype: 'cols',
  24901. items: [
  24902. {
  24903. fieldLabel: '路径',
  24904. bind: { value: '{__custom_path}' },
  24905. xtype: 'textfield',
  24906. flex: 2,
  24907. },
  24908. {
  24909. fieldLabel: '版本',
  24910. bind: { value: '{__custom_version}' },
  24911. xtype: 'textfield',
  24912. },
  24913. ]
  24914. },
  24915. {
  24916. xtype: 'cols',
  24917. items: [
  24918. {
  24919. fieldLabel: '配置点',
  24920. bind: { value: '{__custom_point}' },
  24921. xtype: 'textfield',
  24922. },
  24923. {
  24924. fieldLabel: 'reference',
  24925. bind: { value: '{reference}' },
  24926. xtype: 'textfield',
  24927. },
  24928. {
  24929. fieldLabel: '编辑模式',
  24930. bind: { value: '{_mode}' },
  24931. xtype: 'combo',
  24932. dict: 'GRID_MODE',
  24933. },
  24934. ]
  24935. },
  24936. {
  24937. layout: 'hbox',
  24938. defaults: {
  24939. margin: '0 0 0 15',
  24940. },
  24941. items: [
  24942. {
  24943. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  24944. bind: {
  24945. value: "{hideFootbar}"
  24946. }
  24947. },
  24948. {
  24949. boxLabel: '隐藏刷新', xtype: 'checkbox',
  24950. bind: {
  24951. value: "{hideRefresh}"
  24952. }
  24953. },
  24954. {
  24955. boxLabel: '隐藏导出', xtype: 'checkbox',
  24956. bind: {
  24957. value: "{hideExport}"
  24958. }
  24959. },
  24960. {
  24961. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  24962. bind: {
  24963. value: "{hideAutoSize}"
  24964. }
  24965. },
  24966. {
  24967. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  24968. bind: {
  24969. value: "{hideClearFilter}"
  24970. }
  24971. },
  24972. {
  24973. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  24974. bind: {
  24975. value: "{hideSaveGridUIConfig}"
  24976. }
  24977. },
  24978. {
  24979. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  24980. bind: {
  24981. value: "{hideClearGridUIConfig}"
  24982. }
  24983. },
  24984. ]
  24985. },
  24986. {
  24987. layout: 'hbox',
  24988. defaults: {
  24989. margin: '0 0 0 15',
  24990. },
  24991. items: [
  24992. {
  24993. boxLabel: '自动载入数据源', xtype: 'checkbox',
  24994. bind: { value: '{autoLoad}' },
  24995. margin: '0 0 0 85',
  24996. },
  24997. {
  24998. boxLabel: '分页模式', xtype: 'checkbox',
  24999. bind: { value: '{pagination}' },
  25000. },
  25001. {
  25002. boxLabel: '显示行序号', xtype: 'checkbox',
  25003. bind: { value: '{show_rownum}' },
  25004. },
  25005. {
  25006. boxLabel: '后端排序', xtype: 'checkbox',
  25007. bind: {
  25008. value: "{remoteSort}"
  25009. }
  25010. },
  25011. {
  25012. boxLabel: '后端过滤', xtype: 'checkbox',
  25013. bind: {
  25014. value: "{remoteFilter}"
  25015. }
  25016. },
  25017. {
  25018. boxLabel: '隐藏', xtype: 'checkbox',
  25019. bind: {
  25020. value: "{hidden}"
  25021. }
  25022. },
  25023. ]
  25024. },
  25025. {
  25026. layout: 'hbox',
  25027. defaults: {
  25028. margin: '0 0 0 15',
  25029. },
  25030. items: [
  25031. {
  25032. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  25033. bind: {
  25034. value: "{enableColumnHide}"
  25035. }
  25036. },
  25037. {
  25038. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  25039. bind: {
  25040. value: "{enableColumnMove}"
  25041. }
  25042. },
  25043. {
  25044. boxLabel: '自定义筛选', xtype: 'checkbox',
  25045. bind: {
  25046. value: "{gridfilters}"
  25047. }
  25048. },
  25049. {
  25050. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  25051. bind: {
  25052. value: "{enableColumnResize}"
  25053. }
  25054. },
  25055. {
  25056. boxLabel: '点击列头排序', xtype: 'checkbox',
  25057. bind: {
  25058. value: "{sortOnClick}"
  25059. }
  25060. },
  25061. ]
  25062. },
  25063. {
  25064. xtype: 'cols',
  25065. items: [
  25066. {
  25067. fieldLabel: 'dbTableName',
  25068. labelWidth: 110,
  25069. bind: { value: '{behavior.dbTableName}' },
  25070. xtype: 'textfield',
  25071. },
  25072. {
  25073. fieldLabel: 'theid',
  25074. bind: { value: '{theid}' },
  25075. xtype: 'textfield',
  25076. },
  25077. {
  25078. fieldLabel: '添加行聚焦',
  25079. bind: { value: '{behavior.focusColumnAfterInsert}' },
  25080. xtype: 'textfield',
  25081. },
  25082. ]
  25083. },
  25084. {
  25085. xtype: 'cols',
  25086. items: [
  25087. {
  25088. fieldLabel: '批量删除提示',
  25089. labelWidth: 110,
  25090. bind: { value: '{behavior.batchRemoveConfirm}' },
  25091. xtype: 'textfield',
  25092. },
  25093. {
  25094. fieldLabel: '删除提示',
  25095. bind: { value: '{behavior.singleRemoveConfirm}' },
  25096. xtype: 'textfield',
  25097. },
  25098. {
  25099. fieldLabel: '触发刷新',
  25100. labelWidth: 110,
  25101. bind: { value: '{behavior.selectToReload}' },
  25102. xtype: 'textfield',
  25103. },
  25104. ]
  25105. },
  25106. ]
  25107. },
  25108. {
  25109. title: '字段', reference: 'grid1',
  25110. xtype: 'yvgrid',
  25111. pagination: false,
  25112. _mode: 'edit',
  25113. listeners: {
  25114. buttonclick: 'scope.grid1Buttonclick',
  25115. },
  25116. hideFootbar: true,
  25117. tbar: [
  25118. {
  25119. xtype: 'button',
  25120. text: '添加',
  25121. iconCls: 'x-fa fa-plus-circle',
  25122. listeners: {
  25123. click: 'scope.addField'
  25124. }
  25125. },
  25126. {
  25127. xtype: 'button',
  25128. text: '删除',
  25129. iconCls: 'x-fa fa-minus-circle',
  25130. listeners: {
  25131. click: 'scope.removeField'
  25132. }
  25133. },
  25134. '-',
  25135. {
  25136. xtype: 'button',
  25137. text: '自动分析',
  25138. iconCls: 'x-fa fa-code-fork',
  25139. listeners: {
  25140. click: 'scope.calcField'
  25141. }
  25142. },
  25143. {
  25144. xtype: 'button',
  25145. text: '上移',
  25146. iconCls: 'x-fa fa-arrow-up',
  25147. listeners: {
  25148. click: 'scope.moveUp'
  25149. }
  25150. },
  25151. {
  25152. xtype: 'button',
  25153. text: '下移',
  25154. iconCls: 'x-fa fa-arrow-down',
  25155. listeners: {
  25156. click: 'scope.moveDown'
  25157. }
  25158. },
  25159. ],
  25160. store: {},
  25161. columns: [
  25162. {
  25163. dataIndex: 'dataIndex', header: "字段名", width: 140,
  25164. editor: { xtype: 'textfield' }
  25165. },
  25166. {
  25167. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  25168. editor: { xtype: 'textfield' }
  25169. },
  25170. {
  25171. dataIndex: 'header', header: '中文', width: 140,
  25172. editor: { xtype: 'textfield' }
  25173. },
  25174. {
  25175. dataIndex: 'dict', header: '字典', width: 110,
  25176. editor: { xtype: 'combogrid' }
  25177. },
  25178. {
  25179. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  25180. editor: { xtype: 'combogrid' }, hidden: true,
  25181. },
  25182. {
  25183. dataIndex: 'width', header: '宽度', width: 80,
  25184. editor: { xtype: 'numberfield' }, hidden: true,
  25185. },
  25186. {
  25187. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  25188. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  25189. },
  25190. {
  25191. dataIndex: 'serverCreateValue', header: '服务端创建值',
  25192. editor: { xtype: 'textfield' },
  25193. },
  25194. {
  25195. dataIndex: 'createValue', text: '客户端新创建值',
  25196. editor: { xtype: 'textfield' },
  25197. },
  25198. {
  25199. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  25200. resizable: false, sortable: false, menuDisabled: true,
  25201. checkedValue: true, uncheckedValue: false,
  25202. },
  25203. {
  25204. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  25205. resizable: false, sortable: false, menuDisabled: true,
  25206. checkedValue: true, uncheckedValue: false,
  25207. },
  25208. {
  25209. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  25210. resizable: false, sortable: false, menuDisabled: true,
  25211. checkedValue: true, uncheckedValue: false,
  25212. },
  25213. {
  25214. dataIndex: 'formatter', header: '格式化', width: 110,
  25215. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  25216. },
  25217. {
  25218. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  25219. resizable: false, sortable: false, menuDisabled: true,
  25220. checkedValue: true, uncheckedValue: false, hidden: true,
  25221. },
  25222. {
  25223. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  25224. resizable: false, sortable: false, menuDisabled: true,
  25225. hidden: true,
  25226. },
  25227. {
  25228. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  25229. resizable: false, sortable: false, menuDisabled: true,
  25230. checkedValue: true, uncheckedValue: false, hidden: true,
  25231. },
  25232. {
  25233. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  25234. resizable: false, sortable: false, menuDisabled: true,
  25235. },
  25236. {
  25237. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  25238. resizable: false, sortable: false, menuDisabled: true,
  25239. checkedValue: true, uncheckedValue: false, hidden: true,
  25240. },
  25241. {
  25242. dataIndex: 'form_order', text: '对话框序号',
  25243. editor: { xtype: 'numberfield' },
  25244. },
  25245. {
  25246. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  25247. resizable: false, sortable: false, menuDisabled: true,
  25248. checkedValue: true, uncheckedValue: false,
  25249. },
  25250. {
  25251. dataIndex: 'form_xtype', text: '对话框编辑器',
  25252. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  25253. },
  25254. {
  25255. dataIndex: 'form_fieldset', text: '对话框字段组',
  25256. editor: { xtype: 'textfield' }, hidden: true,
  25257. },
  25258. {
  25259. dataIndex: 'form_tab', text: '对话框选项卡',
  25260. editor: { xtype: 'textfield' }, hidden: true,
  25261. },
  25262. {
  25263. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  25264. resizable: false, sortable: false, menuDisabled: true,
  25265. checkedValue: true, uncheckedValue: false, hidden: true,
  25266. },
  25267. ],
  25268. },
  25269. {
  25270. title: 'SQL和查询条件', reference: 'sql',
  25271. layout: 'border',
  25272. border: false,
  25273. items: [
  25274. {
  25275. region: 'north',
  25276. height: 200,
  25277. border: false,
  25278. split: true,
  25279. xtype: 'yvgrid',
  25280. reference: 'gridCondition',
  25281. pagination: false,
  25282. hideFootbar: true,
  25283. _mode: 'edit',
  25284. listeners: {
  25285. buttonclick: 'scope.conditionButtonclick',
  25286. },
  25287. store: {},
  25288. tbar: {
  25289. xtype: 'toolbar',
  25290. border: false,
  25291. items: [
  25292. {
  25293. xtype: 'button',
  25294. text: '添加条件',
  25295. iconCls: 'x-fa fa-plus-circle',
  25296. listeners: {
  25297. click: 'scope.addCondition'
  25298. }
  25299. },
  25300. {
  25301. xtype: 'button',
  25302. text: '删除条件',
  25303. iconCls: 'x-fa fa-minus-circle',
  25304. listeners: {
  25305. click: 'scope.removeCondition'
  25306. }
  25307. },
  25308. '-',
  25309. {
  25310. xtype: 'button',
  25311. text: '自动分析条件变量',
  25312. iconCls: 'x-fa fa-code-fork',
  25313. listeners: {
  25314. click: 'scope.calcCondition'
  25315. }
  25316. },
  25317. {
  25318. xtype: 'button',
  25319. text: '上移',
  25320. iconCls: 'x-fa fa-arrow-up',
  25321. listeners: {
  25322. click: 'scope.moveUpCondition'
  25323. }
  25324. },
  25325. {
  25326. xtype: 'button',
  25327. text: '下移',
  25328. iconCls: 'x-fa fa-arrow-down',
  25329. listeners: {
  25330. click: 'scope.moveDownCondition'
  25331. }
  25332. },
  25333. ]
  25334. },
  25335. columns: [
  25336. {
  25337. text: '条件变量',
  25338. dataIndex: 'param_name',
  25339. width: 140,
  25340. sortable: false,
  25341. menuDisabled: true,
  25342. editor: {
  25343. selectOnFocus: true
  25344. },
  25345. },
  25346. {
  25347. text: '中文标题',
  25348. dataIndex: 'fieldLabel',
  25349. width: 120,
  25350. sortable: false,
  25351. menuDisabled: true,
  25352. editor: {
  25353. selectOnFocus: true
  25354. },
  25355. },
  25356. {
  25357. text: '编辑类型',
  25358. dataIndex: 'xtype',
  25359. width: 80,
  25360. sortable: false,
  25361. menuDisabled: true,
  25362. editor: {
  25363. xtype: 'combo',
  25364. typeAhead: true,
  25365. triggerAction: 'all',
  25366. selectOnFocus: true,
  25367. store: [
  25368. ['textfield', 'textfield'],
  25369. ['combo', 'combo'],
  25370. ['datefield', 'datefield'],
  25371. ['datetimefield', 'datetimefield'],
  25372. ['numberfield', 'numberfield'],
  25373. ['multiplesearch', 'multiplesearch'],
  25374. ]
  25375. }
  25376. },
  25377. {
  25378. text: '权重',
  25379. dataIndex: 'conditionFieldFlex',
  25380. align: 'right',
  25381. width: 60,
  25382. sortable: false,
  25383. menuDisabled: true,
  25384. editor: {
  25385. xtype: 'numberfield',
  25386. selectOnFocus: false,
  25387. minValue: 0,
  25388. maxValue: 10
  25389. },
  25390. },
  25391. {
  25392. text: '字典',
  25393. dataIndex: 'conditionFieldDict',
  25394. width: 160,
  25395. sortable: false,
  25396. menuDisabled: true,
  25397. editor: {
  25398. selectOnFocus: false
  25399. },
  25400. },
  25401. {
  25402. xtype: 'checkcolumn',
  25403. dataIndex: "conditionFieldWrap", header: "换行",
  25404. width: 65,
  25405. sortable: false,
  25406. menuDisabled: true,
  25407. },
  25408. {
  25409. text: '扩展参数',
  25410. dataIndex: 'conditionFieldExtend',
  25411. sortable: false,
  25412. menuDisabled: true,
  25413. editor: {
  25414. selectOnFocus: false
  25415. },
  25416. },
  25417. ]
  25418. },
  25419. {
  25420. region: 'center',
  25421. xtype: 'sqleditor',
  25422. layout: 'fit',
  25423. reference: 'sqlEditor',
  25424. split: true,
  25425. },
  25426. ]
  25427. },
  25428. {
  25429. title: '详情对话框',
  25430. layout: {
  25431. type: 'vbox',
  25432. pack: 'start',
  25433. align: 'stretch'
  25434. },
  25435. defaults: {
  25436. border: false,
  25437. anchor: '100%',
  25438. margin: '5',
  25439. },
  25440. scrollable: true,
  25441. items: [
  25442. {
  25443. xtype: 'cols',
  25444. items: [
  25445. {
  25446. fieldLabel: '对话框标题',
  25447. bind: { value: '{detailDialog.title}' },
  25448. xtype: 'textfield',
  25449. flex: 2,
  25450. },
  25451. {
  25452. fieldLabel: '宽度',
  25453. bind: { value: '{detailDialog.width}' },
  25454. xtype: 'numberfield',
  25455. },
  25456. {
  25457. fieldLabel: '高度',
  25458. bind: { value: '{detailDialog.height}' },
  25459. xtype: 'numberfield',
  25460. },
  25461. ]
  25462. },
  25463. ]
  25464. },
  25465. {
  25466. title: '界面源码',
  25467. xtype: 'jseditor',
  25468. reference: 'jseditor'
  25469. }
  25470. ]
  25471. }
  25472. ]
  25473. };
  25474. //# sourceMappingURL=GridColumnCustom.view.js.map
  25475. var GridColumnCustom = /** @class */ (function (_super) {
  25476. __extends(GridColumnCustom, _super);
  25477. function GridColumnCustom() {
  25478. return _super.call(this, { model: model$o, vjson: vjson$o }) || this;
  25479. }
  25480. GridColumnCustom.prototype.commit = function () {
  25481. };
  25482. GridColumnCustom.prototype.grid1Buttonclick = function () {
  25483. };
  25484. GridColumnCustom.prototype.conditionButtonclick = function () {
  25485. };
  25486. GridColumnCustom.prototype.addField = function () {
  25487. };
  25488. GridColumnCustom.prototype.removeField = function () {
  25489. };
  25490. GridColumnCustom.prototype.calcField = function () {
  25491. };
  25492. GridColumnCustom.prototype.moveUp = function () {
  25493. };
  25494. GridColumnCustom.prototype.moveDown = function () {
  25495. };
  25496. GridColumnCustom.prototype.addCondition = function () {
  25497. };
  25498. GridColumnCustom.prototype.removeCondition = function () {
  25499. };
  25500. GridColumnCustom.prototype.calcCondition = function () {
  25501. };
  25502. GridColumnCustom.prototype.moveUpCondition = function () {
  25503. };
  25504. GridColumnCustom.prototype.moveDownCondition = function () {
  25505. };
  25506. return GridColumnCustom;
  25507. }(Scope));
  25508. //# sourceMappingURL=GridColumnCustom.js.map
  25509. function initGridCode(grid, newConfig, buttons) {
  25510. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  25511. buttons.push({
  25512. xtype: 'button',
  25513. tooltip: '定义表格属性',
  25514. iconCls: 'x-fa fa-codepen',
  25515. handler: function (btn) {
  25516. var customWindow = new GridColumnCustom();
  25517. customWindow.showDialog(btn, {}, {});
  25518. }
  25519. });
  25520. buttons.push({
  25521. xtype: 'button',
  25522. tooltip: '定义表格数据源',
  25523. iconCls: 'x-fa fa-database',
  25524. handler: function () {
  25525. // showCustomGridDataSource(grid)
  25526. }
  25527. });
  25528. }
  25529. }
  25530. //# sourceMappingURL=grid_code.js.map
  25531. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  25532. var hexToString = function (hex) {
  25533. var arr = hex.split("");
  25534. var out = "";
  25535. for (var i = 0; i < arr.length / 2; i++) {
  25536. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  25537. // @ts-ignore
  25538. var charValue = String.fromCharCode(tmp);
  25539. out += charValue;
  25540. }
  25541. return out;
  25542. };
  25543. var defaultGrid = grid;
  25544. function initGrid () {
  25545. Ext.define('Yvan.Grid', {
  25546. extend: 'Ext.grid.Panel',
  25547. xtype: 'yvgrid',
  25548. __suspendReload: false,
  25549. _originVJson: {},
  25550. constructor: function (config) {
  25551. var _this = this;
  25552. var _a, _b, _c, _d, _e, _f;
  25553. var me = this;
  25554. var dataSource = config.dataSource;
  25555. 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);
  25556. me._originVJson = config;
  25557. if (!isDesignMode(scope, config)) {
  25558. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  25559. if (Array.isArray(config.columns) && config.columns.length > 0) {
  25560. var cacheData = this.getColumnConfigCache();
  25561. if (Array.isArray(cacheData) && cacheData.length > 0) {
  25562. var newColumns = [];
  25563. for (var j = 0; j < cacheData.length; j++) {
  25564. var itData = cacheData[j];
  25565. for (var i = 0; i < config.columns.length; i++) {
  25566. var column = config.columns[i];
  25567. if (itData.dataIndex === column.dataIndex) {
  25568. if (itData.width) {
  25569. column.width = itData.width;
  25570. }
  25571. column.hidden = itData.hidden;
  25572. column.locked = itData.locked;
  25573. newColumns.push(column);
  25574. break;
  25575. }
  25576. }
  25577. }
  25578. config.columns = newColumns;
  25579. }
  25580. }
  25581. }
  25582. var newConfig = _$2.defaultsDeep({
  25583. // 强制性属性 bug.
  25584. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  25585. // enableLocking: false,
  25586. // syncRowHeight: false,
  25587. }, baseConfig(config, 'row-item'), config, grid);
  25588. // 在面板上的组件
  25589. // const scope = newConfig.$initParent?.yvanScope ||
  25590. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  25591. // config.$vmParent?.yvanScope ||
  25592. // newConfig.$vmParent?._parent?.yvanScope;
  25593. var buttons = [];
  25594. var getRowClass = newConfig.getRowClass;
  25595. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  25596. _$2.startsWith(getRowClass, "system."))) {
  25597. var fn = lookupFn(scope, getRowClass);
  25598. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  25599. }
  25600. if (!newConfig.hideExport) {
  25601. buttons.push({
  25602. xtype: 'button',
  25603. tooltip: '导出Excel',
  25604. iconCls: 'x-fa fa-download',
  25605. listeners: {
  25606. click: this.exportExcel
  25607. },
  25608. });
  25609. }
  25610. if (!newConfig.hideAutoSize) {
  25611. buttons.push({
  25612. xtype: 'button',
  25613. iconCls: 'x-fa fa-text-width',
  25614. tooltip: '自适应宽度',
  25615. listeners: {
  25616. click: this.autoSizeColumns
  25617. }
  25618. });
  25619. }
  25620. if (!newConfig.hideClearFilter) {
  25621. buttons.push({
  25622. xtype: 'button',
  25623. tooltip: '清空筛选',
  25624. iconCls: 'x-fa fa-filter',
  25625. handler: this.clearFilter
  25626. });
  25627. }
  25628. if (!newConfig.hideSaveGridUIConfig) {
  25629. buttons.push({
  25630. xtype: 'button',
  25631. tooltip: '保存布局',
  25632. iconCls: 'x-fa fa-cogs',
  25633. handler: this.saveGridUIConfig
  25634. });
  25635. }
  25636. if (!newConfig.hideClearGridUIConfig) {
  25637. buttons.push({
  25638. xtype: 'button',
  25639. tooltip: '还原布局',
  25640. iconCls: 'x-fa fa-reply-all',
  25641. handler: this.clearGridUIConfig
  25642. });
  25643. }
  25644. initGridCode(me, newConfig, buttons);
  25645. if (!newConfig.hideFootbar) {
  25646. if (newConfig.pagination) {
  25647. newConfig.bbar = new Ext.PagingToolbar({
  25648. // pageSize: newConfig.pageSize, 这个值是无效的
  25649. displayInfo: true,
  25650. store: this.store,
  25651. emptyMsg: '没有记录',
  25652. cls: 'grid-bbar',
  25653. items: __spread([
  25654. {
  25655. xtype: 'combobox',
  25656. tooltip: '分页',
  25657. queryMode: 'local',
  25658. editable: false,
  25659. allowBlank: true,
  25660. labelAlign: 'right',
  25661. width: 90,
  25662. // labelWidth: 30,
  25663. listConfig: {
  25664. minWidth: null
  25665. },
  25666. value: 50,
  25667. valueField: undefined,
  25668. displayField: undefined,
  25669. hideClear: true,
  25670. store: newConfig.pageSizeOption,
  25671. listeners: {
  25672. change: function (sender, nv, ov) {
  25673. _this.store.pageSize = nv;
  25674. _this.store.loadPage(1);
  25675. }
  25676. }
  25677. }
  25678. ], buttons),
  25679. doRefresh: function () {
  25680. me.reload();
  25681. }
  25682. });
  25683. }
  25684. else {
  25685. newConfig.bbar = {
  25686. xtype: 'toolbar', overflowHandler: 'menu',
  25687. cls: 'grid-bbar',
  25688. items: __spread([
  25689. {
  25690. xtype: 'button',
  25691. tooltip: '刷新',
  25692. iconCls: 'x-fa fa-refresh',
  25693. handler: function () {
  25694. _this.reload();
  25695. }
  25696. },
  25697. '-'
  25698. ], buttons)
  25699. };
  25700. if (newConfig.hideRefresh) {
  25701. newConfig.bbar.items.splice(0, 1);
  25702. }
  25703. }
  25704. }
  25705. if (_$2.isArray(newConfig.condition)) {
  25706. // 带查询条件
  25707. var conditionRows_1 = [];
  25708. var newRow_1 = false;
  25709. var currentRow_1 = { xtype: 'cols', items: [], };
  25710. conditionRows_1.push(currentRow_1);
  25711. _$2.forEach(newConfig.condition, function (item) {
  25712. var _a;
  25713. if (newRow_1) {
  25714. currentRow_1 = { xtype: 'cols', items: [], };
  25715. conditionRows_1.push(currentRow_1);
  25716. }
  25717. var vj = _$2.cloneDeep(item);
  25718. if (vj.xtype) {
  25719. if (item.xtype === 'combo' && item.dict) {
  25720. vj.fix = ['system.getDict("' + item.dict + '")'];
  25721. }
  25722. if (item.xtype === 'datetimefield') {
  25723. _$2.defer(function () {
  25724. //@ts-ignore
  25725. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  25726. });
  25727. }
  25728. else if (item.xtype === 'datefield') {
  25729. _$2.defer(function () {
  25730. //@ts-ignore
  25731. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  25732. });
  25733. }
  25734. else {
  25735. scope.viewModel.set(item.param_name, '');
  25736. }
  25737. }
  25738. else {
  25739. // 没有组件类型,是个空占位符
  25740. vj.border = false;
  25741. }
  25742. if (item.param_name) {
  25743. vj.bind = {
  25744. value: '{' + item.param_name + '}'
  25745. };
  25746. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25747. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25748. }
  25749. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  25750. currentRow_1.items.push(vj);
  25751. });
  25752. newConfig.tbar = {
  25753. xtype: 'form',
  25754. border: false,
  25755. items: conditionRows_1,
  25756. defaults: {
  25757. margin: '8 0 8 0'
  25758. },
  25759. };
  25760. console.log('newConfig', newConfig);
  25761. }
  25762. _$2.each(newConfig.columns, function (c) {
  25763. var renderer = c.renderer, formatter = c.formatter;
  25764. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  25765. _$2.startsWith(renderer, "system."))) {
  25766. if (newConfig.$initParent) {
  25767. if (scope) {
  25768. var rendererFn = lookupFn(scope, renderer);
  25769. c.renderer = rendererFn.bind(scope);
  25770. }
  25771. }
  25772. }
  25773. if (c.dict) {
  25774. c.fix = ['system.getDict("' + c.dict + '")'];
  25775. if (c.editor && c.editor.xtype === 'combo') {
  25776. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  25777. c.editor.typeAhead = true;
  25778. c.editor.triggerAction = 'all';
  25779. c.editor.selectOnFocus = false;
  25780. c.editor.listConfig = {
  25781. minWidth: 200
  25782. };
  25783. }
  25784. }
  25785. if (formatter === 'button') {
  25786. c.tdCls = 'td-btn';
  25787. if (!c.listeners) {
  25788. c.listeners = {};
  25789. }
  25790. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  25791. if ($(event.target).is('input')) {
  25792. me.fireEvent('buttonclick', me, this, record);
  25793. }
  25794. };
  25795. }
  25796. else if (formatter === 'percentRenderer') {
  25797. c.tdCls = 'td-percent';
  25798. }
  25799. });
  25800. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  25801. // 强制为编辑模式
  25802. newConfig.selModel = {
  25803. type: 'spreadsheet',
  25804. columnSelect: true,
  25805. pruneRemoved: false,
  25806. extensible: 'y'
  25807. };
  25808. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  25809. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  25810. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25811. }
  25812. else {
  25813. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  25814. }
  25815. }
  25816. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  25817. // 强制为勾选模式
  25818. newConfig.selModel = {
  25819. type: 'checkboxmodel',
  25820. mode: 'MULTI',
  25821. };
  25822. }
  25823. else if (newConfig._mode === 'checkonly') {
  25824. newConfig.selModel = {
  25825. type: 'checkboxmodel',
  25826. mode: 'MULTI',
  25827. checkOnly: true,
  25828. };
  25829. }
  25830. else if (newConfig._mode === 'select') {
  25831. // 强制为选择模式
  25832. newConfig.selModel = {
  25833. selType: 'rowmodel',
  25834. mode: 'SINGLE',
  25835. };
  25836. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  25837. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25838. }
  25839. }
  25840. initBehaviorEdit(newConfig);
  25841. initGridDialog(newConfig);
  25842. this.superclass.constructor.call(this, newConfig);
  25843. this.store.pageSize = newConfig.pageSize;
  25844. },
  25845. setData: function (value) {
  25846. var me = this;
  25847. me._setDataReal(value);
  25848. },
  25849. /**
  25850. * 添加行,并进入编辑状态
  25851. * @param record 新行的属性集
  25852. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  25853. */
  25854. appendEditRow: function (record, editRowCol) {
  25855. var records = this.getStore().add(record);
  25856. var recNew = records[0];
  25857. this.setSelection(records);
  25858. if (typeof editRowCol === 'string' && editRowCol) {
  25859. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25860. }
  25861. if (typeof editRowCol === 'number') {
  25862. var ce = this.findPlugin('cellediting');
  25863. this.editingPlugin = ce;
  25864. ce.startEdit(recNew, editRowCol);
  25865. }
  25866. },
  25867. beginEdit: function (record, editRowCol) {
  25868. if (typeof record === 'number') {
  25869. record = this.store.data.getAt(record);
  25870. }
  25871. if (record.isEntity === true) {
  25872. this.setSelection([record]);
  25873. if (typeof editRowCol === 'string' && editRowCol) {
  25874. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25875. }
  25876. if (typeof editRowCol === 'number') {
  25877. var ce = this.findPlugin('cellediting');
  25878. this.editingPlugin = ce;
  25879. ce.startEdit(record, editRowCol);
  25880. }
  25881. }
  25882. },
  25883. /**
  25884. * 移除行
  25885. * @param record 如果记录传空,就是当前选中的行
  25886. */
  25887. removeEditRow: function (record) {
  25888. if (!record) {
  25889. record = this.selection;
  25890. }
  25891. if (!record) {
  25892. msg('请选中要删除的行');
  25893. return;
  25894. }
  25895. this.getStore().remove(record);
  25896. },
  25897. /**
  25898. * 获取全部原始数据
  25899. */
  25900. getDataRows: function () {
  25901. return this.getStore().data.items.map(function (r) { return r.data; });
  25902. },
  25903. /**
  25904. * 获取全部原始数据, 不带 id/ 不带 origin
  25905. */
  25906. getDataRowsOnlyData: function () {
  25907. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  25908. delete r.id;
  25909. delete r._origin;
  25910. return r;
  25911. });
  25912. },
  25913. rowMoveUp: function () {
  25914. var grid = this;
  25915. if (!grid.selection) {
  25916. msg('无法对多行进行移动');
  25917. return;
  25918. }
  25919. var record = grid.selection;
  25920. if (_$2.isArray(record)) {
  25921. record = record[0];
  25922. }
  25923. if (!record) {
  25924. msg('无法对多行进行移动');
  25925. return;
  25926. }
  25927. // const records = grid.selModel.getSelection()
  25928. // if (records.length !== 1) {
  25929. // msg('无法对多行进行移动')
  25930. // return
  25931. // }
  25932. //
  25933. // const [record] = records
  25934. var index = grid.store.indexOf(record);
  25935. if (index > 0) {
  25936. grid.store.removeAt(index);
  25937. grid.store.insert(index - 1, record);
  25938. grid.getView().refresh();
  25939. grid.selModel.select([record]);
  25940. }
  25941. },
  25942. rowMoveDown: function () {
  25943. var grid = this;
  25944. // const records = grid.selModel.getSelection()
  25945. // if (records.length !== 1) {
  25946. // msg('无法对多行进行移动')
  25947. // return
  25948. // }
  25949. if (!grid.selection) {
  25950. msg('无法对多行进行移动');
  25951. return;
  25952. }
  25953. var record = grid.selection;
  25954. if (_$2.isArray(record)) {
  25955. record = record[0];
  25956. }
  25957. if (!record) {
  25958. msg('无法对多行进行移动');
  25959. return;
  25960. }
  25961. var index = grid.store.indexOf(record);
  25962. if (index < grid.store.getCount() - 1) {
  25963. grid.store.removeAt(index);
  25964. grid.store.insert(index + 1, record);
  25965. grid.getView().refresh();
  25966. grid.selModel.select([record]);
  25967. }
  25968. },
  25969. getEditRecord: function () {
  25970. var _a, _b;
  25971. var me = this;
  25972. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  25973. 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;
  25974. var record;
  25975. if (typeof rowIdx === 'undefined') {
  25976. record = me.getSelectionModel().getLastSelected();
  25977. }
  25978. else {
  25979. record = me.store.getAt(rowIdx);
  25980. }
  25981. return record;
  25982. },
  25983. getEditRow: function () {
  25984. var _a;
  25985. var me = this;
  25986. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  25987. },
  25988. setEditRow: function (rowValues) {
  25989. var me = this;
  25990. var record = me.getEditRecord();
  25991. if (record) {
  25992. _$2.forOwn(rowValues, function (v, k) {
  25993. record.set(k, v);
  25994. });
  25995. }
  25996. },
  25997. _transform: function (data) {
  25998. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  25999. _$2.forEach(data, function (row) {
  26000. row._origin = _$2.clone(row);
  26001. });
  26002. },
  26003. _setDataReal: function (value) {
  26004. var me = this;
  26005. this._transform(value);
  26006. var storeOpt = {
  26007. fields: getFileds(this),
  26008. data: value,
  26009. };
  26010. if (this.groupField) {
  26011. storeOpt.groupField = this.groupField;
  26012. }
  26013. var store = new Ext.data.Store(storeOpt);
  26014. me.setStore(store);
  26015. },
  26016. setStore: function (store) {
  26017. var me = this;
  26018. if (_$2.isArray(store)) {
  26019. var value = store;
  26020. this._transform(value);
  26021. var storeOpt = {
  26022. fields: getFileds(this),
  26023. data: value,
  26024. };
  26025. if (this.groupField) {
  26026. storeOpt.groupField = this.groupField;
  26027. }
  26028. store = new Ext.data.Store(storeOpt);
  26029. }
  26030. me.superclass.setStore.call(this, store);
  26031. var reference = this.reference;
  26032. if (reference) {
  26033. var scope = lookupScope(this);
  26034. scope.viewModel.set(reference + '.ischanged', false);
  26035. scope.viewModel.set(reference + '.theid', null);
  26036. scope.viewModel.set(reference + '.theid2', null);
  26037. scope.viewModel.set(reference + '.theid3', null);
  26038. }
  26039. if (store) {
  26040. store.on({
  26041. add: function (store, records, index, eOpts) {
  26042. me._raiseChange(store, 'add');
  26043. },
  26044. remove: function (store, records, index, isMove, eOpts) {
  26045. me._raiseChange(store, 'remove');
  26046. },
  26047. datachanged: function (sender, opt) {
  26048. me._raiseChange(store, 'datachanged');
  26049. }
  26050. });
  26051. }
  26052. },
  26053. _raiseChange: function (store, type) {
  26054. var _a, _b;
  26055. var reference = this.reference;
  26056. if (reference && store) {
  26057. var ischanged = false;
  26058. if (store.getModifiedRecords().length > 0 ||
  26059. store.getNewRecords().length > 0 ||
  26060. store.getRemovedRecords().length > 0) {
  26061. ischanged = true;
  26062. }
  26063. else {
  26064. ischanged = false;
  26065. }
  26066. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  26067. }
  26068. },
  26069. /**
  26070. * 轻量级刷新
  26071. */
  26072. refreshData: function () {
  26073. var store = this.getStore();
  26074. if (store) {
  26075. store.reload();
  26076. }
  26077. },
  26078. /**
  26079. * 为表格强制设置焦点
  26080. * @param seq 顺序号
  26081. */
  26082. focusRow: function (seq) {
  26083. this.setSelection(this.store.getAt(seq));
  26084. this.getView().focusRow(seq);
  26085. },
  26086. /**
  26087. * 重新载入数据(重新计算参数)
  26088. */
  26089. reload: function (reloadParams) {
  26090. if (reloadParams === void 0) { reloadParams = {}; }
  26091. var me = this;
  26092. var config = me.config;
  26093. if (config.dataSourceCallbackFn) {
  26094. // 函数请求刷新
  26095. var scope_1 = lookupScope(this);
  26096. _$2.defer(function () {
  26097. me.setLoading(true);
  26098. });
  26099. config.dataSourceCallbackFn.call(scope_1, me, {
  26100. successCallback: function (value) {
  26101. me._setDataReal(value);
  26102. _$2.defer(function () {
  26103. me.setLoading(false);
  26104. });
  26105. // 自动选中第一行
  26106. var data = me.getStore().data;
  26107. if (data.length > 0) {
  26108. me.setSelection(data.items[0]);
  26109. }
  26110. me.fireEvent('dataLoadComplete', me, true, value);
  26111. },
  26112. failCallback: function (error) {
  26113. _$2.defer(function () {
  26114. me.setLoading(false);
  26115. });
  26116. me.fireEvent('dataLoadComplete', me, false, error);
  26117. }
  26118. });
  26119. return;
  26120. }
  26121. // if (this.store) {
  26122. // this.store.reload({aaaa: 1, bbbb: 2})
  26123. // }
  26124. var dataSource = config.dataSource;
  26125. var scope = lookupScope(me);
  26126. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  26127. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  26128. }
  26129. },
  26130. exportCurrentExcelClick: function () {
  26131. var _a;
  26132. var me = this;
  26133. var config = me.config;
  26134. var scope = lookupScope(me);
  26135. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26136. if (excelFileName.endsWith(".xlsx")) {
  26137. excelFileName = excelFileName.split(".xlsx")[0];
  26138. }
  26139. excelFileName += ".xlsx";
  26140. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  26141. var excelData = me.makeExcelData(rowsAll);
  26142. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  26143. },
  26144. exportExcelClick: function (excelExportParams) {
  26145. var me = this;
  26146. var config = me.config;
  26147. excelExportParams.isExcelExport = true;
  26148. var scope = lookupScope(me);
  26149. var dataSource = config.dataSource;
  26150. scope.setLoading(true);
  26151. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26152. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  26153. var _a, _b, _c, _d;
  26154. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  26155. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  26156. 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;
  26157. me.exportExcelCurrentPage = page;
  26158. me.exportExcelPageSize = size;
  26159. me.exportExcelTotal = total;
  26160. if (excelFileName.endsWith(".xlsx")) {
  26161. excelFileName = excelFileName.split(".xlsx")[0];
  26162. }
  26163. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  26164. excelFileName += ".xlsx";
  26165. var excelData = me.makeExcelData(responseData.data);
  26166. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  26167. if (page < total / size) {
  26168. page++;
  26169. me.exportExcelCurrentPage = page;
  26170. }
  26171. scope.setLoading(false);
  26172. });
  26173. },
  26174. exportBigExcelClick: function () {
  26175. var _a;
  26176. var me = this;
  26177. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  26178. showErrorDialog('当前表格不支持大批量导出');
  26179. return;
  26180. }
  26181. var config = me.config;
  26182. var scope = lookupScope(me);
  26183. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26184. var head = [];
  26185. var dict = {};
  26186. _$2.forEach(me.columns, function (column) {
  26187. if (column.isHidden())
  26188. return;
  26189. if (!column.dataIndex)
  26190. return;
  26191. if (!column.text)
  26192. return;
  26193. head.push({ field: column.dataIndex, name: column.text });
  26194. if (column.dictForExcel) {
  26195. dict[column.dataIndex] = column.dictForExcel;
  26196. }
  26197. });
  26198. // 判断是否需要解密
  26199. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  26200. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  26201. me.dbInfo.password = hexToString(me.dbInfo.password);
  26202. me.dbInfo.username = hexToString(me.dbInfo.username);
  26203. }
  26204. scope.setLoading(true);
  26205. Ext.Ajax.request({
  26206. timeout: 15000,
  26207. url: window["EXPORT_DATA_HOST"],
  26208. method: "POST",
  26209. jsonData: {
  26210. file: excelFileName,
  26211. dbInfo: me.dbInfo,
  26212. exportDataSql: me.exportDataSql,
  26213. exportDataSqlParams: me.exportDataSqlParams,
  26214. head: head,
  26215. dict: dict,
  26216. },
  26217. }).then(function () {
  26218. scope.setLoading(false);
  26219. msg('请求成功');
  26220. }).catch(function () {
  26221. scope.setLoading(false);
  26222. showErrorDialog('请求失败,请确认是否已安装客户端');
  26223. });
  26224. },
  26225. makeExcelData: function (jsonData) {
  26226. var me = this;
  26227. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  26228. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  26229. return;
  26230. }
  26231. var data = [];
  26232. // 获取表格的列定义
  26233. var headerTextArr = [];
  26234. var headers = [];
  26235. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  26236. var header = me.headerCt.getGridColumns()[i];
  26237. if (!header.isHidden()) {
  26238. var textStr = _$2.trim(header.text);
  26239. var dataIndexStr = _$2.trim(header.dataIndex);
  26240. if (dataIndexStr) {
  26241. if (textStr === '') {
  26242. headerTextArr.push(dataIndexStr);
  26243. }
  26244. else {
  26245. headerTextArr.push(textStr);
  26246. }
  26247. headers.push(header);
  26248. }
  26249. }
  26250. }
  26251. if (headers.length === 0) {
  26252. return;
  26253. }
  26254. data.push(headerTextArr);
  26255. for (var i = 0; i < jsonData.length; i++) {
  26256. var dataRow = jsonData[i];
  26257. var row = [];
  26258. for (var j = 0; j < headers.length; j++) {
  26259. var key = headers[j].dataIndex;
  26260. var value = dataRow[key];
  26261. if (!value && value !== 0) {
  26262. value = '';
  26263. }
  26264. var oValue = value;
  26265. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  26266. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  26267. try {
  26268. value = headers[j].renderer(value);
  26269. if (!value && value !== 0) {
  26270. value = oValue;
  26271. }
  26272. }
  26273. catch (e) {
  26274. value = oValue;
  26275. }
  26276. }
  26277. row.push(value);
  26278. }
  26279. data.push(row);
  26280. }
  26281. return data;
  26282. },
  26283. initComponent: function () {
  26284. var _this = this;
  26285. var _a;
  26286. var me = this;
  26287. var config = me.config;
  26288. var scope = lookupScope(this);
  26289. if (isDesignMode(scope, config)) {
  26290. this.superclass.initComponent.call(this);
  26291. return;
  26292. }
  26293. // 转换 dataSource 属性
  26294. convertDataSource$1(me, scope, config);
  26295. this.on({
  26296. afterrender: function (sender) {
  26297. var me = this;
  26298. var config = this.config;
  26299. var dataSource = config.dataSource;
  26300. if (config.autoLoad) {
  26301. if (config.dataSourceCallbackFn) {
  26302. me.reload();
  26303. }
  26304. else if (_$2.isPlainObject(dataSource)) {
  26305. me.reload();
  26306. }
  26307. }
  26308. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  26309. var vm = this.lookupViewModel();
  26310. this.contextMenu = this.add(new Ext.menu.Menu({
  26311. viewModel: vm,
  26312. items: _$2.map(config.tbar, function (item) {
  26313. var menuItem = __assign({}, item);
  26314. if (menuItem.xtype === 'button') {
  26315. delete menuItem.xtype;
  26316. }
  26317. return menuItem;
  26318. })
  26319. }));
  26320. }
  26321. else if (_$2.isPlainObject(config.contextMenu)) {
  26322. this.contextMenu = this.add(config.contextMenu);
  26323. }
  26324. var $dom = $(sender.el.dom);
  26325. $dom.on('keydown', function (e) {
  26326. me.fireEvent('keydown', me, e);
  26327. }).on('keyup', function (e) {
  26328. me.fireEvent('keyup', me, e);
  26329. });
  26330. // 默认显示提示
  26331. if (this.cellTip) {
  26332. this.tip = Ext.create('Ext.tip.ToolTip', {
  26333. target: this.el,
  26334. delegate: '.x-grid-cell-inner',
  26335. trackMouse: true,
  26336. ancor: 'top',
  26337. style: 'background-color: #0D6EFD;',
  26338. listeners: {
  26339. beforeshow: function (tip) {
  26340. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  26341. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  26342. return false;
  26343. }
  26344. tip.update(tipText);
  26345. }
  26346. }
  26347. });
  26348. }
  26349. },
  26350. itemcontextmenu: function (view, rec, node, index, e) {
  26351. if (this.contextMenu) {
  26352. e.stopEvent();
  26353. this.contextMenu.show().setLocalXY(e.getXY());
  26354. return false;
  26355. }
  26356. },
  26357. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  26358. // this.setColumnConfigCache()
  26359. // },
  26360. // columnhide(sender, column, eOpts) {
  26361. // this.setColumnConfigCache()
  26362. // },
  26363. // columnshow(sender, column, eOpts) {
  26364. // this.setColumnConfigCache()
  26365. // },
  26366. // columnresize(sender, column, width, eOpts) {
  26367. // this.setColumnConfigCache()
  26368. // },
  26369. destory: function () {
  26370. },
  26371. selectionchange: function (sender, param) {
  26372. var record = undefined;
  26373. if (_$2.isArray(param)) {
  26374. record = param[0];
  26375. }
  26376. else if (_$2.isObject(param)) {
  26377. record = _$2.get(param, 'endCell.record');
  26378. }
  26379. itemselectFun(this, sender, record);
  26380. },
  26381. itemclick: function (sender, record) {
  26382. itemselectFun(this, sender, record);
  26383. },
  26384. show: function (sender) {
  26385. if (sender.__suspendReload) {
  26386. sender.__suspendReload = false;
  26387. sender.reload();
  26388. }
  26389. }
  26390. });
  26391. _$2.defer(function () {
  26392. var ce = _this.findPlugin('cellediting');
  26393. ce.on({
  26394. beforeedit: function (editor, context, eOpts) {
  26395. me.fireEvent('editbefore', me, editor, context, eOpts);
  26396. },
  26397. canceledit: function (editor, context, eOpts) {
  26398. me.fireEvent('editcancel', me, editor, context, eOpts);
  26399. },
  26400. edit: function (editor, context, eOpts) {
  26401. me.fireEvent('editfinish', me, editor, context, eOpts);
  26402. },
  26403. validateedit: function (editor, context, eOpts) {
  26404. me.fireEvent('editvalidate', me, editor, context, eOpts);
  26405. },
  26406. });
  26407. });
  26408. var itemselectFun = _$2.debounce(function (me, sender, record) {
  26409. var reference = me.reference;
  26410. var scope = lookupScope(me);
  26411. var theid = _$2.get(config, 'behavior.theid');
  26412. if (theid && reference) {
  26413. if (!record) {
  26414. scope.viewModel.set(reference + '.theid', null);
  26415. }
  26416. else {
  26417. scope.viewModel.set(reference + '.theid', record.get(theid));
  26418. }
  26419. }
  26420. var theid2 = _$2.get(config, 'behavior.theid2');
  26421. if (theid2 && reference) {
  26422. if (!record) {
  26423. scope.viewModel.set(reference + '.theid2', null);
  26424. }
  26425. else {
  26426. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  26427. }
  26428. }
  26429. var theid3 = _$2.get(config, 'behavior.theid3');
  26430. if (theid3 && reference) {
  26431. if (!record) {
  26432. scope.viewModel.set(reference + '.theid3', null);
  26433. }
  26434. else {
  26435. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  26436. }
  26437. }
  26438. me.fireEvent('itemselect', sender, record);
  26439. }, 50);
  26440. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  26441. // 为 stores.proxy.buildRequest 做准备
  26442. this.store.proxy.$owner = this;
  26443. }
  26444. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  26445. if (selectToReload) {
  26446. // 点击后触发某个目标表格刷新
  26447. this.on({
  26448. itemselect: function (sender) {
  26449. if (_$2.isArray(selectToReload)) {
  26450. _$2.forEach(selectToReload, function (ref) {
  26451. if (ref) {
  26452. var ctlTarget = scope.refs[ref];
  26453. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26454. if (ctlTarget.isVisible()) {
  26455. ctlTarget.reload();
  26456. }
  26457. else {
  26458. ctlTarget.__suspendReload = true;
  26459. }
  26460. }
  26461. }
  26462. });
  26463. }
  26464. else if (_$2.isString(selectToReload)) {
  26465. var ctlTarget = scope.refs[selectToReload];
  26466. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26467. ctlTarget.reload();
  26468. }
  26469. }
  26470. }
  26471. });
  26472. }
  26473. this.superclass.initComponent.call(this);
  26474. },
  26475. // 生成列自定义的缓存key
  26476. makeColumnConfigCacheKey: function (config) {
  26477. var _a, _b, _c, _d, _e, _f;
  26478. 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);
  26479. var key = "gridColumnCache-" + scope.scopeKey + "-";
  26480. if (config.reference) {
  26481. key += config.reference;
  26482. }
  26483. else {
  26484. var subKey = "";
  26485. for (var i = 0; i < config.columns.length; i++) {
  26486. var column = config.columns[i];
  26487. if (column.dataIndex) {
  26488. subKey += column.dataIndex;
  26489. }
  26490. }
  26491. key += subKey;
  26492. }
  26493. return key;
  26494. },
  26495. getColumnConfigCache: function () {
  26496. var key = this.columnConfigCacheKey;
  26497. var dataStr = localStorage.getItem(key);
  26498. if (dataStr) {
  26499. return JSON.parse(dataStr);
  26500. }
  26501. return "";
  26502. },
  26503. setColumnConfigCache: function () {
  26504. var key = this.columnConfigCacheKey;
  26505. var cacheData = [];
  26506. var columns = this.headerCt.getGridColumns();
  26507. var index = 0;
  26508. for (var i = 0; i < columns.length; i++) {
  26509. var column = columns[i];
  26510. if (column.dataIndex) {
  26511. cacheData.push({
  26512. dataIndex: column.dataIndex,
  26513. width: column.width,
  26514. hidden: column.hidden,
  26515. locked: column.locked,
  26516. index: index
  26517. });
  26518. index++;
  26519. }
  26520. }
  26521. localStorage.setItem(key, JSON.stringify(cacheData));
  26522. },
  26523. autoSizeColumns: function (sender) {
  26524. var grid = sender ? sender.up('grid') : this;
  26525. // const columns = grid.columns;
  26526. // for (let i = 0; i < columns.length; i++) {
  26527. // const column = columns[i];
  26528. // grid.getView().autoSizeColumn(column);
  26529. // column.setWidth(column.getWidth() + 5);
  26530. // }
  26531. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26532. grid.headerCt.getGridColumns()[i].autoSize(i);
  26533. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26534. }
  26535. },
  26536. clearFilter: function (sender) {
  26537. var grid = sender.up('grid');
  26538. grid.filters.clearFilters();
  26539. grid.getStore().sorters.removeAll();
  26540. // grid.getStore().reload()
  26541. },
  26542. saveGridUIConfig: function (sender) {
  26543. var grid = sender.up('grid');
  26544. grid.setColumnConfigCache();
  26545. msg('保存设置成功!');
  26546. },
  26547. clearGridUIConfig: function (sender) {
  26548. var grid = sender.up('grid');
  26549. var key = grid.columnConfigCacheKey;
  26550. localStorage.setItem(key, "");
  26551. msg('清空设置成功,重新打开后生效!');
  26552. },
  26553. setLoading: function (value) {
  26554. if (value) {
  26555. this.mask('读取中');
  26556. }
  26557. else {
  26558. this.unmask();
  26559. }
  26560. },
  26561. exportExcel: function (sender) {
  26562. var rect = sender.btnEl.dom.getBoundingClientRect();
  26563. var scope = lookupScope(this);
  26564. var grid = sender.up('grid');
  26565. var treeMenu = new Ext.menu.Menu({
  26566. xtype: 'menu',
  26567. floated: false,
  26568. width: 300,
  26569. docked: 'left',
  26570. items: [
  26571. {
  26572. text: '大批量导出 (需要客户端支持!)',
  26573. iconCls: 'x-fa fa-download',
  26574. listeners: {
  26575. click: function (sender, value) {
  26576. // @ts-ignore
  26577. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  26578. .then(function (res) {
  26579. grid.exportBigExcelClick();
  26580. });
  26581. }
  26582. }
  26583. },
  26584. '-',
  26585. {
  26586. text: '导出当前数据',
  26587. iconCls: 'x-fa fa-download',
  26588. listeners: {
  26589. click: function (sender, value) {
  26590. grid.exportCurrentExcelClick();
  26591. }
  26592. }
  26593. },
  26594. {
  26595. xtype: "textfield",
  26596. fieldLabel: '当前导出页',
  26597. maskRe: /[0-9]/,
  26598. value: grid.exportExcelCurrentPage,
  26599. listeners: {
  26600. render: function (sender) {
  26601. grid.exportExcelCurrentPageCmp = sender;
  26602. },
  26603. change: function (sender, value) {
  26604. var v = parseInt(value);
  26605. if (isNaN(v) || v === 0) {
  26606. window['system'].msg("页码不能为0");
  26607. v = 1;
  26608. sender.setValue(v);
  26609. }
  26610. var size = parseInt(grid.exportExcelPageSize);
  26611. var total = parseInt(grid.exportExcelTotal);
  26612. if (v > total / size) {
  26613. v = parseInt(total / size + "");
  26614. }
  26615. grid.exportExcelCurrentPage = v + "";
  26616. }
  26617. }
  26618. },
  26619. {
  26620. xtype: "textfield",
  26621. fieldLabel: '导出页大小',
  26622. maskRe: /[0-9]/,
  26623. value: grid.exportExcelPageSize,
  26624. listeners: {
  26625. render: function (sender) {
  26626. grid.exportExcelPageSizeCmp = sender;
  26627. },
  26628. change: function (sender, value) {
  26629. var v = parseInt(value);
  26630. if (isNaN(v) || v === 0) {
  26631. window['system'].msg("导出页大小不能为0");
  26632. v = defaultGrid.exportExcelPageSize;
  26633. sender.setValue(v);
  26634. }
  26635. if (v > 10000) {
  26636. window['system'].msg("导出页大小不能大于10000");
  26637. v = 10000;
  26638. sender.setValue(v);
  26639. }
  26640. var page = parseInt(grid.exportExcelCurrentPage);
  26641. var total = parseInt(grid.exportExcelTotal);
  26642. if (page > total / v) {
  26643. page = parseInt(total / v + "") + 1;
  26644. grid.exportExcelCurrentPageCmp.setValue(page);
  26645. }
  26646. grid.exportExcelPageSize = v + "";
  26647. }
  26648. }
  26649. },
  26650. {
  26651. xtype: "textfield",
  26652. fieldLabel: '总条数',
  26653. value: grid.exportExcelTotal,
  26654. readOnly: true
  26655. },
  26656. {
  26657. text: '导出',
  26658. iconCls: 'x-fa fa-download',
  26659. listeners: {
  26660. click: function (sender, value) {
  26661. grid.exportExcelClick({
  26662. exportExcelPageSize: grid.exportExcelPageSize,
  26663. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26664. });
  26665. }
  26666. }
  26667. },
  26668. ]
  26669. });
  26670. treeMenu.showAt(rect.left, rect.top - 120);
  26671. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26672. // grid.headerCt.getGridColumns()[i].autoSize(i);
  26673. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26674. // }
  26675. },
  26676. /**
  26677. * 获取表格编辑的行数据
  26678. */
  26679. getGridEditRows: function () {
  26680. var grid = this;
  26681. var store = grid.getStore();
  26682. var rows = [];
  26683. var modifyRows = [];
  26684. var newRows = [];
  26685. var err = "";
  26686. var records = store.getModifiedRecords();
  26687. var newRecords = store.getNewRecords();
  26688. var removeRecords = [];
  26689. _$2.forEach(store.getRemovedRecords(), function (row) {
  26690. removeRecords.push(row.data);
  26691. });
  26692. _$2.forEach(records, function (record) {
  26693. var colums = grid.columns;
  26694. var errFunc = undefined;
  26695. _$2.forEach(colums, function (col) {
  26696. var name = col.dataIndex;
  26697. var value = record.data[name];
  26698. var colIndex = col.getIndex(); //获得列号
  26699. var rowIndex = store.indexOfId(record.id); //获得行号
  26700. var editor = col.getEditor(); //使用的编辑器
  26701. var tmpErrFunc = function () {
  26702. var text = col.text || col.name;
  26703. msg(text + ' 校验失败, 请确保输入的数据正确');
  26704. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  26705. };
  26706. if (editor && !editor.allowBlank && isEmpty(value)) {
  26707. errFunc = tmpErrFunc;
  26708. return false;
  26709. }
  26710. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  26711. errFunc = tmpErrFunc;
  26712. return false;
  26713. }
  26714. });
  26715. if (typeof errFunc === 'function') {
  26716. err = "1";
  26717. _$2.remove(rows, function (n) {
  26718. return true;
  26719. });
  26720. //@ts-ignore
  26721. errFunc();
  26722. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  26723. return false;
  26724. }
  26725. else {
  26726. if (_$2.findIndex(newRecords, function (item) {
  26727. return item === record;
  26728. }) >= 0) {
  26729. newRows.push(record.data);
  26730. }
  26731. else {
  26732. modifyRows.push(record.data);
  26733. }
  26734. rows.push(record.data);
  26735. }
  26736. });
  26737. return {
  26738. rows: rows,
  26739. newRows: newRows,
  26740. modifyRows: modifyRows,
  26741. removeRecords: removeRecords,
  26742. err: err
  26743. };
  26744. }
  26745. // reload() {
  26746. // dataSourceReload(this)
  26747. // },
  26748. });
  26749. }
  26750. /**
  26751. * 获取 columns 中所有的 dataIndex
  26752. */
  26753. function getFileds(newConfig) {
  26754. var fields = [];
  26755. _$2.forEach(newConfig.columns, function (c) {
  26756. if (c.dataIndex) {
  26757. fields.push(c.dataIndex);
  26758. }
  26759. });
  26760. return fields;
  26761. }
  26762. function convertDataSource$1(sender, scope, newConfig) {
  26763. if (typeof newConfig.store !== 'undefined') {
  26764. // 有 store 属性的情况下,不做任何事
  26765. return;
  26766. }
  26767. if (typeof newConfig.dataSource === 'undefined') {
  26768. // 没有定义 dataSource 的情况下,不做任何事
  26769. return;
  26770. }
  26771. if (_$2.isArray(newConfig.data)) {
  26772. // 有 data 属性赋值的情况下
  26773. newConfig.store = {
  26774. fields: getFileds(newConfig),
  26775. data: newConfig.data
  26776. };
  26777. delete newConfig.data;
  26778. return;
  26779. }
  26780. var dataSource = newConfig.dataSource;
  26781. if (typeof dataSource === 'string') {
  26782. // dataSource 是字符串的情况下,找到成员函数
  26783. dataSource = lookupFn(scope, dataSource);
  26784. }
  26785. if (typeof dataSource === 'function') {
  26786. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  26787. newConfig.store = new Ext.data.Store({
  26788. fields: getFileds(newConfig),
  26789. // data: [],
  26790. autoLoad: true,
  26791. proxy: {
  26792. type: 'memory',
  26793. data: [],
  26794. }
  26795. });
  26796. newConfig.dataSourceCallbackFn = dataSource;
  26797. return;
  26798. }
  26799. // throw new TypeError('无法识别的调用方法')
  26800. }
  26801. //# sourceMappingURL=grid.js.map
  26802. function initTextfield () {
  26803. var cc = Ext.form.field.Text.prototype.constructor;
  26804. var initComponent = Ext.form.field.Text.prototype.initComponent;
  26805. Ext.form.field.Text.override({
  26806. constructor: function (config) {
  26807. var newConfig = _$2.defaultsDeep({
  26808. // 强制属性
  26809. triggers: {
  26810. clear: {
  26811. weight: -1,
  26812. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  26813. hidden: true,
  26814. handler: 'onClearClick',
  26815. },
  26816. }
  26817. }, baseConfig(config, 'col-item'), config, text);
  26818. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26819. newConfig.enableKeyEvents = true;
  26820. }
  26821. cc.call(this, newConfig);
  26822. },
  26823. /**
  26824. * 清空所有值
  26825. */
  26826. onClearClick: function (sender, e) {
  26827. var me = this;
  26828. me.setValue('');
  26829. },
  26830. /**
  26831. * 尝试获取下一个要获取焦点的控件
  26832. */
  26833. _raiseNextFocus: function (sender) {
  26834. var config = sender.config;
  26835. var scope = lookupScope(sender);
  26836. if (typeof config.nextFocus === 'function') {
  26837. config.nextFocus(sender);
  26838. }
  26839. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  26840. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  26841. var fn = lookupFn(scope, config.nextFocus);
  26842. if (typeof fn === 'function') {
  26843. var nextCtlReference = fn(sender);
  26844. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  26845. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  26846. if (ctl) {
  26847. if (typeof ctl.focus2 === 'function') {
  26848. ctl.focus2();
  26849. }
  26850. else {
  26851. ctl.focus();
  26852. }
  26853. }
  26854. }
  26855. }
  26856. }
  26857. else {
  26858. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  26859. if (ctl) {
  26860. if (typeof ctl.focus2 === 'function') {
  26861. ctl.focus2();
  26862. }
  26863. else {
  26864. ctl.focus();
  26865. }
  26866. }
  26867. }
  26868. }
  26869. },
  26870. initComponent: function () {
  26871. /**
  26872. * 改变必填项之前加星号
  26873. */
  26874. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  26875. // this.beforeLabelTextTpl = [
  26876. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26877. // ];
  26878. this.afterLabelTextTpl = [
  26879. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26880. ];
  26881. }
  26882. var me = this;
  26883. this.on({
  26884. change: function (sender, newVal) {
  26885. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  26886. if (hideTrigger || disabled || readOnly || hideClear) {
  26887. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  26888. return;
  26889. }
  26890. var value = newVal;
  26891. if (value) {
  26892. me.getTrigger('clear').show();
  26893. me.updateLayout();
  26894. }
  26895. else {
  26896. me.getTrigger('clear').hide();
  26897. me.updateLayout();
  26898. }
  26899. },
  26900. afterrender: function (sender) {
  26901. var _this = this;
  26902. var _a;
  26903. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  26904. sender.inputEl.dom.setAttribute('spellcheck', "false");
  26905. $$2(sender.inputEl.dom).on('click', function (e) {
  26906. sender.fireEvent('click', _this, e);
  26907. });
  26908. $$2(sender.inputEl.dom).on('keydown', function (e) {
  26909. var _a, _b, _c, _d;
  26910. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  26911. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  26912. if (sender.isExpanded === true) {
  26913. // 弹开下拉框的基础上,不干预上下选择
  26914. return;
  26915. }
  26916. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  26917. var grid = sender.ownerCt.up('grid');
  26918. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  26919. if (editingPlugin) {
  26920. 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;
  26921. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  26922. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  26923. // editingPlugin
  26924. var targetRecord = void 0;
  26925. if (e.code === 'ArrowDown') {
  26926. targetRecord = grid.store.data.getAt(rowIdx + 1);
  26927. }
  26928. else {
  26929. targetRecord = grid.store.data.getAt(rowIdx - 1);
  26930. }
  26931. if (targetRecord) {
  26932. grid.setSelection([targetRecord]);
  26933. editingPlugin.startEdit(targetRecord, column);
  26934. }
  26935. e.stopPropagation();
  26936. e.preventDefault();
  26937. }
  26938. }
  26939. }
  26940. }
  26941. });
  26942. }
  26943. var config = sender.config;
  26944. if (config.ff && config.ff > 0) {
  26945. setTimeout(function () {
  26946. if (typeof sender.focus2 === 'function') {
  26947. sender.focus2();
  26948. }
  26949. else {
  26950. sender.focus();
  26951. }
  26952. }, config.ff);
  26953. }
  26954. }
  26955. });
  26956. var config = this.config;
  26957. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26958. this.on({
  26959. keyup: function (sender, e) {
  26960. if ([10, 13, 20, 40].includes(e.keyCode)) {
  26961. sender._raiseNextFocus(sender);
  26962. }
  26963. }
  26964. });
  26965. }
  26966. var that = this;
  26967. this.on({
  26968. keyup: function (sender, e, eOpts) {
  26969. if (![10, 13, 20, 40].includes(e.keyCode)) {
  26970. return;
  26971. }
  26972. that.keydown_fun_item(sender, e, eOpts);
  26973. }
  26974. });
  26975. initComponent.call(this);
  26976. },
  26977. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  26978. var that = sender;
  26979. if ([10, 13, 20, 40].includes(event.keyCode)) {
  26980. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  26981. var value = _$2.trim(sender.rawValue);
  26982. var r = that.fireEvent('scancode', that, value, event);
  26983. if (r === 'OK') {
  26984. // 停止事件的默认处理程序,停止事件的冒泡
  26985. // event.stopEvent();
  26986. event.preventDefault();
  26987. event.stopPropagation();
  26988. }
  26989. }
  26990. }, 100)
  26991. });
  26992. }
  26993. //# sourceMappingURL=textfield.js.map
  26994. function initTbFill () {
  26995. /**
  26996. *
  26997. */
  26998. var ct = Ext.toolbar.Fill.prototype.constructor;
  26999. Ext.toolbar.Fill.override({
  27000. constructor: function (config) {
  27001. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  27002. ct.call(this, newConfig);
  27003. }
  27004. });
  27005. }
  27006. //# sourceMappingURL=tbfill.js.map
  27007. function initTbSeparator () {
  27008. /**
  27009. *
  27010. */
  27011. var ct = Ext.toolbar.Separator.prototype.constructor;
  27012. Ext.toolbar.Separator.override({
  27013. constructor: function (config) {
  27014. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  27015. ct.call(this, newConfig);
  27016. }
  27017. });
  27018. }
  27019. //# sourceMappingURL=tbseparator.js.map
  27020. function initToolbar () {
  27021. /**
  27022. *
  27023. */
  27024. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  27025. Ext.toolbar.Toolbar.override({
  27026. constructor: function (config) {
  27027. var newConfig = _$2.defaultsDeep({
  27028. // 强制性属性
  27029. }, baseConfig(config, 'cols-container'), config, toolbar);
  27030. ct.call(this, newConfig);
  27031. }
  27032. });
  27033. initTbFill();
  27034. initTbSeparator();
  27035. }
  27036. //# sourceMappingURL=toolbar.js.map
  27037. function initSplitter () {
  27038. var ct = Ext.resizer.Splitter.prototype.constructor;
  27039. Ext.resizer.Splitter.override({
  27040. constructor: function (config) {
  27041. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  27042. ct.call(this, newConfig);
  27043. }
  27044. });
  27045. }
  27046. //# sourceMappingURL=splitter.js.map
  27047. /**
  27048. * 通用 dataSource 解析,
  27049. * Tree/Combo/Grid/PageList ... 都会从这里解析
  27050. */
  27051. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  27052. var config = ctl.config;
  27053. return new Promise(function (resolve, reject) {
  27054. if (!config.dataSource) {
  27055. // 没有设置数据源,直接置空
  27056. return Promise.resolve();
  27057. }
  27058. var option = {
  27059. extraParam: extraParam,
  27060. _successCb: _successCb,
  27061. successCallback: function (value) {
  27062. if (typeof successCallback === "function") {
  27063. successCallback(value);
  27064. }
  27065. else {
  27066. ctl.setData(value);
  27067. }
  27068. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  27069. ctl.setLoading(false);
  27070. resolve(value);
  27071. },
  27072. failCallback: function (error) {
  27073. if (typeof failCallback === "function") {
  27074. failCallback(error);
  27075. }
  27076. ctl.fireEvent('dataLoadComplete', ctl, false);
  27077. ctl.setLoading(false);
  27078. reject(error);
  27079. }
  27080. };
  27081. // 请求前要求确认一下
  27082. var isCanceled = false;
  27083. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  27084. isCanceled = true;
  27085. } }, option));
  27086. if (!isCanceled) {
  27087. // 请求没有被取消
  27088. // 调用异步接口返回 Promise
  27089. return _innerReload(ctl, option);
  27090. }
  27091. return reject();
  27092. });
  27093. }
  27094. function _innerReload(ctl, option) {
  27095. var config = ctl.config;
  27096. ctl.setLoading(true);
  27097. var scope = lookupScope(ctl);
  27098. var dataSource = config.dataSource;
  27099. if (typeof dataSource == 'string') {
  27100. dataSource = lookupFn(scope, config.dataSource);
  27101. }
  27102. if (typeof dataSource === 'function') {
  27103. // @ts-ignore
  27104. dataSource.call(scope, ctl, option);
  27105. return;
  27106. }
  27107. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27108. if (!ajax.func) {
  27109. console.error("没有配置 ajax");
  27110. return;
  27111. }
  27112. var params_1 = {};
  27113. var sortModel = null;
  27114. var filterModel = null;
  27115. if (option.extraParam && option.extraParam.filterModel) {
  27116. filterModel = option.extraParam.filterModel;
  27117. }
  27118. if (option.extraParam && option.extraParam.sortModel) {
  27119. sortModel = option.extraParam.sortModel;
  27120. }
  27121. _$2.forOwn(option.extraParam, function (v, key) {
  27122. if (key != "filterModel" && key != "sortModel") {
  27123. if (typeof v === 'function') {
  27124. params_1[key] = v();
  27125. }
  27126. else {
  27127. params_1[key] = v;
  27128. }
  27129. }
  27130. });
  27131. var ds = dataSource;
  27132. _$2.forOwn(ds.params, function (v, key) {
  27133. if (typeof v === 'function') {
  27134. params_1[key] = v();
  27135. }
  27136. else {
  27137. params_1[key] = v;
  27138. }
  27139. });
  27140. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  27141. // @ts-ignore
  27142. ajax.func({
  27143. method: dataSource.method,
  27144. url: ds.url,
  27145. data: params_1,
  27146. filterModel: filterModel,
  27147. sortModel: sortModel,
  27148. }).then(function (res) {
  27149. if (res.success) {
  27150. option.successCallback(res.data);
  27151. }
  27152. else {
  27153. option.failCallback(res.msg);
  27154. }
  27155. }).catch(function (e) {
  27156. option.failCallback(e);
  27157. });
  27158. }
  27159. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27160. var ds_1 = ctl.dataSource;
  27161. // @ts-ignore
  27162. Extend.ajax.func({
  27163. url: ds_1.sqlId,
  27164. data: params_1,
  27165. db: ds_1.db,
  27166. method: 'sql',
  27167. filterModel: filterModel,
  27168. sortModel: sortModel,
  27169. }).then(function (res) {
  27170. if (res.success) {
  27171. option.successCallback(res.data);
  27172. }
  27173. else {
  27174. option.failCallback(res.msg);
  27175. }
  27176. }).catch(function (e) {
  27177. option.failCallback(e);
  27178. }).finally(function () {
  27179. ctl.loading = false;
  27180. });
  27181. return;
  27182. }
  27183. else {
  27184. console.error("非法的 dataSource", ctl.dataSource);
  27185. debugger;
  27186. throw new Error("非法的 dataSource");
  27187. }
  27188. }
  27189. }
  27190. //# sourceMappingURL=DataSourceHelper.js.map
  27191. function initCombo () {
  27192. var cc = Ext.form.field.ComboBox.prototype.constructor;
  27193. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27194. Ext.form.field.ComboBox.override({
  27195. constructor: function (config) {
  27196. var newConfig = _$2.defaultsDeep({
  27197. // 强制性属性
  27198. }, baseConfig(config, 'col-item'), config, combo);
  27199. if (typeof config.dict === 'string') {
  27200. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27201. }
  27202. else if (typeof newConfig.store == 'undefined') {
  27203. if (_$2.isArray(newConfig.data)) {
  27204. // ExtJS 无法直接接受数组模式
  27205. newConfig.store = {
  27206. fields: [newConfig.valueField, newConfig.displayField],
  27207. data: newConfig.data
  27208. };
  27209. delete newConfig.data;
  27210. }
  27211. else if (typeof newConfig.data !== 'object') {
  27212. newConfig.store = {
  27213. fields: [newConfig.valueField, newConfig.displayField],
  27214. data: []
  27215. };
  27216. delete newConfig.data;
  27217. }
  27218. }
  27219. cc.call(this, newConfig);
  27220. },
  27221. setDict: function (bizKey) {
  27222. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27223. this.dict = bizKey;
  27224. },
  27225. getDict: function () {
  27226. return this.dict;
  27227. },
  27228. setData: function (value) {
  27229. if (!value) {
  27230. return;
  27231. }
  27232. var config = value.config;
  27233. if (!this.store) {
  27234. this.store = new Ext.data.Store({
  27235. fields: [config.valueField, config.displayField],
  27236. data: value
  27237. });
  27238. }
  27239. else {
  27240. this.store.getProxy().setData(value);
  27241. this.store.load();
  27242. }
  27243. },
  27244. setLoading: function (value) {
  27245. if (value) {
  27246. if (!this.loadMask) {
  27247. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27248. }
  27249. }
  27250. else {
  27251. if (this.loadMask) {
  27252. this.loadMask.destroy();
  27253. delete this.loadMask;
  27254. }
  27255. }
  27256. },
  27257. reload: function () {
  27258. dataSourceReload(this);
  27259. },
  27260. initComponent: function () {
  27261. var that = this;
  27262. var toggle = function (e) {
  27263. var readOnly = that.readOnly, disabled = that.disabled;
  27264. if (readOnly || disabled) {
  27265. return;
  27266. }
  27267. if ($(e.target).is('.x-form-trigger')) {
  27268. return;
  27269. }
  27270. // 点击后下拉
  27271. if (that.isExpanded) {
  27272. that.collapse();
  27273. }
  27274. else {
  27275. that.expand();
  27276. that.doQuery(that.allQuery, true);
  27277. }
  27278. };
  27279. this.on({
  27280. afterrender: function (sender) {
  27281. var config = this.config;
  27282. if (config.dataSource && config.autoLoad) {
  27283. dataSourceReload(this);
  27284. }
  27285. // 点击后下拉
  27286. $(this.el.dom).on('click', toggle.bind(this));
  27287. },
  27288. focusenter: function (sender, event, opt) {
  27289. var _a;
  27290. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27291. // 表格内编辑框,获取焦点后自动弹开
  27292. toggle.call(this, event);
  27293. }
  27294. },
  27295. destory: function () {
  27296. $(this.el.dom).off('click', toggle.bind(this));
  27297. },
  27298. beforequery: function (context) {
  27299. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  27300. // console.log('beforequery', query)
  27301. if (!forceAll && query) {
  27302. combo.store.clearFilter();
  27303. combo.store.filterBy(function (record, id) {
  27304. var text = record.get(combo.displayField);
  27305. // 用拼音筛选的方式
  27306. return keywordFilter(query, text, id);
  27307. });
  27308. combo.expand();
  27309. return false;
  27310. }
  27311. combo.store.clearFilter();
  27312. combo.expand();
  27313. return false;
  27314. },
  27315. });
  27316. initComponent.call(this);
  27317. },
  27318. focus2: function () {
  27319. this.focus();
  27320. var that = this;
  27321. _$2.defer(function () {
  27322. if (that.isExpanded) {
  27323. that.collapse();
  27324. }
  27325. else {
  27326. that.expand();
  27327. that.doQuery(that.allQuery, true);
  27328. }
  27329. });
  27330. }
  27331. });
  27332. }
  27333. //# sourceMappingURL=combo.js.map
  27334. /**
  27335. xtype: 'tagfield',
  27336. displayField: 'show',
  27337. valueField: 'id',
  27338. queryMode: 'local',
  27339. filterPickList: true,
  27340. store: {
  27341. fields: ['id', 'show'],
  27342. data: [
  27343. {id: 0, show: 'Battlestar Galactica'},
  27344. {id: 1, show: 'Doctor Who'},
  27345. {id: 2, show: 'Farscape'},
  27346. {id: 3, show: 'Firefly'},
  27347. {id: 4, show: 'Star Trek'},
  27348. {id: 5, show: 'Star Wars: Christmas Special'}
  27349. ]
  27350. }
  27351. */
  27352. function initTag () {
  27353. var cc = Ext.form.field.Tag.prototype.constructor;
  27354. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27355. Ext.form.field.Tag.override({
  27356. constructor: function (config) {
  27357. var newConfig = _$2.defaultsDeep({
  27358. // 强制性属性
  27359. }, baseConfig(config, 'col-item'), config, tagfield);
  27360. if (typeof config.dict === 'string') {
  27361. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27362. }
  27363. else if (typeof newConfig.store == 'undefined') {
  27364. if (_$2.isArray(newConfig.data)) {
  27365. // ExtJS 无法直接接受数组模式
  27366. newConfig.store = {
  27367. fields: [newConfig.valueField, newConfig.displayField],
  27368. data: newConfig.data
  27369. };
  27370. delete newConfig.data;
  27371. }
  27372. else if (typeof newConfig.data !== 'object') {
  27373. newConfig.store = {
  27374. fields: [newConfig.valueField, newConfig.displayField],
  27375. data: []
  27376. };
  27377. delete newConfig.data;
  27378. }
  27379. }
  27380. cc.call(this, newConfig);
  27381. },
  27382. setDict: function (bizKey) {
  27383. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27384. this.dict = bizKey;
  27385. },
  27386. getDict: function () {
  27387. return this.dict;
  27388. },
  27389. setData: function (value) {
  27390. if (!value) {
  27391. return;
  27392. }
  27393. var config = value.config;
  27394. if (!this.store) {
  27395. this.store = new Ext.data.Store({
  27396. fields: [config.valueField, config.displayField],
  27397. data: value
  27398. });
  27399. }
  27400. else {
  27401. this.store.getProxy().setData(value);
  27402. this.store.load();
  27403. }
  27404. },
  27405. setLoading: function (value) {
  27406. if (value) {
  27407. if (!this.loadMask) {
  27408. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27409. }
  27410. }
  27411. else {
  27412. if (this.loadMask) {
  27413. this.loadMask.destroy();
  27414. delete this.loadMask;
  27415. }
  27416. }
  27417. },
  27418. reload: function () {
  27419. dataSourceReload(this);
  27420. },
  27421. initComponent: function () {
  27422. var that = this;
  27423. var toggle = function (e) {
  27424. var readOnly = that.readOnly, disabled = that.disabled;
  27425. if (readOnly || disabled) {
  27426. return;
  27427. }
  27428. if ($(e.target).is('.x-form-trigger')) {
  27429. return;
  27430. }
  27431. // 点击后下拉
  27432. if (that.isExpanded) {
  27433. that.collapse();
  27434. }
  27435. else {
  27436. that.expand();
  27437. that.doQuery(that.allQuery, true);
  27438. }
  27439. };
  27440. this.on({
  27441. afterrender: function (sender) {
  27442. var config = this.config;
  27443. if (config.dataSource && config.autoLoad) {
  27444. dataSourceReload(this);
  27445. }
  27446. // 点击后下拉
  27447. $(this.el.dom).on('click', toggle.bind(this));
  27448. },
  27449. focusenter: function (sender, event, opt) {
  27450. var _a;
  27451. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27452. // 表格内编辑框,获取焦点后自动弹开
  27453. toggle.call(this, event);
  27454. }
  27455. },
  27456. destory: function () {
  27457. $(this.el.dom).off('click', toggle.bind(this));
  27458. },
  27459. });
  27460. initComponent.call(this);
  27461. },
  27462. focus2: function () {
  27463. this.focus();
  27464. var that = this;
  27465. _$2.defer(function () {
  27466. if (that.isExpanded) {
  27467. that.collapse();
  27468. }
  27469. else {
  27470. that.expand();
  27471. that.doQuery(that.allQuery, true);
  27472. }
  27473. });
  27474. }
  27475. });
  27476. }
  27477. //# sourceMappingURL=tagfield.js.map
  27478. function initComboGridMulti () {
  27479. Ext.define('Yvan.LocalComboGrid', {
  27480. extend: 'Ext.form.field.Picker',
  27481. // extend: 'Yvan.PickerAlignCenter',
  27482. xtype: 'combogridmulti',
  27483. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  27484. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  27485. editable: false,
  27486. initComponent: function () {
  27487. this.on({
  27488. afterrender: function () {
  27489. var config = this.config;
  27490. if (config.dataSource && config.autoLoad) {
  27491. dataSourceReload(this);
  27492. }
  27493. },
  27494. });
  27495. this.superclass.initComponent.apply(this, arguments);
  27496. },
  27497. setStore: function (store) {
  27498. this.store = store;
  27499. var me = this;
  27500. if (me.store) {
  27501. if (me.picker) {
  27502. me.picker.setStore(store);
  27503. if (me.isExpanded) {
  27504. me.collapse();
  27505. delete me.picker;
  27506. me.expand();
  27507. }
  27508. }
  27509. this.onLoad();
  27510. me.mon(me.store, {
  27511. scope: me,
  27512. load: me.onLoad,
  27513. update: me.onUpdate
  27514. });
  27515. }
  27516. },
  27517. reload: function () {
  27518. dataSourceReload(this);
  27519. },
  27520. setData: function (value) {
  27521. var me = this;
  27522. var config = me.config;
  27523. if (!value) {
  27524. return;
  27525. }
  27526. if (!this.store) {
  27527. this.store = new Ext.data.Store({
  27528. fields: [config.valueField, config.displayField],
  27529. data: value
  27530. });
  27531. }
  27532. else {
  27533. this.store.getProxy().setData(value);
  27534. this.store.load();
  27535. }
  27536. this.onLoad();
  27537. },
  27538. createPicker: function () {
  27539. var me = this;
  27540. 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: {
  27541. scope: me,
  27542. selectionchange: me.onSelectionChange,
  27543. itemkeydown: me.onPickerKeyDown
  27544. } })), view = picker.getView();
  27545. if (Ext.isIE9 && Ext.isStrict) {
  27546. view.on({
  27547. scope: me,
  27548. highlightitem: me.repaintPickerView,
  27549. unhighlightitem: me.repaintPickerView,
  27550. afteritemexpand: me.repaintPickerView,
  27551. afteritemcollapse: me.repaintPickerView
  27552. });
  27553. }
  27554. return picker;
  27555. },
  27556. repaintPickerView: function () {
  27557. var style = this.picker.getView().getEl().dom.style;
  27558. style.display = style.display;
  27559. },
  27560. onSelectionChange: function (view, record, node, rowIndex, e) {
  27561. this.selectItem(view, record);
  27562. },
  27563. onPickerKeyDown: function (treeView, record, item, index, e) {
  27564. var key = e.getKey();
  27565. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  27566. this.selectItem(treeView, record);
  27567. }
  27568. },
  27569. selectItem: function (sender, record) {
  27570. var me = this;
  27571. var ids = [];
  27572. _$2.forEach(me.picker.getSelection(), function (record) {
  27573. ids.push(record.get(me.valueField));
  27574. });
  27575. me.fireEvent('select', me, record);
  27576. me.setValue(ids.join(me.splitChar));
  27577. // me.collapse();
  27578. },
  27579. onExpand: function () {
  27580. var me = this;
  27581. var picker = this.picker;
  27582. var value = this.value;
  27583. if (!me.store) {
  27584. msg('正在初始化数据,请稍后');
  27585. me.collapse();
  27586. return;
  27587. }
  27588. var vs = _$2.split(value, me.splitChar);
  27589. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  27590. picker.setSelection(records);
  27591. },
  27592. setValue: function (value) {
  27593. var me = this;
  27594. console.log('setValue', value);
  27595. me.value = value;
  27596. if (!me.store || me.store.loading) {
  27597. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  27598. return me.mixins.field.setValue.call(me, value);
  27599. // return me;
  27600. }
  27601. var vs = _$2.split(value, me.splitChar);
  27602. var displayValues = [];
  27603. _$2.forEach(vs, function (v) {
  27604. var _a;
  27605. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  27606. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  27607. if (dv) {
  27608. displayValues.push(dv);
  27609. }
  27610. else {
  27611. displayValues.push(v);
  27612. }
  27613. });
  27614. // set the raw value to the record's display field if a record was found
  27615. me.setRawValue(displayValues.join(me.splitChar));
  27616. return me.mixins.field.setValue.call(me, value);
  27617. },
  27618. getSubmitValue: function () {
  27619. return this.value;
  27620. },
  27621. getValue: function () {
  27622. return this.value;
  27623. },
  27624. onLoad: function () {
  27625. var value = this.value;
  27626. if (value) {
  27627. this.setValue(value);
  27628. }
  27629. },
  27630. onUpdate: function (store, rec, type, modifiedFieldNames) {
  27631. var display = this.displayField;
  27632. var me = this;
  27633. if (type === 'edit' && modifiedFieldNames &&
  27634. Ext.Array.contains(modifiedFieldNames, display) &&
  27635. this.value === rec.getId()) {
  27636. me.mixins.field.setValue.call(me, this.value);
  27637. this.setRawValue(rec.get(display));
  27638. }
  27639. }
  27640. });
  27641. }
  27642. //# sourceMappingURL=combogridmulti.js.map
  27643. function initSearch () {
  27644. Ext.define('Yvan.Search', {
  27645. extend: 'Ext.form.field.Text',
  27646. alias: 'widget.searchfield',
  27647. xtype: 'searchfield',
  27648. constructor: function (config) {
  27649. var self = this;
  27650. var newConfig = _$2.defaultsDeep({
  27651. // 强制性属性
  27652. triggers: {
  27653. clear: {
  27654. weight: 0,
  27655. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27656. hidden: true,
  27657. handler: 'onClearClick',
  27658. },
  27659. search: {
  27660. weight: 1,
  27661. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  27662. handler: 'onSearchClick'
  27663. },
  27664. },
  27665. listeners: {
  27666. blur: function (sender, e) {
  27667. this.revertOnblur();
  27668. },
  27669. specialkey: function (sender, e) {
  27670. var _a;
  27671. var me = this;
  27672. if (e.getKey() === e.ENTER) {
  27673. me.onSearchClick(sender, {}, e);
  27674. return;
  27675. }
  27676. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27677. },
  27678. afterrender: function (sender, e) {
  27679. var _a;
  27680. this.replaceRawInputEvent();
  27681. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27682. }
  27683. },
  27684. }, baseConfig(config, 'col-item'), config, search);
  27685. this.superclass.constructor.call(self, newConfig);
  27686. },
  27687. revertOnblur: function () {
  27688. this.setRawValue(this.lastValue);
  27689. },
  27690. onSearchClick: function (sender, vv, e) {
  27691. var me = this;
  27692. var config = me.config;
  27693. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  27694. if (e) {
  27695. e.preventDefault();
  27696. e.stopPropagation();
  27697. }
  27698. this.fireEvent('search', sender, e);
  27699. if (!widget) {
  27700. return;
  27701. }
  27702. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  27703. },
  27704. replaceRawInputEvent: function () {
  27705. var me = this;
  27706. var $dom = $(me.inputEl.dom);
  27707. $dom.on('input', function (e) {
  27708. stopEvent(e);
  27709. // console.log('has input', e)
  27710. });
  27711. $dom.on('keyup', function (e) {
  27712. if (e.key === "Enter") {
  27713. me.onSearchClick(me, {}, e);
  27714. return;
  27715. }
  27716. stopEvent(e);
  27717. });
  27718. $dom.on('change', function (e) {
  27719. stopEvent(e);
  27720. });
  27721. },
  27722. onChange: function (newVal, oldVal) {
  27723. var me = this;
  27724. var value = newVal;
  27725. if (value) {
  27726. me.getTrigger('clear').show();
  27727. me.updateLayout();
  27728. }
  27729. else {
  27730. me.getTrigger('clear').hide();
  27731. me.updateLayout();
  27732. }
  27733. },
  27734. /**
  27735. * 清空所有值
  27736. */
  27737. onClearClick: function (sender, e) {
  27738. var me = this;
  27739. var config = me.config;
  27740. var lookup = config.lookup;
  27741. me.setValue('');
  27742. clearViewModelByLookup(sender, lookup);
  27743. }
  27744. });
  27745. }
  27746. //# sourceMappingURL=search.js.map
  27747. function initMultipleSearch () {
  27748. Ext.define('Yvan.MultipleSearch', {
  27749. extend: 'Ext.form.field.Text',
  27750. xtype: 'multiplesearch',
  27751. bindTargert: '',
  27752. constructor: function (config) {
  27753. var _a, _b, _c, _d;
  27754. var self = this;
  27755. var newConfig = _$2.defaultsDeep({
  27756. // 强制性属性
  27757. triggers: {
  27758. clear: {
  27759. weight: 0,
  27760. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27761. hidden: true,
  27762. handler: 'onClearClick',
  27763. }
  27764. },
  27765. transformRawValue: function (o) {
  27766. return o;
  27767. },
  27768. listeners: {
  27769. specialkey: function (sender, e) {
  27770. var me = this;
  27771. if (e.getKey() === e.ENTER) {
  27772. me.fireEvent('search', me, e);
  27773. }
  27774. },
  27775. afterrender: function (sender, e) {
  27776. var _a;
  27777. this.replaceRawInputEvent();
  27778. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27779. }
  27780. },
  27781. }, baseConfig(config, 'col-item'), config, search);
  27782. this.superclass.constructor.call(self, newConfig);
  27783. 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 : '';
  27784. vv = _$2.replace(vv, "{", "");
  27785. vv = _$2.replace(vv, "}", "");
  27786. this.bindTargert = vv;
  27787. this.bindTargert = _$2.trim(this.bindTargert);
  27788. },
  27789. setBindValue: function (arrValue) {
  27790. if (this.bindTargert) {
  27791. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  27792. }
  27793. },
  27794. replaceRawInputEvent: function () {
  27795. var me = this;
  27796. var $dom = $(me.inputEl.dom);
  27797. $dom.on('input', function (e) {
  27798. var _a, _b, _c, _d, _e, _f;
  27799. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  27800. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  27801. if (!a.endsWith(",") && a.length > 0) {
  27802. e.currentTarget.value = a + ",";
  27803. }
  27804. else {
  27805. e.currentTarget.value = a;
  27806. }
  27807. }
  27808. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  27809. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  27810. _$2.remove(arr, function (it) {
  27811. return !it;
  27812. });
  27813. me.setBindValue(arr);
  27814. stopEvent(e);
  27815. });
  27816. $dom.on('keyup', function (e) {
  27817. me.fireEvent('keyup', me, e);
  27818. // invokeMethod(me.config.listeners?.keyup, me, e)
  27819. stopEvent(e);
  27820. });
  27821. $dom.on('keydown', function (e) {
  27822. me.fireEvent('keydown', me, e);
  27823. // invokeMethod(me.config.listeners?.keydown, me, e)
  27824. //stopEvent(e)
  27825. });
  27826. $dom.on('change', function (e) {
  27827. stopEvent(e);
  27828. });
  27829. $dom.on('paste', function (e) {
  27830. var _a;
  27831. // @ts-ignore
  27832. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  27833. var text = clipdata.getData("text/plain");
  27834. var spliter = ',';
  27835. text = text.replaceAll("\r", "");
  27836. text = text.replaceAll("\n", spliter);
  27837. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  27838. var arr = text.split(spliter);
  27839. if (arr && Array.isArray(arr)) {
  27840. for (var i = 0; i < arr.length; i++) {
  27841. arr[i] = _$2.trim(arr[i]);
  27842. }
  27843. }
  27844. _$2.remove(arr, function (it) {
  27845. return !it;
  27846. });
  27847. me.setBindValue(arr);
  27848. stopEvent(e);
  27849. });
  27850. },
  27851. onChange: function (newVal, oldVal) {
  27852. var me = this;
  27853. var value = newVal;
  27854. if (value) {
  27855. me.getTrigger('clear').show();
  27856. me.updateLayout();
  27857. }
  27858. else {
  27859. me.getTrigger('clear').hide();
  27860. me.updateLayout();
  27861. }
  27862. },
  27863. /**
  27864. * 清空所有值
  27865. */
  27866. onClearClick: function (sender, e) {
  27867. var me = this;
  27868. var config = me.config;
  27869. var lookup = config.lookup;
  27870. me.setValue('');
  27871. clearViewModelByLookup(sender, lookup);
  27872. }
  27873. });
  27874. }
  27875. //# sourceMappingURL=multiplesearch.js.map
  27876. function initDate () {
  27877. var cc = Ext.form.field.Date.prototype.constructor;
  27878. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  27879. Ext.form.field.Date.override({
  27880. format: 'Y-m-d',
  27881. altFormats: 'Y-m-d',
  27882. constructor: function (config) {
  27883. var newConfig = _$2.defaultsDeep({
  27884. // 强制属性
  27885. }, baseConfig(config, 'col-item'), config, date);
  27886. cc.call(this, newConfig);
  27887. },
  27888. getValue: function () {
  27889. var ov = getValue.call(this);
  27890. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  27891. // console.log('cc:', nv, ov)
  27892. return nv;
  27893. },
  27894. // focus2() {
  27895. // const that = this
  27896. // if (that.isExpanded) {
  27897. // that.collapse()
  27898. //
  27899. // } else {
  27900. // that.expand();
  27901. // }
  27902. // _.defer(() => {
  27903. // that.focus()
  27904. // })
  27905. // },
  27906. initComponent: function () {
  27907. this.on({
  27908. afterrender: function () {
  27909. var config = this.config;
  27910. // 日期框,不要默认弹出
  27911. // $(this.el.dom).on('click', toggle.bind(this))
  27912. },
  27913. destory: function () {
  27914. // 日期框,不要默认弹出
  27915. // $(this.el.dom).off('click', toggle.bind(this))
  27916. },
  27917. change: {
  27918. fn: function (sender) {
  27919. if (sender.format === 'Y-m-d') {
  27920. // 年月日格式
  27921. var value = sender.getRawValue();
  27922. if (/^\d{8}$/.test(value)) {
  27923. // 8位数字,自动转换为 YYYY-MM-DD
  27924. var newValue = [
  27925. value.substr(0, 4),
  27926. value.substr(4, 2),
  27927. value.substr(6, 2)
  27928. ].join('-');
  27929. sender.setValue(newValue);
  27930. }
  27931. }
  27932. },
  27933. }
  27934. // focus: {
  27935. // // 获得焦点后自动下拉
  27936. // fn(sender) {
  27937. // sender.expand();
  27938. // this.doQuery(this.allQuery, true);
  27939. // },
  27940. // },
  27941. });
  27942. initComponent.call(this);
  27943. },
  27944. createInitialDate: function (value) {
  27945. var minValue = this.minValue, maxValue = this.maxValue;
  27946. value = value || syncDate(new Date());
  27947. if (minValue && minValue > value) {
  27948. value = minValue;
  27949. }
  27950. else if (maxValue && maxValue < value) {
  27951. value = maxValue;
  27952. }
  27953. return value;
  27954. },
  27955. });
  27956. }
  27957. //# sourceMappingURL=datefield.js.map
  27958. function initDateTimePicker () {
  27959. Ext.define('Yvan.DateTimePicker', {
  27960. extend: 'Ext.picker.Date',
  27961. alias: 'datetimepicker',
  27962. alternateClassName: 'Ext.DateTimePicker',
  27963. renderTpl: [
  27964. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  27965. '<div class="{baseCls}-header">',
  27966. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  27967. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  27968. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  27969. '</div>',
  27970. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  27971. '<thead>',
  27972. '<tr role="row">',
  27973. '<tpl for="dayNames">',
  27974. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  27975. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  27976. '</th>',
  27977. '</tpl>',
  27978. '</tr>',
  27979. '</thead>',
  27980. '<tbody>',
  27981. '<tr role="row">',
  27982. '<tpl for="days">',
  27983. '{#:this.isEndOfWeek}',
  27984. '<td role="gridcell">',
  27985. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  27986. '</td>',
  27987. '</tpl>',
  27988. '</tr>',
  27989. '</tbody>',
  27990. '</table>',
  27991. '<tpl if="showToday">',
  27992. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  27993. '</tpl>',
  27994. // These elements are used with Assistive Technologies such as screen readers
  27995. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  27996. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  27997. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  27998. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  27999. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  28000. '</div>',
  28001. {
  28002. firstInitial: function (value) {
  28003. return Ext.picker.Date.prototype.getDayInitial(value);
  28004. },
  28005. isEndOfWeek: function (value) {
  28006. // convert from 1 based index to 0 based
  28007. // by decrementing value once.
  28008. value--;
  28009. // eslint-disable-next-line vars-on-top
  28010. var end = value % 7 === 0 && value !== 0;
  28011. return end ? '</tr><tr role="row">' : '';
  28012. },
  28013. renderTodayBtn: function (values, out) {
  28014. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  28015. },
  28016. renderMonthBtn: function (values, out) {
  28017. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  28018. }
  28019. }
  28020. ],
  28021. beforeRender: function () {
  28022. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  28023. this.superclass.beforeRender.call(this);
  28024. function handleInput(extHandle, $input) {
  28025. var $dom = $(extHandle.el.dom);
  28026. // const $up = $dom.find('.x-form-spinner-up')
  28027. // const $down = $dom.find('.x-form-spinner-down')
  28028. // debugger
  28029. // $up.on('mousedown', () => {
  28030. // debugger
  28031. // });
  28032. // $up.on('click', () => {
  28033. // debugger
  28034. // });
  28035. extHandle.on('click', function (sender) {
  28036. var hideBak = me.hide;
  28037. me.hide = Ext.emptyFn;
  28038. extHandle.focus();
  28039. me.hide = hideBak;
  28040. });
  28041. var changeValue = function (delta) {
  28042. if (_$2.trim(extHandle.getValue()) === '') {
  28043. extHandle.setValue(extHandle.minValue);
  28044. }
  28045. else {
  28046. var v = parseInt('' + extHandle.getValue());
  28047. if (v + delta > extHandle.maxValue) {
  28048. extHandle.setValue(extHandle.minValue);
  28049. }
  28050. else if (v + delta < extHandle.minValue) {
  28051. extHandle.setValue(extHandle.maxValue);
  28052. }
  28053. else {
  28054. extHandle.setValue(v + delta);
  28055. }
  28056. }
  28057. };
  28058. $input.on('mousewheel', function (e) {
  28059. e.stopPropagation();
  28060. var event = e.originalEvent;
  28061. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  28062. // if (event.wheelDelta) {
  28063. // delta = event.wheelDelta / 120;
  28064. // } else if (event.detail) {
  28065. // delta = -event.detail / 3;
  28066. // }
  28067. var zoomSize = Math.ceil(eventDelta / 120);
  28068. changeValue(zoomSize);
  28069. // console.log('delta', delta)
  28070. // $input.focus()
  28071. });
  28072. }
  28073. me.input1 = Ext.create('Ext.form.field.Number', {
  28074. minValue: 0,
  28075. maxValue: 23,
  28076. flex: 1,
  28077. enableKeyEvents: true,
  28078. fieldLabel: '时',
  28079. labelWidth: 20,
  28080. hideLabel: true,
  28081. spinDownEnabled: false,
  28082. spinUpEnabled: false,
  28083. style: {
  28084. marginLeft: '5px',
  28085. },
  28086. listeners: {
  28087. afterrender: function (sender) {
  28088. var $input = $(sender.inputEl.dom);
  28089. handleInput(me.input1, $input);
  28090. },
  28091. change: function (sender, e) {
  28092. if (me.getValue()) {
  28093. me.value.setHours(sender.getValue());
  28094. }
  28095. },
  28096. }
  28097. });
  28098. me.input2 = Ext.create('Ext.form.field.Number', {
  28099. minValue: 0,
  28100. maxValue: 59,
  28101. flex: 1,
  28102. enableKeyEvents: true,
  28103. fieldLabel: ' ',
  28104. hideLabel: false,
  28105. labelWidth: 8,
  28106. spinDownEnabled: false,
  28107. spinUpEnabled: false,
  28108. listeners: {
  28109. afterrender: function (sender) {
  28110. var $input = $(sender.inputEl.dom);
  28111. handleInput(me.input2, $input);
  28112. },
  28113. change: function (sender, e) {
  28114. if (me.getValue()) {
  28115. me.value.setMinutes(sender.getValue());
  28116. }
  28117. },
  28118. }
  28119. });
  28120. me.input3 = Ext.create('Ext.form.field.Number', {
  28121. minValue: 0,
  28122. maxValue: 59,
  28123. flex: 1,
  28124. enableKeyEvents: true,
  28125. fieldLabel: ' ',
  28126. hideLabel: false,
  28127. labelWidth: 8,
  28128. spinDownEnabled: false,
  28129. spinUpEnabled: false,
  28130. style: {
  28131. marginRight: '5px',
  28132. },
  28133. listeners: {
  28134. afterrender: function (sender) {
  28135. var $input = $(sender.inputEl.dom);
  28136. handleInput(me.input3, $input);
  28137. },
  28138. change: function (sender, e) {
  28139. if (me.getValue()) {
  28140. me.value.setSeconds(sender.getValue());
  28141. }
  28142. },
  28143. }
  28144. });
  28145. me.confirmBtn = new Ext.button.Button({
  28146. text: '确认',
  28147. handler: me.confirmClick,
  28148. scope: me
  28149. });
  28150. me.tdBtn = new Ext.button.Button({
  28151. text: '现在',
  28152. handler: me.selectToday,
  28153. scope: me
  28154. });
  28155. me.todayBtn = Ext.create('Ext.container.Container', {
  28156. layout: 'anchor', border: false,
  28157. defaults: {
  28158. border: false, anchor: '100%',
  28159. margin: '0 0 5 0',
  28160. },
  28161. items: [
  28162. {
  28163. layout: 'hbox',
  28164. items: [
  28165. me.input1,
  28166. me.input2,
  28167. me.input3,
  28168. ]
  28169. },
  28170. {
  28171. layout: 'hbox',
  28172. items: [
  28173. me.confirmBtn,
  28174. me.tdBtn,
  28175. ]
  28176. }
  28177. ]
  28178. });
  28179. },
  28180. // finishRenderChildren() {
  28181. // var me = this;
  28182. //
  28183. // this.superclass.finishRenderChildren.call(this);
  28184. // //*
  28185. // me.input1.finishRender();
  28186. // me.input2.finishRender();
  28187. // me.input3.finishRender();
  28188. // //
  28189. // me.tdBtn.finishRender();
  28190. // me.confirmBtn.finishRender();
  28191. // },
  28192. setValue: function (value) {
  28193. //this.value = Ext.Date.clearTime(value, true);
  28194. this.value = value;
  28195. this.input1.setValue(this.value.getHours());
  28196. this.input2.setValue(this.value.getMinutes());
  28197. this.input3.setValue(this.value.getSeconds());
  28198. return this.update(this.value);
  28199. },
  28200. selectDate: function (value) {
  28201. if (this.showTime) {
  28202. value.setHours(this.input1.getValue());
  28203. value.setMinutes(this.input2.getValue());
  28204. value.setSeconds(this.input3.getValue());
  28205. }
  28206. this.value = value;
  28207. return this.update(this.value);
  28208. },
  28209. setDisabledStatus: function (disabled) {
  28210. var me = this;
  28211. debugger;
  28212. // me.callParent();
  28213. if (me.showTime) {
  28214. me.confirmBtn.setDisabled(disabled);
  28215. }
  28216. if (me.isShowFooter()) {
  28217. me.footerContainer.setDisabled(disabled);
  28218. }
  28219. },
  28220. handleDateClick: function (e, t) {
  28221. var me = this, handler = me.handler;
  28222. // e.stopEvent();
  28223. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  28224. me.doCancelFocus = me.focusOnSelect === false;
  28225. me.selectDate(new Date(t.dateValue));
  28226. delete me.doCancelFocus;
  28227. /* 有时间输入时单击事件不退出选择,只移动光标 */
  28228. if (me.showTime) {
  28229. return;
  28230. }
  28231. me.fireEvent('select', me, me.value);
  28232. if (handler) {
  28233. handler.call(me.scope || me, me, me.value);
  28234. }
  28235. me.onSelect();
  28236. }
  28237. },
  28238. selectToday: function () {
  28239. var me = this, btn = me.todayBtn, handler = me.handler;
  28240. if (btn && !btn.disabled) {
  28241. me.value = syncDate(new Date());
  28242. me.update(me.value);
  28243. me.fireEvent('select', me, me.value);
  28244. if (handler) {
  28245. handler.call(me.scope || me, me, me.value);
  28246. }
  28247. me.onSelect();
  28248. me.hide();
  28249. }
  28250. return me;
  28251. },
  28252. confirmClick: function () {
  28253. var me = this, btn = me.confirmBtn, handler = me.handler;
  28254. if (btn && !btn.disabled) {
  28255. me.fireEvent('select', me, me.value);
  28256. if (handler) {
  28257. handler.call(me.scope || me, me, me.value);
  28258. }
  28259. me.onSelect();
  28260. me.hide();
  28261. }
  28262. return me;
  28263. },
  28264. selectedUpdate: function (date) {
  28265. var me = this,
  28266. //t = date.getTime(),
  28267. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  28268. cells.removeCls(cls);
  28269. for (c = 0; c < cLen; c++) {
  28270. cell = Ext.fly(cellItems[c]);
  28271. if (cell.dom.firstChild.dateValue == t) {
  28272. me.fireEvent('highlightitem', me, cell);
  28273. cell.addCls(cls);
  28274. if (me.isVisible() && !me.doCancelFocus) {
  28275. Ext.fly(cell.dom.firstChild).focus(50);
  28276. }
  28277. break;
  28278. }
  28279. }
  28280. },
  28281. // private, inherit docs
  28282. beforeDestroy: function () {
  28283. var me = this;
  28284. if (me.rendered) {
  28285. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  28286. }
  28287. me.superclass.beforeDestroy.call(this);
  28288. }
  28289. });
  28290. }
  28291. //# sourceMappingURL=datetimepicker.js.map
  28292. function initDateTime () {
  28293. Ext.define('Yvan.DateTimeField', {
  28294. extend: 'Ext.form.field.Date',
  28295. xtype: 'datetimefield',
  28296. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  28297. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28298. showTime: true,
  28299. format: "Y-m-d H:i:s",
  28300. constructor: function (config) {
  28301. var newConfig = _$2.defaultsDeep({
  28302. // 强制属性
  28303. }, baseConfig(config, 'col-item'), config, date);
  28304. this.superclass.constructor.call(this, newConfig);
  28305. },
  28306. initComponent: function () {
  28307. this.superclass.initComponent.call(this);
  28308. var setInitValue = function () {
  28309. var value = this.getRawValue();
  28310. if (!value) {
  28311. // 没填内容的时候,自动设置当前时间
  28312. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  28313. }
  28314. };
  28315. this.on({
  28316. afterrender: function () {
  28317. var config = this.config;
  28318. // 日期框,不要默认弹出
  28319. $(this.el.dom).on('click', setInitValue.bind(this));
  28320. },
  28321. destory: function () {
  28322. // 日期框,不要默认弹出
  28323. $(this.el.dom).off('click', setInitValue.bind(this));
  28324. },
  28325. change: {
  28326. fn: function (sender) {
  28327. if (sender.format === "Y-m-d H:i:s") {
  28328. // 年月日格式
  28329. var value = sender.getRawValue();
  28330. if (/^\d{14}$/.test(value)) {
  28331. // 8位数字,自动转换为 YYYY-MM-DD
  28332. var newValue = [
  28333. value.substr(0, 4),
  28334. '-',
  28335. value.substr(4, 2),
  28336. '-',
  28337. value.substr(6, 2),
  28338. ' ',
  28339. value.substr(8, 2),
  28340. ':',
  28341. value.substr(10, 2),
  28342. ':',
  28343. value.substr(12, 2)
  28344. ].join('');
  28345. sender.setValue(newValue);
  28346. }
  28347. }
  28348. },
  28349. }
  28350. });
  28351. },
  28352. getValue: function () {
  28353. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  28354. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  28355. // console.log('cc:', nv, ov)
  28356. return nv;
  28357. },
  28358. onExpand: function () {
  28359. var strValue = this.getValue();
  28360. var value;
  28361. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  28362. 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)));
  28363. }
  28364. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  28365. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  28366. }
  28367. else {
  28368. value = syncDate(new Date());
  28369. }
  28370. this.picker.setValue(value);
  28371. },
  28372. createPicker: function () {
  28373. var me = this, format = Ext.String.format;
  28374. //@ts-ignore
  28375. return new Yvan.DateTimePicker({
  28376. pickerField: me,
  28377. ownerCt: me.ownerCt,
  28378. renderTo: document.body,
  28379. floating: true,
  28380. hidden: true,
  28381. focusOnShow: true,
  28382. minDate: me.minValue,
  28383. maxDate: me.maxValue,
  28384. disabledDatesRE: me.disabledDatesRE,
  28385. disabledDatesText: me.disabledDatesText,
  28386. disabledDays: me.disabledDays,
  28387. disabledDaysText: me.disabledDaysText,
  28388. format: me.format,
  28389. showToday: me.showToday,
  28390. showTime: me.showTime,
  28391. startDay: me.startDay,
  28392. minText: format(me.minText, me.formatDate(me.minValue)),
  28393. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  28394. listeners: {
  28395. scope: me,
  28396. select: me.onSelect
  28397. },
  28398. keyNavConfig: {
  28399. esc: function () {
  28400. me.collapse();
  28401. }
  28402. }
  28403. });
  28404. },
  28405. });
  28406. }
  28407. //# sourceMappingURL=datetimefield.js.map
  28408. function initNumber () {
  28409. var cc = Ext.form.field.Number.prototype.constructor;
  28410. var initComponent = Ext.form.field.Number.prototype.initComponent;
  28411. Ext.form.field.Number.override({
  28412. constructor: function (config) {
  28413. var newConfig = _$2.defaultsDeep({
  28414. // 强制属性
  28415. }, baseConfig(config, 'col-item'), config, numberfield);
  28416. cc.call(this, newConfig);
  28417. },
  28418. initComponent: function () {
  28419. this.on({
  28420. afterrender: function (sender) {
  28421. var _this = this;
  28422. var _a;
  28423. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  28424. sender.inputEl.dom.setAttribute('spellcheck', "false");
  28425. $$2(sender.inputEl.dom).on('click', function (e) {
  28426. sender.fireEvent('click', _this, e);
  28427. });
  28428. }
  28429. }
  28430. });
  28431. initComponent.call(this);
  28432. },
  28433. });
  28434. }
  28435. //# sourceMappingURL=numberfield.js.map
  28436. function initCheckbox () {
  28437. var cc = Ext.form.field.Checkbox.prototype.constructor;
  28438. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  28439. Ext.form.field.Checkbox.override({
  28440. constructor: function (config) {
  28441. var newConfig = _$2.defaultsDeep({
  28442. // 强制属性
  28443. }, baseConfig(config, 'col-item'), config, checkbox);
  28444. cc.call(this, newConfig);
  28445. },
  28446. getValue: function () {
  28447. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28448. var ov = getValue.call(this);
  28449. // const ov = this.getRawValue()
  28450. return (ov ? checkedValue : uncheckedValue);
  28451. },
  28452. setValue: function (nv) {
  28453. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28454. var value;
  28455. if (nv === checkedValue) {
  28456. value = true;
  28457. }
  28458. else if (nv === uncheckedValue) {
  28459. value = false;
  28460. }
  28461. else {
  28462. value = !!nv;
  28463. }
  28464. // me.setRawValue(value)
  28465. // me.checked = value
  28466. // return me.mixins.field.setValue.call(me, value);
  28467. setValue.call(this, value);
  28468. },
  28469. updateCheckedCls: function (checked) {
  28470. var me = this;
  28471. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  28472. checked = checked != null ? checked : me.getValue();
  28473. if (checked === uncheckedValue) {
  28474. checked = false;
  28475. }
  28476. else if (checked === checkedValue) {
  28477. checked = true;
  28478. }
  28479. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  28480. },
  28481. initComponent: function () {
  28482. initComponent.call(this);
  28483. },
  28484. });
  28485. }
  28486. //# sourceMappingURL=checkbox.js.map
  28487. function initCheckboxGroup () {
  28488. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  28489. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  28490. Ext.form.CheckboxGroup.override({
  28491. constructor: function (config) {
  28492. var newConfig = _$2.defaultsDeep({
  28493. // 强制属性
  28494. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  28495. cc.call(this, newConfig);
  28496. },
  28497. initComponent: function () {
  28498. initComponent.call(this);
  28499. },
  28500. });
  28501. }
  28502. //# sourceMappingURL=checkboxgroup.js.map
  28503. function initRadio () {
  28504. var cc = Ext.form.field.Radio.prototype.constructor;
  28505. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  28506. Ext.form.field.Radio.override({
  28507. constructor: function (config) {
  28508. var newConfig = _$2.defaultsDeep({
  28509. // 强制属性
  28510. }, baseConfig(config, 'col-item'), config, radio);
  28511. cc.call(this, newConfig);
  28512. },
  28513. initComponent: function () {
  28514. initComponent.call(this);
  28515. },
  28516. });
  28517. }
  28518. //# sourceMappingURL=radio.js.map
  28519. function initRadioGroup () {
  28520. var cc = Ext.form.RadioGroup.prototype.constructor;
  28521. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  28522. Ext.form.RadioGroup.override({
  28523. constructor: function (config) {
  28524. var newConfig = _$2.defaultsDeep({
  28525. // 强制属性
  28526. }, baseConfig(config, 'col-item'), config, radiogroup);
  28527. cc.call(this, newConfig);
  28528. },
  28529. initComponent: function () {
  28530. initComponent.call(this);
  28531. },
  28532. });
  28533. }
  28534. //# sourceMappingURL=radiogroup.js.map
  28535. function initFieldset () {
  28536. /**
  28537. *
  28538. */
  28539. var ct = Ext.form.FieldSet.prototype.constructor;
  28540. Ext.form.FieldSet.override({
  28541. constructor: function (config) {
  28542. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  28543. ct.call(this, newConfig);
  28544. }
  28545. });
  28546. }
  28547. //# sourceMappingURL=fieldset.js.map
  28548. function initCombotree () {
  28549. Ext.define('Yvan.ComboTree', {
  28550. extend: 'Ext.form.field.Picker',
  28551. xtype: 'combotree',
  28552. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28553. config: {
  28554. store: null,
  28555. displayField: null,
  28556. columns: null,
  28557. selectOnTab: true,
  28558. maxPickerHeight: 300,
  28559. minPickerHeight: 100,
  28560. minPickerWidth: 350,
  28561. rootVisible: true,
  28562. },
  28563. editable: false,
  28564. setStore: function (store) {
  28565. this.store = store;
  28566. var me = this;
  28567. if (me.store) {
  28568. if (me.picker) {
  28569. me.picker.setStore(store);
  28570. if (me.isExpanded) {
  28571. me.collapse();
  28572. delete me.picker;
  28573. me.expand();
  28574. }
  28575. }
  28576. this.onLoad();
  28577. me.mon(me.store, {
  28578. scope: me,
  28579. load: me.onLoad,
  28580. update: me.onUpdate
  28581. });
  28582. }
  28583. },
  28584. createPicker: function () {
  28585. var me = this;
  28586. var picker = new Ext.tree.Panel({
  28587. border: false,
  28588. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28589. shrinkWrapDock: 2,
  28590. store: me.store,
  28591. floating: true,
  28592. rootVisible: me.rootVisible,
  28593. displayField: me.displayField,
  28594. columns: me.columns,
  28595. minHeight: me.minPickerHeight,
  28596. maxHeight: me.maxPickerHeight,
  28597. minWidth: me.minPickerWidth,
  28598. manageHeight: false,
  28599. shadow: false,
  28600. scrollable: true,
  28601. // modal: true,
  28602. // constrain: true,
  28603. // constrainTo: topScope._handle.el.dom,
  28604. // renderTo: topScope._handle.el.dom,
  28605. // alignTarget: topScope._handle,
  28606. listeners: {
  28607. scope: me,
  28608. itemclick: me.onItemClick,
  28609. itemkeydown: me.onPickerKeyDown
  28610. }
  28611. }), view = picker.getView();
  28612. if (Ext.isIE9 && Ext.isStrict) {
  28613. view.on({
  28614. scope: me,
  28615. highlightitem: me.repaintPickerView,
  28616. unhighlightitem: me.repaintPickerView,
  28617. afteritemexpand: me.repaintPickerView,
  28618. afteritemcollapse: me.repaintPickerView
  28619. });
  28620. }
  28621. return picker;
  28622. },
  28623. repaintPickerView: function () {
  28624. var style = this.picker.getView().getEl().dom.style;
  28625. style.display = style.display;
  28626. },
  28627. onItemClick: function (view, record, node, rowIndex, e) {
  28628. this.selectItem(view, record);
  28629. },
  28630. onPickerKeyDown: function (treeView, record, item, index, e) {
  28631. var key = e.getKey();
  28632. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  28633. this.selectItem(treeView, record);
  28634. }
  28635. },
  28636. selectItem: function (sender, record) {
  28637. var me = this;
  28638. me.setValue(record.getId());
  28639. me.fireEvent('select', me, record);
  28640. me.collapse();
  28641. },
  28642. onExpand: function () {
  28643. var picker = this.picker;
  28644. var store = picker.store;
  28645. var value = this.value;
  28646. var node;
  28647. if (value) {
  28648. node = store.getNodeById(value);
  28649. }
  28650. if (!node) {
  28651. node = store.getRoot();
  28652. }
  28653. picker.ensureVisible(node, {
  28654. select: true,
  28655. focus: true
  28656. });
  28657. },
  28658. setValue: function (value) {
  28659. var me = this;
  28660. console.log('setValue', value);
  28661. me.value = value;
  28662. if (!me.store || me.store.loading) {
  28663. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  28664. return me.mixins.field.setValue.call(me, value);
  28665. // return me;
  28666. }
  28667. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  28668. if (value === undefined) {
  28669. record = me.store.getRoot();
  28670. console.log('setValue', record.getId());
  28671. me.value = record.getId();
  28672. return me.mixins.field.setValue.call(me, value);
  28673. }
  28674. else {
  28675. record = me.store.getNodeById(value);
  28676. }
  28677. // set the raw value to the record's display field if a record was found
  28678. me.setRawValue(record ? record.get(me.displayField) : '');
  28679. return me.mixins.field.setValue.call(me, value);
  28680. },
  28681. getSubmitValue: function () {
  28682. return this.value;
  28683. },
  28684. getValue: function () {
  28685. return this.value;
  28686. },
  28687. onLoad: function () {
  28688. var value = this.value;
  28689. if (value) {
  28690. this.setValue(value);
  28691. }
  28692. },
  28693. onUpdate: function (store, rec, type, modifiedFieldNames) {
  28694. var display = this.displayField;
  28695. var me = this;
  28696. if (type === 'edit' && modifiedFieldNames &&
  28697. Ext.Array.contains(modifiedFieldNames, display) &&
  28698. this.value === rec.getId()) {
  28699. me.mixins.field.setValue.call(me, this.value);
  28700. this.setRawValue(rec.get(display));
  28701. }
  28702. }
  28703. });
  28704. }
  28705. //# sourceMappingURL=combotree.js.map
  28706. function initPickerPlus () {
  28707. Ext.define('Yvan.PickerAlignCenter', {
  28708. extend: 'Ext.form.field.Picker',
  28709. /**
  28710. * Performs the alignment on the picker using the class defaults
  28711. * @private
  28712. */
  28713. doAlign: function () {
  28714. // 不要挪动就好
  28715. },
  28716. });
  28717. }
  28718. //# sourceMappingURL=pickerplus.js.map
  28719. function initCombogrid () {
  28720. Ext.define('Yvan.ComboGrid', {
  28721. extend: 'Ext.form.field.Picker',
  28722. // extend: 'Yvan.PickerAlignCenter',
  28723. xtype: 'combogrid',
  28724. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  28725. triggers: {
  28726. clear: {
  28727. weight: 0,
  28728. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  28729. hidden: true,
  28730. handler: 'onClearClick',
  28731. },
  28732. },
  28733. config: __assign({}, comboGrid),
  28734. editable: true,
  28735. _superBlur: false,
  28736. allowCustomInput: false,
  28737. pressEnterPopup: true,
  28738. initComponent: function () {
  28739. var that = this;
  28740. var scope = lookupScope(that);
  28741. var config = that.config;
  28742. if (isDesignMode(scope, config)) {
  28743. this.superclass.initComponent.call(this, arguments);
  28744. return;
  28745. }
  28746. this.on({
  28747. blur: function (sender, e) {
  28748. if (this._superBlur) {
  28749. // 挂起时不恢复内容
  28750. return;
  28751. }
  28752. // 离开焦点时,恢复原来的值
  28753. sender.setRawValue(sender.value);
  28754. },
  28755. afterrender: function (sender) {
  28756. var $dom = $(sender.inputEl.dom);
  28757. that.scope = lookupScope(sender);
  28758. if (sender.column) {
  28759. // 列模式,拦截 keydown
  28760. $dom.on('keydown', function (e) {
  28761. if (isChartEvent(e) && !that.tryEnable()) {
  28762. // 没有达成 editEnable 条件,不用响应
  28763. stopEvent(e);
  28764. return;
  28765. }
  28766. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28767. stopEvent(e);
  28768. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28769. return;
  28770. }
  28771. });
  28772. }
  28773. else {
  28774. // 常规模式,拦截 keyup
  28775. $dom.on('keyup', function (e) {
  28776. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  28777. return;
  28778. }
  28779. if (isChartEvent(e) && !that.tryEnable()) {
  28780. // 没有达成 editEnable 条件,不用响应
  28781. stopEvent(e);
  28782. return;
  28783. }
  28784. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28785. stopEvent(e);
  28786. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28787. return;
  28788. }
  28789. if (!that.allowCustomInput) {
  28790. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  28791. stopEvent(e);
  28792. }
  28793. });
  28794. $dom.on('change', function (e) {
  28795. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  28796. // if (that.isExpanded) {
  28797. // that.filterChange(that, e.target.value)
  28798. // }
  28799. stopEvent(e);
  28800. });
  28801. }
  28802. $dom.on('input', function (e) {
  28803. stopEvent(e);
  28804. });
  28805. },
  28806. });
  28807. this.superclass.initComponent.apply(this, arguments);
  28808. },
  28809. createPicker: function () {
  28810. var me = this;
  28811. var cfg = {
  28812. layout: 'fit',
  28813. border: 0,
  28814. // border: 5,
  28815. style: {
  28816. // borderColor: 'black',
  28817. // borderWidth: '5px',
  28818. // borderStyle: 'solid',
  28819. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  28820. },
  28821. shadow: 'side',
  28822. shadowOffset: 100,
  28823. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28824. shrinkWrapDock: 2,
  28825. floating: true,
  28826. width: me.pickerWidth,
  28827. height: me.pickerHeight,
  28828. minWidth: me.pickerWidth,
  28829. minHeight: me.pickerHeight,
  28830. maxWidth: me.pickerWidth,
  28831. maxHeight: me.pickerHeight,
  28832. items: [
  28833. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  28834. xtype: 'toolbar',
  28835. items: [
  28836. { xtype: 'textfield', fieldLabel: '筛选' },
  28837. {
  28838. xtype: 'button',
  28839. text: '查询',
  28840. iconCls: 'x-fa fa-search',
  28841. cssType: 'primary',
  28842. listeners: {
  28843. click: function () {
  28844. me.reloadGrid();
  28845. }
  28846. }
  28847. },
  28848. ]
  28849. }, autoLoad: false, listeners: {
  28850. afterrender: function (grid) {
  28851. me.grid = grid;
  28852. grid.focus();
  28853. grid.on({
  28854. rowdblclick: function (sender, row) {
  28855. me.selectItem(row);
  28856. },
  28857. dataLoadComplete: function (sender) {
  28858. _$2.defer(function () {
  28859. me.setFocus();
  28860. });
  28861. },
  28862. keydown: function (sender, e) {
  28863. if (me.column) {
  28864. // 列模式,拦截 keydown
  28865. me.processKey(e);
  28866. }
  28867. },
  28868. keyup: function (sender, e) {
  28869. if (!me.column) {
  28870. // 常规模式,拦截 keyup
  28871. me.processKey(e);
  28872. }
  28873. }
  28874. });
  28875. },
  28876. } })
  28877. ]
  28878. };
  28879. // @ts-ignore
  28880. var picker = new Ext.container.Container(cfg);
  28881. return picker;
  28882. },
  28883. setFocus: function () {
  28884. if (this.grid.store.getCount() > 0) {
  28885. this.grid.focusRow(0);
  28886. }
  28887. },
  28888. processKey: function (e) {
  28889. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  28890. this.selectItem(this.grid.selection);
  28891. stopEvent(e);
  28892. }
  28893. else if (e.key === 'Escape') {
  28894. this.collapse();
  28895. }
  28896. },
  28897. repaintPickerView: function () {
  28898. var style = this.picker.getView().getEl().dom.style;
  28899. style.display = style.display;
  28900. },
  28901. onItemClick: function (view, record, node, rowIndex, e) {
  28902. this.selectItem(record);
  28903. },
  28904. onPickerKeyDown: function (treeView, record, item, index, e) {
  28905. var key = e.getKey();
  28906. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  28907. this.selectItem(record);
  28908. }
  28909. },
  28910. filterChange: _$2.debounce(function (sender, value) {
  28911. sender.onExpand();
  28912. }, 1000),
  28913. selectItem: function (record) {
  28914. var me = this;
  28915. var lookup = this.lookup;
  28916. var scope = lookupScope(this);
  28917. me.fireEvent('select', me, record);
  28918. if (record.isModel) {
  28919. record = record.data;
  28920. }
  28921. tryWriteObject(lookup, record, function (path, value) {
  28922. me._lookupSet(path, value);
  28923. });
  28924. // lookup
  28925. // fromColumn: 'toTarget'
  28926. // fromColumn: 'toTarget'
  28927. // fromColumn: 'toTarget'
  28928. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  28929. var value = _$2.get(record, fromColumn);
  28930. me._lookupSet(toTarget, value);
  28931. });
  28932. // 选定之后不能做清空
  28933. // const {lookupClearOnChange} = me
  28934. // if (_.isArray(lookupClearOnChange)) {
  28935. // _.each(lookupClearOnChange, item => {
  28936. // me._lookupSet(item, '')
  28937. // })
  28938. // }
  28939. me.collapse();
  28940. // 触发 _raiseNextFocus
  28941. me._raiseNextFocus(me);
  28942. },
  28943. onExpand: function () {
  28944. // 展开时,根据 lookup 带入查询参数
  28945. var expressData = this.getExpressData();
  28946. var txtField = this.grid.down('toolbar').down('textfield');
  28947. txtField.setValue(expressData.queryValue);
  28948. this.reloadGrid();
  28949. },
  28950. reloadGrid: function () {
  28951. // 展开时,根据 lookup 带入查询参数
  28952. var expressData = this.getExpressData();
  28953. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  28954. var txtField = this.grid.down('toolbar').down('textfield');
  28955. // 每个 combogrid 默认带上 __queryValue 属性
  28956. reloadParam["__queryValue"] = txtField.getValue();
  28957. this.grid.reload(reloadParam);
  28958. },
  28959. onTriggerClick: function (sender) {
  28960. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  28961. if (!grid) {
  28962. msg('正在初始化,请稍后');
  28963. return;
  28964. }
  28965. if (!this.tryEnable()) {
  28966. // 没有达成 editEnable 条件,不用弹出
  28967. return;
  28968. }
  28969. if (isExpanded || readOnly || disabled) {
  28970. // 已弹出、只读、禁用状态下,不允许弹出
  28971. return;
  28972. }
  28973. this._superBlur = true;
  28974. this.superclass.onTriggerClick.apply(this, arguments);
  28975. this._superBlur = false;
  28976. },
  28977. onCollapse: function () {
  28978. // 每次收回时,删除下拉组件
  28979. // delete this.picker
  28980. },
  28981. /**
  28982. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  28983. */
  28984. setValue: function (value) {
  28985. var me = this;
  28986. // 设值用户看到的表面内容
  28987. this.setRawValue(value);
  28988. // 设值 setValue 调用链,正常触发 change 事件等
  28989. return me.mixins.field.setValue.call(me, value);
  28990. },
  28991. _lookupSet: function (path, value) {
  28992. var me = this;
  28993. path = tryVarSimple(path);
  28994. if (me.column) {
  28995. // 判断写入目标,是否与自己绑定的属性相等
  28996. if (path === 'queryValue' || me.column.dataIndex === path) {
  28997. me.setValue(value);
  28998. }
  28999. // 列模式下,写当前编辑行
  29000. var parentRecord = me._lookupEditorRecord();
  29001. if (parentRecord) {
  29002. // Ext.data.Record / Ext.data.Model
  29003. parentRecord.set(path, value);
  29004. }
  29005. else {
  29006. debugger;
  29007. }
  29008. }
  29009. else {
  29010. // 常规模式下,写 viewModel
  29011. me.scope.viewModel.set(path, value);
  29012. }
  29013. },
  29014. _lookupGrid: function () {
  29015. return this.column.up('grid');
  29016. },
  29017. _lookupEditorRecord: function () {
  29018. var _a, _b, _c, _d;
  29019. // parentGrid.getSelectionModel().getLastSelected()
  29020. var grid = this._lookupGrid();
  29021. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  29022. if (!editingPlugin) {
  29023. return grid.getSelectionModel().getLastSelected();
  29024. }
  29025. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  29026. if (_$2.isNumber(rowIdx)) {
  29027. return grid.store.getAt(rowIdx);
  29028. }
  29029. else {
  29030. return grid.getSelectionModel().getLastSelected();
  29031. }
  29032. },
  29033. onChange: function (newVal, oldVal) {
  29034. var me = this;
  29035. var value = newVal;
  29036. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  29037. if (hideTrigger || disabled || readOnly || hideClear) {
  29038. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  29039. return;
  29040. }
  29041. if (value) {
  29042. me.getTrigger('clear').show();
  29043. me.updateLayout();
  29044. }
  29045. else {
  29046. me.getTrigger('clear').hide();
  29047. me.updateLayout();
  29048. }
  29049. },
  29050. /**
  29051. * 得到能用于 express 表达式计算的上下文数据
  29052. */
  29053. getExpressData: function () {
  29054. var queryValue = this.getRawValue();
  29055. if (!queryValue) {
  29056. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  29057. queryValue = this.getPicker().down('textfield').getRawValue();
  29058. }
  29059. if (this.column) {
  29060. // 列模式, 准备好判断 editEnable 表达式用的数据
  29061. var parentRecord = this._lookupEditorRecord();
  29062. if (!parentRecord) {
  29063. debugger;
  29064. }
  29065. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  29066. }
  29067. else {
  29068. // 编辑模式,准备好判断用的数据
  29069. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  29070. }
  29071. },
  29072. tryEnable: function () {
  29073. return tryEnable(this.getExpressData(), this.editEnable);
  29074. },
  29075. /**
  29076. * 清空所有值
  29077. */
  29078. onClearClick: function (sender, e) {
  29079. var me = this;
  29080. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  29081. me.fireEvent('clear', sender, e);
  29082. me.setValue('');
  29083. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  29084. me._lookupSet(toTarget, '');
  29085. });
  29086. _$2.each(lookupClearOnChange, function (item) {
  29087. me._lookupSet(item, '');
  29088. });
  29089. }
  29090. });
  29091. }
  29092. //# sourceMappingURL=combogrid.js.map
  29093. function initContainer () {
  29094. var cc = Ext.container.Container.prototype.constructor;
  29095. //const {initComponent} = Ext.container.Container.prototype
  29096. Ext.container.Container.override({
  29097. constructor: function (config) {
  29098. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  29099. cc.call(this, newConfig);
  29100. },
  29101. });
  29102. }
  29103. //# sourceMappingURL=container.js.map
  29104. function initRows () {
  29105. Ext.define('Yvan.Rows', {
  29106. extend: 'Ext.container.Container',
  29107. xtype: 'rows',
  29108. constructor: function (config) {
  29109. var self = this;
  29110. var newConfig = _$2.defaultsDeep({
  29111. // 强制性属性
  29112. layout: 'anchor', border: false,
  29113. defaults: {
  29114. border: false, anchor: '100%',
  29115. margin: '0 0 5 0',
  29116. },
  29117. }, baseConfig(config, 'rows-container'), config, rows);
  29118. this.superclass.constructor.call(self, newConfig);
  29119. },
  29120. });
  29121. }
  29122. //# sourceMappingURL=rows.js.map
  29123. function initForm () {
  29124. var ct = Ext.form.Panel.prototype.constructor;
  29125. Ext.form.Panel.override({
  29126. constructor: function (config) {
  29127. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  29128. ct.call(this, newConfig);
  29129. }
  29130. });
  29131. }
  29132. //# sourceMappingURL=form.js.map
  29133. function initCols () {
  29134. Ext.define('Yvan.Cols', {
  29135. extend: 'Ext.container.Container',
  29136. xtype: 'cols',
  29137. constructor: function (config) {
  29138. var self = this;
  29139. var newConfig = _$2.defaultsDeep({
  29140. // 强制性属性
  29141. layout: 'hbox',
  29142. minHeight: config.designMode ? 32 : 0
  29143. }, baseConfig(config, 'cols-container'), config, cols);
  29144. this.superclass.constructor.call(self, newConfig);
  29145. },
  29146. });
  29147. }
  29148. //# sourceMappingURL=cols.js.map
  29149. function initButton () {
  29150. /**
  29151. *
  29152. */
  29153. var ct = Ext.button.Button.prototype.constructor;
  29154. Ext.button.Button.override({
  29155. constructor: function (config) {
  29156. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  29157. ct.call(this, newConfig);
  29158. },
  29159. setLoading: function (value) {
  29160. if (value) {
  29161. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  29162. this._originIconCls = this.iconCls;
  29163. }
  29164. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  29165. this.setDisabled(true);
  29166. }
  29167. else {
  29168. this.setIconCls(this._originIconCls);
  29169. this.setDisabled(false);
  29170. }
  29171. }
  29172. });
  29173. }
  29174. //# sourceMappingURL=button.js.map
  29175. function initIframe () {
  29176. Ext.define('Ext.ux.IFrame', {
  29177. extend: 'Ext.Component',
  29178. alias: 'widget.uxiframe',
  29179. loadMask: 'Loading...',
  29180. src: 'about:blank',
  29181. renderTpl: [
  29182. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  29183. ],
  29184. childEls: ['iframeEl'],
  29185. initComponent: function () {
  29186. this.superclass.initComponent.call(this);
  29187. this.superclass.initEvents.call(this);
  29188. this.frameName = this.frameName || this.id + '-frame';
  29189. },
  29190. initEvents: function () {
  29191. var me = this;
  29192. this.superclass.initEvents.call(this);
  29193. me.iframeEl.on('load', me.onLoad, me);
  29194. },
  29195. initRenderData: function () {
  29196. return Ext.apply(this.superclass.initRenderData.call(this), {
  29197. src: this.src,
  29198. frameName: this.frameName
  29199. });
  29200. },
  29201. getBody: function () {
  29202. var doc = this.getDoc();
  29203. return doc.body || doc.documentElement;
  29204. },
  29205. getDoc: function () {
  29206. try {
  29207. return this.getWin().document;
  29208. }
  29209. catch (ex) {
  29210. return null;
  29211. }
  29212. },
  29213. getWin: function () {
  29214. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  29215. return win;
  29216. },
  29217. getFrame: function () {
  29218. var me = this;
  29219. return me.iframeEl.dom;
  29220. },
  29221. onLoad: function () {
  29222. var me = this, doc = me.getDoc();
  29223. if (doc) {
  29224. this.el.unmask();
  29225. this.fireEvent('load', this);
  29226. }
  29227. else if (me.src) {
  29228. this.el.unmask();
  29229. this.fireEvent('error', this);
  29230. }
  29231. },
  29232. load: function (src) {
  29233. var me = this, text = me.loadMask, frame = me.getFrame();
  29234. if (me.fireEvent('beforeload', me, src) !== false) {
  29235. if (text && me.el) {
  29236. me.el.mask(text);
  29237. }
  29238. frame.src = me.src = (src || me.src);
  29239. }
  29240. }
  29241. });
  29242. }
  29243. //# sourceMappingURL=iframe.js.map
  29244. /**
  29245. * 属性:
  29246. * - autoLoad: true
  29247. * - dataSource: ''
  29248. * 方法:
  29249. * - handleZoomBig
  29250. * - handleZoomSmall
  29251. * - handleZoomReset
  29252. * - openDiagram
  29253. * - getBpmn
  29254. * - getBpmnCanvas
  29255. * - getBpmnOverlays
  29256. * - getBpmnZoomScroll
  29257. * 事件:
  29258. * - initFinish
  29259. * - failed
  29260. * - success
  29261. * - itemHover
  29262. * - itemOut
  29263. * - itemClick
  29264. * - itemDblclick
  29265. * - itemMousedown
  29266. * - itemMouseup
  29267. */
  29268. function initBpmn () {
  29269. Ext.define('Yvan.Bpmn', {
  29270. // extend: 'Ext.container.Container',
  29271. extend: 'Ext.panel.Panel',
  29272. alias: 'widget.bpmn',
  29273. xtype: 'bpmn',
  29274. constructor: function (config) {
  29275. var self = this;
  29276. var newConfig = _$2.defaultsDeep({
  29277. // 强制性属性
  29278. }, baseConfig(config, 'row-item'), config, bpmn);
  29279. if (!newConfig.hideToolbar) {
  29280. newConfig.tbar = [];
  29281. newConfig.tbar.push({
  29282. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  29283. listeners: {
  29284. click: function (sender) {
  29285. self.reload();
  29286. }
  29287. }
  29288. });
  29289. newConfig.tbar.push({
  29290. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  29291. listeners: {
  29292. click: function (sender) {
  29293. self.handleZoomBig();
  29294. }
  29295. },
  29296. });
  29297. newConfig.tbar.push({
  29298. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  29299. listeners: {
  29300. click: function (sender) {
  29301. self.handleZoomSmall();
  29302. }
  29303. },
  29304. });
  29305. newConfig.tbar.push({
  29306. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  29307. listeners: {
  29308. click: function (sender) {
  29309. self.handleZoomReset();
  29310. }
  29311. },
  29312. });
  29313. }
  29314. this.superclass.constructor.call(self, newConfig);
  29315. },
  29316. initComponent: function () {
  29317. var _this = this;
  29318. var me = this;
  29319. var config = me.config;
  29320. var scope = lookupScope(this);
  29321. if (!isDesignMode(scope, config)) {
  29322. //@ts-ignore
  29323. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  29324. console.log('BpNavigated', me, BpNavigated);
  29325. var dom = me.el.dom;
  29326. var $dom = $(dom);
  29327. var $container = $dom.find('.x-autocontainer-innerCt');
  29328. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  29329. _this._bpmn = bpmn;
  29330. if (_this.autoLoad) {
  29331. _this.reload();
  29332. }
  29333. _this.fireEvent('initFinish', _this);
  29334. var eventBus = bpmn.get('eventBus');
  29335. eventBus.on('element.hover', function (e) {
  29336. // this.fireEvent('itemHover', this, e);
  29337. });
  29338. eventBus.on('element.out', function (e) {
  29339. _this.fireEvent('itemOut', _this, e);
  29340. });
  29341. eventBus.on('element.click', function (e) {
  29342. _this.fireEvent('itemClick', _this, e);
  29343. });
  29344. eventBus.on('element.dblclick', function (e) {
  29345. _this.fireEvent('itemDblclick', _this, e);
  29346. });
  29347. eventBus.on('element.mousedown', function (e) {
  29348. _this.fireEvent('itemMousedown', _this, e);
  29349. });
  29350. eventBus.on('element.mouseup', function (e) {
  29351. _this.fireEvent('itemMouseup', _this, e);
  29352. });
  29353. });
  29354. }
  29355. this.superclass.initComponent.call(this);
  29356. this.on({
  29357. afterrender: function (sender) {
  29358. }
  29359. });
  29360. },
  29361. /**
  29362. * 重新载入
  29363. */
  29364. reload: function () {
  29365. var _this = this;
  29366. var _a;
  29367. if (typeof this.dataSource === 'string' && this.dataSource) {
  29368. var scope = lookupScope(this);
  29369. var fn = lookupFn(scope, this.dataSource);
  29370. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  29371. _this.openDiagram(res.data);
  29372. });
  29373. }
  29374. },
  29375. /**
  29376. * 获取bpmn
  29377. */
  29378. getBpmn: function () {
  29379. return this._bpmn;
  29380. },
  29381. getBpmnCanvas: function () {
  29382. var _a;
  29383. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  29384. },
  29385. getBpmnOverlays: function () {
  29386. var _a;
  29387. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  29388. },
  29389. getBpmnZoomScroll: function () {
  29390. var _a;
  29391. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  29392. },
  29393. handleZoomBig: function () {
  29394. var _a;
  29395. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  29396. },
  29397. handleZoomSmall: function () {
  29398. var _a;
  29399. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  29400. },
  29401. handleZoomReset: function () {
  29402. var _a;
  29403. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  29404. },
  29405. openDiagram: function (diagram) {
  29406. var _this = this;
  29407. if (!this.getBpmn()) {
  29408. return;
  29409. }
  29410. this.getBpmn().importXML(diagram, function (err) {
  29411. if (err) {
  29412. // YvEventDispatch(this.onFailed, this, undefined);
  29413. _this.fireEvent('failed', _this, err);
  29414. return console.error('could not import BPMN 2.0 diagram', err);
  29415. }
  29416. // zoom to fit full viewport
  29417. _this.getBpmnCanvas().zoom('fit-viewport');
  29418. _this.fireEvent('success', _this);
  29419. });
  29420. },
  29421. });
  29422. }
  29423. //# sourceMappingURL=bpmn.js.map
  29424. function initSqlComplex () {
  29425. Ext.define('Yvan.SqlComplex', {
  29426. extend: 'Ext.panel.Panel',
  29427. xtype: 'sqlcomplex',
  29428. alias: 'widget.sqlcomplex',
  29429. getSqlExpress: function () {
  29430. },
  29431. constructor: function (config) {
  29432. var reference = config.reference;
  29433. var me = this;
  29434. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29435. {
  29436. region: 'west',
  29437. width: 280,
  29438. border: false,
  29439. split: true,
  29440. reference: reference + '_tree',
  29441. xtype: 'yvtree',
  29442. hideRefresh: true,
  29443. hideExpand: true,
  29444. hideCollapse: true,
  29445. listeners: {
  29446. itemdblclick: function (sender, record, item, index, e) {
  29447. var field = record.get('field');
  29448. var defaultValue = record.get('defaultValue');
  29449. if (!field) {
  29450. return;
  29451. }
  29452. var tabExpress = me.down('tabpanel');
  29453. var sqleditor = me.down('sqleditor');
  29454. var expressGrid = me.down('yvgrid');
  29455. if (tabExpress.getActiveTab().key !== 'grid') {
  29456. // SQL 模式
  29457. sqleditor.insertText(field + '=');
  29458. }
  29459. else {
  29460. // 表格模式
  29461. expressGrid.appendEditRow({
  29462. field: field,
  29463. operator: '=',
  29464. value: defaultValue,
  29465. remark: '',
  29466. });
  29467. _$2.defer(function () {
  29468. gridChanged(me, expressGrid);
  29469. });
  29470. }
  29471. }
  29472. },
  29473. },
  29474. {
  29475. region: 'center',
  29476. xtype: 'tabpanel',
  29477. reference: reference + '_tab',
  29478. tabPosition: 'bottom',
  29479. listeners: {
  29480. afterrender: function (sender) {
  29481. var scope = lookupScope(me);
  29482. var value = scope.viewModel.get(me.config.bindValue);
  29483. // sql 转换为 grid
  29484. try {
  29485. var list_1 = parseSqlToGrid(value);
  29486. _$2.defer(function () {
  29487. var grid = me.down('yvgrid');
  29488. grid.setData(list_1);
  29489. });
  29490. }
  29491. catch (e) {
  29492. console.error(e);
  29493. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29494. var tabSql = sender.down('sqleditor');
  29495. sender.setActiveTab(tabSql);
  29496. }
  29497. },
  29498. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29499. var scope = lookupScope(me);
  29500. var value = scope.viewModel.get(me.config.bindValue);
  29501. if (newCard.key === 'grid') {
  29502. // sql 转换为 grid
  29503. try {
  29504. var list_2 = parseSqlToGrid(value);
  29505. _$2.defer(function () {
  29506. var grid = me.down('yvgrid');
  29507. grid.setData(list_2);
  29508. });
  29509. return true;
  29510. }
  29511. catch (e) {
  29512. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29513. console.error(e);
  29514. return false;
  29515. }
  29516. }
  29517. else if (newCard.key === 'sql') {
  29518. // grid 转换为 sql
  29519. _$2.defer(function () {
  29520. var editor = me.down('sqleditor');
  29521. editor.setValue(value);
  29522. });
  29523. return true;
  29524. }
  29525. }
  29526. },
  29527. items: [
  29528. {
  29529. title: '表格模式',
  29530. key: 'grid',
  29531. xtype: 'yvgrid',
  29532. _mode: 'select',
  29533. reference: reference + '_grid',
  29534. hideFootbar: true,
  29535. pagination: false,
  29536. tbar: [
  29537. {
  29538. xtype: 'button',
  29539. text: '删除',
  29540. iconCls: 'x-fa fa-minus-circle',
  29541. cls: 'ext-btn-danger',
  29542. bind: {
  29543. disabled: '{!' + reference + '_grid.selection}',
  29544. },
  29545. listeners: {
  29546. click: function (sender) {
  29547. var grid = sender.up('yvgrid');
  29548. removeGridRow(grid);
  29549. gridChanged(me, grid);
  29550. }
  29551. },
  29552. },
  29553. ],
  29554. store: {},
  29555. listeners: {
  29556. editfinish: function (sender) {
  29557. gridChanged(me, sender);
  29558. },
  29559. },
  29560. columns: [
  29561. {
  29562. dataIndex: 'field',
  29563. header: '字段', sortable: false, menuDisabled: true,
  29564. width: 190,
  29565. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  29566. var column = context.column;
  29567. var propertyConfig = me.config.propertyConfig;
  29568. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29569. var field = record.get('field');
  29570. if (field) {
  29571. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29572. if (idx >= 0) {
  29573. var meta = propertyConfig[idx];
  29574. return meta.text;
  29575. }
  29576. }
  29577. return value;
  29578. }
  29579. },
  29580. {
  29581. dataIndex: 'operator',
  29582. header: '运算符', sortable: false, menuDisabled: true,
  29583. dict: 'operator',
  29584. width: 65,
  29585. editor: { xtype: 'combo' },
  29586. },
  29587. {
  29588. dataIndex: 'value',
  29589. header: '值', sortable: false, menuDisabled: true,
  29590. flex: 1,
  29591. getEditor: function (record) {
  29592. var column = this;
  29593. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  29594. var propertyConfig = me.config.propertyConfig;
  29595. var field = record.get('field');
  29596. if (!field) {
  29597. // 没有填 propertyName
  29598. return;
  29599. }
  29600. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29601. if (idx < 0) {
  29602. console.error('没有找到 field=' + field + ". propertyConfig");
  29603. return;
  29604. }
  29605. var meta = propertyConfig[idx];
  29606. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  29607. return new Ext.grid.CellEditor({
  29608. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  29609. });
  29610. }
  29611. return new Ext.grid.CellEditor({
  29612. field: __assign({ dict: meta.dict }, meta.editor)
  29613. });
  29614. },
  29615. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  29616. var column = context.column;
  29617. var grid = _$2.get(view, 'ownerGrid');
  29618. var propertyConfig = me.config.propertyConfig;
  29619. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29620. var field = record.get('field');
  29621. if (field) {
  29622. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  29623. if (idx >= 0) {
  29624. var meta = propertyConfig[idx];
  29625. var dictName = _$2.get(meta, 'dict');
  29626. if (dictName && window['DICT_CACHE'][dictName]) {
  29627. var dict_1 = window['DICT_CACHE'][dictName];
  29628. var valueText_1 = [];
  29629. _$2.forEach(_$2.split(valueList, ','), function (value) {
  29630. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  29631. if (idxKv >= 0) {
  29632. valueText_1.push(dict_1[idxKv].text);
  29633. }
  29634. else {
  29635. valueText_1.push(value);
  29636. }
  29637. });
  29638. return valueText_1.join(',');
  29639. }
  29640. }
  29641. }
  29642. return valueList;
  29643. },
  29644. },
  29645. ]
  29646. },
  29647. {
  29648. title: 'SQL模式',
  29649. key: 'sql',
  29650. xtype: 'sqleditor',
  29651. reference: reference + '_sql',
  29652. listeners: {
  29653. change: function (sender) {
  29654. var scope = lookupScope(me);
  29655. // 保存 editor 写入的值
  29656. scope.viewModel.set(me.config.bindValue, sender.getValue());
  29657. }
  29658. }
  29659. },
  29660. ]
  29661. }
  29662. ] });
  29663. this.superclass.constructor.call(this, newConfig);
  29664. },
  29665. initComponent: function () {
  29666. // 货位条件树
  29667. var me = this;
  29668. me.superclass.initComponent.apply(this, arguments);
  29669. var tree = this.down('yvtree');
  29670. var config = me.config;
  29671. tree.setRootNode(buildConfigTree(config.propertyConfig));
  29672. },
  29673. });
  29674. function gridChanged(me, grid) {
  29675. var data = grid.getDataRows();
  29676. var propertyConfig = me.config.propertyConfig;
  29677. var bindValue = me.config.bindValue;
  29678. var scope = lookupScope(me);
  29679. var sql = parseGridToSql(data);
  29680. scope.viewModel.set(bindValue, sql);
  29681. }
  29682. /**
  29683. * 用于从 propertyConfig 解析出树形结构
  29684. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  29685. * ->
  29686. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  29687. */
  29688. function buildConfigTree(propertyConfig) {
  29689. var root = {
  29690. expanded: true,
  29691. leaf: false,
  29692. children: []
  29693. };
  29694. var categoryObj = {};
  29695. var cfgList = propertyConfig;
  29696. _$2.forEach(cfgList, function (cfg) {
  29697. var cateNode = categoryObj[cfg.category];
  29698. if (!cateNode) {
  29699. cateNode = {
  29700. text: cfg.category, expanded: true, leaf: false,
  29701. children: []
  29702. };
  29703. categoryObj[cfg.category] = cateNode;
  29704. root.children.push(cateNode);
  29705. }
  29706. cateNode.children.push({
  29707. text: cfg.text,
  29708. field: cfg.field,
  29709. operator: cfg.operator,
  29710. defaultValue: cfg.defaultValue,
  29711. leaf: true,
  29712. });
  29713. });
  29714. return root;
  29715. }
  29716. /**
  29717. * 将表格变成 SQL where语句 [
  29718. * {field: 'f1', value: 1, operator: '='}
  29719. * {field: 'f2', value: 2, operator: '='}
  29720. * {field: 'f3', value: '3', operator: '>='}
  29721. * {field: 'f4', value: 4, operator: '='}
  29722. * ]
  29723. * ->
  29724. * f1=v1 and f2=v2
  29725. */
  29726. function parseGridToSql(list) {
  29727. var sqls = [];
  29728. _$2.forEach(list, function (i) {
  29729. var _a;
  29730. if (i.operator === 'in') {
  29731. sqls.push(i.field + ' in (' + (i.value) + ')');
  29732. }
  29733. else if (i.operator === 'notIn') {
  29734. sqls.push(i.field + ' not in (' + (i.value) + ')');
  29735. }
  29736. else {
  29737. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  29738. }
  29739. });
  29740. return sqls.join(' AND ');
  29741. }
  29742. /**
  29743. * 将 SQL 语句的 where 片段变成表格
  29744. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  29745. * @return [
  29746. {field: 'f1', value: 1, operator: '='}
  29747. {field: 'f2', value: 2, operator: '='}
  29748. {field: 'f3', value: '3', operator: '>='}
  29749. {field: 'f4', value: 4, operator: '='}
  29750. ]
  29751. */
  29752. function parseSqlToGrid(sql) {
  29753. if (!sql || !_$2.trim(sql)) {
  29754. return [];
  29755. }
  29756. var parser = new window['NodeSQLParser'].Parser();
  29757. var ast = parser.astify('select * from dual where ' + sql);
  29758. var ret = [];
  29759. exp(ast.where, ret);
  29760. return ret;
  29761. }
  29762. function exp(ast, ret) {
  29763. if (ast.type === 'binary_expr') {
  29764. if (_$2.toUpper(ast.operator) === 'AND') {
  29765. if (ast.left.type === 'binary_expr') {
  29766. exp(ast.left, ret);
  29767. }
  29768. if (ast.right.type === 'binary_expr') {
  29769. exp(ast.right, ret);
  29770. }
  29771. }
  29772. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  29773. if (ast.left.type === 'column_ref') {
  29774. if (ast.right.type === 'number' ||
  29775. ast.right.type === 'single_quote_string' ||
  29776. ast.right.type === 'double_quote_string') {
  29777. // 具体值相等
  29778. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  29779. }
  29780. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  29781. && ast.right.type === 'expr_list') {
  29782. // in / not in
  29783. var valueList_1 = [];
  29784. _$2.forEach(ast.right.value, function (item) {
  29785. valueList_1.push(item.value);
  29786. });
  29787. var operator = void 0;
  29788. if (_$2.toUpper(ast.operator) === 'IN') {
  29789. operator = 'in';
  29790. }
  29791. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  29792. operator = 'notIn';
  29793. }
  29794. ret.push({
  29795. field: ast.left.column, value: valueList_1.join(','),
  29796. operator: operator
  29797. });
  29798. }
  29799. else {
  29800. throw new Error('ast.right must is value.');
  29801. }
  29802. }
  29803. else {
  29804. throw new Error('ast.left must is column_ref.');
  29805. }
  29806. }
  29807. else {
  29808. // 必须用 AND 条件符匹配
  29809. throw new Error('ast.operator must is "AND / =".');
  29810. }
  29811. }
  29812. else {
  29813. throw new Error('ast.type must is "binary_expr".');
  29814. }
  29815. }
  29816. /**
  29817. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  29818. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  29819. {
  29820. type: 'binary_expr',
  29821. operator: 'AND',
  29822. left: {
  29823. type: 'binary_expr',
  29824. operator: 'AND',
  29825. left: {
  29826. type: 'binary_expr',
  29827. operator: 'AND',
  29828. left: {
  29829. type: 'binary_expr',
  29830. operator: 'AND',
  29831. left: {
  29832. type: 'binary_expr',
  29833. operator: '=',
  29834. left: {
  29835. type: 'column_ref',
  29836. table: null,
  29837. column: 'f1'
  29838. },
  29839. right: {
  29840. type: 'number',
  29841. value: 1
  29842. }
  29843. },
  29844. right: {
  29845. type: 'binary_expr',
  29846. operator: '=',
  29847. left: {
  29848. type: 'column_ref',
  29849. table: null,
  29850. column: 'f2'
  29851. },
  29852. right: {
  29853. type: 'number',
  29854. value: 2
  29855. }
  29856. }
  29857. },
  29858. right: {
  29859. type: 'binary_expr',
  29860. operator: '=',
  29861. left: {
  29862. type: 'column_ref',
  29863. table: null,
  29864. column: 'f3'
  29865. },
  29866. right: {
  29867. type: 'single_quote_string',
  29868. value: '3'
  29869. }
  29870. }
  29871. },
  29872. right: {
  29873. type: 'binary_expr',
  29874. operator: '>=',
  29875. left: {
  29876. type: 'column_ref',
  29877. table: null,
  29878. column: 'f4'
  29879. },
  29880. right: {
  29881. type: 'number',
  29882. value: 4
  29883. }
  29884. }
  29885. },
  29886. right: {
  29887. type: 'binary_expr',
  29888. operator: '<',
  29889. left: {
  29890. type: 'column_ref',
  29891. table: null,
  29892. column: 'f4'
  29893. },
  29894. right: {
  29895. type: 'number',
  29896. value: 3
  29897. }
  29898. }
  29899. }
  29900. * */
  29901. }
  29902. //# sourceMappingURL=SqlComplex.js.map
  29903. function initParamComplex () {
  29904. Ext.define('Yvan.ParamComplex', {
  29905. extend: 'Ext.panel.Panel',
  29906. xtype: 'paramcomplex',
  29907. alias: 'widget.paramcomplex',
  29908. getSqlExpress: function () {
  29909. },
  29910. constructor: function (config) {
  29911. var reference = config.reference;
  29912. var me = this;
  29913. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29914. {
  29915. region: 'west',
  29916. width: 280,
  29917. border: false,
  29918. split: true,
  29919. reference: reference + '_tree',
  29920. xtype: 'yvtree',
  29921. hideRefresh: true,
  29922. hideExpand: true,
  29923. hideCollapse: true,
  29924. listeners: {
  29925. itemdblclick: function (sender, record, item, index, e) {
  29926. var field = record.get('field');
  29927. var defaultValue = record.get('defaultValue');
  29928. if (!field) {
  29929. return;
  29930. }
  29931. var tabExpress = me.down('tabpanel');
  29932. var sqleditor = me.down('sqleditor');
  29933. var expressGrid = me.down('yvgrid');
  29934. if (tabExpress.getActiveTab().key !== 'grid') {
  29935. // SQL 模式
  29936. sqleditor.insertText(field + '=');
  29937. }
  29938. else {
  29939. // 表格模式
  29940. expressGrid.appendEditRow({
  29941. field: field,
  29942. operator: '=',
  29943. value: defaultValue,
  29944. remark: '',
  29945. });
  29946. _$2.defer(function () {
  29947. gridChanged(me, expressGrid);
  29948. });
  29949. }
  29950. }
  29951. },
  29952. },
  29953. {
  29954. region: 'center',
  29955. xtype: 'tabpanel',
  29956. reference: reference + '_tab',
  29957. tabPosition: 'bottom',
  29958. listeners: {
  29959. afterrender: function (sender) {
  29960. var scope = lookupScope(me);
  29961. var value = scope.viewModel.get(me.config.bindValue);
  29962. // sql 转换为 grid
  29963. try {
  29964. var list_1 = parseParamToGrid(value);
  29965. _$2.defer(function () {
  29966. var grid = me.down('yvgrid');
  29967. grid.setData(list_1);
  29968. });
  29969. }
  29970. catch (e) {
  29971. console.error(e);
  29972. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29973. var tabSql = sender.down('sqleditor');
  29974. sender.setActiveTab(tabSql);
  29975. }
  29976. },
  29977. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29978. var scope = lookupScope(me);
  29979. var value = scope.viewModel.get(me.config.bindValue);
  29980. if (newCard.key === 'grid') {
  29981. // sql 转换为 grid
  29982. try {
  29983. var list_2 = parseParamToGrid(value);
  29984. _$2.defer(function () {
  29985. var grid = me.down('yvgrid');
  29986. grid.setData(list_2);
  29987. });
  29988. return true;
  29989. }
  29990. catch (e) {
  29991. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29992. console.error(e);
  29993. return false;
  29994. }
  29995. }
  29996. else if (newCard.key === 'sql') {
  29997. // grid 转换为 sql
  29998. _$2.defer(function () {
  29999. var editor = me.down('sqleditor');
  30000. editor.setValue(value);
  30001. });
  30002. return true;
  30003. }
  30004. }
  30005. },
  30006. items: [
  30007. {
  30008. title: '表格模式',
  30009. key: 'grid',
  30010. xtype: 'yvgrid',
  30011. _mode: 'select',
  30012. reference: reference + '_grid',
  30013. hideFootbar: true,
  30014. pagination: false,
  30015. tbar: [
  30016. {
  30017. xtype: 'button',
  30018. text: '删除',
  30019. iconCls: 'x-fa fa-minus-circle',
  30020. cls: 'ext-btn-danger',
  30021. bind: {
  30022. disabled: '{!' + reference + '_grid.selection}',
  30023. },
  30024. listeners: {
  30025. click: function (sender) {
  30026. var grid = sender.up('yvgrid');
  30027. removeGridRow(grid);
  30028. gridChanged(me, grid);
  30029. }
  30030. },
  30031. },
  30032. ],
  30033. store: {},
  30034. listeners: {
  30035. editfinish: function (sender) {
  30036. gridChanged(me, sender);
  30037. },
  30038. },
  30039. columns: [
  30040. {
  30041. dataIndex: 'field',
  30042. header: '字段', sortable: false, menuDisabled: true,
  30043. width: 190,
  30044. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  30045. var column = context.column;
  30046. var propertyConfig = me.config.propertyConfig;
  30047. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30048. var field = record.get('field');
  30049. if (field) {
  30050. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30051. if (idx >= 0) {
  30052. var meta = propertyConfig[idx];
  30053. return meta.text;
  30054. }
  30055. }
  30056. return value;
  30057. }
  30058. },
  30059. {
  30060. dataIndex: 'value',
  30061. header: '值', sortable: false, menuDisabled: true,
  30062. flex: 1,
  30063. getEditor: function (record) {
  30064. var column = this;
  30065. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  30066. var propertyConfig = me.config.propertyConfig;
  30067. var field = record.get('field');
  30068. if (!field) {
  30069. // 没有填 propertyName
  30070. return;
  30071. }
  30072. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30073. if (idx < 0) {
  30074. console.error('没有找到 field=' + field + ". propertyConfig");
  30075. return;
  30076. }
  30077. var meta = propertyConfig[idx];
  30078. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  30079. return new Ext.grid.CellEditor({
  30080. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  30081. });
  30082. }
  30083. return new Ext.grid.CellEditor({
  30084. field: __assign({ dict: meta.dict }, meta.editor)
  30085. });
  30086. },
  30087. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  30088. var column = context.column;
  30089. var grid = _$2.get(view, 'ownerGrid');
  30090. var propertyConfig = me.config.propertyConfig;
  30091. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30092. var field = record.get('field');
  30093. if (field) {
  30094. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  30095. if (idx >= 0) {
  30096. var meta = propertyConfig[idx];
  30097. var dictName = _$2.get(meta, 'dict');
  30098. if (dictName && window['DICT_CACHE'][dictName]) {
  30099. var dict_1 = window['DICT_CACHE'][dictName];
  30100. var valueText_1 = [];
  30101. _$2.forEach(_$2.split(valueList, ','), function (value) {
  30102. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  30103. if (idxKv >= 0) {
  30104. valueText_1.push(dict_1[idxKv].text);
  30105. }
  30106. else {
  30107. valueText_1.push(value);
  30108. }
  30109. });
  30110. return valueText_1.join(',');
  30111. }
  30112. }
  30113. }
  30114. return valueList;
  30115. },
  30116. },
  30117. ]
  30118. },
  30119. {
  30120. title: '文本模式',
  30121. key: 'sql',
  30122. xtype: 'sqleditor',
  30123. reference: reference + '_sql',
  30124. listeners: {
  30125. change: function (sender) {
  30126. var scope = lookupScope(me);
  30127. // 保存 editor 写入的值
  30128. scope.viewModel.set(me.config.bindValue, sender.getValue());
  30129. }
  30130. }
  30131. },
  30132. ]
  30133. }
  30134. ] });
  30135. this.superclass.constructor.call(this, newConfig);
  30136. },
  30137. initComponent: function () {
  30138. // 货位条件树
  30139. var me = this;
  30140. me.superclass.initComponent.apply(this, arguments);
  30141. var tree = this.down('yvtree');
  30142. var config = me.config;
  30143. tree.setRootNode(buildConfigTree(config.propertyConfig));
  30144. },
  30145. });
  30146. function gridChanged(me, grid) {
  30147. var data = grid.getDataRows();
  30148. var propertyConfig = me.config.propertyConfig;
  30149. var bindValue = me.config.bindValue;
  30150. var scope = lookupScope(me);
  30151. var sql = parseGridToParam(data);
  30152. scope.viewModel.set(bindValue, sql);
  30153. }
  30154. /**
  30155. * 用于从 propertyConfig 解析出树形结构
  30156. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  30157. * ->
  30158. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  30159. */
  30160. function buildConfigTree(propertyConfig) {
  30161. var root = {
  30162. expanded: true,
  30163. leaf: false,
  30164. children: []
  30165. };
  30166. var categoryObj = {};
  30167. var cfgList = propertyConfig;
  30168. _$2.forEach(cfgList, function (cfg) {
  30169. var cateNode = categoryObj[cfg.category];
  30170. if (!cateNode) {
  30171. cateNode = {
  30172. text: cfg.category, expanded: true, leaf: false,
  30173. children: []
  30174. };
  30175. categoryObj[cfg.category] = cateNode;
  30176. root.children.push(cateNode);
  30177. }
  30178. cateNode.children.push({
  30179. text: cfg.text,
  30180. field: cfg.field,
  30181. operator: cfg.operator,
  30182. defaultValue: cfg.defaultValue,
  30183. leaf: true,
  30184. });
  30185. });
  30186. return root;
  30187. }
  30188. /**
  30189. * 将表格变成参数语句 [
  30190. * {field: 'f1', value: 1}
  30191. * {field: 'f2', value: 2}
  30192. * {field: 'f3', value: '3'}
  30193. * {field: 'f4', value: 4}
  30194. * ]
  30195. * ->
  30196. * f1=v1, f2=v2
  30197. */
  30198. function parseGridToParam(list) {
  30199. var sqls = [];
  30200. _$2.forEach(list, function (i) {
  30201. sqls.push(i.field + '=' + (i.value));
  30202. });
  30203. return sqls.join('; ');
  30204. }
  30205. /**
  30206. * 将 分号分割的的参数设置 变成表格
  30207. * @param param a=1; b=2; c='3'
  30208. * @return [
  30209. {field: 'a', value: 1}
  30210. {field: 'b', value: 2}
  30211. {field: 'c', value: '3'}
  30212. ]
  30213. */
  30214. function parseParamToGrid(param) {
  30215. if (!param || !_$2.trim(param)) {
  30216. return [];
  30217. }
  30218. var ret = [];
  30219. var sp = _$2.split(param, ';');
  30220. _$2.forEach(sp, function (v) {
  30221. var vi = _$2.indexOf(v, '=');
  30222. var field = _$2.trim(v.substr(0, vi));
  30223. var value = eval(v.substr(vi + 1));
  30224. ret.push({ field: field, value: value });
  30225. });
  30226. return ret;
  30227. }
  30228. }
  30229. //# sourceMappingURL=ParamComplex.js.map
  30230. function initSqlEditor$1 () {
  30231. Ext.define('com.yvan.studio.SqlEditor', {
  30232. extend: 'Ext.panel.Panel',
  30233. alias: 'widget.sqleditor',
  30234. xtype: 'sqleditor',
  30235. layout: 'fit',
  30236. border: false,
  30237. html: "<div class=\"editor\"/>",
  30238. config: {
  30239. value: ''
  30240. },
  30241. codeChange: undefined,
  30242. isChangeFromOuter: false,
  30243. setCode: function (value) {
  30244. var _this = this;
  30245. this.code = value;
  30246. this.value = value;
  30247. _$2.defer(function () {
  30248. _this.isChangeFromOuter = true;
  30249. if (_this.editor) {
  30250. _this.editor.setValue(value);
  30251. }
  30252. });
  30253. },
  30254. getCode: function () {
  30255. return this.getValue();
  30256. },
  30257. updateOptions: function (options) {
  30258. if (this.editor && options) {
  30259. this.editor.updateOptions(options);
  30260. }
  30261. },
  30262. getValue: function () {
  30263. if (!this.editor) {
  30264. return this.code;
  30265. }
  30266. return this.editor.getValue();
  30267. },
  30268. applyPosition: function () {
  30269. var _this = this;
  30270. if (this.autoFocusMethod) {
  30271. if (this.editor) {
  30272. _$2.defer(function () {
  30273. if (_this.autoFocusStartLine) {
  30274. _this.editor.setPosition({
  30275. lineNumber: _this.autoFocusStartLine,
  30276. column: _this.autoFocusStartColumn
  30277. });
  30278. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30279. }
  30280. _this.editor.focus();
  30281. });
  30282. delete this.autoFocusMethod;
  30283. }
  30284. }
  30285. this.editor.layout();
  30286. },
  30287. insertText: function (text) {
  30288. var editor = this.editor;
  30289. var position = editor.getPosition();
  30290. editor.executeEdits('', [
  30291. {
  30292. range: {
  30293. startLineNumber: position.lineNumber,
  30294. startColumn: position.column,
  30295. endLineNumber: position.lineNumber,
  30296. endColumn: position.column
  30297. },
  30298. text: text
  30299. }
  30300. ]);
  30301. },
  30302. setValue: function (value, fromEditor) {
  30303. this.setCode(value);
  30304. var me = this;
  30305. if (me.value === value) {
  30306. // 值相等,不需要变化
  30307. return;
  30308. }
  30309. if (fromEditor !== true && me.editor) {
  30310. // 不是来源于编辑器的变化,才设置编辑器的值
  30311. me.editor.setValue(value);
  30312. }
  30313. // 通知mixins setValue
  30314. me.value = value;
  30315. me.fireEvent('change', value);
  30316. },
  30317. initComponent: function () {
  30318. var that = this;
  30319. this.superclass.initComponent.call(this);
  30320. that.on({
  30321. resize: function () {
  30322. if (that.editor) {
  30323. that.editor.layout();
  30324. }
  30325. },
  30326. destory: function () {
  30327. if (that.editor) {
  30328. that.editor.dispose();
  30329. delete that.editor;
  30330. }
  30331. },
  30332. afterrender: function (sender) {
  30333. var $dom = $(that.el.dom).find('.editor');
  30334. attach_2($dom[0], {
  30335. value: that.code
  30336. }).then(function (editor) {
  30337. that.editor = editor;
  30338. that.applyPosition();
  30339. that.editor.onDidChangeModelContent(function (e) {
  30340. that.fireEvent('change', that.editor, e);
  30341. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30342. that.codeChange(that.editor.getValue(), that.name, e);
  30343. }
  30344. that.isChangeFromOuter = false;
  30345. });
  30346. });
  30347. }
  30348. });
  30349. }
  30350. });
  30351. function attach_2(element, opts) {
  30352. if (!window['monaco']) {
  30353. return;
  30354. }
  30355. var monaco = window['monaco'];
  30356. return new Promise(function (resolve) {
  30357. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  30358. enabled: false
  30359. } }));
  30360. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  30361. // const sql = editor.getValue()
  30362. // if (_.trim(sql).length > 0) {
  30363. // editor.setValue(format(sql, {
  30364. // indent: ' ',
  30365. // uppercase: true,
  30366. // }))
  30367. // }
  30368. // })
  30369. editor.onKeyUp(function (e) {
  30370. // console.log(e)
  30371. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30372. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30373. }
  30374. });
  30375. resolve(editor);
  30376. });
  30377. }
  30378. }
  30379. //# sourceMappingURL=SqlEditor.js.map
  30380. function initJsonEditor$1 () {
  30381. Ext.define('com.yvan.studio.JsonEditor', {
  30382. extend: 'Ext.panel.Panel',
  30383. alias: 'widget.jsoneditor',
  30384. xtype: 'jsoneditor',
  30385. layout: 'fit',
  30386. border: false,
  30387. html: "<div class=\"editor\"/>",
  30388. autoFocusMethod: true,
  30389. autoFocusStartLine: 0,
  30390. autoFocusStartColumn: 0,
  30391. codeChange: undefined,
  30392. funcArr: [],
  30393. modulePage: null,
  30394. isChangeFromOuter: false,
  30395. name: "",
  30396. /**
  30397. * 设置代码
  30398. */
  30399. setCode: function (value) {
  30400. var _this = this;
  30401. this.code = value;
  30402. _$2.defer(function () {
  30403. _this.isChangeFromOuter = true;
  30404. if (_this.editor) {
  30405. _this.editor.setValue(value);
  30406. }
  30407. });
  30408. },
  30409. updateOptions: function (options) {
  30410. if (this.editor && options) {
  30411. this.editor.updateOptions(options);
  30412. }
  30413. },
  30414. setLanguage: function (lang) {
  30415. if (!window['monaco']) {
  30416. return;
  30417. }
  30418. var monaco = window['monaco'];
  30419. if (this.editor && lang) {
  30420. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  30421. }
  30422. },
  30423. getCode: function () {
  30424. var _a;
  30425. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30426. },
  30427. applyPosition: function () {
  30428. var _this = this;
  30429. if (this.autoFocusMethod) {
  30430. if (this.editor) {
  30431. _$2.defer(function () {
  30432. if (_this.autoFocusStartLine) {
  30433. _this.editor.setPosition({
  30434. lineNumber: _this.autoFocusStartLine,
  30435. column: _this.autoFocusStartColumn
  30436. });
  30437. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30438. }
  30439. _this.editor.focus();
  30440. });
  30441. delete this.autoFocusMethod;
  30442. }
  30443. }
  30444. this.editor.layout();
  30445. },
  30446. initComponent: function () {
  30447. var that = this;
  30448. this.superclass.initComponent.apply(this, arguments);
  30449. this.on({
  30450. resize: function (sender, width, height) {
  30451. if (that.editor) {
  30452. that.editor.layout();
  30453. }
  30454. },
  30455. destory: function () {
  30456. if (that.editor) {
  30457. that.editor.dispose();
  30458. delete that.editor;
  30459. }
  30460. },
  30461. afterrender: function (sender) {
  30462. var $dom = $(that.el.dom).find('.editor');
  30463. attach_116($dom[0], {
  30464. value: that.code
  30465. }).then(function (editor) {
  30466. that.editor = editor;
  30467. that.applyPosition();
  30468. that.editor.onDidChangeModelContent(function (e) {
  30469. that.fireEvent('change', that.editor, e);
  30470. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30471. that.codeChange(that.editor.getValue(), that.name, e);
  30472. }
  30473. that.isChangeFromOuter = false;
  30474. });
  30475. });
  30476. }
  30477. });
  30478. },
  30479. });
  30480. function attach_116(element, opts) {
  30481. if (!window['monaco']) {
  30482. return;
  30483. }
  30484. var monaco = window['monaco'];
  30485. return new Promise(function (resolve) {
  30486. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  30487. enabled: false
  30488. } }));
  30489. editor.onKeyUp(function (e) {
  30490. // console.log(e)
  30491. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30492. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30493. }
  30494. });
  30495. resolve(editor);
  30496. });
  30497. }
  30498. }
  30499. //# sourceMappingURL=JsonEditor.js.map
  30500. function initJsEditor$1 () {
  30501. Ext.define('com.yvan.studio.JsEditor', {
  30502. extend: 'Ext.panel.Panel',
  30503. alias: 'widget.jseditor',
  30504. xtype: 'jseditor',
  30505. layout: 'fit',
  30506. border: false,
  30507. html: "<div class=\"editor\"/>",
  30508. autoFocusMethod: true,
  30509. autoFocusStartLine: 0,
  30510. autoFocusStartColumn: 0,
  30511. codeChange: undefined,
  30512. funcArr: [],
  30513. modulePage: null,
  30514. isChangeFromOuter: false,
  30515. name: "",
  30516. /**
  30517. * 设置代码
  30518. */
  30519. setCode: function (value) {
  30520. var _this = this;
  30521. this.code = value;
  30522. _$2.defer(function () {
  30523. _this.isChangeFromOuter = true;
  30524. if (_this.editor) {
  30525. _this.editor.setValue(value);
  30526. if (_this.name === "controllerEditor") {
  30527. _this.funcArr = _this.getAllFunction();
  30528. }
  30529. }
  30530. });
  30531. },
  30532. getCode: function () {
  30533. var _a;
  30534. if (!this.editor) {
  30535. return this.code;
  30536. }
  30537. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30538. },
  30539. applyPosition: function () {
  30540. var _this = this;
  30541. if (this.autoFocusMethod) {
  30542. if (this.editor) {
  30543. _$2.defer(function () {
  30544. if (_this.autoFocusStartLine) {
  30545. _this.editor.setPosition({
  30546. lineNumber: _this.autoFocusStartLine,
  30547. column: _this.autoFocusStartColumn
  30548. });
  30549. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30550. }
  30551. _this.editor.focus();
  30552. });
  30553. delete this.autoFocusMethod;
  30554. }
  30555. }
  30556. this.editor.layout();
  30557. },
  30558. initComponent: function () {
  30559. var that = this;
  30560. this.superclass.initComponent.apply(this, arguments);
  30561. this.on({
  30562. resize: function (sender, width, height) {
  30563. if (that.editor) {
  30564. that.editor.layout();
  30565. }
  30566. },
  30567. destory: function () {
  30568. if (that.editor) {
  30569. that.editor.dispose();
  30570. delete that.editor;
  30571. }
  30572. },
  30573. afterrender: function () {
  30574. var $dom = $(that.el.dom).find('.editor');
  30575. attach_1($dom[0], {
  30576. value: that.code
  30577. }).then(function (editor) {
  30578. that.editor = editor;
  30579. that.applyPosition();
  30580. that.editor.onDidChangeModelContent(function (e) {
  30581. that.fireEvent('change', that.editor, e);
  30582. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30583. that.codeChange(that.editor.getValue(), that.name, e);
  30584. }
  30585. that.isChangeFromOuter = false;
  30586. });
  30587. });
  30588. }
  30589. });
  30590. },
  30591. getAllFunction: function () {
  30592. var funcArr = [];
  30593. var ast = window['YvanUI'].recast.parse(this.code);
  30594. if (ast && ast.program && ast.program.body) {
  30595. if (Array.isArray(ast.program.body)) {
  30596. for (var i = 0; i < ast.program.body.length; i++) {
  30597. var m = ast.program.body[i];
  30598. if (m.type === "ExportDefaultDeclaration") {
  30599. if (m.declaration.type === "ClassDeclaration") {
  30600. if (m.declaration.body.type === "ClassBody") {
  30601. if (Array.isArray(m.declaration.body.body)) {
  30602. for (var j = 0; j < m.declaration.body.body.length; j++) {
  30603. var ob = m.declaration.body.body[j];
  30604. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  30605. var funcItem = { name: ob.key.name, args: [] };
  30606. if (Array.isArray(ob.value.params)) {
  30607. for (var k = 0; k < ob.value.params.length; k++) {
  30608. var p = ob.value.params[k];
  30609. funcItem.args.push(p.name);
  30610. }
  30611. }
  30612. funcArr.push(funcItem);
  30613. }
  30614. }
  30615. }
  30616. }
  30617. }
  30618. }
  30619. }
  30620. }
  30621. }
  30622. return funcArr;
  30623. }
  30624. });
  30625. var isInited = false;
  30626. function attach_1(element, opts) {
  30627. if (!window['monaco']) {
  30628. return;
  30629. }
  30630. var monaco = window['monaco'];
  30631. return new Promise(function (resolve) {
  30632. if (!isInited) {
  30633. isInited = true;
  30634. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  30635. noSemanticValidation: true,
  30636. noSyntaxValidation: false
  30637. });
  30638. // compiler options
  30639. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  30640. target: monaco.languages.typescript.ScriptTarget.ES2016,
  30641. allowNonTsExtensions: true,
  30642. });
  30643. // extra libraries
  30644. var libSource = [
  30645. 'declare class Facts {',
  30646. ' /**',
  30647. ' * Returns the next fact',
  30648. ' */',
  30649. ' static next():string',
  30650. ' static next222():string',
  30651. '}',
  30652. "\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 ",
  30653. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  30654. ].join('\n');
  30655. var libUri = 'file:///index.d.ts';
  30656. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  30657. // When resolving definitions and references, the editor will try to use created models.
  30658. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  30659. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  30660. }
  30661. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  30662. resolve(editor);
  30663. });
  30664. }
  30665. }
  30666. //# sourceMappingURL=JsEditor.js.map
  30667. function initClipboard () {
  30668. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  30669. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  30670. Ext.grid.plugin.Clipboard.override({
  30671. getCellData: function (format, erase) {
  30672. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  30673. if (selection) {
  30674. selection.eachCell(function (cellContext) {
  30675. column = cellContext.column;
  30676. view = cellContext.column.getView();
  30677. record = cellContext.record;
  30678. // Do not copy the check column or row numberer column
  30679. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  30680. return;
  30681. }
  30682. if (lastRecord !== record) {
  30683. lastRecord = record;
  30684. ret.push(row = []);
  30685. }
  30686. dataIndex = column.dataIndex;
  30687. // 记录原始数据
  30688. var rData = record.data[dataIndex];
  30689. if (isRaw) {
  30690. data = record.data[dataIndex];
  30691. }
  30692. else {
  30693. // Try to access the view node.
  30694. viewNode = view.all.item(cellContext.rowIdx);
  30695. // If we could not, it's because it's outside of the rendered block -
  30696. // recreate it.
  30697. if (!viewNode) {
  30698. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  30699. }
  30700. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  30701. data = cell.innerHTML;
  30702. if (isText) {
  30703. data = Ext.util.Format.stripTags(data);
  30704. }
  30705. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  30706. data = data || rData;
  30707. }
  30708. row.push(data);
  30709. if (erase && dataIndex) {
  30710. record.set(dataIndex, null);
  30711. }
  30712. });
  30713. }
  30714. // See decode() comment below
  30715. return Ext.util.TSV.encode(ret, undefined, null);
  30716. },
  30717. getCells: function (format, erase) {
  30718. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  30719. if (selection) {
  30720. selection.eachCell(function (cellContext) {
  30721. record = cellContext.record;
  30722. if (lastRecord !== record) {
  30723. lastRecord = record;
  30724. ret.push(row = {
  30725. model: record.self,
  30726. fields: []
  30727. });
  30728. }
  30729. dataIndex = cellContext.column.dataIndex;
  30730. row.fields.push({
  30731. name: dataIndex,
  30732. value: record.data[dataIndex]
  30733. });
  30734. if (erase && dataIndex) {
  30735. record.set(dataIndex, null);
  30736. }
  30737. });
  30738. }
  30739. return ret;
  30740. },
  30741. getTextData: function (format, erase) {
  30742. return this.getCellData(format, erase);
  30743. },
  30744. putCellData: function (data, format) {
  30745. var _a;
  30746. 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 = {};
  30747. // If the view is not focused, use the first cell of the selection as the destination.
  30748. if (!destination && selected) {
  30749. selected.eachCell(function (c) {
  30750. destination = c;
  30751. return false;
  30752. });
  30753. }
  30754. if (destination) {
  30755. // Create a new Context based upon the outermost View.
  30756. // NavigationModel works on local views.
  30757. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  30758. // At that point, we can use navModel.getPosition()
  30759. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  30760. }
  30761. else {
  30762. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  30763. }
  30764. destinationStartColumn = destination.colIdx;
  30765. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  30766. row = values[sourceRowIdx];
  30767. // Collect new values in dataObject
  30768. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  30769. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  30770. continue;
  30771. }
  30772. dataIndex = destination.column.dataIndex;
  30773. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  30774. if (dataIndex) {
  30775. switch (format) {
  30776. // Raw field values
  30777. case 'raw':
  30778. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30779. break;
  30780. // Textual data with HTML tags stripped
  30781. case 'text':
  30782. {
  30783. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  30784. // 获取字典原始的value
  30785. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  30786. }
  30787. else {
  30788. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30789. }
  30790. break;
  30791. }
  30792. }
  30793. }
  30794. // If we are at the end of the destination row, break the column loop.
  30795. if (destination.colIdx === maxColIdx) {
  30796. break;
  30797. }
  30798. destination.setColumn(destination.colIdx + 1);
  30799. }
  30800. // Update the record in one go.
  30801. destination.record.set(dataObject);
  30802. // If we are at the end of the destination store, break the row loop.
  30803. if (destination.rowIdx === maxRowIdx) {
  30804. break;
  30805. }
  30806. // Jump to next row in destination
  30807. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  30808. }
  30809. },
  30810. putTextData: function (data, format) {
  30811. var _a, _b, _c;
  30812. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  30813. // 根据复制的行数自动添加新的行
  30814. 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;
  30815. if (selected.startCell.rowIdx + values.length >= dataLength) {
  30816. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  30817. this.cmp.getStore().add({});
  30818. }
  30819. }
  30820. this.putCellData(data, format);
  30821. },
  30822. });
  30823. }
  30824. //# sourceMappingURL=clipboard.js.map
  30825. function initDict$1 () {
  30826. var DICT_CACHE = window['DICT_CACHE'];
  30827. if (!DICT_CACHE) {
  30828. DICT_CACHE = {};
  30829. window['DICT_CACHE'] = DICT_CACHE;
  30830. }
  30831. DICT_CACHE.XTYPE = [
  30832. { id: 'datefield', text: '日期' },
  30833. { id: 'datetimefield', text: '日期时间' },
  30834. { id: 'textfield', text: '文本' },
  30835. { id: 'numberfield', text: '数字' },
  30836. { id: 'combo', text: '下拉框' },
  30837. ];
  30838. DICT_CACHE.operator = [
  30839. { id: '=', text: '=' },
  30840. { id: '>', text: '>' },
  30841. { id: '<', text: '<' },
  30842. { id: '>=', text: '>=' },
  30843. { id: '<=', text: '<=' },
  30844. { id: 'in', text: 'in' },
  30845. { id: 'notIn', text: 'notIn' },
  30846. ];
  30847. DICT_CACHE.GRID_MODE = [
  30848. { id: 'edit1', text: '单机编辑模式' },
  30849. { id: 'edit2', text: '双击编辑模式' },
  30850. { id: 'checkbox', text: '勾选' },
  30851. { id: 'checkonly', text: '只勾选' },
  30852. { id: 'select', text: '行选择模式' },
  30853. ];
  30854. DICT_CACHE.BOTH_SELECT = [
  30855. { id: 'N/A', text: '<无>' },
  30856. { id: 'textfield', text: '文本' },
  30857. { id: 'numberfield', text: '数字框' },
  30858. { id: 'datefield', text: '日期' },
  30859. { id: 'datetimefield', text: '日期时间' },
  30860. { id: 'combo', text: '下拉框' },
  30861. { id: 'combogrid', text: '下拉表' },
  30862. { id: 'checkbox', text: '勾选' },
  30863. ];
  30864. DICT_CACHE.ROW_LAYOUT = [
  30865. { id: 'flex', text: '按权重摆放' },
  30866. { id: 'hbox', text: '按宽度摆放' },
  30867. ];
  30868. DICT_CACHE.GRID_XTYPE = [
  30869. { id: 'N/A', text: '<无>' },
  30870. { id: 'textfield', text: '文本-textfield' },
  30871. { id: 'numberfield', text: '数字框-numberfield' },
  30872. { id: 'datefield', text: '日期-datefield' },
  30873. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30874. { id: 'combo', text: '下拉框-combo' },
  30875. { id: 'combogrid', text: '下拉表-combogrid' },
  30876. { id: 'checkbox', text: '勾选-checkbox' },
  30877. ];
  30878. DICT_CACHE.FORM_XTYPE = [
  30879. { id: 'N/A', text: '<无>' },
  30880. { id: 'textfield', text: '文本-textfield' },
  30881. { id: 'numberfield', text: '数字框-numberfield' },
  30882. { id: 'datefield', text: '日期-datefield' },
  30883. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30884. { id: 'combo', text: '下拉框-combo' },
  30885. { id: 'combogrid', text: '下拉表-combogrid' },
  30886. { id: 'checkbox', text: '勾选-checkbox' },
  30887. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  30888. ];
  30889. DICT_CACHE.GRID_FORMATTER = [
  30890. { id: 'N/A', text: '默认' },
  30891. { id: 'rownum', text: '序号-rownum' },
  30892. { id: 'button', text: '按钮-button' },
  30893. { id: 'checkbox', text: '勾选-checkbox' },
  30894. { id: 'progres', text: '进度条-progres' },
  30895. ];
  30896. }
  30897. //# sourceMappingURL=dict.js.map
  30898. function initDesigner () {
  30899. Ext.define('com.yvan.studio.designer', {
  30900. extend: 'Ext.panel.Panel',
  30901. alias: 'widget.designer',
  30902. xtype: 'designer',
  30903. layout: 'fit',
  30904. items: [],
  30905. constructor: function (config) {
  30906. var self = this;
  30907. var newConfig = _$2.defaultsDeep({
  30908. // 强制性属性
  30909. }, config);
  30910. this.superclass.constructor.call(self, newConfig);
  30911. },
  30912. initComponent: function () {
  30913. var me = this;
  30914. me.on({
  30915. afterrender: function () {
  30916. }
  30917. });
  30918. this.superclass.initComponent.call(me);
  30919. }
  30920. });
  30921. }
  30922. //# sourceMappingURL=designer.js.map
  30923. var FixClass = /** @class */ (function () {
  30924. function FixClass() {
  30925. }
  30926. FixClass.prototype.fix = function (me, config) {
  30927. var _this = this;
  30928. if (isDesignMode(me, config)) {
  30929. return;
  30930. }
  30931. if (!config) {
  30932. return;
  30933. }
  30934. var fix = config.fix;
  30935. if (!fix) {
  30936. return;
  30937. }
  30938. delete config.fix;
  30939. // 这里有个 bug
  30940. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  30941. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  30942. var scope;
  30943. if (config.$initParent) {
  30944. // 在面板上的组件
  30945. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30946. }
  30947. else if (config.column) {
  30948. // 在列上的组件
  30949. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30950. }
  30951. if (_$2.isArray(fix)) {
  30952. _$2.each(fix, function (f) {
  30953. var fn = lookupFn(scope, f);
  30954. fn.call(_this, me, config);
  30955. });
  30956. }
  30957. else if (_$2.isString(fix)) {
  30958. var fn = lookupFn(scope, fix);
  30959. fn.call(this, me, config);
  30960. }
  30961. };
  30962. __decorate([
  30963. baseConfigProcess(),
  30964. __metadata("design:type", Function),
  30965. __metadata("design:paramtypes", [Object, Object]),
  30966. __metadata("design:returntype", void 0)
  30967. ], FixClass.prototype, "fix", null);
  30968. return FixClass;
  30969. }());
  30970. //# sourceMappingURL=fix.js.map
  30971. function init$2() {
  30972. // 引入 filters 过滤插件
  30973. Ext.require([
  30974. 'Ext.grid.filters.Filters'
  30975. ]);
  30976. // 启用 tooltip 快捷提示
  30977. Ext.QuickTips.init();
  30978. // 定义日期格式化方法
  30979. if (Ext.util && Ext.util.Format) {
  30980. Ext.apply(Ext.util.Format, {
  30981. dateFormat: 'Y-m-d'
  30982. });
  30983. }
  30984. Ext.form.field.Display.override({
  30985. cls: 'yvan-display-field',
  30986. labelAlign: 'right'
  30987. });
  30988. Ext.define("Ext.locale.zh_CN.picker.Date", {
  30989. override: "Ext.picker.Date",
  30990. format: "Y-m-d",
  30991. });
  30992. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  30993. override: "Ext.form.field.Date",
  30994. format: "Y-m-d",
  30995. });
  30996. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  30997. override: "Ext.grid.PropertyColumnModel",
  30998. format: "Y-m-d",
  30999. });
  31000. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  31001. override: "Ext.view.AbstractView",
  31002. loadingText: "读取中..."
  31003. });
  31004. Ext.LoadMask.prototype.msg = '请稍后...';
  31005. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  31006. override: "Ext.grid.header.Container",
  31007. sortClearText: '不排序',
  31008. sortAscText: "正序",
  31009. sortDescText: "倒序",
  31010. lockText: "锁定列",
  31011. unlockText: "解除锁定",
  31012. columnsText: "字段隐藏"
  31013. });
  31014. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  31015. override: "Ext.grid.filters.filter.Date",
  31016. fields: {
  31017. lt: { text: '之前' },
  31018. gt: { text: '之后' },
  31019. eq: { text: '相等' },
  31020. },
  31021. // Defaults to Ext.Date.defaultFormat
  31022. dateFormat: null
  31023. });
  31024. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  31025. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  31026. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  31027. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  31028. override: "Ext.grid.locking.Lockable",
  31029. lockText: "锁定",
  31030. unlockText: '解锁',
  31031. });
  31032. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  31033. override: "Ext.grid.filters.Filters",
  31034. menuFilterText: "过滤"
  31035. });
  31036. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  31037. override: "Ext.grid.filters.filter.Boolean",
  31038. yesText: "已钩选",
  31039. noText: "未勾选"
  31040. });
  31041. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  31042. override: "Ext.grid.filters.filter.String",
  31043. emptyText: "输入过滤文本..."
  31044. });
  31045. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  31046. override: "Ext.grid.filters.filter.Number",
  31047. emptyText: "输入数字..."
  31048. });
  31049. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  31050. override: "Ext.PagingToolbar",
  31051. beforePageText: "第",
  31052. // update
  31053. afterPageText: "/ {0} 页",
  31054. // update
  31055. firstText: "第一页",
  31056. prevText: "上一页",
  31057. // update
  31058. nextText: "下一页",
  31059. lastText: "最后页",
  31060. refreshText: "刷新",
  31061. displayMsg: "总共 {2} 条",
  31062. // update
  31063. emptyMsg: '没有数据'
  31064. });
  31065. /**
  31066. * 改变事件的获取方式.
  31067. * 具体见: ext-all-debug.js:23216 addListener
  31068. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  31069. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  31070. */
  31071. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  31072. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  31073. if (typeof fn === 'string' &&
  31074. (_$2.startsWith(fn, 'scope.') ||
  31075. _$2.startsWith(fn, 'system.') ||
  31076. _$2.startsWith(fn, 'format.'))) {
  31077. scope = lookupScope(this);
  31078. if (isDesignMode(scope, undefined)) {
  31079. fn = Ext.emptyFn;
  31080. }
  31081. else {
  31082. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  31083. // const vm = this.lookupViewModel()
  31084. // if (vm && vm.yvanScope) {
  31085. // scope = vm.yvanScope
  31086. // fn = scope[fn.substr('scope.'.length)]
  31087. // }
  31088. fn = lookupFn(scope, fn, this);
  31089. }
  31090. }
  31091. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  31092. };
  31093. // 将 SystemLib 扩展到 window.system 下
  31094. if (!window['system']) {
  31095. window['system'] = {};
  31096. }
  31097. _$2.extend(window['system'], SystemLib);
  31098. _$2.extend(window['system'], {
  31099. showGridRowDetail: showGridRowDetail
  31100. });
  31101. Ext.apply(Ext.util.Format, {
  31102. // 百分比
  31103. percentRenderer: function (v, rd, model) {
  31104. if (!v) {
  31105. v = 0;
  31106. }
  31107. if (typeof v === 'string') {
  31108. v = parseInt(v);
  31109. }
  31110. var valueString = v.toFixed(2);
  31111. var valueFixed = v > 100 ? 100 : v;
  31112. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  31113. var cls = '';
  31114. if (v < 90) {
  31115. cls = 'danger';
  31116. }
  31117. else if (v < 100) {
  31118. cls = 'warning';
  31119. }
  31120. else {
  31121. cls = 'success';
  31122. }
  31123. return Ext.String
  31124. .format(
  31125. // '<div>'
  31126. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  31127. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  31128. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  31129. // + '</div></div>', valueString, valueFixed, cls);
  31130. '<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(
  31131. // '<div>'
  31132. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  31133. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  31134. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  31135. // + '</div></div>', v, valueFixed, valueString);
  31136. },
  31137. //button
  31138. button: function (v, rd, model) {
  31139. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  31140. }
  31141. });
  31142. initComponent();
  31143. initPanel();
  31144. initGridColumn();
  31145. initTree();
  31146. initGrid();
  31147. initMainTab();
  31148. initTextfield();
  31149. initCombo();
  31150. initTag();
  31151. initContainer();
  31152. initRows();
  31153. initCols();
  31154. initForm();
  31155. initToolbar();
  31156. initSplitter();
  31157. initButton();
  31158. initStores();
  31159. initSearch();
  31160. initMultipleSearch();
  31161. initDate();
  31162. initDateTimePicker();
  31163. initDateTime();
  31164. initNumber();
  31165. initCheckbox();
  31166. initCheckboxGroup();
  31167. initRadio();
  31168. initRadioGroup();
  31169. initFieldset();
  31170. initCombotree();
  31171. initPickerPlus();
  31172. initCombogrid();
  31173. initComboGridMulti();
  31174. initIframe();
  31175. initBpmn();
  31176. initSqlEditor$1();
  31177. initJsonEditor$1();
  31178. initJsEditor$1();
  31179. initClipboard();
  31180. initSqlComplex();
  31181. initParamComplex();
  31182. initDict$1();
  31183. initDesigner();
  31184. }
  31185. //# sourceMappingURL=init.js.map
  31186. /**
  31187. * 创建一个 Ajax 客户端
  31188. */
  31189. function createAjax(createOption) {
  31190. if (createOption.baseUrl) {
  31191. axios__default.defaults.baseURL = createOption.baseUrl;
  31192. axios__default.defaults.timeout = createOption.timeout;
  31193. storeAjax.timeout = createOption.timeout;
  31194. axios__default.defaults.timeoutErrorMessage = '网络超时';
  31195. }
  31196. return function (option) {
  31197. //@ts-ignore
  31198. option.method = (option.method || 'get').toLocaleLowerCase();
  31199. //@ts-ignore
  31200. var ax = __assign({}, option);
  31201. switch (option.method) {
  31202. case 'get':
  31203. ax.method = 'GET';
  31204. ax.params = option.param;
  31205. ax.headers = __assign({}, option.headers);
  31206. break;
  31207. case 'post':
  31208. ax.method = 'POST';
  31209. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  31210. ax.params = option.param;
  31211. ax.data = Qs.stringify(option.data);
  31212. break;
  31213. case 'put':
  31214. case 'patch':
  31215. case 'delete':
  31216. ax.method = option.method;
  31217. ax.headers = option.headers;
  31218. ax.params = option.param;
  31219. ax.data = Qs.stringify(option.data);
  31220. break;
  31221. case 'download':
  31222. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  31223. return new Promise(function (resolver, reject) {
  31224. });
  31225. case "invoke":
  31226. ax.url = serverInvokeUrlTransform(option.url, option);
  31227. ax.method = 'POST';
  31228. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31229. if (typeof option.args === 'object') {
  31230. ax.data = JSON.stringify({
  31231. args: option.args,
  31232. });
  31233. }
  31234. else {
  31235. ax.data = JSON.stringify({
  31236. args: [
  31237. __assign(__assign({}, option.data), option.param)
  31238. ],
  31239. filterModel: option.filterModel,
  31240. sortModel: option.sortModel
  31241. });
  31242. }
  31243. break;
  31244. case 'post-json':
  31245. ax.method = 'POST';
  31246. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31247. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  31248. break;
  31249. case 'post-file':
  31250. //TODO 刘壮. 上传文件
  31251. var forms = new FormData();
  31252. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  31253. _$2.forOwn(option.data, function (value, key) {
  31254. if (key === 'files') {
  31255. var i_1 = 0;
  31256. _$2.each(value, function (f) {
  31257. // @ts-ignore
  31258. forms.append('file' + (++i_1), f);
  31259. });
  31260. }
  31261. else {
  31262. forms.append(key, value);
  31263. }
  31264. });
  31265. ax.data = forms;
  31266. ax.method = 'POST';
  31267. break;
  31268. case "sql":
  31269. ax.url = sqlUrlTransform(option.url);
  31270. ax.method = 'POST';
  31271. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31272. ax.data = JSON.stringify({
  31273. args: [option.data],
  31274. db: option.db,
  31275. filterModel: option.filterModel,
  31276. sortModel: option.sortModel
  31277. });
  31278. break;
  31279. default:
  31280. throw new Error('not implements');
  31281. }
  31282. return new Promise(function (resolver, reject) {
  31283. axios__default(ax).then(function (resolverRaw) {
  31284. var apiResult = {
  31285. rawData: resolverRaw.data,
  31286. status: resolverRaw.status,
  31287. success: (resolverRaw.data && resolverRaw.data.success),
  31288. data: resolverRaw.data.data,
  31289. pagination: resolverRaw.data.pagination,
  31290. msg: (resolverRaw.data.msg),
  31291. errors: resolverRaw.data.errors,
  31292. headers: resolverRaw.headers
  31293. };
  31294. if (typeof window['apiTranslate'] === 'function') {
  31295. window['apiTranslate'](apiResult.rawData, option.url);
  31296. }
  31297. resolver(apiResult);
  31298. }).catch(function (reason) {
  31299. reject(reason);
  31300. });
  31301. });
  31302. };
  31303. }
  31304. function downLoad(downLoadUrl, filename, data, header, isJson) {
  31305. if (isJson === void 0) { isJson = false; }
  31306. var YvanUI = _$2.get(window, 'YvanUI');
  31307. YvanUI.loading();
  31308. var createObjectURL = function (object) {
  31309. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  31310. };
  31311. // const formData = new FormData();
  31312. // _.forOwn(data, (v, k) => {
  31313. // formData.append(k, v);
  31314. // });
  31315. var formData = '';
  31316. var xhr = new XMLHttpRequest();
  31317. xhr.open('POST', downLoadUrl);
  31318. xhr.responseType = 'blob';
  31319. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  31320. if (isJson) {
  31321. formData = data ? JSON.stringify(data) : '';
  31322. xhr.setRequestHeader('Content-Type', 'application/json');
  31323. }
  31324. else {
  31325. formData = data ? Qs.stringify(data) : '';
  31326. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  31327. }
  31328. //
  31329. if (header) {
  31330. _$2.forOwn(header, function (v, k) {
  31331. xhr.setRequestHeader(k, v);
  31332. });
  31333. }
  31334. xhr.onload = function (e) {
  31335. if (this.status === 200) {
  31336. var blob = this.response;
  31337. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  31338. navigator.msSaveBlob(blob, filename);
  31339. YvanUI.clearLoading();
  31340. }
  31341. else {
  31342. var a = document.createElement('a');
  31343. var url = createObjectURL(blob);
  31344. a.href = url;
  31345. a.download = filename;
  31346. document.append(a);
  31347. a.click();
  31348. a.remove();
  31349. window.URL.revokeObjectURL(url);
  31350. YvanUI.clearLoading();
  31351. }
  31352. }
  31353. };
  31354. xhr.send(formData);
  31355. }
  31356. //# sourceMappingURL=ajax.js.map
  31357. function readExcel(file) {
  31358. return new Promise(function (resolve, reject) {
  31359. if (!file) {
  31360. reject("文件读取失败!!!");
  31361. return;
  31362. }
  31363. var reader = new FileReader();
  31364. reader.onload = function (e) {
  31365. if (e.target) {
  31366. var data = e.target.result;
  31367. var workbook = XLSX.read(data, { type: 'binary' });
  31368. resolve(workbook);
  31369. }
  31370. else {
  31371. reject("文件读取失败!!!");
  31372. }
  31373. };
  31374. try {
  31375. reader.readAsBinaryString(file);
  31376. }
  31377. catch (e) {
  31378. reject(e);
  31379. }
  31380. });
  31381. }
  31382. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  31383. if (dataStartRow === void 0) { dataStartRow = 2; }
  31384. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  31385. if (rowValidate === void 0) { rowValidate = undefined; }
  31386. if (otherValidate === void 0) { otherValidate = undefined; }
  31387. if (fieldValidate === void 0) { fieldValidate = undefined; }
  31388. return new Promise(function (resolve, reject) {
  31389. var promiseArr = [];
  31390. for (var i = 0; i < columnsSet.length; i++) {
  31391. var fix = columnsSet[i].fix;
  31392. if (_$2.isArray(fix) && fix.length > 0) {
  31393. var ss = fix[0].toLowerCase();
  31394. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31395. columnsSet[i].importFormatter = function (vdata) {
  31396. // @ts-ignore
  31397. return window.moment(vdata.ov) - 0;
  31398. };
  31399. }
  31400. else {
  31401. var fn = lookupFn(topScope, fix[0]);
  31402. promiseArr.push(fn(null, columnsSet[i]));
  31403. delete columnsSet[i].fix;
  31404. }
  31405. }
  31406. else if (_$2.isString(fix)) {
  31407. var ss = fix.toLowerCase();
  31408. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31409. columnsSet[i].importFormatter = function (vdata) {
  31410. // @ts-ignore
  31411. return window.moment(vdata.ov) - 0;
  31412. };
  31413. }
  31414. else {
  31415. var fn = lookupFn(topScope, fix);
  31416. promiseArr.push(fn(null, columnsSet[i]));
  31417. delete columnsSet[i].fix;
  31418. }
  31419. }
  31420. }
  31421. var read = function () {
  31422. readExcel(file).then(function (workbook) {
  31423. var sheetNames = workbook.SheetNames; // 工作表名称集合
  31424. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  31425. var titleRowValue = [];
  31426. var titleRowKey = [];
  31427. var needLoop = false; // 是否需要迭代
  31428. var columns = [];
  31429. if (worksheet && worksheet["!ref"]) {
  31430. var t = worksheet["!ref"];
  31431. var tempArr = t.split(':');
  31432. if (tempArr.length >= 2) {
  31433. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  31434. // 选取title的行,删除之前的行
  31435. if (titleRowNumber > firstRowNumber) {
  31436. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  31437. for (var key in worksheet) {
  31438. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  31439. delete worksheet[key];
  31440. }
  31441. }
  31442. }
  31443. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  31444. firstRowNumber = titleRowNumber + '';
  31445. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  31446. }
  31447. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  31448. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  31449. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  31450. for (var key in worksheet) {
  31451. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  31452. titleRowKey.push(key);
  31453. titleRowValue.push(worksheet[key].v);
  31454. }
  31455. }
  31456. if (columnsSet && columnsSet.length > 0) {
  31457. var length = columnsSet.length;
  31458. length = length <= titleRowKey.length ? length : titleRowKey.length;
  31459. for (var i = 0; i < length; i++) {
  31460. var vk = titleRowKey[i];
  31461. var item = columnsSet[i];
  31462. var column = {};
  31463. if (typeof item === 'string') {
  31464. column.dataIndex = item;
  31465. column.header = worksheet[vk].v;
  31466. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  31467. }
  31468. else if (typeof item.dataIndex === "string") {
  31469. column.dataIndex = item.dataIndex;
  31470. column.header = worksheet[vk].v;
  31471. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  31472. if (typeof item.validate === "function") {
  31473. column.validate = item.validate;
  31474. needLoop = true;
  31475. }
  31476. if (typeof item.importFormatter === "function") {
  31477. column.importFormatter = item.importFormatter;
  31478. needLoop = true;
  31479. }
  31480. if ((item.data instanceof Array && item.data.length > 0)
  31481. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  31482. column.data = item.data;
  31483. needLoop = true;
  31484. }
  31485. }
  31486. columns.push(column);
  31487. }
  31488. }
  31489. }
  31490. }
  31491. if (fieldValidate && typeof fieldValidate === "function") {
  31492. if (fieldValidate(columns, titleRowValue) !== true) {
  31493. reject("fields validate error");
  31494. return;
  31495. }
  31496. }
  31497. var allData = XLSX.utils.sheet_to_json(worksheet);
  31498. var okData = [], errorData = [], errorMsgData = [];
  31499. var needItemLoop = needLoop;
  31500. if (rowValidate && typeof rowValidate === "function") {
  31501. needLoop = true;
  31502. }
  31503. if (needLoop === true) {
  31504. for (var index = 0; index < allData.length; index++) {
  31505. var row = allData[index];
  31506. var rowNumber = dataStartRow + index;
  31507. row.__importID__ = rowNumber;
  31508. var isRowOk = true;
  31509. if (needItemLoop) {
  31510. var _loop_1 = function (num) {
  31511. var column = columns[num];
  31512. var ov = row[column.dataIndex];
  31513. var nv = ov;
  31514. var hasError = false;
  31515. var rowNumber_1 = dataStartRow + index;
  31516. var ei = {
  31517. errorId: rowNumber_1 + '_' + column.dataIndex,
  31518. importID: rowNumber_1,
  31519. dataIndex: column.dataIndex,
  31520. header: column.header,
  31521. value: ov,
  31522. errormessage: ""
  31523. };
  31524. // 格式化
  31525. if (column.data instanceof Array) {
  31526. nv = undefined;
  31527. ei.errormessage = "字典匹配失败";
  31528. _$2.forEach(column.data, function (v, index) {
  31529. if (v.text === ov) {
  31530. nv = v.id;
  31531. return;
  31532. }
  31533. });
  31534. }
  31535. else if (_$2.isPlainObject(column.data)) {
  31536. nv = undefined;
  31537. ei.errormessage = "字典匹配失败";
  31538. _$2.forEach(column.data, function (value, key) {
  31539. if (value === ov) {
  31540. nv = key;
  31541. return;
  31542. }
  31543. });
  31544. }
  31545. if (typeof column.importFormatter === 'function') {
  31546. var vdata = {
  31547. column: column,
  31548. ov: ov,
  31549. nv: nv,
  31550. rowIndex: index,
  31551. data: row,
  31552. rowDatas: allData
  31553. };
  31554. nv = undefined;
  31555. ei.errormessage = "格式化失败";
  31556. nv = column.importFormatter(vdata);
  31557. }
  31558. if (!nv && nv != 0) {
  31559. hasError = true;
  31560. }
  31561. else {
  31562. row[column.dataIndex] = nv;
  31563. ei.errormessage = "";
  31564. }
  31565. // 校验
  31566. if (typeof column.validate === 'function') {
  31567. var vdata = {
  31568. column: column,
  31569. ov: ov,
  31570. nv: nv,
  31571. rowIndex: index,
  31572. data: row,
  31573. rowDatas: allData
  31574. };
  31575. var errormessage = column.validate(vdata);
  31576. if (errormessage === true) ;
  31577. else {
  31578. hasError = true;
  31579. ei.errormessage = ei.errormessage + "/" + errormessage;
  31580. }
  31581. }
  31582. if (hasError === true) {
  31583. isRowOk = false;
  31584. errorMsgData.push(ei);
  31585. }
  31586. };
  31587. for (var num = 0; num < columns.length; num++) {
  31588. _loop_1(num);
  31589. }
  31590. }
  31591. if (rowValidate && typeof rowValidate === "function") {
  31592. var errormessage = rowValidate({
  31593. columns: columns,
  31594. data: row,
  31595. rowIndex: index,
  31596. rowDatas: allData
  31597. });
  31598. if (errormessage === true) ;
  31599. else {
  31600. isRowOk = false;
  31601. var ei = {
  31602. errorId: rowNumber + '',
  31603. dataIndex: "row",
  31604. header: "数据行",
  31605. value: "当前行的数据",
  31606. importID: rowNumber,
  31607. errormessage: errormessage
  31608. };
  31609. errorMsgData.push(ei);
  31610. }
  31611. }
  31612. row.__hasError__ = !isRowOk;
  31613. if (isRowOk === true) {
  31614. okData.push(row);
  31615. }
  31616. else {
  31617. errorData.push(row);
  31618. }
  31619. }
  31620. }
  31621. else {
  31622. // 添加数据的唯一标识
  31623. for (var index = 0; index < allData.length; index++) {
  31624. var row = allData[index];
  31625. var rowNumber = dataStartRow + index;
  31626. row.__importID__ = rowNumber;
  31627. row.__hasError__ = false;
  31628. }
  31629. okData = allData;
  31630. }
  31631. if (otherValidate && typeof otherValidate === "function") {
  31632. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  31633. }
  31634. else {
  31635. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  31636. }
  31637. // clearLoading()
  31638. }).catch(function (e) {
  31639. reject(e);
  31640. });
  31641. };
  31642. if (promiseArr.length > 0) {
  31643. Promise.all(promiseArr).then(function (resArr) {
  31644. for (var i = 0; i < resArr.length; i++) {
  31645. var tmp = resArr[i];
  31646. tmp.config.data = [];
  31647. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  31648. if (tmp.r.field.length > 1) {
  31649. var keyKey = tmp.r.field[0];
  31650. var valueKey = tmp.r.field[1];
  31651. for (var j = 0; j < tmp.r.data.length; j++) {
  31652. var it = tmp.r.data[j];
  31653. var newIt = {};
  31654. newIt.id = it[keyKey];
  31655. newIt.text = it[valueKey];
  31656. tmp.config.data.push(newIt);
  31657. }
  31658. }
  31659. }
  31660. }
  31661. read();
  31662. });
  31663. }
  31664. else {
  31665. setTimeout(read, 50);
  31666. }
  31667. });
  31668. }
  31669. //# sourceMappingURL=xlsx.js.map
  31670. var ExcelImportDialog = /** @class */ (function (_super) {
  31671. __extends(ExcelImportDialog, _super);
  31672. function ExcelImportDialog(option) {
  31673. var _this = this;
  31674. var vjson = vjsonFunc(option);
  31675. _this = _super.call(this, { model: model$p, vjson: vjson }) || this;
  31676. _this.importExcelOption = option;
  31677. return _this;
  31678. }
  31679. ExcelImportDialog.prototype.onLoad = function () {
  31680. _super.prototype.onLoad.call(this);
  31681. };
  31682. ExcelImportDialog.prototype.fileChange = function (sender) {
  31683. var _this = this;
  31684. var file = sender.fileInputEl.dom.files[0];
  31685. // const senderScope = lookupScope(sender)
  31686. var topScope = this.topScope;
  31687. var rowValidate = this.importExcelOption.rowValidate;
  31688. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  31689. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  31690. }
  31691. var afterClientValidate = this.importExcelOption.afterClientValidate;
  31692. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  31693. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  31694. }
  31695. var fieldValidate = this.importExcelOption.fieldValidate;
  31696. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  31697. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  31698. }
  31699. this.setLoading(true);
  31700. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  31701. _this.importData = res;
  31702. _this.refs.dataGrid.setData(res.allData);
  31703. _this.viewModel.set("dataCount", res.allData.length);
  31704. _this.refs.errGrid.setData(res.errorMsgData);
  31705. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  31706. }).catch(function (e) {
  31707. _this.importData = null;
  31708. _this.refs.dataGrid.setData();
  31709. _this.refs.errGrid.setData();
  31710. msg(e.toString());
  31711. }).finally(function () {
  31712. _this.setLoading(false);
  31713. });
  31714. };
  31715. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  31716. if (record.get('__hasError__')) {
  31717. return "x-grid-record-bg-red";
  31718. }
  31719. };
  31720. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  31721. return "x-grid-record-bg-red";
  31722. };
  31723. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  31724. var _a;
  31725. var id = record.data.__importID__;
  31726. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  31727. var selectRecord = null;
  31728. var dataIndex = -1;
  31729. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31730. for (var i = 0; i < rows.length; i++) {
  31731. if (rows[i].importID === id) {
  31732. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31733. dataIndex = i;
  31734. }
  31735. if (rows[i].errorId === id + "_" + subId) {
  31736. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31737. dataIndex = i;
  31738. break;
  31739. }
  31740. }
  31741. if (selectRecord) {
  31742. this.refs.errGrid.ensureVisible(selectRecord);
  31743. this.refs.errGrid.selModel.select(dataIndex);
  31744. // this.refs.errGrid.reload()
  31745. }
  31746. };
  31747. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  31748. var _a;
  31749. var id = record.data.importID;
  31750. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31751. var selectRecord = null;
  31752. var dataIndex = -1;
  31753. for (var i = 0; i < rows.length; i++) {
  31754. if (rows[i].__importID__ === id) {
  31755. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  31756. dataIndex = i;
  31757. break;
  31758. }
  31759. }
  31760. if (selectRecord) {
  31761. this.refs.dataGrid.ensureVisible(selectRecord);
  31762. this.refs.dataGrid.selModel.select(dataIndex);
  31763. // this.refs.dataGrid.reload()
  31764. }
  31765. };
  31766. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  31767. this.viewModel.set("dataType", newValue);
  31768. if (this.importData) {
  31769. this.refs.dataGrid.setData(this.importData[newValue]);
  31770. this.viewModel.set("dataCount", this.importData[newValue].length);
  31771. }
  31772. };
  31773. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  31774. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  31775. window.location.href = this.importExcelOption.dowLoadUrl;
  31776. return;
  31777. }
  31778. var xt = [];
  31779. _$2.forEach(this.importExcelOption.columns, function (v) {
  31780. xt.push(v.header);
  31781. });
  31782. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  31783. if (filename.endsWith(".xlsx")) {
  31784. filename = filename.split(".xlsx")[0];
  31785. }
  31786. filename = filename + ".xlsx";
  31787. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  31788. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  31789. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  31790. XLSX.writeFile(wb, filename); //导出Excel
  31791. };
  31792. ExcelImportDialog.prototype.getData = function (sender) {
  31793. _$2.each(this.importData.okData, function (item) {
  31794. delete item.id;
  31795. delete item.__hasError__;
  31796. delete item.__importID__;
  31797. delete item._origin;
  31798. });
  31799. _$2.each(this.importData.allData, function (item) {
  31800. delete item.id;
  31801. delete item.__hasError__;
  31802. delete item.__importID__;
  31803. delete item._origin;
  31804. });
  31805. _$2.each(this.importData.errorData, function (item) {
  31806. delete item.id;
  31807. delete item.__hasError__;
  31808. delete item.__importID__;
  31809. delete item._origin;
  31810. });
  31811. this.dialogSuccess(this.importData);
  31812. };
  31813. return ExcelImportDialog;
  31814. }(Scope));
  31815. var model$p = {
  31816. data: {
  31817. dataType: "all",
  31818. errMsgCount: 0,
  31819. dataCount: 0
  31820. }
  31821. };
  31822. var vjsonFunc = function (option) {
  31823. return {
  31824. title: option.title || 'excel导入',
  31825. layout: 'fit',
  31826. items: [
  31827. {
  31828. layout: 'border',
  31829. tbar: {
  31830. xtype: "form",
  31831. items: [
  31832. {
  31833. xtype: "cols",
  31834. items: [
  31835. {
  31836. xtype: "filefield",
  31837. fieldLabel: 'excel文件',
  31838. buttonText: '请选择excel文件',
  31839. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  31840. flex: 3,
  31841. listeners: {
  31842. change: "scope.fileChange"
  31843. }
  31844. }, {
  31845. xtype: "button",
  31846. iconCls: "x-fa fa-download",
  31847. text: "下载模版",
  31848. listeners: {
  31849. click: "scope.downloadTemplate"
  31850. }
  31851. }, {
  31852. xtype: 'container',
  31853. border: false,
  31854. layout: 'hbox',
  31855. }, {
  31856. xtype: "button",
  31857. iconCls: "x-fa fa-upload",
  31858. text: option.tQButtonText || "提取数据",
  31859. listeners: {
  31860. click: "scope.getData"
  31861. }
  31862. }
  31863. ]
  31864. },
  31865. ]
  31866. },
  31867. items: [
  31868. {
  31869. tbar: {
  31870. xtype: "toolbar",
  31871. title: "导入的数据",
  31872. items: [{
  31873. xtype: 'label',
  31874. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  31875. }, {
  31876. xtype: 'radiogroup',
  31877. items: [
  31878. {
  31879. boxLabel: '所有数据',
  31880. checked: true,
  31881. inputValue: 'allData',
  31882. }, {
  31883. boxLabel: '正确数据',
  31884. inputValue: 'okData',
  31885. }, {
  31886. boxLabel: '错误数据',
  31887. inputValue: 'errorData',
  31888. }
  31889. ],
  31890. listeners: {
  31891. change: 'scope.filterData',
  31892. },
  31893. }, {
  31894. xtype: "textfield",
  31895. readOnly: true,
  31896. fieldLabel: "条目数",
  31897. bind: "{dataCount}"
  31898. }]
  31899. },
  31900. xtype: 'yvgrid',
  31901. reference: 'dataGrid',
  31902. layout: 'fit',
  31903. pagination: false,
  31904. // pageSize: 50,
  31905. getRowClass: 'scope.getDataGridRowRecord',
  31906. columns: option.columns,
  31907. region: 'center',
  31908. split: true,
  31909. listeners: {
  31910. cellclick: "scope.dataGridClick",
  31911. },
  31912. selModel: {
  31913. // type: 'rowmodel',
  31914. mode: 'SINGLE',
  31915. },
  31916. }, {
  31917. tbar: {
  31918. xtype: "toolbar", items: [
  31919. {
  31920. xtype: 'label',
  31921. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  31922. }, {
  31923. xtype: "textfield",
  31924. readOnly: true,
  31925. fieldLabel: "条目数",
  31926. bind: "{errMsgCount}"
  31927. }
  31928. ]
  31929. },
  31930. xtype: 'yvgrid',
  31931. reference: 'errGrid',
  31932. layout: 'fit',
  31933. pagination: false,
  31934. getRowClass: 'scope.getErrGridRowRecord',
  31935. height: "40%",
  31936. columns: [
  31937. { dataIndex: "errorId", header: "ID", hidden: true },
  31938. { dataIndex: "importID", header: "行号", width: 80 },
  31939. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  31940. { dataIndex: "value", header: "值", width: 120 },
  31941. { dataIndex: "header", header: "字段名", width: 120 },
  31942. { dataIndex: "dataIndex", header: "字段", width: 120 }
  31943. ],
  31944. region: 'south',
  31945. split: true,
  31946. listeners: {
  31947. itemclick: "scope.errGridClick"
  31948. },
  31949. selModel: {
  31950. // type: 'rowmodel',
  31951. mode: 'SINGLE',
  31952. },
  31953. },
  31954. ],
  31955. },
  31956. ],
  31957. referenceHolder: true,
  31958. };
  31959. };
  31960. //# sourceMappingURL=ExcelImportDialog.js.map
  31961. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  31962. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  31963. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  31964. ret.report_id = reportId;
  31965. ret.report = report;
  31966. return ret;
  31967. }
  31968. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  31969. var e_1, _a, e_2, _b;
  31970. var model = {
  31971. data: {
  31972. report_name: config.report_name,
  31973. query: {},
  31974. sum: {},
  31975. }
  31976. };
  31977. var json5 = window['YvanUI'].json5;
  31978. var report = config.report ? json5.parse(config.report) : {};
  31979. var conditionRows = [];
  31980. var sumRows = [];
  31981. model.data.has_sum = _$2.size(report.summary) > 0;
  31982. // query 查询条件
  31983. var newRow = false;
  31984. var currentRow = { xtype: 'cols', items: [], };
  31985. conditionRows.push(currentRow);
  31986. _$2.forEach(report.query, function (item) {
  31987. if (newRow) {
  31988. currentRow = { xtype: 'cols', items: [], };
  31989. conditionRows.push(currentRow);
  31990. }
  31991. var vj = json5.parse(item.conditionFieldExtend);
  31992. if (item.conditionFieldXtype) {
  31993. vj.xtype = item.conditionFieldXtype;
  31994. if (item.conditionFieldXtype === 'combo') {
  31995. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  31996. }
  31997. if (item.conditionFieldXtype === 'datetimefield') {
  31998. //@ts-ignore
  31999. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  32000. }
  32001. else if (item.conditionFieldXtype === 'datefield') {
  32002. //@ts-ignore
  32003. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  32004. }
  32005. else {
  32006. model.data.query[item.conditionFieldBind] = '';
  32007. }
  32008. }
  32009. else {
  32010. // 没有组件类型,是个空占位符
  32011. vj.border = false;
  32012. }
  32013. if (item.conditionFieldBind) {
  32014. vj.bind = {
  32015. value: '{query.' + item.conditionFieldBind + '}'
  32016. };
  32017. }
  32018. if (item.conditionFieldFlex) {
  32019. vj.flex = item.conditionFieldFlex;
  32020. }
  32021. if (item.conditionFieldXtype) {
  32022. vj.fieldLabel = item.conditionFieldLabel;
  32023. }
  32024. if (item.fieldLabel) {
  32025. vj.fieldLabel = item.fieldLabel;
  32026. }
  32027. newRow = item.conditionFieldWrap || false;
  32028. currentRow.items.push(vj);
  32029. });
  32030. if (currentRow) {
  32031. currentRow.margin = '10 0 10 0';
  32032. }
  32033. // sum 汇总条件
  32034. newRow = true;
  32035. try {
  32036. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  32037. var item = _d.value;
  32038. if (newRow) {
  32039. currentRow = {
  32040. xtype: 'cols',
  32041. defaultType: 'displayfield',
  32042. defaults: {
  32043. labelWidth: 70,
  32044. },
  32045. items: []
  32046. };
  32047. sumRows.push(currentRow);
  32048. }
  32049. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  32050. if (item.sumFieldBind) {
  32051. vj.bind = '{sum.' + item.sumFieldBind + '}';
  32052. model.data.sum[item.sumFieldBind] = '';
  32053. }
  32054. else {
  32055. // 没有组件类型,是个空占位符
  32056. vj.border = false;
  32057. }
  32058. if (item.sumFieldFlex) {
  32059. vj.flex = item.sumFieldFlex;
  32060. }
  32061. if (item.sumFieldLabel) {
  32062. vj.fieldLabel = item.sumFieldLabel;
  32063. }
  32064. // sumFieldBind: "zs"
  32065. // sumFieldExtend: "{}"
  32066. // sumFieldFlex: 1
  32067. // sumFieldLabel: "总数"
  32068. // sumFieldWrap: false
  32069. newRow = item.sumFieldWrap || false;
  32070. currentRow.items.push(vj);
  32071. }
  32072. }
  32073. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  32074. finally {
  32075. try {
  32076. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  32077. }
  32078. finally { if (e_1) throw e_1.error; }
  32079. }
  32080. if (currentRow) {
  32081. currentRow.margin = '10 0 10 0';
  32082. }
  32083. // column 结果字段
  32084. var columns = [];
  32085. try {
  32086. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  32087. var item = _f.value;
  32088. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  32089. if (item.xtype) {
  32090. if (item.xtype == 'checkbox') {
  32091. vj.xtype = 'checkcolumn';
  32092. vj.disabled = true;
  32093. }
  32094. else {
  32095. vj.xtype = item.xtype;
  32096. }
  32097. }
  32098. if (item.dataType) {
  32099. vj.dataType = item.dataType;
  32100. }
  32101. if (item.align) {
  32102. vj.align = item.align;
  32103. }
  32104. if (item.width) {
  32105. vj.width = item.width;
  32106. }
  32107. if (item.dict) {
  32108. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  32109. }
  32110. columns.push(vj);
  32111. }
  32112. }
  32113. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  32114. finally {
  32115. try {
  32116. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  32117. }
  32118. finally { if (e_2) throw e_2.error; }
  32119. }
  32120. var vjson = {
  32121. bind: {
  32122. title: '{report_name}',
  32123. },
  32124. layout: 'fit',
  32125. referenceHolder: true,
  32126. items: [
  32127. {
  32128. layout: 'border',
  32129. border: false,
  32130. items: [
  32131. {
  32132. region: 'north',
  32133. border: false,
  32134. tbar: {
  32135. xtype: 'toolbar',
  32136. border: false,
  32137. items: [
  32138. {
  32139. xtype: 'button',
  32140. text: '查询',
  32141. reference: 'btnSearch',
  32142. iconCls: 'x-fa fa-search',
  32143. listeners: {
  32144. click: 'scope.reload',
  32145. },
  32146. },
  32147. {
  32148. xtype: 'button',
  32149. text: '关闭',
  32150. iconCls: 'x-fa fa-times',
  32151. listeners: {
  32152. click: 'system.closeMe()',
  32153. },
  32154. },
  32155. ],
  32156. },
  32157. defaults: {
  32158. margin: '8 0 0 0'
  32159. },
  32160. items: __spread(conditionRows, sumRows),
  32161. fix: ['system.enterToClick("btnSearch")'],
  32162. },
  32163. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  32164. method: 'invoke',
  32165. url: '/report/Report@execute',
  32166. params: {
  32167. dataSource: report.dataSource,
  32168. pagination: report.grid.pagination || true,
  32169. report_id: config.report_id,
  32170. query: '{query}',
  32171. },
  32172. }, columns: columns }, report.grid),
  32173. ],
  32174. },
  32175. ],
  32176. };
  32177. return { model: model, vjson: vjson, report: report };
  32178. }
  32179. var ReportScope = /** @class */ (function (_super) {
  32180. __extends(ReportScope, _super);
  32181. function ReportScope(_a, invokeServerFn) {
  32182. var model = _a.model, vjson = _a.vjson;
  32183. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  32184. _this.invokeServerFn = invokeServerFn;
  32185. return _this;
  32186. }
  32187. ReportScope.prototype.onLoad = function () {
  32188. // this.reload()
  32189. };
  32190. ReportScope.prototype.reload = function () {
  32191. var _this = this;
  32192. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  32193. if (this.viewModel.get('has_sum')) {
  32194. this.invokeServerFn('/report/Report@executeSum', {
  32195. dataSource: this.report.dataSource,
  32196. report_id: this.report_id,
  32197. query: this.viewModel.get('query'),
  32198. }).then(function (res) {
  32199. if (!res.success) {
  32200. showErrorDialog$1(res.msg);
  32201. }
  32202. else {
  32203. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  32204. }
  32205. });
  32206. }
  32207. this.refs.grid1.reload();
  32208. };
  32209. return ReportScope;
  32210. }(Scope));
  32211. //# sourceMappingURL=Report.js.map
  32212. var studio = {
  32213. init: init$1,
  32214. handles: handles$1,
  32215. Workbench: Workbench
  32216. };
  32217. //# sourceMappingURL=index.js.map
  32218. exports.axios = axios;
  32219. exports.qs = Qs;
  32220. exports.lodash = _$2;
  32221. exports.jquery = $$2;
  32222. exports.moment = moment$1;
  32223. exports.recast = recast;
  32224. exports.XLSX = XLSX;
  32225. exports.Defaults = Defaults;
  32226. exports.ExcelImportDialog = ExcelImportDialog;
  32227. exports.Lib = Lib;
  32228. exports.LibParam = LibParam;
  32229. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32230. exports.ReportScope = ReportScope;
  32231. exports.SIMPLE_RE = SIMPLE_RE;
  32232. exports.Scope = Scope;
  32233. exports.ScopeEngine = ScopeEngine;
  32234. exports.SystemEventFu = SystemEventFu;
  32235. exports.ajax = ajax;
  32236. exports.baseConfigProcess = baseConfigProcess;
  32237. exports.baseConfigProcessList = baseConfigProcessList;
  32238. exports.buildPlus = buildPlus;
  32239. exports.buildReportScope = buildReportScope;
  32240. exports.calcExpress = calcExpress;
  32241. exports.calcObject = calcObject;
  32242. exports.calcObjectFlat = calcObjectFlat;
  32243. exports.clearViewModel = clearViewModel;
  32244. exports.clearViewModelByLookup = clearViewModelByLookup;
  32245. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32246. exports.clearViewModelValues = clearViewModelValues;
  32247. exports.commitMe = commitMe;
  32248. exports.confirm = confirm;
  32249. exports.createAjax = createAjax;
  32250. exports.createUUID = createUUID;
  32251. exports.deepTravJson = deepTravJson;
  32252. exports.downLoad = downLoad;
  32253. exports.evalFunction = evalFunction;
  32254. exports.extend = extend;
  32255. exports.flatRow = flatRow;
  32256. exports.getApiConvert = getApiConvert;
  32257. exports.getGridEditRows = getGridEditRows;
  32258. exports.getParentGrid = getParentGrid;
  32259. exports.getPinyin = getPinyin;
  32260. exports.getRegList = getRegList;
  32261. exports.getRegParamList = getRegParamList;
  32262. exports.getScopeOnCreate = getScopeOnCreate;
  32263. exports.init = init$2;
  32264. exports.insertGridRow = insertGridRow;
  32265. exports.invokeServer = invokeServer$1;
  32266. exports.isDesignMode = isDesignMode;
  32267. exports.isEmpty = isEmpty;
  32268. exports.json5 = dist;
  32269. exports.keywordFilter = keywordFilter;
  32270. exports.lookupFn = lookupFn;
  32271. exports.lookupScope = lookupScope;
  32272. exports.mergeViewModel = mergeViewModel;
  32273. exports.moveDownGridRow = moveDownGridRow;
  32274. exports.moveUpGridRow = moveUpGridRow;
  32275. exports.msg = msg$1;
  32276. exports.msgError = msgError;
  32277. exports.normId = normId;
  32278. exports.pinyinMatch = pinyinMatch;
  32279. exports.prompt = prompt$2;
  32280. exports.raiseClick = raiseClick;
  32281. exports.reloadGrid = reloadGrid;
  32282. exports.removeGridRow = removeGridRow;
  32283. exports.replaceNA = replaceNA;
  32284. exports.saveGridRow = saveGridRow;
  32285. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32286. exports.setComboStore = setComboStore;
  32287. exports.showErrorDialog = showErrorDialog$1;
  32288. exports.showInfoDialog = showInfoDialog;
  32289. exports.showWidget = showWidget;
  32290. exports.sqlUrlTransform = sqlUrlTransform;
  32291. exports.stopEvent = stopEvent;
  32292. exports.studio = studio;
  32293. exports.toPlainObject = toPlainObject;
  32294. exports.toString = toString;
  32295. exports.tryEnable = tryEnable;
  32296. exports.tryVarSimple = tryVarSimple;
  32297. exports.tryWriteByExpress = tryWriteByExpress;
  32298. exports.tryWriteObject = tryWriteObject;
  32299. exports.watch = watch;
  32300. Object.defineProperty(exports, '__esModule', { value: true });
  32301. });
  32302. //# sourceMappingURL=yvan-ext.js.map